mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
c02aad66a0
The main menu clipped its own title and bottom button in debug builds. The project lays out in a hard-fixed 1920x1080 logical viewport (window/stretch/mode="viewport"), and the only overflow strategy in the scene was a CenterContainer, which centres its child rather than clipping and scrolling. With DevSection visible the content measures 1133px against 1080, so roughly 53px spilled off both ends with no way to reach it — and main_menu.gd grabs focus on a button that may itself be off-screen. Worth recording because it is counter-intuitive: this is not resolution-dependent. Because the viewport is fixed, a 4K display magnifies the same clipped 1080p frame rather than giving the menu more room, so the fix has to make the layout scroll, not scale. Each menu is now MarginContainer > ScrollContainer > CenterContainer > VBoxContainer. ScrollContainer sizes its child to max(own size, child minimum), so an expanding CenterContainer keeps today's centred look when the content is short and grows past the viewport when it is tall — which is exactly when scrolling should start. follow_focus is on so keyboard and controller navigation cannot strand focus off-screen. Lobby and matchmaking share the same shape and get the same treatment before they hit the same wall; settings gained its wrapper alongside the Controls tab. Also stops the dev bot dropdowns widening the whole menu: they are filled from res://bots filenames and expand horizontally, so a long checkpoint name dragged the layout past its 420px minimum. test_menu_layout asserts each screen's bottom-most control really sits inside a ScrollContainer. That is a structural guard against the wrapper being removed or a new section being added outside it — not proof that nothing visually clips, which was checked by hand at 1000x600, 1280x720 and 1920x1080.
129 lines
4.9 KiB
Plaintext
129 lines
4.9 KiB
Plaintext
[gd_scene load_steps=3 format=3]
|
|
|
|
[ext_resource type="Script" path="res://scripts/lobby.gd" id="1_lobby"]
|
|
[ext_resource type="Theme" path="res://themes/cosmic_clash_theme.tres" id="2_theme"]
|
|
|
|
[node name="Lobby" type="Control"]
|
|
layout_mode = 3
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
script = ExtResource("1_lobby")
|
|
theme = ExtResource("2_theme")
|
|
|
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
|
layout_mode = 1
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
theme_override_constants/margin_left = 24
|
|
theme_override_constants/margin_top = 24
|
|
theme_override_constants/margin_right = 24
|
|
theme_override_constants/margin_bottom = 24
|
|
|
|
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"]
|
|
layout_mode = 2
|
|
follow_focus = true
|
|
horizontal_scroll_mode = 0
|
|
|
|
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/ScrollContainer"]
|
|
layout_mode = 2
|
|
size_flags_horizontal = 3
|
|
size_flags_vertical = 3
|
|
|
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer"]
|
|
custom_minimum_size = Vector2(520, 0)
|
|
layout_mode = 2
|
|
theme_override_constants/separation = 10
|
|
|
|
[node name="TitleLabel" type="Label" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
layout_mode = 2
|
|
theme_override_font_sizes/font_size = 40
|
|
text = "Lobby"
|
|
horizontal_alignment = 1
|
|
|
|
[node name="StatusLabel" type="Label" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
unique_name_in_owner = true
|
|
modulate = Color(1, 1, 1, 0.65)
|
|
layout_mode = 2
|
|
theme_override_font_sizes/font_size = 14
|
|
text = "Connecting..."
|
|
horizontal_alignment = 1
|
|
autowrap_mode = 2
|
|
|
|
[node name="TeamsSeparator" type="HSeparator" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
layout_mode = 2
|
|
|
|
[node name="TeamsRow" type="HBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
layout_mode = 2
|
|
theme_override_constants/separation = 20
|
|
|
|
[node name="Team0Panel" type="VBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow"]
|
|
layout_mode = 2
|
|
size_flags_horizontal = 3
|
|
theme_override_constants/separation = 4
|
|
|
|
[node name="Team0Header" type="Label" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow/Team0Panel"]
|
|
layout_mode = 2
|
|
theme_override_font_sizes/font_size = 18
|
|
text = "Team 1"
|
|
|
|
[node name="Team0List" type="VBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow/Team0Panel"]
|
|
unique_name_in_owner = true
|
|
layout_mode = 2
|
|
theme_override_constants/separation = 2
|
|
|
|
[node name="TeamsVSeparator" type="VSeparator" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow"]
|
|
layout_mode = 2
|
|
|
|
[node name="Team1Panel" type="VBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow"]
|
|
layout_mode = 2
|
|
size_flags_horizontal = 3
|
|
theme_override_constants/separation = 4
|
|
|
|
[node name="Team1Header" type="Label" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow/Team1Panel"]
|
|
layout_mode = 2
|
|
theme_override_font_sizes/font_size = 18
|
|
text = "Team 2"
|
|
|
|
[node name="Team1List" type="VBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/TeamsRow/Team1Panel"]
|
|
unique_name_in_owner = true
|
|
layout_mode = 2
|
|
theme_override_constants/separation = 2
|
|
|
|
[node name="ControlsSeparator" type="HSeparator" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
layout_mode = 2
|
|
|
|
[node name="ControlsRow" type="HBoxContainer" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
unique_name_in_owner = true
|
|
layout_mode = 2
|
|
theme_override_constants/separation = 10
|
|
|
|
[node name="SwitchTeamButton" type="Button" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/ControlsRow"]
|
|
unique_name_in_owner = true
|
|
custom_minimum_size = Vector2(0, 48)
|
|
layout_mode = 2
|
|
size_flags_horizontal = 3
|
|
text = "Switch Team"
|
|
|
|
[node name="ReadyButton" type="CheckButton" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/ControlsRow"]
|
|
unique_name_in_owner = true
|
|
custom_minimum_size = Vector2(0, 48)
|
|
layout_mode = 2
|
|
size_flags_horizontal = 3
|
|
text = "Ready"
|
|
|
|
[node name="LeaveButton" type="Button" parent="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer"]
|
|
unique_name_in_owner = true
|
|
custom_minimum_size = Vector2(0, 48)
|
|
layout_mode = 2
|
|
text = "Leave"
|
|
|
|
[connection signal="pressed" from="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/ControlsRow/SwitchTeamButton" to="." method="_on_switch_team_pressed"]
|
|
[connection signal="toggled" from="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/ControlsRow/ReadyButton" to="." method="_on_ready_toggled"]
|
|
[connection signal="pressed" from="MarginContainer/ScrollContainer/CenterContainer/VBoxContainer/LeaveButton" to="." method="_on_leave_pressed"]
|