This commit is contained in:
scrawl 2013-01-03 01:07:17 +01:00
parent ff74f687fb
commit ddbe13e569
2 changed files with 9 additions and 1 deletions

View file

@ -40,6 +40,7 @@ namespace MWInput
, mMouseLookEnabled(true) , mMouseLookEnabled(true)
, mMouseX(ogre.getWindow()->getWidth ()/2.f) , mMouseX(ogre.getWindow()->getWidth ()/2.f)
, mMouseY(ogre.getWindow()->getHeight ()/2.f) , mMouseY(ogre.getWindow()->getHeight ()/2.f)
, mMouseWheel(0)
, mUserFile(userFile) , mUserFile(userFile)
, mDragDrop(false) , mDragDrop(false)
, mGuiCursorEnabled(false) , mGuiCursorEnabled(false)
@ -242,6 +243,11 @@ namespace MWInput
mKeyboard->capture(); mKeyboard->capture();
mMouse->capture(); mMouse->capture();
// inject some fake mouse movement to force updating MyGUI's widget states
// this shouldn't do any harm since we're moving back to the original position afterwards
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX+1), int(mMouseY+1), mMouseWheel);
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel);
// update values of channels (as a result of pressed keys) // update values of channels (as a result of pressed keys)
if (!loading) if (!loading)
mInputCtrl->update(dt); mInputCtrl->update(dt);
@ -486,8 +492,9 @@ namespace MWInput
mMouseY += float(arg.state.Y.rel) * mUISensitivity * mUIYMultiplier; mMouseY += float(arg.state.Y.rel) * mUISensitivity * mUIYMultiplier;
mMouseX = std::max(0.f, std::min(mMouseX, float(viewSize.width))); mMouseX = std::max(0.f, std::min(mMouseX, float(viewSize.width)));
mMouseY = std::max(0.f, std::min(mMouseY, float(viewSize.height))); mMouseY = std::max(0.f, std::min(mMouseY, float(viewSize.height)));
mMouseWheel = arg.state.Z.abs;
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), arg.state.Z.abs); MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel);
} }
if (mMouseLookEnabled) if (mMouseLookEnabled)

View file

@ -147,6 +147,7 @@ namespace MWInput
float mMouseX; float mMouseX;
float mMouseY; float mMouseY;
int mMouseWheel;
std::map<std::string, bool> mControlSwitch; std::map<std::string, bool> mControlSwitch;