mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-25 22:34:24 +00:00
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:
parent
0f3359fc05
commit
98d88266a6
@ -43,7 +43,18 @@ Platform_GetMousePos
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT Platform_GetMousePos( int *x, int *y )
|
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 );
|
SDL_GetMouseState( x, y );
|
||||||
|
*x = *x * factorX;
|
||||||
|
*y = *y * factorY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -576,10 +576,8 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
|
|||||||
SDL_DisplayMode got;
|
SDL_DisplayMode got;
|
||||||
Uint32 wndFlags = 0;
|
Uint32 wndFlags = 0;
|
||||||
|
|
||||||
#if !XASH_APPLE
|
|
||||||
if( vid_highdpi.value )
|
if( vid_highdpi.value )
|
||||||
SetBits( wndFlags, SDL_WINDOW_ALLOW_HIGHDPI );
|
SetBits( wndFlags, SDL_WINDOW_ALLOW_HIGHDPI );
|
||||||
#endif
|
|
||||||
|
|
||||||
SDL_SetWindowBordered( host.hWnd, SDL_FALSE );
|
SDL_SetWindowBordered( host.hWnd, SDL_FALSE );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user