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