diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-05-12 19:01:27 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-05-12 19:01:27 -0400 |
| commit | a0a3b3974cab754c10a1517d82762b99482970ce (patch) | |
| tree | 8aeb0ca1e007bacecc8e12a263bd5aa321b8f69a /src/main.rs | |
| parent | 7f63ec5c10eb7e8dd4edaabd1a6a437328911d39 (diff) | |
| download | systemic4x-a0a3b3974cab754c10a1517d82762b99482970ce.tar.gz systemic4x-a0a3b3974cab754c10a1517d82762b99482970ce.tar.bz2 systemic4x-a0a3b3974cab754c10a1517d82762b99482970ce.zip | |
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); + } } _ => {} } |
