extends Node

func volume_value_changed(value):
	var db_value = lerp(-80, 0, pow(value / 100.0, 0.5))
	AudioServer.set_bus_volume_db(0, db_value)

func music_value_changed(value):
	var music_index: int = AudioServer.get_bus_index("Music")
	var db_value = lerp(-80, 0, pow(value / 100.0, 0.5))
	AudioServer.set_bus_volume_db(music_index, db_value)

func sfx_value_changed(value):
	var sfx_index: int = AudioServer.get_bus_index("SFX")
	var db_value = lerp(-80, 0, pow(value / 100.0, 0.5))
	AudioServer.set_bus_volume_db(sfx_index, db_value)

func mute_toggled(value):
	AudioServer.set_bus_mute(0,value)

func resolution_item_selected(value):
	match value:
		0:
			DisplayServer.window_set_size(Vector2i(1920,1080))
		1:
			DisplayServer.window_set_size(Vector2i(1600,900))
		2:
			DisplayServer.window_set_size(Vector2i(1280,720))
		3:
			DisplayServer.window_set_size(Vector2i(640,360))

func toggle_fullscreen(value):
	if value:
		DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN, 0)
	else:
		DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED, 0)
		
		
