forked from teamnwah/openmw-tes3coop
Don't wrap mouse to window bounds when the gamepad axis did not move and fix off-by-one error
This commit is contained in:
parent
4051018862
commit
7eb48ea83b
1 changed files with 12 additions and 7 deletions
|
@ -398,16 +398,21 @@ namespace MWInput
|
||||||
|
|
||||||
// We keep track of our own mouse position, so that moving the mouse while in
|
// We keep track of our own mouse position, so that moving the mouse while in
|
||||||
// game mode does not move the position of the GUI cursor
|
// game mode does not move the position of the GUI cursor
|
||||||
mGuiCursorX += xAxis * dt * 1500.0f * mInvUiScalingFactor;
|
float xmove = xAxis * dt * 1500.0f * mInvUiScalingFactor;
|
||||||
mGuiCursorY += yAxis * dt * 1500.0f * mInvUiScalingFactor;
|
float ymove = yAxis * dt * 1500.0f * mInvUiScalingFactor;
|
||||||
|
if (xmove != 0|| ymove != 0)
|
||||||
|
{
|
||||||
|
mGuiCursorX += xmove;
|
||||||
|
mGuiCursorY += ymove;
|
||||||
mMouseWheel -= static_cast<int>(zAxis * dt * 1500.0f);
|
mMouseWheel -= static_cast<int>(zAxis * dt * 1500.0f);
|
||||||
|
|
||||||
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width)));
|
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width-1)));
|
||||||
mGuiCursorY = std::max(0.f, std::min(mGuiCursorY, float(viewSize.height)));
|
mGuiCursorY = std::max(0.f, std::min(mGuiCursorY, float(viewSize.height-1)));
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().injectMouseMove(static_cast<int>(mGuiCursorX), static_cast<int>(mGuiCursorY), mMouseWheel);
|
MyGUI::InputManager::getInstance().injectMouseMove(static_cast<int>(mGuiCursorX), static_cast<int>(mGuiCursorY), mMouseWheel);
|
||||||
mInputManager->warpMouse(static_cast<int>(mGuiCursorX/mInvUiScalingFactor), static_cast<int>(mGuiCursorY/mInvUiScalingFactor));
|
mInputManager->warpMouse(static_cast<int>(mGuiCursorX/mInvUiScalingFactor), static_cast<int>(mGuiCursorY/mInvUiScalingFactor));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mMouseLookEnabled)
|
if (mMouseLookEnabled)
|
||||||
{
|
{
|
||||||
float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f;
|
float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f;
|
||||||
|
|
Loading…
Reference in a new issue