Alternative fix strategy by checking for binding state

deque
Fil Krynicki 11 years ago
parent bbb7ceab43
commit 97caa1f8a4

@ -558,21 +558,20 @@ namespace MWInput
void InputManager::keyReleased(const SDL_KeyboardEvent &arg )
{
mInputBinder->keyReleased (arg);
OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym);
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(kc));
setPlayerControlsEnabled(!MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(kc)));
mInputBinder->keyReleased (arg);
}
void InputManager::mousePressed( const SDL_MouseButtonEvent &arg, Uint8 id )
{
mInputBinder->mousePressed (arg, id);
if (id != SDL_BUTTON_LEFT && id != SDL_BUTTON_RIGHT)
return; // MyGUI has no use for these events
bool guiMode = false;
if (id == SDL_BUTTON_LEFT || id == SDL_BUTTON_RIGHT) // MyGUI has no use for these events
{
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI(id));
guiMode = guiMode && MWBase::Environment::get().getWindowManager()->isGuiMode();
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
{
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
@ -583,11 +582,27 @@ namespace MWInput
}
}
setPlayerControlsEnabled(!guiMode);
mInputBinder->mousePressed (arg, id);
}
void InputManager::mouseReleased( const SDL_MouseButtonEvent &arg, Uint8 id )
{
if(mInputBinder->detectingBindingState())
{
mInputBinder->mouseReleased (arg, id);
} else {
bool guiMode = MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, sdlButtonToMyGUI(id));
guiMode = guiMode && MWBase::Environment::get().getWindowManager()->isGuiMode();
if(mInputBinder->detectingBindingState()) return; // don't allow same mouseup to bind as initiated bind
MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, sdlButtonToMyGUI(id));
setPlayerControlsEnabled(!guiMode);
mInputBinder->mouseReleased (arg, id);
}
}
void InputManager::mouseMoved(const SFO::MouseMotionEvent &arg )

@ -796,6 +796,11 @@ namespace ICS
mMouseAxisBindingInitialValues[0] = ICS_MOUSE_AXIS_BINDING_NULL_VALUE;
}
bool InputControlSystem::detectingBindingState()
{
return mDetectingBindingControl != NULL;
}
void InputControlSystem::cancelDetectingBindingState()
{
mDetectingBindingControl = NULL;

@ -146,6 +146,7 @@ namespace ICS
void enableDetectingBindingState(Control* control, Control::ControlChangingDirection direction);
void cancelDetectingBindingState();
bool detectingBindingState();
bool save(std::string fileName = "");

Loading…
Cancel
Save