From 355001c2369770114e75c557d826d1da625f821e Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 11 Mar 2026 22:39:59 -0700 Subject: [PATCH] Add action bar scale setting to Interface settings tab Adds a 0.5x-1.5x scale slider under Action Bars in the Interface settings tab. The scale multiplies the base 48px slot size for both the main bar and XP bar layout calculations. The setting is persisted to settings.cfg as 'action_bar_scale'. --- include/ui/game_screen.hpp | 1 + src/ui/game_screen.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/ui/game_screen.hpp b/include/ui/game_screen.hpp index 35f83743..18e78f24 100644 --- a/include/ui/game_screen.hpp +++ b/include/ui/game_screen.hpp @@ -123,6 +123,7 @@ private: bool awaitingKeyPress = false; bool pendingUseOriginalSoundtrack = true; bool pendingShowActionBar2 = true; // Show second action bar above main bar + float pendingActionBarScale = 1.0f; // Multiplier for action bar slot size (0.5–1.5) float pendingActionBar2OffsetX = 0.0f; // Horizontal offset from default center position float pendingActionBar2OffsetY = 0.0f; // Vertical offset from default (above bar 1) bool pendingShowRightBar = false; // Right-edge vertical action bar (bar 3, slots 24-35) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 7951110d..c7d541c5 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -4259,7 +4259,7 @@ void GameScreen::renderActionBar(game::GameHandler& gameHandler) { float screenH = displaySize.y > 0.0f ? displaySize.y : 720.0f; auto* assetMgr = core::Application::getInstance().getAssetManager(); - float slotSize = 48.0f; + float slotSize = 48.0f * pendingActionBarScale; float spacing = 4.0f; float padding = 8.0f; float barW = 12 * slotSize + 11 * spacing + padding * 2; @@ -4896,7 +4896,7 @@ void GameScreen::renderXpBar(game::GameHandler& gameHandler) { (void)window; // Not used for positioning; kept for AssetManager if needed // Position just above both action bars (bar1 at screenH-barH, bar2 above that) - float slotSize = 48.0f; + float slotSize = 48.0f * pendingActionBarScale; float spacing = 4.0f; float padding = 8.0f; float barW = 12 * slotSize + 11 * spacing + padding * 2; @@ -9463,6 +9463,11 @@ void GameScreen::renderSettingsWindow() { 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(); @@ -10925,6 +10930,7 @@ void GameScreen::saveSettings() { out << "minimap_npc_dots=" << (pendingMinimapNpcDots ? 1 : 0) << "\n"; out << "show_latency_meter=" << (pendingShowLatencyMeter ? 1 : 0) << "\n"; out << "separate_bags=" << (pendingSeparateBags ? 1 : 0) << "\n"; + out << "action_bar_scale=" << pendingActionBarScale << "\n"; out << "show_action_bar2=" << (pendingShowActionBar2 ? 1 : 0) << "\n"; out << "action_bar2_offset_x=" << pendingActionBar2OffsetX << "\n"; out << "action_bar2_offset_y=" << pendingActionBar2OffsetY << "\n"; @@ -11031,6 +11037,8 @@ void GameScreen::loadSettings() { } else if (key == "separate_bags") { pendingSeparateBags = (std::stoi(val) != 0); inventoryScreen.setSeparateBags(pendingSeparateBags); + } else if (key == "action_bar_scale") { + pendingActionBarScale = std::clamp(std::stof(val), 0.5f, 1.5f); } else if (key == "show_action_bar2") { pendingShowActionBar2 = (std::stoi(val) != 0); } else if (key == "action_bar2_offset_x") {