@tool
class_name Config
extends Resource


@export var music_volume: float = 0
@export var sfx_volume: float = 0
@export var fullscreen: bool = false
@export var vsync: bool = true


func save() -> Error:
	return ResourceSaver.save(self, "user://config.tres")


static func exists() -> bool:
	return ResourceLoader.exists("user://config.tres")


static func load() -> Save:
	if exists():
		var config_data = ResourceLoader.load("user://config.tres")
		if config_data is Config:
			return config_data
	return null
