Update window example

This commit is contained in:
Pierre Krieger 2017-01-28 15:01:59 +01:00
parent 422b332c1b
commit 2c4db6b16e

View file

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