Merge branch '8.1.0-Dev' into 8.2.0-Dev
This commit is contained in:
@@ -21,7 +21,7 @@ class AIRApplication extends FlashApplication
|
||||
{
|
||||
System.exit(0);
|
||||
|
||||
if (Application.current.onExit.canceled)
|
||||
if (Application.current != null && Application.current.onExit.canceled)
|
||||
{
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
|
||||
@@ -5,6 +5,7 @@ import flash.display.NativeWindow;
|
||||
import flash.display.NativeWindowInitOptions;
|
||||
import flash.display.NativeWindowRenderMode;
|
||||
import flash.display.NativeWindowSystemChrome;
|
||||
import flash.geom.Point;
|
||||
import flash.events.Event;
|
||||
import flash.events.NativeWindowBoundsEvent;
|
||||
import flash.html.HTMLLoader;
|
||||
@@ -231,6 +232,22 @@ class AIRWindow extends FlashWindow
|
||||
}
|
||||
}
|
||||
|
||||
public override function setMinSize(width:Int, height:Int):Void
|
||||
{
|
||||
if (nativeWindow != null)
|
||||
{
|
||||
nativeWindow.minSize = new Point(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public override function setMaxSize(width:Int, height:Int):Void
|
||||
{
|
||||
if (nativeWindow != null)
|
||||
{
|
||||
nativeWindow.maxSize = new Point(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public override function setMaximized(value:Bool):Bool
|
||||
{
|
||||
if (nativeWindow != null)
|
||||
|
||||
@@ -586,6 +586,10 @@ class FlashWindow
|
||||
|
||||
public function resize(width:Int, height:Int):Void {}
|
||||
|
||||
public function setMinSize(width:Int, height:Int):Void {}
|
||||
|
||||
public function setMaxSize(width:Int, height:Int):Void {}
|
||||
|
||||
public function setBorderless(value:Bool):Bool
|
||||
{
|
||||
return value;
|
||||
|
||||
@@ -325,7 +325,7 @@ class HTML5Application
|
||||
|
||||
if (!window.requestAnimationFrame)
|
||||
window.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var currTime = window.performance.now();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
|
||||
timeToCall);
|
||||
@@ -341,7 +341,7 @@ class HTML5Application
|
||||
window.requestAnimFrame = window.requestAnimationFrame;
|
||||
");
|
||||
|
||||
lastUpdate = Date.now().getTime();
|
||||
lastUpdate = Browser.window.performance.now();
|
||||
|
||||
handleApplicationEvent();
|
||||
|
||||
@@ -361,7 +361,7 @@ class HTML5Application
|
||||
|
||||
updateGameDevices();
|
||||
|
||||
currentUpdate = Date.now().getTime();
|
||||
currentUpdate = Browser.window.performance.now();
|
||||
|
||||
if (currentUpdate >= nextUpdate)
|
||||
{
|
||||
|
||||
@@ -444,7 +444,7 @@ class HTML5HTTPRequest
|
||||
|
||||
private static function __loadImage(uri:String, promise:Promise<Image>, options:Int):Void
|
||||
{
|
||||
var image = new JSImage();
|
||||
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()');
|
||||
|
||||
if (!__isSameOrigin(uri))
|
||||
{
|
||||
@@ -534,7 +534,7 @@ class HTML5HTTPRequest
|
||||
{
|
||||
if (request.readyState != 4) return;
|
||||
|
||||
if (request.status != null && ((request.status >= 200 && request.status <= 400) || (validStatus0 && request.status == 0)))
|
||||
if (request.status != null && ((request.status >= 200 && request.status < 400) || (validStatus0 && request.status == 0)))
|
||||
{
|
||||
processResponse();
|
||||
promise.complete(request.responseText);
|
||||
|
||||
@@ -250,6 +250,45 @@ class HTML5Window
|
||||
|
||||
public function close():Void
|
||||
{
|
||||
var element = parent.element;
|
||||
if (element != null)
|
||||
{
|
||||
if (canvas != null)
|
||||
{
|
||||
if (element != cast canvas)
|
||||
{
|
||||
element.removeChild(canvas);
|
||||
}
|
||||
canvas = null;
|
||||
}
|
||||
else if (div != null)
|
||||
{
|
||||
element.removeChild(div);
|
||||
div = null;
|
||||
}
|
||||
|
||||
var events = ["mousedown", "mouseenter", "mouseleave", "mousemove", "mouseup", "wheel"];
|
||||
|
||||
for (event in events)
|
||||
{
|
||||
element.removeEventListener(event, handleMouseEvent, true);
|
||||
}
|
||||
|
||||
element.removeEventListener("contextmenu", handleContextMenuEvent, true);
|
||||
|
||||
element.removeEventListener("dragstart", handleDragEvent, true);
|
||||
element.removeEventListener("dragover", handleDragEvent, true);
|
||||
element.removeEventListener("drop", handleDragEvent, true);
|
||||
|
||||
element.removeEventListener("touchstart", handleTouchEvent, true);
|
||||
element.removeEventListener("touchmove", handleTouchEvent, true);
|
||||
element.removeEventListener("touchend", handleTouchEvent, true);
|
||||
element.removeEventListener("touchcancel", handleTouchEvent, true);
|
||||
|
||||
element.removeEventListener("gamepadconnected", handleGamepadEvent, true);
|
||||
element.removeEventListener("gamepaddisconnected", handleGamepadEvent, true);
|
||||
}
|
||||
|
||||
parent.application.__removeWindow(parent);
|
||||
}
|
||||
|
||||
@@ -927,6 +966,10 @@ class HTML5Window
|
||||
|
||||
public function resize(width:Int, height:Int):Void {}
|
||||
|
||||
public function setMinSize(width:Int, height:Int):Void {}
|
||||
|
||||
public function setMaxSize(width:Int, height:Int):Void {}
|
||||
|
||||
public function setBorderless(value:Bool):Bool
|
||||
{
|
||||
return value;
|
||||
@@ -1130,7 +1173,7 @@ class HTML5Window
|
||||
textInput.type = 'text';
|
||||
#else
|
||||
// use password instead of text to avoid IME issues on Android
|
||||
textInput.type = 'password';
|
||||
textInput.type = Browser.navigator.userAgent.indexOf("Android") >= 0 ? 'password' : 'text';
|
||||
#end
|
||||
textInput.style.position = 'absolute';
|
||||
textInput.style.opacity = "0";
|
||||
|
||||
@@ -323,6 +323,10 @@ class NativeCFFI
|
||||
|
||||
@:cffi private static function lime_window_resize(handle:Dynamic, width:Int, height:Int):Void;
|
||||
|
||||
@:cffi private static function lime_window_set_minimum_size(handle:Dynamic, width:Int, height:Int):Void;
|
||||
|
||||
@:cffi private static function lime_window_set_maximum_size(handle:Dynamic, width:Int, height:Int):Void;
|
||||
|
||||
@:cffi private static function lime_window_set_borderless(handle:Dynamic, borderless:Bool):Bool;
|
||||
|
||||
@:cffi private static function lime_window_set_cursor(handle:Dynamic, cursor:Int):Void;
|
||||
@@ -582,6 +586,10 @@ class NativeCFFI
|
||||
"lime_window_read_pixels", "oooo", false));
|
||||
private static var lime_window_resize = new cpp.Callable<cpp.Object->Int->Int->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_window_resize", "oiiv",
|
||||
false));
|
||||
private static var lime_window_set_minimum_size = new cpp.Callable<cpp.Object->Int->Int->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_window_set_minimum_size", "oiiv",
|
||||
false));
|
||||
private static var lime_window_set_maximum_size = new cpp.Callable<cpp.Object->Int->Int->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_window_set_maximum_size", "oiiv",
|
||||
false));
|
||||
private static var lime_window_set_borderless = new cpp.Callable<cpp.Object->Bool->Bool>(cpp.Prime._loadPrime("lime", "lime_window_set_borderless", "obb",
|
||||
false));
|
||||
private static var lime_window_set_cursor = new cpp.Callable<cpp.Object->Int->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_window_set_cursor", "oiv",
|
||||
@@ -753,6 +761,8 @@ class NativeCFFI
|
||||
private static var lime_window_move = CFFI.load("lime", "lime_window_move", 3);
|
||||
private static var lime_window_read_pixels = CFFI.load("lime", "lime_window_read_pixels", 3);
|
||||
private static var lime_window_resize = CFFI.load("lime", "lime_window_resize", 3);
|
||||
private static var lime_window_set_minimum_size = CFFI.load("lime", "lime_window_set_minimum_size", 3);
|
||||
private static var lime_window_set_maximum_size = CFFI.load("lime", "lime_window_set_maximum_size", 3);
|
||||
private static var lime_window_set_borderless = CFFI.load("lime", "lime_window_set_borderless", 2);
|
||||
private static var lime_window_set_cursor = CFFI.load("lime", "lime_window_set_cursor", 2);
|
||||
private static var lime_window_set_display_mode = CFFI.load("lime", "lime_window_set_display_mode", 2);
|
||||
@@ -1324,6 +1334,10 @@ class NativeCFFI
|
||||
|
||||
@:hlNative("lime", "hl_window_resize") private static function lime_window_resize(handle:CFFIPointer, width:Int, height:Int):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_window_set_minimum_size") private static function lime_window_set_minimum_size(handle:CFFIPointer, width:Int, height:Int):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_window_set_maximum_size") private static function lime_window_set_maximum_size(handle:CFFIPointer, width:Int, height:Int):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_window_set_borderless") private static function lime_window_set_borderless(handle:CFFIPointer, borderless:Bool):Bool
|
||||
{
|
||||
return false;
|
||||
@@ -2294,7 +2308,7 @@ class NativeCFFI
|
||||
return null;
|
||||
}
|
||||
|
||||
@:hlNative("lime", "hl_al_filteri") private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void {}
|
||||
@:hlNative("lime", "hl_al_filteri") private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Int):Void {}
|
||||
|
||||
@:hlNative("lime", "hl_al_filterf") private static function lime_al_filterf(filter:CFFIPointer, param:Int, value:hl.F32):Void {}
|
||||
|
||||
|
||||
@@ -461,6 +461,26 @@ class NativeWindow
|
||||
}
|
||||
}
|
||||
|
||||
public function setMinSize(width:Int, height:Int):Void
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
#if (!macro && lime_cffi)
|
||||
NativeCFFI.lime_window_set_minimum_size(handle, width, height);
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
public function setMaxSize(width:Int, height:Int):Void
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
#if (!macro && lime_cffi)
|
||||
NativeCFFI.lime_window_set_maximum_size(handle, width, height);
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
public function setBorderless(value:Bool):Bool
|
||||
{
|
||||
if (handle != null)
|
||||
|
||||
@@ -514,7 +514,7 @@ class Application extends Module
|
||||
{
|
||||
application.onUpdate.add(update);
|
||||
application.onExit.add(onModuleExit, false, 0);
|
||||
application.onExit.add(__onModuleExit, false, 0);
|
||||
application.onExit.add(__onModuleExit, false, -1000);
|
||||
|
||||
for (gamepad in Gamepad.devices)
|
||||
{
|
||||
@@ -555,12 +555,15 @@ class Application extends Module
|
||||
|
||||
@:noCompletion private function __checkForAllWindowsClosed():Void
|
||||
{
|
||||
// air handles this automatically with NativeApplication.autoExit
|
||||
#if !air
|
||||
if (__windows.length == 0)
|
||||
{
|
||||
#if !lime_doc_gen
|
||||
System.exit(0);
|
||||
#end
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
@:noCompletion private function __onGamepadConnect(gamepad:Gamepad):Void
|
||||
@@ -587,7 +590,17 @@ class Application extends Module
|
||||
|
||||
@:noCompletion private function __onModuleExit(code:Int):Void
|
||||
{
|
||||
if (onExit.canceled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__unregisterLimeModule(this);
|
||||
__backend.exit();
|
||||
if (Application.current == this)
|
||||
{
|
||||
Application.current = null;
|
||||
}
|
||||
}
|
||||
|
||||
@:noCompletion private function __onWindowClose(window:Window):Void
|
||||
@@ -612,8 +625,6 @@ class Application extends Module
|
||||
Touch.onStart.remove(onTouchStart);
|
||||
Touch.onMove.remove(onTouchMove);
|
||||
Touch.onEnd.remove(onTouchEnd);
|
||||
|
||||
onModuleExit(0);
|
||||
}
|
||||
|
||||
// Get & Set Methods
|
||||
|
||||
@@ -1421,11 +1421,7 @@ class Image
|
||||
@:noCompletion private function __fromBase64(base64:String, type:String, onload:Image->Void = null):Void
|
||||
{
|
||||
#if (js && html5)
|
||||
#if (openfljs || genes)
|
||||
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()');
|
||||
#else
|
||||
var image = new JSImage();
|
||||
#end
|
||||
|
||||
var image_onLoaded = function(event)
|
||||
{
|
||||
@@ -1513,11 +1509,7 @@ class Image
|
||||
@:noCompletion private function __fromFile(path:String, onload:Image->Void = null, onerror:Void->Void = null):Bool
|
||||
{
|
||||
#if (js && html5)
|
||||
#if (openfljs || genes)
|
||||
var image:JSImage = untyped #if haxe4 js.Syntax.code #else __js__ #end ('new window.Image ()');
|
||||
#else
|
||||
var image = new JSImage();
|
||||
#end
|
||||
|
||||
#if !display
|
||||
if (!HTML5HTTPRequest.__isSameOrigin(path))
|
||||
|
||||
@@ -155,16 +155,15 @@ class CFFI
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
var slash = (__sysName().substr(7).toLowerCase() == "windows") ? "\\" : "/";
|
||||
var haxelib = __findHaxelib("lime");
|
||||
|
||||
if (haxelib != "")
|
||||
{
|
||||
result = __tryLoad(haxelib + slash + "ndll" + slash + __sysName() + slash + library, library, method, args);
|
||||
result = __tryLoad(haxelib + "/ndll/" + __sysName() + "/" + library, library, method, args);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = __tryLoad(haxelib + slash + "ndll" + slash + __sysName() + "64" + slash + library, library, method, args);
|
||||
result = __tryLoad(haxelib + "/ndll/" + __sysName() + "64/" + library, library, method, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,34 +285,35 @@ class CFFI
|
||||
{
|
||||
if (!__loadedNekoAPI)
|
||||
{
|
||||
var init:Dynamic = null;
|
||||
try
|
||||
{
|
||||
var init = load("lime", "neko_init", 5);
|
||||
|
||||
if (init != null)
|
||||
{
|
||||
__loaderTrace("Found nekoapi @ " + __moduleNames.get("lime"));
|
||||
init(function(s) return new String(s), function(len:Int)
|
||||
{
|
||||
var r = [];
|
||||
if (len > 0) r[len - 1] = null;
|
||||
return r;
|
||||
}, null, true, false);
|
||||
}
|
||||
else if (!lazy)
|
||||
{
|
||||
throw("Could not find NekoAPI interface.");
|
||||
}
|
||||
init = load("lime", "neko_init", 5);
|
||||
}
|
||||
catch (e:Dynamic)
|
||||
{
|
||||
if (!lazy)
|
||||
{
|
||||
throw("Could not find NekoAPI interface.");
|
||||
}
|
||||
}
|
||||
|
||||
__loadedNekoAPI = true;
|
||||
if (init != null)
|
||||
{
|
||||
__loaderTrace("Found nekoapi @ " + __moduleNames.get("lime"));
|
||||
init(function(s) return new String(s), function(len:Int)
|
||||
{
|
||||
var r = [];
|
||||
if (len > 0) r[len - 1] = null;
|
||||
return r;
|
||||
}, null, true, false);
|
||||
|
||||
__loadedNekoAPI = true;
|
||||
}
|
||||
else if (!lazy)
|
||||
{
|
||||
var ndllFolder = __findHaxelib("lime") + "/ndll/" + __sysName();
|
||||
throw "Could not find lime.ndll. This file is provided with Lime's Haxelib releases, but not via Git. "
|
||||
+ "Please copy it from Lime's latest Haxelib release into either "
|
||||
+ ndllFolder + " or " + ndllFolder + "64, as appropriate for your system. "
|
||||
+ "Advanced users may run `lime rebuild cpp` instead.";
|
||||
}
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -63,52 +63,12 @@ class JNI
|
||||
|
||||
public static function callMember(method:Dynamic, jobject:Dynamic, a:Array<Dynamic>):Dynamic
|
||||
{
|
||||
switch (a.length)
|
||||
{
|
||||
case 0:
|
||||
return method(jobject);
|
||||
case 1:
|
||||
return method(jobject, a[0]);
|
||||
case 2:
|
||||
return method(jobject, a[0], a[1]);
|
||||
case 3:
|
||||
return method(jobject, a[0], a[1], a[2]);
|
||||
case 4:
|
||||
return method(jobject, a[0], a[1], a[2], a[3]);
|
||||
case 5:
|
||||
return method(jobject, a[0], a[1], a[2], a[3], a[4]);
|
||||
case 6:
|
||||
return method(jobject, a[0], a[1], a[2], a[3], a[4], a[5]);
|
||||
case 7:
|
||||
return method(jobject, a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return Reflect.callMethod(null, method, [jobject].concat(a));
|
||||
}
|
||||
|
||||
public static function callStatic(method:Dynamic, a:Array<Dynamic>):Dynamic
|
||||
{
|
||||
switch (a.length)
|
||||
{
|
||||
case 0:
|
||||
return method();
|
||||
case 1:
|
||||
return method(a[0]);
|
||||
case 2:
|
||||
return method(a[0], a[1]);
|
||||
case 3:
|
||||
return method(a[0], a[1], a[2]);
|
||||
case 4:
|
||||
return method(a[0], a[1], a[2], a[3]);
|
||||
case 5:
|
||||
return method(a[0], a[1], a[2], a[3], a[4]);
|
||||
case 6:
|
||||
return method(a[0], a[1], a[2], a[3], a[4], a[5]);
|
||||
case 7:
|
||||
return method(a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return Reflect.callMethod(null, method, a);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -141,12 +141,13 @@ class System
|
||||
#if (!lime_doc_gen || sys)
|
||||
public static function exit(code:Int):Void
|
||||
{
|
||||
#if ((sys || air) && !macro)
|
||||
if (Application.current != null)
|
||||
var currentApp = Application.current;
|
||||
#if ((sys || (js && html5) || air) && !macro)
|
||||
if (currentApp != null)
|
||||
{
|
||||
Application.current.onExit.dispatch(code);
|
||||
currentApp.onExit.dispatch(code);
|
||||
|
||||
if (Application.current.onExit.canceled)
|
||||
if (currentApp.onExit.canceled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -155,6 +156,11 @@ class System
|
||||
|
||||
#if sys
|
||||
Sys.exit(code);
|
||||
#elseif (js && html5)
|
||||
if (currentApp != null && currentApp.window != null)
|
||||
{
|
||||
currentApp.window.close();
|
||||
}
|
||||
#elseif air
|
||||
NativeApplication.nativeApplication.exit(code);
|
||||
#end
|
||||
|
||||
@@ -149,12 +149,20 @@ class AIRHelper
|
||||
|
||||
if (project.debug)
|
||||
{
|
||||
args.push("-connect");
|
||||
|
||||
if (project.config.exists("air.connect"))
|
||||
{
|
||||
args.push("-connect");
|
||||
args.push(project.config.getString("air.connect"));
|
||||
}
|
||||
else if (project.config.exists("air.listen"))
|
||||
{
|
||||
args.push("-listen");
|
||||
args.push(project.config.getString("air.listen"));
|
||||
}
|
||||
else
|
||||
{
|
||||
args.push("-connect");
|
||||
}
|
||||
}
|
||||
|
||||
args = args.concat(signingOptions);
|
||||
@@ -204,9 +212,17 @@ class AIRHelper
|
||||
Sys.putEnv("AIR_NOANDROIDFLAIR", "true");
|
||||
}
|
||||
|
||||
if (targetPlatform == IOS)
|
||||
if (targetPlatform == IOS && System.hostPlatform == MAC)
|
||||
{
|
||||
Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", XCodeHelper.getSimulatorName(project));
|
||||
var simulatorName = XCodeHelper.getSimulatorName(project);
|
||||
if (simulatorName == null)
|
||||
{
|
||||
Log.warn("Skipping AIR_IOS_SIMULATOR_DEVICE environment variable because default simulator not found");
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys.putEnv("AIR_IOS_SIMULATOR_DEVICE", simulatorName);
|
||||
}
|
||||
}
|
||||
|
||||
System.runCommand(workingDirectory, project.defines.get("AIR_SDK") + "/bin/adt", args);
|
||||
|
||||
@@ -376,38 +376,18 @@ class HXProject extends Script
|
||||
|
||||
var tempDirectory = System.getTemporaryDirectory();
|
||||
var classFile = Path.combine(tempDirectory, name + ".hx");
|
||||
var nekoOutput = Path.combine(tempDirectory, name + ".n");
|
||||
|
||||
System.copyFile(path, classFile);
|
||||
|
||||
#if lime
|
||||
var args = [
|
||||
name,
|
||||
"-main",
|
||||
"lime.tools.HXProject",
|
||||
"-cp",
|
||||
tempDirectory,
|
||||
"-neko",
|
||||
nekoOutput,
|
||||
"-cp",
|
||||
Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src"),
|
||||
"-lib",
|
||||
"lime",
|
||||
"-lib",
|
||||
"hxp"
|
||||
#if lime
|
||||
"-lib", "lime",
|
||||
"-lib", "hxp",
|
||||
#end
|
||||
"-cp", tempDirectory,
|
||||
"-cp", Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src")
|
||||
];
|
||||
#else
|
||||
var args = [
|
||||
name,
|
||||
"--interp",
|
||||
"-main",
|
||||
"lime.tools.HXProject",
|
||||
"-cp",
|
||||
tempDirectory,
|
||||
"-cp",
|
||||
Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src")
|
||||
];
|
||||
#end
|
||||
var input = File.read(classFile, false);
|
||||
var tag = "@:compiler(";
|
||||
|
||||
@@ -430,10 +410,6 @@ class HXProject extends Script
|
||||
var cacheDryRun = System.dryRun;
|
||||
System.dryRun = false;
|
||||
|
||||
#if lime
|
||||
System.runCommand("", "haxe", args);
|
||||
#end
|
||||
|
||||
var inputFile = Path.combine(tempDirectory, "input.dat");
|
||||
var outputFile = Path.combine(tempDirectory, "output.dat");
|
||||
|
||||
@@ -457,10 +433,12 @@ class HXProject extends Script
|
||||
|
||||
try
|
||||
{
|
||||
#if lime
|
||||
System.runCommand("", "neko", [FileSystem.fullPath(nekoOutput), inputFile, outputFile]);
|
||||
#if (lime && !eval)
|
||||
var nekoOutput = FileSystem.fullPath(Path.combine(tempDirectory, name + ".n"));
|
||||
System.runCommand("", "haxe", args.concat(["--main", "lime.tools.HXProject", "-neko", nekoOutput]));
|
||||
System.runCommand("", "neko", [nekoOutput, inputFile, outputFile]);
|
||||
#else
|
||||
System.runCommand("", "haxe", args.concat(["--", inputFile, outputFile]));
|
||||
System.runCommand("", "haxe", args.concat(["--run", "lime.tools.HXProject", inputFile, outputFile]));
|
||||
#end
|
||||
}
|
||||
catch (e:Dynamic)
|
||||
@@ -540,37 +518,48 @@ class HXProject extends Script
|
||||
return HXProject.fromPath(path, userDefines);
|
||||
}
|
||||
|
||||
public static function fromPath(path:String, userDefines:Map<String, Dynamic> = null):HXProject
|
||||
public static function fromPath(directory:String, userDefines:Map<String, Dynamic> = null):HXProject
|
||||
{
|
||||
if (!FileSystem.exists(path) || !FileSystem.isDirectory(path))
|
||||
if (!FileSystem.exists(directory) || !FileSystem.isDirectory(directory))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var files = ["include.lime", "include.nmml", "include.xml"];
|
||||
var files = ["include.lime", "include.nmml", "include.xml", "include.hxp"];
|
||||
var projectFile = null;
|
||||
|
||||
for (file in files)
|
||||
{
|
||||
if (projectFile == null && FileSystem.exists(Path.combine(path, file)))
|
||||
if (FileSystem.exists(Path.combine(directory, file)))
|
||||
{
|
||||
projectFile = Path.combine(path, file);
|
||||
projectFile = Path.combine(directory, file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var project = null;
|
||||
|
||||
if (projectFile != null)
|
||||
{
|
||||
var project = new ProjectXMLParser(projectFile, userDefines);
|
||||
if (StringTools.endsWith(projectFile, ".hxp"))
|
||||
{
|
||||
var cwd = Sys.getCwd();
|
||||
Sys.setCwd(directory);
|
||||
project = HXProject.fromFile(projectFile, userDefines);
|
||||
Sys.setCwd(cwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
project = new ProjectXMLParser(projectFile, userDefines);
|
||||
}
|
||||
|
||||
if (project.config.get("project.rebuild.path") == null)
|
||||
{
|
||||
project.config.set("project.rebuild.path", Path.combine(path, "project"));
|
||||
project.config.set("project.rebuild.path", Path.combine(directory, "project"));
|
||||
}
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
return null;
|
||||
return project;
|
||||
}
|
||||
|
||||
private function getHaxelibVersion(haxelib:Haxelib):String
|
||||
|
||||
@@ -6,7 +6,7 @@ import lime.tools.HXProject;
|
||||
class XCodeHelper
|
||||
{
|
||||
private static inline var DEFAULT_IPAD_SIMULATOR = "ipad-air";
|
||||
private static inline var DEFAULT_IPHONE_SIMULATOR = "iphone-11";
|
||||
private static var DEFAULT_IPHONE_SIMULATOR_REGEX = ~/iphone-\d+/g;
|
||||
|
||||
private static function extractSimulatorFlagName(line:String):String
|
||||
{
|
||||
@@ -92,7 +92,14 @@ class XCodeHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDevice = devices.get(DEFAULT_IPHONE_SIMULATOR);
|
||||
for (device in devices.keys())
|
||||
{
|
||||
if (DEFAULT_IPHONE_SIMULATOR_REGEX.match(device))
|
||||
{
|
||||
currentDevice = devices.get(device);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,12 +108,22 @@ class XCodeHelper
|
||||
|
||||
public static function getSimulatorID(project:HXProject):String
|
||||
{
|
||||
return getSelectedSimulator(project).id;
|
||||
var simulator = getSelectedSimulator(project);
|
||||
if (simulator == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return simulator.id;
|
||||
}
|
||||
|
||||
public static function getSimulatorName(project:HXProject):String
|
||||
{
|
||||
return getSelectedSimulator(project).name;
|
||||
var simulator = getSelectedSimulator(project);
|
||||
if (simulator == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return simulator.name;
|
||||
}
|
||||
|
||||
private static function getSimulators():String
|
||||
|
||||
@@ -50,8 +50,12 @@ class Window
|
||||
public var height(get, set):Int;
|
||||
public var hidden(get, null):Bool;
|
||||
public var id(default, null):Int;
|
||||
public var maxHeight(get, set):Int;
|
||||
public var maximized(get, set):Bool;
|
||||
public var maxWidth(get, set):Int;
|
||||
public var minHeight(get, set):Int;
|
||||
public var minimized(get, set):Bool;
|
||||
public var minWidth(get, set):Int;
|
||||
public var mouseLock(get, set):Bool;
|
||||
public var onActivate(default, null) = new Event<Void->Void>();
|
||||
public var onClose(default, null) = new Event<Void->Void>();
|
||||
@@ -114,6 +118,10 @@ class Window
|
||||
@:noCompletion private var __width:Int;
|
||||
@:noCompletion private var __x:Int;
|
||||
@:noCompletion private var __y:Int;
|
||||
@:noCompletion private var __minWidth:Int;
|
||||
@:noCompletion private var __minHeight:Int;
|
||||
@:noCompletion private var __maxWidth:Int;
|
||||
@:noCompletion private var __maxHeight:Int;
|
||||
|
||||
#if commonjs
|
||||
private static function __init__()
|
||||
@@ -128,8 +136,12 @@ class Window
|
||||
"frameRate": {get: p.get_frameRate, set: p.set_frameRate},
|
||||
"fullscreen": {get: p.get_fullscreen, set: p.set_fullscreen},
|
||||
"height": {get: p.get_height, set: p.set_height},
|
||||
"maxHeight": {get: p.get_maxHeight, set: p.set_maxHeight},
|
||||
"maximized": {get: p.get_maximized, set: p.set_maximized},
|
||||
"maxWidth": {get: p.get_maxWidth, set: p.set_maxWidth},
|
||||
"minHeight": {get: p.get_minHeight, set: p.set_minHeight},
|
||||
"minimized": {get: p.get_minimized, set: p.set_minimized},
|
||||
"minWidth": {get: p.get_minWidth, set: p.set_minWidth},
|
||||
"mouseLock": {get: p.get_mouseLock, set: p.set_mouseLock},
|
||||
"resizable": {get: p.get_resizable, set: p.set_resizable},
|
||||
"scale": {get: p.get_scale},
|
||||
@@ -396,12 +408,57 @@ class Window
|
||||
|
||||
public function resize(width:Int, height:Int):Void
|
||||
{
|
||||
if (width < __minWidth)
|
||||
{
|
||||
width = __minWidth;
|
||||
}
|
||||
else if (width > __maxWidth)
|
||||
{
|
||||
width = __maxWidth;
|
||||
}
|
||||
if (height < __minHeight)
|
||||
{
|
||||
height = __minHeight;
|
||||
}
|
||||
else if (height > __maxHeight)
|
||||
{
|
||||
height = __maxHeight;
|
||||
}
|
||||
|
||||
__backend.resize(width, height);
|
||||
|
||||
__width = width;
|
||||
__height = height;
|
||||
}
|
||||
|
||||
public function setMinSize(width:Int, height:Int):Void
|
||||
{
|
||||
__backend.setMinSize(width, height);
|
||||
|
||||
__minWidth = width;
|
||||
__minHeight = height;
|
||||
if (__width < __minWidth) {
|
||||
__width = __minWidth;
|
||||
}
|
||||
if (__height < __minHeight) {
|
||||
__height = __minHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public function setMaxSize(width:Int, height:Int):Void
|
||||
{
|
||||
__backend.setMaxSize(width, height);
|
||||
|
||||
__maxWidth = width;
|
||||
__maxHeight = height;
|
||||
if (__width > __maxWidth) {
|
||||
__width = __maxWidth;
|
||||
}
|
||||
if (__height > __maxHeight) {
|
||||
__height = __maxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public function setIcon(image:Image):Void
|
||||
{
|
||||
if (image == null)
|
||||
@@ -494,6 +551,17 @@ class Window
|
||||
return __hidden;
|
||||
}
|
||||
|
||||
@:noCompletion private inline function get_maxHeight():Int
|
||||
{
|
||||
return __maxHeight;
|
||||
}
|
||||
|
||||
@:noCompletion private function set_maxHeight(value:Int):Int
|
||||
{
|
||||
setMaxSize(__maxWidth, value);
|
||||
return __maxHeight;
|
||||
}
|
||||
|
||||
@:noCompletion private inline function get_maximized():Bool
|
||||
{
|
||||
return __maximized;
|
||||
@@ -505,6 +573,28 @@ class Window
|
||||
return __maximized = __backend.setMaximized(value);
|
||||
}
|
||||
|
||||
@:noCompletion private inline function get_maxWidth():Int
|
||||
{
|
||||
return __maxWidth;
|
||||
}
|
||||
|
||||
@:noCompletion private function set_maxWidth(value:Int):Int
|
||||
{
|
||||
setMinSize(value, __maxHeight);
|
||||
return __maxWidth;
|
||||
}
|
||||
|
||||
@:noCompletion private inline function get_minHeight():Int
|
||||
{
|
||||
return __minHeight;
|
||||
}
|
||||
|
||||
@:noCompletion private function set_minHeight(value:Int):Int
|
||||
{
|
||||
setMinSize(__minWidth, value);
|
||||
return __minHeight;
|
||||
}
|
||||
|
||||
@:noCompletion private inline function get_minimized():Bool
|
||||
{
|
||||
return __minimized;
|
||||
@@ -516,6 +606,17 @@ class Window
|
||||
return __minimized = __backend.setMinimized(value);
|
||||
}
|
||||
|
||||
@:noCompletion private inline function get_minWidth():Int
|
||||
{
|
||||
return __minWidth;
|
||||
}
|
||||
|
||||
@:noCompletion private function set_minWidth(value:Int):Int
|
||||
{
|
||||
setMinSize(value, __minHeight);
|
||||
return __minWidth;
|
||||
}
|
||||
|
||||
@:noCompletion private function get_mouseLock():Bool
|
||||
{
|
||||
return __backend.getMouseLock();
|
||||
|
||||
@@ -492,6 +492,11 @@ class Assets
|
||||
|
||||
public static function registerLibrary(name:String, library:AssetLibrary):Void
|
||||
{
|
||||
if (name == null || name == "")
|
||||
{
|
||||
name = "default";
|
||||
}
|
||||
|
||||
if (libraries.exists(name))
|
||||
{
|
||||
if (libraries.get(name) == library)
|
||||
|
||||
Reference in New Issue
Block a user