Move ControlFlow to EventLoopWindowTarget

Fixes #3042.
This commit is contained in:
daxpedda
2023-09-07 08:25:04 +02:00
committed by Kirill Chibisov
parent 42243ce288
commit 48647b506f
60 changed files with 800 additions and 860 deletions

View File

@@ -3,7 +3,7 @@
use simple_logger::SimpleLogger;
use winit::{
event::{ElementState, Event, WindowEvent},
event_loop::EventLoop,
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};
@@ -19,14 +19,14 @@ fn main() -> Result<(), impl std::error::Error> {
.build(&event_loop)
.unwrap();
event_loop.run(move |event, _, control_flow| {
event_loop.run(move |event, elwt| {
println!("{event:?}");
control_flow.set_wait();
elwt.set_control_flow(ControlFlow::Wait);
if let Event::WindowEvent { event, .. } = event {
match event {
WindowEvent::CloseRequested => control_flow.set_exit(),
WindowEvent::CloseRequested => elwt.exit(),
WindowEvent::MouseInput {
state: ElementState::Released,
..