volume slider

This commit is contained in:
zoe 2021-12-04 18:37:24 +01:00
parent 7ab759a777
commit cf3e10a880
25 changed files with 191 additions and 10 deletions

View File

@ -1,3 +1,3 @@
source_md5="34ec780a689ee26dcc3dbb0284b5d62e"
dest_md5="296cd9dd4663fd6ef7497891143e8b8a"
source_md5="d2c223adbb6b13c83613990e6f18bd10"
dest_md5="ca793b2f3d46e3424730440450e8dc84"

View File

@ -1,3 +1,3 @@
source_md5="34ec780a689ee26dcc3dbb0284b5d62e"
dest_md5="296cd9dd4663fd6ef7497891143e8b8a"
source_md5="8ec458c19f00fc8b04b015e1adccd50d"
dest_md5="27eaa723c22833d1e7fbbc721dbf2b0a"

View File

@ -0,0 +1,3 @@
source_md5="c632c103f99ec61a551cb31ec0143c4f"
dest_md5="91acb9457da06ce66a7ab0f91bb93138"

View File

@ -0,0 +1,3 @@
source_md5="4b9be3cb1201ae5050099ba978cccc0f"
dest_md5="0b4c8626ccef55f639eb538c545d1f74"

View File

@ -0,0 +1,3 @@
source_md5="24cecb639e4518c4925b3159299a7470"
dest_md5="b207456189caca2e8832f0fefa6e0b8b"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 125 B

BIN
Aseprite/music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

35
Aseprite/music.png.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/music.png-d125e661be6c28155c2d451004121da2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Aseprite/music.png"
dest_files=[ "res://.import/music.png-d125e661be6c28155c2d451004121da2.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
Aseprite/music_hover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/music_hover.png-c315a7c29fc993518e6ed26b897dad29.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Aseprite/music_hover.png"
dest_files=[ "res://.import/music_hover.png-c315a7c29fc993518e6ed26b897dad29.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

3
Menu/Theme.tres Normal file
View File

@ -0,0 +1,3 @@
[gd_resource type="Theme" format=2]
[resource]

9
Menu/Volume.gd Normal file
View File

@ -0,0 +1,9 @@
extends VSlider
export var bus_channel = "Master"
func _ready():
value = db2linear(AudioServer.get_bus_volume_db(AudioServer.get_bus_index(bus_channel)))
func _on_MusicVolume_value_changed(value: float) -> void:
AudioServer.set_bus_volume_db(AudioServer.get_bus_index(bus_channel), linear2db(value))

8
Music/Music.tscn Normal file
View File

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Music/untitled_plant_game.ogg" type="AudioStream" id=1]
[node name="Music" type="AudioStreamPlayer"]
stream = ExtResource( 1 )
autoplay = true
bus = "Music"

Binary file not shown.

View File

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/untitled_plant_game.ogg-31760f108d0f02d04c8560ca1ea3daf1.oggstr"
[deps]
source_file="res://Music/untitled_plant_game.ogg"
dest_files=[ "res://.import/untitled_plant_game.ogg-31760f108d0f02d04c8560ca1ea3daf1.oggstr" ]
[params]
loop=true
loop_offset=0

View File

@ -1,19 +1,42 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://World/Plant.tscn" type="PackedScene" id=1]
[ext_resource path="res://World/FullscreenButton.gd" type="Script" id=2]
[ext_resource path="res://Aseprite/fullscreen.png" type="Texture" id=3]
[ext_resource path="res://Aseprite/fullscreen_hover.png" type="Texture" id=4]
[ext_resource path="res://Menu/Theme.tres" type="Theme" id=5]
[ext_resource path="res://Menu/Volume.gd" type="Script" id=6]
[ext_resource path="res://Aseprite/music.png" type="Texture" id=7]
[ext_resource path="res://Aseprite/music_hover.png" type="Texture" id=8]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 )
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.94902, 0.988235, 0.878431, 1 )
expand_margin_left = 2.0
expand_margin_right = 2.0
[node name="Main" type="Node2D"]
[node name="Plant" parent="." instance=ExtResource( 1 )]
[node name="FullscreenButton" type="TextureButton" parent="."]
margin_left = 238.0
margin_top = 126.0
[node name="Panel" type="Panel" parent="."]
margin_left = 236.0
margin_top = 2.0
margin_right = 254.0
margin_bottom = 142.0
theme = ExtResource( 5 )
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="FullscreenButton" type="TextureButton" parent="Panel"]
margin_left = 1.0
margin_top = 123.0
margin_right = 17.0
margin_bottom = 139.0
texture_normal = ExtResource( 3 )
texture_hover = ExtResource( 4 )
script = ExtResource( 2 )
@ -21,4 +44,34 @@ __meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="FullscreenButton" to="FullscreenButton" method="_on_FullscreenButton_pressed"]
[node name="MusicVolume" type="VSlider" parent="Panel"]
margin_left = 1.0
margin_top = 1.0
margin_right = 17.0
margin_bottom = 120.0
custom_icons/tick = ExtResource( 7 )
custom_icons/grabber_disabled = ExtResource( 7 )
custom_icons/grabber_highlight = ExtResource( 8 )
custom_icons/grabber = ExtResource( 7 )
custom_styles/slider = SubResource( 2 )
max_value = 1.0
step = 0.1
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
bus_channel = "Music"
[node name="Panel2" type="Panel" parent="."]
margin_left = 130.0
margin_top = 2.0
margin_right = 234.0
margin_bottom = 142.0
theme = ExtResource( 5 )
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Panel/FullscreenButton" to="Panel/FullscreenButton" method="_on_FullscreenButton_pressed"]
[connection signal="value_changed" from="Panel/MusicVolume" to="Panel/MusicVolume" method="_on_MusicVolume_value_changed"]

View File

@ -5,7 +5,7 @@ var pixels_x = []
var active = []
var rng
func _process(delta: float) -> void:
func _process(_delta):
# step()
pass

10
default_bus_layout.tres Normal file
View File

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

View File

@ -14,6 +14,10 @@ config/name="Untitled Plant Game"
run/main_scene="res://World/Main.tscn"
config/icon="res://icon.png"
[autoload]
Music="*res://Music/Music.tscn"
[display]
window/size/width=256