Settings Menu basic layout
This commit is contained in:
@ -5,19 +5,35 @@ extends Control
|
|||||||
@onready var start_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button
|
@onready var start_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button
|
||||||
@onready var settings_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button2
|
@onready var settings_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button2
|
||||||
@onready var exit_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button3
|
@onready var exit_button: Button = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Button3
|
||||||
|
@onready var settings_menu: Control = $Settings_Menu
|
||||||
|
@onready var margin_container: MarginContainer = $MarginContainer
|
||||||
|
|
||||||
|
|
||||||
@onready var start_level = preload("res://Main_menu/main_menu.tscn") as PackedScene
|
@onready var start_level = preload("res://Main_menu/main_menu.tscn") as PackedScene
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
start_button.button_down.connect(on_start_pressed)
|
hanlde_signal_connections()
|
||||||
settings_button.button_down.connect(on_settings_pressed)
|
|
||||||
exit_button.button_down.connect(on_exit_pressed)
|
|
||||||
|
|
||||||
func on_start_pressed()-> void:
|
func on_start_pressed()-> void:
|
||||||
print("scene changed!")
|
print("scene changed!")
|
||||||
get_tree().change_scene_to_packed(start_level)
|
get_tree().change_scene_to_packed(start_level)
|
||||||
|
|
||||||
func on_settings_pressed()->void:
|
func on_settings_pressed()->void:
|
||||||
pass
|
margin_container.visible = false
|
||||||
|
settings_menu.set_process(true)
|
||||||
|
settings_menu.visible = true
|
||||||
|
|
||||||
func on_exit_pressed() ->void:
|
func exited_game() ->void:
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
|
func exited_settings() -> void:
|
||||||
|
margin_container.visible = true
|
||||||
|
settings_menu.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func hanlde_signal_connections() ->void:
|
||||||
|
start_button.button_down.connect(on_start_pressed)
|
||||||
|
settings_button.button_down.connect(on_settings_pressed)
|
||||||
|
exit_button.button_down.connect(exited_game)
|
||||||
|
settings_menu.exit_options_menu.connect(exited_settings)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://s4dt2nklh1ef"]
|
[gd_scene load_steps=7 format=3 uid="uid://s4dt2nklh1ef"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cpykl56e4h7q1" path="res://Main_menu/background.jpg" id="1_3skw3"]
|
[ext_resource type="Texture2D" uid="uid://cpykl56e4h7q1" path="res://Main_menu/background.jpg" id="1_3skw3"]
|
||||||
[ext_resource type="Script" path="res://Main_menu/main_menu.gd" id="1_mhyy3"]
|
[ext_resource type="Script" path="res://Main_menu/main_menu.gd" id="1_mhyy3"]
|
||||||
[ext_resource type="FontFile" uid="uid://c3jp6yk6l8gei" path="res://Main_menu/KnightWarrior-w16n8.otf" id="2_7dnc6"]
|
[ext_resource type="FontFile" uid="uid://c3jp6yk6l8gei" path="res://Main_menu/KnightWarrior-w16n8.otf" id="2_7dnc6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bd2tk3epl8hbw" path="res://Settings_menu/options_menu.tscn" id="4_xieoo"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ii5ra"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ii5ra"]
|
||||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
@ -94,3 +95,7 @@ layout_mode = 2
|
|||||||
theme_override_fonts/font = SubResource("SystemFont_e8c4f")
|
theme_override_fonts/font = SubResource("SystemFont_e8c4f")
|
||||||
theme_override_font_sizes/font_size = 24
|
theme_override_font_sizes/font_size = 24
|
||||||
text = "Exit"
|
text = "Exit"
|
||||||
|
|
||||||
|
[node name="Settings_Menu" parent="." instance=ExtResource("4_xieoo")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
55
Settings_menu/options_menu.tscn
Normal file
55
Settings_menu/options_menu.tscn
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://bd2tk3epl8hbw"]
|
||||||
|
|
||||||
|
[ext_resource type="FontFile" uid="uid://c3jp6yk6l8gei" path="res://Main_menu/KnightWarrior-w16n8.otf" id="1_62i2n"]
|
||||||
|
[ext_resource type="Script" path="res://Settings_menu/settings_menu.gd" id="1_p1tcl"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b55g5fki74hey" path="res://Settings_menu/settings_tab_container.tscn" id="3_jn3pd"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ag8kh"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
shadow_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="Settings_Menu" 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_p1tcl")
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 12
|
||||||
|
theme_override_constants/margin_top = 12
|
||||||
|
theme_override_constants/margin_right = 12
|
||||||
|
theme_override_constants/margin_bottom = 12
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label-title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/line_spacing = 15
|
||||||
|
theme_override_constants/shadow_offset_x = 15
|
||||||
|
theme_override_constants/shadow_offset_y = 20
|
||||||
|
theme_override_constants/outline_size = 24
|
||||||
|
theme_override_fonts/font = ExtResource("1_62i2n")
|
||||||
|
theme_override_font_sizes/font_size = 32
|
||||||
|
theme_override_styles/normal = SubResource("StyleBoxFlat_ag8kh")
|
||||||
|
text = "Settings"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Control" parent="MarginContainer/VBoxContainer" instance=ExtResource("3_jn3pd")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="Exit_Button" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 8
|
||||||
|
text = "Exit"
|
13
Settings_menu/settings_menu.gd
Normal file
13
Settings_menu/settings_menu.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Control
|
||||||
|
@onready var exit_button: Button = $MarginContainer/VBoxContainer/Exit_Button
|
||||||
|
|
||||||
|
signal exit_options_menu
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
exit_button.button_down.connect(on_exit_pressed)
|
||||||
|
set_process(false)
|
||||||
|
|
||||||
|
func on_exit_pressed() -> void:
|
||||||
|
exit_options_menu.emit()
|
||||||
|
set_process(false)
|
230
Settings_menu/settings_tab_container.tscn
Normal file
230
Settings_menu/settings_tab_container.tscn
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
[gd_scene format=3 uid="uid://b55g5fki74hey"]
|
||||||
|
|
||||||
|
[node name="Control" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="TabContainer" type="TabContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 100.0
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = -100.0
|
||||||
|
offset_bottom = -50.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
tab_alignment = 1
|
||||||
|
current_tab = 0
|
||||||
|
|
||||||
|
[node name="Sound" type="TabBar" parent="TabContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
metadata/_tab_index = 0
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Sound"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 24
|
||||||
|
theme_override_constants/margin_top = 24
|
||||||
|
theme_override_constants/margin_right = 24
|
||||||
|
theme_override_constants/margin_bottom = 24
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Sound/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 64
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label4" type="Label" parent="TabContainer/Sound/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label5" type="Label" parent="TabContainer/Sound/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="TabContainer/Sound/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label2" type="Label" parent="TabContainer/Sound/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="TabContainer/Sound/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Graphics" type="TabBar" parent="TabContainer"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
metadata/_tab_index = 1
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Graphics"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 24
|
||||||
|
theme_override_constants/margin_top = 24
|
||||||
|
theme_override_constants/margin_right = 24
|
||||||
|
theme_override_constants/margin_bottom = 24
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Graphics/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 64
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label4" type="Label" parent="TabContainer/Graphics/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Second
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label5" type="Label" parent="TabContainer/Graphics/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Second
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label6" type="Label" parent="TabContainer/Graphics/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Second
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label7" type="Label" parent="TabContainer/Graphics/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Second
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label8" type="Label" parent="TabContainer/Graphics/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Second
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Controls" type="TabBar" parent="TabContainer"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
metadata/_tab_index = 2
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Controls"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 24
|
||||||
|
theme_override_constants/margin_top = 24
|
||||||
|
theme_override_constants/margin_right = 24
|
||||||
|
theme_override_constants/margin_bottom = 24
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Controls/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 64
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="TabContainer/Controls/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "third
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label2" type="Label" parent="TabContainer/Controls/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "third
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="TabContainer/Controls/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "third
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label4" type="Label" parent="TabContainer/Controls/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "third
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label5" type="Label" parent="TabContainer/Controls/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "third
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Accesibility" type="TabBar" parent="TabContainer"]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
metadata/_tab_index = 3
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Accesibility"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 24
|
||||||
|
theme_override_constants/margin_top = 24
|
||||||
|
theme_override_constants/margin_right = 24
|
||||||
|
theme_override_constants/margin_bottom = 24
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Accesibility/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 64
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label4" type="Label" parent="TabContainer/Accesibility/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label5" type="Label" parent="TabContainer/Accesibility/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="TabContainer/Accesibility/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label2" type="Label" parent="TabContainer/Accesibility/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="TabContainer/Accesibility/MarginContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "First
|
||||||
|
"
|
||||||
|
horizontal_alignment = 1
|
Reference in New Issue
Block a user