options menu progress
This commit is contained in:
parent
904db7c6fb
commit
c083791b9a
7 changed files with 183 additions and 31 deletions
47
Data.gd
Normal file
47
Data.gd
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var save : SleepyclockSave
|
||||||
|
@export var path : String = "user://sleepyclockSave.tres"
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
print("looking for save...")
|
||||||
|
if not load_data():
|
||||||
|
print ("no save detected... creating new save")
|
||||||
|
new_data()
|
||||||
|
else:
|
||||||
|
print("found it! loading now...")
|
||||||
|
load_data()
|
||||||
|
|
||||||
|
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# returns true if new data created and saved
|
||||||
|
func new_data() -> bool:
|
||||||
|
save = SleepyclockSave.new()
|
||||||
|
var error = ResourceSaver.save(save,path)
|
||||||
|
if error != OK:
|
||||||
|
print(error)
|
||||||
|
return false
|
||||||
|
return true
|
||||||
|
|
||||||
|
# returns true if data successfully loaded into save
|
||||||
|
func load_data() -> bool:
|
||||||
|
if not FileAccess.file_exists(path):
|
||||||
|
return false
|
||||||
|
else:
|
||||||
|
save = ResourceLoader.load(path)
|
||||||
|
return true
|
||||||
|
|
||||||
|
# returns true if data successfully saved
|
||||||
|
func save_data() -> bool:
|
||||||
|
var error = ResourceSaver.save(save,path)
|
||||||
|
if error != OK:
|
||||||
|
print(error)
|
||||||
|
return false
|
||||||
|
return true
|
||||||
1
Data.gd.uid
Normal file
1
Data.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dhp4epdaeuqug
|
||||||
150
main.tscn
150
main.tscn
|
|
@ -14,6 +14,9 @@ gradient = SubResource("Gradient_h2yge")
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_h2yge"]
|
[sub_resource type="LabelSettings" id="LabelSettings_h2yge"]
|
||||||
font_size = 11
|
font_size = 11
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_1bvp3"]
|
||||||
|
font_color = Color(0.63375676, 0.6337568, 0.63375676, 1)
|
||||||
|
|
||||||
[node name="Control" type="Control" unique_id=577067945 node_paths=PackedStringArray("bar", "label")]
|
[node name="Control" type="Control" unique_id=577067945 node_paths=PackedStringArray("bar", "label")]
|
||||||
modulate = Color(1, 1, 1, 0.42745098)
|
modulate = Color(1, 1, 1, 0.42745098)
|
||||||
top_level = true
|
top_level = true
|
||||||
|
|
@ -28,7 +31,39 @@ grow_vertical = 0
|
||||||
script = ExtResource("1_h2yge")
|
script = ExtResource("1_h2yge")
|
||||||
bar = NodePath("VBoxContainer/MainContent/bar")
|
bar = NodePath("VBoxContainer/MainContent/bar")
|
||||||
label = NodePath("VBoxContainer/MainContent/Label")
|
label = NodePath("VBoxContainer/MainContent/Label")
|
||||||
bar_position = 1
|
|
||||||
|
[node name="Bar" type="Window" parent="." unique_id=714499816]
|
||||||
|
transparent_bg = true
|
||||||
|
oversampling_override = 1.0
|
||||||
|
visible = false
|
||||||
|
borderless = true
|
||||||
|
always_on_top = true
|
||||||
|
transparent = true
|
||||||
|
unfocusable = true
|
||||||
|
|
||||||
|
[node name="StatusIndicator" type="StatusIndicator" parent="." unique_id=1039426600]
|
||||||
|
icon = ExtResource("3_h2yge")
|
||||||
|
menu = NodePath("PopupMenu")
|
||||||
|
|
||||||
|
[node name="PopupMenu" type="PopupMenu" parent="StatusIndicator" unique_id=1255435033]
|
||||||
|
item_count = 6
|
||||||
|
item_0/text = "Exit"
|
||||||
|
item_0/id = 0
|
||||||
|
item_1/id = 1
|
||||||
|
item_1/separator = true
|
||||||
|
item_2/text = "Smaller"
|
||||||
|
item_2/checkable = 2
|
||||||
|
item_2/id = 5
|
||||||
|
item_3/text = "Small"
|
||||||
|
item_3/checkable = 2
|
||||||
|
item_3/checked = true
|
||||||
|
item_3/id = 2
|
||||||
|
item_4/text = "Medium"
|
||||||
|
item_4/checkable = 2
|
||||||
|
item_4/id = 3
|
||||||
|
item_5/text = "Large"
|
||||||
|
item_5/checkable = 2
|
||||||
|
item_5/id = 4
|
||||||
|
|
||||||
[node name="Background" type="ColorRect" parent="." unique_id=641703216]
|
[node name="Background" type="ColorRect" parent="." unique_id=641703216]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
@ -101,46 +136,99 @@ 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="StatusIndicator" type="StatusIndicator" parent="." unique_id=1039426600]
|
|
||||||
icon = ExtResource("3_h2yge")
|
|
||||||
menu = NodePath("PopupMenu")
|
|
||||||
|
|
||||||
[node name="PopupMenu" type="PopupMenu" parent="StatusIndicator" unique_id=1255435033]
|
|
||||||
item_count = 6
|
|
||||||
item_0/text = "Exit"
|
|
||||||
item_0/id = 0
|
|
||||||
item_1/id = 1
|
|
||||||
item_1/separator = true
|
|
||||||
item_2/text = "Smaller"
|
|
||||||
item_2/checkable = 2
|
|
||||||
item_2/id = 5
|
|
||||||
item_3/text = "Small"
|
|
||||||
item_3/checkable = 2
|
|
||||||
item_3/checked = true
|
|
||||||
item_3/id = 2
|
|
||||||
item_4/text = "Medium"
|
|
||||||
item_4/checkable = 2
|
|
||||||
item_4/id = 3
|
|
||||||
item_5/text = "Large"
|
|
||||||
item_5/checkable = 2
|
|
||||||
item_5/id = 4
|
|
||||||
|
|
||||||
[node name="Options Window" type="Window" parent="." unique_id=1651073981]
|
[node name="Options Window" type="Window" parent="." unique_id=1651073981]
|
||||||
oversampling_override = 1.0
|
oversampling_override = 1.0
|
||||||
title = "SleepClock Options"
|
title = "SleepClock Options"
|
||||||
initial_position = 1
|
initial_position = 1
|
||||||
size = Vector2i(450, 300)
|
size = Vector2i(450, 300)
|
||||||
|
visible = false
|
||||||
|
unresizable = true
|
||||||
always_on_top = true
|
always_on_top = true
|
||||||
|
minimize_disabled = true
|
||||||
|
maximize_disabled = true
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Options Window" unique_id=201796106]
|
[node name="MarginContainer" type="MarginContainer" parent="Options Window" unique_id=426909220]
|
||||||
offset_right = 40.0
|
anchors_preset = 15
|
||||||
offset_bottom = 23.0
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 5
|
||||||
|
theme_override_constants/margin_top = 5
|
||||||
|
theme_override_constants/margin_right = 5
|
||||||
|
theme_override_constants/margin_bottom = 5
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="Options Window/MarginContainer" unique_id=254348110]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="GridContainer" type="GridContainer" parent="Options Window/MarginContainer/VBoxContainer" unique_id=974042207]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
columns = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=2012826546]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Sleep Time (24 hour time):"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=34542284]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="SpinBox" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer" unique_id=53115223]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 23.0
|
||||||
|
suffix = "h"
|
||||||
|
|
||||||
|
[node name="SpinBox2" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer" unique_id=1582897710]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 59.0
|
||||||
|
suffix = "m"
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1956355233]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Bar/Clock Duration:"
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=650035341]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="SpinBox" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer2" unique_id=1511471443]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 23.0
|
||||||
|
suffix = "h"
|
||||||
|
|
||||||
|
[node name="SpinBox2" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer2" unique_id=1155242421]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
max_value = 59.0
|
||||||
|
suffix = "m"
|
||||||
|
|
||||||
|
[node name="Label2" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=201796106]
|
||||||
|
layout_mode = 2
|
||||||
text = "Things that will go here:
|
text = "Things that will go here:
|
||||||
- bar end time
|
- bar end time
|
||||||
- bar duration
|
- bar duration
|
||||||
- text to display inside bar
|
- text to display inside bar"
|
||||||
"
|
label_settings = SubResource("LabelSettings_1bvp3")
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer" unique_id=2066769118]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="Options Window/MarginContainer/VBoxContainer/HBoxContainer" unique_id=1764524981]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Cancel"
|
||||||
|
|
||||||
|
[node name="Button2" type="Button" parent="Options Window/MarginContainer/VBoxContainer/HBoxContainer" unique_id=1904551975]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Save"
|
||||||
|
|
||||||
[connection signal="gui_input" from="VBoxContainer/TitleBar" to="VBoxContainer/TitleBar" method="_on_TitleBar_gui_input"]
|
|
||||||
[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="id_pressed" from="StatusIndicator/PopupMenu" to="VBoxContainer/TitleBar" method="_on_popup_menu_id_pressed"]
|
[connection signal="id_pressed" from="StatusIndicator/PopupMenu" to="VBoxContainer/TitleBar" method="_on_popup_menu_id_pressed"]
|
||||||
|
[connection signal="gui_input" from="VBoxContainer/TitleBar" to="VBoxContainer/TitleBar" method="_on_TitleBar_gui_input"]
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ run/low_processor_mode=true
|
||||||
config/icon="uid://j8lswk62w1d3"
|
config/icon="uid://j8lswk62w1d3"
|
||||||
config/windows_native_icon="res://Logo/logo taskbar.ico"
|
config/windows_native_icon="res://Logo/logo taskbar.ico"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
Data="*uid://dhp4epdaeuqug"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=2560
|
window/size/viewport_width=2560
|
||||||
|
|
|
||||||
5
sleepyclockSave.gd
Normal file
5
sleepyclockSave.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
extends Resource
|
||||||
|
class_name SleepyclockSave
|
||||||
|
|
||||||
|
@export var end_time : int = 0 # number of seconds past midnight the clock bar should fill up
|
||||||
|
@export var duration : int = 7200 # number of seconds the clock bar should progress for (end_time - duration = "start_time")
|
||||||
1
sleepyclockSave.gd.uid
Normal file
1
sleepyclockSave.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://sm57mtdvlwap
|
||||||
6
sleepyclockSave.tres
Normal file
6
sleepyclockSave.tres
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_resource type="Resource" script_class="SleepyclockSave" format=3]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://sleepyclockSave.gd" id="1_m4nhg"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_m4nhg")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue