mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 15:39:41 +00:00
Fixed binding controls to A on joystick
This commit is contained in:
parent
ad54e09593
commit
a7a211860a
2 changed files with 21 additions and 15 deletions
|
@ -740,13 +740,16 @@ namespace MWInput
|
||||||
if (arg.button == SDL_CONTROLLER_BUTTON_A || arg.button == SDL_CONTROLLER_BUTTON_B) // We'll pretend that A is left click and B is right click
|
if (arg.button == SDL_CONTROLLER_BUTTON_A || arg.button == SDL_CONTROLLER_BUTTON_B) // We'll pretend that A is left click and B is right click
|
||||||
{
|
{
|
||||||
guiMode = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
guiMode = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||||
guiMode = MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI((arg.button == SDL_CONTROLLER_BUTTON_B) ? SDL_BUTTON_RIGHT : SDL_BUTTON_LEFT)) && guiMode;
|
if(!mInputBinder->detectingBindingState())
|
||||||
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
|
||||||
{
|
{
|
||||||
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
guiMode = MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI((arg.button == SDL_CONTROLLER_BUTTON_B) ? SDL_BUTTON_RIGHT : SDL_BUTTON_LEFT)) && guiMode;
|
||||||
if (b && b->getEnabled())
|
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
||||||
|
if (b && b->getEnabled())
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
23
extern/oics/ICSInputControlSystem_joystick.cpp
vendored
23
extern/oics/ICSInputControlSystem_joystick.cpp
vendored
|
@ -180,23 +180,26 @@ namespace ICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mDetectingBindingListener)
|
|
||||||
{
|
|
||||||
mDetectingBindingListener->joystickButtonBindingDetected(this,
|
|
||||||
mDetectingBindingControl, evt.button, mDetectingBindingDirection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputControlSystem::buttonReleased(const SDL_ControllerButtonEvent &evt)
|
void InputControlSystem::buttonReleased(const SDL_ControllerButtonEvent &evt)
|
||||||
{
|
{
|
||||||
if(mActive)
|
if(mActive)
|
||||||
{
|
{
|
||||||
ControlsButtonBinderMapType::const_iterator it = mControlsJoystickButtonBinderMap.find(evt.button);
|
if(!mDetectingBindingControl)
|
||||||
if(it != mControlsJoystickButtonBinderMap.end())
|
|
||||||
{
|
{
|
||||||
it->second.control->setChangingDirection(Control::STOP);
|
ControlsButtonBinderMapType::const_iterator it = mControlsJoystickButtonBinderMap.find(evt.button);
|
||||||
}
|
if(it != mControlsJoystickButtonBinderMap.end())
|
||||||
|
{
|
||||||
|
it->second.control->setChangingDirection(Control::STOP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(mDetectingBindingListener)
|
||||||
|
{
|
||||||
|
mDetectingBindingListener->joystickButtonBindingDetected(this,
|
||||||
|
mDetectingBindingControl, evt.button, mDetectingBindingDirection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue