Update Multiple Resolutions demo for Godot 4.0

This commit is contained in:
Hugo Locurcio
2022-05-02 18:44:54 +02:00
parent e77b85fba3
commit e591ceece9
8 changed files with 260 additions and 236 deletions

View File

@@ -31,21 +31,25 @@ overscan area to prevent GUI elements from being cut off. This can also improve
the gameplay experience on large monitors by bringing HUD elements closer to the the gameplay experience on large monitors by bringing HUD elements closer to the
center of the screen. center of the screen.
A DynamicFont is also used to ensure font rendering remains crisp at high A DynamicFont with multichannel signed distance field (MSDF) rendering is also used.
resolutions, thanks to Godot's built-in support for font oversampling. In other This allows for crisp font rendering at any resolution, without having to re-rasterize
words, the engine will automatically re-rasterize fonts at different resolutions the font when the font size changes. This makes changing the various settings in this
than the base window size when the window is resized (or when the window scale demo faster, especially when large font sizes are used as a result of the GUI scale factor
factor is changed). setting being increased.
Note that by default, Godot uses font oversampling for traditional rasterized
DynamicFonts. This means MSDF fonts are *not* required to have crisp fonts at
higher-than-default screen resolutions.
Language: GDScript Language: GDScript
Renderer: GLES 2 Renderer: Vulkan Mobile
## Technical notes ## Technical notes
The demo works with the following project settings: The demo works with the following project settings:
- `2d` stretch mode (recommended for most non-pixel art games). - `canvas_items` stretch mode (formerly `2d`). Recommended for most non-pixel art games.
- `expand` stretch aspect (allows support for multiple aspect ratios without - `expand` stretch aspect (allows support for multiple aspect ratios without
distortion or black bars). distortion or black bars).
- Using a base window size with a 1:1 aspect ratio (`648×648` in this demo). - Using a base window size with a 1:1 aspect ratio (`648×648` in this demo).

View File

@@ -1,8 +1,9 @@
[remap] [remap]
importer="texture" importer="texture"
type="StreamTexture" type="CompressedTexture2D"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" uid="uid://cx2c0cunh0e1i"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
@@ -10,26 +11,24 @@ metadata={
[deps] [deps]
source_file="res://icon.png" source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params] [params]
compress/mode=0 compress/mode=0
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_mode=0 compress/hdr_compression=1
compress/bptc_ldr=0 compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
flags/repeat=0 compress/channel_pack=0
flags/filter=true mipmaps/generate=false
flags/mipmaps=false mipmaps/limit=-1
flags/anisotropic=false roughness/mode=0
flags/srgb=2 roughness/src_normal=""
process/fix_alpha_border=true process/fix_alpha_border=true
process/premult_alpha=false process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false process/normal_map_invert_y=false
stream=false process/hdr_as_srgb=false
size_limit=0 process/hdr_clamp_exposure=false
detect_3d=true process/size_limit=0
svg/scale=1.0 detect_3d/compress_to=1

View File

