2016-03-27 04:07:52 +11:00
|
|
|
extern crate winit;
|
2014-09-12 16:50:54 +10:00
|
|
|
|
2018-04-25 06:20:40 +10:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
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
|
|
|
|
2018-04-25 06:20:40 +10:00
|
|
|
let mut windows = HashMap::new();
|
|
|
|
for _ in 0..3 {
|
|
|
|
let window = winit::Window::new(&events_loop).unwrap();
|
|
|
|
windows.insert(window.id(), window);
|
|
|
|
}
|
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 {
|
2018-04-25 06:20:40 +10:00
|
|
|
winit::Event::WindowEvent {
|
|
|
|
event: winit::WindowEvent::CloseRequested,
|
|
|
|
window_id,
|
|
|
|
} => {
|
|
|
|
println!("Window {:?} has received the signal to close", window_id);
|
|
|
|
|
|
|
|
// This drops the window, causing it to close.
|
|
|
|
windows.remove(&window_id);
|
2017-01-29 01:45:01 +11:00
|
|
|
|
2018-04-25 06:20:40 +10:00
|
|
|
if windows.is_empty() {
|
2017-06-20 21:25:53 +10:00
|
|
|
return winit::ControlFlow::Break;
|
2017-01-29 01:45:01 +11:00
|
|
|
}
|
2018-04-25 06:20:40 +10:00
|
|
|
}
|
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
|
|
|
}
|