0 votes

This is more of a rhetorical question, but I wanted to throw it out there in case anyone came across this issue. If you set Allow Hidpi to on and have a HiDPI screen, then you will end up with a viewport that is larger than you expect.

If you use the following code, you get set the size of the window to the actual pixel values of the width and height which you set in your Project Settings.

# HiDPI Window Downscaling
var displaySize = Vector2(Globals.get("display/width"), Globals.get("display/height"))
var scaleFactor = OS.get_window_size() / displaySize
OS.set_window_size(displaySize / scaleFactor)

Of course, I wouldn't recommend this because your game, since it's pixel for pixel, will look comparatively tiny. However, the scaleFactor variable could be useful information for loading in higher resolution graphics on HiDPI displays.

I'm new to Godot, but so far I think this is the best way to deal with this. You could disallow hidpi or allow it and then set the stretch mode to 2d / viewport, but neither of those methods take full advantage of a HiDPI display.

in Engine by (97 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.