diff --git a/examples/window.rs b/examples/window.rs index fc908233..5578dab1 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -1,22 +1,19 @@ extern crate winit; -fn resize_callback(width: u32, height: u32) { - println!("Window resized to {}x{}", width, height); -} - fn main() { + let events_loop = winit::EventsLoop::new(); + let window = winit::WindowBuilder::new() .with_title("A fantastic window!") - .with_window_resize_callback(resize_callback) - .build() + .build(&events_loop) .unwrap(); - for event in window.wait_events() { + events_loop.run_forever(|event| { println!("{:?}", event); match event { - winit::Event::Closed => break, + winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => return, _ => () } - } + }); }