Skip to content

Commit

Permalink
Make platform dependent cursor grabbing.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed Nov 16, 2022
1 parent a8b8859 commit 2979506
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bounce-up"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

[lib]
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ fn lock_release_cursor(app_state: Res<State<AppState>>, mut windows: ResMut<Wind
if let Some(window) = windows.get_primary_mut() {
match app_state.current() {
AppState::Battle | AppState::Practice => {
window.set_cursor_grab_mode(CursorGrabMode::Confined);
if cfg!(any(target_arch = "wasm32", target_os = "macos")) {
window.set_cursor_grab_mode(CursorGrabMode::Locked);
} else {
window.set_cursor_grab_mode(CursorGrabMode::Confined);
}

window.set_cursor_visibility(false);
}
_ => {
Expand Down

0 comments on commit 2979506

Please sign in to comment.