You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.1 KiB

#![cfg(not(test))]
use blonkus_fw as fw;
fn entry(conf: &fw::conf::Conf) -> Result<(), Box<dyn std::error::Error>> {
let mut vfs = fw::data::vfs::Vfs::default();
vfs.add_path("testres")?;
let hal = fw::hal::ctx::Context::new()?;
let win = fw::hal::win::Window::new(&hal, fw::c_str!("BLONKUS"), 640, 480)?;
let mut ren = fw::render::Renderer::new(
&win,
&conf.render,
&[fw::data::shader::Module::compile(
vfs.get("main.wgsl").unwrap().data(),
)?],
)?;
'main_loop: loop {
for event in fw::hal::evt::EventIterator::new(&hal) {
match event {
| fw::hal::evt::Event::Quit => {
break 'main_loop;
}
| _ => {}
}
}
ren.draw_frame()?;
}
Ok(())
}
fn main() {
const LOG: fw::types::io::Log = fw::types::io::Log;
log::set_logger(&LOG).unwrap();
log::set_max_level(log::LevelFilter::Trace);
log::info!("Begin logging.");
let conf = fw::conf::Conf::read("blonkus.toml").unwrap_or_else(|err| {
match err {
| fw::conf::Err::NoFile => log::info!("{}", err),
| _ => log::warn!("{}", err),
};
log::info!("Using default configuration.");
fw::conf::Conf::default()
});
entry(&conf).unwrap();
}
// EOF