summaryrefslogtreecommitdiff
path: root/tools/script_plugins/time/time.gd
blob: 66b3e9ed0436e344a6f9123d90a834729acbd874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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