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

feat: add options menu to pause menu #477

Merged
merged 1 commit into from
Dec 6, 2021
Merged
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
12 changes: 12 additions & 0 deletions addons/escoria-core/ui_library/menus/pause_menu/pause_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ func _on_load_game_pressed():
$load_game.show()


# Show the options menu
func _on_options_pressed():
$VBoxContainer.hide()
$options.show()


# Quit the game
func _on_quit_pressed():
escoria.quit()
Expand All @@ -41,6 +47,11 @@ func _on_load_game_back_button_pressed():
reset()


# Hide options menu after clicking back button
func _on_options_back_button_pressed():
reset()


# Set whether saving is enabled currently
#
# #### Parameters
Expand All @@ -53,4 +64,5 @@ func set_save_enabled(p_enabled: bool):
func reset():
$save_game.hide()
$load_game.hide()
$options.hide()
$VBoxContainer.show()
23 changes: 17 additions & 6 deletions addons/escoria-core/ui_library/menus/pause_menu/pause_menu.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://addons/escoria-core/ui_library/menus/pause_menu/pause_menu.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/escoria-core/design/escoria-logo-small.png" type="Texture" id=3]
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/save/save_game.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5]
Expand All @@ -26,6 +27,8 @@ visible = false
[node name="load_game" parent="." instance=ExtResource( 5 )]
visible = false

[node name="options" parent="." instance=ExtResource( 2 )]

[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
Expand All @@ -39,18 +42,18 @@ __meta__ = {
}

[node name="TextureRect" type="TextureRect" parent="VBoxContainer"]
margin_top = 162.0
margin_top = 147.0
margin_right = 616.0
margin_bottom = 398.0
margin_bottom = 383.0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="menuitems" type="VBoxContainer" parent="VBoxContainer"]
margin_top = 498.0
margin_top = 483.0
margin_right = 616.0
margin_bottom = 738.0
margin_bottom = 753.0
custom_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
Expand Down Expand Up @@ -86,10 +89,16 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="quit" type="Button" parent="VBoxContainer/menuitems"]
[node name="options" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 220.0
margin_right = 616.0
margin_bottom = 240.0
text = "OPTIONS"

[node name="quit" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 250.0
margin_right = 616.0
margin_bottom = 270.0
size_flags_vertical = 3
text = "QUIT"
__meta__ = {
Expand All @@ -98,7 +107,9 @@ __meta__ = {

[connection signal="back_button_pressed" from="save_game" to="." method="_on_save_game_back_button_pressed"]
[connection signal="back_button_pressed" from="load_game" to="." method="_on_load_game_back_button_pressed"]
[connection signal="back_button_pressed" from="options" to="." method="_on_options_back_button_pressed"]
[connection signal="pressed" from="VBoxContainer/menuitems/continue" to="." method="_on_continue_pressed"]
[connection signal="pressed" from="VBoxContainer/menuitems/save_game" to="." method="_on_save_game_pressed"]
[connection signal="pressed" from="VBoxContainer/menuitems/load_game" to="." method="_on_load_game_pressed"]
[connection signal="pressed" from="VBoxContainer/menuitems/options" to="." method="_on_options_pressed"]
[connection signal="pressed" from="VBoxContainer/menuitems/quit" to="." method="_on_quit_pressed"]