From 354cb8718d20a7c370bc7eeef97d32d609aaa790 Mon Sep 17 00:00:00 2001 From: Verox001 Date: Sun, 4 May 2025 01:20:26 +0200 Subject: [PATCH] Added input handling --- simulator/src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/simulator/src/main.rs b/simulator/src/main.rs index b99871e..bee04fb 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -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, capabilities: SurfaceCapabilities) -> wgpu::SurfaceConfiguration { let surface_format = capabilities.formats.iter() .find(|f| f.is_srgb())