Added input handling
This commit is contained in:
parent
661af7c1fb
commit
354cb8718d
@ -48,6 +48,13 @@ impl<'a> ApplicationHandler for StateApplication<'a>{
|
|||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
self.state.as_mut().unwrap().render().unwrap();
|
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 {
|
fn create_surface_config(size: PhysicalSize<u32>, capabilities: SurfaceCapabilities) -> wgpu::SurfaceConfiguration {
|
||||||
let surface_format = capabilities.formats.iter()
|
let surface_format = capabilities.formats.iter()
|
||||||
.find(|f| f.is_srgb())
|
.find(|f| f.is_srgb())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user