lots of new features

This commit is contained in:
Tabby 2026-06-01 17:40:48 +10:00
parent 278cddcf22
commit 337c4fbb71
3 changed files with 28 additions and 5 deletions

View file

@ -51,6 +51,10 @@ func setup_window():
background.color = Data.save.background_color
modulate = Color(1,1,1,Data.save.bar_transparency)
if Data.save.progress_style == Data.Styles.Filling or Data.save.progress_style == Data.Styles.Emptying:
bar.fill_mode = bar.FillMode.FILL_LEFT_TO_RIGHT
else:
bar.fill_mode = bar.FillMode.FILL_RIGHT_TO_LEFT
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
@ -97,17 +101,35 @@ func _process(delta: float) -> void:
bar.max_value = Data.save.duration
bar.min_value = 0
bar.value = Data.save.duration - seconds_left
if Data.save.progress_style == Data.Styles.Filling or Data.save.progress_style == Data.Styles.Filling_Reversed:
bar.value = Data.save.duration - seconds_left
else:
bar.value = seconds_left
#print("bar value: " + str(bar.value))
#label.text = Time.get_datetime_string_from_system()
#Time.
#print(current_day)
if (seconds_left <= 3600):
if (seconds_left <= Data.save.warning_time):
bar.modulate = Data.save.warning_color
else:
bar.modulate = Data.save.bar_color
if seconds_left > 82800 and Data.save.flashing:
var effect : float = (sin(seconds_left*3))
modulate = Color(effect,effect,effect,effect)
else:
modulate = Color(1,1,1,Data.save.bar_transparency)
if seconds_left > Data.save.duration + Data.save.before_time and seconds_left < 86400 - Data.save.after_time:
hide()
else:
show()
var time_left_dict : Dictionary = Tools.seconds_to_time(int(seconds_left))
var time_string : String = str(time_left_dict.get("h")) + ":" + str(time_left_dict.get("m")).pad_zeros(2) + ":" + str(time_left_dict.get("s")).pad_zeros(2)
label.text = time_string + " Remaining until sleepytime"
#var screen_size : Vector2i = DisplayServer.screen_get_size()
#DisplayServer.window_set_size(Vector2i(screen_size.x, 10))
#get_window().size = Vector2i(screen_size.x, 10)