Improved volume slider values

This commit is contained in:
2024-05-14 12:28:05 +01:00
parent 11539a2a42
commit 6b3fc2e00e
5 changed files with 31 additions and 27 deletions

View File

@@ -9,16 +9,16 @@
[ext_resource type="Script" path="res://ScrollText.gd" id="6_y6ajf"] [ext_resource type="Script" path="res://ScrollText.gd" id="6_y6ajf"]
[ext_resource type="Texture2D" uid="uid://c6nwmsoi1gjvv" path="res://FadeTex.png" id="7_wpqjt"] [ext_resource type="Texture2D" uid="uid://c6nwmsoi1gjvv" path="res://FadeTex.png" id="7_wpqjt"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u467p"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_31xkm"]
shader = ExtResource("3_u76hk") shader = ExtResource("3_u76hk")
shader_parameter/rect_global_position = Vector2(0, 0.0998668) shader_parameter/rect_global_position = Vector2(0, 0)
shader_parameter/rect_size = Vector2(640, 25) shader_parameter/rect_size = Vector2(160, 25)
shader_parameter/ColourTexture = ExtResource("4_lxs2b") shader_parameter/ColourTexture = ExtResource("4_lxs2b")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fxm16"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_fxm16"]
shader = ExtResource("6_t71ub") shader = ExtResource("6_t71ub")
shader_parameter/rect_global_position = Vector2(nan, nan) shader_parameter/rect_global_position = Vector2(0, 0)
shader_parameter/rect_size = Vector2(nan, nan) shader_parameter/rect_size = Vector2(0, 0)
shader_parameter/ColourTexture = ExtResource("7_wpqjt") shader_parameter/ColourTexture = ExtResource("7_wpqjt")
[node name="GameOver" type="Node2D"] [node name="GameOver" type="Node2D"]
@@ -35,7 +35,7 @@ size_flags_vertical = 3
theme = ExtResource("3_km2fx") theme = ExtResource("3_km2fx")
[node name="GameOver" type="Label" parent="VBoxContainer"] [node name="GameOver" type="Label" parent="VBoxContainer"]
material = SubResource("ShaderMaterial_u467p") material = SubResource("ShaderMaterial_31xkm")
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_km2fx") theme = ExtResource("3_km2fx")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -98,7 +98,7 @@ script = ExtResource("6_y6ajf")
disable_3d = true disable_3d = true
transparent_bg = true transparent_bg = true
handle_input_locally = false handle_input_locally = false
size = Vector2i(211, 71) size = Vector2i(2, 2)
render_target_update_mode = 4 render_target_update_mode = 4
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/HBoxContainer2/SubViewportContainer/SubViewport"] [node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/HBoxContainer2/SubViewportContainer/SubViewport"]

View File

@@ -23,21 +23,21 @@ point_count = 2
[sub_resource type="Gradient" id="Gradient_431mb"] [sub_resource type="Gradient" id="Gradient_431mb"]
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1) colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2oo2w"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_24rds"]
shader = ExtResource("3_eo4f3") shader = ExtResource("3_eo4f3")
shader_parameter/rect_global_position = Vector2(0.19822, 0.0732357) shader_parameter/rect_global_position = Vector2(122.5, 27.5)
shader_parameter/rect_size = Vector2(150, 25) shader_parameter/rect_size = Vector2(150, 25)
shader_parameter/ColourTexture = ExtResource("4_v8i0c") shader_parameter/ColourTexture = ExtResource("4_v8i0c")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fb3e4"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_jnx1u"]
shader = ExtResource("3_eo4f3") shader = ExtResource("3_eo4f3")
shader_parameter/rect_global_position = Vector2(0.161003, 0.111851) shader_parameter/rect_global_position = Vector2(99.5, 42)
shader_parameter/rect_size = Vector2(242, 25) shader_parameter/rect_size = Vector2(242, 25)
shader_parameter/ColourTexture = ExtResource("4_v8i0c") shader_parameter/ColourTexture = ExtResource("4_v8i0c")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_s1jgx"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_s1jgx"]
shader = ExtResource("11_p7bee") shader = ExtResource("11_p7bee")
shader_parameter/rect_global_position = Vector2(0.332524, 0.210386) shader_parameter/rect_global_position = Vector2(205.5, 79)
shader_parameter/rect_size = Vector2(2.369, 3.688) shader_parameter/rect_size = Vector2(2.369, 3.688)
shader_parameter/ColourTexture = ExtResource("12_8ixec") shader_parameter/ColourTexture = ExtResource("12_8ixec")
@@ -79,7 +79,7 @@ size_flags_horizontal = 3
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
[node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"] [node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"]
material = SubResource("ShaderMaterial_2oo2w") material = SubResource("ShaderMaterial_24rds")
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -100,7 +100,7 @@ size_flags_horizontal = 3
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
[node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"] [node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"]
material = SubResource("ShaderMaterial_fb3e4") material = SubResource("ShaderMaterial_jnx1u")
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"

