Control or disable DPI/scaling in Windows

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Control or disable DPI/scaling in Windows

#1 Post by Tayruu »

In Windows 10, you have the option to scale UI applications up if your screen is high resolution. Technically this has existed since Windows 7 as far as I know, but notably the most recent version of W10 there's no longer the option to disable the high-DPI scaling on an application.

I find this a problem in Ren'py, as I want to test my project at its native pixels, but Windows scaling forces it to be larger than it is. (This also has the effect of making the Windowed display setting always inactive, even when the game is windowed. This happens in fresh projects too.)

In regards to resolution stuff, I have the following code:

Code: Select all

# System Config
init -160 python hide:
    def force_resolution(width, height):
        return (1280, 720)
    gui.init(1280, 720)
        
    # Game window
    config.adjust_view_size = force_resolution
    config.use_drawable_resolution = False
  • adjust_view_size I know forces the resolution. This does make the game ignore high resolution settings, but the window itself is still large, resulting in black empty space around the game. It also means full-screen is no longer full-screen.
  • use_drawable_resolution is because at the higher resolutions, text would render as if the game was at native scale. It made text sharp, but it was sharp atop of blurry assets and the text would shift a few pixels between dialogue pauses. This makes it draw before the upscaling.
There's also this odd bug where, if the game is minimised and then restored, it now is even bigger. Selecting Windowed in display settings fixes this, though only to the upscaled level.

My machine is an 11" 1080p laptop, meaning I kind of have to be on 150% scale to see what's on my screen.

Here is a comparison of the screen sizes, note how the scanline effect is sharp only in the top image. (Bear in mind if you have a high-DPI screen, your browser may render this image slightly upscaled by default.)
https://i.imgur.com/8jBVdqE.jpg

Anyway - my issue is I want to be able to have Ren'py have more control over scaling settings, because this scaling makes it harder to tell if any visual issues might be my own doing or my OS. There is adjust_view_size, but it's imperfect.

Post Reply

Who is online

Users browsing this forum: No registered users