diff --git a/hxd/Window.hl.hx b/hxd/Window.hl.hx index 308b63d63..6acd80a81 100644 --- a/hxd/Window.hl.hx +++ b/hxd/Window.hl.hx @@ -47,6 +47,8 @@ class Window { var dropFiles : Array; public var id : Int; + public var x(get, never) : Int; + public var y(get, never) : Int; public var width(get, never) : Int; public var height(get, never) : Int; public var mouseX(get, never) : Int; @@ -208,6 +210,12 @@ class Window { for( f in resizeEvents ) f(); } + public function setPosition(x: Int, y: Int) { + #if (hldx || hlsdl) + window.setPosition(x, y); + #end + } + public function addDragAndDropTarget( f : ( event : DropFileEvent ) -> Void ) : Void { if (dropTargets.length == 0) { #if (hlsdl >= version("1.14.0")) @@ -260,6 +268,14 @@ class Window { #end } + function get_x() : Int { + return window.x; + } + + function get_y() : Int { + return window.y; + } + function get_mouseX() : Int { return curMouseX; } diff --git a/hxd/Window.hx b/hxd/Window.hx index acdc8aeba..b79499da2 100644 --- a/hxd/Window.hx +++ b/hxd/Window.hx @@ -13,6 +13,8 @@ class Window { var resizeEvents : List Void>; var eventTargets : List Void>; + public var x(get, never) : Int; + public var y(get, never) : Int; public var width(get, never) : Int; public var height(get, never) : Int; public var mouseX(get, never) : Int; @@ -58,6 +60,9 @@ class Window { public function setIcon(icon: hxd.BitmapData) : Void { } + public function setPosition(x: Int, y: Int) { + } + public function event( e : hxd.Event ) : Void { for( et in eventTargets ) et(e); @@ -127,6 +132,14 @@ class Window { return inst; } + function get_x() : Int { + return 0; + } + + function get_y() : Int { + return 0; + } + function get_mouseX() : Int { return 0; } diff --git a/hxd/Window.js.hx b/hxd/Window.js.hx index 4c6b1966d..be2c37517 100644 --- a/hxd/Window.js.hx +++ b/hxd/Window.js.hx @@ -32,6 +32,8 @@ class Window { var eventTargets : List Void>; var dropTargets : List Void>; + public var x(get, never) : Int; + public var y(get, never) : Int; public var width(get, never) : Int; public var height(get, never) : Int; public var mouseX(get, never) : Int; @@ -253,6 +255,10 @@ class Window { public function resize( width : Int, height : Int ) : Void { } + public function setPosition(x: Int, y: Int) { + } + + public function addDragAndDropTarget( f : ( event : DropFileEvent ) -> Void ) : Void { if( dropTargets.length == 0 ) { var element = canvas; // Probably should adhere to `globalEvents`? @@ -335,6 +341,14 @@ class Window { return useScreenPixels ? Math.min(js.Browser.window.devicePixelRatio, maxPixelRatio) : 1; } + function get_x() : Int { + return Math.round(canvasPos.left); + } + + function get_y() : Int { + return Math.round(canvasPos.top); + } + function get_width() { return Math.round(canvasPos.width * getPixelRatio()); }