extends Node


var config = ConfigFile.new()
const SETTINGS_FILE_PATH = "user://settings.ini"

signal ControlSettingsChanged

func _ready():
	if !FileAccess.file_exists(SETTINGS_FILE_PATH):
		config.set_value("control","camera_sensitivity", 0.5)
		config.set_value("control","invert_mouse_y", true)
		
		config.save(SETTINGS_FILE_PATH)
	else:
		config.load(SETTINGS_FILE_PATH)
		

func save_control_setting(key: String, value):
	config.set_value("control", key, value)
	config.save(SETTINGS_FILE_PATH)

func load_control_settings():
	var control_settings = {}
	for key in config.get_section_keys("control"):
		control_settings[key] = config.get_value("control", key)
	return control_settings
	
	
