From 2c4db6b16e06d4b6480d839c73642490172830df Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sat, 28 Jan 2017 15:01:59 +0100 Subject: [PATCH] Update window example --- examples/window.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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, _ => () } - } + }); }