Fixed binding controls to A on joystick

celladd
Digmaster 10 years ago
parent ad54e09593
commit a7a211860a

@ -740,6 +740,8 @@ 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();
if(!mInputBinder->detectingBindingState())
{
guiMode = MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI((arg.button == SDL_CONTROLLER_BUTTON_B) ? SDL_BUTTON_RIGHT : SDL_BUTTON_LEFT)) && guiMode; guiMode = MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI((arg.button == SDL_CONTROLLER_BUTTON_B) ? SDL_BUTTON_RIGHT : SDL_BUTTON_LEFT)) && guiMode;
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0) if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
{ {
@ -750,6 +752,7 @@ namespace MWInput
} }
} }
} }
}
setPlayerControlsEnabled(!guiMode); setPlayerControlsEnabled(!guiMode);

@ -180,17 +180,14 @@ 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)
{
if(!mDetectingBindingControl)
{ {
ControlsButtonBinderMapType::const_iterator it = mControlsJoystickButtonBinderMap.find(evt.button); ControlsButtonBinderMapType::const_iterator it = mControlsJoystickButtonBinderMap.find(evt.button);
if(it != mControlsJoystickButtonBinderMap.end()) if(it != mControlsJoystickButtonBinderMap.end())
@ -198,6 +195,12 @@ namespace ICS
it->second.control->setChangingDirection(Control::STOP); it->second.control->setChangingDirection(Control::STOP);
} }
} }
else if(mDetectingBindingListener)
{
mDetectingBindingListener->joystickButtonBindingDetected(this,
mDetectingBindingControl, evt.button, mDetectingBindingDirection);
}
}
} }
void InputControlSystem::axisMoved(const SDL_ControllerAxisEvent &evt) void InputControlSystem::axisMoved(const SDL_ControllerAxisEvent &evt)

Loading…
Cancel
Save