-
-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement shrink option #376
Implement shrink option #376
Conversation
Shrink option allow to scale the godot application. This path enable dynamic change of this value in the options.
For an unknown reason the function get_local_mouse_position return incorrect current_pixel when shrink is not 1. This path compute the transformation manually and povide correct values for any shrink value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! I've been struggling with this for so long, but I always had issues with the mouse coordinates on the canvas. This seems to be working fine and I like the implementation. Thank you!
To clarify, the Godot editor supports hiDPI on all platforms, but exported projects can't expose proper hiDPI support until godotengine/godot#21446 is merged. |
@@ -63,6 +63,9 @@ func setup_application_window_size() -> void: | |||
return | |||
# Set a minimum window size to prevent UI elements from collapsing on each other. | |||
OS.min_window_size = Vector2(1024, 576) | |||
|
|||
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_DISABLED, | |||
SceneTree.STRETCH_ASPECT_IGNORE, Vector2(1014,576), Global.shrink) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why is this 1014
instead of 1024
?
Also, you can get the base window size dynamically using ProjectSettings.get_setting("display/window/size/width")
and ProjectSettings.get_setting("display/window/size/height")
. This makes the code easier to reuse across projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a typo :), I can fix it
Best regards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About ProjectSettings.get_setting("display/window/size/width"), I just followed the line above where OS.min_window_size is set to Vector2(1024, 576). The 3rd parameters of set_screen_stretch is minsize.
Ok, I currently using godot 3.2.3-stable. Anyway I currently using the patch for 3x shrink while for my screen 2x should be the expected value, so it may be useful some how. I'm fine if it is not merged :) Best regards |
Hello, I did improved patch, with comment, a fix to add location in the computation of current_pixel and the fix of typo. |
I included your changes in bd10680, thank you! |
Hello,
On my computer Pixelorama was unusable because of tiny size of the GUI. I using Linux with a screen with HiDPI but godot does not support HiDPI for Linux.
This patch some how fix the issue with an option to set the shrink value. This values is used by godot to scale the whole application. The option is available in the configuration panel of the godot project and it can be changed in live by the application. The purpose of this patch the add an option in the Parameter>Startup section to do the job.
I see few possible issue, in particular if the value is set at a too high value and the parameter screen is not usable anymore. Otherwise it work nice.
Let me know if you want some change.
Best regards.
Overloaded edit: Closes #140