Skip to content

Commit

Permalink
partial fix for high dpi on Windows
Browse files Browse the repository at this point in the history
more work and possibly API redesigns will need to be done
  • Loading branch information
slime73 committed Dec 17, 2024
1 parent b152688 commit e40e731
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/modules/window/sdl/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
#define APIENTRY
#endif

#ifndef SDL_HINT_WINDOWS_DPI_SCALING
#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING"
#endif

namespace love
{
namespace window
Expand All @@ -72,14 +68,7 @@ namespace window
// See src/modules/window/Window.cpp.
void setHighDPIAllowedImplementation(bool enable)
{
#if defined(LOVE_WINDOWS)
// Windows uses a different API than SDL_WINDOW_ALLOW_HIGHDPI.
// This must be set before the video subsystem is initialized.
// FIXME: How does this work in SDL3?
SDL_SetHint(SDL_HINT_WINDOWS_DPI_SCALING, enable ? "1" : "0");
#else
LOVE_UNUSED(enable);
#endif
}

namespace sdl
Expand Down Expand Up @@ -1409,7 +1398,7 @@ double Window::getNativeDPIScale() const
#ifdef LOVE_ANDROID
return love::android::getScreenScale();
#else
return (double) pixelHeight / (double) windowHeight;
return window != nullptr ? SDL_GetWindowDisplayScale(window) : 1.0;
#endif
}

Expand Down

0 comments on commit e40e731

Please sign in to comment.