Skip to content

Commit

Permalink
Open debug menu with F3 instead of menu button
Browse files Browse the repository at this point in the history
  • Loading branch information
Uriopass committed Feb 7, 2024
1 parent 6dc2603 commit aa48a15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions native_app/src/gui/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ impl OldGUIWindows {
.extend(std::iter::repeat(false).take(self.windows.len() - self.opened.len()))
}
for (opened, w) in self.opened.iter_mut().zip(self.windows.iter()) {
if w.name == "Debug" {
continue;
}

*opened ^= button_primary(w.name).show().clicked;
}
}
Expand All @@ -87,14 +91,15 @@ impl OldGUIWindows {
if uiworld
.write::<InputMap>()
.just_act
.contains(&InputAction::OpenEconomyMenu)
.contains(&InputAction::OpenDebugMenu)
{
for (i, w) in self.windows.iter().enumerate() {
if w.name == "Economy" {
if w.name == "Debug" {
self.opened[i] ^= true;
}
}
}

for (ws, opened) in self.windows.iter_mut().zip(self.opened.iter_mut()) {
if *opened {
ws.w.render_window(egui::Window::new(ws.name).open(opened), ui, uiworld, sim);
Expand Down
3 changes: 3 additions & 0 deletions native_app/src/inputmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub enum InputAction {
UpElevation,
DownElevation,
OpenEconomyMenu,
OpenDebugMenu,
PausePlay,
OpenChat,
}
Expand Down Expand Up @@ -102,6 +103,7 @@ const DEFAULT_BINDINGS: &[(InputAction, &[&[UnitInput]])] = &[
(UpElevation, &[&[Key(K::Control), WheelUp]]),
(DownElevation, &[&[Key(K::Control), WheelDown]]),
(OpenEconomyMenu, &[&[Key(K::c("E"))]]),
(OpenDebugMenu, &[&[Key(K::F3)]]),
(PausePlay, &[&[Key(K::Space)]]),
(OpenChat, &[&[Key(K::c("T"))]]),
];
Expand Down Expand Up @@ -339,6 +341,7 @@ impl Display for InputAction {
OpenChat => "Interact with Chat",
SizeUp => "Size Up",
SizeDown => "Size Down",
OpenDebugMenu => "Debug Menu",
}
)
}
Expand Down

0 comments on commit aa48a15

Please sign in to comment.