mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Update window example
This commit is contained in:
parent
422b332c1b
commit
2c4db6b16e
|
@ -1,22 +1,19 @@
|
||||||
extern crate winit;
|
extern crate winit;
|
||||||
|
|
||||||
fn resize_callback(width: u32, height: u32) {
|
|
||||||
println!("Window resized to {}x{}", width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let events_loop = winit::EventsLoop::new();
|
||||||
|
|
||||||
let window = winit::WindowBuilder::new()
|
let window = winit::WindowBuilder::new()
|
||||||
.with_title("A fantastic window!")
|
.with_title("A fantastic window!")
|
||||||
.with_window_resize_callback(resize_callback)
|
.build(&events_loop)
|
||||||
.build()
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
for event in window.wait_events() {
|
events_loop.run_forever(|event| {
|
||||||
println!("{:?}", event);
|
println!("{:?}", event);
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
winit::Event::Closed => break,
|
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => return,
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue