|
@@ -6,21 +6,22 @@ enum Cursor {
|
|
Move;
|
|
Move;
|
|
TextInput;
|
|
TextInput;
|
|
Hide;
|
|
Hide;
|
|
|
|
+ Custom( frames : Array<hxd.BitmapData>, speed : Float, offsetX : Int, offsetY : Int );
|
|
}
|
|
}
|
|
|
|
|
|
class System {
|
|
class System {
|
|
-
|
|
|
|
|
|
+
|
|
public static var width(get,never) : Int;
|
|
public static var width(get,never) : Int;
|
|
public static var height(get,never) : Int;
|
|
public static var height(get,never) : Int;
|
|
public static var isTouch(get,never) : Bool;
|
|
public static var isTouch(get,never) : Bool;
|
|
public static var isWindowed(get,never) : Bool;
|
|
public static var isWindowed(get,never) : Bool;
|
|
public static var lang(get,never) : String;
|
|
public static var lang(get,never) : String;
|
|
public static var isAndroid(get, never) : Bool;
|
|
public static var isAndroid(get, never) : Bool;
|
|
-
|
|
|
|
|
|
+
|
|
public static var screenDPI(get,never) : Float;
|
|
public static var screenDPI(get,never) : Float;
|
|
|
|
|
|
#if flash
|
|
#if flash
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isWindowed() {
|
|
static function get_isWindowed() {
|
|
var p = flash.system.Capabilities.playerType;
|
|
var p = flash.system.Capabilities.playerType;
|
|
return p == "ActiveX" || p == "PlugIn" || p == "StandAlone" || p == "Desktop";
|
|
return p == "ActiveX" || p == "PlugIn" || p == "StandAlone" || p == "Desktop";
|
|
@@ -39,17 +40,17 @@ class System {
|
|
var Cap = flash.system.Capabilities;
|
|
var Cap = flash.system.Capabilities;
|
|
return isWindowed ? flash.Lib.current.stage.stageHeight : Std.int(Cap.screenResolutionX > Cap.screenResolutionY ? Cap.screenResolutionY : Cap.screenResolutionX);
|
|
return isWindowed ? flash.Lib.current.stage.stageHeight : Std.int(Cap.screenResolutionX > Cap.screenResolutionY ? Cap.screenResolutionY : Cap.screenResolutionX);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isAndroid() {
|
|
static function get_isAndroid() {
|
|
return flash.system.Capabilities.manufacturer.indexOf('Android') != -1;
|
|
return flash.system.Capabilities.manufacturer.indexOf('Android') != -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_screenDPI() {
|
|
static function get_screenDPI() {
|
|
return flash.system.Capabilities.screenDPI;
|
|
return flash.system.Capabilities.screenDPI;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static var loop = null;
|
|
static var loop = null;
|
|
-
|
|
|
|
|
|
+
|
|
public static function setLoop( f : Void -> Void ) {
|
|
public static function setLoop( f : Void -> Void ) {
|
|
if( loop != null )
|
|
if( loop != null )
|
|
flash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, loop);
|
|
flash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, loop);
|
|
@@ -64,7 +65,7 @@ class System {
|
|
static function isAir() {
|
|
static function isAir() {
|
|
return flash.system.Capabilities.playerType == "Desktop";
|
|
return flash.system.Capabilities.playerType == "Desktop";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static function exit() {
|
|
public static function exit() {
|
|
if( isAir() ) {
|
|
if( isAir() ) {
|
|
var d : Dynamic = flash.Lib.current.loaderInfo.applicationDomain.getDefinition("flash.desktop.NativeApplication");
|
|
var d : Dynamic = flash.Lib.current.loaderInfo.applicationDomain.getDefinition("flash.desktop.NativeApplication");
|
|
@@ -72,9 +73,9 @@ class System {
|
|
} else
|
|
} else
|
|
flash.system.System.exit(0);
|
|
flash.system.System.exit(0);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static var setCursor = setNativeCursor;
|
|
public static var setCursor = setNativeCursor;
|
|
-
|
|
|
|
|
|
+
|
|
public static function setNativeCursor( c : Cursor ) {
|
|
public static function setNativeCursor( c : Cursor ) {
|
|
flash.ui.Mouse.cursor = switch( c ) {
|
|
flash.ui.Mouse.cursor = switch( c ) {
|
|
case Default: "auto";
|
|
case Default: "auto";
|
|
@@ -82,10 +83,19 @@ class System {
|
|
case Move: "hand";
|
|
case Move: "hand";
|
|
case TextInput: "ibeam";
|
|
case TextInput: "ibeam";
|
|
case Hide: "auto";
|
|
case Hide: "auto";
|
|
|
|
+ case Custom(frames, speed, offsetX, offsetY):
|
|
|
|
+ var customCursor = new flash.ui.MouseCursorData();
|
|
|
|
+ var v = new flash.Vector();
|
|
|
|
+ for( f in frames ) v.push(f.toNative());
|
|
|
|
+ customCursor.data = v;
|
|
|
|
+ customCursor.frameRate = speed;
|
|
|
|
+ customCursor.hotSpot = new flash.geom.Point(offsetX, offsetY);
|
|
|
|
+ flash.ui.Mouse.registerCursor("custom", customCursor);
|
|
|
|
+ "custom";
|
|
}
|
|
}
|
|
if( c == Hide ) flash.ui.Mouse.hide() else flash.ui.Mouse.show();
|
|
if( c == Hide ) flash.ui.Mouse.hide() else flash.ui.Mouse.show();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the device name:
|
|
Returns the device name:
|
|
@@ -117,12 +127,12 @@ class System {
|
|
static function get_lang() {
|
|
static function get_lang() {
|
|
return flash.system.Capabilities.language;
|
|
return flash.system.Capabilities.language;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
#elseif js
|
|
#elseif js
|
|
|
|
|
|
static var LOOP = null;
|
|
static var LOOP = null;
|
|
static var LOOP_INIT = false;
|
|
static var LOOP_INIT = false;
|
|
-
|
|
|
|
|
|
+
|
|
static function loopFunc() {
|
|
static function loopFunc() {
|
|
var window : Dynamic = js.Browser.window;
|
|
var window : Dynamic = js.Browser.window;
|
|
var rqf : Dynamic = window.requestAnimationFrame ||
|
|
var rqf : Dynamic = window.requestAnimationFrame ||
|
|
@@ -131,7 +141,7 @@ class System {
|
|
rqf(loopFunc);
|
|
rqf(loopFunc);
|
|
if( LOOP != null ) LOOP();
|
|
if( LOOP != null ) LOOP();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static function setLoop( f : Void -> Void ) {
|
|
public static function setLoop( f : Void -> Void ) {
|
|
if( !LOOP_INIT ) {
|
|
if( !LOOP_INIT ) {
|
|
LOOP_INIT = true;
|
|
LOOP_INIT = true;
|
|
@@ -141,7 +151,7 @@ class System {
|
|
}
|
|
}
|
|
|
|
|
|
public static var setCursor = setNativeCursor;
|
|
public static var setCursor = setNativeCursor;
|
|
-
|
|
|
|
|
|
+
|
|
public static function setNativeCursor( c : Cursor ) {
|
|
public static function setNativeCursor( c : Cursor ) {
|
|
var canvas = js.Browser.document.getElementById("webgl");
|
|
var canvas = js.Browser.document.getElementById("webgl");
|
|
if( canvas != null ) {
|
|
if( canvas != null ) {
|
|
@@ -151,42 +161,43 @@ class System {
|
|
case Move: "move";
|
|
case Move: "move";
|
|
case TextInput: "text";
|
|
case TextInput: "text";
|
|
case Hide: "none";
|
|
case Hide: "none";
|
|
|
|
+ case Custom(_): throw "Custom cursor not supported";
|
|
};
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_lang() {
|
|
static function get_lang() {
|
|
return "en";
|
|
return "en";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_screenDPI() {
|
|
static function get_screenDPI() {
|
|
return 72.;
|
|
return 72.;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isAndroid() {
|
|
static function get_isAndroid() {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isWindowed() {
|
|
static function get_isWindowed() {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isTouch() {
|
|
static function get_isTouch() {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_width() {
|
|
static function get_width() {
|
|
return js.Browser.document.width;
|
|
return js.Browser.document.width;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_height() {
|
|
static function get_height() {
|
|
return js.Browser.document.height;
|
|
return js.Browser.document.height;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
#elseif openfl
|
|
#elseif openfl
|
|
|
|
|
|
static var VIEW = null;
|
|
static var VIEW = null;
|
|
-
|
|
|
|
|
|
+
|
|
public static function setLoop( f : Void -> Void ) {
|
|
public static function setLoop( f : Void -> Void ) {
|
|
if( VIEW == null ) {
|
|
if( VIEW == null ) {
|
|
VIEW = new openfl.display.OpenGLView();
|
|
VIEW = new openfl.display.OpenGLView();
|
|
@@ -196,7 +207,7 @@ class System {
|
|
}
|
|
}
|
|
|
|
|
|
public static var setCursor = setNativeCursor;
|
|
public static var setCursor = setNativeCursor;
|
|
-
|
|
|
|
|
|
+
|
|
public static function setNativeCursor( c : Cursor ) {
|
|
public static function setNativeCursor( c : Cursor ) {
|
|
/* not supported by openFL
|
|
/* not supported by openFL
|
|
flash.ui.Mouse.cursor = switch( c ) {
|
|
flash.ui.Mouse.cursor = switch( c ) {
|
|
@@ -206,15 +217,15 @@ class System {
|
|
case TextInput: "ibeam";
|
|
case TextInput: "ibeam";
|
|
}*/
|
|
}*/
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_lang() {
|
|
static function get_lang() {
|
|
return flash.system.Capabilities.language.split("-")[0];
|
|
return flash.system.Capabilities.language.split("-")[0];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_screenDPI() {
|
|
static function get_screenDPI() {
|
|
return flash.system.Capabilities.screenDPI;
|
|
return flash.system.Capabilities.screenDPI;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isAndroid() {
|
|
static function get_isAndroid() {
|
|
#if android
|
|
#if android
|
|
return true;
|
|
return true;
|
|
@@ -240,7 +251,7 @@ class System {
|
|
CACHED_NAME = name;
|
|
CACHED_NAME = name;
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static function exit() {
|
|
public static function exit() {
|
|
Sys.exit(0);
|
|
Sys.exit(0);
|
|
}
|
|
}
|
|
@@ -248,11 +259,11 @@ class System {
|
|
static function get_isWindowed() {
|
|
static function get_isWindowed() {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_isTouch() {
|
|
static function get_isTouch() {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function get_width() {
|
|
static function get_width() {
|
|
var Cap = flash.system.Capabilities;
|
|
var Cap = flash.system.Capabilities;
|
|
return isWindowed ? flash.Lib.current.stage.stageWidth : Std.int(Cap.screenResolutionX > Cap.screenResolutionY ? Cap.screenResolutionX : Cap.screenResolutionY);
|
|
return isWindowed ? flash.Lib.current.stage.stageWidth : Std.int(Cap.screenResolutionX > Cap.screenResolutionY ? Cap.screenResolutionX : Cap.screenResolutionY);
|
|
@@ -264,5 +275,5 @@ class System {
|
|
}
|
|
}
|
|
|
|
|
|
#end
|
|
#end
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|