View File

@@ -12,18 +12,16 @@ func _ready() -> void:
ToggleNode.button_pressed = Global.relative_mouse ToggleNode.button_pressed = Global.relative_mouse
AbsoluteNode.theme_type_variation = "" if Global.relative_mouse else "GlowLabel" AbsoluteNode.theme_type_variation = "" if Global.relative_mouse else "GlowLabel"
RelativeNode.theme_type_variation = "GlowLabel" if Global.relative_mouse else "" RelativeNode.theme_type_variation = "GlowLabel" if Global.relative_mouse else ""
MusicNode.set_value_no_signal(Global.music_volume) MusicNode.set_value_no_signal(db_to_linear(Global.music_volume))
EffectsNode.set_value_no_signal(Global.effects_volume) EffectsNode.set_value_no_signal(db_to_linear(Global.effects_volume))
func _on_exit_pressed() -> void: func _on_exit_pressed() -> void:
get_tree().change_scene_to_file("res://Intro.tscn") get_tree().change_scene_to_file("res://Intro.tscn")
func _on_music_volume_drag_ended(value_changed: bool) -> void:
Global.music_volume = MusicNode.value
func _on_effects_volume_drag_ended(value_changed: bool) -> void: func _on_effects_volume_drag_ended(value_changed: bool) -> void:
Global.effects_volume = EffectsNode.value Global.effects_volume = linear_to_db(EffectsNode.value)
$Boink.play() $Boink.play()
@@ -48,3 +46,7 @@ func _on_relative_pressed() -> void:
ToggleNode.button_pressed = true ToggleNode.button_pressed = true
AbsoluteNode.theme_type_variation = "" if Global.relative_mouse else "GlowLabel" AbsoluteNode.theme_type_variation = "" if Global.relative_mouse else "GlowLabel"
RelativeNode.theme_type_variation = "GlowLabel" if Global.relative_mouse else "" RelativeNode.theme_type_variation = "GlowLabel" if Global.relative_mouse else ""
func _on_music_value_changed(value: float) -> void:
Global.music_volume = linear_to_db(MusicNode.value)

View File

@@ -97,9 +97,10 @@ vertical_alignment = 1
[node name="Music" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"] [node name="Music" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"]
layout_mode = 2 layout_mode = 2
min_value = -80.0 max_value = 1.0
max_value = 0.0 step = 0.1
tick_count = 10 tick_count = 11
ticks_on_borders = true
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/HBoxContainer/RightPanel"] [node name="VSeparator2" type="VSeparator" parent="VBoxContainer/HBoxContainer/RightPanel"]
custom_minimum_size = Vector2(0, 8) custom_minimum_size = Vector2(0, 8)
@@ -115,9 +116,10 @@ vertical_alignment = 1
[node name="Effects" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"] [node name="Effects" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"]
layout_mode = 2 layout_mode = 2
min_value = -80.0 max_value = 1.0
max_value = 0.0 step = 0.1
tick_count = 10 tick_count = 11
ticks_on_borders = true
[node name="RightGutter" type="HSeparator" parent="VBoxContainer/HBoxContainer"] [node name="RightGutter" type="HSeparator" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
@@ -150,7 +152,7 @@ bus = &"Effects"
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Absolute" to="." method="_on_absolute_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Absolute" to="." method="_on_absolute_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Toggle" to="." method="_on_toggle_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Toggle" to="." method="_on_toggle_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Relative" to="." method="_on_relative_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Relative" to="." method="_on_relative_pressed"]
[connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Music" to="." method="_on_music_volume_drag_ended"] [connection signal="value_changed" from="VBoxContainer/HBoxContainer/RightPanel/Music" to="." method="_on_music_value_changed"]
[connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Effects" to="." method="_on_effects_volume_drag_ended"] [connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Effects" to="." method="_on_effects_volume_drag_ended"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/ResetTimes" to="." method="_on_reset_times_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/ResetTimes" to="." method="_on_reset_times_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Exit" to="." method="_on_exit_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/Exit" to="." method="_on_exit_pressed"]

View File

@@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="Dunkanoid" config/name="Dunkanoid"
config/version="1.0.3" config/version="1.0.4"
run/main_scene="res://Intro.tscn" run/main_scene="res://Intro.tscn"
config/features=PackedStringArray("4.2", "Forward Plus") config/features=PackedStringArray("4.2", "Forward Plus")
run/max_fps=30 run/max_fps=30