@@ -8,15 +8,15 @@ var base_window_size = Vector2(ProjectSettings.get_setting("display/window/size/
# These defaults match this demo's project settings. Adjust as needed if adapting this # These defaults match this demo's project settings. Adjust as needed if adapting this
# in your own project. # in your own project.
var stretch_mode = SceneTree.STRETCH_MODE_2D var stretch_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
var stretch_aspect = SceneTree.STRETCH_ASPECT_EXPAND var stretch_aspect = Window.CONTENT_SCALE_ASPECT_EXPAND
var scale_factor = 1.0 var scale_factor = 1.0
var gui_aspect_ratio = -1.0 var gui_aspect_ratio = -1.0
var gui_margin = 0.0 var gui_margin = 0.0
onready var panel = $Panel @onready var panel = $Panel
onready var arc = $Panel/AspectRatioContainer @onready var arc = $Panel/AspectRatioContainer
func _ready(): func _ready():
@@ -24,36 +24,36 @@ func _ready():
# is resized whenever the window size changes. This is because the root Control node # is resized whenever the window size changes. This is because the root Control node
# uses a Full Rect anchor, so its size will always be equal to the window size. # uses a Full Rect anchor, so its size will always be equal to the window size.
# warning-ignore:return_value_discarded # warning-ignore:return_value_discarded
connect("resized", self, "_on_resized") connect("resized", self._on_resized)
update_container() update_container()
func update_container(): func update_container():
# The code within this function needs to be run twice to work around an issue with containers # The code within this function needs to be run twice to work around an issue with containers
# having a 1-frame delay with updates. # having a 1-frame delay with updates.
# Otherwise, `panel.rect_size` returns a value of the previous frame, which results in incorrect # Otherwise, `panel.size` returns a value of the previous frame, which results in incorrect
# sizing of the inner AspectRatioContainer when using the Fit to Window setting. # sizing of the inner AspectRatioContainer when using the Fit to Window setting.
for _i in 2: for _i in 2:
if is_equal_approx(gui_aspect_ratio, -1.0): if is_equal_approx(gui_aspect_ratio, -1.0):
# Fit to Window. Tell the AspectRatioContainer to use the same aspect ratio as the window, # Fit to Window. Tell the AspectRatioContainer to use the same aspect ratio as the window,
# making the AspectRatioContainer not have any visible effect. # making the AspectRatioContainer not have any visible effect.
arc.ratio = panel.rect_size.aspect() arc.ratio = panel.size.aspect()
# Apply GUI margin on the AspectRatioContainer's parent (Panel). # Apply GUI offset on the AspectRatioContainer's parent (Panel).
# This also makes the GUI margin apply on controls located outside the AspectRatioContainer # This also makes the GUI offset apply on controls located outside the AspectRatioContainer
# (such as the inner side label in this demo). # (such as the inner side label in this demo).
panel.margin_top = gui_margin panel.offset_top = gui_margin
panel.margin_bottom = -gui_margin panel.offset_bottom = -gui_margin
else: else:
# Constrained aspect ratio. # Constrained aspect ratio.
arc.ratio = min(panel.rect_size.aspect(), gui_aspect_ratio) arc.ratio = min(panel.size.aspect(), gui_aspect_ratio)
# Adjust top and bottom margins relative to the aspect ratio when it's constrained. # Adjust top and bottom offsets relative to the aspect ratio when it's constrained.
# This ensures that GUI margin settings behave exactly as if the window had the # This ensures that GUI offset settings behave exactly as if the window had the
# original aspect ratio size. # original aspect ratio size.
panel.margin_top = gui_margin / gui_aspect_ratio panel.offset_top = gui_margin / gui_aspect_ratio
panel.margin_bottom = -gui_margin / gui_aspect_ratio panel.offset_bottom = -gui_margin / gui_aspect_ratio
panel.margin_left = gui_margin panel.offset_left = gui_margin
panel.margin_right = -gui_margin panel.offset_right = -gui_margin
func _on_gui_aspect_ratio_item_selected(index): func _on_gui_aspect_ratio_item_selected(index):
@@ -81,8 +81,8 @@ func _on_resized():
func _on_gui_margin_drag_ended(_value_changed): func _on_gui_margin_drag_ended(_value_changed):
gui_margin = $"Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMargin/HSlider".value gui_margin = $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin/HSlider".value
$"Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMargin/Value".text = str(gui_margin) $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin/Value".text = str(gui_margin)
update_container() update_container()
@@ -105,25 +105,25 @@ func _on_window_base_size_item_selected(index):
7: # 1680×720 (21:9) 7: # 1680×720 (21:9)
base_window_size = Vector2(1680, 720) base_window_size = Vector2(1680, 720)
get_tree().set_screen_stretch(stretch_mode, stretch_aspect, base_window_size, scale_factor) get_viewport().content_scale_size = base_window_size
update_container() update_container()
func _on_window_stretch_mode_item_selected(index): func _on_window_stretch_mode_item_selected(index):
stretch_mode = index stretch_mode = index
get_tree().set_screen_stretch(stretch_mode, stretch_aspect, base_window_size, scale_factor) get_viewport().content_scale_mode = stretch_mode
# Disable irrelevant options when the stretch mode is Disabled. # Disable irrelevant options when the stretch mode is Disabled.
$"Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowBaseSize/OptionButton".disabled = stretch_mode == SceneTree.STRETCH_MODE_DISABLED $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize/OptionButton".disabled = stretch_mode == Window.CONTENT_SCALE_MODE_DISABLED
$"Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchAspect/OptionButton".disabled = stretch_mode == SceneTree.STRETCH_MODE_DISABLED $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect/OptionButton".disabled = stretch_mode == Window.CONTENT_SCALE_MODE_DISABLED
func _on_window_stretch_aspect_item_selected(index): func _on_window_stretch_aspect_item_selected(index):
stretch_aspect = index stretch_aspect = index
get_tree().set_screen_stretch(stretch_mode, stretch_aspect, base_window_size, scale_factor) get_viewport().content_scale_aspect = stretch_aspect
func _on_window_scale_factor_drag_ended(_value_changed): func _on_window_scale_factor_drag_ended(_value_changed):
scale_factor = $"Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowScaleFactor/HSlider".value scale_factor = $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor/HSlider".value
$"Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowScaleFactor/Value".text = "%d%%" % (scale_factor * 100) $"Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor/Value".text = "%d%%" % (scale_factor * 100)
get_tree().set_screen_stretch(stretch_mode, stretch_aspect, base_window_size, scale_factor) get_viewport().content_scale_factor = scale_factor

View File

@@ -1,205 +1,215 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=4 format=3 uid="uid://1cywl1qtanq3"]
[ext_resource path="res://main.gd" type="Script" id=1] [ext_resource type="Script" path="res://main.gd" id="1"]
[ext_resource path="res://noto_sans_ui_regular.tres" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=3] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vvbdh"]
size = 14
font_data = ExtResource( 2 )
[sub_resource type="Theme" id=4]
default_font = SubResource( 3 )
[sub_resource type="StyleBoxFlat" id=1]
draw_center = false draw_center = false
border_width_left = 4 border_width_left = 4
border_width_top = 4 border_width_top = 4
border_width_right = 4 border_width_right = 4
border_width_bottom = 4 border_width_bottom = 4
border_color = Color( 0.501961, 1, 0.25098, 0.501961 ) border_color = Color(0.501961, 1, 0.25098, 0.501961)
[sub_resource type="StyleBoxFlat" id=2] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dyby4"]
draw_center = false draw_center = false
border_width_left = 8 border_width_left = 8
border_width_top = 8 border_width_top = 8
border_width_right = 8 border_width_right = 8
border_width_bottom = 8 border_width_bottom = 8
border_color = Color( 0.25098, 0.376471, 1, 0.501961 ) border_color = Color(0.25, 0.38, 0.8, 0.5)
[node name="Main" type="Control"] [node name="Main" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
theme = SubResource( 4 ) script = ExtResource( "1" )
script = ExtResource( 1 )
[node name="OuterSideLabel" type="Label" parent="."] [node name="OuterSideLabel" type="Label" parent="."]
modulate = Color( 1, 1, 1, 0.627451 ) modulate = Color(1, 1, 1, 0.627451)
anchor_top = 0.5 offset_left = 8.0
anchor_bottom = 0.5 offset_top = 8.0
margin_left = 11.0 offset_right = 165.0
margin_top = -47.0 offset_bottom = 60.0
margin_right = 140.0
margin_bottom = -16.0
text = "Outer Side Label text = "Outer Side Label
(ignores all margins)" (ignores all margins)"
metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = false
[node name="Panel" type="Panel" parent="."] [node name="Panel" type="Panel" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
custom_styles/panel = SubResource( 1 ) theme_override_styles/panel = SubResource( "StyleBoxFlat_vvbdh" )
[node name="InnerSideLabel" type="Label" parent="Panel"] [node name="InnerSideLabel" type="Label" parent="Panel"]
modulate = Color( 0.666667, 1, 0.501961, 1 ) modulate = Color(0.666667, 1, 0.501961, 1)
anchor_top = 0.5 anchor_top = 1.0
anchor_bottom = 0.5 anchor_bottom = 1.0
margin_left = 11.0 offset_left = 8.0
margin_top = 16.5 offset_top = -60.0
margin_right = 209.0 offset_right = 246.0
margin_bottom = 47.5 offset_bottom = -8.0
grow_vertical = 0
text = "Inner Side Label text = "Inner Side Label
(ignores GUI Max Aspect Ratio)" (ignores GUI Max Aspect Ratio)"
metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = false
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="Panel"] [node name="AspectRatioContainer" type="AspectRatioContainer" parent="Panel"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
[node name="ColorRect" type="Panel" parent="Panel/AspectRatioContainer"] [node name="Panel" type="Panel" parent="Panel/AspectRatioContainer"]
margin_right = 648.0 offset_left = 212.0
margin_bottom = 648.0 offset_right = 812.0
custom_styles/panel = SubResource( 2 ) offset_bottom = 600.0
theme_override_styles/panel = SubResource( "StyleBoxFlat_dyby4" )
[node name="TopLeft" type="ColorRect" parent="Panel/AspectRatioContainer/ColorRect"] [node name="TopLeft" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
margin_right = 64.0 color = Color(1, 1, 1, 0.25098)
margin_bottom = 64.0
color = Color( 1, 1, 1, 0.25098 )
[node name="TopRight" type="ColorRect" parent="Panel/AspectRatioContainer/ColorRect"] [node name="TopRight" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
margin_left = -64.0 color = Color(1, 1, 1, 0.25098)
margin_bottom = 64.0
color = Color( 1, 1, 1, 0.25098 )
[node name="BottomLeft" type="ColorRect" parent="Panel/AspectRatioContainer/ColorRect"] [node name="BottomLeft" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
anchor_top = 1.0 anchor_top = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_top = -64.0 color = Color(1, 1, 1, 0.25098)
margin_right = 64.0
color = Color( 1, 1, 1, 0.25098 )
[node name="BottomRight" type="ColorRect" parent="Panel/AspectRatioContainer/ColorRect"] [node name="BottomRight" type="ColorRect" parent="Panel/AspectRatioContainer/Panel"]
anchor_left = 1.0 anchor_left = 1.0
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = -64.0 color = Color(1, 1, 1, 0.25098)
margin_top = -64.0
color = Color( 1, 1, 1, 0.25098 )
[node name="CenterContainer" type="CenterContainer" parent="Panel/AspectRatioContainer/ColorRect"] [node name="CenterContainer" type="CenterContainer" parent="Panel/AspectRatioContainer/Panel"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
__meta__ = {
"_edit_lock_": true
}
[node name="Options" type="VBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer"] [node name="Options" type="VBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer"]
margin_left = 167.0 offset_left = 112.0
margin_top = 187.0 offset_top = 152.0
margin_right = 481.0 offset_right = 488.0
margin_bottom = 460.0 offset_bottom = 447.0
rect_min_size = Vector2( 300, 0 ) theme_override_constants/separation = 10
custom_constants/separation = 15
[node name="Title" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="Title" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_right = 314.0 minimum_size = Vector2(0, 45)
margin_bottom = 20.0 offset_right = 376.0
custom_colors/font_color = Color( 1, 0.866667, 0.615686, 1 ) offset_bottom = 45.0
theme_override_colors/font_color = Color(1, 0.87, 0.62, 1)
theme_override_font_sizes/font_size = 24
text = "Options" text = "Options"
align = 1 horizontal_alignment = 1
[node name="WindowBaseSize" type="HBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="WindowBaseSize" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 35.0 offset_top = 55.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 61.0 offset_bottom = 86.0
custom_constants/separation = 15
[node name="Label" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowBaseSize"] [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize"]
margin_top = 3.0 minimum_size = Vector2(190, 0)
margin_right = 150.0 offset_top = 2.0
margin_bottom = 23.0 offset_right = 190.0
rect_min_size = Vector2( 150, 0 ) offset_bottom = 28.0
text = "Window Base Size" text = "Window Base Size"
[node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowBaseSize"] [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize"]
margin_left = 165.0 offset_left = 194.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 26.0 offset_bottom = 31.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "648×648 (1:1)" item_count = 8
items = [ "648×648 (1:1)", null, false, 0, null, "640×480 (4:3)", null, false, 1, null, "720×480 (3:2)", null, false, 2, null, "800×600 (4:3)", null, false, 3, null, "1152×648 (16:9)", null, false, 5, null, "1280×720 (16:9)", null, false, 6, null, "1280×800 (16:10)", null, false, 7, null, "1680×720 (21:9)", null, false, 8, null ]
selected = 0 selected = 0
popup/item_0/text = "648×648 (1:1)"
popup/item_0/id = 0
popup/item_1/text = "640×480 (4:3)"
popup/item_1/id = 1
popup/item_2/text = "720×480 (3:2)"
popup/item_2/id = 2
popup/item_3/text = "800×600 (4:3)"
popup/item_3/id = 3
popup/item_4/text = "1152×648 (16:9)"
popup/item_4/id = 4
popup/item_5/text = "1280×720 (16:9)"
popup/item_5/id = 5
popup/item_6/text = "1280×800 (16:10)"
popup/item_6/id = 6
popup/item_7/text = "1680×720 (21:9)"
popup/item_7/id = 7
[node name="WindowStretchMode" type="HBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="WindowStretchMode" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 76.0 offset_top = 96.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 102.0 offset_bottom = 127.0
custom_constants/separation = 15
[node name="Label" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchMode"] [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchMode"]
margin_top = 3.0 minimum_size = Vector2(190, 0)
margin_right = 150.0 offset_top = 2.0
margin_bottom = 23.0 offset_right = 190.0
rect_min_size = Vector2( 150, 0 ) offset_bottom = 28.0
text = "Window Stretch Mode" text = "Window Stretch Mode"
[node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchMode"] [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchMode"]
margin_left = 165.0 offset_left = 194.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 26.0 offset_bottom = 31.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "2D (Canvas Items)" item_count = 3
items = [ "Disabled", null, false, 0, null, "2D (Canvas Items)", null, false, 1, null, "Viewport", null, false, 2, null ]
selected = 1 selected = 1
popup/item_0/text = "Disabled"
popup/item_0/id = 0
popup/item_1/text = "Canvas Items (2D)"
popup/item_1/id = 1
popup/item_2/text = "Viewport"
popup/item_2/id = 2
[node name="WindowStretchAspect" type="HBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="WindowStretchAspect" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 117.0 offset_top = 137.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 143.0 offset_bottom = 168.0
custom_constants/separation = 15
[node name="Label" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchAspect"] [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect"]
margin_top = 3.0 minimum_size = Vector2(190, 0)
margin_right = 155.0 offset_top = 2.0
margin_bottom = 23.0 offset_right = 190.0
rect_min_size = Vector2( 150, 0 ) offset_bottom = 28.0
text = "Window Stretch Aspect" text = "Window Stretch Aspect"
[node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchAspect"] [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect"]
margin_left = 170.0 offset_left = 194.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 26.0 offset_bottom = 31.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Expand" item_count = 5
items = [ "Ignore (Distort)", null, false, 0, null, "Keep (Black Bars)", null, false, 1, null, "Keep Width", null, false, 2, null, "Keep Height", null, false, 3, null, "Expand", null, false, 4, null ]
selected = 4 selected = 4
popup/item_0/text = "Ignore"
popup/item_0/id = 0
popup/item_1/text = "Keep"
popup/item_1/id = 1
popup/item_2/text = "Keep Width"
popup/item_2/id = 2
popup/item_3/text = "Keep Height"
popup/item_3/id = 3
popup/item_4/text = "Expand"
popup/item_4/id = 4
[node name="WindowScaleFactor" type="HBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="WindowScaleFactor" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 158.0 offset_top = 178.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 178.0 offset_bottom = 204.0
custom_constants/separation = 15
[node name="Label" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowScaleFactor"] [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor"]
margin_right = 150.0 minimum_size = Vector2(190, 0)
margin_bottom = 20.0 offset_right = 190.0
rect_min_size = Vector2( 150, 0 ) offset_bottom = 26.0
text = "Window Scale Factor" text = "Window Scale Factor"
[node name="HSlider" type="HSlider" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowScaleFactor"] [node name="HSlider" type="HSlider" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor"]
margin_left = 165.0 offset_left = 194.0
margin_right = 263.0 offset_right = 330.0
margin_bottom = 16.0 offset_bottom = 16.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 100.0 size_flags_stretch_ratio = 100.0
min_value = 0.75 min_value = 0.75
@@ -207,70 +217,81 @@ max_value = 2.0
step = 0.01 step = 0.01
value = 1.0 value = 1.0
[node name="Value" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowScaleFactor"] [node name="Value" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor"]
margin_left = 278.0 offset_left = 334.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 20.0 offset_bottom = 26.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "100%" text = "100%"
[node name="HSeparator" type="HSeparator" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="HSeparator" type="HSeparator" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 193.0 offset_top = 214.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 197.0 offset_bottom = 218.0
[node name="GUIMaxAspectRatio" type="HBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="GUIMaxAspectRatio" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 212.0 offset_top = 228.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 238.0 offset_bottom = 259.0
custom_constants/separation = 15
[node name="Label" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMaxAspectRatio"] [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMaxAspectRatio"]
margin_top = 3.0 minimum_size = Vector2(190, 0)
margin_right = 150.0 offset_top = 2.0
margin_bottom = 23.0 offset_right = 190.0
rect_min_size = Vector2( 150, 0 ) offset_bottom = 28.0
text = "GUI Max Aspect Ratio" text = "GUI Max Aspect Ratio"
[node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMaxAspectRatio"] [node name="OptionButton" type="OptionButton" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMaxAspectRatio"]
margin_left = 165.0 offset_left = 194.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 26.0 offset_bottom = 31.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Fit to Window" item_count = 7
items = [ "Fit to Window", null, false, 0, null, "5:4", null, false, 1, null, "4:3", null, false, 2, null, "3:2", null, false, 3, null, "16:10", null, false, 4, null, "16:9", null, false, 5, null, "21:9", null, false, 6, null ]
selected = 0 selected = 0
popup/item_0/text = "Fit to Window"
popup/item_0/id = 0
popup/item_1/text = "5:4"
popup/item_1/id = 1
popup/item_2/text = "4:3"
popup/item_2/id = 2
popup/item_3/text = "3:2"
popup/item_3/id = 3
popup/item_4/text = "16:10"
popup/item_4/id = 4
popup/item_5/text = "16:9"
popup/item_5/id = 5
popup/item_6/text = "21:9"
popup/item_6/id = 6
[node name="GUIMargin" type="HBoxContainer" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options"] [node name="GUIMargin" type="HBoxContainer" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options"]
margin_top = 253.0 offset_top = 269.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 273.0 offset_bottom = 295.0
custom_constants/separation = 15
[node name="Label" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMargin"] [node name="Label" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin"]
margin_right = 150.0 minimum_size = Vector2(190, 0)
margin_bottom = 20.0 offset_right = 190.0
rect_min_size = Vector2( 150, 0 ) offset_bottom = 26.0
text = "GUI Margin" text = "GUI Margin"
[node name="HSlider" type="HSlider" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMargin"] [node name="HSlider" type="HSlider" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin"]
margin_left = 165.0 offset_left = 194.0
margin_right = 291.0 offset_right = 362.0
margin_bottom = 16.0 offset_bottom = 16.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 100.0 size_flags_stretch_ratio = 100.0
max_value = 50.0 max_value = 50.0
[node name="Value" type="Label" parent="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMargin"] [node name="Value" type="Label" parent="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin"]
margin_left = 306.0 offset_left = 366.0
margin_right = 314.0 offset_right = 376.0
margin_bottom = 20.0 offset_bottom = 26.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "0" text = "0"
[connection signal="item_selected" from="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowBaseSize/OptionButton" to="." method="_on_window_base_size_item_selected"] [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowBaseSize/OptionButton" to="." method="_on_window_base_size_item_selected"]
[connection signal="item_selected" from="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchMode/OptionButton" to="." method="_on_window_stretch_mode_item_selected"] [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchMode/OptionButton" to="." method="_on_window_stretch_mode_item_selected"]
[connection signal="item_selected" from="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowStretchAspect/OptionButton" to="." method="_on_window_stretch_aspect_item_selected"] [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowStretchAspect/OptionButton" to="." method="_on_window_stretch_aspect_item_selected"]
[connection signal="drag_ended" from="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/WindowScaleFactor/HSlider" to="." method="_on_window_scale_factor_drag_ended"] [connection signal="drag_ended" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/WindowScaleFactor/HSlider" to="." method="_on_window_scale_factor_drag_ended"]
[connection signal="item_selected" from="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMaxAspectRatio/OptionButton" to="." method="_on_gui_aspect_ratio_item_selected"] [connection signal="item_selected" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMaxAspectRatio/OptionButton" to="." method="_on_gui_aspect_ratio_item_selected"]
[connection signal="drag_ended" from="Panel/AspectRatioContainer/ColorRect/CenterContainer/Options/GUIMargin/HSlider" to="." method="_on_gui_margin_drag_ended"] [connection signal="drag_ended" from="Panel/AspectRatioContainer/Panel/CenterContainer/Options/GUIMargin/HSlider" to="." method="_on_gui_margin_drag_ended"]

View File

@@ -1,5 +0,0 @@
[gd_resource type="DynamicFontData" format=2]
[resource]
hinting = 1
font_path = "res://noto_sans_ui_regular.ttf"

View File

@@ -6,7 +6,7 @@
; [section] ; section goes between [] ; [section] ; section goes between []
; param=value ; assign values to parameters ; param=value ; assign values to parameters
config_version=4 config_version=5
[application] [application]
@@ -30,19 +30,24 @@ by bringing HUD elements closer to the center of the screen."
run/main_scene="res://main.tscn" run/main_scene="res://main.tscn"
run/low_processor_mode=true run/low_processor_mode=true
config/icon="res://icon.png" config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
[display] [display]
window/handheld/orientation="sensor"
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
window/size/width=648 window/size/width=648
window/size/height=648 window/size/height=648
window/size/test_width=1152 window/size/test_width=1152
window/size/test_height=648 window/size/test_height=648
window/dpi/allow_hidpi=true
window/handheld/orientation="sensor" [gui]
window/stretch/mode="2d"
window/stretch/aspect="expand" theme/default_font_multichannel_signed_distance_field=true
[rendering] [rendering]
vulkan/rendering/back_end=1
environment/defaults/default_clear_color=Color(0.133333, 0.133333, 0.2, 1)
quality/driver/driver_name="GLES2" quality/driver/driver_name="GLES2"
environment/default_clear_color=Color( 0.133333, 0.133333, 0.2, 1 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 72 KiB