The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote

We became available Godot 2.1 RC1 link
One of the expected changes is the support for HIDPI screens in the Godot editor.

Dear developers, huge, huge... extremely huge to you thanks! :-)

In connection with this change becoming a pressing issue:
How to support HIDPI in your project?

I'm developing a 3D game which works only in full screen mode. It incorporated the switch from 1280x720 to 3840x2160. How to perform a theme, icons, fonts, whatever they are displayed correctly in all screen resolutions? What are the necessary settings?

in Engine by (361 points)

Project Settings > Display > Stretch mode > 2d
Is this setting not enough?

The problem is that this setting doesn't let you provide your own hi-DPI graphics for theme items and other sprites, so everything is either pixelated or blurry when upscaled.

I resolved the issue with support for screens of different densities. In this matter, I did not rely on the mechanism of Godot HIDPI. I have a global script which switches the resolution viewport, there it is possible to obtain data on the current screen resolution.

Next, I drew in SVG format elements of a theme and exported it to a raster for three different size theme: "low density", "medium density" and "high density".

Next, I added in script the variable, in which the loaded theme as a resource. I update this variable automatically when you switch screen resolutions.

And last... in:

func _ready():

all scenes interface I prescribed the application of themes from the variable global script.

This enough ;-)

1 Answer

0 votes

An alternative to changing the stretch mode is to determine the scaleFactor.

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

You shouldn't set the window size, I just added it so you could see the effect. Instead, you can use scaleFactor to determine what resources you should load. It's a Vector2 which returns (2, 2) on my Retina display. So in this case, I would load resources that are twice as big.

by (97 points)
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.