Skip to content
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

Merged

Conversation

gschwind
Copy link
Contributor

@gschwind gschwind commented Nov 6, 2020

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

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.
Copy link
Member

@OverloadedOrama OverloadedOrama left a 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!

@OverloadedOrama OverloadedOrama merged commit 279228d into Orama-Interactive:master Nov 7, 2020
@Calinou
Copy link
Contributor

Calinou commented Nov 7, 2020

I using Linux with a screen with HiDPI but godot does not support HiDPI for Linux.

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)
Copy link
Contributor

@Calinou Calinou Nov 7, 2020

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@gschwind
Copy link
Contributor Author

gschwind commented Nov 7, 2020

I using Linux with a screen with HiDPI but godot does not support HiDPI for Linux.

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.

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

@gschwind
Copy link
Contributor Author

gschwind commented Nov 7, 2020

Hello, I did improved patch, with comment, a fix to add location in the computation of current_pixel and the fix of typo.

gschwind/Pixelorama@774f7df
gschwind/Pixelorama@ed8e898

@OverloadedOrama
Copy link
Member

Hello, I did improved patch, with comment, a fix to add location in the computation of current_pixel and the fix of typo.

gschwind/Pixelorama@774f7df
gschwind/Pixelorama@ed8e898

I included your changes in bd10680, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: support HiDPI display / editor display scale setting
3 participants