mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
Slider fine
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
var master_bus
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
$VBoxContainer/Start.grab_focus() # Replace with function body.
|
$VBoxContainer/Start.grab_focus() # Replace with function body.
|
||||||
|
master_bus = AudioServer.get_bus_index("Master")
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
@@ -33,3 +35,12 @@ func _on_full_screen_pressed():
|
|||||||
if DisplayServer.window_get_mode() != DisplayServer.WINDOW_MODE_WINDOWED:
|
if DisplayServer.window_get_mode() != DisplayServer.WINDOW_MODE_WINDOWED:
|
||||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_vol_slider_value_changed(value):
|
||||||
|
AudioServer.set_bus_volume_db(master_bus, value)
|
||||||
|
|
||||||
|
if value == -30:
|
||||||
|
AudioServer.set_bus_mute(master_bus,true)
|
||||||
|
else:
|
||||||
|
AudioServer.set_bus_mute(master_bus, false)
|
||||||
|
|||||||
0
menu/VolSlider.gd
Normal file
0
menu/VolSlider.gd
Normal file
@@ -1,7 +1,6 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://bsmsdlf5jiukx"]
|
[gd_scene load_steps=3 format=3 uid="uid://bsmsdlf5jiukx"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://menu/MainMenu.gd" id="1_hyw8p"]
|
[ext_resource type="Script" path="res://menu/MainMenu.gd" id="1_hyw8p"]
|
||||||
[ext_resource type="Script" path="res://menu/VolSlider.gd" id="2_h85ei"]
|
|
||||||
[ext_resource type="AudioStream" uid="uid://bmawra1dgi812" path="res://Assets/Sounds/_MUSIC_/MenuGameJamLoop.wav" id="3_ktf88"]
|
[ext_resource type="AudioStream" uid="uid://bmawra1dgi812" path="res://Assets/Sounds/_MUSIC_/MenuGameJamLoop.wav" id="3_ktf88"]
|
||||||
|
|
||||||
[node name="MainMenu" type="Control"]
|
[node name="MainMenu" type="Control"]
|
||||||
@@ -14,6 +13,7 @@ grow_vertical = 2
|
|||||||
script = ExtResource("1_hyw8p")
|
script = ExtResource("1_hyw8p")
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
@@ -22,6 +22,7 @@ grow_vertical = 2
|
|||||||
color = Color(0.513726, 0.403922, 0.27451, 1)
|
color = Color(0.513726, 0.403922, 0.27451, 1)
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@@ -35,42 +36,30 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="Start" type="Button" parent="VBoxContainer"]
|
[node name="Start" type="Button" parent="VBoxContainer"]
|
||||||
offset_right = 87.0
|
layout_mode = 2
|
||||||
offset_bottom = 31.0
|
|
||||||
text = "Start
|
text = "Start
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="Tutorial" type="Button" parent="VBoxContainer"]
|
[node name="Tutorial" type="Button" parent="VBoxContainer"]
|
||||||
offset_top = 35.0
|
layout_mode = 2
|
||||||
offset_right = 87.0
|
|
||||||
offset_bottom = 66.0
|
|
||||||
text = "Tutorial
|
text = "Tutorial
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="Settings" type="Button" parent="VBoxContainer"]
|
[node name="Settings" type="Button" parent="VBoxContainer"]
|
||||||
offset_top = 70.0
|
layout_mode = 2
|
||||||
offset_right = 87.0
|
|
||||||
offset_bottom = 101.0
|
|
||||||
text = "Volume:"
|
text = "Volume:"
|
||||||
|
|
||||||
[node name="VolSlider" type="HSlider" parent="VBoxContainer"]
|
[node name="VolSlider" type="HSlider" parent="VBoxContainer"]
|
||||||
offset_top = 105.0
|
layout_mode = 2
|
||||||
offset_right = 87.0
|
|
||||||
offset_bottom = 121.0
|
|
||||||
min_value = -30.0
|
min_value = -30.0
|
||||||
max_value = 0.0
|
max_value = 0.0
|
||||||
script = ExtResource("2_h85ei")
|
|
||||||
|
|
||||||
[node name="Quit" type="Button" parent="VBoxContainer"]
|
[node name="Quit" type="Button" parent="VBoxContainer"]
|
||||||
offset_top = 125.0
|
layout_mode = 2
|
||||||
offset_right = 87.0
|
|
||||||
offset_bottom = 156.0
|
|
||||||
text = "Quit"
|
text = "Quit"
|
||||||
|
|
||||||
[node name="FullScreen" type="Button" parent="VBoxContainer"]
|
[node name="FullScreen" type="Button" parent="VBoxContainer"]
|
||||||
offset_top = 160.0
|
layout_mode = 2
|
||||||
offset_right = 87.0
|
|
||||||
offset_bottom = 191.0
|
|
||||||
text = "Fullscreen"
|
text = "Fullscreen"
|
||||||
|
|
||||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
@@ -80,6 +69,6 @@ autoplay = true
|
|||||||
[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"]
|
[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"]
|
||||||
[connection signal="pressed" from="VBoxContainer/Tutorial" to="." method="_on_tutorial_pressed"]
|
[connection signal="pressed" from="VBoxContainer/Tutorial" to="." method="_on_tutorial_pressed"]
|
||||||
[connection signal="pressed" from="VBoxContainer/Settings" to="." method="_on_settings_pressed"]
|
[connection signal="pressed" from="VBoxContainer/Settings" to="." method="_on_settings_pressed"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/VolSlider" to="VBoxContainer/VolSlider" method="_on_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/VolSlider" to="." method="_on_vol_slider_value_changed"]
|
||||||
[connection signal="pressed" from="VBoxContainer/Quit" to="." method="_on_quit_pressed"]
|
[connection signal="pressed" from="VBoxContainer/Quit" to="." method="_on_quit_pressed"]
|
||||||
[connection signal="pressed" from="VBoxContainer/FullScreen" to="." method="_on_full_screen_pressed"]
|
[connection signal="pressed" from="VBoxContainer/FullScreen" to="." method="_on_full_screen_pressed"]
|
||||||
|
|||||||
Reference in New Issue
Block a user