Commit c5dcf3d9 authored by Gerard Gascón's avatar Gerard Gascón
Browse files

feat: added clock

parent c422a83f
Loading
Loading
Loading
Loading

scenes/clock/clock.gd

0 → 100644
+14 −0
Original line number Diff line number Diff line
extends Label


func _process(delta: float) -> void:
	var time: Dictionary = Time.get_time_dict_from_system()
	
	var hour: int = time['hour']
	var minute: int = time['minute']
	var second: int = time['second']
	
	if second % 2 == 0:
		text = "%02d:%02d" % [hour, minute]
	else:
		text = "%02d %02d" % [hour, minute]
+1 −0
Original line number Diff line number Diff line
uid://drnne01ksnlqv
+41 −0
Original line number Diff line number Diff line
[gd_scene load_steps=4 format=3 uid="uid://bj5ptaniasaaj"]

[ext_resource type="Script" uid="uid://ddsdlhbepjrm3" path="res://scenes/clock/day.gd" id="1_4o2gw"]
[ext_resource type="Script" uid="uid://catrd7ir3ekyj" path="res://scenes/clock/clock_window.gd" id="1_yxh3l"]
[ext_resource type="Script" uid="uid://drnne01ksnlqv" path="res://scenes/clock/clock.gd" id="2_ngmfe"]

[node name="Clock" type="Window"]
transparent_bg = true
size = Vector2i(200, 100)
unresizable = true
borderless = true
transparent = true
script = ExtResource("1_yxh3l")

[node name="ColorRect" type="ColorRect" parent="."]
offset_right = 200.0
offset_bottom = 100.0
color = Color(0, 0.5, 0.2, 1)

[node name="Clock" type="Label" parent="."]
offset_right = 146.0
offset_bottom = 49.0
theme_override_font_sizes/font_size = 41
text = "00:00"
script = ExtResource("2_ngmfe")

[node name="Coins" type="Label" parent="."]
offset_left = 126.0
offset_right = 200.0
offset_bottom = 57.0
theme_override_font_sizes/font_size = 41
text = "00"
horizontal_alignment = 2

[node name="Day" type="Label" parent="."]
offset_top = 65.0
offset_right = 146.0
offset_bottom = 100.0
theme_override_font_sizes/font_size = 25
text = "dl. 23-04"
script = ExtResource("1_4o2gw")
+15 −0
Original line number Diff line number Diff line
extends Window


func _ready() -> void:
	move_window_to_top_right()


func move_window_to_top_right():
	var display_index: int = DisplayServer.window_get_current_screen()

	var work_area_position: Vector2i = DisplayServer.screen_get_usable_rect(display_index).position
	var work_area_size: Vector2i     = DisplayServer.screen_get_usable_rect(display_index).size

	var offset: int = 30
	position = work_area_position + Vector2i(work_area_size.x - size.x - offset, offset)
+1 −0
Original line number Diff line number Diff line
uid://catrd7ir3ekyj
Loading