|
@@ -46,6 +46,9 @@ class Window {
|
|
var curMouseY = 0;
|
|
var curMouseY = 0;
|
|
|
|
|
|
static var CODEMAP = [for( i in 0...2048 ) i];
|
|
static var CODEMAP = [for( i in 0...2048 ) i];
|
|
|
|
+ #if hlsdl
|
|
|
|
+ static inline var TOUCH_SCALE = #if (hl_ver >= version("1.12.0")) 10000 #else 100 #end;
|
|
|
|
+ #end
|
|
|
|
|
|
function new(title:String, width:Int, height:Int, fixed:Bool = false) {
|
|
function new(title:String, width:Int, height:Int, fixed:Bool = false) {
|
|
this.windowWidth = width;
|
|
this.windowWidth = width;
|
|
@@ -255,12 +258,24 @@ class Window {
|
|
else
|
|
else
|
|
((c & 0x0F) << 18) | (((e.keyCode >> 8) & 0x7F) << 12) | (((e.keyCode >> 16) & 0x7F) << 6) | ((e.keyCode >> 24) & 0x7F);
|
|
((c & 0x0F) << 18) | (((e.keyCode >> 8) & 0x7F) << 12) | (((e.keyCode >> 16) & 0x7F) << 6) | ((e.keyCode >> 24) & 0x7F);
|
|
case TouchDown if (hxd.System.getValue(IsTouch)):
|
|
case TouchDown if (hxd.System.getValue(IsTouch)):
|
|
|
|
+ #if hlsdl
|
|
|
|
+ e.mouseX = Std.int(windowWidth * e.mouseX / TOUCH_SCALE);
|
|
|
|
+ e.mouseY = Std.int(windowHeight * e.mouseY / TOUCH_SCALE);
|
|
|
|
+ #end
|
|
eh = new Event(EPush, e.mouseX, e.mouseY);
|
|
eh = new Event(EPush, e.mouseX, e.mouseY);
|
|
eh.touchId = e.fingerId;
|
|
eh.touchId = e.fingerId;
|
|
case TouchMove if (hxd.System.getValue(IsTouch)):
|
|
case TouchMove if (hxd.System.getValue(IsTouch)):
|
|
|
|
+ #if hlsdl
|
|
|
|
+ e.mouseX = Std.int(windowWidth * e.mouseX / TOUCH_SCALE);
|
|
|
|
+ e.mouseY = Std.int(windowHeight * e.mouseY / TOUCH_SCALE);
|
|
|
|
+ #end
|
|
eh = new Event(EMove, e.mouseX, e.mouseY);
|
|
eh = new Event(EMove, e.mouseX, e.mouseY);
|
|
eh.touchId = e.fingerId;
|
|
eh.touchId = e.fingerId;
|
|
case TouchUp if (hxd.System.getValue(IsTouch)):
|
|
case TouchUp if (hxd.System.getValue(IsTouch)):
|
|
|
|
+ #if hlsdl
|
|
|
|
+ e.mouseX = Std.int(windowWidth * e.mouseX / TOUCH_SCALE);
|
|
|
|
+ e.mouseY = Std.int(windowHeight * e.mouseY / TOUCH_SCALE);
|
|
|
|
+ #end
|
|
eh = new Event(ERelease, e.mouseX, e.mouseY);
|
|
eh = new Event(ERelease, e.mouseX, e.mouseY);
|
|
eh.touchId = e.fingerId;
|
|
eh.touchId = e.fingerId;
|
|
#elseif hldx
|
|
#elseif hldx
|