You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
Writing the UI I currently fall back to manually scale UI elements using the dpi value of OS.get_screen_dpi(OS.get_current_screen()). but this leads to a lot of complication due to resulting in me needing to set all the theme values (eg. margin) in code and not being able to use Themes for that.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding (for example to a theme) the option to use dp instead of normal pixels (1 dp = 160 / screen density) or another resolution independent unit.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When applying the theme to Controls apply the StyleBox sizes not as pixels but as dp's.
(Better in my opinion) Change all Pixels to DP for controls (If enabled), this would also make it possible to use the DPs for other UI values like size.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be worked around by adding a function that for each value in a theme calculates the correct value (dp->pixel) and applies that new theme.
Is there a reason why this should be core and not an add-on in the asset library?
This could be done as an addon but this would not be easily integreted (would only work if the addon reexports every Control as a DPControl).
The text was updated successfully, but these errors were encountered:
For games, Godot's multiple resolutions support should suffice as you want 2D elements to scale automatically to match the display resolution in games. If you have no reason to use anything else, use the 2d stretch mode, expand stretch aspect and configure your UI nodes' anchors to support multiple aspect ratios.
For non-game applications, the best way to solve this is to add a 2D scale factor property which can be adjusted at run-time. Unlike stretch shrink, this property doesn't affect the viewport size. It only affects the scale at which 2D elements are rendered.
Until a 2D scale factor property is merged, you can use this workaround which works well enough to make the app usable for integer scale factors. You can make it work better for fractional scale factors by using a viewport that has filtering enabled. Note that enabling filtering on the root Viewport will only have an effect when using GLES2, not GLES3.
This was addressed by godotengine/godot#52137 in 3.x and is being addressed by godotengine/godot#52170 in master. (See my comment above about the current lack of a display scale factor for context.)
Describe the project you are working on
A Cross Platform Graphical Notetaking Application
Describe the problem or limitation you are having in your project
Writing the UI I currently fall back to manually scale UI elements using the dpi value of
OS.get_screen_dpi(OS.get_current_screen())
. but this leads to a lot of complication due to resulting in me needing to set all the theme values (eg. margin) in code and not being able to use Themes for that.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding (for example to a theme) the option to use dp instead of normal pixels (
1 dp = 160 / screen density
) or another resolution independent unit.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be worked around by adding a function that for each value in a theme calculates the correct value (dp->pixel) and applies that new theme.
Is there a reason why this should be core and not an add-on in the asset library?
This could be done as an addon but this would not be easily integreted (would only work if the addon reexports every Control as a DPControl).
The text was updated successfully, but these errors were encountered: