winit-sonoma-fix/examples/multiwindow.rs

35 lines
695 B
Rust
Raw Normal View History

2016-03-26 18:07:52 +01:00
extern crate winit;
2015-04-02 22:04:17 +02:00
use std::thread;
2014-12-23 17:12:29 +01:00
fn main() {
2016-03-26 18:07:52 +01: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-26 18:07:52 +01:00
run(window1);
});
let t2 = thread::spawn(move || {
2016-03-26 18:07:52 +01:00
run(window2);
});
let t3 = thread::spawn(move || {
2016-03-26 18:07:52 +01:00
run(window3);
});
2014-12-23 17:12:29 +01:00
2015-01-18 19:51:23 +11:00
let _ = t1.join();
let _ = t2.join();
let _ = t3.join();
}
2016-03-26 18:07:52 +01:00
fn run(window: winit::Window) {
2015-06-16 13:48:08 +02:00
for event in window.wait_events() {
match event {
2016-03-26 18:07:52 +01:00
winit::Event::Closed => break,
2015-06-16 13:48:08 +02:00
_ => ()
}
}
}