Skip to content

Commit

Permalink
Add DPI awareness to fix unecessary scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed May 23, 2024
1 parent edfc02f commit 72720e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Source/Game/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "codepages/codepages.h"

#include <SDL.h>
#include <SDL_hints.h>
#include <SDL_image.h>
#include <SDL_vulkan.h>

Expand Down Expand Up @@ -1055,6 +1056,15 @@ int SDL_main(int argc, char *argv[])
//Parse version string
decode_version(currentShortVersion, currentVersionNumbers);

//Set DPI awareness, must be done before initializing SDL video subsystem
//Some old versions of SDL2 may not have this hint defined
#ifdef SDL_HINT_WINDOWS_DPI_AWARENESS
SDL_SetHintWithPriority(SDL_HINT_WINDOWS_DPI_AWARENESS, "system", SDL_HINT_OVERRIDE);
#endif
#ifdef SDL_HINT_WINDOWS_DPI_SCALING
SDL_SetHintWithPriority(SDL_HINT_WINDOWS_DPI_SCALING, "0", SDL_HINT_OVERRIDE);
#endif

//Start SDL stuff
int sdlresult = SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS);
if (sdlresult < 0) {
Expand Down

0 comments on commit 72720e3

Please sign in to comment.