This repository has been archived on 2022-01-09. You can view files and clone it, but cannot push or open issues/pull-requests.
liblast/Game/GUI.gd

29 lines
547 B
GDScript
Raw Normal View History

2021-06-01 23:53:32 +02:00
extends Control
2021-06-02 23:32:07 +02:00
var settings_filename = "user://settings.save"
2021-06-02 17:00:28 +02:00
var settings = {}
2021-06-01 23:53:32 +02:00
func _ready():
2021-06-02 17:00:28 +02:00
if has_settings():
load_settings()
2021-06-02 23:32:07 +02:00
print(settings)
2021-06-02 17:00:28 +02:00
func has_settings():
2021-06-02 23:32:07 +02:00
var filecheck = File.new()
return filecheck.file_exists(settings_filename)
2021-06-02 17:00:28 +02:00
func save_settings():
var file = File.new()
2021-06-02 23:32:07 +02:00
file.open(settings_filename, File.WRITE)
2021-06-02 17:00:28 +02:00
file.store_var(settings)
file.close()
func load_settings():
var file = File.new()
2021-06-02 23:32:07 +02:00
file.open(settings_filename, File.READ)
2021-06-02 17:00:28 +02:00
settings = file.get_var()
file.close()
2021-06-01 23:53:32 +02:00
func quit_game():
get_tree().quit()