From 95d0977df51da095ad81c3605d90ffbff88576ae Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:11:09 -0400 Subject: [PATCH] Windows: Make SDL APIs DPI aware --- src/pc/gfx/gfx_sdl1.c | 8 ++++++++ src/pc/gfx/gfx_sdl2.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/pc/gfx/gfx_sdl1.c b/src/pc/gfx/gfx_sdl1.c index 3a05eb60..cd045e55 100644 --- a/src/pc/gfx/gfx_sdl1.c +++ b/src/pc/gfx/gfx_sdl1.c @@ -6,6 +6,10 @@ #define FOR_WINDOWS 0 #endif +#if defined(_WIN32) || defined(_WIN64) +#include +#endif + #include #include @@ -110,6 +114,10 @@ static void gfx_sdl_init(const char *window_title) { } controller_bind_init(); + +#if defined(_WIN32) || defined(_WIN64) + SetProcessDPIAware(); +#endif } static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) { diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index 169fd8af..e0b678a8 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -6,6 +6,10 @@ #define FOR_WINDOWS 0 #endif +#if defined(_WIN32) || defined(_WIN64) +#include +#endif + #if FOR_WINDOWS #define GLEW_STATIC #include @@ -139,6 +143,10 @@ static void gfx_sdl_init(const char *window_title) { } controller_bind_init(); + +#if defined(_WIN32) || defined(_WIN64) + SetProcessDPIAware(); +#endif } static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) {