alsatest
This commit is contained in:
parent
300a271d8e
commit
ae84fc7b67
10 changed files with 153 additions and 1 deletions
29
levels/ui/alsatest.gd
Normal file
29
levels/ui/alsatest.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends Control
|
||||
var bgsound := AudioStreamPlayer.new()
|
||||
var fl := AudioStreamPlayer2D.new()
|
||||
var fr := AudioStreamPlayer2D.new()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
add_child(bgsound)
|
||||
add_child(fl)
|
||||
add_child(fr)
|
||||
bgsound.stream = load(Global.musictracks[21])
|
||||
fl.stream = load("res://sfx/Front_Left.wav")
|
||||
fr.stream = load("res://sfx/Front_Right.wav")
|
||||
bgsound.set_volume_db(-10)
|
||||
fl.set_volume_db(10)
|
||||
fr.set_volume_db(10)
|
||||
bgsound.play(0)
|
||||
|
||||
func _input(event):
|
||||
# Mouse in viewport coordinates.
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
get_tree().change_scene_to_file("res://levels/ui/soundtest.tscn")
|
||||
elif Input.is_action_just_pressed("ui_left"):
|
||||
fl.play(0)
|
||||
elif Input.is_action_just_pressed("ui_right"):
|
||||
fr.play(0)
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
57
levels/ui/alsatest.tscn
Normal file
57
levels/ui/alsatest.tscn
Normal file
|
@ -0,0 +1,57 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bivi1ncwnunrp"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/ui/alsatest.gd" id="1_hqlyt"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxa27c7gnivwx" path="res://backgounds/night-sky-at-ceres.jpg" id="2_ribwb"]
|
||||
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="3_2tyrv"]
|
||||
[ext_resource type="Script" path="res://Game name.gd" id="3_iuwjb"]
|
||||
[ext_resource type="Script" path="res://start.gd" id="4_cp7hy"]
|
||||
[ext_resource type="Script" path="res://exit.gd" id="5_aogyx"]
|
||||
|
||||
[node name="Alsatest" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_hqlyt")
|
||||
|
||||
[node name="Night Sky" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
texture = ExtResource("2_ribwb")
|
||||
|
||||
[node name="Game name" type="Label" parent="."]
|
||||
offset_left = 35.0
|
||||
offset_top = 308.0
|
||||
offset_right = 1241.0
|
||||
offset_bottom = 438.0
|
||||
theme_override_font_sizes/font_size = 95
|
||||
text = "Advanced Linein
|
||||
Sound Architects"
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("3_iuwjb")
|
||||
|
||||
[node name="start" type="Label" parent="."]
|
||||
offset_left = 46.0
|
||||
offset_top = 92.0
|
||||
offset_right = 1224.0
|
||||
offset_bottom = 147.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "ALSA_TEST_SPK"
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("4_cp7hy")
|
||||
|
||||
[node name="exit" type="Label" parent="."]
|
||||
offset_left = 47.0
|
||||
offset_top = 602.0
|
||||
offset_right = 1208.0
|
||||
offset_bottom = 657.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "TEXT_EXIT"
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("5_aogyx")
|
||||
|
||||
[node name="Bottomhud" parent="." instance=ExtResource("3_2tyrv")]
|
||||
layout_mode = 1
|
|
@ -1,7 +1,11 @@
|
|||
extends Control
|
||||
var alsatest
|
||||
func _ready():
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
alsatest = $VBoxContainer/ALSA
|
||||
$"VBoxContainer/Music".grab_focus()
|
||||
if OS.get_name() == "Linux":
|
||||
alsatest.disabled = false
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
|
@ -38,3 +42,7 @@ func _on_music_pressed():
|
|||
|
||||
func _on_sfx_pressed():
|
||||
get_tree().change_scene_to_file("res://levels/ui/sfxtest.tscn")
|
||||
|
||||
|
||||
func _on_alsa_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://levels/ui/alsatest.tscn")
|
||||
|
|
|
@ -66,6 +66,13 @@ theme_override_font_sizes/font_size = 80
|
|||
theme_override_styles/focus = SubResource("StyleBoxFlat_4arqn")
|
||||
text = "BUTTON_SFXTEST"
|
||||
|
||||
[node name="ALSA" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 80
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_4arqn")
|
||||
disabled = true
|
||||
text = "ALSA_TEST_MENU"
|
||||
|
||||
[node name="Back" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 80
|
||||
|
@ -74,4 +81,5 @@ text = "BUTTON_RETURN"
|
|||
|
||||
[connection signal="pressed" from="VBoxContainer/Music" to="." method="_on_music_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Sfx" to="." method="_on_sfx_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ALSA" to="." method="_on_alsa_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue