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

Add basic hiDPI support #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Scenes/UI/Helpers.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
extends Node

func _ready():
# Upscale everything if the display requires it (crude hiDPI support).
# This prevents 2D elements from being too small on hiDPI displays.
if OS.get_screen_dpi() >= 192 and OS.get_screen_size().x >= 2048:
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_DISABLED, SceneTree.STRETCH_ASPECT_IGNORE, Vector2(), 2)

func _get_scene():
return get_tree().current_scene

Expand Down
1 change: 1 addition & 0 deletions src/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ window/size/width=640
window/size/height=480
window/size/test_width=1366
window/size/test_height=750
window/dpi/allow_hidpi=true
window/stretch/aspect="expand"

[importer_defaults]
Expand Down