project_teddy/scripts/settings.gd

43 lines
982 B
GDScript3
Raw Normal View History

2023-01-26 12:17:54 -07:00
extends Control
2023-03-17 00:20:54 -06:00
@export var audio_bus_name := "Master"
@onready var _bus := AudioServer.get_bus_index(audio_bus_name)
2023-01-26 12:17:54 -07:00
func _ready():
2023-03-11 14:18:11 -07:00
if get_window().get_mode() == Window.Mode.MODE_FULLSCREEN:
$fullscreenBox.button_pressed = true
2023-01-26 12:17:54 -07:00
func _on_h_slider_ready():
var slider = $h_slider
slider.value = Global.mouseSensitivity
func _process(delta):
pass
func _on_h_slider_value_changed(value):
Global.mouseSensitivity = value
2023-03-17 00:20:54 -06:00
Global.save_data()
2023-01-26 13:23:13 -07:00
func _on_button_pressed():
self.queue_free()
2023-03-11 14:18:11 -07:00
2023-03-17 00:20:54 -06:00
func _on_volume_slider_value_changed(value):
Global.volumeModifer = value
AudioServer.set_bus_volume_db(_bus, linear_to_db(value))
Global.save_data()
2023-05-11 23:53:18 -06:00
2023-03-17 00:20:54 -06:00
func _on_volume_slider_ready():
var slider = $volumeSlider
slider.value = Global.volumeModifer
2023-05-11 23:53:18 -06:00
func _on_fullscreen_box_pressed():
if $fullscreenBox.button_pressed == true:
get_window().set_mode(Window.Mode.MODE_FULLSCREEN)
elif $fullscreenBox.button_pressed == false:
get_window().set_mode(Window.Mode.MODE_WINDOWED)