1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-21 15:34:17 +00:00

Add name input on main menu

This commit is contained in:
Steffo 2023-01-09 15:15:59 +01:00
parent c5d540231f
commit 3c325c4505
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 65 additions and 17 deletions

View file

@ -1,3 +1,4 @@
extends Node
var player: Player
var username: String

View file

@ -7,3 +7,7 @@ signal play_pressed()
func play():
print("Play button was pressed.")
emit_signal("play_pressed")
func _on_text_edit_text_changed():
Singletons.username = $Content/Inputs/NameInput.text

View file

@ -17,6 +17,7 @@ theme = ExtResource("1_mkxnc")
script = ExtResource("2_6amk3")
[node name="Panel" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@ -26,6 +27,7 @@ texture = ExtResource("2_q14jx")
stretch_mode = 1
[node name="Content" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@ -34,29 +36,39 @@ grow_vertical = 2
alignment = 1
[node name="Authors" type="Label" parent="Content"]
offset_right = 284.0
offset_bottom = 18.0
layout_mode = 2
text = "A game by Ichicoro and Steffo"
horizontal_alignment = 1
[node name="Title" type="Label" parent="Content"]
offset_top = 25.0
offset_right = 284.0
offset_bottom = 75.0
layout_mode = 2
size_flags_vertical = 6
theme_override_font_sizes/font_size = 48
text = "Harvest"
horizontal_alignment = 1
[node name="Control" type="Control" parent="Content"]
layout_mode = 3
anchors_preset = 0
offset_top = 110.0
offset_right = 284.0
offset_bottom = 110.0
[node name="Inputs" type="Control" parent="Content"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
[node name="Play" type="Button" parent="Content/Control"]
[node name="NameInput" type="TextEdit" parent="Content/Inputs"]
custom_minimum_size = Vector2(140, 28)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 6
placeholder_text = "What's your name?"
[node name="Buttons" type="Control" parent="Content"]
layout_mode = 2
size_flags_vertical = 6
[node name="Play" type="Button" parent="Content/Buttons"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
@ -74,11 +86,10 @@ theme_override_font_sizes/font_size = 0
text = "Play"
[node name="Authors2" type="Label" parent="Content"]
offset_top = 142.0
offset_right = 284.0
offset_bottom = 160.0
layout_mode = 2
size_flags_vertical = 1
text = "Ludum Dare 52 - Harvest"
horizontal_alignment = 1
[connection signal="pressed" from="Content/Control/Play" to="." method="play"]
[connection signal="text_changed" from="Content/Inputs/NameInput" to="." method="_on_text_edit_text_changed"]
[connection signal="pressed" from="Content/Buttons/Play" to="." method="play"]

View file

@ -1,4 +1,4 @@
[gd_resource type="Theme" load_steps=8 format=3 uid="uid://c5a1nyqumj46j"]
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://c5a1nyqumj46j"]
[ext_resource type="FontFile" uid="uid://dvfq5l72ynw4s" path="res://assets/pixel_operator.ttf" id="1_tst0x"]
@ -49,6 +49,33 @@ corner_detail = 2
shadow_color = Color(1, 1, 1, 1)
anti_aliasing = false
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_20p1w"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jo6pk"]
bg_color = Color(0.156863, 0.207843, 0.25098, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0.388235, 0.670588, 0.247059, 1)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2
anti_aliasing = false
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_u2xmj"]
bg_color = Color(0.670588, 0.317647, 0.188235, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0.941176, 0.709804, 0.254902, 1)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2
[resource]
Button/font_sizes/font_size = 16
Button/fonts/font = SubResource("FontVariation_srw5c")
@ -61,3 +88,8 @@ Label/colors/font_color = Color(1, 1, 1, 1)
Label/constants/line_spacing = 2
Label/font_sizes/font_size = 16
Label/fonts/font = ExtResource("1_tst0x")
TextEdit/font_sizes/font_size = 16
TextEdit/fonts/font = ExtResource("1_tst0x")
TextEdit/styles/focus = SubResource("StyleBoxEmpty_20p1w")
TextEdit/styles/normal = SubResource("StyleBoxFlat_jo6pk")
TextEdit/styles/read_only = SubResource("StyleBoxFlat_u2xmj")