mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Merge pull request #186 from LPGhatguy/patch-2
Update README example to use EventsLoop
This commit is contained in:
commit
a17f7328c9
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