Browse Source

added Sdl.processEvents()

Nicolas Cannasse 8 years ago
parent
commit
e928966df8
1 changed files with 12 additions and 0 deletions
  1. 12 0
      libs/sdl/sdl/Sdl.hx

+ 12 - 0
libs/sdl/sdl/Sdl.hx

@@ -36,6 +36,18 @@ class Sdl {
 		sentinel.tick();
 		sentinel.tick();
 	}
 	}
 
 
+	public static function processEvents() {
+		var event = new Event();
+		while( true ) {
+			if( !eventLoop(event) )
+				break;
+			if( event.type == Quit )
+				return false;
+			defaultEventHandler(event);
+		}
+		return true;
+	}
+
 	public static function loop( callb : Void -> Void, ?onEvent : Event -> Void ) {
 	public static function loop( callb : Void -> Void, ?onEvent : Event -> Void ) {
 		var event = new Event();
 		var event = new Event();
 		if( onEvent == null ) onEvent = defaultEventHandler;
 		if( onEvent == null ) onEvent = defaultEventHandler;