Implement system-scaled HiDPI support (SDL_WINDOW_ALLOW_HIGHDPI - Wayland, macOS, etc)

This commit is contained in:
unrelentingtech 2022-09-12 08:18:08 +00:00 committed by psi29a
parent 622f906855
commit 1c8fd2ecdb
6 changed files with 56 additions and 14 deletions

View file

@ -54,8 +54,13 @@ bool GraphicsWindowSDL2::setWindowRectangleImplementation(int x, int y, int widt
{
if(!mWindow) return false;
int w,h;
SDL_GetWindowSize(mWindow, &w, &h);
int dw,dh;
SDL_GL_GetDrawableSize(mWindow, &dw, &dh);
SDL_SetWindowPosition(mWindow, x, y);
SDL_SetWindowSize(mWindow, width, height);
SDL_SetWindowSize(mWindow, width / (dw / w), height / (dh / h));
return true;
}