From 39137fc3c4c07fdc0745badcb007fac8c136dcf4 Mon Sep 17 00:00:00 2001 From: XProger Date: Sat, 18 Apr 2020 09:20:36 +0300 Subject: [PATCH] turn off High DPI mode by default add --high-dpi cmd line arg --- src/platform/win/main.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/platform/win/main.cpp b/src/platform/win/main.cpp index 6d3f5f9..dc1cf6e 100644 --- a/src/platform/win/main.cpp +++ b/src/platform/win/main.cpp @@ -971,8 +971,20 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi #endif // set our process to be DPI aware before creating main window - HMODULE hUser32 = LoadLibrary("User32.dll"); - HMODULE hShcore = LoadLibrary("Shcore.dll"); + + bool high_dpi = false; + for (int i = 0; i < argc; i++) { + if (strcmp(argv[i], "--high-dpi") == 0) { + high_dpi = true; + } + } + + HMODULE hUser32 = NULL, hShcore = NULL; + + if (high_dpi) { + hUser32 = LoadLibrary("User32.dll"); + hShcore = LoadLibrary("Shcore.dll"); + } GetProcAddr(hUser32, _SetProcessDpiAwarenessContext); GetProcAddr(hShcore, _SetProcessDpiAwareness); @@ -1013,7 +1025,7 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi Core::defLang = checkLanguage(); - Game::init(argc > 1 ? argv[1] : NULL); + Game::init((argc > 1 && strstr(argv[1], "--") != argv[1]) ? argv[1] : NULL); if (Core::isQuit) { MessageBoxA(hWnd, "Please check the readme file first!", "Game resources not found", MB_ICONHAND);