From e3e9d5591d180826269c10dca4df6719b95d2130 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 19 Jul 2025 21:20:38 +0400 Subject: [PATCH] Main menu created --- scripts/MainMenu.gd | 14 +++++++++++ scripts/MainMenu.gd.uid | 1 + ui/MainMenu.tscn | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 scripts/MainMenu.gd create mode 100644 scripts/MainMenu.gd.uid create mode 100644 ui/MainMenu.tscn diff --git a/scripts/MainMenu.gd b/scripts/MainMenu.gd new file mode 100644 index 0000000..10feaca --- /dev/null +++ b/scripts/MainMenu.gd @@ -0,0 +1,14 @@ +extends Control + +func _ready(): + print("MainMenu ready") + +func _on_new_game_button_pressed(): + print("New Game pressed") + +func _on_settings_button_pressed(): + print("Settings pressed") + +func _on_exit_button_pressed(): + print("Exit pressed") + get_tree().quit() diff --git a/scripts/MainMenu.gd.uid b/scripts/MainMenu.gd.uid new file mode 100644 index 0000000..1e079c6 --- /dev/null +++ b/scripts/MainMenu.gd.uid @@ -0,0 +1 @@ +uid://ctu58xq7btp1n diff --git a/ui/MainMenu.tscn b/ui/MainMenu.tscn new file mode 100644 index 0000000..b58eefc --- /dev/null +++ b/ui/MainMenu.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=2 format=3 uid="uid://m8lf3eh3al5j"] + +[ext_resource type="Script" uid="uid://ctu58xq7btp1n" path="res://scripts/MainMenu.gd" id="1_b00nv"] + +[node name="MainMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_b00nv") + +[node name="Background" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.952411, 0.651681, 0.63048, 1) + +[node name="MenuContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -20.0 +offset_right = 20.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="NewGameButton" type="Button" parent="MenuContainer"] +layout_mode = 2 +text = "New Game" + +[node name="SettingsButton" type="Button" parent="MenuContainer"] +layout_mode = 2 +text = "Settings" + +[node name="ExitButton" type="Button" parent="MenuContainer"] +layout_mode = 2 +text = "Exit" + +[connection signal="pressed" from="MenuContainer/NewGameButton" to="." method="_on_new_game_button_pressed"] +[connection signal="pressed" from="MenuContainer/SettingsButton" to="." method="_on_settings_button_pressed"] +[connection signal="pressed" from="MenuContainer/ExitButton" to="." method="_on_exit_button_pressed"]