Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions hxd/Window.hl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Window {
var dropFiles : Array<hxd.DropFileEvent.DroppedFile>;

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;
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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;
}
Expand Down
13 changes: 13 additions & 0 deletions hxd/Window.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Window {
var resizeEvents : List<Void -> Void>;
var eventTargets : List<Event -> 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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 14 additions & 0 deletions hxd/Window.js.hx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Window {
var eventTargets : List<Event -> Void>;
var dropTargets : List<DropFileEvent -> 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;
Expand Down Expand Up @@ -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`?
Expand Down Expand Up @@ -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());
}
Expand Down