pull events native
This commit is contained in:
parent
bbdbef889a
commit
bca366d7e5
@ -1,12 +1,11 @@
|
|||||||
package kernel;
|
package kernel;
|
||||||
|
|
||||||
|
import lua.TableTools;
|
||||||
|
import lua.Coroutine;
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import haxe.Exception;
|
import haxe.Exception;
|
||||||
|
|
||||||
using tink.CoreApi;
|
using tink.CoreApi;
|
||||||
|
|
||||||
import cc.OS;
|
|
||||||
|
|
||||||
using lua.Table;
|
using lua.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +133,7 @@ class KernelEvents {
|
|||||||
**/
|
**/
|
||||||
public function startEventLoop() {
|
public function startEventLoop() {
|
||||||
while (true) {
|
while (true) {
|
||||||
var event:Table<Int, Dynamic> = OS.pullEventRaw();
|
var event:Table<Int, Dynamic> = pullEvents();
|
||||||
|
|
||||||
var eventName:String = event[1];
|
var eventName:String = event[1];
|
||||||
|
|
||||||
@ -142,6 +141,10 @@ class KernelEvents {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function pullEvents():Table<Int, Dynamic> {
|
||||||
|
return cast TableTools.pack(Coroutine.yield(null));
|
||||||
|
}
|
||||||
|
|
||||||
private function fireSignal(eventName: String,event:Table<Int, Dynamic> ) {
|
private function fireSignal(eventName: String,event:Table<Int, Dynamic> ) {
|
||||||
switch eventName {
|
switch eventName {
|
||||||
case "alarm":
|
case "alarm":
|
||||||
|
Loading…
Reference in New Issue
Block a user