Added input handling

This commit is contained in:
Verox001 2025-05-04 01:20:26 +02:00
parent 661af7c1fb
commit 354cb8718d

View File

@ -48,6 +48,13 @@ impl<'a> ApplicationHandler for StateApplication<'a>{
WindowEvent::RedrawRequested => {
self.state.as_mut().unwrap().render().unwrap();
}
WindowEvent::KeyboardInput { .. } => {
if let Some(state) = self.state.as_mut() {
if state.input(&event) {
return;
}
}
}
_ => {}
}
}
@ -91,6 +98,14 @@ impl<'a> State<'a> {
}
}
pub fn input(&mut self, event: &WindowEvent) -> bool {
false
}
fn update(&mut self) {
// TODO: Update logic here
}
fn create_surface_config(size: PhysicalSize<u32>, capabilities: SurfaceCapabilities) -> wgpu::SurfaceConfiguration {
let surface_format = capabilities.formats.iter()
.find(|f| f.is_srgb())