Jelajahi Sumber

added support for windows ids

Nicolas Cannasse 1 tahun lalu
induk
melakukan
8255dc5645
3 mengubah file dengan 8 tambahan dan 2 penghapusan
  1. 1 0
      libs/directx/dx/Event.hx
  2. 3 1
      libs/directx/dx/Loop.hx
  3. 4 1
      libs/directx/dx/Window.hx

+ 1 - 0
libs/directx/dx/Event.hx

@@ -15,6 +15,7 @@ package dx;
 	public var controller : Int;
 	public var value : Int;
 	public var dropFile: hl.Bytes;
+	public var windowId : Int;
 	public function new() {
 	}
 }

+ 3 - 1
libs/directx/dx/Loop.hx

@@ -4,8 +4,10 @@ class Loop {
 
 	static function eventLoop( e : Event ) {
 		for( w in @:privateAccess Window.windows )
-			if( w.getNextEvent(e) )
+			if( w.getNextEvent(e) ) {
+				e.windowId = w.id;
 				return true;
+			}
 		return false;
 	}
 

+ 4 - 1
libs/directx/dx/Window.hx

@@ -34,7 +34,9 @@ class Window {
 	public static inline var HIDDEN    = 0x000001;
 	public static inline var RESIZABLE = 0x000002;
 
+	static var _UID = 0;
 	var win : WinPtr;
+	public var id(default,null) : Int;
 	public var title(default, set) : String;
 	public var width(get, never) : Int;
 	public var height(get, never) : Int;
@@ -57,6 +59,7 @@ class Window {
 		this.title = title;
 		windows.push(this);
 		vsync = true;
+		id = ++_UID;
 	}
 
 	function set_title(name:String) {
@@ -357,7 +360,7 @@ class Window {
 		return false;
 	}
 
-	static function winGetRelativeMouseMode() : Bool { 
+	static function winGetRelativeMouseMode() : Bool {
 		return false;
 	}