|
|
@ -202,6 +202,11 @@ namespace MWInput
|
|
|
|
|
|
|
|
|
|
|
|
void InputManager::handleGuiArrowKey(int action)
|
|
|
|
void InputManager::handleGuiArrowKey(int action)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// This is currently keyboard-specific code
|
|
|
|
|
|
|
|
// TODO: see if GUI controls can be refactored into a single function
|
|
|
|
|
|
|
|
if (mJoystickLastUsed)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (SDL_IsTextInputActive())
|
|
|
|
if (SDL_IsTextInputActive())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
@ -229,13 +234,10 @@ namespace MWInput
|
|
|
|
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0, false);
|
|
|
|
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool InputManager::gamepadToGuiControl(const SDL_ControllerButtonEvent &arg, bool release=false)
|
|
|
|
bool InputManager::gamepadToGuiControl(const SDL_ControllerButtonEvent &arg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Presumption of GUI mode will be removed in the future.
|
|
|
|
// Presumption of GUI mode will be removed in the future.
|
|
|
|
// MyGUI KeyCodes *may* change.
|
|
|
|
// MyGUI KeyCodes *may* change.
|
|
|
|
// Currently button releases are ignored.
|
|
|
|
|
|
|
|
if (release)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MyGUI::KeyCode key = MyGUI::KeyCode::None;
|
|
|
|
MyGUI::KeyCode key = MyGUI::KeyCode::None;
|
|
|
|
switch (arg.button)
|
|
|
|
switch (arg.button)
|
|
|
@ -386,9 +388,6 @@ namespace MWInput
|
|
|
|
case A_GameMenu:
|
|
|
|
case A_GameMenu:
|
|
|
|
toggleMainMenu ();
|
|
|
|
toggleMainMenu ();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case A_OptionsMenu:
|
|
|
|
|
|
|
|
toggleOptionsMenu();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case A_Screenshot:
|
|
|
|
case A_Screenshot:
|
|
|
|
screenshot();
|
|
|
|
screenshot();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -406,8 +405,7 @@ namespace MWInput
|
|
|
|
case A_MoveRight:
|
|
|
|
case A_MoveRight:
|
|
|
|
case A_MoveForward:
|
|
|
|
case A_MoveForward:
|
|
|
|
case A_MoveBackward:
|
|
|
|
case A_MoveBackward:
|
|
|
|
// Temporary shut-down of this function until deemed necessary.
|
|
|
|
handleGuiArrowKey(action);
|
|
|
|
//handleGuiArrowKey(action);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case A_Journal:
|
|
|
|
case A_Journal:
|
|
|
|
toggleJournal ();
|
|
|
|
toggleJournal ();
|
|
|
@ -1002,9 +1000,9 @@ namespace MWInput
|
|
|
|
mJoystickLastUsed = true;
|
|
|
|
mJoystickLastUsed = true;
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (gamepadToGuiControl(arg, false))
|
|
|
|
if (gamepadToGuiControl(arg))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
else if (mGamepadGuiCursorEnabled)
|
|
|
|
if (mGamepadGuiCursorEnabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Temporary mouse binding until keyboard controls are available:
|
|
|
|
// Temporary mouse binding until keyboard controls are available:
|
|
|
|
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
|
|
|
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
|
|
@ -1045,9 +1043,7 @@ namespace MWInput
|
|
|
|
mJoystickLastUsed = true;
|
|
|
|
mJoystickLastUsed = true;
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (gamepadToGuiControl(arg, true))
|
|
|
|
if (mGamepadGuiCursorEnabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
else if (mGamepadGuiCursorEnabled)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Temporary mouse binding until keyboard controls are available:
|
|
|
|
// Temporary mouse binding until keyboard controls are available:
|
|
|
|
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
|
|
|
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
|
|
@ -1146,37 +1142,19 @@ namespace MWInput
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
|
|
|
|
|
|
|
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((inGame && mode == MWGui::GM_MainMenu) || mode == MWGui::GM_Settings)
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inGame && mode != MWGui::GM_MainMenu)
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_MainMenu);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InputManager::toggleOptionsMenu()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (MyGUI::InputManager::getInstance().isModalAny())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWindowManager()->exitCurrentModal();
|
|
|
|
MWBase::Environment::get().getWindowManager()->toggleConsole();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
|
|
|
if (!MWBase::Environment::get().getWindowManager()->isGuiMode()) //No open GUIs, open up the MainMenu
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
|
|
|
|
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
|
|
|
}
|
|
|
|
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
|
|
|
else //Close current GUI
|
|
|
|
|
|
|
|
{
|
|
|
|
if ((inGame && mode == MWGui::GM_MainMenu) || mode == MWGui::GM_Settings)
|
|
|
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
|
|
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (inGame && mode != MWGui::GM_Settings)
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Settings);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InputManager::quickLoad() {
|
|
|
|
void InputManager::quickLoad() {
|
|
|
@ -1531,7 +1509,6 @@ namespace MWInput
|
|
|
|
defaultButtonBindings[A_TogglePOV] = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
|
|
|
|
defaultButtonBindings[A_TogglePOV] = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
|
|
|
|
defaultButtonBindings[A_Inventory] = SDL_CONTROLLER_BUTTON_B;
|
|
|
|
defaultButtonBindings[A_Inventory] = SDL_CONTROLLER_BUTTON_B;
|
|
|
|
defaultButtonBindings[A_GameMenu] = SDL_CONTROLLER_BUTTON_START;
|
|
|
|
defaultButtonBindings[A_GameMenu] = SDL_CONTROLLER_BUTTON_START;
|
|
|
|
defaultButtonBindings[A_OptionsMenu] = SDL_CONTROLLER_BUTTON_BACK;
|
|
|
|
|
|
|
|
defaultButtonBindings[A_QuickSave] = SDL_CONTROLLER_BUTTON_GUIDE;
|
|
|
|
defaultButtonBindings[A_QuickSave] = SDL_CONTROLLER_BUTTON_GUIDE;
|
|
|
|
defaultButtonBindings[A_MoveForward] = SDL_CONTROLLER_BUTTON_DPAD_UP;
|
|
|
|
defaultButtonBindings[A_MoveForward] = SDL_CONTROLLER_BUTTON_DPAD_UP;
|
|
|
|
defaultButtonBindings[A_MoveLeft] = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
|
|
|
|
defaultButtonBindings[A_MoveLeft] = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
|
|
|
@ -1612,7 +1589,6 @@ namespace MWInput
|
|
|
|
descriptions[A_Journal] = "sJournal";
|
|
|
|
descriptions[A_Journal] = "sJournal";
|
|
|
|
descriptions[A_Rest] = "sRestKey";
|
|
|
|
descriptions[A_Rest] = "sRestKey";
|
|
|
|
descriptions[A_Inventory] = "sInventory";
|
|
|
|
descriptions[A_Inventory] = "sInventory";
|
|
|
|
descriptions[A_OptionsMenu] = "sPreferences";
|
|
|
|
|
|
|
|
descriptions[A_TogglePOV] = "sTogglePOVCmd";
|
|
|
|
descriptions[A_TogglePOV] = "sTogglePOVCmd";
|
|
|
|
descriptions[A_QuickKeysMenu] = "sQuickMenu";
|
|
|
|
descriptions[A_QuickKeysMenu] = "sQuickMenu";
|
|
|
|
descriptions[A_QuickKey1] = "sQuick1Cmd";
|
|
|
|
descriptions[A_QuickKey1] = "sQuick1Cmd";
|
|
|
@ -1750,7 +1726,6 @@ namespace MWInput
|
|
|
|
ret.push_back(A_Inventory);
|
|
|
|
ret.push_back(A_Inventory);
|
|
|
|
ret.push_back(A_Journal);
|
|
|
|
ret.push_back(A_Journal);
|
|
|
|
ret.push_back(A_Rest);
|
|
|
|
ret.push_back(A_Rest);
|
|
|
|
ret.push_back(A_OptionsMenu);
|
|
|
|
|
|
|
|
ret.push_back(A_Console);
|
|
|
|
ret.push_back(A_Console);
|
|
|
|
ret.push_back(A_QuickSave);
|
|
|
|
ret.push_back(A_QuickSave);
|
|
|
|
ret.push_back(A_QuickLoad);
|
|
|
|
ret.push_back(A_QuickLoad);
|
|
|
@ -1783,7 +1758,6 @@ namespace MWInput
|
|
|
|
ret.push_back(A_Inventory);
|
|
|
|
ret.push_back(A_Inventory);
|
|
|
|
ret.push_back(A_Journal);
|
|
|
|
ret.push_back(A_Journal);
|
|
|
|
ret.push_back(A_Rest);
|
|
|
|
ret.push_back(A_Rest);
|
|
|
|
ret.push_back(A_OptionsMenu);
|
|
|
|
|
|
|
|
ret.push_back(A_QuickSave);
|
|
|
|
ret.push_back(A_QuickSave);
|
|
|
|
ret.push_back(A_QuickLoad);
|
|
|
|
ret.push_back(A_QuickLoad);
|
|
|
|
ret.push_back(A_Screenshot);
|
|
|
|
ret.push_back(A_Screenshot);
|
|
|
|