Merge branch 'develop' into 8.2.0-Dev

This commit is contained in:
Joseph Cloutier
2024-01-13 23:35:33 -05:00
12 changed files with 140 additions and 52 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1,6 +1,6 @@
# These are supported funding model platforms # These are supported funding model platforms
github: [jgranick] github: [jgranick, joshtynjala]
patreon: openfl patreon: openfl
open_collective: openfl open_collective: openfl
ko_fi: # Replace with a single Ko-fi username ko_fi: # Replace with a single Ko-fi username

View File

@@ -36,7 +36,7 @@ jobs:
- name: Rebuild Lime tools - name: Rebuild Lime tools
run: | run: |
haxelib dev lime $GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime rebuild tools -nocolor -verbose -nocffi
haxelib run lime setup -alias -y -nocffi haxelib run lime setup -alias -y -nocffi
@@ -105,7 +105,7 @@ jobs:
- name: Rebuild Lime tools - name: Rebuild Lime tools
run: | run: |
haxelib dev lime $GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime rebuild tools -nocolor -verbose -nocffi
haxelib run lime setup -alias -y -nocffi haxelib run lime setup -alias -y -nocffi
@@ -157,7 +157,7 @@ jobs:
- name: Rebuild Lime tools - name: Rebuild Lime tools
run: | run: |
haxelib dev lime $Env:GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime rebuild tools -nocolor -verbose -nocffi
haxelib run lime setup -alias -y -nocffi haxelib run lime setup -alias -y -nocffi
@@ -236,7 +236,7 @@ jobs:
- name: Rebuild Lime tools - name: Rebuild Lime tools
run: | run: |
haxelib dev lime $GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime rebuild tools -nocolor -verbose -nocffi
haxelib run lime setup -alias -y -nocffi haxelib run lime setup -alias -y -nocffi
@@ -294,7 +294,7 @@ jobs:
- name: Rebuild Lime tools - name: Rebuild Lime tools
run: | run: |
haxelib dev lime $GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime rebuild tools -nocolor -verbose -nocffi
haxelib run lime setup -alias -y -nocffi haxelib run lime setup -alias -y -nocffi
@@ -317,7 +317,7 @@ jobs:
package-haxelib: package-haxelib:
needs: [linux-ndll, macos-ndll, windows-ndll, android-ndll, ios-ndll] needs: [linux-ndll, macos-ndll, windows-ndll, android-ndll, ios-ndll]
runs-on: macos-11 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -337,6 +337,8 @@ jobs:
haxelib install hxcpp 4.2.1 --quiet haxelib install hxcpp 4.2.1 --quiet
haxelib install format --quiet haxelib install format --quiet
haxelib install hxp --quiet haxelib install hxp --quiet
haxelib install svg --quiet
haxelib install openfl --quiet
- name: Enable HXCPP compile cache - name: Enable HXCPP compile cache
run: | run: |
@@ -344,10 +346,11 @@ jobs:
- name: Rebuild Lime tools - name: Rebuild Lime tools
run: | run: |
haxelib dev lime $GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime rebuild tools -nocolor -verbose -nocffi
haxelib run lime setup -alias -y -nocffi haxelib run lime setup -alias -y -nocffi
cp project/lib/hashlink/other/osx/entitlements.xml templates/bin/hl/entitlements.xml cp project/lib/hashlink/other/osx/entitlements.xml templates/bin/hl/entitlements.xml
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: Android-NDLL name: Android-NDLL
@@ -403,6 +406,11 @@ jobs:
name: Linux64-Hashlink name: Linux64-Hashlink
path: templates/bin/hl/Linux64 path: templates/bin/hl/Linux64
- name: Rebuild Lime svg.n
working-directory: tools
run: |
haxe svg.hxml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: lime-haxelib name: lime-haxelib
@@ -415,7 +423,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
docs: docs:
runs-on: macos-11 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -431,7 +439,7 @@ jobs:
- name: Install Haxe dependencies - name: Install Haxe dependencies
run: | run: |
haxelib install dox --quiet haxelib install dox --quiet
haxelib dev lime $GITHUB_WORKSPACE haxelib dev lime ${{ github.workspace }}
- name: Build docs - name: Build docs
working-directory: docs working-directory: docs
@@ -511,7 +519,7 @@ jobs:
flash-samples: flash-samples:
needs: package-haxelib needs: package-haxelib
runs-on: macos-11 runs-on: ubuntu-latest
steps: steps:
- uses: krdlab/setup-haxe@v1 - uses: krdlab/setup-haxe@v1
@@ -637,7 +645,7 @@ jobs:
html5-samples: html5-samples:
needs: package-haxelib needs: package-haxelib
runs-on: macos-11 runs-on: ubuntu-latest
steps: steps:
- uses: krdlab/setup-haxe@v1 - uses: krdlab/setup-haxe@v1

View File

@@ -1,7 +1,13 @@
Changelog Changelog
========= =========
8.1.0 (??/??/2023) 8.1.1 (11/08/2023)
------------------
* Fixed subset of characters escaped in file paths to fix Android builds on Windows.
* Fixed playback of very long sounds by changing arithmetic to avoid integer overflow.
8.1.0 (10/16/2023)
------------------ ------------------
* Added `visible` property to `Window` to allow it to be shown and hidden * Added `visible` property to `Window` to allow it to be shown and hidden
@@ -14,9 +20,8 @@ Changelog
* Added `-terser` option to Lime tools for html5 builds to optionally use Terser minifier * Added `-terser` option to Lime tools for html5 builds to optionally use Terser minifier
* Added `-npx` option to Lime tools to run minifiers, or Electron, using `npx` instead of the bundled versions * Added `-npx` option to Lime tools to run minifiers, or Electron, using `npx` instead of the bundled versions
* Updated the bundled version of Node.js to 18 LTS for the html5 target's HTTP server * Updated the bundled version of Node.js to 18 LTS for the html5 target's HTTP server
* Modernized Android Gradle build options * Exposed more information to _project.xml_, such as `${project.host}` and `${config.android.target-sdk-version}`
* Exposed more information to _project.xml_, including `${project.platformType}` and `${config.android.target-sdk-version}` * Updated the Android Gradle plugin
* Added click count for mouse events, for use by OpenFL
* Disabled pointer tagging on Android * Disabled pointer tagging on Android
* Fixed issues in `emscripten` target and renamed it to `webassembly` * Fixed issues in `emscripten` target and renamed it to `webassembly`
* Fixed unpopulated `responseData` on `HTTPRequest` when server returns error status code * Fixed unpopulated `responseData` on `HTTPRequest` when server returns error status code

View File

@@ -1,41 +1,65 @@
package sys; package sys;
import flash.filesystem.File in FlashFile;
import lime.utils.Log;
@:dce @:dce
@:coreApi @:coreApi
class FileSystem class FileSystem
{ {
public static function exists(path:String):Bool public static function exists(path:String):Bool
{ {
return false; return new FlashFile(path).exists;
} }
public static function rename(path:String, newPath:String):Void {} public static function rename(path:String, newPath:String):Void
{
new FlashFile(path).moveTo(new FlashFile(newPath));
}
public static function stat(path:String):sys.FileStat public static function stat(path:String):sys.FileStat
{ {
Log.warn("stat is not implemented");
return null; return null;
} }
public static function fullPath(relPath:String):String public static function fullPath(relPath:String):String
{ {
return null; var flashFile = new FlashFile(relPath);
flashFile.canonicalize();
return flashFile.nativePath;
} }
public static function absolutePath(relPath:String):String public static function absolutePath(relPath:String):String
{ {
return null; return new FlashFile(relPath).nativePath;
} }
public static function isDirectory(path:String):Bool public static function isDirectory(path:String):Bool
{ {
return false; return new FlashFile(path).isDirectory;
} }
public static function createDirectory(path:String):Void {} public static function createDirectory(path:String):Void
{
new FlashFile(path).createDirectory();
}
public static function deleteFile(path:String):Void {} public static function deleteFile(path:String):Void
{
new FlashFile(path).deleteFile();
}
public static function deleteDirectory(path:String):Void {} public static function deleteDirectory(path:String):Void
{
new FlashFile(path).deleteDirectory(false);
}
public static function readDirectory(path:String):Array<String> {} public static function readDirectory(path:String):Array<String>
{
return new FlashFile(path).getDirectoryListing().map(function(f:FlashFile):String
{
return f.name;
});
}
} }

View File

@@ -1,8 +1,11 @@
package sys.io; package sys.io;
import flash.utils.ByteArray;
import flash.filesystem.File in FlashFile; import flash.filesystem.File in FlashFile;
import flash.filesystem.FileMode; import flash.filesystem.FileMode;
import flash.filesystem.FileStream; import flash.filesystem.FileStream;
import lime.utils.Log;
import haxe.io.Bytes;
@:dce @:dce
@:coreApi @:coreApi
@@ -18,34 +21,62 @@ class File
return content; return content;
} }
public static function saveContent(path:String, content:String):Void {} public static function saveContent(path:String, content:String):Void
{
var file = new FlashFile(path);
var stream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTFBytes(content);
stream.close();
}
public static function getBytes(path:String):haxe.io.Bytes public static function getBytes(path:String):haxe.io.Bytes
{ {
return null; var file = new FlashFile(path);
var stream = new FileStream();
stream.open(file, FileMode.READ);
var byteArray = new ByteArray();
stream.readBytes(byteArray, 0, stream.bytesAvailable);
stream.close();
return Bytes.ofData(byteArray);
} }
public static function saveBytes(path:String, bytes:haxe.io.Bytes):Void {} public static function saveBytes(path:String, bytes:haxe.io.Bytes):Void
{
var byteArray:ByteArray = bytes.getData();
var file = new FlashFile(path);
var stream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeBytes(byteArray);
stream.close();
}
public static function read(path:String, binary:Bool = true):FileInput public static function read(path:String, binary:Bool = true):FileInput
{ {
Log.warn("read is not implemented");
return null; return null;
} }
public static function write(path:String, binary:Bool = true):FileOutput public static function write(path:String, binary:Bool = true):FileOutput
{ {
Log.warn("write is not implemented");
return null; return null;
} }
public static function append(path:String, binary:Bool = true):FileOutput public static function append(path:String, binary:Bool = true):FileOutput
{ {
Log.warn("append is not implemented");
return null; return null;
} }
public static function update(path:String, binary:Bool = true):FileOutput public static function update(path:String, binary:Bool = true):FileOutput
{ {
Log.warn("update is not implemented");
return null; return null;
} }
public static function copy(srcPath:String, dstPath:String):Void {} public static function copy(srcPath:String, dstPath:String):Void
{
new FlashFile(srcPath).copyTo(new FlashFile(dstPath));
}
} }

View File

@@ -136,7 +136,7 @@ class NativeAudioSource
} }
} }
samples = Std.int((dataLength * 8) / (parent.buffer.channels * parent.buffer.bitsPerSample)); samples = Std.int((dataLength * 8.0) / (parent.buffer.channels * parent.buffer.bitsPerSample));
} }
public function play():Void public function play():Void

View File

@@ -13,6 +13,13 @@ class WebAudioContext
public function new() {} public function new() {}
#if (haxe_ver >= 4.2)
public function resume():Dynamic /*Promise<Void>*/
{
return null;
}
#end
public function createAnalyser():Dynamic /*AnalyserNode*/ public function createAnalyser():Dynamic /*AnalyserNode*/
{ {
return null; return null;

View File

@@ -172,7 +172,7 @@ class ProjectHelper
var object:Dynamic = project; var object:Dynamic = project;
while (object != null && fields.length > 0) while (object != null && fields.length > 0)
{ {
object = Reflect.field(object, fields.shift()); object = Reflect.getProperty(object, fields.shift());
} }
if (object != null && object != project) if (object != null && object != project)

View File

@@ -54,8 +54,19 @@ class Joystick
#if (js && html5) #if (js && html5)
@:noCompletion private static function __getDeviceData():Array<Dynamic> @:noCompletion private static function __getDeviceData():Array<Dynamic>
{ {
return var res:Dynamic = null;
(untyped navigator.getGamepads) ? untyped navigator.getGamepads() : (untyped navigator.webkitGetGamepads) ? untyped navigator.webkitGetGamepads() : null;
try
{
res = (untyped navigator.getGamepads) ? untyped navigator.getGamepads() : (untyped navigator.webkitGetGamepads) ? untyped navigator.webkitGetGamepads() : null;
}
catch (err:Dynamic)
{
// if something went wrong, treat it the same as when navigator.getGamepads doesn't exist
// we probably don't have permission to use this feature
}
return res;
} }
#end #end

View File

@@ -93,7 +93,6 @@ import lime.utils.ArrayBufferView;
abstract Float32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView abstract Float32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView
{ {
public inline static var BYTES_PER_ELEMENT:Int = 4; public inline static var BYTES_PER_ELEMENT:Int = 4;
public static var hello:Int;
public var length(get, never):Int; public var length(get, never):Int;

View File

@@ -495,9 +495,8 @@ class AndroidPlatform extends PlatformTarget
context.ANDROID_BUILD_TOOLS_VERSION = AndroidHelper.getBuildToolsVersion(project); context.ANDROID_BUILD_TOOLS_VERSION = AndroidHelper.getBuildToolsVersion(project);
} }
var escaped = ~/([ #!=\\:])/g; context.ANDROID_SDK_ESCAPED = StringTools.replace(context.ENV_ANDROID_SDK, "\\", "\\\\");
context.ANDROID_SDK_ESCAPED = escaped.replace(context.ENV_ANDROID_SDK, "\\$1"); context.ANDROID_NDK_ROOT_ESCAPED = StringTools.replace(context.ENV_ANDROID_NDK_ROOT, "\\", "\\\\");
context.ANDROID_NDK_ROOT_ESCAPED = escaped.replace(context.ENV_ANDROID_NDK_ROOT, "\\$1");
if (Reflect.hasField(context, "KEY_STORE")) context.KEY_STORE = StringTools.replace(context.KEY_STORE, "\\", "\\\\"); if (Reflect.hasField(context, "KEY_STORE")) context.KEY_STORE = StringTools.replace(context.KEY_STORE, "\\", "\\\\");
if (Reflect.hasField(context, "KEY_STORE_ALIAS")) context.KEY_STORE_ALIAS = StringTools.replace(context.KEY_STORE_ALIAS, "\\", "\\\\"); if (Reflect.hasField(context, "KEY_STORE_ALIAS")) context.KEY_STORE_ALIAS = StringTools.replace(context.KEY_STORE_ALIAS, "\\", "\\\\");

View File

@@ -1118,21 +1118,25 @@ class PlatformSetup
} }
else else
{ {
System.runCommand("", "sudo", [ try
"cp", {
"-f", System.runCommand("", "sudo", [
Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", "cp",
"/usr/local/bin/lime" "-f",
], false); Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh",
System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); "/usr/local/bin/lime"
System.runCommand("", "sudo", [ ], false);
"cp", System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false);
"-f", System.runCommand("", "sudo", [
System.findTemplate(project.templatePaths, "bin/openfl.sh"), "cp",
"/usr/local/bin/openfl" "-f",
], false); System.findTemplate(project.templatePaths, "bin/openfl.sh"),
System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/openfl"], false); "/usr/local/bin/openfl"
installedCommand = true; ], false);
System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/openfl"], false);
installedCommand = true;
}
catch (e:Dynamic) {}
} }
} }