sokoban
Diffstat (limited to 'StopWatch.gd')
-rw-r--r--StopWatch.gd39
1 files changed, 0 insertions, 39 deletions
diff --git a/StopWatch.gd b/StopWatch.gd
deleted file mode 100644
index 35e6492..0000000
--- a/StopWatch.gd
+++ /dev/null
@@ -1,39 +0,0 @@
-extends Label
-
-var time_elapsed := 0.0
-
-
-func _ready():
- MainInstances.stopwatch = self
- set_process(false)
-
-
-func start():
- set_process(true)
-
-
-func _exit_tree():
- MainInstances.stopwatch = null
-
-
-func reset():
- time_elapsed = 0.0
- text = _format_seconds(time_elapsed, true)
- set_process(false)
-
-
-func _process(delta):
- time_elapsed += delta
- text = _format_seconds(time_elapsed, true)
-
-
-func _format_seconds(time: float, use_milliseconds: bool) -> String:
- var minutes := time / 60
- var seconds := fmod(time, 60)
-
- if not use_milliseconds:
- return "%02d:%02d" % [minutes, seconds]
-
- var milliseconds := fmod(time, 1) * 100
-
- return "%02d:%02d:%02d" % [minutes, seconds, milliseconds]