diff --git a/README.md b/README.md index 7509a6d..4d3b948 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # SleepyClock +## Download +Goto the [releases tab](https://forge.tabbycat.dev/tabby/SleepyClock/releases) and download the latest version + +## Opening in Godot +1. Download Godot 4.6.3 https://godotengine.org/download/windows/ +2. Clone this repo +3. Import project + +### Ideas - [x] refactor main clock bar code - process method - [x] pick time for the clock to end, and how long before that it should start (in duration - ie 2 hours) - [x] support for varied monitor size @@ -10,10 +19,8 @@ - [x] customisation/settings - [x] scale on high resolution displays - [x] remove leftover files from focus and payphone watcher -- [ ] fade/flash when time rouns out +- [x] fade/flash when time rouns out - [x] options save and load - [x] select display style (which side) -- [ ] hide clock outside active hours +- [x] hide clock outside active hours - [x] configurable bar/text(?) size - -test diff --git a/clock.gd b/clock.gd index 84ce92a..41a5cb3 100644 --- a/clock.gd +++ b/clock.gd @@ -1,6 +1,6 @@ extends Control -var taskbar_height : int = 50 +#var taskbar_height : int = 50 #@export var bar_size : int = 10 @export var bar: TextureProgressBar @export var label: Label @@ -32,7 +32,7 @@ func setup_window(): get_window().size = Vector2i(screen_size.x, Data.save.size) # set window size to be 10 high and screen width wide 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 + DisplayServer.window_set_position(screen_pos + Vector2i(0,screen_size.y-Data.save.size-Data.save.safe_bottom)) # 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.x = 0 rotation_degrees = 0 @@ -41,7 +41,7 @@ func setup_window(): 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 - Data.save.safe_bottom size.y = Data.save.size label.label_settings.font_size = (float(Data.save.size)/10)*10 DisplayServer.window_set_position(screen_pos + Vector2i(screen_size.x-Data.save.size,0)) # set position of window to be just above the taskbar diff --git a/main.tscn b/main.tscn index d965ff8..a899834 100644 --- a/main.tscn +++ b/main.tscn @@ -128,7 +128,7 @@ 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" 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", "size_label", "size_slider", "bar_color", "background_color", "warning_color", "trans_label", "trans_slider", "warning_h", "warning_m", "flash_check", "before_h", "before_m", "after_h", "after_m", "style_dropdown", "position_dropdown")] +[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", "bar_color", "background_color", "warning_color", "trans_label", "trans_slider", "warning_h", "warning_m", "flash_check", "before_h", "before_m", "after_h", "after_m", "style_dropdown", "position_dropdown", "safe_top", "safe_bottom")] oversampling_override = 1.0 title = "SleepyClock Options" initial_position = 1 @@ -138,26 +138,28 @@ always_on_top = true minimize_disabled = true maximize_disabled = true script = ExtResource("4_1bvp3") -sleep_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sleepH") -sleep_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer/sleepM") -duration_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationH") -duration_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer2/durationM") -size_label = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer3/sizeLabel") -size_slider = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer3/sizeSlider") -bar_color = NodePath("MarginContainer/VBoxContainer/GridContainer/barColor") -background_color = NodePath("MarginContainer/VBoxContainer/GridContainer/backgroundColor") -warning_color = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningColor") -trans_label = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer7/transLabel") -trans_slider = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer7/transSlider") -warning_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningH") -warning_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningM") -flash_check = NodePath("MarginContainer/VBoxContainer/GridContainer/flashCheck") -before_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer5/beforeH") -before_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer5/beforeM") -after_h = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer6/afterH") -after_m = NodePath("MarginContainer/VBoxContainer/GridContainer/HBoxContainer6/afterM") -style_dropdown = NodePath("MarginContainer/VBoxContainer/GridContainer/styleDropdown") -position_dropdown = NodePath("MarginContainer/VBoxContainer/GridContainer/positionDropdown") +sleep_h = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer/sleepH") +sleep_m = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer/sleepM") +duration_h = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer2/durationH") +duration_m = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer2/durationM") +size_label = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer3/sizeLabel") +size_slider = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer3/sizeSlider") +bar_color = NodePath("MarginContainer/VBoxContainer/OptionsBox/barColor") +background_color = NodePath("MarginContainer/VBoxContainer/OptionsBox/backgroundColor") +warning_color = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4/warningColor") +trans_label = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer7/transLabel") +trans_slider = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer7/transSlider") +warning_h = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4/warningH") +warning_m = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4/warningM") +flash_check = NodePath("MarginContainer/VBoxContainer/OptionsBox/flashCheck") +before_h = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer5/beforeH") +before_m = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer5/beforeM") +after_h = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer6/afterH") +after_m = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer6/afterM") +style_dropdown = NodePath("MarginContainer/VBoxContainer/OptionsBox/styleDropdown") +position_dropdown = NodePath("MarginContainer/VBoxContainer/OptionsBox/positionDropdown") +safe_top = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer8/safeTop") +safe_bottom = NodePath("MarginContainer/VBoxContainer/OptionsBox/HBoxContainer8/safeBottom") [node name="MarginContainer" type="MarginContainer" parent="Options Window" unique_id=426909220] anchors_preset = 15 @@ -173,68 +175,68 @@ 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] +[node name="OptionsBox" 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] +[node name="Label" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=2012826546] layout_mode = 2 size_flags_horizontal = 3 tooltip_text = "This is the time at which the bar should completely fill up" mouse_filter = 1 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/OptionsBox" unique_id=34542284] layout_mode = 2 size_flags_horizontal = 3 -[node name="sleepH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer" unique_id=53115223] +[node name="sleepH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer" unique_id=53115223] layout_mode = 2 size_flags_horizontal = 3 max_value = 23.0 suffix = "h" select_all_on_focus = true -[node name="sleepM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer" unique_id=1582897710] +[node name="sleepM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer" unique_id=1582897710] layout_mode = 2 size_flags_horizontal = 3 max_value = 59.0 suffix = "m" select_all_on_focus = true -[node name="Label3" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1956355233] +[node name="Label3" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1956355233] layout_mode = 2 size_flags_horizontal = 3 tooltip_text = "How long it should take for the bar to fill" mouse_filter = 1 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/OptionsBox" unique_id=650035341] layout_mode = 2 size_flags_horizontal = 3 -[node name="durationH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer2" unique_id=1511471443] +[node name="durationH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer2" unique_id=1511471443] layout_mode = 2 size_flags_horizontal = 3 max_value = 23.0 suffix = "h" select_all_on_focus = true -[node name="durationM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer2" unique_id=1155242421] +[node name="durationM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer2" unique_id=1155242421] layout_mode = 2 size_flags_horizontal = 3 max_value = 59.0 suffix = "m" 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/OptionsBox" unique_id=1856476808] layout_mode = 2 tooltip_text = "Which edge of the screen should the bar be placed on" mouse_filter = 1 text = "Bar Position 🛈" -[node name="positionDropdown" type="OptionButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1955200779] +[node name="positionDropdown" type="OptionButton" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1955200779] layout_mode = 2 selected = 0 item_count = 2 @@ -243,20 +245,20 @@ popup/item_0/id = 0 popup/item_1/text = "Right" 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/OptionsBox" unique_id=1597493397] layout_mode = 2 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/OptionsBox" unique_id=1274134494] layout_mode = 2 -[node name="sizeLabel" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3" unique_id=531473775] +[node name="sizeLabel" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer3" unique_id=531473775] layout_mode = 2 text = "10px" -[node name="sizeSlider" type="HSlider" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer3" unique_id=271540690] +[node name="sizeSlider" type="HSlider" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer3" unique_id=271540690] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -266,21 +268,21 @@ value = 10.0 tick_count = 5 ticks_on_borders = true -[node name="Label11" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1879012879] +[node name="Label11" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1879012879] layout_mode = 2 tooltip_text = "How transparent should the bar be" mouse_filter = 1 text = "Bar Transparency 🛈" -[node name="HBoxContainer7" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1690404152] +[node name="HBoxContainer7" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1690404152] layout_mode = 2 -[node name="transLabel" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer7" unique_id=1732819966] +[node name="transLabel" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer7" unique_id=1732819966] custom_minimum_size = Vector2(45, 0) layout_mode = 2 text = "100%" -[node name="transSlider" type="HSlider" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer7" unique_id=2119026733] +[node name="transSlider" type="HSlider" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer7" unique_id=2119026733] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 @@ -290,38 +292,38 @@ value = 1.0 tick_count = 10 ticks_on_borders = true -[node name="Label6" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1332307585] +[node name="Label6" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" 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] +[node name="barColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=114688172] layout_mode = 2 -[node name="Label7" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1857238089] +[node name="Label7" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" 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] +[node name="backgroundColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=468934955] layout_mode = 2 -[node name="Label5" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=665826413] +[node name="Label5" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" 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] +[node name="HBoxContainer4" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=936118584] layout_mode = 2 -[node name="warningColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4" unique_id=925432958] +[node name="warningColor" type="ColorPickerButton" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/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] +[node name="warningH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4" unique_id=232298746] layout_mode = 2 size_flags_horizontal = 3 max_value = 23.0 @@ -329,76 +331,76 @@ value = 1.0 suffix = "h" select_all_on_focus = true -[node name="warningM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4" unique_id=604816514] +[node name="warningM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/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] +[node name="Label10" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" 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] +[node name="flashCheck" type="CheckButton" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1168112585] layout_mode = 2 size_flags_horizontal = 4 -[node name="Label8" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=280072151] +[node name="Label8" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" 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] +[node name="HBoxContainer5" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=2104802150] layout_mode = 2 -[node name="beforeH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer5" unique_id=239006734] +[node name="beforeH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer5" unique_id=239006734] layout_mode = 2 size_flags_horizontal = 3 max_value = 23.0 suffix = "h" select_all_on_focus = true -[node name="beforeM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer5" unique_id=157077084] +[node name="beforeM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer5" unique_id=157077084] layout_mode = 2 size_flags_horizontal = 3 max_value = 59.0 suffix = "m" select_all_on_focus = true -[node name="Label9" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=703302168] +[node name="Label9" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" 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] +[node name="HBoxContainer6" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1503325100] layout_mode = 2 -[node name="afterH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer6" unique_id=514335276] +[node name="afterH" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer6" unique_id=514335276] layout_mode = 2 size_flags_horizontal = 3 max_value = 23.0 suffix = "h" select_all_on_focus = true -[node name="afterM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer6" unique_id=1517063919] +[node name="afterM" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer6" unique_id=1517063919] layout_mode = 2 size_flags_horizontal = 3 max_value = 59.0 suffix = "m" select_all_on_focus = true -[node name="Label12" type="Label" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=900821531] +[node name="Label12" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=900821531] layout_mode = 2 tooltip_text = "Filling or Emptying changed weather the bar grows or shrinks over time. Reversed swaps the diretion of the bars movement" mouse_filter = 1 text = "Progress Style 🛈" -[node name="styleDropdown" type="OptionButton" parent="Options Window/MarginContainer/VBoxContainer/GridContainer" unique_id=1485870511] +[node name="styleDropdown" type="OptionButton" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1485870511] layout_mode = 2 selected = 0 item_count = 4 @@ -411,11 +413,31 @@ popup/item_2/id = 2 popup/item_3/text = "Emptying Reversed" popup/item_3/id = 3 +[node name="safe label" type="Label" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=1401540555] +layout_mode = 2 +tooltip_text = "Configure the safe zones at the top and bottom of the screen" +mouse_filter = 1 +text = "Safe zones top/bottom 🛈" + +[node name="HBoxContainer8" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox" unique_id=957757730] +layout_mode = 2 + +[node name="safeTop" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer8" unique_id=1440318820] +layout_mode = 2 +size_flags_horizontal = 3 +editable = false +suffix = "px" + +[node name="safeBottom" type="SpinBox" parent="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer8" unique_id=1867137297] +layout_mode = 2 +size_flags_horizontal = 3 +suffix = "px" + [node name="Label2" type="Label" parent="Options Window/MarginContainer/VBoxContainer" unique_id=201796106] layout_mode = 2 text = "todo: -- configure safe zones top/bottom -- text to display inside bar" +- configure top safe zone +- configurable text to display inside bar?" label_settings = SubResource("LabelSettings_1bvp3") [node name="HBoxContainer" type="HBoxContainer" parent="Options Window/MarginContainer/VBoxContainer" unique_id=2066769118] @@ -436,23 +458,25 @@ text = "Save" [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="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/HBoxContainer7/transSlider" to="Options Window" method="_on_trans_slider_value_changed"] -[connection signal="color_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/barColor" to="Options Window" method="_on_bar_color_color_changed"] -[connection signal="color_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/backgroundColor" to="Options Window" method="_on_background_color_color_changed"] -[connection signal="color_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningColor" to="Options Window" method="_on_warning_color_color_changed"] -[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningH" to="Options Window" method="_on_warning_value_changed"] -[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer4/warningM" to="Options Window" method="_on_warning_value_changed"] -[connection signal="toggled" from="Options Window/MarginContainer/VBoxContainer/GridContainer/flashCheck" to="Options Window" method="_on_flash_check_toggled"] -[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer5/beforeH" to="Options Window" method="_on_before_value_changed"] -[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer5/beforeM" to="Options Window" method="_on_before_value_changed"] -[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer6/afterH" to="Options Window" method="_on_after_value_changed"] -[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/GridContainer/HBoxContainer6/afterM" to="Options Window" method="_on_after_value_changed"] -[connection signal="item_selected" from="Options Window/MarginContainer/VBoxContainer/GridContainer/styleDropdown" to="Options Window" method="_on_style_dropdown_item_selected"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer/sleepH" to="Options Window" method="_on_sleep_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer/sleepM" to="Options Window" method="_on_sleep_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer2/durationH" to="Options Window" method="_on_duration_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer2/durationM" to="Options Window" method="_on_duration_value_changed"] +[connection signal="item_selected" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/positionDropdown" to="Options Window" method="_on_position_dropdown_item_selected"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer3/sizeSlider" to="Options Window" method="_on_size_slider_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer7/transSlider" to="Options Window" method="_on_trans_slider_value_changed"] +[connection signal="color_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/barColor" to="Options Window" method="_on_bar_color_color_changed"] +[connection signal="color_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/backgroundColor" to="Options Window" method="_on_background_color_color_changed"] +[connection signal="color_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4/warningColor" to="Options Window" method="_on_warning_color_color_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4/warningH" to="Options Window" method="_on_warning_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer4/warningM" to="Options Window" method="_on_warning_value_changed"] +[connection signal="toggled" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/flashCheck" to="Options Window" method="_on_flash_check_toggled"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer5/beforeH" to="Options Window" method="_on_before_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer5/beforeM" to="Options Window" method="_on_before_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer6/afterH" to="Options Window" method="_on_after_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer6/afterM" to="Options Window" method="_on_after_value_changed"] +[connection signal="item_selected" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/styleDropdown" to="Options Window" method="_on_style_dropdown_item_selected"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer8/safeTop" to="Options Window" method="_on_safe_top_value_changed"] +[connection signal="value_changed" from="Options Window/MarginContainer/VBoxContainer/OptionsBox/HBoxContainer8/safeBottom" to="Options Window" method="_on_safe_bottom_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/saveButton" to="Options Window" method="_on_save_button_pressed"] diff --git a/options_window.gd b/options_window.gd index 061212d..3721817 100644 --- a/options_window.gd +++ b/options_window.gd @@ -22,6 +22,8 @@ signal options_changed @export var after_m: SpinBox @export var style_dropdown: OptionButton @export var position_dropdown: OptionButton +@export var safe_top: SpinBox +@export var safe_bottom: SpinBox func _init() -> void: @@ -89,6 +91,8 @@ func _on_visibility_changed() -> void: flash_check.button_pressed = Data.save.flashing position_dropdown.select(Data.save.position) style_dropdown.select(Data.save.progress_style) + safe_bottom.value = Data.save.safe_bottom + safe_top.value = Data.save.safe_top pass # Replace with function body. @@ -159,3 +163,13 @@ func _on_style_dropdown_item_selected(index: int) -> void: elif index == 3: Data.save.progress_style = Data.Styles.Emptying_Reversed options_changed.emit() + + +func _on_safe_top_value_changed(value: float) -> void: + Data.save.safe_top = int(value) + options_changed.emit() + + +func _on_safe_bottom_value_changed(value: float) -> void: + Data.save.safe_bottom = int(value) + options_changed.emit() diff --git a/sleepyclockSave.gd b/sleepyclockSave.gd index 04d7a05..dcc2780 100644 --- a/sleepyclockSave.gd +++ b/sleepyclockSave.gd @@ -15,3 +15,5 @@ class_name SleepyclockSave @export var after_time : float = 86340 @export var flashing : bool = true @export var progress_style : Data.Styles = Data.Styles.Filling +@export var safe_top : int = 0 +@export var safe_bottom : int = 50