mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Handle RedrawRequested event in request_redraw example (#1030)
This commit is contained in:
parent
c1f314ccdc
commit
f5c624bcd6
|
@ -14,19 +14,21 @@ fn main() {
|
||||||
.build(&event_loop)
|
.build(&event_loop)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| match event {
|
||||||
println!("{:?}", event);
|
Event::WindowEvent {
|
||||||
|
event: WindowEvent::CloseRequested,
|
||||||
match event {
|
..
|
||||||
Event::WindowEvent {
|
} => *control_flow = ControlFlow::Exit,
|
||||||
event: WindowEvent::CloseRequested,
|
Event::EventsCleared => {
|
||||||
..
|
window.request_redraw();
|
||||||
} => *control_flow = ControlFlow::Exit,
|
*control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0))
|
||||||
Event::EventsCleared => {
|
|
||||||
window.request_redraw();
|
|
||||||
*control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0))
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
Event::WindowEvent {
|
||||||
|
event: WindowEvent::RedrawRequested,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
println!("{:?}", event);
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue