Handle High DPI displays on windows

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Sasha264
Prole
Posts: 19
Joined: Mon Sep 08, 2014 7:57 am

Handle High DPI displays on windows

Post by Sasha264 » Sat Dec 16, 2017 12:32 pm

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.
Attachments
Its me.png
Its me.png (194.13 KiB) Viewed 655 times

User avatar
Sasha264
Prole
Posts: 19
Joined: Mon Sep 08, 2014 7:57 am

Re: Handle High DPI displays on windows

Post by Sasha264 » Fri Jan 05, 2018 3:39 am

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.
Attachments
system-enhanced-scaling-option-windows10.jpg
system-enhanced-scaling-option-windows10.jpg (133.8 KiB) Viewed 556 times

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Handle High DPI displays on windows

Post by davisdude » Fri Jan 05, 2018 3:47 am

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.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim

User avatar
slime
Solid Snayke
Posts: 2765
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Handle High DPI displays on windows

Post by slime » Fri Jan 05, 2018 12:15 pm

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).

Post Reply

Who is online

Users browsing this forum: molul and 20 guests