@Natanox Well the settings of the main window are controlled via the project settings and the equivalent project setting is `display/window/stretch/scale`, but if you want to change it on the fly `get_window().content_scale_factor` is the way to go.
Posts
-
@Natanox @dbat The intended way is to change the Window.content_scale_factor, which works well for many things, e.g. -
@Natanox @dbat The intended way is to change the Window.content_scale_factor, which works well for many things, e.g.@Natanox @dbat The intended way is to change the Window.content_scale_factor, which works well for many things, e.g. styleboxes and fonts (cause those are rendered in a scalable way). But icons can't yet adapt. It's planned and hey, maybe it will actually be included in 4.4? But for now, if you care for icons, the best solution is to design your UI at a larger scale and then use a content_scale_factor of 0.5 or smaller on normal monitors.
You can get the DPI with DisplayServer.screen_get_dpi().
-
Ouff, the #GodotEngine UI node settings ain't as easily HiDPI aware and dynamically scalable as I hoped. Explains why many games opt for a mobile UI that might end up looking out of place (and way too large) on the desktop but will still work everywhere.@dbat @Natanox Some relevant links:
https://github.com/godotengine/godot/pull/86022Move away from texture-size based sizes of components and icons in default controls · godotengine godot-proposals · Discussion #9080
Move away from texture-size based sizes of components and icons in default controls
GitHub (github.com)
Potential to improve scaled UI appearance · Issue #762 · MewPurPur/GodSVG
Godot's default rendering settings for fonts and icons is not the best for applications if they want to support HiDPI / UI Scaling. For fonts, I would recommend turning on Multichannel Signed Distance Fields for font rendering. Some font...
GitHub (github.com)
I've just recently tried to solve HiDPI scaling icons for material maker and the only proper solution right now is to basically re-implement ui scaling.
-
Ouff, the #GodotEngine UI node settings ain't as easily HiDPI aware and dynamically scalable as I hoped. Explains why many games opt for a mobile UI that might end up looking out of place (and way too large) on the desktop but will still work everywhere.@dbat @Natanox Not sure what Nox was getting at, but the main stopper for proper HiDPI UI right now is Icons. Because godot cannot have adaptive SVG textures (they are always rendered to a fixed size) and the icon size is directly used to determine the size of many UI nodes you have to make icons at the exact resolution of your UI and when then increasing the UI-scale icons will look blurry.
This is supposed to be fixed eventually, but is not yet possible and requires complicated workarounds.