working settings menu
includes audio sliders, fullscreen, disabling gravity change sound
This commit is contained in:
parent
eefda9e2bd
commit
a73b32610e
9 changed files with 197 additions and 4 deletions
|
@ -7,6 +7,7 @@ script/source = "extends Node3D
|
|||
|
||||
var start_menu = preload(\"res://menus/main/start_menu.tscn\")
|
||||
var save_file_manager = preload(\"res://menus/main/save_file_manager.tscn\")
|
||||
var settings_menu = preload(\"res://menus/main/settings_menu.tscn\")
|
||||
|
||||
func _ready() -> void:
|
||||
var sm = start_menu.instantiate()
|
||||
|
@ -20,6 +21,8 @@ func start() -> void:
|
|||
rotate_cube(90)
|
||||
|
||||
func settings() -> void:
|
||||
var sm = settings_menu.instantiate()
|
||||
$Menus/Panel2.change_menu(sm)
|
||||
rotate_cube(90)
|
||||
|
||||
func rotate_cube(degrees: int) -> void:
|
||||
|
|
96
menus/main/settings_menu.tscn
Normal file
96
menus/main/settings_menu.tscn
Normal file
|
@ -0,0 +1,96 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://opwiiusu80nu"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_wbybg"]
|
||||
script/source = "extends Control
|
||||
|
||||
func _ready() -> void:
|
||||
$VBoxContainer/Fullscreen/CheckButton.button_pressed = Settings.fullscreen
|
||||
$VBoxContainer/SoundGravity/CheckButton.button_pressed = Settings.sound_on_gravity_change
|
||||
$VBoxContainer/VolumeMusic/HSlider.value = Settings.volume_music
|
||||
$VBoxContainer/VolumeSounds/HSlider.value = Settings.volume_sounds
|
||||
|
||||
func _on_fullscreen_check_button_toggled(toggled_on: bool) -> void:
|
||||
Settings.fullscreen = toggled_on
|
||||
|
||||
func _on_soundgravity_check_button_toggled(toggled_on: bool) -> void:
|
||||
Settings.sound_on_gravity_change = toggled_on
|
||||
|
||||
func _on_volumemusic_h_slider_value_changed(value: float) -> void:
|
||||
Settings.volume_music = int(value)
|
||||
|
||||
func _on_volumesounds_h_slider_value_changed(value: float) -> void:
|
||||
Settings.volume_sounds = int(value)
|
||||
"
|
||||
|
||||
[node name="SettingsMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = SubResource("GDScript_wbybg")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Fullscreen" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Fullscreen"]
|
||||
layout_mode = 2
|
||||
text = "Fullscreen"
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/Fullscreen"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SoundGravity" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/SoundGravity"]
|
||||
layout_mode = 2
|
||||
text = "Play sound on gravity change"
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/SoundGravity"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VolumeMusic" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/VolumeMusic"]
|
||||
layout_mode = 2
|
||||
text = "Music volume"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeMusic"]
|
||||
custom_minimum_size = Vector2(200, 28)
|
||||
layout_mode = 2
|
||||
min_value = -15.0
|
||||
max_value = 15.0
|
||||
|
||||
[node name="VolumeSounds" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/VolumeSounds"]
|
||||
layout_mode = 2
|
||||
text = "Sound volume"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeSounds"]
|
||||
custom_minimum_size = Vector2(200, 28)
|
||||
layout_mode = 2
|
||||
min_value = -15.0
|
||||
max_value = 15.0
|
||||
|
||||
[connection signal="toggled" from="VBoxContainer/Fullscreen/CheckButton" to="." method="_on_fullscreen_check_button_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/SoundGravity/CheckButton" to="." method="_on_soundgravity_check_button_toggled"]
|
||||
[connection signal="value_changed" from="VBoxContainer/VolumeMusic/HSlider" to="." method="_on_volumemusic_h_slider_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/VolumeSounds/HSlider" to="." method="_on_volumesounds_h_slider_value_changed"]
|
Loading…
Add table
Add a link
Reference in a new issue