From d086d68a2f9cca1047f333d15eb0ad8941c826f8 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 25 Mar 2026 16:07:04 -0700 Subject: [PATCH] refactor: extract Interface settings tab into dedicated method Extract renderSettingsInterfaceTab() (108 lines) from renderSettingsWindow(). 6 of 7 tabs now have dedicated methods; only Video remains inline (shares init state with parent). --- include/ui/game_screen.hpp | 1 + src/ui/game_screen.cpp | 220 +++++++++++++++++++------------------ 2 files changed, 113 insertions(+), 108 deletions(-) diff --git a/include/ui/game_screen.hpp b/include/ui/game_screen.hpp index b8550580..3a974846 100644 --- a/include/ui/game_screen.hpp +++ b/include/ui/game_screen.hpp @@ -385,6 +385,7 @@ private: void renderSettingsAudioTab(); void renderSettingsChatTab(); void renderSettingsAboutTab(); + void renderSettingsInterfaceTab(); void renderSettingsGameplayTab(); void renderSettingsControlsTab(); void applyGraphicsPreset(GraphicsPreset preset); diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 27d18888..6cafa6ed 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -18203,6 +18203,117 @@ void GameScreen::renderPetUnlearnConfirmDialog(game::GameHandler& gameHandler) { // Settings Window // ============================================================ +void GameScreen::renderSettingsInterfaceTab() { +ImGui::Spacing(); +ImGui::BeginChild("InterfaceSettings", ImVec2(0, 360), true); + +ImGui::SeparatorText("Action Bars"); +ImGui::Spacing(); +ImGui::SetNextItemWidth(200.0f); +if (ImGui::SliderFloat("Action Bar Scale", &pendingActionBarScale, 0.5f, 1.5f, "%.2fx")) { + saveSettings(); +} +ImGui::Spacing(); + +if (ImGui::Checkbox("Show Second Action Bar", &pendingShowActionBar2)) { + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(Shift+1 through Shift+=)"); + +if (pendingShowActionBar2) { + ImGui::Spacing(); + ImGui::TextUnformatted("Second Bar Position Offset"); + ImGui::SetNextItemWidth(160.0f); + if (ImGui::SliderFloat("Horizontal##bar2x", &pendingActionBar2OffsetX, -600.0f, 600.0f, "%.0f px")) { + saveSettings(); + } + ImGui::SetNextItemWidth(160.0f); + if (ImGui::SliderFloat("Vertical##bar2y", &pendingActionBar2OffsetY, -400.0f, 400.0f, "%.0f px")) { + saveSettings(); + } + if (ImGui::Button("Reset Position##bar2")) { + pendingActionBar2OffsetX = 0.0f; + pendingActionBar2OffsetY = 0.0f; + saveSettings(); + } +} + +ImGui::Spacing(); +if (ImGui::Checkbox("Show Right Side Bar", &pendingShowRightBar)) { + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(Slots 25-36)"); +if (pendingShowRightBar) { + ImGui::SetNextItemWidth(160.0f); + if (ImGui::SliderFloat("Vertical Offset##rbar", &pendingRightBarOffsetY, -400.0f, 400.0f, "%.0f px")) { + saveSettings(); + } +} + +ImGui::Spacing(); +if (ImGui::Checkbox("Show Left Side Bar", &pendingShowLeftBar)) { + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(Slots 37-48)"); +if (pendingShowLeftBar) { + ImGui::SetNextItemWidth(160.0f); + if (ImGui::SliderFloat("Vertical Offset##lbar", &pendingLeftBarOffsetY, -400.0f, 400.0f, "%.0f px")) { + saveSettings(); + } +} + +ImGui::Spacing(); +ImGui::SeparatorText("Nameplates"); +ImGui::Spacing(); +ImGui::SetNextItemWidth(200.0f); +if (ImGui::SliderFloat("Nameplate Scale", &nameplateScale_, 0.5f, 2.0f, "%.2fx")) { + saveSettings(); +} + +ImGui::Spacing(); +ImGui::SeparatorText("Network"); +ImGui::Spacing(); +if (ImGui::Checkbox("Show Latency Meter", &pendingShowLatencyMeter)) { + showLatencyMeter_ = pendingShowLatencyMeter; + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(ms indicator near minimap)"); + +if (ImGui::Checkbox("Show DPS/HPS Meter", &showDPSMeter_)) { + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(damage/healing per second above action bar)"); + +if (ImGui::Checkbox("Show Cooldown Tracker", &showCooldownTracker_)) { + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(active spell cooldowns near action bar)"); + +ImGui::Spacing(); +ImGui::SeparatorText("Screen Effects"); +ImGui::Spacing(); +if (ImGui::Checkbox("Damage Flash", &damageFlashEnabled_)) { + if (!damageFlashEnabled_) damageFlashAlpha_ = 0.0f; + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(red vignette on taking damage)"); + +if (ImGui::Checkbox("Low Health Vignette", &lowHealthVignetteEnabled_)) { + saveSettings(); +} +ImGui::SameLine(); +ImGui::TextDisabled("(pulsing red edges below 20%% HP)"); + +ImGui::EndChild(); +} + void GameScreen::renderSettingsGameplayTab() { auto* renderer = core::Application::getInstance().getRenderer(); ImGui::Spacing(); @@ -19074,114 +19185,7 @@ void GameScreen::renderSettingsWindow() { // INTERFACE TAB // ============================================================ if (ImGui::BeginTabItem("Interface")) { - ImGui::Spacing(); - ImGui::BeginChild("InterfaceSettings", ImVec2(0, 360), true); - - ImGui::SeparatorText("Action Bars"); - ImGui::Spacing(); - ImGui::SetNextItemWidth(200.0f); - if (ImGui::SliderFloat("Action Bar Scale", &pendingActionBarScale, 0.5f, 1.5f, "%.2fx")) { - saveSettings(); - } - ImGui::Spacing(); - - if (ImGui::Checkbox("Show Second Action Bar", &pendingShowActionBar2)) { - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(Shift+1 through Shift+=)"); - - if (pendingShowActionBar2) { - ImGui::Spacing(); - ImGui::TextUnformatted("Second Bar Position Offset"); - ImGui::SetNextItemWidth(160.0f); - if (ImGui::SliderFloat("Horizontal##bar2x", &pendingActionBar2OffsetX, -600.0f, 600.0f, "%.0f px")) { - saveSettings(); - } - ImGui::SetNextItemWidth(160.0f); - if (ImGui::SliderFloat("Vertical##bar2y", &pendingActionBar2OffsetY, -400.0f, 400.0f, "%.0f px")) { - saveSettings(); - } - if (ImGui::Button("Reset Position##bar2")) { - pendingActionBar2OffsetX = 0.0f; - pendingActionBar2OffsetY = 0.0f; - saveSettings(); - } - } - - ImGui::Spacing(); - if (ImGui::Checkbox("Show Right Side Bar", &pendingShowRightBar)) { - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(Slots 25-36)"); - if (pendingShowRightBar) { - ImGui::SetNextItemWidth(160.0f); - if (ImGui::SliderFloat("Vertical Offset##rbar", &pendingRightBarOffsetY, -400.0f, 400.0f, "%.0f px")) { - saveSettings(); - } - } - - ImGui::Spacing(); - if (ImGui::Checkbox("Show Left Side Bar", &pendingShowLeftBar)) { - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(Slots 37-48)"); - if (pendingShowLeftBar) { - ImGui::SetNextItemWidth(160.0f); - if (ImGui::SliderFloat("Vertical Offset##lbar", &pendingLeftBarOffsetY, -400.0f, 400.0f, "%.0f px")) { - saveSettings(); - } - } - - ImGui::Spacing(); - ImGui::SeparatorText("Nameplates"); - ImGui::Spacing(); - ImGui::SetNextItemWidth(200.0f); - if (ImGui::SliderFloat("Nameplate Scale", &nameplateScale_, 0.5f, 2.0f, "%.2fx")) { - saveSettings(); - } - - ImGui::Spacing(); - ImGui::SeparatorText("Network"); - ImGui::Spacing(); - if (ImGui::Checkbox("Show Latency Meter", &pendingShowLatencyMeter)) { - showLatencyMeter_ = pendingShowLatencyMeter; - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(ms indicator near minimap)"); - - if (ImGui::Checkbox("Show DPS/HPS Meter", &showDPSMeter_)) { - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(damage/healing per second above action bar)"); - - if (ImGui::Checkbox("Show Cooldown Tracker", &showCooldownTracker_)) { - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(active spell cooldowns near action bar)"); - - ImGui::Spacing(); - ImGui::SeparatorText("Screen Effects"); - ImGui::Spacing(); - if (ImGui::Checkbox("Damage Flash", &damageFlashEnabled_)) { - if (!damageFlashEnabled_) damageFlashAlpha_ = 0.0f; - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(red vignette on taking damage)"); - - if (ImGui::Checkbox("Low Health Vignette", &lowHealthVignetteEnabled_)) { - saveSettings(); - } - ImGui::SameLine(); - ImGui::TextDisabled("(pulsing red edges below 20%% HP)"); - - ImGui::EndChild(); + renderSettingsInterfaceTab(); ImGui::EndTabItem(); }