mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
e2c84725de
* Format everything and add rustfmt to travis * Remove extern crate winit from examples and add force_multiline_blocks * Format the code properly * Fix inconsistent period in PULL_REQUEST_TEMPLATE.md * Only run rustfmt on nightly * Travis fixings
46 lines
1.3 KiB
Rust
46 lines
1.3 KiB
Rust
use winit::{
|
|
event::{Event, WindowEvent},
|
|
event_loop::{ControlFlow, EventLoop},
|
|
platform::desktop::EventLoopExtDesktop,
|
|
window::WindowBuilder,
|
|
};
|
|
|
|
fn main() {
|
|
let mut event_loop = EventLoop::new();
|
|
|
|
let window = WindowBuilder::new()
|
|
.with_title("A fantastic window!")
|
|
.build(&event_loop)
|
|
.unwrap();
|
|
|
|
println!("Close the window to continue.");
|
|
event_loop.run_return(|event, _, control_flow| {
|
|
match event {
|
|
Event::WindowEvent {
|
|
event: WindowEvent::CloseRequested,
|
|
..
|
|
} => *control_flow = ControlFlow::Exit,
|
|
_ => *control_flow = ControlFlow::Wait,
|
|
}
|
|
});
|
|
drop(window);
|
|
|
|
let _window_2 = WindowBuilder::new()
|
|
.with_title("A second, fantasticer window!")
|
|
.build(&event_loop)
|
|
.unwrap();
|
|
|
|
println!("Wa ha ha! You thought that closing the window would finish this?!");
|
|
event_loop.run_return(|event, _, control_flow| {
|
|
match event {
|
|
Event::WindowEvent {
|
|
event: WindowEvent::CloseRequested,
|
|
..
|
|
} => *control_flow = ControlFlow::Exit,
|
|
_ => *control_flow = ControlFlow::Wait,
|
|
}
|
|
});
|
|
|
|
println!("Okay we're done now for real.");
|
|
}
|