1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Attempt to fix DPI scaling on Windows

This commit is contained in:
Ivan Savenko 2023-05-07 23:24:49 +03:00
parent cc68ce9d8b
commit f403766fbb
2 changed files with 8 additions and 9 deletions

View File

@ -1,9 +0,0 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View File

@ -114,6 +114,14 @@ EWindowMode WindowHandler::getPreferredWindowMode() const
WindowHandler::WindowHandler()
{
#ifdef VCMI_WINDOWS
// set VCMI as "per-monitor DPI awareness". This completely disables any DPI-scaling by system.
// Might not be the best solution since VCMI can't automatically adjust to DPI changes (including moving to monitors with different DPI scaling)
// However this fixed unintuitive bug where player selects specific resolution for windowed mode, but ends up with completely different one due to scaling
// NOTE: requires SDL 2.24.
SDL_SetHint(SDL_HINT_WINDOWS_DPI_AWARENESS, "permonitor");
#endif
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE))
{
logGlobal->error("Something was wrong: %s", SDL_GetError());