extends Node
var video_settings
var audio_settings
func _ready():
	video_settings = ConfigFileHandler.load_video_settings()
	audio_settings = ConfigFileHandler.load_audio_settings()
	change_fullscreen(video_settings.fullscreen)
	change_master_volume()
	change_music_volume()
	change_sfx_volume()
	mute_master(audio_settings.master_volume_mute)
	mute_music(audio_settings.music_volume_mute)
	mute_sfx(audio_settings.sfx_volume_mute)
func change_fullscreen(fullscreen: bool):
	if fullscreen:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
	else:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
func change_master_volume():
	audio_settings = ConfigFileHandler.load_audio_settings()
	AudioServer.set_bus_volume_db(0, log(audio_settings.master_volume)*20)
func change_music_volume():
	audio_settings = ConfigFileHandler.load_audio_settings()
	AudioServer.set_bus_volume_db(1, log(audio_settings.music_volume)*20)
func change_sfx_volume():
	audio_settings = ConfigFileHandler.load_audio_settings()
	AudioServer.set_bus_volume_db(2, log(audio_settings.sfx_volume)*20)
func mute_master(master_mute : bool):
	AudioServer.set_bus_mute(0, master_mute)
func mute_music(music_mute : bool):
	AudioServer.set_bus_mute(1, music_mute)
func mute_sfx(sfx_mute : bool):
	AudioServer.set_bus_mute(2, sfx_mute)
