Add methods to set ControlFlow operation

This allows downstream users to avoid importing `ControlFlow` from winit.
This commit is contained in:
Steve Wooster
2022-04-09 18:32:02 -07:00
committed by GitHub
parent c57294b41a
commit d624a3e648
27 changed files with 120 additions and 86 deletions

View File

@@ -5,7 +5,7 @@ fn main() {
use simple_logger::SimpleLogger;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
event_loop::EventLoop,
window::WindowBuilder,
};
@@ -25,11 +25,11 @@ fn main() {
event_loop.run(move |event, _, control_flow| {
println!("{:?}", event);
*control_flow = ControlFlow::Wait;
control_flow.set_wait();
match event {
Event::WindowEvent { event, .. } => match event {
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
WindowEvent::CloseRequested => control_flow.set_exit(),
_ => (),
},
Event::RedrawRequested(_) => {