File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ config_version=5
1111[application ]
1212
1313config/name ="FINI Clock"
14+ run/main_scene ="res://scenes/main.tscn"
1415config/features =PackedStringArray ("4.5" , "Mobile" )
1516config/icon ="res://icon.svg"
1617
Original file line number Diff line number Diff line change 1+ [gd_scene load_steps =2 format =3 uid ="uid://cmgtipf2pqvpl" ]
2+
3+ [ext_resource type ="Script" uid ="uid://c1bhwqlkyejjc" path ="res://scripts/main.gd" id ="1_main_script" ]
4+
5+ [node name ="main_node" type ="Node2D" ]
6+ script = ExtResource ("1_main_script" )
7+
8+ [node name ="CenterContainer" type ="CenterContainer" parent ="." ]
9+ anchors_preset = 15
10+ anchor_right = 1.0
11+ anchor_bottom = 1.0
12+ offset_right = 1152.0
13+ offset_bottom = 648.0
14+ grow_horizontal = 2
15+ grow_vertical = 2
16+
17+ [node name ="time_label" type ="Label" parent ="CenterContainer" ]
18+ layout_mode = 2
19+ theme_override_font_sizes/font_size = 80
20+ text = "--:--:--"
21+ horizontal_alignment = 1
22+ vertical_alignment = 1
Original file line number Diff line number Diff line change 1+ extends Node2D
2+
3+ @onready var time_label = $ CenterContainer/time_label
4+
5+
6+ func _ready ():
7+ var timer = Timer .new ()
8+ add_child (timer )
9+ timer .timeout .connect (update_time )
10+ timer .wait_time = 1.0
11+ timer .start ()
12+ update_time ()
13+
14+
15+ func update_time ():
16+ if not time_label :
17+ return
18+ var time_dict = Time .get_time_dict_from_system (true )
19+ var hours = time_dict .hour
20+ var minutes = time_dict .minute
21+ var seconds = time_dict .second
22+ time_label .text = "%02d :%02d :%02d " % [hours , minutes , seconds ]
Original file line number Diff line number Diff line change 1+ uid://c1bhwqlkyejjc
You canβt perform that action at this time.
0 commit comments