1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-22 11:09:40 +00:00

Do not discard remnants

This commit is contained in:
Andrei Kortunov 2020-07-01 09:52:57 +04:00
parent ef6fe8d52a
commit 5f0cc87a67
3 changed files with 5 additions and 6 deletions

View file

@ -104,10 +104,9 @@ namespace MWInput
// game mode does not move the position of the GUI cursor // game mode does not move the position of the GUI cursor
float xMove = xAxis * dt * 1500.0f * mInvUiScalingFactor * mGamepadCursorSpeed; float xMove = xAxis * dt * 1500.0f * mInvUiScalingFactor * mGamepadCursorSpeed;
float yMove = yAxis * dt * 1500.0f * mInvUiScalingFactor * mGamepadCursorSpeed; float yMove = yAxis * dt * 1500.0f * mInvUiScalingFactor * mGamepadCursorSpeed;
if (xMove != 0 || yMove != 0 || zAxis != 0) float mouseWheelMove = -zAxis * dt * 1500.0f;
if (xMove != 0 || yMove != 0 || mouseWheelMove != 0)
{ {
int mouseWheelMove = static_cast<int>(-zAxis * dt * 1500.0f);
mMouseManager->injectMouseMove(xMove, yMove, mouseWheelMove); mMouseManager->injectMouseMove(xMove, yMove, mouseWheelMove);
mMouseManager->warpMouse(); mMouseManager->warpMouse();
MWBase::Environment::get().getWindowManager()->setCursorActive(true); MWBase::Environment::get().getWindowManager()->setCursorActive(true);

View file

@ -232,7 +232,7 @@ namespace MWInput
return MyGUI::InputManager::getInstance().injectMousePress(static_cast<int>(mGuiCursorX), static_cast<int>(mGuiCursorY), sdlButtonToMyGUI(button)); return MyGUI::InputManager::getInstance().injectMousePress(static_cast<int>(mGuiCursorX), static_cast<int>(mGuiCursorY), sdlButtonToMyGUI(button));
} }
void MouseManager::injectMouseMove(int xMove, int yMove, int mouseWheelMove) void MouseManager::injectMouseMove(float xMove, float yMove, float mouseWheelMove)
{ {
mGuiCursorX += xMove; mGuiCursorX += xMove;
mGuiCursorY += yMove; mGuiCursorY += yMove;
@ -242,7 +242,7 @@ namespace MWInput
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width - 1))); mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width - 1)));
mGuiCursorY = std::max(0.f, std::min(mGuiCursorY, float(viewSize.height - 1))); 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), static_cast<int>(mMouseWheel));
} }
void MouseManager::warpMouse() void MouseManager::warpMouse()

View file

@ -32,7 +32,7 @@ namespace MWInput
bool injectMouseButtonPress(Uint8 button); bool injectMouseButtonPress(Uint8 button);
bool injectMouseButtonRelease(Uint8 button); bool injectMouseButtonRelease(Uint8 button);
void injectMouseMove(int xMove, int yMove, int mouseWheelMove); void injectMouseMove(float xMove, float yMove, float mouseWheelMove);
void warpMouse(); void warpMouse();
void setMouseLookEnabled(bool enabled) { mMouseLookEnabled = enabled; } void setMouseLookEnabled(bool enabled) { mMouseLookEnabled = enabled; }