winit-sonoma-fix/examples/multiwindow.rs

42 lines
819 B
Rust
Raw Normal View History

2014-09-12 02:13:50 +10:00
#[cfg(target_os = "android")]
2015-01-08 19:28:22 +11:00
#[macro_use]
2014-09-12 02:13:50 +10:00
extern crate android_glue;
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
2014-09-12 02:13:50 +10:00
#[cfg(target_os = "android")]
android_start!(main);
2014-09-12 02:13:50 +10: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
_ => ()
}
}
}