Added volume slider

This commit is contained in:
Luke Hubmayer-Werner 2021-01-14 00:11:28 +10:30
parent 1e28a31941
commit 6941965965
5 changed files with 46 additions and 3 deletions

15
default_bus_layout.tres Normal file
View File

@ -0,0 +1,15 @@
[gd_resource type="AudioBusLayout" format=2]
[resource]
bus/1/name = "Music"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = "Master"
bus/2/name = "Hits"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/send = "Master"

View File

@ -22,7 +22,7 @@ shader_param/num_receptors = 8
shader_param/receptor_offset = 0.392699
shader_param/line_color = Color( 0, 0, 1, 1 )
shader_param/dot_color = Color( 0, 0, 1, 1 )
shader_param/shadow_color = Color( 0, 0, 0, 0.568627 )
shader_param/shadow_color = Color( 0, 0, 0, 0.57 )
shader_param/line_thickness = 0.00434783
shader_param/dot_radius = 0.026087
shader_param/shadow_thickness = 0.0173913
@ -79,6 +79,7 @@ __meta__ = {
[node name="music" type="AudioStreamPlayer" parent="."]
volume_db = -6.0
bus = "Music"
[node name="video" type="VideoPlayer" parent="."]
margin_left = -540.0
@ -90,6 +91,7 @@ grow_vertical = 2
rect_pivot_offset = Vector2( 540, 540 )
mouse_filter = 2
volume_db = -80.0
bus = "Music"
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
@ -219,6 +221,29 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Label3" type="Label" parent="InputHandler"]
margin_top = 240.0
margin_right = 133.0
margin_bottom = 254.0
text = "Main Volume"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VolumeSlider" type="HSlider" parent="InputHandler"]
margin_left = 10.0
margin_top = 260.0
margin_right = 250.0
margin_bottom = 276.0
min_value = -70.0
max_value = 0.0
step = 1.0
tick_count = 8
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VsyncButton" type="CheckButton" parent="InputHandler"]
margin_top = 90.0
margin_right = 117.0

View File

@ -58,6 +58,5 @@ singletons_disabled=[ ]
[rendering]
vram_compression/import_etc=true
environment/default_clear_color=Color( 0.16, 0.16, 0.16, 1 )
quality/filters/msaa=1
environment/default_environment="res://default_env.tres"

View File

@ -38,6 +38,7 @@ func _ready():
$VsyncButton.connect("toggled", self, "update_vsync")
$WakelockButton.connect("toggled", self, "update_wakelock")
$FilterSlider.connect("value_changed", self, "update_filter")
$VolumeSlider.connect("value_changed", self, "update_volume")
resize()
func update_vsync(setting: bool):
@ -49,6 +50,9 @@ func update_wakelock(setting: bool):
func update_filter(alpha: float):
GameTheme.screen_filter_min_alpha = alpha
func update_volume(volume: float):
AudioServer.set_bus_volume_db(0, volume)
func print_pressed(col: int):
print("Pressed %d"%col)

View File

@ -181,7 +181,7 @@ func _draw_song_select(center: Vector2) -> Array:
var subsize_n = subsize
var x_p = x
var x_n = x
for i in range(1, len(scales.array)):
for i in range(1, scales.len()):
x_p += subsize_p + spacer_x
x_n += subsize_n + spacer_x
subsize_p = size * scales.value(abs(i-selected_song_delta))