From 9a2bcf02c2623c8f3e8f5e74e70b3c0333790484 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sat, 4 Jun 2022 10:27:35 -0600 Subject: refactor nodes to work with native scene changer, add functioning main menu --- src/ui/main_menu/scenes/MainMenu.tscn | 66 +++++++++++++++++++++++++++++++++ src/ui/main_menu/scenes/MenuOption.tscn | 27 ++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 src/ui/main_menu/scenes/MainMenu.tscn create mode 100644 src/ui/main_menu/scenes/MenuOption.tscn (limited to 'src/ui/main_menu/scenes') diff --git a/src/ui/main_menu/scenes/MainMenu.tscn b/src/ui/main_menu/scenes/MainMenu.tscn new file mode 100644 index 0000000..249885e --- /dev/null +++ b/src/ui/main_menu/scenes/MainMenu.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://ui/main_menu/scenes/MenuOption.tscn" type="PackedScene" id=1] +[ext_resource path="res://fonts/monogram_extended.ttf" type="DynamicFontData" id=2] +[ext_resource path="res://ui/main_menu/scripts/main_menu.gd" type="Script" id=3] + +[sub_resource type="DynamicFont" id=1] +size = 64 +font_data = ExtResource( 2 ) + +[node name="MainMenu" type="MarginContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 3 ) +START_OPTION_NP = NodePath("Center/VBox/Options/VBox/Start") +SETTINGS_OPTION_NP = NodePath("Center/VBox/Options/VBox/Settings") +EXIT_OPTION_NP = NodePath("Center/VBox/Options/VBox/Exit") + +[node name="Center" type="CenterContainer" parent="."] +margin_right = 320.0 +margin_bottom = 180.0 + +[node name="VBox" type="VBoxContainer" parent="Center"] +margin_left = 64.0 +margin_top = 28.0 +margin_right = 256.0 +margin_bottom = 152.0 +custom_constants/separation = 16 + +[node name="Title" type="CenterContainer" parent="Center/VBox"] +margin_right = 192.0 +margin_bottom = 52.0 + +[node name="Label" type="Label" parent="Center/VBox/Title"] +margin_right = 192.0 +margin_bottom = 52.0 +custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 1 ) +text = "El Snake" + +[node name="Options" type="CenterContainer" parent="Center/VBox"] +margin_top = 68.0 +margin_right = 192.0 +margin_bottom = 124.0 + +[node name="VBox" type="VBoxContainer" parent="Center/VBox/Options"] +margin_left = 56.0 +margin_right = 136.0 +margin_bottom = 56.0 + +[node name="Start" parent="Center/VBox/Options/VBox" instance=ExtResource( 1 )] +margin_right = 80.0 +label_text = "Start" +selected = true + +[node name="Settings" parent="Center/VBox/Options/VBox" instance=ExtResource( 1 )] +margin_top = 20.0 +margin_right = 80.0 +margin_bottom = 36.0 +label_text = "Settings" + +[node name="Exit" parent="Center/VBox/Options/VBox" instance=ExtResource( 1 )] +margin_top = 40.0 +margin_right = 80.0 +margin_bottom = 56.0 +label_text = "Exit" diff --git a/src/ui/main_menu/scenes/MenuOption.tscn b/src/ui/main_menu/scenes/MenuOption.tscn new file mode 100644 index 0000000..d6bb05f --- /dev/null +++ b/src/ui/main_menu/scenes/MenuOption.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://fonts/MonogramExtended.tres" type="DynamicFont" id=2] +[ext_resource path="res://ui/main_menu/scripts/menu_option.gd" type="Script" id=3] + +[node name="MenuOption" type="CenterContainer"] +margin_right = 49.0 +margin_bottom = 16.0 +script = ExtResource( 3 ) + +[node name="HBox" type="HBoxContainer" parent="."] +margin_right = 80.0 +margin_bottom = 16.0 + +[node name="Selector" type="TextureRect" parent="HBox"] +margin_right = 16.0 +margin_bottom = 16.0 +rect_min_size = Vector2( 16, 16 ) + +[node name="Label" type="Label" parent="HBox"] +margin_left = 20.0 +margin_top = 1.0 +margin_right = 80.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 60, 0 ) +custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 2 ) -- cgit v1.2.3-54-g00ecf