From 8b0d4d3df9d4b5ed8ba1c51ba20e791564ef70e0 Mon Sep 17 00:00:00 2001 From: yuni Date: Mon, 16 Sep 2024 02:31:51 +0200 Subject: [PATCH] release+unhide mouse cursor in menu --- src/game.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game.rs b/src/game.rs index f75089d..564ea5b 100644 --- a/src/game.rs +++ b/src/game.rs @@ -219,6 +219,14 @@ pub fn handle_game_event( } GameEvent::SetMenu(turn) => { settings.menu_active = turn.to_bool(settings.menu_active); + for mut window in &mut q_window { + window.cursor.grab_mode = if settings.menu_active { + bevy::window::CursorGrabMode::None + } else { + bevy::window::CursorGrabMode::Locked + }; + window.cursor.visible = settings.menu_active; + } ew_updatemenu.send(menu::UpdateMenuEvent); } GameEvent::SetThirdPerson(turn) => {