void PlayerPanel::onKeyDown(Event::Keyboard* event) { switch (event->keyCode()) { case SDLK_a: // @TODO: initiateCombat(); break; case SDLK_c: openCharacterScreen(); break; case SDLK_i: openInventory(); break; case SDLK_p: if (event->controlPressed()) { // @TODO: pause game } else { openPipBoy(); } break; case SDLK_z: openPipBoy(); // @TODO: go to clock break; case SDLK_ESCAPE: case SDLK_o: openGameMenu(); break; case SDLK_b: changeHand(); break; // M button is handled in State::Location case SDLK_n: // @TODO: toggleItemMode(); break; case SDLK_s: if (event->controlPressed()) { openSaveGame(); } else { openSkilldex(); } break; case SDLK_l: if (event->controlPressed()) { openLoadGame(); } break; case SDLK_x: if (event->controlPressed()) { Game::getInstance()->pushState(new State::ExitConfirm()); playWindowOpenSfx(); } case SDLK_SLASH: // @TODO: printCurrentTime(); break; case SDLK_TAB: openMap(); break; case SDLK_F1: // @TODO: help screen break; case SDLK_F2: // @TODO: volume down break; case SDLK_F3: // @TODO: volume up break; case SDLK_F4: if (!event->altPressed()) { openSaveGame(); } break; case SDLK_F5: openLoadGame(); break; case SDLK_F6: // @TODO: quick save logic break; case SDLK_F7: // @TODO: quick load logic break; case SDLK_F10: Game::getInstance()->pushState(new State::ExitConfirm()); playWindowOpenSfx(); break; case SDLK_F12: // @TODO: save screenshot break; } }
void GameSceneUILayer::controlUIKeyboard() { KeyState mapKey1 = GET_INPUT_MANAGER()->getKeyState(KC_MAP); KeyState mapKey2 = GET_INPUT_MANAGER()->getKeyState(KC_TAB); KeyState escKey = GET_INPUT_MANAGER()->getKeyState(KC_ESC); KeyState charKey = GET_INPUT_MANAGER()->getKeyState(KC_CHARACTER); KeyState enterKey = GET_INPUT_MANAGER()->getKeyState(KC_RETURN); if (escKey == KS_PRESS) { GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false); if (m_MenuWindowOn) { closeGameMenu(); } else { if (m_MapWindowOn) { closeMapWindow(); } else if (m_CharWindowOn) { closeCharWindow(); } else { openGameMenu(); } } } if (mapKey1 == KS_PRESS || mapKey2 == KS_PRESS) { GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false); if (!m_MenuWindowOn) { if (m_MapWindowOn) { closeMapWindow(); } else { openMapWindow(); } } } if (charKey == KS_PRESS) { GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false); if (!m_MenuWindowOn) { if (m_CharWindowOn) { closeCharWindow(); } else { openCharWindow(); } } } }