add uw8-window crate

This commit is contained in:
2022-07-08 22:11:00 +02:00
parent 7aa70ef39d
commit b0adf7748d
9 changed files with 2395 additions and 0 deletions

19
uw8-window/src/lib.rs Normal file
View File

@@ -0,0 +1,19 @@
use std::time::Instant;
mod cpu;
mod gpu;
pub fn run<F: 'static + FnMut(&mut dyn Framebuffer, u32, bool) -> Instant>(update: F) -> ! {
match gpu::Window::new() {
Ok(window) => window.run(Box::new(update)),
Err(err) => eprintln!(
"Failed to create gpu window: {}\nFalling back to cpu window",
err
),
}
cpu::run(Box::new(update));
}
pub trait Framebuffer {
fn update(&mut self, pixels: &[u8], palette: &[u8]);
}