# HG changeset patch # User alfadur # Date 1507293922 -7200 # Node ID 2065819170cec10ce6c87c633e317c2a3a5def6d # Parent 161c10db4f274f8f36be299af2b012f6366b9f30 (Hopefully) fix game camera being shifted on Windows 10 IMPORTANT: This fix needs testing before 0.9.23 release! diff -r 161c10db4f27 -r 2065819170ce hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Fri Oct 06 14:03:13 2017 +0200 +++ b/hedgewars/hwengine.pas Fri Oct 06 14:45:22 2017 +0200 @@ -36,6 +36,7 @@ {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF} {$IFDEF USE_TOUCH_INTERFACE}, uTouch {$ENDIF} {$IFDEF ANDROID}, GLUnit{$ENDIF} + {$IFDEF WIN32}, dynlibs{$ENDIF} ; {$IFDEF HWLIBRARY} @@ -52,6 +53,12 @@ procedure freeEverything(complete:boolean); forward; {$ENDIF} +{$IFDEF WIN32} +type TSetProcessDpiAwareness = function(value: Integer): Integer; stdcall; +var SetProcessDpiAwareness: TSetProcessDpiAwareness; +var ShcoreLibHandle: TLibHandle; +{$ENDIF} + /////////////////////////////////////////////////////////////////////////////// function DoTimer(Lag: LongInt): boolean; var s: shortstring; @@ -587,6 +594,17 @@ begin {$ENDIF} +{$IFDEF WIN32} + ShcoreLibHandle := LoadLibrary('Shcore.dll'); + if (ShcoreLibHandle <> 0) then + begin + SetProcessDpiAwareness := + TSetProcessDpiAwareness(GetProcedureAddress(ShcoreLibHandle, 'SetProcessDpiAwareness')); + if (SetProcessDpiAwareness <> nil) then + SetProcessDpiAwareness(1); + end; +{$ENDIF} + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////// m a i n /////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////