diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3664a3be9..9ca6191385 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -29,7 +29,8 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -49,7 +50,7 @@ jobs: lime rebuild linux -64 -release -nocolor -verbose -nocffi lime rebuild hl -clean -release -nocolor -verbose -nocffi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Linux-NDLL path: | @@ -57,7 +58,7 @@ jobs: !**/.gitignore if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Linux64-NDLL path: | @@ -65,7 +66,7 @@ jobs: !**/.gitignore if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Linux64-Hashlink path: | @@ -179,7 +180,7 @@ jobs: runs-on: macos-12 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -204,8 +205,8 @@ jobs: - name: Install Haxe dependencies run: | - curl -LO https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip - haxelib install ./hxcpp-4.3.45.zip --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -225,7 +226,7 @@ jobs: lime rebuild macos -clean -release -arm64 -nocolor -verbose -nocffi lime rebuild hl -clean -release -nocolor -verbose -nocffi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Mac64-NDLL path: | @@ -233,7 +234,7 @@ jobs: !**/.gitignore if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: MacArm64-NDLL path: | @@ -241,7 +242,7 @@ jobs: !**/.gitignore if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Mac64-Hashlink path: | @@ -271,7 +272,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -289,7 +290,8 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -310,7 +312,7 @@ jobs: lime rebuild windows -arm64 -release -nocolor -verbose -nocffi -D HXCPP_ARM64 lime rebuild hl -clean -release -nocolor -verbose -nocffi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Windows-NDLL path: | @@ -318,7 +320,7 @@ jobs: !**/.gitignore if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Windows64-NDLL path: | @@ -326,13 +328,13 @@ jobs: !**/.gitignore if-no-files-found: error - # - uses: actions/upload-artifact@v3 + # - uses: actions/upload-artifact@v4 # with: # name: Windows-Hashlink # path: | # templates/bin/hl/Windows # if-no-files-found: error - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Windows64-Hashlink path: | @@ -362,7 +364,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -372,7 +374,7 @@ jobs: with: ndk-version: r21e - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: "zulu" java-version: 11 @@ -387,7 +389,8 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -412,7 +415,7 @@ jobs: run: | lime rebuild android -release -nocolor -verbose -nocffi -eval - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Android-NDLL path: | @@ -442,7 +445,7 @@ jobs: runs-on: macos-12 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -456,7 +459,8 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet @@ -473,7 +477,7 @@ jobs: run: | lime rebuild ios -clean -release -verbose -nocolor -eval - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: iPhone-NDLL path: | @@ -505,7 +509,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -519,7 +523,8 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib install svg --quiet @@ -540,62 +545,62 @@ jobs: cp project/lib/hashlink/src/hl.h templates/bin/hl/include/hl.h cp project/lib/hashlink/src/hlc_main.c templates/bin/hl/include/hlc_main.c - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Android-NDLL path: ndll/Android/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: iPhone-NDLL path: ndll/iPhone/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Linux-NDLL path: ndll/Linux/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Linux64-NDLL path: ndll/Linux64/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Mac64-NDLL path: ndll/Mac64/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: MacArm64-NDLL path: ndll/MacArm64/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Windows-NDLL path: ndll/Windows/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Windows64-NDLL path: ndll/Windows64/ - # - uses: actions/download-artifact@v3 + # - uses: actions/download-artifact@v4 # with: # name: Windows-Hashlink # path: templates/bin/hl/Windows - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Windows64-Hashlink path: templates/bin/hl/Windows64 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Mac64-Hashlink path: templates/bin/hl/Mac64 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: Linux64-Hashlink path: templates/bin/hl/Linux64 @@ -605,7 +610,7 @@ jobs: run: | haxe svg.hxml - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: lime-haxelib path: | @@ -620,7 +625,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: krdlab/setup-haxe@v1 with: @@ -640,7 +645,7 @@ jobs: run: | haxe build.hxml - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: lime-docs path: docs/pages @@ -650,7 +655,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: krdlab/setup-haxe@v1 with: @@ -693,7 +698,7 @@ jobs: haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.1] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -712,7 +717,8 @@ jobs: - name: Install Haxe dependencies run: | - haxelib install hxcpp 4.2.1 --quiet + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet haxelib install format --quiet haxelib install hxp --quiet haxelib git lime-samples https://github.com/openfl/lime-samples --quiet @@ -763,7 +769,7 @@ jobs: run: | haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: lime-haxelib path: lime-haxelib @@ -813,7 +819,7 @@ jobs: run: | haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: lime-haxelib path: lime-haxelib @@ -842,7 +848,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: krdlab/setup-haxe@v1 with: @@ -920,7 +926,7 @@ jobs: run: | haxelib git lime-samples https://github.com/openfl/lime-samples --quiet - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: lime-haxelib path: lime-haxelib diff --git a/CHANGELOG.md b/CHANGELOG.md index 133f1c3d5b..9ca7f078e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,76 @@ Changelog ========= +8.2.1 (11/01/2024) +------------------ + +* Fixed `Sys.exit()` causing hang instead of exiting application. +* Fixed paths for _.ndll_ files when targeting Raspberry Pi. +* Fixed compiling `BackgroundWorker` when targeting HashLink before Haxe 4. +* Fixed errors compiling `ThreadPool` for HashLink with Haxe 4.0 and 4.1. +* Fixed `Font.renderGlyph` to support 32-bit colors, including alpha. +* Fixed OpenFL line height issues by rolling back FreeType submodule to version 2.9.1. + +8.2.0 (10/21/2024) +------------------ + +* Added Apple Silicon (ARM64) support for macOS target. +* Added new `hlc` target to support compiling for HashLink/C. Both generates C code and compiles to an executable (requires Haxe 4.3.4 or newer). +* Added support for inserting attributes into the `` or `` elements of _AndroidManifest.xml_ +* Added `createPerspective()` to `Matrix4`. +* Added `removeLibrary()` to `lime.utils.Assets`, which removes a library, but makes unloading optional. +* Added `SINGLE_THREADED` mode to `ThreadPool`, which is used by default when threading is not available. +* Added `workLoad` property to `ThreadPool` to limit total time spent per frame on green threads. +* Added optional `-noalias` flag to `lime setup` to skip creating the **lime** executable alias. +* Added optional `-nosign` flag to `lime build ios` to skip code signing when targeting iOS. +* Added support for `-64` flag to force compiling for 64-bit Raspberry Pi.without requiring a custom template. +* Added option to configure `preserveDrawingBuffer` on HTML5 target. +* Added LZMA compression to HTML5 target. +* Added automatic deletion of "stale" assets and dependency files. +* Added `VIEW` intents on Android target. +* Added support for `-mingw` flag when cross-compiling to Windows from another operating system. +* Added support for `-cpp` flag when cross-compiling to Linux from another operating system (requires homebrew-macos-cross-toolchains on macOS). +* Added support for `tsa` option in `` to pass timestamp URL to Adobe AIR's adt tool. +* Fixed `lime display` command incorrectly printing old _.hxml_ content after _project.xml_ file has been modified, skipping requirement to build project or restart editor to get valid code intelligence. +* Fixed HashLink _.app_ bundles on macOS to include all Homebrew library dependencies, so that they run on computers without Homebrew. +* Fixed `@android:style/Theme.NoTitleBarnull` in generated _AndroidManifest.xml_. +* Fixed `Image` in a web worker by storing it as `DATA` type. +* Fixed cURL C++ to Haxe callbacks when targeting HashLink. +* Fixed icon generation for Android target with `accept-file-intent` config. +* Fixed exception in Lime tools when resolving full path of Neko _.n_ file. +* Fixed keyboard input incorrectly getting enabled by default when creating a new window, which could show an IME when unexpected. +* Fixed `ALC.getContextsDevice()` when targeting HashLink. +* Fixed potentially uninitialized values in `Matrix3`. +* Fixed wrong type for `Socket.objectEncoding` in Flash/AIR externs. +* Fixed `BackgroundWorker` not using threads on HashLink. +* Improved support for Raspberry Pi 64-bit builds. +* Changed custom `haxe.Timer` to fall back to the original in a macro context. +* Changed `Promise` to remove `@:generic` when in a macro context. +* Changed `Matrix3` to be an abstract over `Float32Array`, similar to `Matrix4`. +* Changed Raspberry Pi keyboard shortcut to exit to Ctrl + Esc. +* Changed `-64` and `-32` flags for Intel architectures to `-x86_64` and `-x86_32` to make their purpose more clear (the old flags still work, for now). +* Removed Joystick trackball APIs because they is supported only on Linux, with a single piece of hardware, and will be removed from SDL 3. +* Removed ARMV5 architecture from Android rebuilds by default because hxcpp doesn't support it with NDK versions >= 20. +* Removed 32-bit _liblime.iphonesim.a_ as a default binary because 32-bit iOS is no longer supported by Apple. +* Updated Cairo submodule to version 1.17.6 and point to upstream repository instead of fork. +* Updated cURL submodule to version 7.83.1 and point to upstream repository instead of fork. +* Updated efsw submodule to version 1.2.0 and point to upstream repository instead of fork. +* Updated FreeType submodule to version 2.12.1 and point to upstream repository instead of fork. +* Updated HarfBuzz submodule to version 6.0.0 and point to upstream repository instead of fork. +* Updated libpng submodule to version 1.6.37 and point to upstream repository instead of fork. +* Updated libjpg-turbo submodule to version 2.1.3 and point to upstream repository instead of fork. +* Updated libvpx submodule to version 1.11.0 and point to upstream repository instead of fork. +* Updated libwebm submodule to version 1.0.0.28 and point to upstream repository instead of fork. +* Updated Mbed TLS submodule to version 2.28.7 and point to upstream repository instead of fork. +* Updated MojoAL submodule to commit e08dbf3 and point to upstream repository instead of fork. +* Updated Ogg submodule to version 1.3.5 and point to upstream repository instead of fork. +* Updated OpenAL-Soft submodule to version 1.20.1 and point to upstream repository instead of fork. +* Updated Pixman submodule to version 0.42.2 and point to upstream repository instead of fork. +* Updated SDL submodule to version 2.24.0 and point to upstream repository instead of fork. +* Updated Tinyfiledialogs submodule to version 3.8.8 (still uses fork due to SourceForge limitationss). +* Updated Vorbis submodule to version 1.3.7 and point to upstream repository instead of fork. +* Updated zlib submodule to version 1.2.12 and point to upstream repository instead of fork. + 8.1.3 (07/22/2024) ------------------ diff --git a/README.md b/README.md index 41a378c7f1..992c2ee1d0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,12 @@ Lime is free, open-source software under the [MIT license](LICENSE.md). Installation ============ -First install the latest version of [Haxe](http://www.haxe.org/download). +First, install the latest version of [Haxe](http://www.haxe.org/download). + +Then, install Lime from Haxelib and run Lime's setup command. + + haxelib install lime + haxelib run lime setup Development Builds diff --git a/externs/air/flash/net/Socket.hx b/externs/air/flash/net/Socket.hx index 34eddbfcf9..40940d78d1 100644 --- a/externs/air/flash/net/Socket.hx +++ b/externs/air/flash/net/Socket.hx @@ -7,7 +7,7 @@ extern class Socket extends flash.events.EventDispatcher implements flash.utils. @:require(flash11) var bytesPending(default, never):UInt; var connected(default, never):Bool; var endian:flash.utils.Endian; - var objectEncoding:UInt; + var objectEncoding:#if openfl openfl.net.ObjectEncoding #else UInt #end; @:require(flash10) var timeout:UInt; #if air var localAddress(default, never):String; @@ -20,7 +20,7 @@ extern class Socket extends flash.events.EventDispatcher implements flash.utils. @:flash.property @:require(flash11) var bytesPending(get, never):UInt; @:flash.property var connected(get, never):Bool; @:flash.property var endian(get, set):flash.utils.Endian; - @:flash.property var objectEncoding(get, set):UInt; + @:flash.property var objectEncoding(get, set):#if openfl openfl.net.ObjectEncoding #else UInt #end; @:flash.property @:require(flash10) var timeout(get, set):UInt; #if air @:flash.property var localAddress(get, never):String; @@ -65,7 +65,7 @@ extern class Socket extends flash.events.EventDispatcher implements flash.utils. private function get_bytesPending():UInt; private function get_connected():Bool; private function get_endian():flash.utils.Endian; - private function get_objectEncoding():UInt; + private function get_objectEncoding():#if openfl openfl.net.ObjectEncoding #else UInt #end; private function get_timeout():UInt; #if air private function get_localAddress():String; @@ -74,7 +74,7 @@ extern class Socket extends flash.events.EventDispatcher implements flash.utils. private function get_remotePort():Int; #end private function set_endian(value:flash.utils.Endian):flash.utils.Endian; - private function set_objectEncoding(value:UInt):UInt; + private function set_objectEncoding(value:#if openfl openfl.net.ObjectEncoding #else UInt #end):#if openfl openfl.net.ObjectEncoding #else UInt #end; private function set_timeout(value:UInt):UInt; #end } diff --git a/haxelib.json b/haxelib.json index cd140378b8..22a396ea8b 100644 --- a/haxelib.json +++ b/haxelib.json @@ -12,4 +12,4 @@ "Dimensionscape" ], "classPath": "src" -} \ No newline at end of file +} diff --git a/project/include/text/Font.h b/project/include/text/Font.h index bcf3d4a8ed..2d4cf87f40 100644 --- a/project/include/text/Font.h +++ b/project/include/text/Font.h @@ -59,7 +59,7 @@ namespace lime { int GetUnitsPerEM (); int RenderGlyph (int index, Bytes *bytes, int offset = 0); int RenderGlyphs (value indices, Bytes *bytes); - void SetSize (size_t size); + void SetSize (size_t size, size_t dpi); void* library; void* face; diff --git a/project/lib/freetype b/project/lib/freetype index e8ebfe988b..86bc8a9505 160000 --- a/project/lib/freetype +++ b/project/lib/freetype @@ -1 +1 @@ -Subproject commit e8ebfe988b5f57bfb9a3ecb13c70d9791bce9ecf +Subproject commit 86bc8a95056c97a810986434a3f268cbe67f2902 diff --git a/project/lib/freetype-files.xml b/project/lib/freetype-files.xml index c9e9e69e58..15e0c3476a 100644 --- a/project/lib/freetype-files.xml +++ b/project/lib/freetype-files.xml @@ -110,7 +110,13 @@ - + + + + + + + @@ -120,13 +126,8 @@ - - - - - diff --git a/project/lib/harfbuzz b/project/lib/harfbuzz index aee123fc83..afcae83a06 160000 --- a/project/lib/harfbuzz +++ b/project/lib/harfbuzz @@ -1 +1 @@ -Subproject commit aee123fc83388b8f5acfb301d87bd92eccc5b843 +Subproject commit afcae83a064843d71d47624bc162e121cc56c08b diff --git a/project/lib/harfbuzz-files.xml b/project/lib/harfbuzz-files.xml index 1027f14b3f..68f882a6ba 100644 --- a/project/lib/harfbuzz-files.xml +++ b/project/lib/harfbuzz-files.xml @@ -45,18 +45,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 62d89441cf..d213c61e74 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -1602,21 +1602,21 @@ namespace lime { } - void lime_font_set_size (value fontHandle, int fontSize) { + void lime_font_set_size (value fontHandle, int fontSize, int dpi) { #ifdef LIME_FREETYPE Font *font = (Font*)val_data (fontHandle); - font->SetSize (fontSize); + font->SetSize (fontSize, dpi); #endif } - HL_PRIM void HL_NAME(hl_font_set_size) (HL_CFFIPointer* fontHandle, int fontSize) { + HL_PRIM void HL_NAME(hl_font_set_size) (HL_CFFIPointer* fontHandle, int fontSize, int dpi) { #ifdef LIME_FREETYPE Font *font = (Font*)fontHandle->ptr; - font->SetSize (fontSize); + font->SetSize (fontSize, dpi); #endif } @@ -3965,7 +3965,7 @@ namespace lime { DEFINE_PRIME2 (lime_font_outline_decompose); DEFINE_PRIME3 (lime_font_render_glyph); DEFINE_PRIME3 (lime_font_render_glyphs); - DEFINE_PRIME2v (lime_font_set_size); + DEFINE_PRIME3v (lime_font_set_size); DEFINE_PRIME1v (lime_gamepad_add_mappings); DEFINE_PRIME2v (lime_gamepad_event_manager_register); DEFINE_PRIME1 (lime_gamepad_get_device_guid); @@ -4153,7 +4153,7 @@ namespace lime { DEFINE_HL_PRIM (_DYN, hl_font_outline_decompose, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_TBYTES, hl_font_render_glyph, _TCFFIPOINTER _I32 _TBYTES); DEFINE_HL_PRIM (_TBYTES, hl_font_render_glyphs, _TCFFIPOINTER _ARR _TBYTES); - DEFINE_HL_PRIM (_VOID, hl_font_set_size, _TCFFIPOINTER _I32); + DEFINE_HL_PRIM (_VOID, hl_font_set_size, _TCFFIPOINTER _I32 _I32); DEFINE_HL_PRIM (_VOID, hl_gamepad_add_mappings, _ARR); DEFINE_HL_PRIM (_VOID, hl_gamepad_event_manager_register, _FUN(_VOID, _NO_ARG) _TGAMEPAD_EVENT); DEFINE_HL_PRIM (_BYTES, hl_gamepad_get_device_guid, _I32); diff --git a/project/src/graphics/cairo/CairoBindings.cpp b/project/src/graphics/cairo/CairoBindings.cpp index b3c92e1f06..09ab422e38 100644 --- a/project/src/graphics/cairo/CairoBindings.cpp +++ b/project/src/graphics/cairo/CairoBindings.cpp @@ -1824,7 +1824,7 @@ namespace lime { if (fontReference) { Font* font = (Font*)val_data ((value)fontReference->Get ()); - font->SetSize (size); + font->SetSize (size, 72); } @@ -1852,7 +1852,7 @@ namespace lime { if (fontReference) { Font* font = (Font*)((HL_CFFIPointer*)fontReference->Get ())->ptr; - font->SetSize (size); + font->SetSize (size, 72); } diff --git a/project/src/media/openal/OpenALBindings.cpp b/project/src/media/openal/OpenALBindings.cpp index cd67d72ccc..fe549149df 100644 --- a/project/src/media/openal/OpenALBindings.cpp +++ b/project/src/media/openal/OpenALBindings.cpp @@ -142,7 +142,12 @@ namespace lime { } - + /*This has been removed after updating to openal 1.20.0+ since the cleanup functions involved + * lead to deadlocking. See https://github.com/openfl/lime/issues/1803 for more info. + * Developers should use lime.system.System.exit() instead of Sys.exit() to clean up any system + * resources + */ + /* void lime_al_atexit () { ALCcontext* alcContext = alcGetCurrentContext (); @@ -163,7 +168,7 @@ namespace lime { } } - + */ void lime_al_auxf (value aux, int param, float value) { @@ -3412,7 +3417,8 @@ namespace lime { value lime_alc_open_device (HxString devicename) { ALCdevice* alcDevice = alcOpenDevice (devicename.__s); - atexit (lime_al_atexit); + //TODO: Can we work out our own cleanup for openal? + //atexit (lime_al_atexit); value ptr = CFFIPointer (alcDevice, gc_alc_object); alcObjects[alcDevice] = ptr; @@ -3424,7 +3430,8 @@ namespace lime { HL_PRIM HL_CFFIPointer* HL_NAME(hl_alc_open_device) (hl_vstring* devicename) { ALCdevice* alcDevice = alcOpenDevice (devicename ? (char*)hl_to_utf8 ((const uchar*)devicename->bytes) : 0); - atexit (lime_al_atexit); + //TODO: Can we work out our own cleanup for openal? + //atexit (lime_al_atexit); HL_CFFIPointer* ptr = HLCFFIPointer (alcDevice, (hl_finalizer)hl_gc_alc_object); alcObjects[alcDevice] = ptr; diff --git a/project/src/text/Font.cpp b/project/src/text/Font.cpp index 61328850ca..52903b73e7 100644 --- a/project/src/text/Font.cpp +++ b/project/src/text/Font.cpp @@ -944,29 +944,33 @@ namespace lime { } - int Font::RenderGlyph (int index, Bytes *bytes, int offset) { - - if (FT_Load_Glyph ((FT_Face)face, index, FT_LOAD_FORCE_AUTOHINT | FT_LOAD_DEFAULT) == 0) { - - if (FT_Render_Glyph (((FT_Face)face)->glyph, FT_RENDER_MODE_NORMAL) == 0) { - + int Font::RenderGlyph(int index, Bytes *bytes, int offset) + { + if (FT_Load_Glyph((FT_Face)face, index, FT_LOAD_FORCE_AUTOHINT | FT_LOAD_DEFAULT) == 0) + { + if (FT_Render_Glyph(((FT_Face)face)->glyph, FT_RENDER_MODE_LCD) == 0) + { FT_Bitmap bitmap = ((FT_Face)face)->glyph->bitmap; int height = bitmap.rows; - int width = bitmap.width; + int width = bitmap.width / 3; //Due to each pixel now has 3 components (R, G, B) int pitch = bitmap.pitch; - if (width == 0 || height == 0) return 0; - - uint32_t size = (4 * 5) + (width * height); + if (width == 0 || height == 0) + return 0; - if (bytes->length < size + offset) { - - bytes->Resize (size + offset); + //We calculate the size needed for the glyph image, including metadata and 24-bit RGB color data + uint32_t size = sizeof(GlyphImage) + (width * height * 4); + if (bytes->length < size + offset) + { + bytes->Resize(size + offset); } - GlyphImage *data = (GlyphImage*)(bytes->b + offset); + GlyphImage *data = (GlyphImage *)(bytes->b + offset); + + //We should initialize the GlyphImage struct here with zero to avoid uninitialized values + memset(data, 0, sizeof(GlyphImage)); data->index = index; data->width = width; @@ -974,22 +978,34 @@ namespace lime { data->x = ((FT_Face)face)->glyph->bitmap_left; data->y = ((FT_Face)face)->glyph->bitmap_top; - unsigned char* position = &data->data; - - for (int i = 0; i < height; i++) { - - memcpy (position + (i * width), bitmap.buffer + (i * pitch), width); - + unsigned char *position = &data->data; + + //Copy the bitmap data row by row, copying each RGB triplet and adding padding for 32-bit alignment + for (int i = 0; i < height; i++) + { + for (int j = 0; j < width; j++) + { + unsigned char r = bitmap.buffer[i * pitch + j * 3 + 0]; + unsigned char g = bitmap.buffer[i * pitch + j * 3 + 1]; + unsigned char b = bitmap.buffer[i * pitch + j * 3 + 2]; + unsigned char a = (r + g + b) / 3; + + //Red + position[(i * width + j) * 4 + 0] = r; + //Green + position[(i * width + j) * 4 + 1] = g; + //Blue + position[(i * width + j) * 4 + 2] = b; + //Alpha + position[(i * width + j) * 4 + 3] = a; + } } return size; - } - } return 0; - } @@ -1023,14 +1039,22 @@ namespace lime { return totalOffset; } - - - void Font::SetSize (size_t size) { - - size_t hdpi = 72; - size_t vdpi = 72; - - FT_Set_Char_Size ((FT_Face)face, (int)(size*64), (int)(size*64), hdpi, vdpi); + + void Font::SetSize(size_t size, size_t dpi) + { + //We changed the function signature to include a dpi argument which changes this from + //the default value of 72 for dpi. Any public api that uses this should probably be changed + //to allow setting the dpi in an appropriate future release. + size_t hdpi = dpi; + size_t vdpi = dpi; + + FT_Set_Char_Size( + (FT_Face)face, //Handle to the target face object + 0, //Char width in 1/64th of points (0 means same as height) + static_cast(size * 64), //Char height in 1/64th of points + hdpi, //Horizontal DPI + vdpi //Vertical DPI + ); mSize = size; } diff --git a/release-checklist.md b/release-checklist.md new file mode 100644 index 0000000000..7f75b7f3dc --- /dev/null +++ b/release-checklist.md @@ -0,0 +1,49 @@ +# Lime Release Checklist + +- Add release notes to _CHANGELOG.md_ + - Compare to previous tag on GitHub: + `https://github.com/openfl/lime/compare/a.b.c...develop` + - Compare to previous tag in terminal: + ```sh + git log a.b.c...develop --oneline + ``` + - Sometimes, commits from previous releases show up, but most should be correct +- Update release note in _haxelib.json_ +- Update version in _haxelib.json_ (may be updated already) +- Update release date in _CHANGELOG.md_ +- Tag release and push + ```sh + git tag -s x.y.z -m "version x.y.z" + git push origin x.y.z + ``` +- Download _lime-haxelib_ and _lime-docs_ artifacts for tag from GitHub Actions +- Submit _.zip_ file to Haxelib with following command: + ```sh + haxelib submit lime-haxelib.zip + ``` + - Lime releases are sometimes too large for Haxelib. If required, unzip and rezip with higher compresssion + - First, unzip _lime-haxelib.zip_ + - Then, zip with highest compresssion (command for macOS terminal below): + ```sh + cd lime-haxelib/ + zip -r path/to/new/lime-haxelib.zip . -9 + ``` +- Create new release for tag on GitHub + - Upload _lime-haxelib.zip_ and _lime-docs.zip_ + - Link to _CHANGELOG.md_ from tag and to _https://community.openfl.org_ announcement thread) + - _CHANGELOG.md_ tag URL format: `https://github.com/openfl/lime/blob/x.y.z/CHANGELOG.md` + - It's okay to skip link to announcement at first, and edit the release to add it later +- Deploy API reference by updating Git ref in _.github/workflows/deploy.yml_ in _openfl/lime.openfl.org_ repo + ```yaml + - uses: actions/checkout@v4 + with: + repository: openfl/lime + path: _lime-git + ref: x.y.z + ``` +- Make announcement on _https://community.openfl.org_ in _Announcements_ category + - For feature releases, it's good to write a summary of noteworthy new features + - For bugfix releases, intro can be short + - Include full list of changes from _CHANGELOG.md_ + - If also releasing OpenFL at the same time, announcement thread should be combined + - After posting, go back and add link to thread GitHub release description, if needed \ No newline at end of file diff --git a/src/lime/_internal/backend/native/NativeCFFI.hx b/src/lime/_internal/backend/native/NativeCFFI.hx index 33ce3df541..dd3403c8cc 100644 --- a/src/lime/_internal/backend/native/NativeCFFI.hx +++ b/src/lime/_internal/backend/native/NativeCFFI.hx @@ -149,7 +149,7 @@ class NativeCFFI @:cffi private static function lime_font_render_glyphs(handle:Dynamic, indices:Dynamic, data:Dynamic):Dynamic; - @:cffi private static function lime_font_set_size(handle:Dynamic, size:Int):Void; + @:cffi private static function lime_font_set_size(handle:Dynamic, size:Int, dpi:Int):Void; @:cffi private static function lime_gamepad_add_mappings(mappings:Dynamic):Void; @@ -439,7 +439,7 @@ class NativeCFFI "lime_font_render_glyph", "oioo", false)); private static var lime_font_render_glyphs = new cpp.Callablecpp.Object->cpp.Object->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_font_render_glyphs", "oooo", false)); - private static var lime_font_set_size = new cpp.CallableInt->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_font_set_size", "oiv", false)); + private static var lime_font_set_size = new cpp.CallableInt->Int->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_font_set_size", "oiiv", false)); private static var lime_gamepad_add_mappings = new cpp.Callablecpp.Void>(cpp.Prime._loadPrime("lime", "lime_gamepad_add_mappings", "ov", false)); private static var lime_gamepad_get_device_guid = new cpp.Callablecpp.Object>(cpp.Prime._loadPrime("lime", "lime_gamepad_get_device_guid", "io", @@ -672,7 +672,7 @@ class NativeCFFI private static var lime_font_outline_decompose = CFFI.load("lime", "lime_font_outline_decompose", 2); private static var lime_font_render_glyph = CFFI.load("lime", "lime_font_render_glyph", 3); private static var lime_font_render_glyphs = CFFI.load("lime", "lime_font_render_glyphs", 3); - private static var lime_font_set_size = CFFI.load("lime", "lime_font_set_size", 2); + private static var lime_font_set_size = CFFI.load("lime", "lime_font_set_size", 3); private static var lime_gamepad_add_mappings = CFFI.load("lime", "lime_gamepad_add_mappings", 1); private static var lime_gamepad_get_device_guid = CFFI.load("lime", "lime_gamepad_get_device_guid", 1); private static var lime_gamepad_get_device_name = CFFI.load("lime", "lime_gamepad_get_device_name", 1); @@ -993,7 +993,7 @@ class NativeCFFI return null; } - @:hlNative("lime", "hl_font_set_size") private static function lime_font_set_size(handle:CFFIPointer, size:Int):Void {} + @:hlNative("lime", "hl_font_set_size") private static function lime_font_set_size(handle:CFFIPointer, size:Int, dpi:Int):Void {} @:hlNative("lime", "hl_gamepad_add_mappings") private static function lime_gamepad_add_mappings(mappings:hl.NativeArray):Void {} diff --git a/src/lime/_internal/format/LZMA.hx b/src/lime/_internal/format/LZMA.hx index f54f2ae7cf..47510fecd4 100644 --- a/src/lime/_internal/format/LZMA.hx +++ b/src/lime/_internal/format/LZMA.hx @@ -27,7 +27,7 @@ class LZMA #end #elseif js var data = untyped #if haxe4 js.Syntax.code #else __js__ #end ("LZMA.compress")(new UInt8Array(bytes.getData()), 5); - if (data is String) + if ((data is String)) { return Bytes.ofString(data); } @@ -60,7 +60,7 @@ class LZMA #end #elseif js var data = untyped #if haxe4 js.Syntax.code #else __js__ #end ("LZMA.decompress")(new UInt8Array(bytes.getData())); - if (data is String) + if ((data is String)) { return Bytes.ofString(data); } diff --git a/src/lime/system/BackgroundWorker.hx b/src/lime/system/BackgroundWorker.hx index f92ca0ca17..30d69d1ed8 100644 --- a/src/lime/system/BackgroundWorker.hx +++ b/src/lime/system/BackgroundWorker.hx @@ -69,7 +69,7 @@ class BackgroundWorker public var onProgress = new EventVoid>(); @:noCompletion private var __runMessage:Dynamic; - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) @:noCompletion private var __messageQueue:Deque; @:noCompletion private var __workerThread:Thread; #end @@ -87,7 +87,7 @@ class BackgroundWorker { canceled = true; - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) __workerThread = null; #end } @@ -102,7 +102,7 @@ class BackgroundWorker completed = false; __runMessage = message; - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) __messageQueue = new Deque(); __workerThread = Thread.create(__doWork); @@ -125,7 +125,7 @@ class BackgroundWorker { completed = true; - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) __messageQueue.add(MESSAGE_COMPLETE); __messageQueue.add(message); #else @@ -143,7 +143,7 @@ class BackgroundWorker **/ public function sendError(message:Dynamic = null):Void { - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) __messageQueue.add(MESSAGE_ERROR); __messageQueue.add(message); #else @@ -161,7 +161,7 @@ class BackgroundWorker **/ public function sendProgress(message:Dynamic = null):Void { - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) __messageQueue.add(message); #else if (!canceled) @@ -193,7 +193,7 @@ class BackgroundWorker @:noCompletion private function __update(deltaTime:Int):Void { - #if (cpp || neko) + #if (cpp || neko || (haxe4 && hl)) var message = __messageQueue.pop(false); if (message != null) diff --git a/src/lime/system/System.hx b/src/lime/system/System.hx index 039b58283c..71d1812c70 100644 --- a/src/lime/system/System.hx +++ b/src/lime/system/System.hx @@ -191,7 +191,18 @@ class System #if (!lime_doc_gen || sys) /** Attempts to exit the application. Dispatches `onExit`, and will not - exit if the event is canceled. + exit if the event is canceled. When exiting using this method, Lime will + gracefully shut down a number of subsystems, including (but not limited + to) audio, graphics, timers, and game controllers. + + To properly exit a Lime application, it's best to call Lime's + `System.exit()` instead of calling Haxe's built-in `Sys.exit()`. When + targeting native platforms especially, Lime's is built on C++ libraries + that expose functions to clean up resources properly on exit. Haxe's + `Sys.exit()` exits immediately without giving Lime a chance to clean + things up. With that in mind, the proper and correct way to exit a Lime + app is by calling `lime.system.System.exit()`, and to avoid using + `Sys.exit()`. **/ public static function exit(code:Int):Void { diff --git a/src/lime/system/ThreadPool.hx b/src/lime/system/ThreadPool.hx index ec8669b295..d64bff98b5 100644 --- a/src/lime/system/ThreadPool.hx +++ b/src/lime/system/ThreadPool.hx @@ -425,7 +425,7 @@ class ThreadPool extends WorkOutput { while (!output.__jobComplete.value && (interruption = Thread.readMessage(false)) == null) { - output.workIterations.value++; + output.workIterations.value = output.workIterations.value + 1; event.job.doWork.dispatch(event.job.state, output); } } @@ -521,7 +521,7 @@ class ThreadPool extends WorkOutput { do { - workIterations.value++; + workIterations.value = workIterations.value + 1; activeJob.doWork.dispatch(state, this); timeElapsed = timestamp() - startTime; } diff --git a/src/lime/text/Font.hx b/src/lime/text/Font.hx index 19843c2e8a..564b267afb 100644 --- a/src/lime/text/Font.hx +++ b/src/lime/text/Font.hx @@ -34,14 +34,47 @@ import haxe.io.Path; @:access(lime.text.Glyph) class Font { + /** + * The ascender value of the font. + */ public var ascender:Int; + + /** + * The descender value of the font. + */ public var descender:Int; + + /** + * The height of the font. + */ public var height:Int; + + /** + * The name of the font. + */ public var name(default, null):String; + + /** + * The number of glyphs in the font. + */ public var numGlyphs:Int; + + public var src:Dynamic; + + /** + * The underline position of the font. + */ public var underlinePosition:Int; + + /** + * The underline thickness of the font. + */ public var underlineThickness:Int; + + /** + * The units per EM of the font. + */ public var unitsPerEM:Int; @:noCompletion private var __fontID:String; @@ -51,6 +84,11 @@ class Font #end @:noCompletion private var __init:Bool; + /** + * Creates a new instance of a Font object. + * + * @param name Optional name of the font. + */ public function new(name:String = null) { if (name != null) @@ -100,6 +138,11 @@ class Font } } + /** + * Decomposes the font into outline data. + * + * @return An instance of `NativeFontData` that contains decomposed font outline information. + */ public function decompose():NativeFontData { #if (lime_cffi && !macro) @@ -118,6 +161,12 @@ class Font #end } + /** + * Creates a Font instance from byte data. + * + * @param bytes The byte data containing the font. + * @return A `Font` instance. + */ public static function fromBytes(bytes:Bytes):Font { if (bytes == null) return null; @@ -132,6 +181,12 @@ class Font #end } + /** + * Creates a Font instance from a file path. + * + * @param path The file path of the font. + * @return A `Font` instance. + */ public static function fromFile(path:String):Font { if (path == null) return null; @@ -146,11 +201,23 @@ class Font #end } + /** + * Loads a Font from byte data asynchronously. + * + * @param bytes The byte data containing the font. + * @return A `Future` containing a `Font` instance. + */ public static function loadFromBytes(bytes:Bytes):Future { return Future.withValue(fromBytes(bytes)); } + /** + * Loads a Font from a file path asynchronously. + * + * @param path The file path of the font. + * @return A `Future` containing a `Font` instance. + */ public static function loadFromFile(path:String):Future { var request = new HTTPRequest(); @@ -167,6 +234,12 @@ class Font }); } + /** + * Loads a Font by its name asynchronously. + * + * @param path The name of the font. + * @return A `Future` containing a `Font` instance. + */ public static function loadFromName(path:String):Future { #if (js && html5) @@ -177,6 +250,12 @@ class Font #end } + /** + * Retrieves a glyph from the font by a character. + * + * @param character The character whose glyph to retrieve. + * @return A `Glyph` instance representing the glyph of the character. + */ public function getGlyph(character:String):Glyph { #if (lime_cffi && !macro) @@ -186,6 +265,12 @@ class Font #end } + /** + * Retrieves an array of glyphs for a set of characters. + * + * @param characters The string containing characters to retrieve glyphs for. + * @return An array of `Glyph` instances representing the glyphs of the characters. + */ public function getGlyphs(characters:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|:;_-+=?,. "):Array { #if (lime_cffi && !macro) @@ -199,6 +284,12 @@ class Font #end } + /** + * Retrieves metrics for a given glyph. + * + * @param glyph The glyph whose metrics to retrieve. + * @return A `GlyphMetrics` instance containing the metrics of the glyph. + */ public function getGlyphMetrics(glyph:Glyph):GlyphMetrics { #if (lime_cffi && !macro) @@ -216,34 +307,64 @@ class Font #end } + /** + * Renders a specific glyph to an image. + * + * @param glyph The glyph to render. + * @param fontSize The size to render the glyph at. + * @return An `Image` instance representing the rendered glyph. + */ public function renderGlyph(glyph:Glyph, fontSize:Int):Image { #if (lime_cffi && !macro) - __setSize(fontSize); + __setSize(fontSize, 96); - var bytes = Bytes.alloc(0); - // bytes.endian = (System.endianness == BIG_ENDIAN ? "bigEndian" : "littleEndian"); + // Allocate an estimated buffer size - adjust if necessary + var bytes:Bytes = Bytes.alloc(0); // Allocate some reasonable initial size - var dataPosition = 0; + // Call native function to render glyph and get byte data bytes = NativeCFFI.lime_font_render_glyph(src, glyph, bytes); if (bytes != null && bytes.length > 0) { - var index = bytes.getInt32(dataPosition); + var dataPosition = 0; + + // Extract glyph information from the byte array + var index:Int = bytes.getInt32(dataPosition); dataPosition += 4; - var width = bytes.getInt32(dataPosition); + + var width:Int = bytes.getInt32(dataPosition); dataPosition += 4; - var height = bytes.getInt32(dataPosition); + + var height:Int = bytes.getInt32(dataPosition); dataPosition += 4; - var x = bytes.getInt32(dataPosition); + + var x:Int = bytes.getInt32(dataPosition); dataPosition += 4; - var y = bytes.getInt32(dataPosition); + + var y:Int = bytes.getInt32(dataPosition); dataPosition += 4; - var data = bytes.sub(dataPosition, width * height); - dataPosition += (width * height); + // Check if width and height are valid before proceeding + if (width <= 0 || height <= 0) + { + return null; + } + + // Extract pixel data from the byte array, accounting for 32-bit RGBA data + var pitch = width * 4; // 32-bit color data - var buffer = new ImageBuffer(new UInt8Array(data), width, height, 8); + // Create a new Bytes array to store the extracted bitmap data without padding + var dataBytes = Bytes.alloc(width * height * 4); + + // Extract row by row to handle RGBA data + for (i in 0...height) + { + dataBytes.blit(i * width * 4, bytes, dataPosition + (i * pitch), width * 4); + } + + // Create ImageBuffer and Image from the extracted data + var buffer = new ImageBuffer(new UInt8Array(dataBytes), width, height, 32); var image = new Image(buffer, 0, 0, width, height); image.x = x; image.y = y; @@ -254,7 +375,13 @@ class Font return null; } - + /** + * Renders a set of glyphs to images. + * + * @param glyphs The glyphs to render. + * @param fontSize The size to render the glyphs at. + * @return A `Map` containing glyphs mapped to their corresponding images. + */ public function renderGlyphs(glyphs:Array, fontSize:Int):Map { #if (lime_cffi && !macro) @@ -283,7 +410,7 @@ class Font var glyphList = _glyphList; #end - NativeCFFI.lime_font_set_size(src, fontSize); + __setSize(fontSize, 96); var bytes = Bytes.alloc(0); bytes = NativeCFFI.lime_font_render_glyphs(src, glyphList, bytes); @@ -587,14 +714,17 @@ class Font } #end - @:noCompletion private function __setSize(size:Int):Void + @:noCompletion private function __setSize(size:Int, dpi:Int = 72):Void { #if (lime_cffi && !macro) - NativeCFFI.lime_font_set_size(src, size); + NativeCFFI.lime_font_set_size(src, size, dpi); #end } } +/** +* Represents decomposed font data, containing kerning information, glyphs, and other properties. +*/ typedef NativeFontData = { var has_kerning:Bool; @@ -613,6 +743,9 @@ typedef NativeFontData = var kerning:Array; } +/** +* Represents data for an individual glyph, including dimensions and control points. +*/ typedef NativeGlyphData = { var char_code:Int; @@ -624,6 +757,9 @@ typedef NativeGlyphData = var points:Array; } +/** +* Represents kerning information between two glyphs. +*/ typedef NativeKerningData = { var left_glyph:Int; diff --git a/src/lime/tools/AIRHelper.hx b/src/lime/tools/AIRHelper.hx index 01045e8d55..62e4ffde6a 100644 --- a/src/lime/tools/AIRHelper.hx +++ b/src/lime/tools/AIRHelper.hx @@ -135,6 +135,12 @@ class AIRHelper signingOptions.push("samplePassword"); } + if (project.config.exists("air.tsa")) + { + signingOptions.push("-tsa"); + signingOptions.push(project.config.getString("air.tsa")); + } + var args = ["-package"]; // TODO: Is this an old workaround fixed in newer AIR SDK? diff --git a/src/lime/tools/HTML5Helper.hx b/src/lime/tools/HTML5Helper.hx index 6a6ae10d84..2ff72c4a66 100644 --- a/src/lime/tools/HTML5Helper.hx +++ b/src/lime/tools/HTML5Helper.hx @@ -111,9 +111,13 @@ class HTML5Helper { suffix += "32"; } - else if (System.hostArchitecture == ARM64) + else if( System.hostArchitecture == ARMV7) { - suffix += "arm64"; + suffix += "Arm"; + } + else if( System.hostArchitecture == ARM64) + { + suffix += "Arm64"; } else { diff --git a/src/lime/ui/FileDialog.hx b/src/lime/ui/FileDialog.hx index 61201b9fbc..d5bc70d990 100644 --- a/src/lime/ui/FileDialog.hx +++ b/src/lime/ui/FileDialog.hx @@ -99,7 +99,7 @@ class FileDialog if (type == null) type = FileDialogType.OPEN; #if desktop - var worker = new ThreadPool(); + var worker = new ThreadPool(#if (windows && hl) SINGLE_THREADED #end); worker.onComplete.add(function(result) { @@ -224,7 +224,7 @@ class FileDialog public function open(filter:String = null, defaultPath:String = null, title:String = null):Bool { #if (desktop && sys) - var worker = new ThreadPool(); + var worker = new ThreadPool(#if (windows && hl) SINGLE_THREADED #end); worker.onComplete.add(function(path:String) { @@ -287,7 +287,7 @@ class FileDialog } #if (desktop && sys) - var worker = new ThreadPool(); + var worker = new ThreadPool(#if (windows && hl) SINGLE_THREADED #end); worker.onComplete.add(function(path:String) { diff --git a/src/lime/utils/PackedAssetLibrary.hx b/src/lime/utils/PackedAssetLibrary.hx index 13161282ab..5a7a98f10a 100644 --- a/src/lime/utils/PackedAssetLibrary.hx +++ b/src/lime/utils/PackedAssetLibrary.hx @@ -168,61 +168,72 @@ import flash.media.Sound; if (promise == null) { promise = new Promise(); + bytesLoadedCache = new Map(); // TODO: Handle `preload` for individual assets // TODO: Do not preload bytes on native, if we can read from it instead (all non-Android targets?) + assetsLoaded = 0; + assetsTotal = 2; //for our initial __assetLoaded(null) call and __assetLoaded(this.id) + + for (id in preload.keys()) + { + if (!preload.get(id)) continue; + + switch (types.get(id)) + { + case BINARY, FONT, IMAGE, TEXT: + assetsTotal++; + + case MUSIC, SOUND: + Log.verbose("Preloading asset: " + id + " [" + types.get(id) + "]"); + assetsTotal++; + + var future = loadAudioBuffer(id); + future.onProgress(load_onProgress.bind(id)); + future.onError(loadAudioBuffer_onError.bind(id)); + future.onComplete(loadAudioBuffer_onComplete.bind(id)); + + default: + } + } + var packedData_onComplete = function(data:Bytes) { cachedBytes.set(id, data); packedData = data; - assetsLoaded = 0; - assetsTotal = 1; + __assetLoaded(this.id); for (id in preload.keys()) { if (!preload.get(id)) continue; - Log.verbose("Preloading asset: " + id + " [" + types.get(id) + "]"); - switch (types.get(id)) { case BINARY: - assetsTotal++; - + Log.verbose("Preloading asset: " + id + " [" + types.get(id) + "]"); var future = loadBytes(id); // future.onProgress (load_onProgress.bind (id)); future.onError(load_onError.bind(id)); future.onComplete(loadBytes_onComplete.bind(id)); case FONT: - assetsTotal++; - + Log.verbose("Preloading asset: " + id + " [" + types.get(id) + "]"); var future = loadFont(id); // future.onProgress (load_onProgress.bind (id)); future.onError(load_onError.bind(id)); future.onComplete(loadFont_onComplete.bind(id)); case IMAGE: - assetsTotal++; - + Log.verbose("Preloading asset: " + id + " [" + types.get(id) + "]"); var future = loadImage(id); // future.onProgress (load_onProgress.bind (id)); future.onError(load_onError.bind(id)); future.onComplete(loadImage_onComplete.bind(id)); - case MUSIC, SOUND: - assetsTotal++; - - var future = loadAudioBuffer(id); - // future.onProgress (load_onProgress.bind (id)); - future.onError(load_onError.bind(id)); - future.onComplete(loadAudioBuffer_onComplete.bind(id)); - case TEXT: - assetsTotal++; - + Log.verbose("Preloading asset: " + id + " [" + types.get(id) + "]"); var future = loadText(id); // future.onProgress (load_onProgress.bind (id)); future.onError(load_onError.bind(id)); @@ -231,10 +242,10 @@ import flash.media.Sound; default: } } - - __assetLoaded(null); }; + __assetLoaded(null); + if (cachedBytes.exists(id)) { packedData_onComplete(cachedBytes.get(id)); @@ -248,7 +259,9 @@ import flash.media.Sound; var path = Path.join([basePath, libPath]); path = __cacheBreak(path); - Bytes.loadFromFile(path).onError(promise.error).onComplete(packedData_onComplete); + var packedData_onProgress = load_onProgress.bind(this.id); + + Bytes.loadFromFile(path).onProgress(packedData_onProgress).onError(promise.error).onComplete(packedData_onComplete); } } @@ -401,18 +414,39 @@ import flash.media.Sound; super.__fromManifest(manifest); + var packedBytesTotal = 0; + bytesTotal = 0; + for (asset in manifest.assets) { + var id = asset.id; + if (Reflect.hasField(asset, "position")) { - positions.set(asset.id, Reflect.field(asset, "position")); + positions.set(id, Reflect.field(asset, "position")); } if (Reflect.hasField(asset, "length")) { - lengths.set(asset.id, Reflect.field(asset, "length")); + var length = Reflect.field(asset, "length"); + lengths.set(id, length); + + //for individual packed assets, the size represents the work done unpacking them + //since this is likely to be much faster than downloading, set it to something + //small like the packed length / 10. + sizes.set(id, Math.floor(length / 10)); + + packedBytesTotal += length; + } + + if (preload.exists(id) && preload.get(id) && sizes.exists(id)) + { + bytesTotal += sizes.get(id); } } + + sizes.set(this.id, packedBytesTotal); + bytesTotal += packedBytesTotal; } @:noCompletion private override function __assetLoaded(id:String):Void @@ -424,38 +458,35 @@ import flash.media.Sound; Log.verbose("Loaded asset: " + id + " [" + types.get(id) + "] (" + (assetsLoaded - 1) + "/" + (assetsTotal - 1) + ")"); } - // if (id != null) { - - // var size = sizes.get (id); - - // if (!bytesLoadedCache.exists (id)) { - - // bytesLoaded += size; - - // } else { - - // var cache = bytesLoadedCache.get (id); - - // if (cache < size) { - - // bytesLoaded += (size - cache); - - // } + if (id != null) + { + var size = sizes.exists(id) ? sizes.get(id) : 0; - // } + if (!bytesLoadedCache.exists(id)) + { + bytesLoaded += size; + } + else + { + var cache = bytesLoadedCache.get(id); - // bytesLoadedCache.set (id, size); + if (cache < size) + { + bytesLoaded += (size - cache); + } + } - // } + bytesLoadedCache.set(id, size); + } if (assetsLoaded < assetsTotal) { - // promise.progress (bytesLoaded, bytesTotal); + promise.progress(bytesLoaded, bytesTotal); } else { loaded = true; - // promise.progress (bytesTotal, bytesTotal); + promise.progress(bytesTotal, bytesTotal); promise.complete(this); } } diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index ad20903ccd..569335793b 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -496,12 +496,6 @@ class CommandLineTools case LINUX: var arguments = Sys.args(); - var raspberryPi = false; - - for (argument in arguments) - { - if (argument == "-rpi") raspberryPi = true; - } if (System.hostArchitecture == X64) { diff --git a/tools/RunScript.hx b/tools/RunScript.hx index 37f1030961..c4abce4cdf 100644 --- a/tools/RunScript.hx +++ b/tools/RunScript.hx @@ -71,13 +71,13 @@ class RunScript } case "Linux", "LinuxArm": - if (System.hostPlatform == LINUX && System.hostArchitecture != X64) + if (System.hostPlatform == LINUX && System.hostArchitecture != X64 && System.hostArchitecture != ARM64) { System.runCommand(limeDirectory, "neko", args.concat(["linux", "-32", toolsDirectory])); } - case "Linux64", "LinuxArm64": - if (System.hostPlatform == LINUX && System.hostArchitecture == X64) + case "Linux64", "LinuxArm64" + if (System.hostPlatform == LINUX && (System.hostArchitecture == X64 || System.hostArchitecture == ARM64)) { System.runCommand(limeDirectory, "neko", args.concat(["linux", "-64", toolsDirectory])); } diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index dafe00d2ba..6edc8378e1 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -123,7 +123,7 @@ class LinuxPlatform extends PlatformTarget for (architecture in project.architectures) { - if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && architecture == Architecture.X64) + if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && (architecture == Architecture.X64 || architecture == Architecture.ARM64)) { is64 = true; } @@ -139,11 +139,6 @@ class LinuxPlatform extends PlatformTarget } } - if (project.targetFlags.exists("rpi")) - { - isRaspberryPi = true; - } - if (project.targetFlags.exists("neko")) { targetType = "neko"; @@ -166,7 +161,13 @@ class LinuxPlatform extends PlatformTarget targetType = "cpp"; } - targetDirectory = Path.combine(project.app.path, project.config.getString("linux.output-directory", targetType == "cpp" ? "linux" : targetType)); + var defaultTargetDirectory = switch (targetType) + { + case "cpp": "linux"; + case "hl": project.targetFlags.exists("hlc") ? "hlc" : targetType; + default: targetType; + } + targetDirectory = Path.combine(project.app.path, project.config.getString("linux.output-directory", defaultTargetDirectory)); targetDirectory = StringTools.replace(targetDirectory, "arch64", is64 ? "64" : ""); applicationDirectory = targetDirectory + "/bin/"; executablePath = Path.combine(applicationDirectory, project.app.file); @@ -198,7 +199,7 @@ class LinuxPlatform extends PlatformTarget } else { - ProjectHelper.copyLibrary(project, ndll, "Linux" + (is64 ? "64" : ""), "", + ProjectHelper.copyLibrary(project, ndll, "Linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64)?"Arm":"") + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, targetSuffix); @@ -419,7 +420,7 @@ class LinuxPlatform extends PlatformTarget { // var project = project.clone (); - if (isRaspberryPi) + if(targetFlags.exists('rpi')) { project.haxedefs.set("rpi", 1); } diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index 6de0fc6894..3737419d4d 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -147,7 +147,13 @@ class MacPlatform extends PlatformTarget targetType = "cpp"; } - targetDirectory = Path.combine(project.app.path, project.config.getString("mac.output-directory", targetType == "cpp" ? "macos" : targetType)); + var defaultTargetDirectory = switch (targetType) + { + case "cpp": "macos"; + case "hl": project.targetFlags.exists("hlc") ? "hlc" : targetType; + default: targetType; + } + targetDirectory = Path.combine(project.app.path, project.config.getString("mac.output-directory", defaultTargetDirectory)); targetDirectory = StringTools.replace(targetDirectory, "arch64", dirSuffix); applicationDirectory = targetDirectory + "/bin/" + project.app.file + ".app"; contentDirectory = applicationDirectory + "/Contents/Resources"; diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 2aed5d0406..60a693ffde 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -206,7 +206,13 @@ class WindowsPlatform extends PlatformTarget } } - targetDirectory = Path.combine(project.app.path, project.config.getString("windows.output-directory", targetType == "cpp" ? "windows" : targetType)); + var defaultTargetDirectory = switch (targetType) + { + case "cpp": "windows"; + case "hl": project.targetFlags.exists("hlc") ? "hlc" : targetType; + default: targetType; + } + targetDirectory = Path.combine(project.app.path, project.config.getString("windows.output-directory", defaultTargetDirectory)); targetDirectory = StringTools.replace(targetDirectory, "arch64", is64 ? "64" : ""); if (targetType == "winjs")