-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7f72fc
commit 8dcdf86
Showing
11 changed files
with
451 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[gd_resource type="Theme" load_steps=7 format=3 uid="uid://65dakj0ukuj6"] | ||
|
||
[ext_resource type="FontFile" uid="uid://dtywkluh6lms5" path="res://assets/fonts/Early GameBoy.ttf" id="1_7bvv0"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_urgfj"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7314y"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_eqtds"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_db648"] | ||
|
||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_42rn8"] | ||
|
||
[resource] | ||
default_font = ExtResource("1_7bvv0") | ||
default_font_size = 16 | ||
Button/colors/font_focus_color = Color(0.25098, 0.384314, 0.592157, 1) | ||
Button/colors/font_hover_color = Color(0.721569, 0.831373, 1, 1) | ||
Button/colors/font_pressed_color = Color(0.207843, 0.266667, 0.380392, 1) | ||
Button/styles/disabled = SubResource("StyleBoxEmpty_urgfj") | ||
Button/styles/focus = SubResource("StyleBoxEmpty_7314y") | ||
Button/styles/hover = SubResource("StyleBoxEmpty_eqtds") | ||
Button/styles/normal = SubResource("StyleBoxEmpty_db648") | ||
Button/styles/pressed = SubResource("StyleBoxEmpty_42rn8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
extends Control | ||
|
||
signal return_to_game() | ||
signal main_menu() | ||
|
||
@onready var SFX_BUS_ID = AudioServer.get_bus_index("SFX") | ||
@onready var MUSIC_BUS_ID = AudioServer.get_bus_index("Music") | ||
@onready var buttons_v_box = %ButtonsVBox | ||
|
||
|
||
func _on_music_slider_value_changed(value): | ||
AudioServer.set_bus_volume_db(MUSIC_BUS_ID, linear_to_db(value)) | ||
AudioServer.set_bus_mute(MUSIC_BUS_ID, value < .05) | ||
|
||
|
||
func _on_sfx_slider_value_changed(value): | ||
AudioServer.set_bus_volume_db(SFX_BUS_ID, linear_to_db(value)) | ||
AudioServer.set_bus_mute(SFX_BUS_ID, value < .05) | ||
|
||
|
||
func focus_button() -> void: | ||
if buttons_v_box: | ||
var button: Button = buttons_v_box.get_child(0) | ||
if button is Button: | ||
button.grab_focus() | ||
|
||
|
||
func _on_visibility_changed(): | ||
if visible: | ||
focus_button() | ||
|
||
|
||
|
||
func _on_return_to_game_button_pressed(): | ||
return_to_game.emit() | ||
|
||
|
||
func _on_main_menu_button_pressed(): | ||
main_menu.emit() | ||
|
||
|
||
func _on_quit_button_pressed(): | ||
get_tree().quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
[gd_scene load_steps=3 format=3 uid="uid://daxygoynvdyya"] | ||
|
||
[ext_resource type="Theme" uid="uid://65dakj0ukuj6" path="res://assets/themes/default_theme.tres" id="1_mwxwu"] | ||
[ext_resource type="Script" path="res://scenes/ui/menus/game_menu.gd" id="2_pgx83"] | ||
|
||
[node name="GameMenu" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme = ExtResource("1_mwxwu") | ||
script = ExtResource("2_pgx83") | ||
|
||
[node name="ColorRect" 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.0705882, 0.0705882, 0.0705882, 0.780392) | ||
|
||
[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 = 256 | ||
theme_override_constants/margin_right = 256 | ||
|
||
[node name="ButtonsVBox" type="VBoxContainer" parent="MarginContainer"] | ||
unique_name_in_owner = true | ||
layout_mode = 2 | ||
alignment = 1 | ||
|
||
[node name="ReturnToGameButton" type="Button" parent="MarginContainer/ButtonsVBox"] | ||
layout_mode = 2 | ||
focus_neighbor_top = NodePath("../QuitButton") | ||
focus_neighbor_bottom = NodePath("../GridContainer/MusicSlider") | ||
focus_next = NodePath("../GridContainer/MusicSlider") | ||
focus_previous = NodePath("../QuitButton") | ||
text = "Continue Game" | ||
alignment = 0 | ||
|
||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/ButtonsVBox"] | ||
layout_mode = 2 | ||
size_flags_vertical = 4 | ||
theme_override_constants/h_separation = 16 | ||
columns = 2 | ||
|
||
[node name="MusicLabel" type="Label" parent="MarginContainer/ButtonsVBox/GridContainer"] | ||
layout_mode = 2 | ||
text = "Music" | ||
|
||
[node name="MusicSlider" type="HSlider" parent="MarginContainer/ButtonsVBox/GridContainer"] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 4 | ||
focus_neighbor_top = NodePath("../../ReturnToGameButton") | ||
focus_neighbor_bottom = NodePath("../SFXSlider") | ||
focus_next = NodePath("../SFXSlider") | ||
focus_previous = NodePath("../../ReturnToGameButton") | ||
max_value = 1.0 | ||
step = 0.05 | ||
|
||
[node name="SFXLabel" type="Label" parent="MarginContainer/ButtonsVBox/GridContainer"] | ||
layout_mode = 2 | ||
text = "SFX" | ||
|
||
[node name="SFXSlider" type="HSlider" parent="MarginContainer/ButtonsVBox/GridContainer"] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 4 | ||
focus_neighbor_top = NodePath("../MusicSlider") | ||
focus_neighbor_bottom = NodePath("../../MainMenuButton") | ||
focus_next = NodePath("../../MainMenuButton") | ||
focus_previous = NodePath("../MusicSlider") | ||
max_value = 1.0 | ||
step = 0.05 | ||
value = 1.0 | ||
|
||
[node name="MainMenuButton" type="Button" parent="MarginContainer/ButtonsVBox"] | ||
layout_mode = 2 | ||
focus_neighbor_top = NodePath("../GridContainer/SFXSlider") | ||
focus_neighbor_bottom = NodePath("../QuitButton") | ||
focus_next = NodePath("../QuitButton") | ||
focus_previous = NodePath("../GridContainer/SFXSlider") | ||
text = "Return to menu" | ||
alignment = 0 | ||
|
||
[node name="QuitButton" type="Button" parent="MarginContainer/ButtonsVBox"] | ||
layout_mode = 2 | ||
focus_neighbor_top = NodePath("../MainMenuButton") | ||
focus_neighbor_bottom = NodePath("../ReturnToGameButton") | ||
focus_next = NodePath("../ReturnToGameButton") | ||
focus_previous = NodePath("../MainMenuButton") | ||
text = "Quit Game" | ||
alignment = 0 | ||
|
||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"] | ||
[connection signal="pressed" from="MarginContainer/ButtonsVBox/ReturnToGameButton" to="." method="_on_return_to_game_button_pressed"] | ||
[connection signal="value_changed" from="MarginContainer/ButtonsVBox/GridContainer/MusicSlider" to="." method="_on_music_slider_value_changed"] | ||
[connection signal="value_changed" from="MarginContainer/ButtonsVBox/GridContainer/SFXSlider" to="." method="_on_sfx_slider_value_changed"] | ||
[connection signal="pressed" from="MarginContainer/ButtonsVBox/MainMenuButton" to="." method="_on_main_menu_button_pressed"] | ||
[connection signal="pressed" from="MarginContainer/ButtonsVBox/QuitButton" to="." method="_on_quit_button_pressed"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends Control | ||
|
||
signal start_game() | ||
@onready var buttons_v_box = %ButtonsVBox | ||
|
||
func _ready() -> void: | ||
focus_button() | ||
|
||
|
||
func _on_start_game_button_pressed() -> void: | ||
start_game.emit() | ||
hide() | ||
|
||
|
||
func _on_quit_button_pressed() -> void: | ||
get_tree().quit() | ||
|
||
|
||
func focus_button() -> void: | ||
if buttons_v_box: | ||
var button: Button = buttons_v_box.get_child(0) | ||
if button is Button: | ||
button.grab_focus() | ||
|
||
|
||
func _on_visibility_changed(): | ||
if visible: | ||
focus_button() |
Oops, something went wrong.