Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu Support Cleanup #665

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/window/gui/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,14 @@ void Gui::DrawMenu() {
if (ImGui::IsKeyPressed(TOGGLE_BTN) || ImGui::IsKeyPressed(ImGuiKey_Escape) ||
(ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0))) {
if (ImGui::IsKeyPressed(TOGGLE_BTN) || (ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && !GetPadBtnTogglesMenu())) {
GetMenuBar()->ToggleVisibility();
if (GetMenuBar()) {
GetMenuBar()->ToggleVisibility();
}
} else if (ImGui::IsKeyPressed(ImGuiKey_Escape) ||
(ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && GetPadBtnTogglesMenu())) {
GetMenu()->ToggleVisibility();
if (GetMenu()) {
GetMenu()->ToggleVisibility();
}
}
if (wnd->IsFullscreen()) {
Context::GetInstance()->GetWindow()->SetCursorVisibility(GetMenuOrMenubarVisible() ||
Expand Down
8 changes: 4 additions & 4 deletions src/window/gui/GuiElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ void GuiElement::Update() {
UpdateElement();
}

void GuiElement::SetVisiblity(bool visible) {
void GuiElement::SetVisibility(bool visible) {
mIsVisible = visible;
}

void GuiElement::Show() {
SetVisiblity(true);
SetVisibility(true);
}

void GuiElement::Hide() {
SetVisiblity(false);
SetVisibility(false);
}

void GuiElement::ToggleVisibility() {
SetVisiblity(!IsVisible());
SetVisibility(!IsVisible());
}

bool GuiElement::IsVisible() {
Expand Down
2 changes: 1 addition & 1 deletion src/window/gui/GuiElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GuiElement {
virtual void InitElement() = 0;
virtual void UpdateElement() = 0;

virtual void SetVisiblity(bool visible);
virtual void SetVisibility(bool visible);
bool mIsVisible;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/window/gui/GuiMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void GuiMenuBar::SyncVisibilityConsoleVariable() {
}
}

void GuiMenuBar::SetVisiblity(bool visible) {
void GuiMenuBar::SetVisibility(bool visible) {
mIsVisible = visible;
SyncVisibilityConsoleVariable();
}
Expand Down
2 changes: 1 addition & 1 deletion src/window/gui/GuiMenuBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class GuiMenuBar : public GuiElement {
void Draw() override;

protected:
void SetVisiblity(bool visible) override;
void SetVisibility(bool visible) override;

private:
void SyncVisibilityConsoleVariable();
Expand Down
2 changes: 1 addition & 1 deletion src/window/gui/GuiWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GuiWindow::GuiWindow(const std::string& consoleVariable, const std::string& name
: GuiWindow(consoleVariable, false, name, ImVec2{ -1, -1 }, ImGuiWindowFlags_None) {
}

void GuiWindow::SetVisiblity(bool visible) {
void GuiWindow::SetVisibility(bool visible) {
mIsVisible = visible;
SyncVisibilityConsoleVariable();
}
Expand Down
2 changes: 1 addition & 1 deletion src/window/gui/GuiWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GuiWindow : public GuiElement {
std::string GetName();

protected:
void SetVisiblity(bool visible) override;
void SetVisibility(bool visible) override;
void BeginGroupPanel(const char* name, const ImVec2& size);
void EndGroupPanel(float minHeight);
void SyncVisibilityConsoleVariable();
Expand Down
Loading