mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 21:13:51 +00:00
fix(chat): disable shortcuts while typing
This commit is contained in:
parent
aed1f2ad21
commit
14e58eaa01
1 changed files with 60 additions and 54 deletions
|
|
@ -2274,10 +2274,12 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
|
||||||
void GameScreen::processTargetInput(game::GameHandler& gameHandler) {
|
void GameScreen::processTargetInput(game::GameHandler& gameHandler) {
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
auto& input = core::Input::getInstance();
|
auto& input = core::Input::getInstance();
|
||||||
|
const bool textFocus = chatInputActive || io.WantTextInput;
|
||||||
|
|
||||||
// Tab targeting (when keyboard not captured by UI)
|
// Tab targeting (when keyboard not captured by UI)
|
||||||
if (!io.WantCaptureKeyboard) {
|
if (!io.WantCaptureKeyboard) {
|
||||||
if (input.isKeyJustPressed(SDL_SCANCODE_TAB)) {
|
// When typing in chat (or any text input), never treat keys as gameplay/UI shortcuts.
|
||||||
|
if (!textFocus && input.isKeyJustPressed(SDL_SCANCODE_TAB)) {
|
||||||
const auto& movement = gameHandler.getMovementInfo();
|
const auto& movement = gameHandler.getMovementInfo();
|
||||||
gameHandler.tabTarget(movement.x, movement.y, movement.z);
|
gameHandler.tabTarget(movement.x, movement.y, movement.z);
|
||||||
}
|
}
|
||||||
|
|
@ -2300,69 +2302,70 @@ void GameScreen::processTargetInput(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle character screen (C) and inventory/bags (I)
|
if (!textFocus) {
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_CHARACTER_SCREEN)) {
|
// Toggle character screen (C) and inventory/bags (I)
|
||||||
inventoryScreen.toggleCharacter();
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_CHARACTER_SCREEN)) {
|
||||||
}
|
inventoryScreen.toggleCharacter();
|
||||||
|
}
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_INVENTORY)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_INVENTORY)) {
|
||||||
inventoryScreen.toggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_BAGS)) {
|
|
||||||
if (inventoryScreen.isSeparateBags()) {
|
|
||||||
inventoryScreen.openAllBags();
|
|
||||||
} else {
|
|
||||||
inventoryScreen.toggle();
|
inventoryScreen.toggle();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_NAMEPLATES)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_BAGS)) {
|
||||||
showNameplates_ = !showNameplates_;
|
if (inventoryScreen.isSeparateBags()) {
|
||||||
}
|
inventoryScreen.openAllBags();
|
||||||
|
} else {
|
||||||
|
inventoryScreen.toggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_WORLD_MAP)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_NAMEPLATES)) {
|
||||||
showWorldMap_ = !showWorldMap_;
|
showNameplates_ = !showNameplates_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_MINIMAP)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_WORLD_MAP)) {
|
||||||
showMinimap_ = !showMinimap_;
|
showWorldMap_ = !showWorldMap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_RAID_FRAMES)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_MINIMAP)) {
|
||||||
showRaidFrames_ = !showRaidFrames_;
|
showMinimap_ = !showMinimap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_QUEST_LOG)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_RAID_FRAMES)) {
|
||||||
questLogScreen.toggle();
|
showRaidFrames_ = !showRaidFrames_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_ACHIEVEMENTS)) {
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_QUEST_LOG)) {
|
||||||
showAchievementWindow_ = !showAchievementWindow_;
|
questLogScreen.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle Titles window with H (hero/title screen — no conflicting keybinding)
|
if (KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_ACHIEVEMENTS)) {
|
||||||
if (input.isKeyJustPressed(SDL_SCANCODE_H) && !ImGui::GetIO().WantCaptureKeyboard) {
|
showAchievementWindow_ = !showAchievementWindow_;
|
||||||
showTitlesWindow_ = !showTitlesWindow_;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Toggle Titles window with H (hero/title screen — no conflicting keybinding)
|
||||||
|
if (input.isKeyJustPressed(SDL_SCANCODE_H) && !ImGui::GetIO().WantCaptureKeyboard) {
|
||||||
|
showTitlesWindow_ = !showTitlesWindow_;
|
||||||
|
}
|
||||||
|
|
||||||
// Action bar keys (1-9, 0, -, =)
|
// Action bar keys (1-9, 0, -, =)
|
||||||
static const SDL_Scancode actionBarKeys[] = {
|
static const SDL_Scancode actionBarKeys[] = {
|
||||||
SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4,
|
SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4,
|
||||||
SDL_SCANCODE_5, SDL_SCANCODE_6, SDL_SCANCODE_7, SDL_SCANCODE_8,
|
SDL_SCANCODE_5, SDL_SCANCODE_6, SDL_SCANCODE_7, SDL_SCANCODE_8,
|
||||||
SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS
|
SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS
|
||||||
};
|
};
|
||||||
const bool shiftDown = input.isKeyPressed(SDL_SCANCODE_LSHIFT) || input.isKeyPressed(SDL_SCANCODE_RSHIFT);
|
const bool shiftDown = input.isKeyPressed(SDL_SCANCODE_LSHIFT) || input.isKeyPressed(SDL_SCANCODE_RSHIFT);
|
||||||
const auto& bar = gameHandler.getActionBar();
|
const auto& bar = gameHandler.getActionBar();
|
||||||
for (int i = 0; i < game::GameHandler::SLOTS_PER_BAR; ++i) {
|
for (int i = 0; i < game::GameHandler::SLOTS_PER_BAR; ++i) {
|
||||||
if (input.isKeyJustPressed(actionBarKeys[i])) {
|
if (input.isKeyJustPressed(actionBarKeys[i])) {
|
||||||
int slotIdx = shiftDown ? (game::GameHandler::SLOTS_PER_BAR + i) : i;
|
int slotIdx = shiftDown ? (game::GameHandler::SLOTS_PER_BAR + i) : i;
|
||||||
if (bar[slotIdx].type == game::ActionBarSlot::SPELL && bar[slotIdx].isReady()) {
|
if (bar[slotIdx].type == game::ActionBarSlot::SPELL && bar[slotIdx].isReady()) {
|
||||||
uint64_t target = gameHandler.hasTarget() ? gameHandler.getTargetGuid() : 0;
|
uint64_t target = gameHandler.hasTarget() ? gameHandler.getTargetGuid() : 0;
|
||||||
gameHandler.castSpell(bar[slotIdx].id, target);
|
gameHandler.castSpell(bar[slotIdx].id, target);
|
||||||
} else if (bar[slotIdx].type == game::ActionBarSlot::ITEM && bar[slotIdx].id != 0) {
|
} else if (bar[slotIdx].type == game::ActionBarSlot::ITEM && bar[slotIdx].id != 0) {
|
||||||
gameHandler.useItemById(bar[slotIdx].id);
|
gameHandler.useItemById(bar[slotIdx].id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11224,7 +11227,9 @@ void GameScreen::renderLfgProposalPopup(game::GameHandler& gameHandler) {
|
||||||
|
|
||||||
void GameScreen::renderGuildRoster(game::GameHandler& gameHandler) {
|
void GameScreen::renderGuildRoster(game::GameHandler& gameHandler) {
|
||||||
// Guild Roster toggle (customizable keybind)
|
// Guild Roster toggle (customizable keybind)
|
||||||
if (!ImGui::GetIO().WantCaptureKeyboard && KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_GUILD_ROSTER)) {
|
if (!chatInputActive && !ImGui::GetIO().WantTextInput &&
|
||||||
|
!ImGui::GetIO().WantCaptureKeyboard &&
|
||||||
|
KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_GUILD_ROSTER)) {
|
||||||
showGuildRoster_ = !showGuildRoster_;
|
showGuildRoster_ = !showGuildRoster_;
|
||||||
if (showGuildRoster_) {
|
if (showGuildRoster_) {
|
||||||
// Open friends tab directly if not in guild
|
// Open friends tab directly if not in guild
|
||||||
|
|
@ -19543,7 +19548,8 @@ void GameScreen::renderZoneText() {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
void GameScreen::renderDungeonFinderWindow(game::GameHandler& gameHandler) {
|
void GameScreen::renderDungeonFinderWindow(game::GameHandler& gameHandler) {
|
||||||
// Toggle Dungeon Finder (customizable keybind)
|
// Toggle Dungeon Finder (customizable keybind)
|
||||||
if (!chatInputActive && KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_DUNGEON_FINDER)) {
|
if (!chatInputActive && !ImGui::GetIO().WantTextInput &&
|
||||||
|
KeybindingManager::getInstance().isActionPressed(KeybindingManager::Action::TOGGLE_DUNGEON_FINDER)) {
|
||||||
showDungeonFinder_ = !showDungeonFinder_;
|
showDungeonFinder_ = !showDungeonFinder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue