engine: platform: sdl: fix incorrect mouse cursor positioning on high-dpi displays (#1623)

Signed-off-by: SheridanR <sheridan.rathbun@gmail.com>
This commit is contained in:
Sheridan Kane Rathbun
2024-02-23 20:54:17 +03:00
committed by GitHub
parent 0f3359fc05
commit 98d88266a6
2 changed files with 11 additions and 2 deletions
+11
View File
@@ -43,7 +43,18 @@ Platform_GetMousePos
*/
void GAME_EXPORT Platform_GetMousePos( int *x, int *y )
{
float factorX;
float factorY;
{
int w1, w2, h1, h2;
SDL_GL_GetDrawableSize( host.hWnd, &w1, &h1 );
SDL_GetWindowSize( host.hWnd, &w2, &h2 );
factorX = (float)w1 / w2;
factorY = (float)h1 / h2;
}
SDL_GetMouseState( x, y );
*x = *x * factorX;
*y = *y * factorY;
}
/*
-2
View File
@@ -576,10 +576,8 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
SDL_DisplayMode got;
Uint32 wndFlags = 0;
#if !XASH_APPLE
if( vid_highdpi.value )
SetBits( wndFlags, SDL_WINDOW_ALLOW_HIGHDPI );
#endif
SDL_SetWindowBordered( host.hWnd, SDL_FALSE );