extends Tabs


func _ready():
	find_node("fullscreen").set_pressed(config.get_value("graphics","fullscreen", true))
	find_node("light").set_pressed(config.get_value("graphics","light", false))
	find_node("shadows").set_pressed(config.get_value("graphics","shadows", false))
	find_node("shadows").set_disabled(not find_node("light").is_pressed())

	for resolution in config.RESOLUTIONS:
		find_node("resolution").add_item(str(resolution.x) + " * " + str(resolution.y))

	find_node("resolution").select(config.RESOLUTIONS.find(config.get_value("graphics","resolution", config.RESOLUTIONS[0])))


func apply():
	config.set_value("graphics","resolution",config.RESOLUTIONS[find_node("resolution").get_selected()])
	config.set_value("graphics","fullscreen",find_node("fullscreen").is_pressed())
	config.set_value("graphics","light",find_node("light").is_pressed())
	config.set_value("graphics","shadows",find_node("shadows").is_pressed())


func _on_light_toggled(button_pressed):
	find_node("shadows").set_disabled(not button_pressed)