Add MainLoop support.

Pros: It's a standard Haxe feature that other Haxelibs may rely on. Plus
it offers built-in thread safety, unlike `onUpdate`.

Cons: It incurs two `mutex.acquire()` calls per frame.
This commit is contained in:
Joseph Cloutier
2022-05-30 16:37:43 -04:00
parent c406bc53ea
commit 7890951d12

View File

@@ -600,6 +600,16 @@ class NativeApplication
});
}
}
#if target.threaded
sys.thread.Thread.current().events.progress();
#elseif cpp
cpp.vm.Thread.current().events.progress();
#elseif neko
neko.vm.Thread.current().events.progress();
#else
@:privateAccess haxe.EntryPoint.processEvents();
#end
#end
}
}