mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 13:51:30 +11:00
Update window example
This commit is contained in:
parent
422b332c1b
commit
2c4db6b16e
|
@ -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,
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue