lots of progress
This commit is contained in:
parent
e24568da25
commit
733a8fd6c0
7 changed files with 240 additions and 51 deletions
16
Data.gd
16
Data.gd
|
|
@ -3,6 +3,13 @@ extends Node
|
||||||
@export var save : SleepyclockSave
|
@export var save : SleepyclockSave
|
||||||
@export var path : String = "user://sleepyclockSave.tres"
|
@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.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
print("looking for save...")
|
print("looking for save...")
|
||||||
|
|
@ -24,6 +31,13 @@ func _process(delta: float) -> void:
|
||||||
# returns true if new data created and saved
|
# returns true if new data created and saved
|
||||||
func new_data() -> bool:
|
func new_data() -> bool:
|
||||||
save = SleepyclockSave.new()
|
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)
|
var error = ResourceSaver.save(save,path)
|
||||||
if error != OK:
|
if error != OK:
|
||||||
print(error)
|
print(error)
|
||||||
|
|
@ -35,7 +49,7 @@ func load_data() -> bool:
|
||||||
if not FileAccess.file_exists(path):
|
if not FileAccess.file_exists(path):
|
||||||
return false
|
return false
|
||||||
else:
|
else:
|
||||||
save = ResourceLoader.load(path)
|
save = ResourceLoader.load(path,"",ResourceLoader.CACHE_MODE_IGNORE)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
# returns true if data successfully saved
|
# returns true if data successfully saved
|
||||||
|
|
|
||||||
BIN
Logo/tiny.png
Normal file
BIN
Logo/tiny.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 472 B |
40
Logo/tiny.png.import
Normal file
40
Logo/tiny.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dbrin3qlfjdas"
|
||||||
|
path="res://.godot/imported/tiny.png-7075772b29e1a77872ae6087fda4f47f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Logo/tiny.png"
|
||||||
|
dest_files=["res://.godot/imported/tiny.png-7075772b29e1a77872ae6087fda4f47f.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
50
clock.gd
50
clock.gd
|
|
@ -1,20 +1,20 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
var taskbar_height : int = 50
|
var taskbar_height : int = 50
|
||||||
@export var bar_size : int = 10
|
#@export var bar_size : int = 10
|
||||||
@export var bar: TextureProgressBar
|
@export var bar: TextureProgressBar
|
||||||
@export var label: Label
|
@export var label: Label
|
||||||
@export var options_window: Window
|
@export var options_window: Window
|
||||||
|
|
||||||
|
#
|
||||||
@export var bar_position : Position
|
#@export var bar_position : Position
|
||||||
|
#
|
||||||
enum Position {
|
#enum Position {
|
||||||
Bottom,
|
#Bottom,
|
||||||
Right,
|
#Right,
|
||||||
Top,
|
#Top,
|
||||||
Left,
|
#Left,
|
||||||
}
|
#}
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
|
@ -26,26 +26,26 @@ func setup_window():
|
||||||
var screen_size : Vector2i = DisplayServer.screen_get_size() # get current screen size
|
var screen_size : Vector2i = DisplayServer.screen_get_size() # get current screen size
|
||||||
var screen_pos : Vector2i = DisplayServer.screen_get_position(DisplayServer.SCREEN_OF_MAIN_WINDOW) # get the posiiton of the window on the virtual display
|
var screen_pos : Vector2i = DisplayServer.screen_get_position(DisplayServer.SCREEN_OF_MAIN_WINDOW) # get the posiiton of the window on the virtual display
|
||||||
get_window().min_size = Vector2i(1,1) # weird godot bug where the min screen size is 64x64 unless set in code
|
get_window().min_size = Vector2i(1,1) # weird godot bug where the min screen size is 64x64 unless set in code
|
||||||
if bar_position == Position.Bottom:
|
if Data.save.position == Data.Position.Bottom:
|
||||||
if screen_size.x > 2560:
|
|
||||||
bar_size = 20
|
|
||||||
|
|
||||||
get_window().size = Vector2i(screen_size.x, bar_size) # set window size to be 10 high and screen width wide
|
|
||||||
size = Vector2i(screen_size.x, bar_size)
|
get_window().size = Vector2i(screen_size.x, Data.save.size) # set window size to be 10 high and screen width wide
|
||||||
DisplayServer.window_set_position(screen_pos + Vector2i(0,screen_size.y-bar_size-taskbar_height)) # set position of window to be just above the taskbar
|
size = Vector2i(screen_size.x, Data.save.size)
|
||||||
|
DisplayServer.window_set_position(screen_pos + Vector2i(0,screen_size.y-Data.save.size-taskbar_height)) # set position of window to be just above the taskbar
|
||||||
position.y = 0 # set position of bar to be where it should be (moves when we change the window size)
|
position.y = 0 # set position of bar to be where it should be (moves when we change the window size)
|
||||||
label.label_settings.font_size = (bar_size/10)*10
|
position.x = 0
|
||||||
if bar_position == Position.Right:
|
rotation_degrees = 0
|
||||||
if screen_size.y > 1440:
|
label.label_settings.font_size = (float(Data.save.size)/10)*10
|
||||||
bar_size = 20
|
if Data.save.position == Data.Position.Right:
|
||||||
|
|
||||||
get_window().size = Vector2i(bar_size, screen_size.y) # set window size to be 10 high and screen width wide
|
|
||||||
|
get_window().size = Vector2i(Data.save.size, screen_size.y) # set window size to be 10 high and screen width wide
|
||||||
size.x = screen_size.y - taskbar_height
|
size.x = screen_size.y - taskbar_height
|
||||||
size.y = bar_size
|
size.y = Data.save.size
|
||||||
label.label_settings.font_size = (bar_size/10)*10
|
label.label_settings.font_size = (float(Data.save.size)/10)*10
|
||||||
DisplayServer.window_set_position(screen_pos + Vector2i(screen_size.x-bar_size,0)) # set position of window to be just above the taskbar
|
DisplayServer.window_set_position(screen_pos + Vector2i(screen_size.x-Data.save.size,0)) # set position of window to be just above the taskbar
|
||||||
position.y = 0 # set position of bar to be where it should be (moves when we change the window size)
|
position.y = 0 # set position of bar to be where it should be (moves when we change the window size)
|
||||||
position.x = bar_size
|
position.x = Data.save.size
|
||||||
rotation_degrees = 90
|
rotation_degrees = 90
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
|
|
||||||
134
main.tscn
134
main.tscn
|
|
@ -33,7 +33,6 @@ script = ExtResource("1_h2yge")
|
||||||
bar = NodePath("VBoxContainer/MainContent/bar")
|
bar = NodePath("VBoxContainer/MainContent/bar")
|
||||||
label = NodePath("VBoxContainer/MainContent/Label")
|
label = NodePath("VBoxContainer/MainContent/Label")
|
||||||
options_window = NodePath("Options Window")
|
options_window = NodePath("Options Window")
|
||||||
bar_position = 1
|
|
||||||
|
|
||||||
[node name="Bar" type="Window" parent="." unique_id=714499816]
|
[node name="Bar" type="Window" parent="." unique_id=714499816]
|
||||||
transparent_bg = true
|
transparent_bg = true
|
||||||
|
|
@ -128,12 +127,11 @@ grow_vertical = 2
|
||||||
text = "12:34 Remaining Until Sleepy time, there is alot of space for text you can work with here meow meow meow meow"
|
text = "12:34 Remaining Until Sleepy time, there is alot of space for text you can work with here meow meow meow meow"
|
||||||
label_settings = SubResource("LabelSettings_h2yge")
|
label_settings = SubResource("LabelSettings_h2yge")
|
||||||
|
|
||||||
[node name="Options Window" type="Window" parent="." unique_id=1651073981 node_paths=PackedStringArray("sleep_h", "sleep_m", "duration_h", "duration_m")]
|
[node name="Options Window" type="Window" parent="." unique_id=1651073981 node_paths=PackedStringArray("sleep_h", "sleep_m", "duration_h", "duration_m", "size_label", "size_slider")]
|
||||||
oversampling_override = 1.0
|
oversampling_override = 1.0
|
||||||
title = "SleepClock Options"
|
title = "SleepyClock Options"
|
||||||
initial_position = 1
|
initial_position = 1
|
||||||
size = Vector2i(450, 300)
|
size = Vector2i(450, 600)
|
||||||
visible = false
|
|
||||||
unresizable = true
|
unresizable = true
|
||||||
always_on_top = true
|
always_on_top = true
|
||||||
minimize_disabled = true
|
minimize_disabled = true
|
||||||
|
|
@ -143,6 +141,8 @@ sleep_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sl
|
||||||
sleep_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sleepM")
|
sleep_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sleepM")
|
||||||
duration_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationH")
|
duration_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationH")
|
||||||
duration_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationM")
|
duration_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationM")
|
||||||
|
size_label = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer3/sizeLabel")
|
||||||
|
size_slider = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer3/sizeSlider")
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="Options Window" unique_id=426909220]
|
[node name="MarginContainer" type="MarginContainer" parent="Options Window" unique_id=426909220]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
|
@ -168,7 +168,7 @@ layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
tooltip_text = "This is the time at which the bar should completely fill up"
|
tooltip_text = "This is the time at which the bar should completely fill up"
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
text = "Sleep Time (24 hour time): 🛈"
|
text = "Sleep Time (24 hour time) 🛈"
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=34542284]
|
[node name="HBoxContainer" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=34542284]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -193,7 +193,7 @@ layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
tooltip_text = "How long it should take for the bar to fill"
|
tooltip_text = "How long it should take for the bar to fill"
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
text = "Bar/Clock Duration: 🛈"
|
text = "Bar/Clock Duration 🛈"
|
||||||
|
|
||||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=650035341]
|
[node name="HBoxContainer2" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=650035341]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -215,11 +215,12 @@ select_all_on_focus = true
|
||||||
|
|
||||||
[node name="Label4" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1856476808]
|
[node name="Label4" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1856476808]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Bar Position"
|
tooltip_text = "Which edge of the screen should the bar be placed on"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Bar Position 🛈"
|
||||||
|
|
||||||
[node name="OptionButton" type="OptionButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1955200779]
|
[node name="positionDropdown" type="OptionButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1955200779]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
disabled = true
|
|
||||||
selected = 0
|
selected = 0
|
||||||
item_count = 2
|
item_count = 2
|
||||||
popup/item_0/text = "Bottom"
|
popup/item_0/text = "Bottom"
|
||||||
|
|
@ -229,31 +230,121 @@ popup/item_1/id = 1
|
||||||
|
|
||||||
[node name="Label2" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1597493397]
|
[node name="Label2" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1597493397]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Bar Size"
|
tooltip_text = "How much space should the bar take up"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Bar Size 🛈"
|
||||||
|
|
||||||
[node name="HBoxContainer3" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1274134494]
|
[node name="HBoxContainer3" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1274134494]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3" unique_id=531473775]
|
[node name="sizeLabel" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3" unique_id=531473775]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "10px"
|
text = "10px"
|
||||||
|
|
||||||
[node name="HSlider" type="HSlider" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3" unique_id=271540690]
|
[node name="sizeSlider" type="HSlider" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3" unique_id=271540690]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
min_value = 10.0
|
min_value = 10.0
|
||||||
max_value = 50.0
|
max_value = 50.0
|
||||||
step = 10.0
|
|
||||||
value = 10.0
|
value = 10.0
|
||||||
editable = false
|
|
||||||
tick_count = 5
|
tick_count = 5
|
||||||
ticks_on_borders = true
|
ticks_on_borders = true
|
||||||
|
|
||||||
|
[node name="Label6" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1332307585]
|
||||||
|
layout_mode = 2
|
||||||
|
tooltip_text = "Color that the bar should be under normal conditions"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Bar Color 🛈"
|
||||||
|
|
||||||
|
[node name="barColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=114688172]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label7" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1857238089]
|
||||||
|
layout_mode = 2
|
||||||
|
tooltip_text = "Color that the background of the bar should be"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Background Color 🛈"
|
||||||
|
|
||||||
|
[node name="backgroundColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=468934955]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label5" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=665826413]
|
||||||
|
layout_mode = 2
|
||||||
|
tooltip_text = "Make the bar change color when the time left is below a certain threshold"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Warning 🛈"
|
||||||
|
|
||||||
|
[node name="HBoxContainer4" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=936118584]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="warningColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4" unique_id=925432958]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="warningH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4" unique_id=232298746]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 23.0
|
||||||
|
suffix = "h"
|
||||||
|
select_all_on_focus = true
|
||||||
|
|
||||||
|
[node name="warningM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4" unique_id=604816514]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 59.0
|
||||||
|
suffix = "m"
|
||||||
|
select_all_on_focus = true
|
||||||
|
|
||||||
|
[node name="Label10" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=207682712]
|
||||||
|
layout_mode = 2
|
||||||
|
tooltip_text = "Play a flashing effect when time expires"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "flash bar when time ends 🛈"
|
||||||
|
|
||||||
|
[node name="flashCheck" type="CheckButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1168112585]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
|
||||||
|
[node name="Label8" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=280072151]
|
||||||
|
layout_mode = 2
|
||||||
|
tooltip_text = "How long should the bar be visible before the time starts"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Display before time starts 🛈"
|
||||||
|
|
||||||
|
[node name="HBoxContainer5" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=2104802150]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="beforeM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer5" unique_id=157077084]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 59.0
|
||||||
|
editable = false
|
||||||
|
suffix = "m"
|
||||||
|
select_all_on_focus = true
|
||||||
|
|
||||||
|
[node name="Label9" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=703302168]
|
||||||
|
layout_mode = 2
|
||||||
|
tooltip_text = "How long should the bar be visible for after the time ends"
|
||||||
|
mouse_filter = 1
|
||||||
|
text = "Display after time ends 🛈"
|
||||||
|
|
||||||
|
[node name="HBoxContainer6" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1503325100]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="afterM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer6" unique_id=1517063919]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 59.0
|
||||||
|
editable = false
|
||||||
|
suffix = "m"
|
||||||
|
select_all_on_focus = true
|
||||||
|
|
||||||
[node name="Label2" type="Label" parent="Options Window/MarginContainer/VBoxContainer" unique_id=201796106]
|
[node name="Label2" type="Label" parent="Options Window/MarginContainer/VBoxContainer" unique_id=201796106]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "todo:
|
text = "todo:
|
||||||
- position and size
|
- red threshold
|
||||||
|
- display before/after time
|
||||||
- text to display inside bar"
|
- text to display inside bar"
|
||||||
label_settings = SubResource("LabelSettings_1bvp3")
|
label_settings = SubResource("LabelSettings_1bvp3")
|
||||||
|
|
||||||
|
|
@ -273,6 +364,17 @@ text = "Save"
|
||||||
[connection signal="id_pressed" from="StatusIndicator/PopupMenu" to="." method="_on_popup_menu_id_pressed"]
|
[connection signal="id_pressed" from="StatusIndicator/PopupMenu" to="." method="_on_popup_menu_id_pressed"]
|
||||||
[connection signal="gui_input" from="VBoxContainer/TitleBar" to="VBoxContainer/TitleBar" method="_on_TitleBar_gui_input"]
|
[connection signal="gui_input" from="VBoxContainer/TitleBar" to="VBoxContainer/TitleBar" method="_on_TitleBar_gui_input"]
|
||||||
[connection signal="close_requested" from="Options Window" to="Options Window" method="_on_close_requested"]
|
[connection signal="close_requested" from="Options Window" to="Options Window" method="_on_close_requested"]
|
||||||
|
[connection signal="options_changed" from="Options Window" to="." method="setup_window"]
|
||||||
[connection signal="visibility_changed" from="Options Window" to="Options Window" method="_on_visibility_changed"]
|
[connection signal="visibility_changed" from="Options Window" to="Options Window" method="_on_visibility_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sleepH" to="Options Window" method="_on_sleep_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sleepM" to="Options Window" method="_on_sleep_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationH" to="Options Window" method="_on_duration_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationM" to="Options Window" method="_on_duration_value_changed"]
|
||||||
|
[connection signal="item_selected" from="Options Window/MarginContainer/VBoxContainer/GridContainer/positionDropdown" to="Options Window" method="_on_position_dropdown_item_selected"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3/sizeSlider" to="Options Window" method="_on_size_slider_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningH" to="Options Window" method="_on_duration_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningM" to="Options Window" method="_on_duration_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer5/beforeM" to="Options Window" method="_on_duration_value_changed"]
|
||||||
|
[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer6/afterM" to="Options Window" method="_on_duration_value_changed"]
|
||||||
[connection signal="pressed" from="Options Window/MarginContainer/VBoxContainer/HBoxContainer/cancelButton" to="Options Window" method="_on_cancel_button_pressed"]
|
[connection signal="pressed" from="Options Window/MarginContainer/VBoxContainer/HBoxContainer/cancelButton" to="Options Window" method="_on_cancel_button_pressed"]
|
||||||
[connection signal="pressed" from="Options Window/MarginContainer/VBoxContainer/HBoxContainer/saveButton" to="Options Window" method="_on_save_button_pressed"]
|
[connection signal="pressed" from="Options Window/MarginContainer/VBoxContainer/HBoxContainer/saveButton" to="Options Window" method="_on_save_button_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
extends Window
|
extends Window
|
||||||
|
|
||||||
|
signal options_changed
|
||||||
|
|
||||||
@export var sleep_h: SpinBox
|
@export var sleep_h: SpinBox
|
||||||
@export var sleep_m: SpinBox
|
@export var sleep_m: SpinBox
|
||||||
@export var duration_h: SpinBox
|
@export var duration_h: SpinBox
|
||||||
@export var duration_m: SpinBox
|
@export var duration_m: SpinBox
|
||||||
|
@export var size_label: Label
|
||||||
|
@export var size_slider: HSlider
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
|
@ -13,6 +17,8 @@ func _ready() -> void:
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
#validate inputs?, disable save button if somehow invalid?
|
#validate inputs?, disable save button if somehow invalid?
|
||||||
|
if visible:
|
||||||
|
size_label.text = str(Data.save.size)+"px"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24,18 +30,14 @@ func _on_close_requested() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_cancel_button_pressed() -> void:
|
func _on_cancel_button_pressed() -> void:
|
||||||
|
Data.load_data()
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
|
|
||||||
func _on_save_button_pressed() -> void:
|
func _on_save_button_pressed() -> void:
|
||||||
var end_seconds : float = 0
|
|
||||||
end_seconds += sleep_h.value * 60 * 60
|
|
||||||
end_seconds += sleep_m.value * 60
|
|
||||||
var duration_seconds : float = 0
|
|
||||||
duration_seconds += duration_h.value * 60 * 60
|
|
||||||
duration_seconds += duration_m.value * 60
|
|
||||||
Data.save.duration = duration_seconds
|
|
||||||
Data.save.end_time = end_seconds
|
|
||||||
if Data.save_data():
|
if Data.save_data():
|
||||||
hide()
|
hide()
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
@ -48,4 +50,34 @@ func _on_visibility_changed() -> void:
|
||||||
sleep_m.value = int((Data.save.end_time-sleep_h.value*60*60)/60)
|
sleep_m.value = int((Data.save.end_time-sleep_h.value*60*60)/60)
|
||||||
duration_h.value = int(Data.save.duration/(60*60))
|
duration_h.value = int(Data.save.duration/(60*60))
|
||||||
duration_m.value = int((Data.save.duration-duration_h.value*60*60)/60)
|
duration_m.value = int((Data.save.duration-duration_h.value*60*60)/60)
|
||||||
|
size_slider.value = Data.save.size
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_duration_value_changed(value: float) -> void:
|
||||||
|
var duration_seconds : float = 0
|
||||||
|
duration_seconds += duration_h.value * 60 * 60
|
||||||
|
duration_seconds += duration_m.value * 60
|
||||||
|
Data.save.duration = duration_seconds
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_sleep_value_changed(value: float) -> void:
|
||||||
|
var end_seconds : float = 0
|
||||||
|
end_seconds += sleep_h.value * 60 * 60
|
||||||
|
end_seconds += sleep_m.value * 60
|
||||||
|
Data.save.end_time = end_seconds
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_size_slider_value_changed(value: float) -> void:
|
||||||
|
Data.save.size = int(value)
|
||||||
|
options_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_position_dropdown_item_selected(index: int) -> void:
|
||||||
|
if index == 0:
|
||||||
|
Data.save.position = Data.Position.Bottom
|
||||||
|
elif index == 1:
|
||||||
|
Data.save.position = Data.Position.Right
|
||||||
|
options_changed.emit()
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,5 @@ class_name SleepyclockSave
|
||||||
@export var end_time : float = 0 # number of seconds past midnight the clock bar should fill up
|
@export var end_time : float = 0 # number of seconds past midnight the clock bar should fill up
|
||||||
@export var duration : float = 7200 # number of seconds the clock bar should progress for (end_time - duration = "start_time")
|
@export var duration : float = 7200 # number of seconds the clock bar should progress for (end_time - duration = "start_time")
|
||||||
#@export var position : int = 0
|
#@export var position : int = 0
|
||||||
#@export var size : int = 10
|
@export var size : int = 10
|
||||||
|
@export var position : Data.Position = Data.Position.Bottom
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue