From 0d9404c704385c0e6b1cffc3364ba1b0acc4bbae Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 11 Mar 2026 07:19:54 -0700 Subject: [PATCH] feat: expand keybinding system with 4 new customizable actions - Add World Map (W), Nameplates (V), Raid Frames (R), Quest Log (Q) to KeybindingManager enum with customizable default bindings - Replace hard-coded V key check for nameplate toggle with KeybindingManager::isActionPressed() to support customization - Update config file persistence to handle new bindings - Infrastructure in place for implementing visibility toggles on other windows (World Map, Raid Frames, Quest Log) with future UI refactoring --- include/ui/keybinding_manager.hpp | 4 ++++ src/ui/game_screen.cpp | 4 ++-- src/ui/keybinding_manager.cpp | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/ui/keybinding_manager.hpp b/include/ui/keybinding_manager.hpp index e4987798..098505c1 100644 --- a/include/ui/keybinding_manager.hpp +++ b/include/ui/keybinding_manager.hpp @@ -25,6 +25,10 @@ public: TOGGLE_CHAT, TOGGLE_GUILD_ROSTER, TOGGLE_DUNGEON_FINDER, + TOGGLE_WORLD_MAP, + TOGGLE_NAMEPLATES, + TOGGLE_RAID_FRAMES, + TOGGLE_QUEST_LOG, ACTION_COUNT }; diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index c228bc70..20e8769d 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -1470,8 +1470,8 @@ void GameScreen::processTargetInput(game::GameHandler& gameHandler) { } } - // V — toggle nameplates (WoW default keybinding) - if (input.isKeyJustPressed(SDL_SCANCODE_V)) { + // Toggle nameplates (customizable keybinding, default V) + if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_NAMEPLATES)) { showNameplates_ = !showNameplates_; } diff --git a/src/ui/keybinding_manager.cpp b/src/ui/keybinding_manager.cpp index ff04cc58..bf65ae56 100644 --- a/src/ui/keybinding_manager.cpp +++ b/src/ui/keybinding_manager.cpp @@ -26,6 +26,10 @@ void KeybindingManager::initializeDefaults() { bindings_[static_cast(Action::TOGGLE_CHAT)] = ImGuiKey_Enter; bindings_[static_cast(Action::TOGGLE_GUILD_ROSTER)] = ImGuiKey_O; bindings_[static_cast(Action::TOGGLE_DUNGEON_FINDER)] = ImGuiKey_J; // Originally I, reassigned to avoid conflict + bindings_[static_cast(Action::TOGGLE_WORLD_MAP)] = ImGuiKey_W; + bindings_[static_cast(Action::TOGGLE_NAMEPLATES)] = ImGuiKey_V; + bindings_[static_cast(Action::TOGGLE_RAID_FRAMES)] = ImGuiKey_R; + bindings_[static_cast(Action::TOGGLE_QUEST_LOG)] = ImGuiKey_Q; } bool KeybindingManager::isActionPressed(Action action, bool repeat) { @@ -61,6 +65,10 @@ const char* KeybindingManager::getActionName(Action action) { case Action::TOGGLE_CHAT: return "Chat"; case Action::TOGGLE_GUILD_ROSTER: return "Guild Roster / Social"; case Action::TOGGLE_DUNGEON_FINDER: return "Dungeon Finder"; + case Action::TOGGLE_WORLD_MAP: return "World Map"; + case Action::TOGGLE_NAMEPLATES: return "Nameplates"; + case Action::TOGGLE_RAID_FRAMES: return "Raid Frames"; + case Action::TOGGLE_QUEST_LOG: return "Quest Log"; case Action::ACTION_COUNT: break; } return "Unknown"; @@ -120,6 +128,10 @@ void KeybindingManager::loadFromConfigFile(const std::string& filePath) { else if (action == "toggle_chat") actionIdx = static_cast(Action::TOGGLE_CHAT); else if (action == "toggle_guild_roster") actionIdx = static_cast(Action::TOGGLE_GUILD_ROSTER); else if (action == "toggle_dungeon_finder") actionIdx = static_cast(Action::TOGGLE_DUNGEON_FINDER); + else if (action == "toggle_world_map") actionIdx = static_cast(Action::TOGGLE_WORLD_MAP); + else if (action == "toggle_nameplates") actionIdx = static_cast(Action::TOGGLE_NAMEPLATES); + else if (action == "toggle_raid_frames") actionIdx = static_cast(Action::TOGGLE_RAID_FRAMES); + else if (action == "toggle_quest_log") actionIdx = static_cast(Action::TOGGLE_QUEST_LOG); if (actionIdx < 0) continue; @@ -206,6 +218,10 @@ void KeybindingManager::saveToConfigFile(const std::string& filePath) const { {Action::TOGGLE_CHAT, "toggle_chat"}, {Action::TOGGLE_GUILD_ROSTER, "toggle_guild_roster"}, {Action::TOGGLE_DUNGEON_FINDER, "toggle_dungeon_finder"}, + {Action::TOGGLE_WORLD_MAP, "toggle_world_map"}, + {Action::TOGGLE_NAMEPLATES, "toggle_nameplates"}, + {Action::TOGGLE_RAID_FRAMES, "toggle_raid_frames"}, + {Action::TOGGLE_QUEST_LOG, "toggle_quest_log"}, }; for (const auto& [action, nameStr] : actionMap) {