MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / handleKeyDown

Method handleKeyDown

game/ui/tileview/battleview.cpp:3018–3507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3016}
3017
3018bool BattleView::handleKeyDown(Event *e)
3019{
3020 // Common keys active in both debug and normal mode
3021 switch (e->keyboard().KeyCode)
3022 {
3023 case SDLK_RSHIFT:
3024 modifierRShift = true;
3025 return true;
3026 case SDLK_LSHIFT:
3027 modifierLShift = true;
3028 return true;
3029 case SDLK_RALT:
3030 modifierRAlt = true;
3031 return true;
3032 case SDLK_LALT:
3033 modifierLAlt = true;
3034 return true;
3035 case SDLK_RCTRL:
3036 modifierRCtrl = true;
3037 return true;
3038 case SDLK_LCTRL:
3039 modifierLCtrl = true;
3040 return true;
3041 case SDLK_ESCAPE:
3042 if (activeTab != notMyTurnTab)
3043 {
3044 selectionState = BattleSelectionState::Normal;
3045 this->refresh();
3046 fw().stageQueueCommand(
3047 {StageCmd::Command::PUSH, mksp<InGameOptions>(state->shared_from_this())});
3048 }
3049 return true;
3050 case SDLK_TAB:
3051 baseForm->findControl("BUTTON_TOGGLE_STRATMAP")->click();
3052 return true;
3053 case SDLK_PAGEUP:
3054 setZLevel(getZLevel() + 1);
3055 setSelectedTilePosition(
3056 {selectedTilePosition.x, selectedTilePosition.y, selectedTilePosition.z + 1});
3057 updateLayerButtons();
3058 return true;
3059 case SDLK_PAGEDOWN:
3060 setZLevel(getZLevel() - 1);
3061 setSelectedTilePosition(
3062 {selectedTilePosition.x, selectedTilePosition.y, selectedTilePosition.z - 1});
3063 updateLayerButtons();
3064 return true;
3065 case SDLK_SPACE:
3066 if (updateSpeed != BattleUpdateSpeed::Pause)
3067 setUpdateSpeed(BattleUpdateSpeed::Pause);
3068 else
3069 setUpdateSpeed(lastSpeed);
3070 return true;
3071 default:
3072 break;
3073 }
3074 // Debug keys (cheats)
3075 if (debugHotkeyMode)

Callers

nothing calls this directly

Calls 15

refreshMethod · 0.95
stageQueueCommandMethod · 0.80
findControlMethod · 0.80
getTileMethod · 0.80
insertMethod · 0.80
getOwningTileMethod · 0.80
executeAIMovementMethod · 0.80
applyDamageDirectMethod · 0.80
retreatMethod · 0.80
isConsciousMethod · 0.80
cancelMissionsMethod · 0.80
endTurnMethod · 0.80

Tested by

no test coverage detected