release+unhide mouse cursor in menu

This commit is contained in:
yuni 2024-09-16 02:31:51 +02:00
parent 16a578d294
commit 8b0d4d3df9

View file

@ -219,6 +219,14 @@ pub fn handle_game_event(
} }
GameEvent::SetMenu(turn) => { GameEvent::SetMenu(turn) => {
settings.menu_active = turn.to_bool(settings.menu_active); 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); ew_updatemenu.send(menu::UpdateMenuEvent);
} }
GameEvent::SetThirdPerson(turn) => { GameEvent::SetThirdPerson(turn) => {