From 05ab17d3a8fe26600ee4cee032de1c54d2c024f4 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sun, 16 Mar 2025 15:00:30 -0700 Subject: [PATCH] Reimplement ImGui Scaling option. (#5124) --- soh/soh/SohGui/SohMenuBar.cpp | 20 -------------------- soh/soh/SohGui/SohMenuSettings.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/soh/soh/SohGui/SohMenuBar.cpp b/soh/soh/SohGui/SohMenuBar.cpp index 18fa8b53d..ed63fea7b 100644 --- a/soh/soh/SohGui/SohMenuBar.cpp +++ b/soh/soh/SohGui/SohMenuBar.cpp @@ -68,8 +68,6 @@ static std::unordered_map windowBackendNames = { Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" }, }; -static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large" }; - static const char* filters[3] = { #ifdef __WIIU__ "", @@ -89,24 +87,6 @@ Ship::WindowBackend configWindowBackend; extern std::shared_ptr mGfxDebuggerWindow; void DrawSettingsMenu() { - //if (ImGui::BeginMenu("Settings")) - //{ - // if (ImGui::BeginMenu("Graphics")) { - // ImGui::Text("ImGui Menu Scale"); - // ImGui::SameLine(); - // ImGui::TextColored({ 0.85f, 0.35f, 0.0f, 1.0f }, "(Experimental)"); - // if (UIWidgets::EnhancementCombobox(CVAR_SETTING("ImGuiScale"), imguiScaleOptions, 1)) { - // OTRGlobals::Instance->ScaleImGui(); - // } - // UIWidgets::Tooltip("Changes the scaling of the ImGui menu elements."); - - // // Draw LUS settings menu (such as Overlays Text Font) - // Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings(); - - // ImGui::EndMenu(); - // } - // ImGui::EndMenu(); - //} } void SohMenuBar::InitElement() { diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index a9103377b..5a186b0ae 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -15,6 +15,7 @@ namespace SohGui { extern std::shared_ptr mSohMenu; using namespace UIWidgets; static std::unordered_map languages = {{ LANGUAGE_ENG, "English" }, { LANGUAGE_GER, "German" }, { LANGUAGE_FRA, "French" }}; +static std::unordered_map imguiScaleOptions = {{ 0, "Small" }, { 1, "Normal" }, { 2, "Large" }, { 3, "X-Large" }}; const char* GetGameVersionString(uint32_t index) { uint32_t gameVersion = ResourceMgr_GetGameVersion(index); @@ -115,6 +116,15 @@ void SohMenu::AddMenuSettings() { AddWidget(path, "Disable Idle Camera Re-Centering", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_SETTING("A11yDisableIdleCam")) .Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle.")); + AddWidget(path, "EXPERIMENTAL", WIDGET_SEPARATOR_TEXT) + .Options(WidgetOptions().Color(Colors::Orange)); + AddWidget(path, "ImGui Menu Scaling", WIDGET_CVAR_COMBOBOX) + .CVar(CVAR_SETTING("ImGuiScale")) + .Options(ComboboxOptions().ComboMap(imguiScaleOptions).Tooltip("Changes the scaling of the ImGui menu elements.").DefaultIndex(1) + .ComponentAlignment(ComponentAlignment::Right).LabelPosition(LabelPosition::Far)) + .Callback([](WidgetInfo& info) { + OTRGlobals::Instance->ScaleImGui(); + }); // General - About path.column = SECTION_COLUMN_2;