@ -29,22 +29,18 @@ namespace MWInput
, mCameraYMultiplier ( Settings : : Manager : : getFloat ( " camera y multiplier " , " Input " ) )
, mBindingsManager ( bindingsManager )
, mInputWrapper ( inputWrapper )
, mInvUiScalingFactor ( 1.f )
, mGuiCursorX ( 0 )
, mGuiCursorY ( 0 )
, mMouseWheel ( 0 )
, mMouseLookEnabled ( false )
, mGuiCursorEnabled ( true )
{
float uiScale = Settings : : Manager : : getFloat ( " scaling factor " , " GUI " ) ;
if ( uiScale > 0.f )
mInvUiScalingFactor = 1.f / uiScale ;
int w , h ;
SDL_GetWindowSize ( window , & w , & h ) ;
mGuiCursorX = mInvUiScalingFactor * w / 2.f ;
mGuiCursorY = mInvUiScalingFactor * h / 2.f ;
float uiScale = MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getScalingFactor ( ) ;
mGuiCursorX = w / ( 2.f * uiScale ) ;
mGuiCursorY = h / ( 2.f * uiScale ) ;
}
void MouseManager : : processChangedSettings ( const Settings : : CategorySettingVector & changed )
@ -79,8 +75,9 @@ namespace MWInput
// 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
mGuiCursorX = static_cast < float > ( arg . x ) * mInvUiScalingFactor ;
mGuiCursorY = static_cast < float > ( arg . y ) * mInvUiScalingFactor ;
float uiScale = MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getScalingFactor ( ) ;
mGuiCursorX = static_cast < float > ( arg . x ) / uiScale ;
mGuiCursorY = static_cast < float > ( arg . y ) / uiScale ;
mMouseWheel = static_cast < int > ( arg . z ) ;
@ -249,6 +246,7 @@ namespace MWInput
void MouseManager : : warpMouse ( )
{
mInputWrapper - > warpMouse ( static_cast < int > ( mGuiCursorX / mInvUiScalingFactor ) , static_cast < int > ( mGuiCursorY / mInvUiScalingFactor ) ) ;
float uiScale = MWBase : : Environment : : get ( ) . getWindowManager ( ) - > getScalingFactor ( ) ;
mInputWrapper - > warpMouse ( static_cast < int > ( mGuiCursorX * uiScale ) , static_cast < int > ( mGuiCursorY * uiScale ) ) ;
}
}