keyboard input is working for cpu window again

This commit is contained in:
2022-07-09 13:18:51 +02:00
parent f559c5b7d4
commit eb724e8785
4 changed files with 35 additions and 15 deletions

View File

@@ -3,13 +3,18 @@ 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
),
pub fn run<F: 'static + FnMut(&mut dyn Framebuffer, u32, bool) -> Instant>(
gpu: bool,
update: F,
) -> ! {
if gpu {
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));
}