diff --git a/src/ui/spellbook_screen.cpp b/src/ui/spellbook_screen.cpp index 0a355ff3..ef8815f5 100644 --- a/src/ui/spellbook_screen.cpp +++ b/src/ui/spellbook_screen.cpp @@ -1,4 +1,5 @@ #include "ui/spellbook_screen.hpp" +#include "ui/keybinding_manager.hpp" #include "core/input.hpp" #include "core/application.hpp" #include "rendering/vk_context.hpp" @@ -563,13 +564,14 @@ void SpellbookScreen::renderSpellTooltip(const SpellInfo* info, game::GameHandle } void SpellbookScreen::render(game::GameHandler& gameHandler, pipeline::AssetManager* assetManager) { - // P key toggle (edge-triggered) - bool wantsTextInput = ImGui::GetIO().WantTextInput; - bool pDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_P); - if (pDown && !pKeyWasDown) { + // Spellbook toggle via keybinding (edge-triggered) + // Customizable key (default: P) from KeybindingManager + bool spellbookDown = KeybindingManager::getInstance().isActionPressed( + KeybindingManager::Action::TOGGLE_SPELLBOOK, false); + if (spellbookDown && !pKeyWasDown) { open = !open; } - pKeyWasDown = pDown; + pKeyWasDown = spellbookDown; if (!open) return; diff --git a/src/ui/talent_screen.cpp b/src/ui/talent_screen.cpp index eeff7c41..3a487d5d 100644 --- a/src/ui/talent_screen.cpp +++ b/src/ui/talent_screen.cpp @@ -1,4 +1,5 @@ #include "ui/talent_screen.hpp" +#include "ui/keybinding_manager.hpp" #include "core/input.hpp" #include "core/application.hpp" #include "core/logger.hpp" @@ -22,13 +23,14 @@ static const char* getClassName(uint8_t classId) { } void TalentScreen::render(game::GameHandler& gameHandler) { - // N key toggle (edge-triggered) - bool wantsTextInput = ImGui::GetIO().WantTextInput; - bool nDown = !wantsTextInput && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_N); - if (nDown && !nKeyWasDown) { + // Talents toggle via keybinding (edge-triggered) + // Customizable key (default: N) from KeybindingManager + bool talentsDown = KeybindingManager::getInstance().isActionPressed( + KeybindingManager::Action::TOGGLE_TALENTS, false); + if (talentsDown && !nKeyWasDown) { open = !open; } - nKeyWasDown = nDown; + nKeyWasDown = talentsDown; if (!open) return;