mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 13:31:29 +11:00
Update README example to use EventsLoop
This commit is contained in:
parent
4a50fa6c44
commit
b8c6afb96a
11
README.md
11
README.md
|
@ -28,13 +28,16 @@ another library.
|
|||
extern crate winit;
|
||||
|
||||
fn main() {
|
||||
let window = winit::Window::new().unwrap();
|
||||
let events_loop = winit::EventsLoop::new();
|
||||
let window = winit::Window::new(&events_loop).unwrap();
|
||||
|
||||
for event in window.wait_events() {
|
||||
events_loop.run_forever(|event| {
|
||||
match event {
|
||||
winit::Event::Closed => break,
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => {
|
||||
events_loop.interrupt();
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue