Merge branch 'develop' into 8.2.0-Dev

This commit is contained in:
Joseph Cloutier
2024-02-05 14:46:33 -05:00
11 changed files with 162 additions and 72 deletions

View File

@@ -10,6 +10,9 @@ import flash.desktop.Clipboard as FlashClipboard;
import lime._internal.backend.html5.HTML5Window;
#end
/**
Reads and writes text on the system clipboard.
**/
#if !lime_debug
@:fileXml('tags="haxe,release"')
@:noDebug
@@ -18,8 +21,16 @@ import lime._internal.backend.html5.HTML5Window;
@:access(lime.ui.Window)
class Clipboard
{
/**
Dispatched when the clipboard text changes.
**/
public static var onUpdate = new Event<Void->Void>();
/**
The text currently stored in the clipboard.
**/
public static var text(get, set):String;
private static var _text:String;
@:noCompletion private static var __updated = false;

View File

@@ -25,6 +25,9 @@ import js.Browser;
import sys.io.Process;
#end
/**
Access operating system level settings and operations.
**/
#if !lime_debug
@:fileXml('tags="haxe,release"')
@:noDebug
@@ -44,21 +47,68 @@ extern "C" {
#end
class System
{
/**
Determines if the screen saver is allowed to start or not.
**/
public static var allowScreenTimeout(get, set):Bool;
/**
The path to the directory where the application is installed, along with
its supporting files. In many cases, this directory is read-only, and
attempts to write to files, create new files, or delete files in this
directory are likely fail.
**/
public static var applicationDirectory(get, never):String;
/**
The application's dedicated storage directory, which unique to each
application and user. Useful for storing settings on a user-specific
and application-specific basis.
This directory may or may not be removed when the application is
uninstalled, and it depends on the platform and installer technology
that is used.
**/
public static var applicationStorageDirectory(get, never):String;
/**
The path to the directory containing the user's desktop.
**/
public static var desktopDirectory(get, never):String;
public static var deviceModel(get, never):String;
public static var deviceVendor(get, never):String;
public static var disableCFFI:Bool;
/**
The path to the directory containing the user's documents.
**/
public static var documentsDirectory(get, never):String;
/**
The platform's default endianness for bytes.
**/
public static var endianness(get, never):Endian;
/**
The path to the directory where fonts are installed.
**/
public static var fontsDirectory(get, never):String;
/**
The number of available video displays.
**/
public static var numDisplays(get, never):Int;
public static var platformLabel(get, never):String;
public static var platformName(get, never):String;
public static var platformVersion(get, never):String;
/**
The path to the user's home directory.
**/
public static var userDirectory(get, never):String;
@:noCompletion private static var __applicationDirectory:String;
@:noCompletion private static var __applicationEntryPoint:Map<String, Function>;
@:noCompletion private static var __applicationStorageDirectory:String;
@@ -139,6 +189,10 @@ class System
#end
#if (!lime_doc_gen || sys)
/**
Attempts to exit the application. Dispatches `onExit`, and will not
exit if the event is canceled.
**/
public static function exit(code:Int):Void
{
var currentApp = Application.current;
@@ -167,6 +221,9 @@ class System
}
#end
/**
Returns information about the video display with the specified ID.
**/
public static function getDisplay(id:Int):Display
{
#if (lime_cffi && !macro)
@@ -261,6 +318,9 @@ class System
return null;
}
/**
The number of milliseconds since the application was initialized.
**/
public static function getTimer():Int
{
#if flash
@@ -289,6 +349,11 @@ class System
}
#end
/**
Opens a file with the suste, default application.
In a web browser, opens a URL with target `_blank`.
**/
public static function openFile(path:String):Void
{
if (path != null)
@@ -312,6 +377,9 @@ class System
}
}
/**
Opens a URL with the specified target web browser window.
**/
public static function openURL(url:String, target:String = "_blank"):Void
{
if (url != null)

View File

@@ -190,7 +190,9 @@ class Font
{
#if (lime_cffi && !macro)
var glyphs:Dynamic = NativeCFFI.lime_font_get_glyph_indices(src, characters);
return glyphs;
// lime_font_get_glyph_indices returns Array<Int>
// cast it to Array<Glyph> instead (Glyph is an abstract)
return cast glyphs;
#else
return null;
#end

View File

@@ -1250,17 +1250,10 @@ class HXProject extends Script
{
var cache = Log.verbose;
Log.verbose = Haxelib.debug;
var output = "";
try
{
output = Haxelib.runProcess("", ["path", name], true, true, true);
}
catch (e:Dynamic) {}
var output = Haxelib.runProcess("", ["path", name], true, true, true);
Log.verbose = cache;
var split = output.split("\n");
var split = output != null ? output.split("\n") : [];
var haxelibName = null;
for (arg in split)

View File

@@ -60,10 +60,10 @@ class HashlinkHelper
{
System.copyFile(msvcrPath, Path.combine(applicationDirectory, "msvcr120.dll"));
}
var vcruntimePath = Path.combine(hlPath, "vcruntime.dll.dll");
var vcruntimePath = Path.combine(hlPath, "vcruntime140.dll");
if (FileSystem.exists(vcruntimePath))
{
System.copyFile(vcruntimePath, Path.combine(applicationDirectory, "vcruntime.dll"));
System.copyFile(vcruntimePath, Path.combine(applicationDirectory, "vcruntime140.dll"));
}
}
else if (platform == MAC || platform == IOS)

View File

@@ -200,7 +200,7 @@ class AssetLibrary
}
else
{
return AudioBuffer.fromFile(paths.get(id));
return AudioBuffer.fromFile(getPath(id));
}
}
@@ -239,7 +239,7 @@ class AssetLibrary
}
else
{
return Bytes.fromFile(paths.get(id));
return Bytes.fromFile(getPath(id));
}
}
@@ -263,7 +263,7 @@ class AssetLibrary
}
else
{
return Font.fromFile(paths.get(id));
return Font.fromFile(getPath(id));
}
}
@@ -283,7 +283,7 @@ class AssetLibrary
}
else
{
return Image.fromFile(paths.get(id));
return Image.fromFile(getPath(id));
}
}
@@ -498,7 +498,7 @@ class AssetLibrary
}
else
{
return Bytes.loadFromFile(paths.get(id));
return Bytes.loadFromFile(getPath(id));
}
}
@@ -521,9 +521,9 @@ class AssetLibrary
else
{
#if (js && html5)
return Font.loadFromName(paths.get(id));
return Font.loadFromName(getPath(id));
#else
return Font.loadFromFile(paths.get(id));
return Font.loadFromFile(getPath(id));
#end
}
}
@@ -579,7 +579,7 @@ class AssetLibrary
}
else
{
return Image.loadFromFile(paths.get(id));
return Image.loadFromFile(getPath(id));
}
}
@@ -607,7 +607,7 @@ class AssetLibrary
else
{
var request = new HTTPRequest<String>();
return request.load(paths.get(id));
return request.load(getPath(id));
}
}

View File

@@ -242,7 +242,8 @@ import flash.media.Sound;
else
{
var basePath = rootPath == null || rootPath == "" ? "" : Path.addTrailingSlash(rootPath);
var libPath = paths.exists(id) ? paths.get(id) : id;
var libPath = getPath(id);
if (libPath == null) libPath = id;
var path = Path.join([basePath, libPath]);
path = __cacheBreak(path);