2016-03-27 04:07:52 +11:00
|
|
|
extern crate winit;
|
2014-09-12 16:50:54 +10:00
|
|
|
|
2014-08-04 01:23:08 +10:00
|
|
|
fn main() {
|
2017-06-08 00:12:41 +10:00
|
|
|
let mut events_loop = winit::EventsLoop::new();
|
2014-08-04 01:23:08 +10:00
|
|
|
|
2017-01-29 01:45:01 +11:00
|
|
|
let window1 = winit::Window::new(&events_loop).unwrap();
|
|
|
|
let window2 = winit::Window::new(&events_loop).unwrap();
|
|
|
|
let window3 = winit::Window::new(&events_loop).unwrap();
|
2014-08-08 02:15:09 +10:00
|
|
|
|
2017-01-29 01:45:01 +11:00
|
|
|
let mut num_windows = 3;
|
2014-12-24 03:12:29 +11:00
|
|
|
|
2017-01-29 01:45:01 +11:00
|
|
|
events_loop.run_forever(|event| {
|
2015-06-16 21:48:08 +10:00
|
|
|
match event {
|
2017-01-29 01:45:01 +11:00
|
|
|
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, window_id } => {
|
|
|
|
if window_id == window1.id() {
|
|
|
|
println!("Window 1 has been closed")
|
|
|
|
} else if window_id == window2.id() {
|
|
|
|
println!("Window 2 has been closed")
|
|
|
|
} else if window_id == window3.id() {
|
|
|
|
println!("Window 3 has been closed");
|
|
|
|
} else {
|
|
|
|
unreachable!()
|
|
|
|
}
|
|
|
|
|
|
|
|
num_windows -= 1;
|
|
|
|
if num_windows == 0 {
|
2017-06-20 21:25:53 +10:00
|
|
|
return winit::ControlFlow::Break;
|
2017-01-29 01:45:01 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
_ => (),
|
2015-06-16 21:48:08 +10:00
|
|
|
}
|
2017-06-08 00:12:41 +10:00
|
|
|
winit::ControlFlow::Continue
|
2017-01-29 01:45:01 +11:00
|
|
|
})
|
2014-08-04 01:23:08 +10:00
|
|
|
}
|