mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Windows: add support for high-dpi when capable SDL versions are used.
Issue #1421
This commit is contained in:
@@ -71,6 +71,12 @@ Window::Window()
|
|||||||
, hasSDL203orEarlier(false)
|
, hasSDL203orEarlier(false)
|
||||||
, contextAttribs()
|
, contextAttribs()
|
||||||
{
|
{
|
||||||
|
// Windows uses a different API than SDL_WINDOW_ALLOW_HIGHDPI.
|
||||||
|
#if defined(LOVE_WINDOWS) && defined(SDL_HINT_WINDOWS_DPI_SCALING)
|
||||||
|
// This must be set before the video subsystem is initialized.
|
||||||
|
SDL_SetHint(SDL_HINT_WINDOWS_DPI_SCALING, isHighDPIAllowed() ? "1" : "0");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||||
throw love::Exception("Could not initialize SDL video subsystem (%s)", SDL_GetError());
|
throw love::Exception("Could not initialize SDL video subsystem (%s)", SDL_GetError());
|
||||||
|
|
||||||
@@ -589,6 +595,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
|||||||
if (f.borderless)
|
if (f.borderless)
|
||||||
sdlflags |= SDL_WINDOW_BORDERLESS;
|
sdlflags |= SDL_WINDOW_BORDERLESS;
|
||||||
|
|
||||||
|
// Note: this flag is ignored on Windows.
|
||||||
if (isHighDPIAllowed())
|
if (isHighDPIAllowed())
|
||||||
sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user