Page 1 of 1

Handle High DPI displays on windows

Posted: Sat Dec 16, 2017 12:32 pm
by Sasha264
Hello!

I am trying to run love game on 4k monitor and found some problem here.
If "font scale" in windows "screen preferences" is set up to 100% then everything works fine.
But if I change font scale to (for example) 200% then windows forces all applications to render in half resolotion and displays it scaled up by 200%. Except applications that tell windows that they can handle resolution inside correctly (for example Google chrome, Discord, modern 3d games...). They renders in full resolution as they can. My love game is not doing this, so it renders in half resolution :huh: Also love.graphics.getDimensions() returns half resolution, for example 640x480 while real game window size is 1280x960.

Is here a way to fix this?
I have tried highdpi = true in love.window.setMode, but it does nothing on windows, as the wiki tells.

Re: Handle High DPI displays on windows

Posted: Fri Jan 05, 2018 3:39 am
by Sasha264
Found one way to handle this.

Checkbox in exe file propetries.
MyGame.exe in packaged mode or love.exe in development mode.

This solves the problem perfectly on one computer: if system handles highdpi scaling (this is by default) - we have "big" pixels, otherwise we have normal pixels. But it information stores somewhere deep in OS, so after transfer to another computer this checkbox will be lost. This leads to some problems with game distributions.

Perfect solution is a way to change this inside from love dynamically. But I don't know how to do this.

Re: Handle High DPI displays on windows

Posted: Fri Jan 05, 2018 3:47 am
by davisdude
It looks like this will be fixed in 0.11.0:
The wiki wrote:Changed high-dpi functionality to require much less code (often none at all) for graphics to appear at the correct sizes and positions.
You could try compiling it yourself or downloading a nightly build to see if that fixes the problem.

Re: Handle High DPI displays on windows

Posted: Fri Jan 05, 2018 12:15 pm
by slime
davisdude wrote: Fri Jan 05, 2018 3:47 am It looks like this will be fixed in 0.11.0
Unfortunately LÖVE still doesn't support high dpi on Windows, since SDL doesnt support it yet (because Microsoft's high dpi / dpi scaling APIs are hard to work with and can't replicate the functionality of other major operating systems).

Re: Handle High DPI displays on windows

Posted: Wed Mar 20, 2019 11:13 pm
by Sasha264
Thanks for the response!
Unfortunately, but understandable :)
...And many many games and applications have problems with that, so this "Override high DPI scaling" drop-down-box has become the most usable feature for me in past year on windows.

Re: Handle High DPI displays on windows

Posted: Tue Jul 23, 2019 4:24 pm
by Sasha264
Found interesting note here in Additions section :awesome: https://love2d.org/wiki/11.3 :awesome:
Added 'usedpiscale' boolean (true by default) to love.window.setMode and love.conf. Disables automatic DPI scaling when false.
Will the 'usedpiscale' flag solve this high dpi problem on Windows?

Re: Handle High DPI displays on windows

Posted: Tue Jul 23, 2019 9:08 pm
by slime
No, high dpi (app-aware DPI scale) is still not supported on Windows. love's own automatic DPI scaling only happens when that's supported.

Re: Handle High DPI displays on windows

Posted: Tue Jul 23, 2019 10:25 pm
by jonthysell
When you modify the DPI settings in the file properties they get stored in the registry

From: https://superuser.com/questions/1230346 ... mmand-line

~ HIGHDPIAWARE Indicates value of Override high DPI scaling behavior (Application)

~ DPIUNAWARE Indicates value of Override high DPI scaling behavior (System)

~ GDIDPISCALING DPIUNAWARE Indicates value of Override high DPI scaling behavior (System Enhanced)

You can also set the setting temporarily in a batch file that launches your game:

Code: Select all

setlocal
pushd %~dp0\
set __COMPAT_LAYER=~ GDIDPISCALING DPIUNAWARE
love.exe game.love
popd
endlocal

Re: Handle High DPI displays on windows

Posted: Thu Jul 25, 2019 11:49 am
by Sasha264
@slime, thanks! I will be looking forward for future updates in future years :megagrin:

@jonthysell, that's a very useful information, thank you!
Changing it permanently or temporarily through bat files is an appropriate solution :cool: