Additionally use movement keys (default WASD) to navigate GUI buttons

new-script-api
scrawl 7 years ago
parent 3d2ad2d339
commit 74e806d974

@ -174,6 +174,29 @@ namespace MWInput
} }
} }
void InputManager::handleGuiArrowKey(int action)
{
MyGUI::KeyCode key;
switch (action)
{
case A_MoveLeft:
key = MyGUI::KeyCode::ArrowLeft;
break;
case A_MoveRight:
key = MyGUI::KeyCode::ArrowRight;
break;
case A_MoveForward:
key = MyGUI::KeyCode::ArrowUp;
break;
case A_MoveBackward:
default:
key = MyGUI::KeyCode::ArrowDown;
break;
}
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0);
}
void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue) void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue)
{ {
resetIdleTime (); resetIdleTime ();
@ -235,6 +258,12 @@ namespace MWInput
resetIdleTime(); resetIdleTime();
activate(); activate();
break; break;
case A_MoveLeft:
case A_MoveRight:
case A_MoveForward:
case A_MoveBackward:
handleGuiArrowKey(action);
break;
case A_Journal: case A_Journal:
toggleJournal (); toggleJournal ();
break; break;

@ -214,6 +214,7 @@ namespace MWInput
void updateIdleTime(float dt); void updateIdleTime(float dt);
void setPlayerControlsEnabled(bool enabled); void setPlayerControlsEnabled(bool enabled);
void handleGuiArrowKey(int action);
void updateCursorMode(); void updateCursorMode();

Loading…
Cancel
Save