Added inital logic for loading game settings
This commit is contained in:
parent
45a3759417
commit
0c881af6fb
30
src/Save/save_settings.gd
Normal file
30
src/Save/save_settings.gd
Normal file
@ -0,0 +1,30 @@
|
||||
extends Node
|
||||
|
||||
const SETTINGS_FILE = "GameSettings.save"
|
||||
|
||||
var game_data: = {}
|
||||
|
||||
func _ready() -> void:
|
||||
load_data()
|
||||
|
||||
func load_data():
|
||||
var file: = File.new()
|
||||
|
||||
if not file.file_exists(SETTINGS_FILE):
|
||||
game_data = {
|
||||
"fullscreen": false,
|
||||
"vsync": false,
|
||||
"particle_effects": true,
|
||||
"master_vol": -10
|
||||
}
|
||||
save_data()
|
||||
|
||||
file.open(SETTINGS_FILE, File.READ)
|
||||
game_data = file.get_var()
|
||||
file.close()
|
||||
|
||||
func save_data():
|
||||
var file: = File.new()
|
||||
file.open(SETTINGS_FILE, File.WRITE)
|
||||
file.store_var(game_data)
|
||||
file.close()
|
Loading…
Reference in New Issue
Block a user