We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dee37d6 commit f1eb52cCopy full SHA for f1eb52c
src/main.rs
@@ -3,6 +3,7 @@
3
windows_subsystem = "windows"
4
)]
5
use state::State;
6
+use std::io::Cursor;
7
use std::sync::{Arc, Mutex};
8
use std::time::Instant;
9
use winit::dpi::LogicalSize;
@@ -47,7 +48,10 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
47
48
size.width = size.width.max(1);
49
size.height = size.height.max(1);
50
- window.set_cursor_grab(CursorGrabMode::Confined).unwrap();
51
+ window
52
+ .set_cursor_grab(CursorGrabMode::Confined)
53
+ .or_else(|_| window.set_cursor_grab(CursorGrabMode::Locked))
54
+ .unwrap();
55
window.set_cursor_visible(false);
56
let window = Arc::new(Mutex::new(window));
57
let mut state = State::new(window.clone()).await;
0 commit comments