diff --git a/menus/scenes/menus/main_menu/new_main_menu.tscn b/menus/scenes/menus/main_menu/new_main_menu.tscn new file mode 100644 index 00000000..b0608bca --- /dev/null +++ b/menus/scenes/menus/main_menu/new_main_menu.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=3 format=3 uid="uid://br8shfwk2lne0"] + +[ext_resource type="Script" uid="uid://brrt2uj47cmld" path="res://systems/ui/grab_focus.gd" id="1_c6nmr"] +[ext_resource type="Script" uid="uid://ckywnolvqy6w1" path="res://systems/ui/new_main_menu.gd" id="1_vi8ha"] + +[node name="NewMainMenu" 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_vi8ha") +game_scene_path = "uid://dmkw8cmalm5k" + +[node name="Menus" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="StartGameButton" type="Button" parent="Menus"] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +text = "Start game" +script = ExtResource("1_c6nmr") + +[connection signal="pressed" from="Menus/StartGameButton" to="." method="on_new_game"] diff --git a/project.godot b/project.godot index 68f2d02a..abd9f62c 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ warnings/check_invalid_track_paths=false [application] config/name="Movement tests" -run/main_scene="uid://vm22i5sv3p3s" +run/main_scene="uid://br8shfwk2lne0" config/features=PackedStringArray("4.5", "C#", "Forward Plus") config/icon="res://icon.svg" diff --git a/systems/ui/grab_focus.gd b/systems/ui/grab_focus.gd new file mode 100644 index 00000000..122f26ce --- /dev/null +++ b/systems/ui/grab_focus.gd @@ -0,0 +1,4 @@ +extends Control + +func _ready() -> void: + grab_focus() diff --git a/systems/ui/grab_focus.gd.uid b/systems/ui/grab_focus.gd.uid new file mode 100644 index 00000000..024ab2ef --- /dev/null +++ b/systems/ui/grab_focus.gd.uid @@ -0,0 +1 @@ +uid://brrt2uj47cmld diff --git a/systems/ui/new_main_menu.gd b/systems/ui/new_main_menu.gd new file mode 100644 index 00000000..ac08bdce --- /dev/null +++ b/systems/ui/new_main_menu.gd @@ -0,0 +1,6 @@ +extends Control + +@export_file("*.tscn") var game_scene_path : String + +func on_new_game() -> void: + SceneLoader.load_scene(game_scene_path) diff --git a/systems/ui/new_main_menu.gd.uid b/systems/ui/new_main_menu.gd.uid new file mode 100644 index 00000000..5b53f744 --- /dev/null +++ b/systems/ui/new_main_menu.gd.uid @@ -0,0 +1 @@ +uid://ckywnolvqy6w1