From 31bd5ff4c6fe7fb243198294df649c91dc2f193d Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Mon, 31 Jul 2017 21:22:25 +0700 Subject: [PATCH] NimRuntime only works during idle time --- godot/nimruntime.nim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/godot/nimruntime.nim b/godot/nimruntime.nim index 4429508..8a392b5 100644 --- a/godot/nimruntime.nim +++ b/godot/nimruntime.nim @@ -4,7 +4,13 @@ import asyncdispatch import godot, node gdobj NimRuntime of Node: - method process*(delta: float64) = + method enterTree*() = + discard getTree().connect("idle_frame", self, "idle", newArray()) + + method exitTree*() = + getTree().disconnect("idle_frame", self, "idle") + + proc idle*() {.gdExport.} = if asyncdispatch.hasPendingOperations(): poll(0) GC_step(2000, false, 0)