Retrieve the initial mouse coordinates on SDL2 backend ( since SDL2 does not provided the real coordinates until the mouse is moved ).

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2017-04-09 19:29:54 -03:00
parent a570cd2812
commit a46f6d777c
2 changed files with 9 additions and 5 deletions

View File

@@ -329,12 +329,16 @@ void InputSDL::init() {
SDL_GetWindowSize(sdlw, &scaledX, &scaledY);
mDPIScale = (Float)realX / (Float)scaledX;
Vector2if mTempMouse;
Vector2i mTempMouse;
Vector2i mTempWinPos;
Recti mBordersSize;
SDL_GetMouseState( &mTempMouse.x, &mTempMouse.y );
SDL_GetGlobalMouseState( &mTempMouse.x, &mTempMouse.y );
SDL_GetWindowPosition( sdlw, &mTempWinPos.x, &mTempWinPos.y );
SDL_GetWindowBordersSize( sdlw, &mBordersSize.Top, &mBordersSize.Left, &mBordersSize.Bottom, &mBordersSize.Right );
mMousePos.x = (int)mTempMouse.x;
mMousePos.y = (int)mTempMouse.y;
mMousePos.x = (int)mTempMouse.x - mTempWinPos.x - mBordersSize.Left;
mMousePos.y = (int)mTempMouse.y - mTempWinPos.y - mBordersSize.Top;
initializeTables();

View File

@@ -66,7 +66,7 @@ void videoResize( EE::Window::Window * w ) {
BlendMode::setMode( ALPHA_BLENDONE );
/// Set the line width
GlobalBatchRenderer::instance()->setLineWidth( 2 );
GLi->lineWidth( 2 );
if ( ShadersSupported ) {
/// Rebind the Shader