Show mouse on Esc, hide when pressing again

Former-commit-id: 440fd99b32b2490cb87add2e095cdd17fece0b57
This commit is contained in:
timokoesters 2019-04-22 20:23:40 +02:00
parent b6d785f401
commit f8d1340199

View File

@ -1523,7 +1523,7 @@ impl Hud {
self.show_ui = !self.show_ui;
}
fn toggle_windows(&mut self) {
fn toggle_windows(&mut self, global_state: &mut GlobalState) {
if self.bag_open
|| self.menu_open
|| self.map_open
@ -1536,8 +1536,10 @@ impl Hud {
self.menu_open = false;
self.map_open = false;
self.open_windows = Windows::None;
global_state.window.grab_cursor(true);
} else {
self.menu_open = true;
global_state.window.grab_cursor(false);
}
}
@ -1578,7 +1580,7 @@ impl Hud {
self.ui.focus_widget(None);
} else {
// Close windows on esc
self.toggle_windows();
self.toggle_windows(global_state);
}
true
}