aboutsummaryrefslogtreecommitdiff
path: root/plugins/time/time.gd
diff options
context:
space:
mode:
authorJuan Linietsky2014-02-09 22:10:30 -0300
committerJuan Linietsky2014-02-09 22:10:30 -0300
commit0b806ee0fc9097fa7bda7ac0109191c9c5e0a1ac (patch)
tree276c4d099e178eb67fbd14f61d77b05e3808e9e3 /plugins/time/time.gd
parent0e49da1687bc8192ed210947da52c9e5c5f301bb (diff)
downloadgodot-0b806ee.tar.gz
godot-0b806ee.tar.zst
godot-0b806ee.zip
GODOT IS OPEN SOURCE
Diffstat (limited to '')
-rw-r--r--plugins/time/time.gd32
1 files changed, 32 insertions, 0 deletions
diff --git a/plugins/time/time.gd b/plugins/time/time.gd
new file mode 100644
index 000000000..66b3e9ed0
--- /dev/null
+++ b/plugins/time/time.gd
@@ -0,0 +1,32 @@
+tool # Always declare as Tool, if it's meant to run in the editor.
+extends EditorPlugin
+
+var timer = null
+var label = null
+
+func _timeout():
+ if (label):
+ var time = OS.get_time()
+ label.set_text(str(time.hour).pad_zeros(2)+":"+str(time.minute).pad_zeros(2)+":"+str(time.second).pad_zeros(2))
+
+func get_name():
+ return "The Time"
+
+
+func _init():
+ print("PLUGIN INIT")
+ timer = Timer.new()
+ add_child(timer)
+ timer.set_wait_time(0.5)
+ timer.set_one_shot(false)
+ timer.connect("timeout",self,"_timeout")
+
+func _enter_scene():
+ label = Label.new()
+ add_custom_control(CONTAINER_TOOLBAR,label)
+ timer.start()
+
+func _exit_scene():
+ timer.stop()
+ label.free()
+ label=null