diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index a50eec1..68ecd55 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,7 +139,7 @@ impl ApplicationHandler for SystemicApp None => return }; - window.on_event(&event); + let event_resp = window.on_event(&event); match event { WindowEvent::CloseRequested => { @@ -156,14 +156,17 @@ impl ApplicationHandler for SystemicApp game_state.borrow_mut().update(delta_time); window.update(game_state, delta_time); - match window.render(game_state) { + match window.render(game_state, event_resp) { Ok(_) => {} - Err(wgpu::SurfaceError::Outdated | wgpu::SurfaceError::Lost) => { + Err(wgpu::CurrentSurfaceTexture::Suboptimal(_) | + wgpu::CurrentSurfaceTexture::Outdated | + wgpu::CurrentSurfaceTexture::Lost + ) => { let size = window.size(); window.resize(size.width, size.height); }, - Err(e) => { - log::error!("Unable to render: {}", e); + Err(_) => { + log::error!("Uncaught error while trying to render!"); } } if delta_time < TARGET_DT { @@ -178,7 +181,9 @@ impl ApplicationHandler for SystemicApp }, .. } => { - window.keyboard_input(key_code, key_state); + if !event_resp.consumed { + window.keyboard_input(key_code, key_state); + } } _ => {} } |
