lots of progress

This commit is contained in:
Tabby 2026-06-01 12:21:11 +10:00
parent e24568da25
commit 733a8fd6c0
7 changed files with 240 additions and 51 deletions

16
Data.gd
View file

@ -3,6 +3,13 @@ extends Node
@export var save : SleepyclockSave
@export var path : String = "user://sleepyclockSave.tres"
enum Position {
Bottom,
Right,
Top,
Left,
}
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print("looking for save...")
@ -24,6 +31,13 @@ func _process(delta: float) -> void:
# returns true if new data created and saved
func new_data() -> bool:
save = SleepyclockSave.new()
var screen_size : Vector2i = DisplayServer.screen_get_size() # get current screen size
if screen_size.x > 2560 or screen_size.y > 1440:
save.size = 20
if OS.has_feature("macos"):
save.position = Data.Position.Right
var error = ResourceSaver.save(save,path)
if error != OK:
print(error)
@ -35,7 +49,7 @@ func load_data() -> bool:
if not FileAccess.file_exists(path):
return false
else:
save = ResourceLoader.load(path)
save = ResourceLoader.load(path,"",ResourceLoader.CACHE_MODE_IGNORE)
return true
# returns true if data successfully saved