Update README example to use EventsLoop

This commit is contained in:
Lucien Greathouse 2017-05-21 22:03:22 -07:00 committed by GitHub
parent 4a50fa6c44
commit b8c6afb96a

View file

@ -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();
},
_ => ()
}
}
});
}
```