Browse Source

Adding Quit button and cleaning up UI layout

pull/1/head v1.3
Ryan Reed 1 year ago
parent
commit
ff25603b1c
2 changed files with 28 additions and 5 deletions
  1. +4
    -1
      world.gd
  2. +24
    -4
      world.tscn

+ 4
- 1
world.gd View File

@ -196,7 +196,10 @@ func _on_generation_timer_timeout() -> void:
generation_timer.start() generation_timer.start()
func _on_generation_submit_pressed() -> void:
func _on_quit_button_pressed() -> void:
get_tree().quit()
func _on_run_button_pressed() -> void:
if not generation_seed.text.strip_edges(): if not generation_seed.text.strip_edges():
world_seed = randi() world_seed = randi()
else: else:


+ 24
- 4
world.tscn View File

@ -112,6 +112,11 @@ custom_minimum_size = Vector2(120, 0)
layout_mode = 2 layout_mode = 2
text = "World Size" text = "World Size"
[node name="Padding" type="VSeparator" parent="UI/WorldGeneration/VBoxContainer/WorldSize"]
modulate = Color(1, 1, 1, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="Label_x" type="Label" parent="UI/WorldGeneration/VBoxContainer/WorldSize"] [node name="Label_x" type="Label" parent="UI/WorldGeneration/VBoxContainer/WorldSize"]
layout_mode = 2 layout_mode = 2
text = "X:" text = "X:"
@ -143,6 +148,11 @@ custom_minimum_size = Vector2(120, 0)
layout_mode = 2 layout_mode = 2
text = "Cell Size" text = "Cell Size"
[node name="Padding" type="VSeparator" parent="UI/WorldGeneration/VBoxContainer/CellSize"]
modulate = Color(1, 1, 1, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="Label_x" type="Label" parent="UI/WorldGeneration/VBoxContainer/CellSize"] [node name="Label_x" type="Label" parent="UI/WorldGeneration/VBoxContainer/CellSize"]
layout_mode = 2 layout_mode = 2
text = "X:" text = "X:"
@ -165,14 +175,24 @@ text = "16"
max_length = 4 max_length = 4
select_all_on_focus = true select_all_on_focus = true
[node name="FinalRow" type="HBoxContainer" parent="UI/WorldGeneration/VBoxContainer"]
layout_mode = 2
[node name="RunButton" type="Button" parent="UI/WorldGeneration/VBoxContainer/FinalRow"]
layout_mode = 2
text = "Run"
[node name="Submit" type="HBoxContainer" parent="UI/WorldGeneration/VBoxContainer"]
[node name="Padding" type="VSeparator" parent="UI/WorldGeneration/VBoxContainer/FinalRow"]
modulate = Color(1, 1, 1, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3
[node name="Button" type="Button" parent="UI/WorldGeneration/VBoxContainer/Submit"]
[node name="QuitButton" type="Button" parent="UI/WorldGeneration/VBoxContainer/FinalRow"]
layout_direction = 3
layout_mode = 2 layout_mode = 2
text = "Start"
text = "Quit"
[connection signal="timeout" from="GenerationTimer" to="." method="_on_generation_timer_timeout"] [connection signal="timeout" from="GenerationTimer" to="." method="_on_generation_timer_timeout"]
[connection signal="pressed" from="UI/WorldGeneration/VBoxContainer/Seed/Generate" to="." method="_on_world_seed_generate_pressed"] [connection signal="pressed" from="UI/WorldGeneration/VBoxContainer/Seed/Generate" to="." method="_on_world_seed_generate_pressed"]
[connection signal="pressed" from="UI/WorldGeneration/VBoxContainer/Submit/Button" to="." method="_on_generation_submit_pressed"]
[connection signal="pressed" from="UI/WorldGeneration/VBoxContainer/FinalRow/RunButton" to="." method="_on_run_button_pressed"]
[connection signal="pressed" from="UI/WorldGeneration/VBoxContainer/FinalRow/QuitButton" to="." method="_on_quit_button_pressed"]

Loading…
Cancel
Save