extends Control

@onready var shader_precompiler: Node = $ShaderPrecompiler


func _ready() -> void:
	if SettingsManager.get_setting(&"game", &"has_compiled_shaders"):
		shader_precompiler.canvas_layer.hide()
		_on_shader_precompiler_finished_compilation()
	else:
		await get_tree().create_timer(1.0).timeout
		shader_precompiler.precompile_shaders()


func _on_shader_precompiler_finished_compilation() -> void:
	SettingsManager.set_setting(&"game", &"has_compiled_shaders", true)

	SceneFader.color_rect.color.a = 1.0
	SceneFader.load_to_path(GameGlobals.MAIN_MENU_PATH)
