-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCfgHandler.gd
More file actions
36 lines (28 loc) · 985 Bytes
/
CfgHandler.gd
File metadata and controls
36 lines (28 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
extends Node
var config = ConfigFile.new()
const config_filepath = "user://config.ini"
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if (!FileAccess.file_exists(config_filepath)):
config.set_value("output", "recfps", 30)
config.set_value("gui", "showrectimer", false)
config.save(config_filepath)
else:
config.load(config_filepath)
pass # Replace with function body.
func save_cfg():
config.save(config_filepath)
func save_output_setting(key: String, value):
config.set_value("output", key, value)
func load_output_settings():
var out_settings = {}
for key in config.get_section_keys("output"):
out_settings[key] = config.get_value("output", key)
return out_settings
func save_gui_setting(key: String, value):
config.set_value("gui", key, value)
func load_gui_settings():
var out_settings = {}
for key in config.get_section_keys("gui"):
out_settings[key] = config.get_value("gui", key)
return out_settings