diff options
Diffstat (limited to 'game/src/MainMenu')
-rw-r--r-- | game/src/MainMenu/MainMenu.gd | 34 | ||||
-rw-r--r-- | game/src/MainMenu/MainMenu.tscn | 98 |
2 files changed, 132 insertions, 0 deletions
diff --git a/game/src/MainMenu/MainMenu.gd b/game/src/MainMenu/MainMenu.gd new file mode 100644 index 0000000..000dc69 --- /dev/null +++ b/game/src/MainMenu/MainMenu.gd @@ -0,0 +1,34 @@ +extends Control + +signal options_button_pressed + +@export +var _new_game_button : BaseButton + +func _ready(): + print("From GDScript") + TestSingleton.hello_singleton() + _new_game_button.grab_focus() + + +func _on_new_game_button_pressed(): + print("Start a new game!") + get_tree().change_scene_to_file("res://src/SampleGame.tscn") + + +func _on_continue_button_pressed(): + print("Continue last game!") + + +func _on_multi_player_button_pressed(): + print("Have fun with friends!") + + +func _on_options_button_pressed(): + print("Check out some options!") + options_button_pressed.emit() + + +func _on_exit_button_pressed(): + print("See you later!") + get_tree().quit() diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn new file mode 100644 index 0000000..bb47f88 --- /dev/null +++ b/game/src/MainMenu/MainMenu.tscn @@ -0,0 +1,98 @@ +[gd_scene load_steps=3 format=3 uid="uid://dvoin538iby54"] + +[ext_resource type="Theme" uid="uid://1xrgnmmnrnce" path="res://default_theme.theme" id="1_6d448"] +[ext_resource type="Script" path="res://src/MainMenu/MainMenu.gd" id="2_nm1fq"] + +[node name="MainMenu" type="Control" node_paths=PackedStringArray("_new_game_button")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("1_6d448") +script = ExtResource("2_nm1fq") +_new_game_button = NodePath("Panel/VBox/Margin/ButtonList/NewGameButton") + +[node name="Panel" type="PanelContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_type_variation = &"Panel_MainMenu" + +[node name="VBox" type="VBoxContainer" parent="Panel"] +layout_mode = 2 + +[node name="TitleLabel" type="Label" parent="Panel/VBox"] +layout_mode = 2 +size_flags_vertical = 6 +size_flags_stretch_ratio = 1.5 +theme_override_font_sizes/font_size = 90 +text = "OpenVic2" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Margin" type="MarginContainer" parent="Panel/VBox"] +layout_mode = 2 +theme_override_constants/margin_left = 15 +theme_override_constants/margin_right = 12 + +[node name="ButtonList" type="HBoxContainer" parent="Panel/VBox/Margin"] +custom_minimum_size = Vector2(500, 0) +layout_mode = 2 +theme_type_variation = &"HBox_MainMenu_ButtonList" +theme_override_constants/separation = 18 +alignment = 1 + +[node name="NewGameButton" type="Button" parent="Panel/VBox/Margin/ButtonList" node_paths=PackedStringArray("shortcut_context")] +layout_mode = 2 +size_flags_horizontal = 3 +focus_neighbor_top = NodePath("../ExitButton") +shortcut_context = NodePath("") +theme_type_variation = &"Button_MainMenu" +text = "New Game" +clip_text = true + +[node name="ContinueButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_type_variation = &"Button_MainMenu" +disabled = true +text = "Continue" +clip_text = true + +[node name="MultiplayerButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_type_variation = &"Button_MainMenu" +text = "Multiplayer" +clip_text = true + +[node name="OptionsButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_type_variation = &"Button_MainMenu" +text = "Options" +clip_text = true + +[node name="ExitButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +layout_mode = 2 +size_flags_horizontal = 3 +focus_neighbor_bottom = NodePath("../NewGameButton") +theme_type_variation = &"Button_MainMenu" +text = "Exit" +clip_text = true + +[node name="BottomSpace" type="Control" parent="Panel/VBox"] +layout_mode = 2 +size_flags_vertical = 3 +size_flags_stretch_ratio = 0.35 + +[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/NewGameButton" to="." method="_on_new_game_button_pressed"] +[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/ContinueButton" to="." method="_on_continue_button_pressed"] +[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/MultiplayerButton" to="." method="_on_multi_player_button_pressed"] +[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"] +[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/ExitButton" to="." method="_on_exit_button_pressed"] |