diff --git a/Game/GUI.gd b/Game/GUI.gd new file mode 100644 index 0000000..a8de6c1 --- /dev/null +++ b/Game/GUI.gd @@ -0,0 +1,8 @@ +extends Control + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +func quit_game(): + get_tree().quit() diff --git a/Game/GUI.tscn b/Game/GUI.tscn new file mode 100644 index 0000000..324efc3 --- /dev/null +++ b/Game/GUI.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://GUI.gd" type="Script" id=1] +[ext_resource path="res://Menu.tscn" type="PackedScene" id=2] + +[node name="GUI" type="CenterContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MainMenu" parent="." instance=ExtResource( 2 )] +offset_left = 477.0 +offset_top = 252.0 +offset_right = 547.0 +offset_bottom = 347.0 + +[node name="Options" type="Button" parent="MainMenu"] +offset_top = 33.0 +offset_right = 70.0 +offset_bottom = 62.0 +text = "options" +script = null + +[node name="Quit" type="Button" parent="MainMenu"] +offset_top = 66.0 +offset_right = 70.0 +offset_bottom = 95.0 +text = "quit" +script = null + +[connection signal="pressed" from="MainMenu/Options" to="MainMenu" method="open_menu" binds= [ "res://OptionsMenu.tscn" ]] +[connection signal="pressed" from="MainMenu/Quit" to="." method="quit_game"] diff --git a/Game/GraphicsMenu.gd b/Game/GraphicsMenu.gd new file mode 100644 index 0000000..f1c3f1b --- /dev/null +++ b/Game/GraphicsMenu.gd @@ -0,0 +1,11 @@ +extends "res://Menu.gd" + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass + +func toggle_fullscreen(button_pressed): + if button_pressed: + get_tree().get_root().mode = Window.MODE_FULLSCREEN + else: + get_tree().get_root().mode = Window.MODE_WINDOWED diff --git a/Game/GraphicsMenu.tscn b/Game/GraphicsMenu.tscn new file mode 100644 index 0000000..06d6697 --- /dev/null +++ b/Game/GraphicsMenu.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Menu.tscn" type="PackedScene" id=1] +[ext_resource path="res://GraphicsMenu.gd" type="Script" id=2] + +[node name="GraphicsMenu" instance=ExtResource( 1 )] +script = ExtResource( 2 ) + +[node name="Fullscreen" type="CheckButton" parent="." index="0"] +offset_right = 158.0 +offset_bottom = 40.0 +text = "Fullscreen" +script = null + +[node name="Back" parent="." index="1"] +offset_top = 44.0 +offset_right = 158.0 +offset_bottom = 73.0 + +[connection signal="toggled" from="Fullscreen" to="." method="toggle_fullscreen"] diff --git a/Game/Menu.gd b/Game/Menu.gd new file mode 100644 index 0000000..3eb8e86 --- /dev/null +++ b/Game/Menu.gd @@ -0,0 +1,19 @@ +extends VBoxContainer + +var previous_menu : Node = null + +# Called when the node enters the scene tree for the first time. +func _ready(): + if previous_menu == null: + $Back.hide() + +func open_menu(path : String): + var menu = load(path).instance() + menu.previous_menu = self + get_parent().add_child(menu) + hide() + +func go_back(): + previous_menu.show() + previous_menu = null + queue_free() diff --git a/Game/Menu.tscn b/Game/Menu.tscn new file mode 100644 index 0000000..06b1b41 --- /dev/null +++ b/Game/Menu.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Menu.gd" type="Script" id=1] + +[node name="Menu" type="VBoxContainer"] +offset_left = 475.0 +offset_top = 269.0 +offset_right = 548.0 +offset_bottom = 331.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Back" type="Button" parent="."] +offset_right = 73.0 +offset_bottom = 29.0 +text = "back +" +script = null + +[connection signal="pressed" from="Back" to="." method="go_back"] diff --git a/Game/OptionsMenu.tscn b/Game/OptionsMenu.tscn new file mode 100644 index 0000000..ba8b68e --- /dev/null +++ b/Game/OptionsMenu.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Menu.tscn" type="PackedScene" id=1] + +[node name="OptionsMenu" instance=ExtResource( 1 )] + +[node name="Graphics" type="Button" parent="." index="0"] +offset_right = 80.0 +offset_bottom = 29.0 +text = "Graphics" +script = null + +[node name="Controls" type="Button" parent="." index="1"] +offset_top = 33.0 +offset_right = 80.0 +offset_bottom = 62.0 +text = "Controls" +script = null + +[node name="Back" parent="." index="2"] +offset_top = 66.0 +offset_right = 80.0 +offset_bottom = 95.0 + +[connection signal="pressed" from="Graphics" to="." method="open_menu" binds= [ "res://GraphicsMenu.tscn" ]]