From 3c431559df702cfffa2a2b9399a5ebcfee6b8531 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 17 Jul 2023 14:49:45 -0400 Subject: [PATCH 01/15] Always use `getPath` instead of `paths.get()` directly. --- src/lime/utils/AssetLibrary.hx | 20 ++++++++++---------- src/lime/utils/PackedAssetLibrary.hx | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lime/utils/AssetLibrary.hx b/src/lime/utils/AssetLibrary.hx index b368f7954..82451f7a3 100644 --- a/src/lime/utils/AssetLibrary.hx +++ b/src/lime/utils/AssetLibrary.hx @@ -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)); } } @@ -477,7 +477,7 @@ class AssetLibrary } else { - return AudioBuffer.loadFromFile(paths.get(id)); + return AudioBuffer.loadFromFile(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(); - return request.load(paths.get(id)); + return request.load(getPath(id)); } } diff --git a/src/lime/utils/PackedAssetLibrary.hx b/src/lime/utils/PackedAssetLibrary.hx index dd976c22e..f99b0df82 100644 --- a/src/lime/utils/PackedAssetLibrary.hx +++ b/src/lime/utils/PackedAssetLibrary.hx @@ -242,7 +242,7 @@ import flash.media.Sound; else { var basePath = rootPath == null || rootPath == "" ? "" : Path.addTrailingSlash(rootPath); - var libPath = paths.exists(id) ? paths.get(id) : id; + var libPath = paths.exists(id) ? getPath(id) : id; var path = Path.join([basePath, libPath]); path = __cacheBreak(path); From 186124dfd3ffd62c5c786210c661cca7005bb126 Mon Sep 17 00:00:00 2001 From: tobil4sk Date: Thu, 27 Apr 2023 18:56:58 +0100 Subject: [PATCH 02/15] Avoid error `no such file or directory: 'arm64'` --- tools/platforms/IOSPlatform.hx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 8a8736a4f..9d5fa3346 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -475,8 +475,7 @@ class IOSPlatform extends PlatformTarget public override function rebuild():Void { var armv6 = (project.architectures.indexOf(Architecture.ARMV6) > -1 && !project.targetFlags.exists("simulator")); - var armv7 = (command == "rebuild" - || (project.architectures.indexOf(Architecture.ARMV7) > -1 && !project.targetFlags.exists("simulator"))); + var armv7 = (project.architectures.indexOf(Architecture.ARMV7) > -1 && !project.targetFlags.exists("simulator")); var armv7s = (project.architectures.indexOf(Architecture.ARMV7S) > -1 && !project.targetFlags.exists("simulator")); var arm64 = (command == "rebuild" || (project.architectures.indexOf(Architecture.ARM64) > -1 && !project.targetFlags.exists("simulator"))); From a48898849e34ec9e81147d374b62e4091dd2bc77 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Wed, 10 Jan 2024 10:11:11 -0800 Subject: [PATCH 03/15] actions: use github.workspace instead of platform specific environment variables syntax --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09a0df57c..2052c66a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -105,7 +105,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -157,7 +157,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $Env:GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -236,7 +236,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -294,7 +294,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi @@ -346,7 +346,7 @@ jobs: - name: Rebuild Lime tools run: | - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} haxelib run lime rebuild tools -nocolor -verbose -nocffi haxelib run lime setup -alias -y -nocffi cp project/lib/hashlink/other/osx/entitlements.xml templates/bin/hl/entitlements.xml @@ -439,7 +439,7 @@ jobs: - name: Install Haxe dependencies run: | haxelib install dox --quiet - haxelib dev lime $GITHUB_WORKSPACE + haxelib dev lime ${{ github.workspace }} - name: Build docs working-directory: docs From 8648b0599103c9cebb5a9546ca9e1af503f729eb Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Tue, 16 Jan 2024 15:15:06 +0200 Subject: [PATCH 04/15] Update AndroidPlatform.hx --- tools/platforms/AndroidPlatform.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 9372437ee..010066f00 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -145,7 +145,7 @@ class AndroidPlatform extends PlatformTarget var architectures = []; if (hasARMV5) architectures.push(Architecture.ARMV5); - if (hasARMV7 || (!hasARMV5 && !hasX86)) architectures.push(Architecture.ARMV7); + if (hasARMV7) architectures.push(Architecture.ARMV7); if (hasARM64) architectures.push(Architecture.ARM64); if (hasX86) architectures.push(Architecture.X86); if (hasX64) architectures.push(Architecture.X64); From 1f0ddb34cbe6c80ebf7194e82116e7b24998c0e1 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Wed, 17 Jan 2024 05:59:08 +0200 Subject: [PATCH 05/15] Just in case --- tools/platforms/AndroidPlatform.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 010066f00..916694981 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -150,6 +150,8 @@ class AndroidPlatform extends PlatformTarget if (hasX86) architectures.push(Architecture.X86); if (hasX64) architectures.push(Architecture.X64); + if (architectures.length == 0) architectures.push(Architecture.ARM64); + for (architecture in architectures) { var haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-21"]; From 380f64cb6ef96d0d548da44c0e23493035b6fb3b Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Wed, 17 Jan 2024 06:17:00 +0200 Subject: [PATCH 06/15] Forgot this --- tools/platforms/AndroidPlatform.hx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 916694981..9bcad5a4b 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -150,7 +150,12 @@ class AndroidPlatform extends PlatformTarget if (hasX86) architectures.push(Architecture.X86); if (hasX64) architectures.push(Architecture.X64); - if (architectures.length == 0) architectures.push(Architecture.ARM64); + if (architectures.length == 0) + { + hasARM64 = true; + + architectures.push(Architecture.ARM64); + } for (architecture in architectures) { From d6a3954a57143fd7aacd7bb06900641088667c0a Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Wed, 17 Jan 2024 06:34:40 +0200 Subject: [PATCH 07/15] Also warn the user about it. --- tools/platforms/AndroidPlatform.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index 9bcad5a4b..f9f7d8bf0 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -152,6 +152,8 @@ class AndroidPlatform extends PlatformTarget if (architectures.length == 0) { + Log.warn("No architecture selected, resorting to arm64."); + hasARM64 = true; architectures.push(Architecture.ARM64); From a414f641735545ba073fb5a9d9ecb948112cde03 Mon Sep 17 00:00:00 2001 From: player-03 Date: Thu, 18 Jan 2024 13:22:05 -0500 Subject: [PATCH 08/15] Optimize CI workflow. (#1743) See pull request for details. Summary: * Reduce dependencies between CI jobs, allowing more of them to run in parallel. * Use Linux for as many jobs as possible. * Merge matching "-ndll" and "-samples" jobs. This way, the latter doesn't have to waste time recreating the former's environment, and the workflow summary is simplified. Downside: this delays package-haxelib. * Update to a newer macOS version, as the old version massively slowed down Homebrew. * Skip the HelloWorld test for Mac and iOS, as those two can build slowly under some circumstances, delaying package-haxelib. These could be restored later, if performance seems good enough. * Add `HAXE_VERSION` environment variable, so future updates will only have to make one change. Unfortunately, doing the same for the Windows/Mac/Linux versions would severely hurt performance, so those remain hard-coded. * Split up some steps within jobs for better organization. --- .github/workflows/main.yml | 609 ++++++++++++------------------- src/lime/tools/PlatformTarget.hx | 67 ++-- 2 files changed, 269 insertions(+), 407 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2052c66a9..31fd3c001 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,12 @@ name: CI on: [push, pull_request] +env: + HAXE_VERSION: 4.2.5 + jobs: - linux-ndll: + linux: runs-on: ubuntu-20.04 steps: @@ -18,7 +21,7 @@ jobs: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -69,8 +72,27 @@ jobs: templates/bin/hl/Linux64 if-no-files-found: error - macos-ndll: - runs-on: macos-11 + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld linux -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage linux -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio linux -release -verbose -nocolor + + macos: + runs-on: macos-12 steps: - uses: actions/checkout@v3 @@ -79,13 +101,13 @@ jobs: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV - - name: Install Haxe dependencies + - name: Install HashLink dependencies run: | pushd project/lib/hashlink brew update @@ -95,6 +117,9 @@ jobs: rm /usr/local/bin/python3* brew bundle popd + + - name: Install Haxe dependencies + run: | haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -129,7 +154,26 @@ jobs: templates/bin/hl/Mac64 if-no-files-found: error - windows-ndll: + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + # - name: Build HelloWorld sample + # run: | + # lime create HelloWorld -verbose -nocolor + # lime build HelloWorld macos -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage macos -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio macos -release -verbose -nocolor + + windows: runs-on: windows-latest steps: @@ -139,7 +183,7 @@ jobs: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -196,9 +240,27 @@ jobs: templates/bin/hl/Windows64 if-no-files-found: error - android-ndll: - needs: macos-ndll - runs-on: macos-11 + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld windows -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage windows -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio windows -release -verbose -nocolor + + android: + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -218,7 +280,7 @@ jobs: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -234,28 +296,22 @@ jobs: run: | echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV - - name: Rebuild Lime tools + - name: Prepare Lime run: | haxelib dev lime ${{ github.workspace }} - haxelib run lime rebuild tools -nocolor -verbose -nocffi - haxelib run lime setup -alias -y -nocffi - - - uses: actions/download-artifact@v3 - with: - name: Mac64-NDLL - path: ndll/Mac64/ + haxelib run lime setup -alias -y -nocffi -eval - name: Configure Android support run: | - lime config ANDROID_SDK $ANDROID_HOME - lime config ANDROID_NDK_ROOT ${{ steps.setup-ndk.outputs.ndk-path }} - lime config JAVA_HOME $JAVA_HOME - lime config ANDROID_SETUP true - lime config + lime config ANDROID_SDK $ANDROID_HOME -eval + lime config ANDROID_NDK_ROOT ${{ steps.setup-ndk.outputs.ndk-path }} -eval + lime config JAVA_HOME $JAVA_HOME -eval + lime config ANDROID_SETUP true -eval + lime config -eval - name: Rebuild Lime (Android) run: | - lime rebuild android -release -nocolor -verbose -nocffi + lime rebuild android -release -nocolor -verbose -nocffi -eval - uses: actions/upload-artifact@v3 with: @@ -265,9 +321,26 @@ jobs: !**/.gitignore if-no-files-found: error - ios-ndll: - needs: macos-ndll - runs-on: macos-11 + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld android -release -verbose -nocolor -eval + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage android -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio android -release -verbose -nocolor -eval + ios: + runs-on: macos-12 steps: - uses: actions/checkout@v3 @@ -276,7 +349,7 @@ jobs: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -292,20 +365,14 @@ jobs: run: | echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV - - name: Rebuild Lime tools + - name: Prepare Lime run: | haxelib dev lime ${{ github.workspace }} - haxelib run lime rebuild tools -nocolor -verbose -nocffi - haxelib run lime setup -alias -y -nocffi - - - uses: actions/download-artifact@v3 - with: - name: Mac64-NDLL - path: ndll/Mac64/ + haxelib run lime setup -alias -y -nocffi -eval - name: Rebuild Lime (iOS) run: | - lime rebuild ios -clean -release -verbose -nocolor + lime rebuild ios -clean -release -verbose -nocolor -eval - uses: actions/upload-artifact@v3 with: @@ -315,9 +382,28 @@ jobs: !**/.gitignore if-no-files-found: error + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + # - name: Build HelloWorld sample + # run: | + # lime create HelloWorld -verbose -nocolor -eval + # lime build HelloWorld ios -simulator -release -verbose -nocolor -eval + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage ios -simulator -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio ios -simulator -release -verbose -nocolor -eval + package-haxelib: - needs: [linux-ndll, macos-ndll, windows-ndll, android-ndll, ios-ndll] - runs-on: ubuntu-latest + needs: [linux, macos, windows, android, ios] + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -326,7 +412,7 @@ jobs: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -423,14 +509,14 @@ jobs: if-no-files-found: error docs: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -452,25 +538,15 @@ jobs: path: docs/pages if-no-files-found: error - android-samples: - needs: package-haxelib - runs-on: macos-11 + flash-samples: + runs-on: ubuntu-20.04 steps: - - name: Install Android NDK - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: r15c - - - uses: actions/setup-java@v3 - with: - distribution: "zulu" - java-version: 11 + - uses: actions/checkout@v3 - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -478,95 +554,44 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - name: Enable HXCPP compile cache + - name: Prepare Lime run: | - echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime + - name: Build HelloWorld sample run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld flash -release -verbose -nocolor -eval - - name: Configure Android support + - name: Build SimpleImage sample run: | - lime config ANDROID_SDK $ANDROID_HOME - lime config ANDROID_NDK_ROOT ${{ steps.setup-ndk.outputs.ndk-path }} - lime config JAVA_HOME $JAVA_HOME - lime config ANDROID_SETUP true - lime config + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage flash -release -verbose -nocolor -eval - - name: Create Lime samples + - name: Build SimpleAudio sample run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | - lime build HelloWorld android -release -verbose -nocolor - lime build SimpleImage android -release -verbose -nocolor - lime build SimpleAudio android -release -verbose -nocolor - - flash-samples: - needs: package-haxelib - runs-on: ubuntu-latest - steps: - - - uses: krdlab/setup-haxe@v1 - with: - haxe-version: 4.2.5 - - - name: Set HAXEPATH - run: | - echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV - - - name: Install Haxe dependencies - run: | - haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime - run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi - - - name: Create Lime samples - run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | - lime build HelloWorld flash -release -verbose -nocolor - lime build SimpleImage flash -release -verbose -nocolor - lime build SimpleAudio flash -release -verbose -nocolor + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio flash -release -verbose -nocolor -eval air-samples: - needs: package-haxelib runs-on: windows-latest strategy: matrix: - haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.1] + haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.1] steps: + - uses: actions/checkout@v3 + with: + submodules: true + - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ matrix.haxe-version }} - uses: joshtynjala/setup-adobe-air-action@v2 with: @@ -579,41 +604,50 @@ jobs: - name: Install Haxe dependencies run: | + haxelib install hxcpp 4.2.1 --quiet + haxelib install format --quiet + haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime + - name: Prepare Lime run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi - haxelib run lime config AIR_SDK ${{ env.AIR_HOME }} + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval + haxelib run lime config AIR_SDK ${{ env.AIR_HOME }} -eval - - name: Create Lime samples + - name: Build HelloWorld sample run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld air -release -verbose -nocolor -eval - - name: Build Lime samples + - name: Build SimpleImage sample run: | - lime build HelloWorld air -release -verbose -nocolor - lime build SimpleImage air -release -verbose -nocolor - lime build SimpleAudio air -release -verbose -nocolor + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage air -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio air -release -verbose -nocolor -eval hashlink-samples: needs: package-haxelib - runs-on: ubuntu-20.04 + strategy: + matrix: + os: [windows-latest, ubuntu-20.04, macos-12] + runs-on: ${{ matrix.os }} steps: - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - - name: Set HAXEPATH + - name: Set HAXEPATH (Windows) + if: runner.os == 'Windows' + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + - name: Set HAXEPATH (Mac/Linux) + if: runner.os != 'Windows' run: | echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV @@ -626,31 +660,35 @@ jobs: name: lime-haxelib path: lime-haxelib - - name: Prepare lime + - name: Prepare Lime run: | haxelib dev lime lime-haxelib haxelib run lime setup -alias -y -nocffi - - name: Create Lime samples + - name: Build HelloWorld sample run: | lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | lime build HelloWorld hl -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor lime build SimpleImage hl -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor lime build SimpleAudio hl -release -verbose -nocolor html5-samples: - needs: package-haxelib - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v3 + - uses: krdlab/setup-haxe@v1 with: - haxe-version: 4.2.5 + haxe-version: ${{ env.HAXE_VERSION }} - name: Set HAXEPATH run: | @@ -658,199 +696,65 @@ jobs: - name: Install Haxe dependencies run: | + haxelib install format --quiet + haxelib install hxp --quiet haxelib install genes --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime + - name: Prepare Lime run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval - - name: Create Lime samples + - name: Build HelloWorld sample run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld html5 -release -verbose -nocolor -eval - - name: Build Lime samples + - name: Build HelloWorld variants run: | - lime build HelloWorld html5 -release -verbose -nocolor - lime build SimpleImage html5 -release -verbose -nocolor - lime build SimpleAudio html5 -release -verbose -nocolor + lime build HelloWorld html5 -clean -release -verbose -nocolor --haxelib=genes -eval + lime build HelloWorld html5 -clean -release -verbose -nocolor -minify -terser -eval - - name: Build Lime samples with Genes + - name: Build SimpleImage sample run: | - lime build HelloWorld html5 -clean -release -verbose -nocolor --haxelib=genes - lime build SimpleImage html5 -clean -release -verbose -nocolor --haxelib=genes - lime build SimpleAudio html5 -clean -release -verbose -nocolor --haxelib=genes + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage html5 -release -verbose -nocolor -eval - - name: Build Lime samples with Terser minification + - name: Build SimpleImage variants run: | - lime build HelloWorld html5 -clean -release -verbose -nocolor -minify -terser - lime build SimpleImage html5 -clean -release -verbose -nocolor -minify -terser - lime build SimpleAudio html5 -clean -release -verbose -nocolor -minify -terser + lime build SimpleImage html5 -clean -release -verbose -nocolor --haxelib=genes -eval + lime build SimpleImage html5 -clean -release -verbose -nocolor -minify -terser -eval - ios-samples: - needs: package-haxelib - runs-on: macos-11 - steps: - - - uses: krdlab/setup-haxe@v1 - with: - haxe-version: 4.2.5 - - - name: Set HAXEPATH + - name: Build SimpleAudio sample run: | - echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio html5 -release -verbose -nocolor -eval - - name: Install Haxe dependencies + - name: Build SimpleAudio variants run: | - haxelib install hxcpp 4.2.1 --quiet - haxelib install format --quiet - haxelib install hxp --quiet - haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - - name: Enable HXCPP compile cache - run: | - echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV - - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime - run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi - - - name: Create Lime samples - run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | - lime build HelloWorld ios -simulator -release -verbose -nocolor - lime build SimpleImage ios -simulator -release -verbose -nocolor - lime build SimpleAudio ios -simulator -release -verbose -nocolor - - linux-samples: - needs: package-haxelib - runs-on: ubuntu-20.04 - steps: - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev g++-multilib gcc-multilib libasound2-dev libx11-dev libxext-dev libxi-dev libxrandr-dev libxinerama-dev - - - uses: krdlab/setup-haxe@v1 - with: - haxe-version: 4.2.5 - - - name: Set HAXEPATH - run: | - echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV - - - name: Install Haxe dependencies - run: | - haxelib install hxcpp 4.2.1 --quiet - haxelib install format --quiet - haxelib install hxp --quiet - haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - - name: Enable HXCPP compile cache - run: | - echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV - - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime - run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi - - - name: Create Lime samples - run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | - lime build HelloWorld linux -release -verbose -nocolor - lime build SimpleImage linux -release -verbose -nocolor - lime build SimpleAudio linux -release -verbose -nocolor - - macos-samples: - needs: package-haxelib - runs-on: macos-11 - steps: - - - uses: krdlab/setup-haxe@v1 - with: - haxe-version: 4.2.5 - - - name: Set HAXEPATH - run: | - echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV - - - name: Install Haxe dependencies - run: | - haxelib install hxcpp 4.2.1 --quiet - haxelib install format --quiet - haxelib install hxp --quiet - haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - - name: Enable HXCPP compile cache - run: | - echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV - - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime - run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi - - - name: Create Lime samples - run: | - lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | - lime build HelloWorld macos -release -verbose -nocolor - lime build SimpleImage macos -release -verbose -nocolor - lime build SimpleAudio macos -release -verbose -nocolor + lime build SimpleAudio html5 -clean -release -verbose -nocolor --haxelib=genes -eval + lime build SimpleAudio html5 -clean -release -verbose -nocolor -minify -terser -eval neko-samples: needs: package-haxelib - runs-on: ubuntu-20.04 strategy: matrix: - haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.1] + haxe-version: [3.4.7, 4.2.5] + os: [windows-latest, ubuntu-20.04, macos-12] + runs-on: ${{ matrix.os }} steps: - uses: krdlab/setup-haxe@v1 with: haxe-version: ${{ matrix.haxe-version }} - - name: Set HAXEPATH + - name: Set HAXEPATH (Windows) + if: runner.os == 'Windows' + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + - name: Set HAXEPATH (Mac/Linux) + if: runner.os != 'Windows' run: | echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV @@ -863,72 +767,29 @@ jobs: name: lime-haxelib path: lime-haxelib - - name: Prepare lime + - name: Prepare Lime run: | haxelib dev lime lime-haxelib haxelib run lime setup -alias -y -nocffi - - name: Create Lime samples + - name: Build HelloWorld sample run: | lime create HelloWorld -verbose -nocolor - lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor - - - name: Build Lime samples - run: | lime build HelloWorld neko -release -verbose -nocolor - lime build SimpleImage neko -release -verbose -nocolor - lime build SimpleAudio neko -release -verbose -nocolor - windows-samples: - needs: package-haxelib - runs-on: windows-latest - steps: - - - uses: krdlab/setup-haxe@v1 - with: - haxe-version: 4.2.5 - - - name: Set HAXEPATH + - name: Build SimpleImage sample run: | - echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV - - - name: Install Haxe dependencies - run: | - haxelib install hxcpp 4.2.1 --quiet - haxelib install format --quiet - haxelib install hxp --quiet - haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - - name: Enable HXCPP compile cache - run: | - echo "HXCPP_COMPILE_CACHE=C:\.hxcpp" >> $Env:GITHUB_ENV - - - uses: actions/download-artifact@v3 - with: - name: lime-haxelib - path: lime-haxelib - - - name: Prepare lime - run: | - haxelib dev lime lime-haxelib - haxelib run lime setup -alias -y -nocffi - - - name: Create Lime samples - run: | - lime create HelloWorld -verbose -nocolor lime create SimpleImage -verbose -nocolor - lime create SimpleAudio -verbose -nocolor + lime build SimpleImage neko -release -verbose -nocolor - - name: Build Lime samples + - name: Build SimpleAudio sample run: | - lime build HelloWorld windows -release -verbose -nocolor - lime build SimpleImage windows -release -verbose -nocolor - lime build SimpleAudio windows -release -verbose -nocolor + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio neko -release -verbose -nocolor notify: runs-on: ubuntu-20.04 - needs: [package-haxelib, docs, android-samples, flash-samples, air-samples, hashlink-samples, html5-samples, ios-samples, linux-samples, macos-samples, neko-samples, windows-samples] + needs: [package-haxelib, docs, android, flash-samples, air-samples, hashlink-samples, html5-samples, ios, linux, macos, neko-samples, windows] if: ${{ github.repository == 'openfl/lime' && github.event_name != 'pull_request' }} steps: - name: Notify Discord diff --git a/src/lime/tools/PlatformTarget.hx b/src/lime/tools/PlatformTarget.hx index a6232f4ba..87cf6e1d0 100644 --- a/src/lime/tools/PlatformTarget.hx +++ b/src/lime/tools/PlatformTarget.hx @@ -52,31 +52,39 @@ class PlatformTarget this.additionalArguments = additionalArguments; var metaFields = Meta.getFields(Type.getClass(this)); - if (/*!Reflect.hasField (metaFields.watch, "ignore") && */ (project.targetFlags.exists("watch"))) + // known issue: this may not log in `-eval` mode on Linux + inline function logCommand(command:String):Void + { + if (!Reflect.hasField(metaFields, command) + || !Reflect.hasField(Reflect.field(metaFields, command), "ignore")) + { + Log.info("", "\n" + Log.accentColor + "Running command: " + command.toUpperCase() + Log.resetColor); + } + } + + if (project.targetFlags.exists("watch")) { Log.info("", "\n" + Log.accentColor + "Running command: WATCH" + Log.resetColor); watch(); return; } - if ((!Reflect.hasField(metaFields, "display") || !Reflect.hasField(metaFields.display, "ignore")) && (command == "display")) + if (command == "display") { display(); } - // if (!Reflect.hasField (metaFields.clean, "ignore") && (command == "clean" || targetFlags.exists ("clean"))) { - if ((!Reflect.hasField(metaFields, "clean") || !Reflect.hasField(metaFields.clean, "ignore")) - && (command == "clean" - || (project.targetFlags.exists("clean") && (command == "update" || command == "build" || command == "test")))) + // if (command == "clean" || project.targetFlags.exists ("clean")) { + if (command == "clean" + || (project.targetFlags.exists("clean") && (command == "update" || command == "build" || command == "test"))) { - Log.info("", Log.accentColor + "Running command: CLEAN" + Log.resetColor); + logCommand("CLEAN"); clean(); } - if ((!Reflect.hasField(metaFields, "rebuild") || !Reflect.hasField(metaFields.rebuild, "ignore")) - && (command == "rebuild" || project.targetFlags.exists("rebuild"))) + if (command == "rebuild" || project.targetFlags.exists("rebuild")) { - Log.info("", "\n" + Log.accentColor + "Running command: REBUILD" + Log.resetColor); + logCommand("REBUILD"); // hack for now, need to move away from project.rebuild.path, probably @@ -88,60 +96,53 @@ class PlatformTarget rebuild(); } - if ((!Reflect.hasField(metaFields, "update") || !Reflect.hasField(metaFields.update, "ignore")) - && (command == "update" || command == "build" || command == "test")) + if (command == "update" || command == "build" || command == "test") { - Log.info("", "\n" + Log.accentColor + "Running command: UPDATE" + Log.resetColor); + logCommand("update"); // #if lime // AssetHelper.processLibraries (project, targetDirectory); // #end update(); } - if ((!Reflect.hasField(metaFields, "build") || !Reflect.hasField(metaFields.build, "ignore")) - && (command == "build" || command == "test")) + if (command == "build" || command == "test") { CommandHelper.executeCommands(project.preBuildCallbacks); - Log.info("", "\n" + Log.accentColor + "Running command: BUILD" + Log.resetColor); + logCommand("build"); build(); CommandHelper.executeCommands(project.postBuildCallbacks); } - if ((!Reflect.hasField(metaFields, "deploy") || !Reflect.hasField(metaFields.deploy, "ignore")) && (command == "deploy")) + if (command == "deploy") { - Log.info("", "\n" + Log.accentColor + "Running command: DEPLOY" + Log.resetColor); + logCommand("deploy"); deploy(); } - if ((!Reflect.hasField(metaFields, "install") || !Reflect.hasField(metaFields.install, "ignore")) - && (command == "install" || command == "run" || command == "test")) + if (command == "install" || command == "run" || command == "test") { - Log.info("", "\n" + Log.accentColor + "Running command: INSTALL" + Log.resetColor); + logCommand("install"); install(); } - if ((!Reflect.hasField(metaFields, "run") || !Reflect.hasField(metaFields.run, "ignore")) - && (command == "run" || command == "rerun" || command == "test")) + if (command == "run" || command == "rerun" || command == "test") { - Log.info("", "\n" + Log.accentColor + "Running command: RUN" + Log.resetColor); + logCommand("run"); run(); } - if ((!Reflect.hasField(metaFields, "trace") || !Reflect.hasField(metaFields.trace, "ignore")) - && (command == "test" || command == "trace" || command == "run" || command == "rerun")) + if ((command == "test" || command == "trace" || command == "run" || command == "rerun") + && (traceEnabled || command == "trace")) { - if (traceEnabled || command == "trace") - { - Log.info("", "\n" + Log.accentColor + "Running command: TRACE" + Log.resetColor); - this.trace(); - } + logCommand("trace"); + this.trace(); } - if ((!Reflect.hasField(metaFields, "uninstall") || !Reflect.hasField(metaFields.uninstall, "ignore")) && (command == "uninstall")) + if (command == "uninstall") { - Log.info("", "\n" + Log.accentColor + "Running command: UNINSTALL" + Log.resetColor); + logCommand("UNINSTALL"); uninstall(); } } From 86bcc7352d744506906bcdb9bf75513ed084b008 Mon Sep 17 00:00:00 2001 From: player-03 Date: Thu, 18 Jan 2024 13:35:07 -0500 Subject: [PATCH 09/15] Tweak warning message. --- tools/platforms/AndroidPlatform.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index f9f7d8bf0..56fa6aeae 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -152,7 +152,7 @@ class AndroidPlatform extends PlatformTarget if (architectures.length == 0) { - Log.warn("No architecture selected, resorting to arm64."); + Log.warn("No architecture selected, defaulting to ARM64."); hasARM64 = true; From 40d70d8e53c1f6236c7100b7fbab9a3292f1bfd7 Mon Sep 17 00:00:00 2001 From: player-03 Date: Thu, 18 Jan 2024 13:56:44 -0500 Subject: [PATCH 10/15] Use `paths.get()` when `pathGroups` was already checked. --- src/lime/utils/AssetLibrary.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/utils/AssetLibrary.hx b/src/lime/utils/AssetLibrary.hx index 82451f7a3..782bd4a43 100644 --- a/src/lime/utils/AssetLibrary.hx +++ b/src/lime/utils/AssetLibrary.hx @@ -477,7 +477,7 @@ class AssetLibrary } else { - return AudioBuffer.loadFromFile(getPath(id)); + return AudioBuffer.loadFromFile(paths.get(id)); } } } From 13865cbbc977f033a4c8f14e85bbe8a7c0ecf2e5 Mon Sep 17 00:00:00 2001 From: player-03 Date: Thu, 18 Jan 2024 14:02:58 -0500 Subject: [PATCH 11/15] Make better use of `getPath()`. If you check `paths.exists()` first, then there's no benefit to calling `getPath(id)`: it always just returns `paths.get(id)`. It's more effective to let `getPath()` perform all of its checks. --- src/lime/utils/PackedAssetLibrary.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lime/utils/PackedAssetLibrary.hx b/src/lime/utils/PackedAssetLibrary.hx index f99b0df82..13161282a 100644 --- a/src/lime/utils/PackedAssetLibrary.hx +++ b/src/lime/utils/PackedAssetLibrary.hx @@ -242,7 +242,8 @@ import flash.media.Sound; else { var basePath = rootPath == null || rootPath == "" ? "" : Path.addTrailingSlash(rootPath); - var libPath = paths.exists(id) ? getPath(id) : id; + var libPath = getPath(id); + if (libPath == null) libPath = id; var path = Path.join([basePath, libPath]); path = __cacheBreak(path); From f0aae1f8f2030c4ce9d5b57bde238649c119f659 Mon Sep 17 00:00:00 2001 From: player-03 Date: Sun, 21 Jan 2024 14:11:51 -0500 Subject: [PATCH 12/15] Correctly check for errors in `Haxelib.runProcess()`. In safe mode, this function includes its own `try ... catch` block, so we don't need one here. Instead, we need to check if the output is null. --- src/lime/tools/HXProject.hx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index 34e1265e6..c3224010c 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -1074,17 +1074,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) From c58013c5e649fb4a92913b235fb2c1f0b99554fa Mon Sep 17 00:00:00 2001 From: Timur Date: Wed, 10 Jan 2024 19:45:06 +1000 Subject: [PATCH 13/15] Fix "don't know how to cast array" error. This can happen when compiling HL with `analyzer-optimize`. --- src/lime/text/Font.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lime/text/Font.hx b/src/lime/text/Font.hx index 30681e3d7..2d273fb1a 100644 --- a/src/lime/text/Font.hx +++ b/src/lime/text/Font.hx @@ -189,7 +189,7 @@ class Font { #if (lime_cffi && !macro) var glyphs:Dynamic = NativeCFFI.lime_font_get_glyph_indices(src, characters); - return glyphs; + return cast glyphs; #else return null; #end From f2ef5d008212922019db6c053aefe13c5407f74d Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 22 Jan 2024 10:43:09 -0800 Subject: [PATCH 14/15] add comment about cast --- src/lime/text/Font.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lime/text/Font.hx b/src/lime/text/Font.hx index 2d273fb1a..6a188a181 100644 --- a/src/lime/text/Font.hx +++ b/src/lime/text/Font.hx @@ -189,6 +189,8 @@ class Font { #if (lime_cffi && !macro) var glyphs:Dynamic = NativeCFFI.lime_font_get_glyph_indices(src, characters); + // lime_font_get_glyph_indices returns Array + // cast it to Array instead (Glyph is an abstract) return cast glyphs; #else return null; From 8d389501080c49aeba15b8f6669f51d6e4bff970 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 25 Jan 2024 01:14:42 -0500 Subject: [PATCH 15/15] Update howler.min.js --- dependencies/howler.min.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencies/howler.min.js b/dependencies/howler.min.js index b73f984c5..da027fad0 100644 --- a/dependencies/howler.min.js +++ b/dependencies/howler.min.js @@ -1,4 +1,4 @@ -/*! howler.js v2.1.1 | (c) 2013-2018, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ -!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator&&e._navigator.userAgent.match(/OPR\/([0-6].)/g),a=r&&parseInt(r[0].split("/")[1],10)<33;return e._codecs={mp3:!(a||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!o.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n,o=/iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi|Chrome|Safari/i.test(e._navigator&&e._navigator.userAgent);if(!e._audioUnlocked&&e.ctx&&o){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var t=function(n){for(var o=0;o0?i._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(i._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3,p=!(!i._loop&&!t._sprite[e][2]);i._sprite=e,i._ended=!1;var m=function(){i._paused=!1,i._seek=_,i._start=c,i._stop=f,i._loop=p};if(_>=f)return void t._ended(i);var v=i._node;if(t._webAudio){var h=function(){t._playLock=!1,m(),t._refreshBuffer(i);var e=i._muted||t._muted?0:i._volume;v.gain.setValueAtTime(e,n.ctx.currentTime),i._playStart=n.ctx.currentTime,void 0===v.bufferSource.start?i._loop?v.bufferSource.noteGrainOn(0,_,86400):v.bufferSource.noteGrainOn(0,_,s):i._loop?v.bufferSource.start(0,_,86400):v.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[i._id]=setTimeout(t._ended.bind(t,i),l)),o||setTimeout(function(){t._emit("play",i._id),t._loadQueue()},0)};"running"===n.state?h():(t._playLock=!0,t.once("resume",h),t._clearTimer(i._id))}else{var y=function(){v.currentTime=_,v.muted=i._muted||t._muted||n._muted||v.muted,v.volume=i._volume*n.volume(),v.playbackRate=i._rate;try{var r=v.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,m(),r.then(function(){t._playLock=!1,v._unlocked=!0,o||(t._emit("play",i._id),t._loadQueue())}).catch(function(){t._playLock=!1,t._emit("playerror",i._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),i._ended=!0,i._paused=!0})):o||(t._playLock=!1,m(),t._emit("play",i._id),t._loadQueue()),v.playbackRate=i._rate,v.paused)return void t._emit("playerror",i._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||i._loop?t._endTimers[i._id]=setTimeout(t._ended.bind(t,i),l):(t._endTimers[i._id]=function(){t._ended(i),v.removeEventListener("ended",t._endTimers[i._id],!1)},v.addEventListener("ended",t._endTimers[i._id],!1))}catch(e){t._emit("playerror",i._id,e)}},g=window&&window.ejecta||!v.readyState&&n._navigator.isCocoonJS;if(v.readyState>=3||g)y();else{t._playLock=!0;var b=function(){y(),v.removeEventListener(n._canPlayEvent,b,!1)};v.addEventListener(n._canPlayEvent,b,!1),t._clearTimer(i._id)}}return i._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),i+=d*r,i=Math.max(0,i),i=Math.min(1,i),i=Math.round(100*i)/100,u._webAudio?e._volume=i:u.volume(i,e._id,!0),a&&(u._volume=i),(on&&i>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var i;if("number"!=typeof e)return i=t._soundById(o),i?i._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var d=0;d=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return t;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var i=t._soundById(o);if(i){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var d=t.playing(o)?n.ctx.currentTime-i._playStart:0,_=i._rateSeek?i._rateSeek-i._seek:0;return i._seek+(_+d*Math.abs(i._rate))}return i._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),i._seek=e,i._ended=!1,t._clearTimer(o),t._webAudio||!i._node||isNaN(i._node.duration)||(i._node.currentTime=e);var l=function(){t._emit("seek",o),s&&t.play(o,!0)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._node.src=o._src,e._node.preload="auto",e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void d(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,d(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},d=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());(n._navigator&&n._navigator.standalone&&!r||n._navigator&&!n._navigator.standalone&&!r)&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:1,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof window?(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t):"undefined"!=typeof global&&(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t)}(); +/*! howler.js v2.2.4 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ +!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/(\d+)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o?t._loadQueue():t._emit("play",d._id)}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id)),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){s&&t.play(o,!0),t._emit("seek",o)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(!e.bufferSource)return o;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); /*! Spatial Plugin */ -!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(t,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var p=a._orientation;return n="number"!=typeof n?p[1]:n,t="number"!=typeof t?p[2]:t,r="number"!=typeof r?p[3]:r,o="number"!=typeof o?p[4]:o,i="number"!=typeof i?p[5]:i,"number"!=typeof e?p:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a