mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
35 lines
1.6 KiB
Rust
35 lines
1.6 KiB
Rust
#[cfg(target_os = "android")]
|
|
#[macro_use]
|
|
extern crate android_glue;
|
|
|
|
extern crate winit;
|
|
|
|
use winit::{Event, ElementState, MouseCursor};
|
|
|
|
#[cfg(target_os = "android")]
|
|
android_start!(main);
|
|
|
|
fn main() {
|
|
let window = winit::WindowBuilder::new().build().unwrap();
|
|
window.set_title("A fantastic window!");
|
|
|
|
let cursors = [MouseCursor::Default, MouseCursor::Crosshair, MouseCursor::Hand, MouseCursor::Arrow, MouseCursor::Move, MouseCursor::Text, MouseCursor::Wait, MouseCursor::Help, MouseCursor::Progress, MouseCursor::NotAllowed, MouseCursor::ContextMenu, MouseCursor::NoneCursor, MouseCursor::Cell, MouseCursor::VerticalText, MouseCursor::Alias, MouseCursor::Copy, MouseCursor::NoDrop, MouseCursor::Grab, MouseCursor::Grabbing, MouseCursor::AllScroll, MouseCursor::ZoomIn, MouseCursor::ZoomOut, MouseCursor::EResize, MouseCursor::NResize, MouseCursor::NeResize, MouseCursor::NwResize, MouseCursor::SResize, MouseCursor::SeResize, MouseCursor::SwResize, MouseCursor::WResize, MouseCursor::EwResize, MouseCursor::NsResize, MouseCursor::NeswResize, MouseCursor::NwseResize, MouseCursor::ColResize, MouseCursor::RowResize];
|
|
let mut cursor_idx = 0;
|
|
|
|
for event in window.wait_events() {
|
|
match event {
|
|
Event::KeyboardInput(ElementState::Pressed, _, _) => {
|
|
println!("Setting cursor to \"{:?}\"", cursors[cursor_idx]);
|
|
window.set_cursor(cursors[cursor_idx]);
|
|
if cursor_idx < cursors.len() - 1 {
|
|
cursor_idx += 1;
|
|
} else {
|
|
cursor_idx = 0;
|
|
}
|
|
},
|
|
Event::Closed => break,
|
|
_ => (),
|
|
}
|
|
}
|
|
}
|