mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
7f6ae8910e
Conflicts: .travis.yml Cargo.toml examples/fullscreen.rs src/api/android/mod.rs src/api/cocoa/headless.rs src/api/cocoa/helpers.rs src/api/cocoa/mod.rs src/api/glx/mod.rs src/api/osmesa/mod.rs src/api/win32/callback.rs src/headless.rs src/lib.rs src/platform/linux/mod.rs src/window.rs
48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
#[cfg(target_os = "android")]
|
|
#[macro_use]
|
|
extern crate android_glue;
|
|
|
|
extern crate winit;
|
|
|
|
use std::io::{self, Write};
|
|
|
|
#[cfg(target_os = "android")]
|
|
android_start!(main);
|
|
|
|
fn main() {
|
|
// enumerating monitors
|
|
let monitor = {
|
|
for (num, monitor) in winit::get_available_monitors().enumerate() {
|
|
println!("Monitor #{}: {:?}", num, monitor.get_name());
|
|
}
|
|
|
|
print!("Please write the number of the monitor to use: ");
|
|
io::stdout().flush().unwrap();
|
|
|
|
let mut num = String::new();
|
|
io::stdin().read_line(&mut num).unwrap();
|
|
let num = num.trim().parse().ok().expect("Please enter a number");
|
|
let monitor = winit::get_available_monitors().nth(num).expect("Please enter a valid ID");
|
|
|
|
println!("Using {:?}", monitor.get_name());
|
|
|
|
monitor
|
|
};
|
|
|
|
let window = winit::WindowBuilder::new()
|
|
.with_title("Hello world!")
|
|
.with_fullscreen(monitor)
|
|
.build()
|
|
.unwrap();
|
|
|
|
for event in window.wait_events() {
|
|
println!("{:?}", event);
|
|
|
|
match event {
|
|
winit::Event::Closed => break,
|
|
winit::Event::KeyboardInput(_, _, Some(winit::VirtualKeyCode::Escape)) => break,
|
|
_ => ()
|
|
}
|
|
}
|
|
}
|