winit-sonoma-fix/examples/multiwindow.rs

35 lines
695 B
Rust
Raw Normal View History

2016-03-27 04:07:52 +11:00
extern crate winit;
2015-04-03 07:04:17 +11:00
use std::thread;
2014-12-24 03:12:29 +11:00
fn main() {
2016-03-27 04:07:52 +11:00
let window1 = winit::WindowBuilder::new().build().unwrap();
let window2 = winit::WindowBuilder::new().build().unwrap();
let window3 = winit::WindowBuilder::new().build().unwrap();
let t1 = thread::spawn(move || {
2016-03-27 04:07:52 +11:00
run(window1);
});
let t2 = thread::spawn(move || {
2016-03-27 04:07:52 +11:00
run(window2);
});
let t3 = thread::spawn(move || {
2016-03-27 04:07:52 +11:00
run(window3);
});
2014-12-24 03:12:29 +11:00
2015-01-18 19:51:23 +11:00
let _ = t1.join();
let _ = t2.join();
let _ = t3.join();
}
2016-03-27 04:07:52 +11:00
fn run(window: winit::Window) {
2015-06-16 21:48:08 +10:00
for event in window.wait_events() {
match event {
2016-03-27 04:07:52 +11:00
winit::Event::Closed => break,
2015-06-16 21:48:08 +10:00
_ => ()
}
}
}