aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:20 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:20 +0100
commit83c67f8e304d7e6baf85aa0ea285d7664a4f90cd (patch)
tree27581a0fb4b094bd4d4185cdcec3ca6a78602525 /examples
parentde0f306ffcdf540c16ff2f89d99790c7f2b541fc (diff)
feat(render): handle resizing properly
Diffstat (limited to 'examples')
-rw-r--r--examples/render-quad/src/main.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/render-quad/src/main.rs b/examples/render-quad/src/main.rs
index 130bc5e..f04fca7 100644
--- a/examples/render-quad/src/main.rs
+++ b/examples/render-quad/src/main.rs
@@ -107,19 +107,23 @@ fn main() {
*flow = ControlFlow::Poll;
match event {
- // TODO: Handle resize
Event::WindowEvent {
- event: WindowEvent::CloseRequested,
+ event: WindowEvent::CloseRequested,
..
} => {
*flow = ControlFlow::Exit
- },
+ }
Event::MainEventsCleared => {
window.request_redraw()
},
Event::RedrawRequested(_) => {
- ctx.draw_vertices().unwrap();
+ if let Err(err) = ctx.draw_vertices() {
+ unsafe {ctx.handle_surface_change().unwrap()};
+
+ // If it fails twice, then panic
+ ctx.draw_vertices().unwrap();
+ }
}
_ => ()
}