From 0635f3636dc0596cce0667e0db7d2c6dc844c575 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Fri, 14 Apr 2017 16:45:14 +0200 Subject: [PATCH] Add a setting to disable DPI scaling on Windows systems --- OpenRA.Game/Settings.cs | 3 +++ OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index fdb85236b3..0e10715198 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -120,6 +120,9 @@ namespace OpenRA [Desc("At which frames per second to cap the framerate.")] public int MaxFramerate = 60; + [Desc("Disable high resolution DPI scaling on Windows operating systems.")] + public bool DisableWindowsDPIScaling = false; + public int BatchSize = 8192; public int SheetSize = 2048; diff --git a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs index 01466c0c79..7f88207343 100644 --- a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs +++ b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs @@ -40,7 +40,7 @@ namespace OpenRA.Platforms.Default WindowSize = windowSize; // Disable legacy scaling on Windows - if (Platform.CurrentPlatform == PlatformType.Windows) + if (Platform.CurrentPlatform == PlatformType.Windows && !Game.Settings.Graphics.DisableWindowsDPIScaling) SetProcessDPIAware(); SDL.SDL_Init(SDL.SDL_INIT_NOPARACHUTE | SDL.SDL_INIT_VIDEO); @@ -82,7 +82,7 @@ namespace OpenRA.Platforms.Default else if (Platform.CurrentPlatform == PlatformType.Windows) { float ddpi, hdpi, vdpi; - if (SDL.SDL_GetDisplayDPI(0, out ddpi, out hdpi, out vdpi) == 0) + if (!Game.Settings.Graphics.DisableWindowsDPIScaling && SDL.SDL_GetDisplayDPI(0, out ddpi, out hdpi, out vdpi) == 0) { WindowScale = ddpi / 96; WindowSize = new Size((int)(SurfaceSize.Width / WindowScale), (int)(SurfaceSize.Height / WindowScale));