diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d622cd4df..15109e904 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -60,11 +60,11 @@ jobs: cd ../../../raylib # ${{ matrix.ARCH }}-linux-gnu-gcc -v - # TODO: Support 32bit (i386) shared library building + # TODO: Support 32bit (i386) static/shared library building - name: Build Library run: | cd src - make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32" -B + make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-m32" -B # make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B cd .. if: matrix.bits == 32 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 079513673..c98c3a4dc 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -49,14 +49,14 @@ jobs: run: | cd src clang --version - make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B - # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" - # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B + make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B + # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" + # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B # lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a libraylib_x86_64.a libraylib_arm64.a make clean - make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B - # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B - # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B + make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B + # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B + # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CUSTOM_CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B # lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.3.1.0.dylib libraylib_x86_64.3.1.0.dylib libraylib_arm64.3.1.0.dylib # cp -v ./libraylib_arm64.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib # cp -v ./libraylib_arm64.310.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.310.dylib diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml index 4427d2cb6..9b15c34e9 100644 --- a/.github/workflows/webassembly.yml +++ b/.github/workflows/webassembly.yml @@ -27,9 +27,9 @@ jobs: uses: actions/checkout@master - name: Setup emsdk - uses: mymindstorm/setup-emsdk@v9 + uses: mymindstorm/setup-emsdk@v11 with: - version: 2.0.0 + version: 3.0.0 actions-cache-folder: 'emsdk-cache' - name: Setup Release Version @@ -52,7 +52,7 @@ jobs: run: | cd src emcc -v - make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B + make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-main" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B cd .. - name: Generate Artifacts diff --git a/BINDINGS.md b/BINDINGS.md index d09c642ef..99024eef7 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -1,54 +1,58 @@ # raylib bindings and wrappers -Some people ported raylib to other languages in form of bindings or wrappers to the library. Here it is alist with all the ports available. Feel free to send a PR if you know of any binding/wrapper not in this list. +Some people ported raylib to other languages in form of bindings or wrappers to the library. Here is a list with all the ports available. Feel free to send a PR if you know of any binding/wrapper not in this list. ### Language Bindings -| name | raylib version | language | repo | -|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------| -| raylib | **4.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib | -| Raylib-cs | 3.7 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs | -| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo | -| bindbc-raylib3 | **4.0** | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib3 | -| dray | 3.5 | [D](https://dlang.org/) | https://github.com/xdrie/dray | -| raylib-go | **4.0** | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go | -| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs | -| raylib-lua | **4.0** | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua | -| raylua | **4.0** | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua | -| nelua-raylib | 4.0 | [nelua](https://nelua.io/) | https://github.com/AKDev21/nelua-raylib | -| NimraylibNow! | 3.7 | [Nim](https://nim-lang.org/) | https://github.com/greenfork/nimraylib_now | -| raylib-Forever | auto | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever | -| Ray4Laz | **4.0** | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/GuvaCode/Ray4Laz | -| pyraylib | 3.7 | [Python](https://www.python.org/) | https://github.com/Ho011/pyraylib | -| raylib-python-cffi | **4.0** | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi | -| jaylib | 3.7 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ | -| raylib-j | 3.7 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/CreedVI/Raylib-J | -| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib | -| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php | -| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp | -| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor | -| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib | -| hxRaylib | 4.0 | [Haxe](https://haxe.org/) | https://github.com/ForeignSasquatch/hxRaylib | -| raylib-wren | **4.0** | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren | -| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | https://github.com/Deathbat2190/raylib_odin_bindings | -| raylib-odin | **4.0**| [Odin](https://odin-lang.org/) | https://github.com/odin-lang/Odin/tree/master/vendor/raylib | -| raylib.v | **4.0** | [V](https://vlang.io/) | https://github.com/irishgreencitrus/raylib.v | -| raylib-ocaml | 3.7 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml | -| raylib-swift | 3.7 | [Swift](https://swift.org/) | https://github.com/STREGAsGate/Raylib | -| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | -| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib | -| rayex | 3.7 | [elixir](https://elixir-lang.org/) | https://github.com/shiryel/rayex | -| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | https://github.com/electronstudio/kaylib | -| dlang_raylib | 3.7 | [D](https://dlang.org) | https://github.com/rc-05/dlang_raylib | -| raylib-freebasic | **4.0** | [FreeBASIC](https://www.freebasic.net/) | https://github.com/WIITD/raylib-freebasic | -| raylib-cr | **4.0** | [Crystal](https://crystal-lang.org/) | https://github.com/sol-vin/raylib-cr | -| dart-raylib | **4.0** | [Dart](https://dart.dev/) | https://gitlab.com/wolfenrain/dart-raylib | +| name | raylib version | language | license | repo | +|:------------------:|:---------------:|:---------:|:----------:|-----------------------------------------------------------| +| raylib | **4.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib | +| Raylib-cs | 3.7 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs | +| Raylib-CsLo | **4.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo | +| raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo | +| bindbc-raylib3 | **4.0** | [D](https://dlang.org/) | BSL-1.0 | https://github.com/o3o/bindbc-raylib3 | +| dray | **4.0** | [D](https://dlang.org/) | Apache-2.0 | https://github.com/xdrie/dray | +| raylib-d | **4.0** | [D](https://dlang.org/) | Zlib | https://github.com/schveiguy/raylib-d | +| raylib-go | **4.0** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go | +| raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile | +| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | Zlib | https://github.com/deltaphc/raylib-rs | +| raylib-lua | **4.0** | [Lua](http://www.lua.org/) | ISC | https://github.com/TSnake41/raylib-lua | +| raylua | **4.0** | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua | +| nelua-raylib | 4.0 | [nelua](https://nelua.io/) | MIT | https://github.com/AKDev21/nelua-raylib | +| NimraylibNow! | 4.0 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now | +| raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever | +| Ray4Laz | **4.0** | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))| Zlib | https://github.com/GuvaCode/Ray4Laz | +| pyraylib | 3.7 | [Python](https://www.python.org/) | Zlib | https://github.com/Ho011/pyraylib | +| raylib-python-cffi | **4.0** | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi | +| jaylib | **4.0** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3 | https://github.com/electronstudio/jaylib/ | +| raylib-j | 3.7 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | ? | https://github.com/CreedVI/Raylib-J | +| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | Zlib | https://github.com/RobLoach/node-raylib | +| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/joseph-montanez/raylib-php | +| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib | https://github.com/oraoto/raylib-phpcpp | +| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | MIT | https://github.com/ArnautDaniel/raylib-factor | +| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | ? | https://github.com/ArnautDaniel/gforth-raylib | +| hxRaylib | 4.0 | [Haxe](https://haxe.org/) | Zlib | https://github.com/ForeignSasquatch/hxRaylib | +| raylib-wren | **4.0** | [Wren](http://wren.io/) | ISC | https://github.com/TSnake41/raylib-wren | +| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings | +| raylib-odin | **4.0** | [Odin](https://odin-lang.org/) | BSD-3Clause | https://github.com/odin-lang/Odin/tree/master/vendor/raylib | +| raylib.v | **4.0** | [V](https://vlang.io/) | Zlib | https://github.com/irishgreencitrus/raylib.v | +| raylib-ocaml | 3.7 | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml | +| raylib-swift | 3.7 | [Swift](https://swift.org/) | MIT | https://github.com/STREGAsGate/Raylib | +| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | +| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | ? | https://github.com/RedCubeDev-ByteSpace/Relib | +| rayex | 3.7 | [elixir](https://elixir-lang.org/) | Apache-2.0 | https://github.com/shiryel/rayex | +| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | ? | https://github.com/electronstudio/kaylib | +| dlang_raylib | 3.7 | [D](https://dlang.org) | ? |https://github.com/rc-05/dlang_raylib | +| raylib-freebasic | **4.0** | [FreeBASIC](https://www.freebasic.net/) | MIT | https://github.com/WIITD/raylib-freebasic | +| raylib-cr | **4.0** | [Crystal](https://crystal-lang.org/) | Apache-2.0 | https://github.com/sol-vin/raylib-cr | +| dart-raylib | **4.0** | [Dart](https://dart.dev/) | MIT | https://gitlab.com/wolfenrain/dart-raylib | +| raylib-scopes | auto | [Scopes](http://scopes.rocks) | MIT | https://github.com/salotz/raylib-scopes | ### Utility Wrapers These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm. -| name | raylib version | language | repo | -|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------| -| raylib-cpp | **4.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp | +| name | raylib version | language | license | repo | +|:------------------:|:-------------: | :--------:|:-------:|:-------------------------------------------------------------| +| raylib-cpp | **4.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp | ### Older or Unmaintained Language Bindings These are older raylib bindings that are more than 2 versions old or have not been maintained. @@ -58,55 +62,55 @@ These are older raylib bindings that are more than 2 versions old or have not be | RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS | | raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d | | bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib | -| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib | -| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus | -| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go | +| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib | +| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus | +| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go | | raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore | | LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib | -| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol | +| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol | | raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 | | raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua | | raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua | | raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim | | raylib-Nim | 1.7 | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim | -| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib | +| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib | | raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell | -| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr | +| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr | | raylib.cr | 2.0 | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr | | cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray | | raylib-pas | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas | | raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal | -| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib | -| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby | -| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi | +| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib | +| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby | +| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi | | raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby | -| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg | -| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py | +| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg | +| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py | | raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java | -| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib | -| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib | +| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib | +| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib | | raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape | | raylib-v7 | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/Rabios/raylib-v7 | -| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript | +| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript | | raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel | -| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d | +| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d | | raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi | -| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe | +| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe | | ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib | | cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib | | raylib-scm | 2.5 | [Chicken Scheme](https://www.call-cc.org/) | https://github.com/yashrk/raylib-scm | | raylib-chibi | 2.5 | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi | | raylib-gambit-scheme | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) | https://github.com/georgjz/raylib-gambit-scheme | -| Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib | -| raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin | -| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib | -| raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig | +| Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib | +| raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin | +| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib | +| raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig | | raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kevinw/raylib-jai | -| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments | -| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada | -| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib | -| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit | -| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod | +| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments | +| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada | +| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib | +| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit | +| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod | | raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic | | raylib-xdpw | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) | https://github.com/vtereshkov/raylib-xdpw | | raylib-carp | 3.0 | [Carp](https://github.com/carp-lang/Carp) | https://github.com/pluckyporcupine/raylib-carp | @@ -116,7 +120,7 @@ These are older raylib bindings that are more than 2 versions old or have not be | raylib-ats2 | 3.0 | [ATS2](http://www.ats-lang.org/) | https://github.com/mephistopheles-8/raylib-ats2 | | raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef | | raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never | -| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* | +| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* | diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 6f0a4c1f3..463977333 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -27,6 +27,13 @@ endif() option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF) set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option") +# raylib modules included +cmake_dependent_option(SUPPORT_MODULE_RSHAPES "Include module: rshapes" ON CUSTOMIZE_BUILD ON) +cmake_dependent_option(SUPPORT_MODULE_RTEXTURES "Include module: rtextures" ON CUSTOMIZE_BUILD ON) +cmake_dependent_option(SUPPORT_MODULE_RTEXT "Include module: rtext" ON CUSTOMIZE_BUILD ON) +cmake_dependent_option(SUPPORT_MODULE_RMODELS "Include module: rmodels" ON CUSTOMIZE_BUILD ON) +cmake_dependent_option(SUPPORT_MODULE_RAUDIO "Include module: raudio" ON CUSTOMIZE_BUILD ON) + # rcore.c cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON) @@ -57,6 +64,7 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_BMP "Support loading BMP as textures" cmake_dependent_option(SUPPORT_FILEFORMAT_TGA "Support loading TGA as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_JPG "Support loading JPG as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_GIF "Support loading GIF as textures" ${OFF} CUSTOMIZE_BUILD OFF) +cmake_dependent_option(SUPPORT_FILEFORMAT_QOI "Support loading QOI as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF) diff --git a/SPONSORS.md b/SPONSORS.md index e9a952535..5842d3b7a 100644 --- a/SPONSORS.md +++ b/SPONSORS.md @@ -22,13 +22,14 @@ The following people are currently [**sponsoring raylib**](https://github.com/sp - Níckolas Daniel da Silva ([@nawarian](https://github.com/nawarian) - [thephp.website](https://thephp.website/)) - kenzie ([@sme-ek](https://github.com/sme-ek)) - Allan Regush ([@AllanRegush](https://github.com/AllanRegush)) - - Jeffery Myers ([@JeffM2501](https://github.com/ProfJski)) - - Ryan Roden-Corrent ([@rcorre](https://github.com/ProfJski)) - - michaelfiber ([@michaelfiber](https://github.com/ProfJski)) - - Nikhilesh S ([@nikki93](https://github.com/ProfJski)) - - kevinabraun ([@kevinabraun](https://github.com/ProfJski)) - - Matthew Owens ([@MatthewOwens](https://github.com/ProfJski)) - - Tim Eilers ([@eilerstim](https://github.com/ProfJski)) + - Jeffery Myers ([@JeffM2501](https://github.com/JeffM2501)) + - Ryan Roden-Corrent ([@rcorre](https://github.com/rcorre)) + - michaelfiber ([@michaelfiber](https://github.com/michaelfiber)) + - Nikhilesh S ([@nikki93](https://github.com/nikki93)) + - kevinabraun ([@kevinabraun](https://github.com/kevinabraun)) + - Matthew Owens ([@MatthewOwens](https://github.com/MatthewOwens)) + - Tim Eilers ([@eilerstim](https://github.com/eilerstim)) + - Laurentino Luna ([@catmanl](https://github.com/catmanl)) ### Past raylib GitHub Sponsors diff --git a/examples/Makefile b/examples/Makefile index c16dbed53..c845588c5 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -61,6 +61,15 @@ USE_EXTERNAL_GLFW ?= FALSE # by default it uses X11 windowing system USE_WAYLAND_DISPLAY ?= FALSE +# Use cross-compiler for PLATFORM_RPI +ifeq ($(PLATFORM),PLATFORM_RPI) + USE_RPI_CROSS_COMPILER ?= FALSE + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) + RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry + RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot + endif +endif + # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected ifeq ($(PLATFORM),PLATFORM_DESKTOP) # No uname.exe on MinGW!, but OS=Windows_NT on Windows! @@ -178,7 +187,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif # Define default make program -MAKE = make +MAKE ?= make ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) @@ -201,10 +210,10 @@ endif # -std=gnu99 defines C language mode (GNU C from 1999 revision) # -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec -CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result +CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result ifeq ($(BUILD_MODE),DEBUG) - CFLAGS += -g + CFLAGS += -g -D_DEBUG ifeq ($(PLATFORM),PLATFORM_WEB) CFLAGS += -s ASSERTIONS=1 --profiling endif @@ -243,9 +252,9 @@ INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLI # Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) # RPI required libraries - INCLUDE_PATHS += -I/opt/vc/include - INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux - INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads endif ifeq ($(PLATFORM),PLATFORM_DRM) # DRM required libraries @@ -275,12 +284,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif ifeq ($(PLATFORM_OS),BSD) # Consider -L$(RAYLIB_INSTALL_PATH) - LDFLAGS += -L. -Lsrc -L/usr/local/lib + LDFLAGS += -Lsrc -L/usr/local/lib endif ifeq ($(PLATFORM_OS),LINUX) # Reset everything. # Precedence: immediately local, installed version, raysan5 provided libs - LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH) + LDFLAGS += -L$(RAYLIB_INSTALL_PATH) endif endif ifeq ($(PLATFORM),PLATFORM_WEB) @@ -310,7 +319,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) EXT = .html endif ifeq ($(PLATFORM),PLATFORM_RPI) - LDFLAGS += -L/opt/vc/lib + LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib endif # Define any libraries required on linking @@ -364,6 +373,9 @@ ifeq ($(PLATFORM),PLATFORM_RPI) # Libraries for Raspberry Pi compiling # NOTE: Required packages: libasound2-dev (ALSA) LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) + LDLIBS += -lvchiq_arm -lvcos + endif endif ifeq ($(PLATFORM),PLATFORM_DRM) # Libraries for DRM compiling diff --git a/examples/Makefile.Web b/examples/Makefile.Web index 4aaf54a12..52924c10a 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -128,7 +128,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) CLANG_PATH = $(EMSDK_PATH)/upstream/bin PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin - export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH) + export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH) endif # Define raylib release directory for compiled library. @@ -178,7 +178,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif # Define default make program -MAKE = make +MAKE ?= make ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) @@ -200,11 +200,12 @@ endif # -std=c99 defines C language mode (standard C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision) # -Wno-missing-braces ignore invalid warning (GCC bug 53119) +# -Wno-unused-value ignore unused return values of some functions (i.e. fread()) # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec -CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result +CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wno-unused-value ifeq ($(BUILD_MODE),DEBUG) - CFLAGS += -g + CFLAGS += -g -D_DEBUG ifeq ($(PLATFORM),PLATFORM_WEB) CFLAGS += -s ASSERTIONS=1 --profiling endif diff --git a/examples/build.zig b/examples/build.zig index c05808bf7..5c3a69d29 100644 --- a/examples/build.zig +++ b/examples/build.zig @@ -21,13 +21,20 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi // zig's mingw headers do not include pthread.h if (std.mem.eql(u8, "core_loading_thread", name) and target.getOsTag() == .windows) continue; - const exe = b.addExecutable(name, path); + const exe = b.addExecutable(name, null); + exe.addCSourceFile(path, switch (target.getOsTag()) { + .windows => &[_][]const u8{}, + .linux => &[_][]const u8{}, + .macos => &[_][]const u8{"-DPLATFORM_DESKTOP"}, + else => @panic("Unsupported OS"), + }); exe.setTarget(target); exe.setBuildMode(mode); exe.linkLibC(); exe.addObjectFile(switch (target.getOsTag()) { .windows => "../src/raylib.lib", .linux => "../src/libraylib.a", + .macos => "../src/libraylib.a", else => @panic("Unsupported OS"), }); @@ -49,6 +56,14 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi exe.linkSystemLibrary("m"); exe.linkSystemLibrary("X11"); }, + .macos => { + exe.linkFramework("Foundation"); + exe.linkFramework("Cocoa"); + exe.linkFramework("OpenGL"); + exe.linkFramework("CoreAudio"); + exe.linkFramework("CoreVideo"); + exe.linkFramework("IOKit"); + }, else => { @panic("Unsupported OS"); }, diff --git a/examples/models/models_mesh_generation.c b/examples/models/models_mesh_generation.c index 095aad827..7213f58d9 100644 --- a/examples/models/models_mesh_generation.c +++ b/examples/models/models_mesh_generation.c @@ -5,64 +5,15 @@ * This example has been created using raylib 1.8 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * -* Copyright (c) 2017 Ramon Santamaria (Ray San) +* Copyright (c) 2017-2021 Ramon Santamaria (@raysan5) * ********************************************************************************************/ #include "raylib.h" -#define NUM_MODELS 9 // Parametric 3d shapes to generate +#define NUM_MODELS 9 // Parametric 3d shapes to generate -void AllocateMeshData(Mesh* mesh, int triangleCount) -{ - mesh->vertexCount = triangleCount * 3; - mesh->triangleCount = triangleCount; - - mesh->vertices = (float*)MemAlloc(mesh->vertexCount * 3 * sizeof(float)); - mesh->texcoords = (float*)MemAlloc(mesh->vertexCount * 2 * sizeof(float)); - mesh->normals = (float*)MemAlloc(mesh->vertexCount * 3 * sizeof(float)); -} - -// generate a simple triangle mesh from code -Mesh MakeMesh() -{ - Mesh mesh = { 0 }; - AllocateMeshData(&mesh, 1); - - // vertex at the origin - mesh.vertices[0] = 0; - mesh.vertices[1] = 0; - mesh.vertices[2] = 0; - mesh.normals[0] = 0; - mesh.normals[1] = 1; - mesh.normals[2] = 0; - mesh.texcoords[0] = 0; - mesh.texcoords[1] = 0; - - // vertex at 1,0,2 - mesh.vertices[3] = 1; - mesh.vertices[4] = 0; - mesh.vertices[5] = 2; - mesh.normals[3] = 0; - mesh.normals[4] = 1; - mesh.normals[5] = 0; - mesh.texcoords[2] = 0.5f; - mesh.texcoords[3] = 1.0f; - - // vertex at 2,0,0 - mesh.vertices[6] = 2; - mesh.vertices[7] = 0; - mesh.vertices[8] = 0; - mesh.normals[6] = 0; - mesh.normals[7] = 1; - mesh.normals[8] = 0; - mesh.texcoords[4] = 1; - mesh.texcoords[5] =0; - - UploadMesh(&mesh, false); - - return mesh; -} +static Mesh GenMeshCustom(void); // Generate a simple triangle mesh from code int main(void) { @@ -88,7 +39,18 @@ int main(void) models[5] = LoadModelFromMesh(GenMeshTorus(0.25f, 4.0f, 16, 32)); models[6] = LoadModelFromMesh(GenMeshKnot(1.0f, 2.0f, 16, 128)); models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f)); - models[8] = LoadModelFromMesh(MakeMesh()); + models[8] = LoadModelFromMesh(GenMeshCustom()); + + // Generated meshes could be exported as .obj files + //ExportMesh(models[0].meshes[0], "plane.obj"); + //ExportMesh(models[1].meshes[0], "cube.obj"); + //ExportMesh(models[2].meshes[0], "sphere.obj"); + //ExportMesh(models[3].meshes[0], "hemisphere.obj"); + //ExportMesh(models[4].meshes[0], "cylinder.obj"); + //ExportMesh(models[5].meshes[0], "torus.obj"); + //ExportMesh(models[6].meshes[0], "knot.obj"); + //ExportMesh(models[7].meshes[0], "poly.obj"); + //ExportMesh(models[8].meshes[0], "custom.obj"); // Set checked texture as default diffuse component for all models material for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; @@ -157,7 +119,7 @@ int main(void) case 5: DrawText("TORUS", 680, 10, 20, DARKBLUE); break; case 6: DrawText("KNOT", 680, 10, 20, DARKBLUE); break; case 7: DrawText("POLY", 680, 10, 20, DARKBLUE); break; - case 8: DrawText("Parametric(custom)", 580, 10, 20, DARKBLUE); break; + case 8: DrawText("Custom (triangle)", 580, 10, 20, DARKBLUE); break; default: break; } @@ -176,4 +138,50 @@ int main(void) //-------------------------------------------------------------------------------------- return 0; -} \ No newline at end of file +} + +// Generate a simple triangle mesh from code +static Mesh GenMeshCustom(void) +{ + Mesh mesh = { 0 }; + mesh.triangleCount = 1; + mesh.vertexCount = mesh.triangleCount*3; + mesh.vertices = (float *)MemAlloc(mesh.vertexCount*3*sizeof(float)); // 3 vertices, 3 coordinates each (x, y, z) + mesh.texcoords = (float *)MemAlloc(mesh.vertexCount*2*sizeof(float)); // 3 vertices, 2 coordinates each (x, y) + mesh.normals = (float *)MemAlloc(mesh.vertexCount*3*sizeof(float)); // 3 vertices, 3 coordinates each (x, y, z) + + // Vertex at (0, 0, 0) + mesh.vertices[0] = 0; + mesh.vertices[1] = 0; + mesh.vertices[2] = 0; + mesh.normals[0] = 0; + mesh.normals[1] = 1; + mesh.normals[2] = 0; + mesh.texcoords[0] = 0; + mesh.texcoords[1] = 0; + + // Vertex at (1, 0, 2) + mesh.vertices[3] = 1; + mesh.vertices[4] = 0; + mesh.vertices[5] = 2; + mesh.normals[3] = 0; + mesh.normals[4] = 1; + mesh.normals[5] = 0; + mesh.texcoords[2] = 0.5f; + mesh.texcoords[3] = 1.0f; + + // Vertex at (2, 0, 0) + mesh.vertices[6] = 2; + mesh.vertices[7] = 0; + mesh.vertices[8] = 0; + mesh.normals[6] = 0; + mesh.normals[7] = 1; + mesh.normals[8] = 0; + mesh.texcoords[4] = 1; + mesh.texcoords[5] =0; + + // Upload mesh data from CPU (RAM) to GPU (VRAM) memory + UploadMesh(&mesh, false); + + return mesh; +} diff --git a/examples/raylib_compile_execute.bat b/examples/raylib_compile_execute.bat index ddea69473..59a25fc51 100644 --- a/examples/raylib_compile_execute.bat +++ b/examples/raylib_compile_execute.bat @@ -25,8 +25,8 @@ cmd /c if exist %NAMEPART%.exe del /F %NAMEPART%.exe :: -std=c99 : Use C99 language standard :: -Wall : Enable all compilation Warnings :: -mwindows : Compile a Windows executable, no cmd window -gcc -o %NAMEPART%.exe %FILENAME% %RAYLIB_RES_FILE% -s -O2 -I%RAYLIB_INCLUDE_DIR% -I%RAYLIB_LIB_DIR% -lraylib -lopengl32 -lgdi32 -lwinmm -std=c99 -Wall -mwindows +gcc -o %NAMEPART%.exe %FILENAME% %RAYLIB_RES_FILE% -s -O2 -I%RAYLIB_INCLUDE_DIR% -L%RAYLIB_LIB_DIR% -lraylib -lopengl32 -lgdi32 -lwinmm -std=c99 -Wall -mwindows :: . :: > Executing program :: ------------------------- -cmd /c if exist %NAMEPART%.exe %NAMEPART%.exe \ No newline at end of file +cmd /c if exist %NAMEPART%.exe %NAMEPART%.exe diff --git a/examples/text/resources/LICENSE.md b/examples/text/resources/LICENSE.md index c2a3ad0c7..506a4aaf0 100644 --- a/examples/text/resources/LICENSE.md +++ b/examples/text/resources/LICENSE.md @@ -6,7 +6,7 @@ | fonts/setback.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/setback.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | fonts/jupiter_crash.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | fonts/mecha.png | Captain Falcon | [Freeware](https://www.dafont.com/es/mecha-cf.font) | Atlas created by [@raysan5](https://github.com/raysan5) | -| fonts/pixelplay.png | Aleksander Shevchuk | [Freeware](https://www.dafont.com/es/pixelplay.fon) | Atlas created by [@raysan5](https://github.com/raysan5) | +| fonts/pixelplay.png | Aleksander Shevchuk | [Freeware](https://www.dafont.com/es/pixelplay.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | fonts/pixantiqua.ttf | Gerhard Großmann | [Freeware](https://www.dafont.com/es/pixantiqua.font) | Atlas created by [@raysan5](https://github.com/raysan5) | | anonymous_pro_bold.ttf | [Mark Simonson](https://fonts.google.com/specimen/Anonymous+Pro) | [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) | - | | custom_alagard.png | [Brian Kent (AEnigma)](https://www.dafont.com/es/aenigma.d188) | [Freeware](https://www.dafont.com/es/jupiter-crash.font) | Atlas created by [@raysan5](https://github.com/raysan5) | diff --git a/parser/raylib_api.json b/parser/raylib_api.json index 0d2fb2e71..d7c64d26f 100644 --- a/parser/raylib_api.json +++ b/parser/raylib_api.json @@ -2,7 +2,7 @@ "structs": [ { "name": "Vector2", - "description": "", + "description": "Vector2, 2 components", "fields": [ { "name": "x", @@ -18,7 +18,7 @@ }, { "name": "Vector3", - "description": "", + "description": "Vector3, 3 components", "fields": [ { "name": "x", @@ -39,7 +39,7 @@ }, { "name": "Vector4", - "description": "", + "description": "Vector4, 4 components", "fields": [ { "name": "x", @@ -65,7 +65,7 @@ }, { "name": "Matrix", - "description": "", + "description": "Matrix, 4x4 components, column major, OpenGL style, right handed", "fields": [ { "name": "m0, m4, m8, m12", @@ -91,7 +91,7 @@ }, { "name": "Color", - "description": "", + "description": "Color, 4 components, R8G8B8A8 (32bit)", "fields": [ { "name": "r", @@ -117,7 +117,7 @@ }, { "name": "Rectangle", - "description": "", + "description": "Rectangle, 4 components", "fields": [ { "name": "x", @@ -143,7 +143,7 @@ }, { "name": "Image", - "description": "", + "description": "Image, pixel data stored in CPU memory (RAM)", "fields": [ { "name": "data", @@ -174,7 +174,7 @@ }, { "name": "Texture", - "description": "", + "description": "Texture, tex data stored in GPU memory (VRAM)", "fields": [ { "name": "id", @@ -205,7 +205,7 @@ }, { "name": "RenderTexture", - "description": "", + "description": "RenderTexture, fbo for texture rendering", "fields": [ { "name": "id", @@ -226,7 +226,7 @@ }, { "name": "NPatchInfo", - "description": "", + "description": "NPatchInfo, n-patch layout info", "fields": [ { "name": "source", @@ -262,7 +262,7 @@ }, { "name": "GlyphInfo", - "description": "", + "description": "GlyphInfo, font characters glyphs info", "fields": [ { "name": "value", @@ -293,7 +293,7 @@ }, { "name": "Font", - "description": "", + "description": "Font, font texture and GlyphInfo array data", "fields": [ { "name": "baseSize", @@ -329,7 +329,7 @@ }, { "name": "Camera3D", - "description": "", + "description": "Camera, defines position/orientation in 3d space", "fields": [ { "name": "position", @@ -360,7 +360,7 @@ }, { "name": "Camera2D", - "description": "", + "description": "Camera2D, defines position/orientation in 2d space", "fields": [ { "name": "offset", @@ -386,7 +386,7 @@ }, { "name": "Mesh", - "description": "", + "description": "Mesh, vertex data and vao/vbo", "fields": [ { "name": "vertexCount", @@ -467,7 +467,7 @@ }, { "name": "Shader", - "description": "", + "description": "Shader", "fields": [ { "name": "id", @@ -483,7 +483,7 @@ }, { "name": "MaterialMap", - "description": "", + "description": "MaterialMap", "fields": [ { "name": "texture", @@ -504,7 +504,7 @@ }, { "name": "Material", - "description": "", + "description": "Material, includes shader and maps", "fields": [ { "name": "shader", @@ -525,7 +525,7 @@ }, { "name": "Transform", - "description": "", + "description": "Transform, vectex transformation data", "fields": [ { "name": "translation", @@ -546,7 +546,7 @@ }, { "name": "BoneInfo", - "description": "", + "description": "Bone, skeletal animation bone", "fields": [ { "name": "name[32]", @@ -562,7 +562,7 @@ }, { "name": "Model", - "description": "", + "description": "Model, meshes, materials and animation data", "fields": [ { "name": "transform", @@ -613,7 +613,7 @@ }, { "name": "ModelAnimation", - "description": "", + "description": "ModelAnimation", "fields": [ { "name": "boneCount", @@ -639,7 +639,7 @@ }, { "name": "Ray", - "description": "", + "description": "Ray, ray for raycasting", "fields": [ { "name": "position", @@ -655,7 +655,7 @@ }, { "name": "RayCollision", - "description": "", + "description": "RayCollision, ray hit information", "fields": [ { "name": "hit", @@ -681,7 +681,7 @@ }, { "name": "BoundingBox", - "description": "", + "description": "BoundingBox", "fields": [ { "name": "min", @@ -697,7 +697,7 @@ }, { "name": "Wave", - "description": "", + "description": "Wave, audio wave data", "fields": [ { "name": "frameCount", @@ -728,7 +728,7 @@ }, { "name": "AudioStream", - "description": "", + "description": "AudioStream, custom audio stream", "fields": [ { "name": "buffer", @@ -754,7 +754,7 @@ }, { "name": "Sound", - "description": "", + "description": "Sound", "fields": [ { "name": "stream", @@ -770,7 +770,7 @@ }, { "name": "Music", - "description": "", + "description": "Music, audio stream, anything longer than ~10 seconds should be streamed", "fields": [ { "name": "stream", @@ -801,7 +801,7 @@ }, { "name": "VrDeviceInfo", - "description": "", + "description": "VrDeviceInfo, Head-Mounted-Display device parameters", "fields": [ { "name": "hResolution", @@ -857,7 +857,7 @@ }, { "name": "VrStereoConfig", - "description": "", + "description": "VrStereoConfig, VR stereo rendering configuration for simulator", "fields": [ { "name": "projection[2]", @@ -905,1582 +905,1582 @@ "enums": [ { "name": "ConfigFlags", - "description": "", + "description": "System/Window config flags", "values": [ { "name": "FLAG_VSYNC_HINT", "value": 64, - "description": "" + "description": "Set to try enabling V-Sync on GPU" }, { "name": "FLAG_FULLSCREEN_MODE", "value": 2, - "description": "" + "description": "Set to run program in fullscreen" }, { "name": "FLAG_WINDOW_RESIZABLE", "value": 4, - "description": "" + "description": "Set to allow resizable window" }, { "name": "FLAG_WINDOW_UNDECORATED", "value": 8, - "description": "" + "description": "Set to disable window decoration (frame and buttons)" }, { "name": "FLAG_WINDOW_HIDDEN", "value": 128, - "description": "" + "description": "Set to hide window" }, { "name": "FLAG_WINDOW_MINIMIZED", "value": 512, - "description": "" + "description": "Set to minimize window (iconify)" }, { "name": "FLAG_WINDOW_MAXIMIZED", "value": 1024, - "description": "" + "description": "Set to maximize window (expanded to monitor)" }, { "name": "FLAG_WINDOW_UNFOCUSED", "value": 2048, - "description": "" + "description": "Set to window non focused" }, { "name": "FLAG_WINDOW_TOPMOST", "value": 4096, - "description": "" + "description": "Set to window always on top" }, { "name": "FLAG_WINDOW_ALWAYS_RUN", "value": 256, - "description": "" + "description": "Set to allow windows running while minimized" }, { "name": "FLAG_WINDOW_TRANSPARENT", "value": 16, - "description": "" + "description": "Set to allow transparent framebuffer" }, { "name": "FLAG_WINDOW_HIGHDPI", "value": 8192, - "description": "" + "description": "Set to support HighDPI" }, { "name": "FLAG_MSAA_4X_HINT", "value": 32, - "description": "" + "description": "Set to try enabling MSAA 4X" }, { "name": "FLAG_INTERLACED_HINT", "value": 65536, - "description": "" + "description": "Set to try enabling interlaced video format (for V3D)" } ] }, { "name": "TraceLogLevel", - "description": "", + "description": "Trace log level", "values": [ { "name": "LOG_ALL", "value": 0, - "description": "" + "description": "Display all logs" }, { "name": "LOG_TRACE", "value": 1, - "description": "" + "description": "Trace logging, intended for internal use only" }, { "name": "LOG_DEBUG", "value": 2, - "description": "" + "description": "Debug logging, used for internal debugging, it should be disabled on release builds" }, { "name": "LOG_INFO", "value": 3, - "description": "" + "description": "Info logging, used for program execution info" }, { "name": "LOG_WARNING", "value": 4, - "description": "" + "description": "Warning logging, used on recoverable failures" }, { "name": "LOG_ERROR", "value": 5, - "description": "" + "description": "Error logging, used on unrecoverable failures" }, { "name": "LOG_FATAL", "value": 6, - "description": "" + "description": "Fatal logging, used to abort program: exit(EXIT_FAILURE)" }, { "name": "LOG_NONE", "value": 7, - "description": "" + "description": "Disable logging" } ] }, { "name": "KeyboardKey", - "description": "", + "description": "Keyboard keys (US keyboard layout)", "values": [ { "name": "KEY_NULL", "value": 0, - "description": "" + "description": "Key: NULL, used for no key pressed" }, { "name": "KEY_APOSTROPHE", "value": 39, - "description": "" + "description": "Key: '" }, { "name": "KEY_COMMA", "value": 44, - "description": "" + "description": "Key: ," }, { "name": "KEY_MINUS", "value": 45, - "description": "" + "description": "Key: -" }, { "name": "KEY_PERIOD", "value": 46, - "description": "" + "description": "Key: ." }, { "name": "KEY_SLASH", "value": 47, - "description": "" + "description": "Key: /" }, { "name": "KEY_ZERO", "value": 48, - "description": "" + "description": "Key: 0" }, { "name": "KEY_ONE", "value": 49, - "description": "" + "description": "Key: 1" }, { "name": "KEY_TWO", "value": 50, - "description": "" + "description": "Key: 2" }, { "name": "KEY_THREE", "value": 51, - "description": "" + "description": "Key: 3" }, { "name": "KEY_FOUR", "value": 52, - "description": "" + "description": "Key: 4" }, { "name": "KEY_FIVE", "value": 53, - "description": "" + "description": "Key: 5" }, { "name": "KEY_SIX", "value": 54, - "description": "" + "description": "Key: 6" }, { "name": "KEY_SEVEN", "value": 55, - "description": "" + "description": "Key: 7" }, { "name": "KEY_EIGHT", "value": 56, - "description": "" + "description": "Key: 8" }, { "name": "KEY_NINE", "value": 57, - "description": "" + "description": "Key: 9" }, { "name": "KEY_SEMICOLON", "value": 59, - "description": "" + "description": "Key: ;" }, { "name": "KEY_EQUAL", "value": 61, - "description": "" + "description": "Key: =" }, { "name": "KEY_A", "value": 65, - "description": "" + "description": "Key: A | a" }, { "name": "KEY_B", "value": 66, - "description": "" + "description": "Key: B | b" }, { "name": "KEY_C", "value": 67, - "description": "" + "description": "Key: C | c" }, { "name": "KEY_D", "value": 68, - "description": "" + "description": "Key: D | d" }, { "name": "KEY_E", "value": 69, - "description": "" + "description": "Key: E | e" }, { "name": "KEY_F", "value": 70, - "description": "" + "description": "Key: F | f" }, { "name": "KEY_G", "value": 71, - "description": "" + "description": "Key: G | g" }, { "name": "KEY_H", "value": 72, - "description": "" + "description": "Key: H | h" }, { "name": "KEY_I", "value": 73, - "description": "" + "description": "Key: I | i" }, { "name": "KEY_J", "value": 74, - "description": "" + "description": "Key: J | j" }, { "name": "KEY_K", "value": 75, - "description": "" + "description": "Key: K | k" }, { "name": "KEY_L", "value": 76, - "description": "" + "description": "Key: L | l" }, { "name": "KEY_M", "value": 77, - "description": "" + "description": "Key: M | m" }, { "name": "KEY_N", "value": 78, - "description": "" + "description": "Key: N | n" }, { "name": "KEY_O", "value": 79, - "description": "" + "description": "Key: O | o" }, { "name": "KEY_P", "value": 80, - "description": "" + "description": "Key: P | p" }, { "name": "KEY_Q", "value": 81, - "description": "" + "description": "Key: Q | q" }, { "name": "KEY_R", "value": 82, - "description": "" + "description": "Key: R | r" }, { "name": "KEY_S", "value": 83, - "description": "" + "description": "Key: S | s" }, { "name": "KEY_T", "value": 84, - "description": "" + "description": "Key: T | t" }, { "name": "KEY_U", "value": 85, - "description": "" + "description": "Key: U | u" }, { "name": "KEY_V", "value": 86, - "description": "" + "description": "Key: V | v" }, { "name": "KEY_W", "value": 87, - "description": "" + "description": "Key: W | w" }, { "name": "KEY_X", "value": 88, - "description": "" + "description": "Key: X | x" }, { "name": "KEY_Y", "value": 89, - "description": "" + "description": "Key: Y | y" }, { "name": "KEY_Z", "value": 90, - "description": "" + "description": "Key: Z | z" }, { "name": "KEY_LEFT_BRACKET", "value": 91, - "description": "" + "description": "Key: [" }, { "name": "KEY_BACKSLASH", "value": 92, - "description": "" + "description": "Key: '\\'" }, { "name": "KEY_RIGHT_BRACKET", "value": 93, - "description": "" + "description": "Key: ]" }, { "name": "KEY_GRAVE", "value": 96, - "description": "" + "description": "Key: `" }, { "name": "KEY_SPACE", "value": 32, - "description": "" + "description": "Key: Space" }, { "name": "KEY_ESCAPE", "value": 256, - "description": "" + "description": "Key: Esc" }, { "name": "KEY_ENTER", "value": 257, - "description": "" + "description": "Key: Enter" }, { "name": "KEY_TAB", "value": 258, - "description": "" + "description": "Key: Tab" }, { "name": "KEY_BACKSPACE", "value": 259, - "description": "" + "description": "Key: Backspace" }, { "name": "KEY_INSERT", "value": 260, - "description": "" + "description": "Key: Ins" }, { "name": "KEY_DELETE", "value": 261, - "description": "" + "description": "Key: Del" }, { "name": "KEY_RIGHT", "value": 262, - "description": "" + "description": "Key: Cursor right" }, { "name": "KEY_LEFT", "value": 263, - "description": "" + "description": "Key: Cursor left" }, { "name": "KEY_DOWN", "value": 264, - "description": "" + "description": "Key: Cursor down" }, { "name": "KEY_UP", "value": 265, - "description": "" + "description": "Key: Cursor up" }, { "name": "KEY_PAGE_UP", "value": 266, - "description": "" + "description": "Key: Page up" }, { "name": "KEY_PAGE_DOWN", "value": 267, - "description": "" + "description": "Key: Page down" }, { "name": "KEY_HOME", "value": 268, - "description": "" + "description": "Key: Home" }, { "name": "KEY_END", "value": 269, - "description": "" + "description": "Key: End" }, { "name": "KEY_CAPS_LOCK", "value": 280, - "description": "" + "description": "Key: Caps lock" }, { "name": "KEY_SCROLL_LOCK", "value": 281, - "description": "" + "description": "Key: Scroll down" }, { "name": "KEY_NUM_LOCK", "value": 282, - "description": "" + "description": "Key: Num lock" }, { "name": "KEY_PRINT_SCREEN", "value": 283, - "description": "" + "description": "Key: Print screen" }, { "name": "KEY_PAUSE", "value": 284, - "description": "" + "description": "Key: Pause" }, { "name": "KEY_F1", "value": 290, - "description": "" + "description": "Key: F1" }, { "name": "KEY_F2", "value": 291, - "description": "" + "description": "Key: F2" }, { "name": "KEY_F3", "value": 292, - "description": "" + "description": "Key: F3" }, { "name": "KEY_F4", "value": 293, - "description": "" + "description": "Key: F4" }, { "name": "KEY_F5", "value": 294, - "description": "" + "description": "Key: F5" }, { "name": "KEY_F6", "value": 295, - "description": "" + "description": "Key: F6" }, { "name": "KEY_F7", "value": 296, - "description": "" + "description": "Key: F7" }, { "name": "KEY_F8", "value": 297, - "description": "" + "description": "Key: F8" }, { "name": "KEY_F9", "value": 298, - "description": "" + "description": "Key: F9" }, { "name": "KEY_F10", "value": 299, - "description": "" + "description": "Key: F10" }, { "name": "KEY_F11", "value": 300, - "description": "" + "description": "Key: F11" }, { "name": "KEY_F12", "value": 301, - "description": "" + "description": "Key: F12" }, { "name": "KEY_LEFT_SHIFT", "value": 340, - "description": "" + "description": "Key: Shift left" }, { "name": "KEY_LEFT_CONTROL", "value": 341, - "description": "" + "description": "Key: Control left" }, { "name": "KEY_LEFT_ALT", "value": 342, - "description": "" + "description": "Key: Alt left" }, { "name": "KEY_LEFT_SUPER", "value": 343, - "description": "" + "description": "Key: Super left" }, { "name": "KEY_RIGHT_SHIFT", "value": 344, - "description": "" + "description": "Key: Shift right" }, { "name": "KEY_RIGHT_CONTROL", "value": 345, - "description": "" + "description": "Key: Control right" }, { "name": "KEY_RIGHT_ALT", "value": 346, - "description": "" + "description": "Key: Alt right" }, { "name": "KEY_RIGHT_SUPER", "value": 347, - "description": "" + "description": "Key: Super right" }, { "name": "KEY_KB_MENU", "value": 348, - "description": "" + "description": "Key: KB menu" }, { "name": "KEY_KP_0", "value": 320, - "description": "" + "description": "Key: Keypad 0" }, { "name": "KEY_KP_1", "value": 321, - "description": "" + "description": "Key: Keypad 1" }, { "name": "KEY_KP_2", "value": 322, - "description": "" + "description": "Key: Keypad 2" }, { "name": "KEY_KP_3", "value": 323, - "description": "" + "description": "Key: Keypad 3" }, { "name": "KEY_KP_4", "value": 324, - "description": "" + "description": "Key: Keypad 4" }, { "name": "KEY_KP_5", "value": 325, - "description": "" + "description": "Key: Keypad 5" }, { "name": "KEY_KP_6", "value": 326, - "description": "" + "description": "Key: Keypad 6" }, { "name": "KEY_KP_7", "value": 327, - "description": "" + "description": "Key: Keypad 7" }, { "name": "KEY_KP_8", "value": 328, - "description": "" + "description": "Key: Keypad 8" }, { "name": "KEY_KP_9", "value": 329, - "description": "" + "description": "Key: Keypad 9" }, { "name": "KEY_KP_DECIMAL", "value": 330, - "description": "" + "description": "Key: Keypad ." }, { "name": "KEY_KP_DIVIDE", "value": 331, - "description": "" + "description": "Key: Keypad /" }, { "name": "KEY_KP_MULTIPLY", "value": 332, - "description": "" + "description": "Key: Keypad *" }, { "name": "KEY_KP_SUBTRACT", "value": 333, - "description": "" + "description": "Key: Keypad -" }, { "name": "KEY_KP_ADD", "value": 334, - "description": "" + "description": "Key: Keypad +" }, { "name": "KEY_KP_ENTER", "value": 335, - "description": "" + "description": "Key: Keypad Enter" }, { "name": "KEY_KP_EQUAL", "value": 336, - "description": "" + "description": "Key: Keypad =" }, { "name": "KEY_BACK", "value": 4, - "description": "" + "description": "Key: Android back button" }, { "name": "KEY_MENU", "value": 82, - "description": "" + "description": "Key: Android menu button" }, { "name": "KEY_VOLUME_UP", "value": 24, - "description": "" + "description": "Key: Android volume up button" }, { "name": "KEY_VOLUME_DOWN", "value": 25, - "description": "" + "description": "Key: Android volume down button" } ] }, { "name": "MouseButton", - "description": "", + "description": "Mouse buttons", "values": [ { "name": "MOUSE_BUTTON_LEFT", "value": 0, - "description": "" + "description": "Mouse button left" }, { "name": "MOUSE_BUTTON_RIGHT", "value": 1, - "description": "" + "description": "Mouse button right" }, { "name": "MOUSE_BUTTON_MIDDLE", "value": 2, - "description": "" + "description": "Mouse button middle (pressed wheel)" }, { "name": "MOUSE_BUTTON_SIDE", "value": 3, - "description": "" + "description": "Mouse button side (advanced mouse device)" }, { "name": "MOUSE_BUTTON_EXTRA", "value": 4, - "description": "" + "description": "Mouse button extra (advanced mouse device)" }, { "name": "MOUSE_BUTTON_FORWARD", "value": 5, - "description": "" + "description": "Mouse button fordward (advanced mouse device)" }, { "name": "MOUSE_BUTTON_BACK", "value": 6, - "description": "" + "description": "Mouse button back (advanced mouse device)" } ] }, { "name": "MouseCursor", - "description": "", + "description": "Mouse cursor", "values": [ { "name": "MOUSE_CURSOR_DEFAULT", "value": 0, - "description": "" + "description": "Default pointer shape" }, { "name": "MOUSE_CURSOR_ARROW", "value": 1, - "description": "" + "description": "Arrow shape" }, { "name": "MOUSE_CURSOR_IBEAM", "value": 2, - "description": "" + "description": "Text writing cursor shape" }, { "name": "MOUSE_CURSOR_CROSSHAIR", "value": 3, - "description": "" + "description": "Cross shape" }, { "name": "MOUSE_CURSOR_POINTING_HAND", "value": 4, - "description": "" + "description": "Pointing hand cursor" }, { "name": "MOUSE_CURSOR_RESIZE_EW", "value": 5, - "description": "" + "description": "Horizontal resize/move arrow shape" }, { "name": "MOUSE_CURSOR_RESIZE_NS", "value": 6, - "description": "" + "description": "Vertical resize/move arrow shape" }, { "name": "MOUSE_CURSOR_RESIZE_NWSE", "value": 7, - "description": "" + "description": "Top-left to bottom-right diagonal resize/move arrow shape" }, { "name": "MOUSE_CURSOR_RESIZE_NESW", "value": 8, - "description": "" + "description": "The top-right to bottom-left diagonal resize/move arrow shape" }, { "name": "MOUSE_CURSOR_RESIZE_ALL", "value": 9, - "description": "" + "description": "The omni-directional resize/move cursor shape" }, { "name": "MOUSE_CURSOR_NOT_ALLOWED", "value": 10, - "description": "" + "description": "The operation-not-allowed shape" } ] }, { "name": "GamepadButton", - "description": "", + "description": "Gamepad buttons", "values": [ { "name": "GAMEPAD_BUTTON_UNKNOWN", "value": 0, - "description": "" + "description": "Unknown button, just for error checking" }, { "name": "GAMEPAD_BUTTON_LEFT_FACE_UP", "value": 1, - "description": "" + "description": "Gamepad left DPAD up button" }, { "name": "GAMEPAD_BUTTON_LEFT_FACE_RIGHT", "value": 2, - "description": "" + "description": "Gamepad left DPAD right button" }, { "name": "GAMEPAD_BUTTON_LEFT_FACE_DOWN", "value": 3, - "description": "" + "description": "Gamepad left DPAD down button" }, { "name": "GAMEPAD_BUTTON_LEFT_FACE_LEFT", "value": 4, - "description": "" + "description": "Gamepad left DPAD left button" }, { "name": "GAMEPAD_BUTTON_RIGHT_FACE_UP", "value": 5, - "description": "" + "description": "Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)" }, { "name": "GAMEPAD_BUTTON_RIGHT_FACE_RIGHT", "value": 6, - "description": "" + "description": "Gamepad right button right (i.e. PS3: Square, Xbox: X)" }, { "name": "GAMEPAD_BUTTON_RIGHT_FACE_DOWN", "value": 7, - "description": "" + "description": "Gamepad right button down (i.e. PS3: Cross, Xbox: A)" }, { "name": "GAMEPAD_BUTTON_RIGHT_FACE_LEFT", "value": 8, - "description": "" + "description": "Gamepad right button left (i.e. PS3: Circle, Xbox: B)" }, { "name": "GAMEPAD_BUTTON_LEFT_TRIGGER_1", "value": 9, - "description": "" + "description": "Gamepad top/back trigger left (first), it could be a trailing button" }, { "name": "GAMEPAD_BUTTON_LEFT_TRIGGER_2", "value": 10, - "description": "" + "description": "Gamepad top/back trigger left (second), it could be a trailing button" }, { "name": "GAMEPAD_BUTTON_RIGHT_TRIGGER_1", "value": 11, - "description": "" + "description": "Gamepad top/back trigger right (one), it could be a trailing button" }, { "name": "GAMEPAD_BUTTON_RIGHT_TRIGGER_2", "value": 12, - "description": "" + "description": "Gamepad top/back trigger right (second), it could be a trailing button" }, { "name": "GAMEPAD_BUTTON_MIDDLE_LEFT", "value": 13, - "description": "" + "description": "Gamepad center buttons, left one (i.e. PS3: Select)" }, { "name": "GAMEPAD_BUTTON_MIDDLE", "value": 14, - "description": "" + "description": "Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)" }, { "name": "GAMEPAD_BUTTON_MIDDLE_RIGHT", "value": 15, - "description": "" + "description": "Gamepad center buttons, right one (i.e. PS3: Start)" }, { "name": "GAMEPAD_BUTTON_LEFT_THUMB", "value": 16, - "description": "" + "description": "Gamepad joystick pressed button left" }, { "name": "GAMEPAD_BUTTON_RIGHT_THUMB", "value": 17, - "description": "" + "description": "Gamepad joystick pressed button right" } ] }, { "name": "GamepadAxis", - "description": "", + "description": "Gamepad axis", "values": [ { "name": "GAMEPAD_AXIS_LEFT_X", "value": 0, - "description": "" + "description": "Gamepad left stick X axis" }, { "name": "GAMEPAD_AXIS_LEFT_Y", "value": 1, - "description": "" + "description": "Gamepad left stick Y axis" }, { "name": "GAMEPAD_AXIS_RIGHT_X", "value": 2, - "description": "" + "description": "Gamepad right stick X axis" }, { "name": "GAMEPAD_AXIS_RIGHT_Y", "value": 3, - "description": "" + "description": "Gamepad right stick Y axis" }, { "name": "GAMEPAD_AXIS_LEFT_TRIGGER", "value": 4, - "description": "" + "description": "Gamepad back trigger left, pressure level: [1..-1]" }, { "name": "GAMEPAD_AXIS_RIGHT_TRIGGER", "value": 5, - "description": "" + "description": "Gamepad back trigger right, pressure level: [1..-1]" } ] }, { "name": "MaterialMapIndex", - "description": "", + "description": "Material map index", "values": [ { "name": "MATERIAL_MAP_ALBEDO", "value": 0, - "description": "" + "description": "Albedo material (same as: MATERIAL_MAP_DIFFUSE)" }, { "name": "MATERIAL_MAP_METALNESS", "value": 1, - "description": "" + "description": "Metalness material (same as: MATERIAL_MAP_SPECULAR)" }, { "name": "MATERIAL_MAP_NORMAL", "value": 2, - "description": "" + "description": "Normal material" }, { "name": "MATERIAL_MAP_ROUGHNESS", "value": 3, - "description": "" + "description": "Roughness material" }, { "name": "MATERIAL_MAP_OCCLUSION", "value": 4, - "description": "" + "description": "Ambient occlusion material" }, { "name": "MATERIAL_MAP_EMISSION", "value": 5, - "description": "" + "description": "Emission material" }, { "name": "MATERIAL_MAP_HEIGHT", "value": 6, - "description": "" + "description": "Heightmap material" }, { "name": "MATERIAL_MAP_CUBEMAP", "value": 7, - "description": "" + "description": "Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" }, { "name": "MATERIAL_MAP_IRRADIANCE", "value": 8, - "description": "" + "description": "Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" }, { "name": "MATERIAL_MAP_PREFILTER", "value": 9, - "description": "" + "description": "Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" }, { "name": "MATERIAL_MAP_BRDF", "value": 10, - "description": "" + "description": "Brdf material" } ] }, { "name": "ShaderLocationIndex", - "description": "", + "description": "Shader location index", "values": [ { "name": "SHADER_LOC_VERTEX_POSITION", "value": 0, - "description": "" + "description": "Shader location: vertex attribute: position" }, { "name": "SHADER_LOC_VERTEX_TEXCOORD01", "value": 1, - "description": "" + "description": "Shader location: vertex attribute: texcoord01" }, { "name": "SHADER_LOC_VERTEX_TEXCOORD02", "value": 2, - "description": "" + "description": "Shader location: vertex attribute: texcoord02" }, { "name": "SHADER_LOC_VERTEX_NORMAL", "value": 3, - "description": "" + "description": "Shader location: vertex attribute: normal" }, { "name": "SHADER_LOC_VERTEX_TANGENT", "value": 4, - "description": "" + "description": "Shader location: vertex attribute: tangent" }, { "name": "SHADER_LOC_VERTEX_COLOR", "value": 5, - "description": "" + "description": "Shader location: vertex attribute: color" }, { "name": "SHADER_LOC_MATRIX_MVP", "value": 6, - "description": "" + "description": "Shader location: matrix uniform: model-view-projection" }, { "name": "SHADER_LOC_MATRIX_VIEW", "value": 7, - "description": "" + "description": "Shader location: matrix uniform: view (camera transform)" }, { "name": "SHADER_LOC_MATRIX_PROJECTION", "value": 8, - "description": "" + "description": "Shader location: matrix uniform: projection" }, { "name": "SHADER_LOC_MATRIX_MODEL", "value": 9, - "description": "" + "description": "Shader location: matrix uniform: model (transform)" }, { "name": "SHADER_LOC_MATRIX_NORMAL", "value": 10, - "description": "" + "description": "Shader location: matrix uniform: normal" }, { "name": "SHADER_LOC_VECTOR_VIEW", "value": 11, - "description": "" + "description": "Shader location: vector uniform: view" }, { "name": "SHADER_LOC_COLOR_DIFFUSE", "value": 12, - "description": "" + "description": "Shader location: vector uniform: diffuse color" }, { "name": "SHADER_LOC_COLOR_SPECULAR", "value": 13, - "description": "" + "description": "Shader location: vector uniform: specular color" }, { "name": "SHADER_LOC_COLOR_AMBIENT", "value": 14, - "description": "" + "description": "Shader location: vector uniform: ambient color" }, { "name": "SHADER_LOC_MAP_ALBEDO", "value": 15, - "description": "" + "description": "Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE)" }, { "name": "SHADER_LOC_MAP_METALNESS", "value": 16, - "description": "" + "description": "Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR)" }, { "name": "SHADER_LOC_MAP_NORMAL", "value": 17, - "description": "" + "description": "Shader location: sampler2d texture: normal" }, { "name": "SHADER_LOC_MAP_ROUGHNESS", "value": 18, - "description": "" + "description": "Shader location: sampler2d texture: roughness" }, { "name": "SHADER_LOC_MAP_OCCLUSION", "value": 19, - "description": "" + "description": "Shader location: sampler2d texture: occlusion" }, { "name": "SHADER_LOC_MAP_EMISSION", "value": 20, - "description": "" + "description": "Shader location: sampler2d texture: emission" }, { "name": "SHADER_LOC_MAP_HEIGHT", "value": 21, - "description": "" + "description": "Shader location: sampler2d texture: height" }, { "name": "SHADER_LOC_MAP_CUBEMAP", "value": 22, - "description": "" + "description": "Shader location: samplerCube texture: cubemap" }, { "name": "SHADER_LOC_MAP_IRRADIANCE", "value": 23, - "description": "" + "description": "Shader location: samplerCube texture: irradiance" }, { "name": "SHADER_LOC_MAP_PREFILTER", "value": 24, - "description": "" + "description": "Shader location: samplerCube texture: prefilter" }, { "name": "SHADER_LOC_MAP_BRDF", "value": 25, - "description": "" + "description": "Shader location: sampler2d texture: brdf" } ] }, { "name": "ShaderUniformDataType", - "description": "", + "description": "Shader uniform data type", "values": [ { "name": "SHADER_UNIFORM_FLOAT", "value": 0, - "description": "" + "description": "Shader uniform type: float" }, { "name": "SHADER_UNIFORM_VEC2", "value": 1, - "description": "" + "description": "Shader uniform type: vec2 (2 float)" }, { "name": "SHADER_UNIFORM_VEC3", "value": 2, - "description": "" + "description": "Shader uniform type: vec3 (3 float)" }, { "name": "SHADER_UNIFORM_VEC4", "value": 3, - "description": "" + "description": "Shader uniform type: vec4 (4 float)" }, { "name": "SHADER_UNIFORM_INT", "value": 4, - "description": "" + "description": "Shader uniform type: int" }, { "name": "SHADER_UNIFORM_IVEC2", "value": 5, - "description": "" + "description": "Shader uniform type: ivec2 (2 int)" }, { "name": "SHADER_UNIFORM_IVEC3", "value": 6, - "description": "" + "description": "Shader uniform type: ivec3 (3 int)" }, { "name": "SHADER_UNIFORM_IVEC4", "value": 7, - "description": "" + "description": "Shader uniform type: ivec4 (4 int)" }, { "name": "SHADER_UNIFORM_SAMPLER2D", "value": 8, - "description": "" + "description": "Shader uniform type: sampler2d" } ] }, { "name": "ShaderAttributeDataType", - "description": "", + "description": "Shader attribute data types", "values": [ { "name": "SHADER_ATTRIB_FLOAT", "value": 0, - "description": "" + "description": "Shader attribute type: float" }, { "name": "SHADER_ATTRIB_VEC2", "value": 1, - "description": "" + "description": "Shader attribute type: vec2 (2 float)" }, { "name": "SHADER_ATTRIB_VEC3", "value": 2, - "description": "" + "description": "Shader attribute type: vec3 (3 float)" }, { "name": "SHADER_ATTRIB_VEC4", "value": 3, - "description": "" + "description": "Shader attribute type: vec4 (4 float)" } ] }, { "name": "PixelFormat", - "description": "", + "description": "Pixel formats", "values": [ { "name": "PIXELFORMAT_UNCOMPRESSED_GRAYSCALE", "value": 1, - "description": "" + "description": "8 bit per pixel (no alpha)" }, { "name": "PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA", "value": 2, - "description": "" + "description": "8*2 bpp (2 channels)" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R5G6B5", "value": 3, - "description": "" + "description": "16 bpp" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R8G8B8", "value": 4, - "description": "" + "description": "24 bpp" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R5G5B5A1", "value": 5, - "description": "" + "description": "16 bpp (1 bit alpha)" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R4G4B4A4", "value": 6, - "description": "" + "description": "16 bpp (4 bit alpha)" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R8G8B8A8", "value": 7, - "description": "" + "description": "32 bpp" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R32", "value": 8, - "description": "" + "description": "32 bpp (1 channel - float)" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R32G32B32", "value": 9, - "description": "" + "description": "32*3 bpp (3 channels - float)" }, { "name": "PIXELFORMAT_UNCOMPRESSED_R32G32B32A32", "value": 10, - "description": "" + "description": "32*4 bpp (4 channels - float)" }, { "name": "PIXELFORMAT_COMPRESSED_DXT1_RGB", "value": 11, - "description": "" + "description": "4 bpp (no alpha)" }, { "name": "PIXELFORMAT_COMPRESSED_DXT1_RGBA", "value": 12, - "description": "" + "description": "4 bpp (1 bit alpha)" }, { "name": "PIXELFORMAT_COMPRESSED_DXT3_RGBA", "value": 13, - "description": "" + "description": "8 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_DXT5_RGBA", "value": 14, - "description": "" + "description": "8 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_ETC1_RGB", "value": 15, - "description": "" + "description": "4 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_ETC2_RGB", "value": 16, - "description": "" + "description": "4 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA", "value": 17, - "description": "" + "description": "8 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_PVRT_RGB", "value": 18, - "description": "" + "description": "4 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_PVRT_RGBA", "value": 19, - "description": "" + "description": "4 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA", "value": 20, - "description": "" + "description": "8 bpp" }, { "name": "PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA", "value": 21, - "description": "" + "description": "2 bpp" } ] }, { "name": "TextureFilter", - "description": "", + "description": "Texture parameters: filter mode", "values": [ { "name": "TEXTURE_FILTER_POINT", "value": 0, - "description": "" + "description": "No filter, just pixel approximation" }, { "name": "TEXTURE_FILTER_BILINEAR", "value": 1, - "description": "" + "description": "Linear filtering" }, { "name": "TEXTURE_FILTER_TRILINEAR", "value": 2, - "description": "" + "description": "Trilinear filtering (linear with mipmaps)" }, { "name": "TEXTURE_FILTER_ANISOTROPIC_4X", "value": 3, - "description": "" + "description": "Anisotropic filtering 4x" }, { "name": "TEXTURE_FILTER_ANISOTROPIC_8X", "value": 4, - "description": "" + "description": "Anisotropic filtering 8x" }, { "name": "TEXTURE_FILTER_ANISOTROPIC_16X", "value": 5, - "description": "" + "description": "Anisotropic filtering 16x" } ] }, { "name": "TextureWrap", - "description": "", + "description": "Texture parameters: wrap mode", "values": [ { "name": "TEXTURE_WRAP_REPEAT", "value": 0, - "description": "" + "description": "Repeats texture in tiled mode" }, { "name": "TEXTURE_WRAP_CLAMP", "value": 1, - "description": "" + "description": "Clamps texture to edge pixel in tiled mode" }, { "name": "TEXTURE_WRAP_MIRROR_REPEAT", "value": 2, - "description": "" + "description": "Mirrors and repeats the texture in tiled mode" }, { "name": "TEXTURE_WRAP_MIRROR_CLAMP", "value": 3, - "description": "" + "description": "Mirrors and clamps to border the texture in tiled mode" } ] }, { "name": "CubemapLayout", - "description": "", + "description": "Cubemap layouts", "values": [ { "name": "CUBEMAP_LAYOUT_AUTO_DETECT", "value": 0, - "description": "" + "description": "Automatically detect layout type" }, { "name": "CUBEMAP_LAYOUT_LINE_VERTICAL", "value": 1, - "description": "" + "description": "Layout is defined by a vertical line with faces" }, { "name": "CUBEMAP_LAYOUT_LINE_HORIZONTAL", "value": 2, - "description": "" + "description": "Layout is defined by an horizontal line with faces" }, { "name": "CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR", "value": 3, - "description": "" + "description": "Layout is defined by a 3x4 cross with cubemap faces" }, { "name": "CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE", "value": 4, - "description": "" + "description": "Layout is defined by a 4x3 cross with cubemap faces" }, { "name": "CUBEMAP_LAYOUT_PANORAMA", "value": 5, - "description": "" + "description": "Layout is defined by a panorama image (equirectangular map)" } ] }, { "name": "FontType", - "description": "", + "description": "Font type, defines generation method", "values": [ { "name": "FONT_DEFAULT", "value": 0, - "description": "" + "description": "Default font generation, anti-aliased" }, { "name": "FONT_BITMAP", "value": 1, - "description": "" + "description": "Bitmap font generation, no anti-aliasing" }, { "name": "FONT_SDF", "value": 2, - "description": "" + "description": "SDF font generation, requires external shader" } ] }, { "name": "BlendMode", - "description": "", + "description": "Color blending modes (pre-defined)", "values": [ { "name": "BLEND_ALPHA", "value": 0, - "description": "" + "description": "Blend textures considering alpha (default)" }, { "name": "BLEND_ADDITIVE", "value": 1, - "description": "" + "description": "Blend textures adding colors" }, { "name": "BLEND_MULTIPLIED", "value": 2, - "description": "" + "description": "Blend textures multiplying colors" }, { "name": "BLEND_ADD_COLORS", "value": 3, - "description": "" + "description": "Blend textures adding colors (alternative)" }, { "name": "BLEND_SUBTRACT_COLORS", "value": 4, - "description": "" + "description": "Blend textures subtracting colors (alternative)" }, { "name": "BLEND_CUSTOM", "value": 5, - "description": "" + "description": "Belnd textures using custom src/dst factors (use rlSetBlendMode())" } ] }, { "name": "Gesture", - "description": "", + "description": "Gesture", "values": [ { "name": "GESTURE_NONE", "value": 0, - "description": "" + "description": "No gesture" }, { "name": "GESTURE_TAP", "value": 1, - "description": "" + "description": "Tap gesture" }, { "name": "GESTURE_DOUBLETAP", "value": 2, - "description": "" + "description": "Double tap gesture" }, { "name": "GESTURE_HOLD", "value": 4, - "description": "" + "description": "Hold gesture" }, { "name": "GESTURE_DRAG", "value": 8, - "description": "" + "description": "Drag gesture" }, { "name": "GESTURE_SWIPE_RIGHT", "value": 16, - "description": "" + "description": "Swipe right gesture" }, { "name": "GESTURE_SWIPE_LEFT", "value": 32, - "description": "" + "description": "Swipe left gesture" }, { "name": "GESTURE_SWIPE_UP", "value": 64, - "description": "" + "description": "Swipe up gesture" }, { "name": "GESTURE_SWIPE_DOWN", "value": 128, - "description": "" + "description": "Swipe down gesture" }, { "name": "GESTURE_PINCH_IN", "value": 256, - "description": "" + "description": "Pinch in gesture" }, { "name": "GESTURE_PINCH_OUT", "value": 512, - "description": "" + "description": "Pinch out gesture" } ] }, { "name": "CameraMode", - "description": "", + "description": "Camera system modes", "values": [ { "name": "CAMERA_CUSTOM", "value": 0, - "description": "" + "description": "Custom camera" }, { "name": "CAMERA_FREE", "value": 1, - "description": "" + "description": "Free camera" }, { "name": "CAMERA_ORBITAL", "value": 2, - "description": "" + "description": "Orbital camera" }, { "name": "CAMERA_FIRST_PERSON", "value": 3, - "description": "" + "description": "First person camera" }, { "name": "CAMERA_THIRD_PERSON", "value": 4, - "description": "" + "description": "Third person camera" } ] }, { "name": "CameraProjection", - "description": "", + "description": "Camera projection", "values": [ { "name": "CAMERA_PERSPECTIVE", "value": 0, - "description": "" + "description": "Perspective projection" }, { "name": "CAMERA_ORTHOGRAPHIC", "value": 1, - "description": "" + "description": "Orthographic projection" } ] }, { "name": "NPatchLayout", - "description": "", + "description": "N-patch layout", "values": [ { "name": "NPATCH_NINE_PATCH", "value": 0, - "description": "" + "description": "Npatch layout: 3x3 tiles" }, { "name": "NPATCH_THREE_PATCH_VERTICAL", "value": 1, - "description": "" + "description": "Npatch layout: 1x3 tiles" }, { "name": "NPATCH_THREE_PATCH_HORIZONTAL", "value": 2, - "description": "" + "description": "Npatch layout: 3x1 tiles" } ] } @@ -2651,6 +2651,16 @@ "description": "Get current screen height", "returnType": "int" }, + { + "name": "GetRenderWidth", + "description": "Get current render width (it considers HiDPI)", + "returnType": "int" + }, + { + "name": "GetRenderHeight", + "description": "Get current render height (it considers HiDPI)", + "returnType": "int" + }, { "name": "GetMonitorCount", "description": "Get number of connected monitors", @@ -3234,7 +3244,7 @@ }, { "name": "LoadFileText", - "description": "Load text data from file (read), returns a ' 0' terminated string", + "description": "Load text data from file (read), returns a '\\0' terminated string", "returnType": "char *", "params": { "fileName": "const char *" @@ -3250,7 +3260,7 @@ }, { "name": "SaveFileText", - "description": "Save text data to file (write), string must be ' 0' terminated, returns true on success", + "description": "Save text data to file (write), string must be '\\0' terminated, returns true on success", "returnType": "bool", "params": { "fileName": "const char *", @@ -5509,7 +5519,7 @@ }, { "name": "TextLength", - "description": "Get text length, checks for ' 0' ending", + "description": "Get text length, checks for '\\0' ending", "returnType": "unsigned int", "params": { "text": "const char *" diff --git a/parser/raylib_api.lua b/parser/raylib_api.lua index 401ccca5a..ba5086f2d 100644 --- a/parser/raylib_api.lua +++ b/parser/raylib_api.lua @@ -2,7 +2,7 @@ return { structs = { { name = "Vector2", - description = "", + description = "Vector2, 2 components", fields = { { name = "x", @@ -18,7 +18,7 @@ return { }, { name = "Vector3", - description = "", + description = "Vector3, 3 components", fields = { { name = "x", @@ -39,7 +39,7 @@ return { }, { name = "Vector4", - description = "", + description = "Vector4, 4 components", fields = { { name = "x", @@ -65,7 +65,7 @@ return { }, { name = "Matrix", - description = "", + description = "Matrix, 4x4 components, column major, OpenGL style, right handed", fields = { { name = "m0, m4, m8, m12", @@ -91,7 +91,7 @@ return { }, { name = "Color", - description = "", + description = "Color, 4 components, R8G8B8A8 (32bit)", fields = { { name = "r", @@ -117,7 +117,7 @@ return { }, { name = "Rectangle", - description = "", + description = "Rectangle, 4 components", fields = { { name = "x", @@ -143,7 +143,7 @@ return { }, { name = "Image", - description = "", + description = "Image, pixel data stored in CPU memory (RAM)", fields = { { name = "data", @@ -174,7 +174,7 @@ return { }, { name = "Texture", - description = "", + description = "Texture, tex data stored in GPU memory (VRAM)", fields = { { name = "id", @@ -205,7 +205,7 @@ return { }, { name = "RenderTexture", - description = "", + description = "RenderTexture, fbo for texture rendering", fields = { { name = "id", @@ -226,7 +226,7 @@ return { }, { name = "NPatchInfo", - description = "", + description = "NPatchInfo, n-patch layout info", fields = { { name = "source", @@ -262,7 +262,7 @@ return { }, { name = "GlyphInfo", - description = "", + description = "GlyphInfo, font characters glyphs info", fields = { { name = "value", @@ -293,7 +293,7 @@ return { }, { name = "Font", - description = "", + description = "Font, font texture and GlyphInfo array data", fields = { { name = "baseSize", @@ -329,7 +329,7 @@ return { }, { name = "Camera3D", - description = "", + description = "Camera, defines position/orientation in 3d space", fields = { { name = "position", @@ -360,7 +360,7 @@ return { }, { name = "Camera2D", - description = "", + description = "Camera2D, defines position/orientation in 2d space", fields = { { name = "offset", @@ -386,7 +386,7 @@ return { }, { name = "Mesh", - description = "", + description = "Mesh, vertex data and vao/vbo", fields = { { name = "vertexCount", @@ -467,7 +467,7 @@ return { }, { name = "Shader", - description = "", + description = "Shader", fields = { { name = "id", @@ -483,7 +483,7 @@ return { }, { name = "MaterialMap", - description = "", + description = "MaterialMap", fields = { { name = "texture", @@ -504,7 +504,7 @@ return { }, { name = "Material", - description = "", + description = "Material, includes shader and maps", fields = { { name = "shader", @@ -525,7 +525,7 @@ return { }, { name = "Transform", - description = "", + description = "Transform, vectex transformation data", fields = { { name = "translation", @@ -546,7 +546,7 @@ return { }, { name = "BoneInfo", - description = "", + description = "Bone, skeletal animation bone", fields = { { name = "name[32]", @@ -562,7 +562,7 @@ return { }, { name = "Model", - description = "", + description = "Model, meshes, materials and animation data", fields = { { name = "transform", @@ -613,7 +613,7 @@ return { }, { name = "ModelAnimation", - description = "", + description = "ModelAnimation", fields = { { name = "boneCount", @@ -639,7 +639,7 @@ return { }, { name = "Ray", - description = "", + description = "Ray, ray for raycasting", fields = { { name = "position", @@ -655,7 +655,7 @@ return { }, { name = "RayCollision", - description = "", + description = "RayCollision, ray hit information", fields = { { name = "hit", @@ -681,7 +681,7 @@ return { }, { name = "BoundingBox", - description = "", + description = "BoundingBox", fields = { { name = "min", @@ -697,7 +697,7 @@ return { }, { name = "Wave", - description = "", + description = "Wave, audio wave data", fields = { { name = "frameCount", @@ -728,7 +728,7 @@ return { }, { name = "AudioStream", - description = "", + description = "AudioStream, custom audio stream", fields = { { name = "buffer", @@ -754,7 +754,7 @@ return { }, { name = "Sound", - description = "", + description = "Sound", fields = { { name = "stream", @@ -770,7 +770,7 @@ return { }, { name = "Music", - description = "", + description = "Music, audio stream, anything longer than ~10 seconds should be streamed", fields = { { name = "stream", @@ -801,7 +801,7 @@ return { }, { name = "VrDeviceInfo", - description = "", + description = "VrDeviceInfo, Head-Mounted-Display device parameters", fields = { { name = "hResolution", @@ -857,7 +857,7 @@ return { }, { name = "VrStereoConfig", - description = "", + description = "VrStereoConfig, VR stereo rendering configuration for simulator", fields = { { name = "projection[2]", @@ -905,1582 +905,1582 @@ return { enums = { { name = "ConfigFlags", - description = "", + description = "System/Window config flags", values = { { name = "FLAG_VSYNC_HINT", value = 64, - description = "" + description = "Set to try enabling V-Sync on GPU" }, { name = "FLAG_FULLSCREEN_MODE", value = 2, - description = "" + description = "Set to run program in fullscreen" }, { name = "FLAG_WINDOW_RESIZABLE", value = 4, - description = "" + description = "Set to allow resizable window" }, { name = "FLAG_WINDOW_UNDECORATED", value = 8, - description = "" + description = "Set to disable window decoration (frame and buttons)" }, { name = "FLAG_WINDOW_HIDDEN", value = 128, - description = "" + description = "Set to hide window" }, { name = "FLAG_WINDOW_MINIMIZED", value = 512, - description = "" + description = "Set to minimize window (iconify)" }, { name = "FLAG_WINDOW_MAXIMIZED", value = 1024, - description = "" + description = "Set to maximize window (expanded to monitor)" }, { name = "FLAG_WINDOW_UNFOCUSED", value = 2048, - description = "" + description = "Set to window non focused" }, { name = "FLAG_WINDOW_TOPMOST", value = 4096, - description = "" + description = "Set to window always on top" }, { name = "FLAG_WINDOW_ALWAYS_RUN", value = 256, - description = "" + description = "Set to allow windows running while minimized" }, { name = "FLAG_WINDOW_TRANSPARENT", value = 16, - description = "" + description = "Set to allow transparent framebuffer" }, { name = "FLAG_WINDOW_HIGHDPI", value = 8192, - description = "" + description = "Set to support HighDPI" }, { name = "FLAG_MSAA_4X_HINT", value = 32, - description = "" + description = "Set to try enabling MSAA 4X" }, { name = "FLAG_INTERLACED_HINT", value = 65536, - description = "" + description = "Set to try enabling interlaced video format (for V3D)" } } }, { name = "TraceLogLevel", - description = "", + description = "Trace log level", values = { { name = "LOG_ALL", value = 0, - description = "" + description = "Display all logs" }, { name = "LOG_TRACE", value = 1, - description = "" + description = "Trace logging, intended for internal use only" }, { name = "LOG_DEBUG", value = 2, - description = "" + description = "Debug logging, used for internal debugging, it should be disabled on release builds" }, { name = "LOG_INFO", value = 3, - description = "" + description = "Info logging, used for program execution info" }, { name = "LOG_WARNING", value = 4, - description = "" + description = "Warning logging, used on recoverable failures" }, { name = "LOG_ERROR", value = 5, - description = "" + description = "Error logging, used on unrecoverable failures" }, { name = "LOG_FATAL", value = 6, - description = "" + description = "Fatal logging, used to abort program: exit(EXIT_FAILURE)" }, { name = "LOG_NONE", value = 7, - description = "" + description = "Disable logging" } } }, { name = "KeyboardKey", - description = "", + description = "Keyboard keys (US keyboard layout)", values = { { name = "KEY_NULL", value = 0, - description = "" + description = "Key: NULL, used for no key pressed" }, { name = "KEY_APOSTROPHE", value = 39, - description = "" + description = "Key: '" }, { name = "KEY_COMMA", value = 44, - description = "" + description = "Key: ," }, { name = "KEY_MINUS", value = 45, - description = "" + description = "Key: -" }, { name = "KEY_PERIOD", value = 46, - description = "" + description = "Key: ." }, { name = "KEY_SLASH", value = 47, - description = "" + description = "Key: /" }, { name = "KEY_ZERO", value = 48, - description = "" + description = "Key: 0" }, { name = "KEY_ONE", value = 49, - description = "" + description = "Key: 1" }, { name = "KEY_TWO", value = 50, - description = "" + description = "Key: 2" }, { name = "KEY_THREE", value = 51, - description = "" + description = "Key: 3" }, { name = "KEY_FOUR", value = 52, - description = "" + description = "Key: 4" }, { name = "KEY_FIVE", value = 53, - description = "" + description = "Key: 5" }, { name = "KEY_SIX", value = 54, - description = "" + description = "Key: 6" }, { name = "KEY_SEVEN", value = 55, - description = "" + description = "Key: 7" }, { name = "KEY_EIGHT", value = 56, - description = "" + description = "Key: 8" }, { name = "KEY_NINE", value = 57, - description = "" + description = "Key: 9" }, { name = "KEY_SEMICOLON", value = 59, - description = "" + description = "Key: ;" }, { name = "KEY_EQUAL", value = 61, - description = "" + description = "Key: =" }, { name = "KEY_A", value = 65, - description = "" + description = "Key: A | a" }, { name = "KEY_B", value = 66, - description = "" + description = "Key: B | b" }, { name = "KEY_C", value = 67, - description = "" + description = "Key: C | c" }, { name = "KEY_D", value = 68, - description = "" + description = "Key: D | d" }, { name = "KEY_E", value = 69, - description = "" + description = "Key: E | e" }, { name = "KEY_F", value = 70, - description = "" + description = "Key: F | f" }, { name = "KEY_G", value = 71, - description = "" + description = "Key: G | g" }, { name = "KEY_H", value = 72, - description = "" + description = "Key: H | h" }, { name = "KEY_I", value = 73, - description = "" + description = "Key: I | i" }, { name = "KEY_J", value = 74, - description = "" + description = "Key: J | j" }, { name = "KEY_K", value = 75, - description = "" + description = "Key: K | k" }, { name = "KEY_L", value = 76, - description = "" + description = "Key: L | l" }, { name = "KEY_M", value = 77, - description = "" + description = "Key: M | m" }, { name = "KEY_N", value = 78, - description = "" + description = "Key: N | n" }, { name = "KEY_O", value = 79, - description = "" + description = "Key: O | o" }, { name = "KEY_P", value = 80, - description = "" + description = "Key: P | p" }, { name = "KEY_Q", value = 81, - description = "" + description = "Key: Q | q" }, { name = "KEY_R", value = 82, - description = "" + description = "Key: R | r" }, { name = "KEY_S", value = 83, - description = "" + description = "Key: S | s" }, { name = "KEY_T", value = 84, - description = "" + description = "Key: T | t" }, { name = "KEY_U", value = 85, - description = "" + description = "Key: U | u" }, { name = "KEY_V", value = 86, - description = "" + description = "Key: V | v" }, { name = "KEY_W", value = 87, - description = "" + description = "Key: W | w" }, { name = "KEY_X", value = 88, - description = "" + description = "Key: X | x" }, { name = "KEY_Y", value = 89, - description = "" + description = "Key: Y | y" }, { name = "KEY_Z", value = 90, - description = "" + description = "Key: Z | z" }, { name = "KEY_LEFT_BRACKET", value = 91, - description = "" + description = "Key: [" }, { name = "KEY_BACKSLASH", value = 92, - description = "" + description = "Key: '\\'" }, { name = "KEY_RIGHT_BRACKET", value = 93, - description = "" + description = "Key: ]" }, { name = "KEY_GRAVE", value = 96, - description = "" + description = "Key: `" }, { name = "KEY_SPACE", value = 32, - description = "" + description = "Key: Space" }, { name = "KEY_ESCAPE", value = 256, - description = "" + description = "Key: Esc" }, { name = "KEY_ENTER", value = 257, - description = "" + description = "Key: Enter" }, { name = "KEY_TAB", value = 258, - description = "" + description = "Key: Tab" }, { name = "KEY_BACKSPACE", value = 259, - description = "" + description = "Key: Backspace" }, { name = "KEY_INSERT", value = 260, - description = "" + description = "Key: Ins" }, { name = "KEY_DELETE", value = 261, - description = "" + description = "Key: Del" }, { name = "KEY_RIGHT", value = 262, - description = "" + description = "Key: Cursor right" }, { name = "KEY_LEFT", value = 263, - description = "" + description = "Key: Cursor left" }, { name = "KEY_DOWN", value = 264, - description = "" + description = "Key: Cursor down" }, { name = "KEY_UP", value = 265, - description = "" + description = "Key: Cursor up" }, { name = "KEY_PAGE_UP", value = 266, - description = "" + description = "Key: Page up" }, { name = "KEY_PAGE_DOWN", value = 267, - description = "" + description = "Key: Page down" }, { name = "KEY_HOME", value = 268, - description = "" + description = "Key: Home" }, { name = "KEY_END", value = 269, - description = "" + description = "Key: End" }, { name = "KEY_CAPS_LOCK", value = 280, - description = "" + description = "Key: Caps lock" }, { name = "KEY_SCROLL_LOCK", value = 281, - description = "" + description = "Key: Scroll down" }, { name = "KEY_NUM_LOCK", value = 282, - description = "" + description = "Key: Num lock" }, { name = "KEY_PRINT_SCREEN", value = 283, - description = "" + description = "Key: Print screen" }, { name = "KEY_PAUSE", value = 284, - description = "" + description = "Key: Pause" }, { name = "KEY_F1", value = 290, - description = "" + description = "Key: F1" }, { name = "KEY_F2", value = 291, - description = "" + description = "Key: F2" }, { name = "KEY_F3", value = 292, - description = "" + description = "Key: F3" }, { name = "KEY_F4", value = 293, - description = "" + description = "Key: F4" }, { name = "KEY_F5", value = 294, - description = "" + description = "Key: F5" }, { name = "KEY_F6", value = 295, - description = "" + description = "Key: F6" }, { name = "KEY_F7", value = 296, - description = "" + description = "Key: F7" }, { name = "KEY_F8", value = 297, - description = "" + description = "Key: F8" }, { name = "KEY_F9", value = 298, - description = "" + description = "Key: F9" }, { name = "KEY_F10", value = 299, - description = "" + description = "Key: F10" }, { name = "KEY_F11", value = 300, - description = "" + description = "Key: F11" }, { name = "KEY_F12", value = 301, - description = "" + description = "Key: F12" }, { name = "KEY_LEFT_SHIFT", value = 340, - description = "" + description = "Key: Shift left" }, { name = "KEY_LEFT_CONTROL", value = 341, - description = "" + description = "Key: Control left" }, { name = "KEY_LEFT_ALT", value = 342, - description = "" + description = "Key: Alt left" }, { name = "KEY_LEFT_SUPER", value = 343, - description = "" + description = "Key: Super left" }, { name = "KEY_RIGHT_SHIFT", value = 344, - description = "" + description = "Key: Shift right" }, { name = "KEY_RIGHT_CONTROL", value = 345, - description = "" + description = "Key: Control right" }, { name = "KEY_RIGHT_ALT", value = 346, - description = "" + description = "Key: Alt right" }, { name = "KEY_RIGHT_SUPER", value = 347, - description = "" + description = "Key: Super right" }, { name = "KEY_KB_MENU", value = 348, - description = "" + description = "Key: KB menu" }, { name = "KEY_KP_0", value = 320, - description = "" + description = "Key: Keypad 0" }, { name = "KEY_KP_1", value = 321, - description = "" + description = "Key: Keypad 1" }, { name = "KEY_KP_2", value = 322, - description = "" + description = "Key: Keypad 2" }, { name = "KEY_KP_3", value = 323, - description = "" + description = "Key: Keypad 3" }, { name = "KEY_KP_4", value = 324, - description = "" + description = "Key: Keypad 4" }, { name = "KEY_KP_5", value = 325, - description = "" + description = "Key: Keypad 5" }, { name = "KEY_KP_6", value = 326, - description = "" + description = "Key: Keypad 6" }, { name = "KEY_KP_7", value = 327, - description = "" + description = "Key: Keypad 7" }, { name = "KEY_KP_8", value = 328, - description = "" + description = "Key: Keypad 8" }, { name = "KEY_KP_9", value = 329, - description = "" + description = "Key: Keypad 9" }, { name = "KEY_KP_DECIMAL", value = 330, - description = "" + description = "Key: Keypad ." }, { name = "KEY_KP_DIVIDE", value = 331, - description = "" + description = "Key: Keypad /" }, { name = "KEY_KP_MULTIPLY", value = 332, - description = "" + description = "Key: Keypad *" }, { name = "KEY_KP_SUBTRACT", value = 333, - description = "" + description = "Key: Keypad -" }, { name = "KEY_KP_ADD", value = 334, - description = "" + description = "Key: Keypad +" }, { name = "KEY_KP_ENTER", value = 335, - description = "" + description = "Key: Keypad Enter" }, { name = "KEY_KP_EQUAL", value = 336, - description = "" + description = "Key: Keypad =" }, { name = "KEY_BACK", value = 4, - description = "" + description = "Key: Android back button" }, { name = "KEY_MENU", value = 82, - description = "" + description = "Key: Android menu button" }, { name = "KEY_VOLUME_UP", value = 24, - description = "" + description = "Key: Android volume up button" }, { name = "KEY_VOLUME_DOWN", value = 25, - description = "" + description = "Key: Android volume down button" } } }, { name = "MouseButton", - description = "", + description = "Mouse buttons", values = { { name = "MOUSE_BUTTON_LEFT", value = 0, - description = "" + description = "Mouse button left" }, { name = "MOUSE_BUTTON_RIGHT", value = 1, - description = "" + description = "Mouse button right" }, { name = "MOUSE_BUTTON_MIDDLE", value = 2, - description = "" + description = "Mouse button middle (pressed wheel)" }, { name = "MOUSE_BUTTON_SIDE", value = 3, - description = "" + description = "Mouse button side (advanced mouse device)" }, { name = "MOUSE_BUTTON_EXTRA", value = 4, - description = "" + description = "Mouse button extra (advanced mouse device)" }, { name = "MOUSE_BUTTON_FORWARD", value = 5, - description = "" + description = "Mouse button fordward (advanced mouse device)" }, { name = "MOUSE_BUTTON_BACK", value = 6, - description = "" + description = "Mouse button back (advanced mouse device)" } } }, { name = "MouseCursor", - description = "", + description = "Mouse cursor", values = { { name = "MOUSE_CURSOR_DEFAULT", value = 0, - description = "" + description = "Default pointer shape" }, { name = "MOUSE_CURSOR_ARROW", value = 1, - description = "" + description = "Arrow shape" }, { name = "MOUSE_CURSOR_IBEAM", value = 2, - description = "" + description = "Text writing cursor shape" }, { name = "MOUSE_CURSOR_CROSSHAIR", value = 3, - description = "" + description = "Cross shape" }, { name = "MOUSE_CURSOR_POINTING_HAND", value = 4, - description = "" + description = "Pointing hand cursor" }, { name = "MOUSE_CURSOR_RESIZE_EW", value = 5, - description = "" + description = "Horizontal resize/move arrow shape" }, { name = "MOUSE_CURSOR_RESIZE_NS", value = 6, - description = "" + description = "Vertical resize/move arrow shape" }, { name = "MOUSE_CURSOR_RESIZE_NWSE", value = 7, - description = "" + description = "Top-left to bottom-right diagonal resize/move arrow shape" }, { name = "MOUSE_CURSOR_RESIZE_NESW", value = 8, - description = "" + description = "The top-right to bottom-left diagonal resize/move arrow shape" }, { name = "MOUSE_CURSOR_RESIZE_ALL", value = 9, - description = "" + description = "The omni-directional resize/move cursor shape" }, { name = "MOUSE_CURSOR_NOT_ALLOWED", value = 10, - description = "" + description = "The operation-not-allowed shape" } } }, { name = "GamepadButton", - description = "", + description = "Gamepad buttons", values = { { name = "GAMEPAD_BUTTON_UNKNOWN", value = 0, - description = "" + description = "Unknown button, just for error checking" }, { name = "GAMEPAD_BUTTON_LEFT_FACE_UP", value = 1, - description = "" + description = "Gamepad left DPAD up button" }, { name = "GAMEPAD_BUTTON_LEFT_FACE_RIGHT", value = 2, - description = "" + description = "Gamepad left DPAD right button" }, { name = "GAMEPAD_BUTTON_LEFT_FACE_DOWN", value = 3, - description = "" + description = "Gamepad left DPAD down button" }, { name = "GAMEPAD_BUTTON_LEFT_FACE_LEFT", value = 4, - description = "" + description = "Gamepad left DPAD left button" }, { name = "GAMEPAD_BUTTON_RIGHT_FACE_UP", value = 5, - description = "" + description = "Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)" }, { name = "GAMEPAD_BUTTON_RIGHT_FACE_RIGHT", value = 6, - description = "" + description = "Gamepad right button right (i.e. PS3: Square, Xbox: X)" }, { name = "GAMEPAD_BUTTON_RIGHT_FACE_DOWN", value = 7, - description = "" + description = "Gamepad right button down (i.e. PS3: Cross, Xbox: A)" }, { name = "GAMEPAD_BUTTON_RIGHT_FACE_LEFT", value = 8, - description = "" + description = "Gamepad right button left (i.e. PS3: Circle, Xbox: B)" }, { name = "GAMEPAD_BUTTON_LEFT_TRIGGER_1", value = 9, - description = "" + description = "Gamepad top/back trigger left (first), it could be a trailing button" }, { name = "GAMEPAD_BUTTON_LEFT_TRIGGER_2", value = 10, - description = "" + description = "Gamepad top/back trigger left (second), it could be a trailing button" }, { name = "GAMEPAD_BUTTON_RIGHT_TRIGGER_1", value = 11, - description = "" + description = "Gamepad top/back trigger right (one), it could be a trailing button" }, { name = "GAMEPAD_BUTTON_RIGHT_TRIGGER_2", value = 12, - description = "" + description = "Gamepad top/back trigger right (second), it could be a trailing button" }, { name = "GAMEPAD_BUTTON_MIDDLE_LEFT", value = 13, - description = "" + description = "Gamepad center buttons, left one (i.e. PS3: Select)" }, { name = "GAMEPAD_BUTTON_MIDDLE", value = 14, - description = "" + description = "Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)" }, { name = "GAMEPAD_BUTTON_MIDDLE_RIGHT", value = 15, - description = "" + description = "Gamepad center buttons, right one (i.e. PS3: Start)" }, { name = "GAMEPAD_BUTTON_LEFT_THUMB", value = 16, - description = "" + description = "Gamepad joystick pressed button left" }, { name = "GAMEPAD_BUTTON_RIGHT_THUMB", value = 17, - description = "" + description = "Gamepad joystick pressed button right" } } }, { name = "GamepadAxis", - description = "", + description = "Gamepad axis", values = { { name = "GAMEPAD_AXIS_LEFT_X", value = 0, - description = "" + description = "Gamepad left stick X axis" }, { name = "GAMEPAD_AXIS_LEFT_Y", value = 1, - description = "" + description = "Gamepad left stick Y axis" }, { name = "GAMEPAD_AXIS_RIGHT_X", value = 2, - description = "" + description = "Gamepad right stick X axis" }, { name = "GAMEPAD_AXIS_RIGHT_Y", value = 3, - description = "" + description = "Gamepad right stick Y axis" }, { name = "GAMEPAD_AXIS_LEFT_TRIGGER", value = 4, - description = "" + description = "Gamepad back trigger left, pressure level: [1..-1]" }, { name = "GAMEPAD_AXIS_RIGHT_TRIGGER", value = 5, - description = "" + description = "Gamepad back trigger right, pressure level: [1..-1]" } } }, { name = "MaterialMapIndex", - description = "", + description = "Material map index", values = { { name = "MATERIAL_MAP_ALBEDO", value = 0, - description = "" + description = "Albedo material (same as: MATERIAL_MAP_DIFFUSE)" }, { name = "MATERIAL_MAP_METALNESS", value = 1, - description = "" + description = "Metalness material (same as: MATERIAL_MAP_SPECULAR)" }, { name = "MATERIAL_MAP_NORMAL", value = 2, - description = "" + description = "Normal material" }, { name = "MATERIAL_MAP_ROUGHNESS", value = 3, - description = "" + description = "Roughness material" }, { name = "MATERIAL_MAP_OCCLUSION", value = 4, - description = "" + description = "Ambient occlusion material" }, { name = "MATERIAL_MAP_EMISSION", value = 5, - description = "" + description = "Emission material" }, { name = "MATERIAL_MAP_HEIGHT", value = 6, - description = "" + description = "Heightmap material" }, { name = "MATERIAL_MAP_CUBEMAP", value = 7, - description = "" + description = "Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" }, { name = "MATERIAL_MAP_IRRADIANCE", value = 8, - description = "" + description = "Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" }, { name = "MATERIAL_MAP_PREFILTER", value = 9, - description = "" + description = "Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" }, { name = "MATERIAL_MAP_BRDF", value = 10, - description = "" + description = "Brdf material" } } }, { name = "ShaderLocationIndex", - description = "", + description = "Shader location index", values = { { name = "SHADER_LOC_VERTEX_POSITION", value = 0, - description = "" + description = "Shader location: vertex attribute: position" }, { name = "SHADER_LOC_VERTEX_TEXCOORD01", value = 1, - description = "" + description = "Shader location: vertex attribute: texcoord01" }, { name = "SHADER_LOC_VERTEX_TEXCOORD02", value = 2, - description = "" + description = "Shader location: vertex attribute: texcoord02" }, { name = "SHADER_LOC_VERTEX_NORMAL", value = 3, - description = "" + description = "Shader location: vertex attribute: normal" }, { name = "SHADER_LOC_VERTEX_TANGENT", value = 4, - description = "" + description = "Shader location: vertex attribute: tangent" }, { name = "SHADER_LOC_VERTEX_COLOR", value = 5, - description = "" + description = "Shader location: vertex attribute: color" }, { name = "SHADER_LOC_MATRIX_MVP", value = 6, - description = "" + description = "Shader location: matrix uniform: model-view-projection" }, { name = "SHADER_LOC_MATRIX_VIEW", value = 7, - description = "" + description = "Shader location: matrix uniform: view (camera transform)" }, { name = "SHADER_LOC_MATRIX_PROJECTION", value = 8, - description = "" + description = "Shader location: matrix uniform: projection" }, { name = "SHADER_LOC_MATRIX_MODEL", value = 9, - description = "" + description = "Shader location: matrix uniform: model (transform)" }, { name = "SHADER_LOC_MATRIX_NORMAL", value = 10, - description = "" + description = "Shader location: matrix uniform: normal" }, { name = "SHADER_LOC_VECTOR_VIEW", value = 11, - description = "" + description = "Shader location: vector uniform: view" }, { name = "SHADER_LOC_COLOR_DIFFUSE", value = 12, - description = "" + description = "Shader location: vector uniform: diffuse color" }, { name = "SHADER_LOC_COLOR_SPECULAR", value = 13, - description = "" + description = "Shader location: vector uniform: specular color" }, { name = "SHADER_LOC_COLOR_AMBIENT", value = 14, - description = "" + description = "Shader location: vector uniform: ambient color" }, { name = "SHADER_LOC_MAP_ALBEDO", value = 15, - description = "" + description = "Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE)" }, { name = "SHADER_LOC_MAP_METALNESS", value = 16, - description = "" + description = "Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR)" }, { name = "SHADER_LOC_MAP_NORMAL", value = 17, - description = "" + description = "Shader location: sampler2d texture: normal" }, { name = "SHADER_LOC_MAP_ROUGHNESS", value = 18, - description = "" + description = "Shader location: sampler2d texture: roughness" }, { name = "SHADER_LOC_MAP_OCCLUSION", value = 19, - description = "" + description = "Shader location: sampler2d texture: occlusion" }, { name = "SHADER_LOC_MAP_EMISSION", value = 20, - description = "" + description = "Shader location: sampler2d texture: emission" }, { name = "SHADER_LOC_MAP_HEIGHT", value = 21, - description = "" + description = "Shader location: sampler2d texture: height" }, { name = "SHADER_LOC_MAP_CUBEMAP", value = 22, - description = "" + description = "Shader location: samplerCube texture: cubemap" }, { name = "SHADER_LOC_MAP_IRRADIANCE", value = 23, - description = "" + description = "Shader location: samplerCube texture: irradiance" }, { name = "SHADER_LOC_MAP_PREFILTER", value = 24, - description = "" + description = "Shader location: samplerCube texture: prefilter" }, { name = "SHADER_LOC_MAP_BRDF", value = 25, - description = "" + description = "Shader location: sampler2d texture: brdf" } } }, { name = "ShaderUniformDataType", - description = "", + description = "Shader uniform data type", values = { { name = "SHADER_UNIFORM_FLOAT", value = 0, - description = "" + description = "Shader uniform type: float" }, { name = "SHADER_UNIFORM_VEC2", value = 1, - description = "" + description = "Shader uniform type: vec2 (2 float)" }, { name = "SHADER_UNIFORM_VEC3", value = 2, - description = "" + description = "Shader uniform type: vec3 (3 float)" }, { name = "SHADER_UNIFORM_VEC4", value = 3, - description = "" + description = "Shader uniform type: vec4 (4 float)" }, { name = "SHADER_UNIFORM_INT", value = 4, - description = "" + description = "Shader uniform type: int" }, { name = "SHADER_UNIFORM_IVEC2", value = 5, - description = "" + description = "Shader uniform type: ivec2 (2 int)" }, { name = "SHADER_UNIFORM_IVEC3", value = 6, - description = "" + description = "Shader uniform type: ivec3 (3 int)" }, { name = "SHADER_UNIFORM_IVEC4", value = 7, - description = "" + description = "Shader uniform type: ivec4 (4 int)" }, { name = "SHADER_UNIFORM_SAMPLER2D", value = 8, - description = "" + description = "Shader uniform type: sampler2d" } } }, { name = "ShaderAttributeDataType", - description = "", + description = "Shader attribute data types", values = { { name = "SHADER_ATTRIB_FLOAT", value = 0, - description = "" + description = "Shader attribute type: float" }, { name = "SHADER_ATTRIB_VEC2", value = 1, - description = "" + description = "Shader attribute type: vec2 (2 float)" }, { name = "SHADER_ATTRIB_VEC3", value = 2, - description = "" + description = "Shader attribute type: vec3 (3 float)" }, { name = "SHADER_ATTRIB_VEC4", value = 3, - description = "" + description = "Shader attribute type: vec4 (4 float)" } } }, { name = "PixelFormat", - description = "", + description = "Pixel formats", values = { { name = "PIXELFORMAT_UNCOMPRESSED_GRAYSCALE", value = 1, - description = "" + description = "8 bit per pixel (no alpha)" }, { name = "PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA", value = 2, - description = "" + description = "8*2 bpp (2 channels)" }, { name = "PIXELFORMAT_UNCOMPRESSED_R5G6B5", value = 3, - description = "" + description = "16 bpp" }, { name = "PIXELFORMAT_UNCOMPRESSED_R8G8B8", value = 4, - description = "" + description = "24 bpp" }, { name = "PIXELFORMAT_UNCOMPRESSED_R5G5B5A1", value = 5, - description = "" + description = "16 bpp (1 bit alpha)" }, { name = "PIXELFORMAT_UNCOMPRESSED_R4G4B4A4", value = 6, - description = "" + description = "16 bpp (4 bit alpha)" }, { name = "PIXELFORMAT_UNCOMPRESSED_R8G8B8A8", value = 7, - description = "" + description = "32 bpp" }, { name = "PIXELFORMAT_UNCOMPRESSED_R32", value = 8, - description = "" + description = "32 bpp (1 channel - float)" }, { name = "PIXELFORMAT_UNCOMPRESSED_R32G32B32", value = 9, - description = "" + description = "32*3 bpp (3 channels - float)" }, { name = "PIXELFORMAT_UNCOMPRESSED_R32G32B32A32", value = 10, - description = "" + description = "32*4 bpp (4 channels - float)" }, { name = "PIXELFORMAT_COMPRESSED_DXT1_RGB", value = 11, - description = "" + description = "4 bpp (no alpha)" }, { name = "PIXELFORMAT_COMPRESSED_DXT1_RGBA", value = 12, - description = "" + description = "4 bpp (1 bit alpha)" }, { name = "PIXELFORMAT_COMPRESSED_DXT3_RGBA", value = 13, - description = "" + description = "8 bpp" }, { name = "PIXELFORMAT_COMPRESSED_DXT5_RGBA", value = 14, - description = "" + description = "8 bpp" }, { name = "PIXELFORMAT_COMPRESSED_ETC1_RGB", value = 15, - description = "" + description = "4 bpp" }, { name = "PIXELFORMAT_COMPRESSED_ETC2_RGB", value = 16, - description = "" + description = "4 bpp" }, { name = "PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA", value = 17, - description = "" + description = "8 bpp" }, { name = "PIXELFORMAT_COMPRESSED_PVRT_RGB", value = 18, - description = "" + description = "4 bpp" }, { name = "PIXELFORMAT_COMPRESSED_PVRT_RGBA", value = 19, - description = "" + description = "4 bpp" }, { name = "PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA", value = 20, - description = "" + description = "8 bpp" }, { name = "PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA", value = 21, - description = "" + description = "2 bpp" } } }, { name = "TextureFilter", - description = "", + description = "Texture parameters: filter mode", values = { { name = "TEXTURE_FILTER_POINT", value = 0, - description = "" + description = "No filter, just pixel approximation" }, { name = "TEXTURE_FILTER_BILINEAR", value = 1, - description = "" + description = "Linear filtering" }, { name = "TEXTURE_FILTER_TRILINEAR", value = 2, - description = "" + description = "Trilinear filtering (linear with mipmaps)" }, { name = "TEXTURE_FILTER_ANISOTROPIC_4X", value = 3, - description = "" + description = "Anisotropic filtering 4x" }, { name = "TEXTURE_FILTER_ANISOTROPIC_8X", value = 4, - description = "" + description = "Anisotropic filtering 8x" }, { name = "TEXTURE_FILTER_ANISOTROPIC_16X", value = 5, - description = "" + description = "Anisotropic filtering 16x" } } }, { name = "TextureWrap", - description = "", + description = "Texture parameters: wrap mode", values = { { name = "TEXTURE_WRAP_REPEAT", value = 0, - description = "" + description = "Repeats texture in tiled mode" }, { name = "TEXTURE_WRAP_CLAMP", value = 1, - description = "" + description = "Clamps texture to edge pixel in tiled mode" }, { name = "TEXTURE_WRAP_MIRROR_REPEAT", value = 2, - description = "" + description = "Mirrors and repeats the texture in tiled mode" }, { name = "TEXTURE_WRAP_MIRROR_CLAMP", value = 3, - description = "" + description = "Mirrors and clamps to border the texture in tiled mode" } } }, { name = "CubemapLayout", - description = "", + description = "Cubemap layouts", values = { { name = "CUBEMAP_LAYOUT_AUTO_DETECT", value = 0, - description = "" + description = "Automatically detect layout type" }, { name = "CUBEMAP_LAYOUT_LINE_VERTICAL", value = 1, - description = "" + description = "Layout is defined by a vertical line with faces" }, { name = "CUBEMAP_LAYOUT_LINE_HORIZONTAL", value = 2, - description = "" + description = "Layout is defined by an horizontal line with faces" }, { name = "CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR", value = 3, - description = "" + description = "Layout is defined by a 3x4 cross with cubemap faces" }, { name = "CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE", value = 4, - description = "" + description = "Layout is defined by a 4x3 cross with cubemap faces" }, { name = "CUBEMAP_LAYOUT_PANORAMA", value = 5, - description = "" + description = "Layout is defined by a panorama image (equirectangular map)" } } }, { name = "FontType", - description = "", + description = "Font type, defines generation method", values = { { name = "FONT_DEFAULT", value = 0, - description = "" + description = "Default font generation, anti-aliased" }, { name = "FONT_BITMAP", value = 1, - description = "" + description = "Bitmap font generation, no anti-aliasing" }, { name = "FONT_SDF", value = 2, - description = "" + description = "SDF font generation, requires external shader" } } }, { name = "BlendMode", - description = "", + description = "Color blending modes (pre-defined)", values = { { name = "BLEND_ALPHA", value = 0, - description = "" + description = "Blend textures considering alpha (default)" }, { name = "BLEND_ADDITIVE", value = 1, - description = "" + description = "Blend textures adding colors" }, { name = "BLEND_MULTIPLIED", value = 2, - description = "" + description = "Blend textures multiplying colors" }, { name = "BLEND_ADD_COLORS", value = 3, - description = "" + description = "Blend textures adding colors (alternative)" }, { name = "BLEND_SUBTRACT_COLORS", value = 4, - description = "" + description = "Blend textures subtracting colors (alternative)" }, { name = "BLEND_CUSTOM", value = 5, - description = "" + description = "Belnd textures using custom src/dst factors (use rlSetBlendMode())" } } }, { name = "Gesture", - description = "", + description = "Gesture", values = { { name = "GESTURE_NONE", value = 0, - description = "" + description = "No gesture" }, { name = "GESTURE_TAP", value = 1, - description = "" + description = "Tap gesture" }, { name = "GESTURE_DOUBLETAP", value = 2, - description = "" + description = "Double tap gesture" }, { name = "GESTURE_HOLD", value = 4, - description = "" + description = "Hold gesture" }, { name = "GESTURE_DRAG", value = 8, - description = "" + description = "Drag gesture" }, { name = "GESTURE_SWIPE_RIGHT", value = 16, - description = "" + description = "Swipe right gesture" }, { name = "GESTURE_SWIPE_LEFT", value = 32, - description = "" + description = "Swipe left gesture" }, { name = "GESTURE_SWIPE_UP", value = 64, - description = "" + description = "Swipe up gesture" }, { name = "GESTURE_SWIPE_DOWN", value = 128, - description = "" + description = "Swipe down gesture" }, { name = "GESTURE_PINCH_IN", value = 256, - description = "" + description = "Pinch in gesture" }, { name = "GESTURE_PINCH_OUT", value = 512, - description = "" + description = "Pinch out gesture" } } }, { name = "CameraMode", - description = "", + description = "Camera system modes", values = { { name = "CAMERA_CUSTOM", value = 0, - description = "" + description = "Custom camera" }, { name = "CAMERA_FREE", value = 1, - description = "" + description = "Free camera" }, { name = "CAMERA_ORBITAL", value = 2, - description = "" + description = "Orbital camera" }, { name = "CAMERA_FIRST_PERSON", value = 3, - description = "" + description = "First person camera" }, { name = "CAMERA_THIRD_PERSON", value = 4, - description = "" + description = "Third person camera" } } }, { name = "CameraProjection", - description = "", + description = "Camera projection", values = { { name = "CAMERA_PERSPECTIVE", value = 0, - description = "" + description = "Perspective projection" }, { name = "CAMERA_ORTHOGRAPHIC", value = 1, - description = "" + description = "Orthographic projection" } } }, { name = "NPatchLayout", - description = "", + description = "N-patch layout", values = { { name = "NPATCH_NINE_PATCH", value = 0, - description = "" + description = "Npatch layout: 3x3 tiles" }, { name = "NPATCH_THREE_PATCH_VERTICAL", value = 1, - description = "" + description = "Npatch layout: 1x3 tiles" }, { name = "NPATCH_THREE_PATCH_HORIZONTAL", value = 2, - description = "" + description = "Npatch layout: 3x1 tiles" } } } @@ -2651,6 +2651,16 @@ return { description = "Get current screen height", returnType = "int" }, + { + name = "GetRenderWidth", + description = "Get current render width (it considers HiDPI)", + returnType = "int" + }, + { + name = "GetRenderHeight", + description = "Get current render height (it considers HiDPI)", + returnType = "int" + }, { name = "GetMonitorCount", description = "Get number of connected monitors", @@ -3234,7 +3244,7 @@ return { }, { name = "LoadFileText", - description = "Load text data from file (read), returns a ' 0' terminated string", + description = "Load text data from file (read), returns a '\\0' terminated string", returnType = "char *", params = { {name = "fileName", type = "const char *"} @@ -3250,7 +3260,7 @@ return { }, { name = "SaveFileText", - description = "Save text data to file (write), string must be ' 0' terminated, returns true on success", + description = "Save text data to file (write), string must be '\\0' terminated, returns true on success", returnType = "bool", params = { {name = "fileName", type = "const char *"}, @@ -5509,7 +5519,7 @@ return { }, { name = "TextLength", - description = "Get text length, checks for ' 0' ending", + description = "Get text length, checks for '\\0' ending", returnType = "unsigned int", params = { {name = "text", type = "const char *"} diff --git a/parser/raylib_api.txt b/parser/raylib_api.txt index c5fe4514d..a01f9fa25 100644 --- a/parser/raylib_api.txt +++ b/parser/raylib_api.txt @@ -3,46 +3,46 @@ Structures found: 31 Struct 01: Vector2 (2 fields) Name: Vector2 - Description: + Description: Vector2, 2 components Field[1]: float x // Vector x component Field[2]: float y // Vector y component Struct 02: Vector3 (3 fields) Name: Vector3 - Description: + Description: Vector3, 3 components Field[1]: float x // Vector x component Field[2]: float y // Vector y component Field[3]: float z // Vector z component Struct 03: Vector4 (4 fields) Name: Vector4 - Description: + Description: Vector4, 4 components Field[1]: float x // Vector x component Field[2]: float y // Vector y component Field[3]: float z // Vector z component Field[4]: float w // Vector w component Struct 04: Matrix (4 fields) Name: Matrix - Description: + Description: Matrix, 4x4 components, column major, OpenGL style, right handed Field[1]: float m0, m4, m8, m12 // Matrix first row (4 components) Field[2]: float m1, m5, m9, m13 // Matrix second row (4 components) Field[3]: float m2, m6, m10, m14 // Matrix third row (4 components) Field[4]: float m3, m7, m11, m15 // Matrix fourth row (4 components) Struct 05: Color (4 fields) Name: Color - Description: + Description: Color, 4 components, R8G8B8A8 (32bit) Field[1]: unsigned char r // Color red value Field[2]: unsigned char g // Color green value Field[3]: unsigned char b // Color blue value Field[4]: unsigned char a // Color alpha value Struct 06: Rectangle (4 fields) Name: Rectangle - Description: + Description: Rectangle, 4 components Field[1]: float x // Rectangle top-left corner position x Field[2]: float y // Rectangle top-left corner position y Field[3]: float width // Rectangle width Field[4]: float height // Rectangle height Struct 07: Image (5 fields) Name: Image - Description: + Description: Image, pixel data stored in CPU memory (RAM) Field[1]: void * data // Image raw data Field[2]: int width // Image base width Field[3]: int height // Image base height @@ -50,7 +50,7 @@ Struct 07: Image (5 fields) Field[5]: int format // Data format (PixelFormat type) Struct 08: Texture (5 fields) Name: Texture - Description: + Description: Texture, tex data stored in GPU memory (VRAM) Field[1]: unsigned int id // OpenGL texture id Field[2]: int width // Texture base width Field[3]: int height // Texture base height @@ -58,13 +58,13 @@ Struct 08: Texture (5 fields) Field[5]: int format // Data format (PixelFormat type) Struct 09: RenderTexture (3 fields) Name: RenderTexture - Description: + Description: RenderTexture, fbo for texture rendering Field[1]: unsigned int id // OpenGL framebuffer object id Field[2]: Texture texture // Color buffer attachment texture Field[3]: Texture depth // Depth buffer attachment texture Struct 10: NPatchInfo (6 fields) Name: NPatchInfo - Description: + Description: NPatchInfo, n-patch layout info Field[1]: Rectangle source // Texture source rectangle Field[2]: int left // Left border offset Field[3]: int top // Top border offset @@ -73,7 +73,7 @@ Struct 10: NPatchInfo (6 fields) Field[6]: int layout // Layout of the n-patch: 3x3, 1x3 or 3x1 Struct 11: GlyphInfo (5 fields) Name: GlyphInfo - Description: + Description: GlyphInfo, font characters glyphs info Field[1]: int value // Character value (Unicode) Field[2]: int offsetX // Character offset X when drawing Field[3]: int offsetY // Character offset Y when drawing @@ -81,7 +81,7 @@ Struct 11: GlyphInfo (5 fields) Field[5]: Image image // Character image data Struct 12: Font (6 fields) Name: Font - Description: + Description: Font, font texture and GlyphInfo array data Field[1]: int baseSize // Base size (default chars height) Field[2]: int glyphCount // Number of glyph characters Field[3]: int glyphPadding // Padding around the glyph characters @@ -90,7 +90,7 @@ Struct 12: Font (6 fields) Field[6]: GlyphInfo * glyphs // Glyphs info data Struct 13: Camera3D (5 fields) Name: Camera3D - Description: + Description: Camera, defines position/orientation in 3d space Field[1]: Vector3 position // Camera position Field[2]: Vector3 target // Camera target it looks-at Field[3]: Vector3 up // Camera up vector (rotation over its axis) @@ -98,14 +98,14 @@ Struct 13: Camera3D (5 fields) Field[5]: int projection // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC Struct 14: Camera2D (4 fields) Name: Camera2D - Description: + Description: Camera2D, defines position/orientation in 2d space Field[1]: Vector2 offset // Camera offset (displacement from target) Field[2]: Vector2 target // Camera target (rotation and zoom origin) Field[3]: float rotation // Camera rotation in degrees Field[4]: float zoom // Camera zoom (scaling), should be 1.0f by default Struct 15: Mesh (15 fields) Name: Mesh - Description: + Description: Mesh, vertex data and vao/vbo Field[1]: int vertexCount // Number of vertices stored in arrays Field[2]: int triangleCount // Number of triangles stored (indexed or not) Field[3]: float * vertices // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) @@ -123,35 +123,35 @@ Struct 15: Mesh (15 fields) Field[15]: unsigned int * vboId // OpenGL Vertex Buffer Objects id (default vertex data) Struct 16: Shader (2 fields) Name: Shader - Description: + Description: Shader Field[1]: unsigned int id // Shader program id Field[2]: int * locs // Shader locations array (RL_MAX_SHADER_LOCATIONS) Struct 17: MaterialMap (3 fields) Name: MaterialMap - Description: + Description: MaterialMap Field[1]: Texture2D texture // Material map texture Field[2]: Color color // Material map color Field[3]: float value // Material map value Struct 18: Material (3 fields) Name: Material - Description: + Description: Material, includes shader and maps Field[1]: Shader shader // Material shader Field[2]: MaterialMap * maps // Material maps array (MAX_MATERIAL_MAPS) Field[3]: float params[4] // Material generic parameters (if required) Struct 19: Transform (3 fields) Name: Transform - Description: + Description: Transform, vectex transformation data Field[1]: Vector3 translation // Translation Field[2]: Quaternion rotation // Rotation Field[3]: Vector3 scale // Scale Struct 20: BoneInfo (2 fields) Name: BoneInfo - Description: + Description: Bone, skeletal animation bone Field[1]: char name[32] // Bone name Field[2]: int parent // Bone parent Struct 21: Model (9 fields) Name: Model - Description: + Description: Model, meshes, materials and animation data Field[1]: Matrix transform // Local transform matrix Field[2]: int meshCount // Number of meshes Field[3]: int materialCount // Number of materials @@ -163,31 +163,31 @@ Struct 21: Model (9 fields) Field[9]: Transform * bindPose // Bones base transformation (pose) Struct 22: ModelAnimation (4 fields) Name: ModelAnimation - Description: + Description: ModelAnimation Field[1]: int boneCount // Number of bones Field[2]: int frameCount // Number of animation frames Field[3]: BoneInfo * bones // Bones information (skeleton) Field[4]: Transform ** framePoses // Poses array by frame Struct 23: Ray (2 fields) Name: Ray - Description: + Description: Ray, ray for raycasting Field[1]: Vector3 position // Ray position (origin) Field[2]: Vector3 direction // Ray direction Struct 24: RayCollision (4 fields) Name: RayCollision - Description: + Description: RayCollision, ray hit information Field[1]: bool hit // Did the ray hit something? Field[2]: float distance // Distance to nearest hit Field[3]: Vector3 point // Point of nearest hit Field[4]: Vector3 normal // Surface normal of hit Struct 25: BoundingBox (2 fields) Name: BoundingBox - Description: + Description: BoundingBox Field[1]: Vector3 min // Minimum vertex box-corner Field[2]: Vector3 max // Maximum vertex box-corner Struct 26: Wave (5 fields) Name: Wave - Description: + Description: Wave, audio wave data Field[1]: unsigned int frameCount // Total number of frames (considering channels) Field[2]: unsigned int sampleRate // Frequency (samples per second) Field[3]: unsigned int sampleSize // Bit depth (bits per sample): 8, 16, 32 (24 not supported) @@ -195,19 +195,19 @@ Struct 26: Wave (5 fields) Field[5]: void * data // Buffer data pointer Struct 27: AudioStream (4 fields) Name: AudioStream - Description: + Description: AudioStream, custom audio stream Field[1]: rAudioBuffer * buffer // Pointer to internal data used by the audio system Field[2]: unsigned int sampleRate // Frequency (samples per second) Field[3]: unsigned int sampleSize // Bit depth (bits per sample): 8, 16, 32 (24 not supported) Field[4]: unsigned int channels // Number of channels (1-mono, 2-stereo, ...) Struct 28: Sound (2 fields) Name: Sound - Description: + Description: Sound Field[1]: AudioStream stream // Audio stream Field[2]: unsigned int frameCount // Total number of frames (considering channels) Struct 29: Music (5 fields) Name: Music - Description: + Description: Music, audio stream, anything longer than ~10 seconds should be streamed Field[1]: AudioStream stream // Audio stream Field[2]: unsigned int frameCount // Total number of frames (considering channels) Field[3]: bool looping // Music looping enable @@ -215,7 +215,7 @@ Struct 29: Music (5 fields) Field[5]: void * ctxData // Audio context data, depends on type Struct 30: VrDeviceInfo (10 fields) Name: VrDeviceInfo - Description: + Description: VrDeviceInfo, Head-Mounted-Display device parameters Field[1]: int hResolution // Horizontal resolution in pixels Field[2]: int vResolution // Vertical resolution in pixels Field[3]: float hScreenSize // Horizontal size in meters @@ -228,7 +228,7 @@ Struct 30: VrDeviceInfo (10 fields) Field[10]: float chromaAbCorrection[4] // Chromatic aberration correction parameters Struct 31: VrStereoConfig (8 fields) Name: VrStereoConfig - Description: + Description: VrStereoConfig, VR stereo rendering configuration for simulator Field[1]: Matrix projection[2] // VR projection matrices (per eye) Field[2]: Matrix viewOffset[2] // VR view offset matrices (per eye) Field[3]: float leftLensCenter[2] // VR left lens center @@ -242,7 +242,7 @@ Enums found: 21 Enum 01: ConfigFlags (14 values) Name: ConfigFlags - Description: + Description: System/Window config flags Value[FLAG_VSYNC_HINT]: 64 Value[FLAG_FULLSCREEN_MODE]: 2 Value[FLAG_WINDOW_RESIZABLE]: 4 @@ -259,7 +259,7 @@ Enum 01: ConfigFlags (14 values) Value[FLAG_INTERLACED_HINT]: 65536 Enum 02: TraceLogLevel (8 values) Name: TraceLogLevel - Description: + Description: Trace log level Value[LOG_ALL]: 0 Value[LOG_TRACE]: 1 Value[LOG_DEBUG]: 2 @@ -270,7 +270,7 @@ Enum 02: TraceLogLevel (8 values) Value[LOG_NONE]: 7 Enum 03: KeyboardKey (110 values) Name: KeyboardKey - Description: + Description: Keyboard keys (US keyboard layout) Value[KEY_NULL]: 0 Value[KEY_APOSTROPHE]: 39 Value[KEY_COMMA]: 44 @@ -383,7 +383,7 @@ Enum 03: KeyboardKey (110 values) Value[KEY_VOLUME_DOWN]: 25 Enum 04: MouseButton (7 values) Name: MouseButton - Description: + Description: Mouse buttons Value[MOUSE_BUTTON_LEFT]: 0 Value[MOUSE_BUTTON_RIGHT]: 1 Value[MOUSE_BUTTON_MIDDLE]: 2 @@ -393,7 +393,7 @@ Enum 04: MouseButton (7 values) Value[MOUSE_BUTTON_BACK]: 6 Enum 05: MouseCursor (11 values) Name: MouseCursor - Description: + Description: Mouse cursor Value[MOUSE_CURSOR_DEFAULT]: 0 Value[MOUSE_CURSOR_ARROW]: 1 Value[MOUSE_CURSOR_IBEAM]: 2 @@ -407,7 +407,7 @@ Enum 05: MouseCursor (11 values) Value[MOUSE_CURSOR_NOT_ALLOWED]: 10 Enum 06: GamepadButton (18 values) Name: GamepadButton - Description: + Description: Gamepad buttons Value[GAMEPAD_BUTTON_UNKNOWN]: 0 Value[GAMEPAD_BUTTON_LEFT_FACE_UP]: 1 Value[GAMEPAD_BUTTON_LEFT_FACE_RIGHT]: 2 @@ -428,7 +428,7 @@ Enum 06: GamepadButton (18 values) Value[GAMEPAD_BUTTON_RIGHT_THUMB]: 17 Enum 07: GamepadAxis (6 values) Name: GamepadAxis - Description: + Description: Gamepad axis Value[GAMEPAD_AXIS_LEFT_X]: 0 Value[GAMEPAD_AXIS_LEFT_Y]: 1 Value[GAMEPAD_AXIS_RIGHT_X]: 2 @@ -437,7 +437,7 @@ Enum 07: GamepadAxis (6 values) Value[GAMEPAD_AXIS_RIGHT_TRIGGER]: 5 Enum 08: MaterialMapIndex (11 values) Name: MaterialMapIndex - Description: + Description: Material map index Value[MATERIAL_MAP_ALBEDO]: 0 Value[MATERIAL_MAP_METALNESS]: 1 Value[MATERIAL_MAP_NORMAL]: 2 @@ -451,7 +451,7 @@ Enum 08: MaterialMapIndex (11 values) Value[MATERIAL_MAP_BRDF]: 10 Enum 09: ShaderLocationIndex (26 values) Name: ShaderLocationIndex - Description: + Description: Shader location index Value[SHADER_LOC_VERTEX_POSITION]: 0 Value[SHADER_LOC_VERTEX_TEXCOORD01]: 1 Value[SHADER_LOC_VERTEX_TEXCOORD02]: 2 @@ -480,7 +480,7 @@ Enum 09: ShaderLocationIndex (26 values) Value[SHADER_LOC_MAP_BRDF]: 25 Enum 10: ShaderUniformDataType (9 values) Name: ShaderUniformDataType - Description: + Description: Shader uniform data type Value[SHADER_UNIFORM_FLOAT]: 0 Value[SHADER_UNIFORM_VEC2]: 1 Value[SHADER_UNIFORM_VEC3]: 2 @@ -492,14 +492,14 @@ Enum 10: ShaderUniformDataType (9 values) Value[SHADER_UNIFORM_SAMPLER2D]: 8 Enum 11: ShaderAttributeDataType (4 values) Name: ShaderAttributeDataType - Description: + Description: Shader attribute data types Value[SHADER_ATTRIB_FLOAT]: 0 Value[SHADER_ATTRIB_VEC2]: 1 Value[SHADER_ATTRIB_VEC3]: 2 Value[SHADER_ATTRIB_VEC4]: 3 Enum 12: PixelFormat (21 values) Name: PixelFormat - Description: + Description: Pixel formats Value[PIXELFORMAT_UNCOMPRESSED_GRAYSCALE]: 1 Value[PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA]: 2 Value[PIXELFORMAT_UNCOMPRESSED_R5G6B5]: 3 @@ -523,7 +523,7 @@ Enum 12: PixelFormat (21 values) Value[PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA]: 21 Enum 13: TextureFilter (6 values) Name: TextureFilter - Description: + Description: Texture parameters: filter mode Value[TEXTURE_FILTER_POINT]: 0 Value[TEXTURE_FILTER_BILINEAR]: 1 Value[TEXTURE_FILTER_TRILINEAR]: 2 @@ -532,14 +532,14 @@ Enum 13: TextureFilter (6 values) Value[TEXTURE_FILTER_ANISOTROPIC_16X]: 5 Enum 14: TextureWrap (4 values) Name: TextureWrap - Description: + Description: Texture parameters: wrap mode Value[TEXTURE_WRAP_REPEAT]: 0 Value[TEXTURE_WRAP_CLAMP]: 1 Value[TEXTURE_WRAP_MIRROR_REPEAT]: 2 Value[TEXTURE_WRAP_MIRROR_CLAMP]: 3 Enum 15: CubemapLayout (6 values) Name: CubemapLayout - Description: + Description: Cubemap layouts Value[CUBEMAP_LAYOUT_AUTO_DETECT]: 0 Value[CUBEMAP_LAYOUT_LINE_VERTICAL]: 1 Value[CUBEMAP_LAYOUT_LINE_HORIZONTAL]: 2 @@ -548,13 +548,13 @@ Enum 15: CubemapLayout (6 values) Value[CUBEMAP_LAYOUT_PANORAMA]: 5 Enum 16: FontType (3 values) Name: FontType - Description: + Description: Font type, defines generation method Value[FONT_DEFAULT]: 0 Value[FONT_BITMAP]: 1 Value[FONT_SDF]: 2 Enum 17: BlendMode (6 values) Name: BlendMode - Description: + Description: Color blending modes (pre-defined) Value[BLEND_ALPHA]: 0 Value[BLEND_ADDITIVE]: 1 Value[BLEND_MULTIPLIED]: 2 @@ -563,7 +563,7 @@ Enum 17: BlendMode (6 values) Value[BLEND_CUSTOM]: 5 Enum 18: Gesture (11 values) Name: Gesture - Description: + Description: Gesture Value[GESTURE_NONE]: 0 Value[GESTURE_TAP]: 1 Value[GESTURE_DOUBLETAP]: 2 @@ -577,7 +577,7 @@ Enum 18: Gesture (11 values) Value[GESTURE_PINCH_OUT]: 512 Enum 19: CameraMode (5 values) Name: CameraMode - Description: + Description: Camera system modes Value[CAMERA_CUSTOM]: 0 Value[CAMERA_FREE]: 1 Value[CAMERA_ORBITAL]: 2 @@ -585,17 +585,17 @@ Enum 19: CameraMode (5 values) Value[CAMERA_THIRD_PERSON]: 4 Enum 20: CameraProjection (2 values) Name: CameraProjection - Description: + Description: Camera projection Value[CAMERA_PERSPECTIVE]: 0 Value[CAMERA_ORTHOGRAPHIC]: 1 Enum 21: NPatchLayout (3 values) Name: NPatchLayout - Description: + Description: N-patch layout Value[NPATCH_NINE_PATCH]: 0 Value[NPATCH_THREE_PATCH_VERTICAL]: 1 Value[NPATCH_THREE_PATCH_HORIZONTAL]: 2 -Functions found: 487 +Functions found: 489 Function 001: InitWindow() (3 input parameters) Name: InitWindow @@ -732,182 +732,192 @@ Function 026: GetScreenHeight() (0 input parameters) Return type: int Description: Get current screen height No input parameters -Function 027: GetMonitorCount() (0 input parameters) +Function 027: GetRenderWidth() (0 input parameters) + Name: GetRenderWidth + Return type: int + Description: Get current render width (it considers HiDPI) + No input parameters +Function 028: GetRenderHeight() (0 input parameters) + Name: GetRenderHeight + Return type: int + Description: Get current render height (it considers HiDPI) + No input parameters +Function 029: GetMonitorCount() (0 input parameters) Name: GetMonitorCount Return type: int Description: Get number of connected monitors No input parameters -Function 028: GetCurrentMonitor() (0 input parameters) +Function 030: GetCurrentMonitor() (0 input parameters) Name: GetCurrentMonitor Return type: int Description: Get current connected monitor No input parameters -Function 029: GetMonitorPosition() (1 input parameters) +Function 031: GetMonitorPosition() (1 input parameters) Name: GetMonitorPosition Return type: Vector2 Description: Get specified monitor position Param[1]: monitor (type: int) -Function 030: GetMonitorWidth() (1 input parameters) +Function 032: GetMonitorWidth() (1 input parameters) Name: GetMonitorWidth Return type: int Description: Get specified monitor width (max available by monitor) Param[1]: monitor (type: int) -Function 031: GetMonitorHeight() (1 input parameters) +Function 033: GetMonitorHeight() (1 input parameters) Name: GetMonitorHeight Return type: int Description: Get specified monitor height (max available by monitor) Param[1]: monitor (type: int) -Function 032: GetMonitorPhysicalWidth() (1 input parameters) +Function 034: GetMonitorPhysicalWidth() (1 input parameters) Name: GetMonitorPhysicalWidth Return type: int Description: Get specified monitor physical width in millimetres Param[1]: monitor (type: int) -Function 033: GetMonitorPhysicalHeight() (1 input parameters) +Function 035: GetMonitorPhysicalHeight() (1 input parameters) Name: GetMonitorPhysicalHeight Return type: int Description: Get specified monitor physical height in millimetres Param[1]: monitor (type: int) -Function 034: GetMonitorRefreshRate() (1 input parameters) +Function 036: GetMonitorRefreshRate() (1 input parameters) Name: GetMonitorRefreshRate Return type: int Description: Get specified monitor refresh rate Param[1]: monitor (type: int) -Function 035: GetWindowPosition() (0 input parameters) +Function 037: GetWindowPosition() (0 input parameters) Name: GetWindowPosition Return type: Vector2 Description: Get window position XY on monitor No input parameters -Function 036: GetWindowScaleDPI() (0 input parameters) +Function 038: GetWindowScaleDPI() (0 input parameters) Name: GetWindowScaleDPI Return type: Vector2 Description: Get window scale DPI factor No input parameters -Function 037: GetMonitorName() (1 input parameters) +Function 039: GetMonitorName() (1 input parameters) Name: GetMonitorName Return type: const char * Description: Get the human-readable, UTF-8 encoded name of the primary monitor Param[1]: monitor (type: int) -Function 038: SetClipboardText() (1 input parameters) +Function 040: SetClipboardText() (1 input parameters) Name: SetClipboardText Return type: void Description: Set clipboard text content Param[1]: text (type: const char *) -Function 039: GetClipboardText() (0 input parameters) +Function 041: GetClipboardText() (0 input parameters) Name: GetClipboardText Return type: const char * Description: Get clipboard text content No input parameters -Function 040: SwapScreenBuffer() (0 input parameters) +Function 042: SwapScreenBuffer() (0 input parameters) Name: SwapScreenBuffer Return type: void Description: Swap back buffer with front buffer (screen drawing) No input parameters -Function 041: PollInputEvents() (0 input parameters) +Function 043: PollInputEvents() (0 input parameters) Name: PollInputEvents Return type: void Description: Register all input events No input parameters -Function 042: WaitTime() (1 input parameters) +Function 044: WaitTime() (1 input parameters) Name: WaitTime Return type: void Description: Wait for some milliseconds (halt program execution) Param[1]: ms (type: float) -Function 043: ShowCursor() (0 input parameters) +Function 045: ShowCursor() (0 input parameters) Name: ShowCursor Return type: void Description: Shows cursor No input parameters -Function 044: HideCursor() (0 input parameters) +Function 046: HideCursor() (0 input parameters) Name: HideCursor Return type: void Description: Hides cursor No input parameters -Function 045: IsCursorHidden() (0 input parameters) +Function 047: IsCursorHidden() (0 input parameters) Name: IsCursorHidden Return type: bool Description: Check if cursor is not visible No input parameters -Function 046: EnableCursor() (0 input parameters) +Function 048: EnableCursor() (0 input parameters) Name: EnableCursor Return type: void Description: Enables cursor (unlock cursor) No input parameters -Function 047: DisableCursor() (0 input parameters) +Function 049: DisableCursor() (0 input parameters) Name: DisableCursor Return type: void Description: Disables cursor (lock cursor) No input parameters -Function 048: IsCursorOnScreen() (0 input parameters) +Function 050: IsCursorOnScreen() (0 input parameters) Name: IsCursorOnScreen Return type: bool Description: Check if cursor is on the screen No input parameters -Function 049: ClearBackground() (1 input parameters) +Function 051: ClearBackground() (1 input parameters) Name: ClearBackground Return type: void Description: Set background color (framebuffer clear color) Param[1]: color (type: Color) -Function 050: BeginDrawing() (0 input parameters) +Function 052: BeginDrawing() (0 input parameters) Name: BeginDrawing Return type: void Description: Setup canvas (framebuffer) to start drawing No input parameters -Function 051: EndDrawing() (0 input parameters) +Function 053: EndDrawing() (0 input parameters) Name: EndDrawing Return type: void Description: End canvas drawing and swap buffers (double buffering) No input parameters -Function 052: BeginMode2D() (1 input parameters) +Function 054: BeginMode2D() (1 input parameters) Name: BeginMode2D Return type: void Description: Begin 2D mode with custom camera (2D) Param[1]: camera (type: Camera2D) -Function 053: EndMode2D() (0 input parameters) +Function 055: EndMode2D() (0 input parameters) Name: EndMode2D Return type: void Description: Ends 2D mode with custom camera No input parameters -Function 054: BeginMode3D() (1 input parameters) +Function 056: BeginMode3D() (1 input parameters) Name: BeginMode3D Return type: void Description: Begin 3D mode with custom camera (3D) Param[1]: camera (type: Camera3D) -Function 055: EndMode3D() (0 input parameters) +Function 057: EndMode3D() (0 input parameters) Name: EndMode3D Return type: void Description: Ends 3D mode and returns to default 2D orthographic mode No input parameters -Function 056: BeginTextureMode() (1 input parameters) +Function 058: BeginTextureMode() (1 input parameters) Name: BeginTextureMode Return type: void Description: Begin drawing to render texture Param[1]: target (type: RenderTexture2D) -Function 057: EndTextureMode() (0 input parameters) +Function 059: EndTextureMode() (0 input parameters) Name: EndTextureMode Return type: void Description: Ends drawing to render texture No input parameters -Function 058: BeginShaderMode() (1 input parameters) +Function 060: BeginShaderMode() (1 input parameters) Name: BeginShaderMode Return type: void Description: Begin custom shader drawing Param[1]: shader (type: Shader) -Function 059: EndShaderMode() (0 input parameters) +Function 061: EndShaderMode() (0 input parameters) Name: EndShaderMode Return type: void Description: End custom shader drawing (use default shader) No input parameters -Function 060: BeginBlendMode() (1 input parameters) +Function 062: BeginBlendMode() (1 input parameters) Name: BeginBlendMode Return type: void Description: Begin blending mode (alpha, additive, multiplied, subtract, custom) Param[1]: mode (type: int) -Function 061: EndBlendMode() (0 input parameters) +Function 063: EndBlendMode() (0 input parameters) Name: EndBlendMode Return type: void Description: End blending mode (reset to default: alpha blending) No input parameters -Function 062: BeginScissorMode() (4 input parameters) +Function 064: BeginScissorMode() (4 input parameters) Name: BeginScissorMode Return type: void Description: Begin scissor mode (define screen area for following drawing) @@ -915,56 +925,56 @@ Function 062: BeginScissorMode() (4 input parameters) Param[2]: y (type: int) Param[3]: width (type: int) Param[4]: height (type: int) -Function 063: EndScissorMode() (0 input parameters) +Function 065: EndScissorMode() (0 input parameters) Name: EndScissorMode Return type: void Description: End scissor mode No input parameters -Function 064: BeginVrStereoMode() (1 input parameters) +Function 066: BeginVrStereoMode() (1 input parameters) Name: BeginVrStereoMode Return type: void Description: Begin stereo rendering (requires VR simulator) Param[1]: config (type: VrStereoConfig) -Function 065: EndVrStereoMode() (0 input parameters) +Function 067: EndVrStereoMode() (0 input parameters) Name: EndVrStereoMode Return type: void Description: End stereo rendering (requires VR simulator) No input parameters -Function 066: LoadVrStereoConfig() (1 input parameters) +Function 068: LoadVrStereoConfig() (1 input parameters) Name: LoadVrStereoConfig Return type: VrStereoConfig Description: Load VR stereo config for VR simulator device parameters Param[1]: device (type: VrDeviceInfo) -Function 067: UnloadVrStereoConfig() (1 input parameters) +Function 069: UnloadVrStereoConfig() (1 input parameters) Name: UnloadVrStereoConfig Return type: void Description: Unload VR stereo config Param[1]: config (type: VrStereoConfig) -Function 068: LoadShader() (2 input parameters) +Function 070: LoadShader() (2 input parameters) Name: LoadShader Return type: Shader Description: Load shader from files and bind default locations Param[1]: vsFileName (type: const char *) Param[2]: fsFileName (type: const char *) -Function 069: LoadShaderFromMemory() (2 input parameters) +Function 071: LoadShaderFromMemory() (2 input parameters) Name: LoadShaderFromMemory Return type: Shader Description: Load shader from code strings and bind default locations Param[1]: vsCode (type: const char *) Param[2]: fsCode (type: const char *) -Function 070: GetShaderLocation() (2 input parameters) +Function 072: GetShaderLocation() (2 input parameters) Name: GetShaderLocation Return type: int Description: Get shader uniform location Param[1]: shader (type: Shader) Param[2]: uniformName (type: const char *) -Function 071: GetShaderLocationAttrib() (2 input parameters) +Function 073: GetShaderLocationAttrib() (2 input parameters) Name: GetShaderLocationAttrib Return type: int Description: Get shader attribute location Param[1]: shader (type: Shader) Param[2]: attribName (type: const char *) -Function 072: SetShaderValue() (4 input parameters) +Function 074: SetShaderValue() (4 input parameters) Name: SetShaderValue Return type: void Description: Set shader uniform value @@ -972,7 +982,7 @@ Function 072: SetShaderValue() (4 input parameters) Param[2]: locIndex (type: int) Param[3]: value (type: const void *) Param[4]: uniformType (type: int) -Function 073: SetShaderValueV() (5 input parameters) +Function 075: SetShaderValueV() (5 input parameters) Name: SetShaderValueV Return type: void Description: Set shader uniform value vector @@ -981,48 +991,48 @@ Function 073: SetShaderValueV() (5 input parameters) Param[3]: value (type: const void *) Param[4]: uniformType (type: int) Param[5]: count (type: int) -Function 074: SetShaderValueMatrix() (3 input parameters) +Function 076: SetShaderValueMatrix() (3 input parameters) Name: SetShaderValueMatrix Return type: void Description: Set shader uniform value (matrix 4x4) Param[1]: shader (type: Shader) Param[2]: locIndex (type: int) Param[3]: mat (type: Matrix) -Function 075: SetShaderValueTexture() (3 input parameters) +Function 077: SetShaderValueTexture() (3 input parameters) Name: SetShaderValueTexture Return type: void Description: Set shader uniform value for texture (sampler2d) Param[1]: shader (type: Shader) Param[2]: locIndex (type: int) Param[3]: texture (type: Texture2D) -Function 076: UnloadShader() (1 input parameters) +Function 078: UnloadShader() (1 input parameters) Name: UnloadShader Return type: void Description: Unload shader from GPU memory (VRAM) Param[1]: shader (type: Shader) -Function 077: GetMouseRay() (2 input parameters) +Function 079: GetMouseRay() (2 input parameters) Name: GetMouseRay Return type: Ray Description: Get a ray trace from mouse position Param[1]: mousePosition (type: Vector2) Param[2]: camera (type: Camera) -Function 078: GetCameraMatrix() (1 input parameters) +Function 080: GetCameraMatrix() (1 input parameters) Name: GetCameraMatrix Return type: Matrix Description: Get camera transform matrix (view matrix) Param[1]: camera (type: Camera) -Function 079: GetCameraMatrix2D() (1 input parameters) +Function 081: GetCameraMatrix2D() (1 input parameters) Name: GetCameraMatrix2D Return type: Matrix Description: Get camera 2d transform matrix Param[1]: camera (type: Camera2D) -Function 080: GetWorldToScreen() (2 input parameters) +Function 082: GetWorldToScreen() (2 input parameters) Name: GetWorldToScreen Return type: Vector2 Description: Get the screen space position for a 3d world space position Param[1]: position (type: Vector3) Param[2]: camera (type: Camera) -Function 081: GetWorldToScreenEx() (4 input parameters) +Function 083: GetWorldToScreenEx() (4 input parameters) Name: GetWorldToScreenEx Return type: Vector2 Description: Get size position for a 3d world space position @@ -1030,521 +1040,521 @@ Function 081: GetWorldToScreenEx() (4 input parameters) Param[2]: camera (type: Camera) Param[3]: width (type: int) Param[4]: height (type: int) -Function 082: GetWorldToScreen2D() (2 input parameters) +Function 084: GetWorldToScreen2D() (2 input parameters) Name: GetWorldToScreen2D Return type: Vector2 Description: Get the screen space position for a 2d camera world space position Param[1]: position (type: Vector2) Param[2]: camera (type: Camera2D) -Function 083: GetScreenToWorld2D() (2 input parameters) +Function 085: GetScreenToWorld2D() (2 input parameters) Name: GetScreenToWorld2D Return type: Vector2 Description: Get the world space position for a 2d camera screen space position Param[1]: position (type: Vector2) Param[2]: camera (type: Camera2D) -Function 084: SetTargetFPS() (1 input parameters) +Function 086: SetTargetFPS() (1 input parameters) Name: SetTargetFPS Return type: void Description: Set target FPS (maximum) Param[1]: fps (type: int) -Function 085: GetFPS() (0 input parameters) +Function 087: GetFPS() (0 input parameters) Name: GetFPS Return type: int Description: Get current FPS No input parameters -Function 086: GetFrameTime() (0 input parameters) +Function 088: GetFrameTime() (0 input parameters) Name: GetFrameTime Return type: float Description: Get time in seconds for last frame drawn (delta time) No input parameters -Function 087: GetTime() (0 input parameters) +Function 089: GetTime() (0 input parameters) Name: GetTime Return type: double Description: Get elapsed time in seconds since InitWindow() No input parameters -Function 088: GetRandomValue() (2 input parameters) +Function 090: GetRandomValue() (2 input parameters) Name: GetRandomValue Return type: int Description: Get a random value between min and max (both included) Param[1]: min (type: int) Param[2]: max (type: int) -Function 089: SetRandomSeed() (1 input parameters) +Function 091: SetRandomSeed() (1 input parameters) Name: SetRandomSeed Return type: void Description: Set the seed for the random number generator Param[1]: seed (type: unsigned int) -Function 090: TakeScreenshot() (1 input parameters) +Function 092: TakeScreenshot() (1 input parameters) Name: TakeScreenshot Return type: void Description: Takes a screenshot of current screen (filename extension defines format) Param[1]: fileName (type: const char *) -Function 091: SetConfigFlags() (1 input parameters) +Function 093: SetConfigFlags() (1 input parameters) Name: SetConfigFlags Return type: void Description: Setup init configuration flags (view FLAGS) Param[1]: flags (type: unsigned int) -Function 092: TraceLog() (3 input parameters) +Function 094: TraceLog() (3 input parameters) Name: TraceLog Return type: void Description: Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) Param[1]: logLevel (type: int) Param[2]: text (type: const char *) Param[3]: (type: ) -Function 093: SetTraceLogLevel() (1 input parameters) +Function 095: SetTraceLogLevel() (1 input parameters) Name: SetTraceLogLevel Return type: void Description: Set the current threshold (minimum) log level Param[1]: logLevel (type: int) -Function 094: MemAlloc() (1 input parameters) +Function 096: MemAlloc() (1 input parameters) Name: MemAlloc Return type: void * Description: Internal memory allocator Param[1]: size (type: int) -Function 095: MemRealloc() (2 input parameters) +Function 097: MemRealloc() (2 input parameters) Name: MemRealloc Return type: void * Description: Internal memory reallocator Param[1]: ptr (type: void *) Param[2]: size (type: int) -Function 096: MemFree() (1 input parameters) +Function 098: MemFree() (1 input parameters) Name: MemFree Return type: void Description: Internal memory free Param[1]: ptr (type: void *) -Function 097: SetTraceLogCallback() (1 input parameters) +Function 099: SetTraceLogCallback() (1 input parameters) Name: SetTraceLogCallback Return type: void Description: Set custom trace log Param[1]: callback (type: TraceLogCallback) -Function 098: SetLoadFileDataCallback() (1 input parameters) +Function 100: SetLoadFileDataCallback() (1 input parameters) Name: SetLoadFileDataCallback Return type: void Description: Set custom file binary data loader Param[1]: callback (type: LoadFileDataCallback) -Function 099: SetSaveFileDataCallback() (1 input parameters) +Function 101: SetSaveFileDataCallback() (1 input parameters) Name: SetSaveFileDataCallback Return type: void Description: Set custom file binary data saver Param[1]: callback (type: SaveFileDataCallback) -Function 100: SetLoadFileTextCallback() (1 input parameters) +Function 102: SetLoadFileTextCallback() (1 input parameters) Name: SetLoadFileTextCallback Return type: void Description: Set custom file text data loader Param[1]: callback (type: LoadFileTextCallback) -Function 101: SetSaveFileTextCallback() (1 input parameters) +Function 103: SetSaveFileTextCallback() (1 input parameters) Name: SetSaveFileTextCallback Return type: void Description: Set custom file text data saver Param[1]: callback (type: SaveFileTextCallback) -Function 102: LoadFileData() (2 input parameters) +Function 104: LoadFileData() (2 input parameters) Name: LoadFileData Return type: unsigned char * Description: Load file data as byte array (read) Param[1]: fileName (type: const char *) Param[2]: bytesRead (type: unsigned int *) -Function 103: UnloadFileData() (1 input parameters) +Function 105: UnloadFileData() (1 input parameters) Name: UnloadFileData Return type: void Description: Unload file data allocated by LoadFileData() Param[1]: data (type: unsigned char *) -Function 104: SaveFileData() (3 input parameters) +Function 106: SaveFileData() (3 input parameters) Name: SaveFileData Return type: bool Description: Save data to file from byte array (write), returns true on success Param[1]: fileName (type: const char *) Param[2]: data (type: void *) Param[3]: bytesToWrite (type: unsigned int) -Function 105: LoadFileText() (1 input parameters) +Function 107: LoadFileText() (1 input parameters) Name: LoadFileText Return type: char * Description: Load text data from file (read), returns a '\0' terminated string Param[1]: fileName (type: const char *) -Function 106: UnloadFileText() (1 input parameters) +Function 108: UnloadFileText() (1 input parameters) Name: UnloadFileText Return type: void Description: Unload file text data allocated by LoadFileText() Param[1]: text (type: char *) -Function 107: SaveFileText() (2 input parameters) +Function 109: SaveFileText() (2 input parameters) Name: SaveFileText Return type: bool Description: Save text data to file (write), string must be '\0' terminated, returns true on success Param[1]: fileName (type: const char *) Param[2]: text (type: char *) -Function 108: FileExists() (1 input parameters) +Function 110: FileExists() (1 input parameters) Name: FileExists Return type: bool Description: Check if file exists Param[1]: fileName (type: const char *) -Function 109: DirectoryExists() (1 input parameters) +Function 111: DirectoryExists() (1 input parameters) Name: DirectoryExists Return type: bool Description: Check if a directory path exists Param[1]: dirPath (type: const char *) -Function 110: IsFileExtension() (2 input parameters) +Function 112: IsFileExtension() (2 input parameters) Name: IsFileExtension Return type: bool Description: Check file extension (including point: .png, .wav) Param[1]: fileName (type: const char *) Param[2]: ext (type: const char *) -Function 111: GetFileExtension() (1 input parameters) +Function 113: GetFileExtension() (1 input parameters) Name: GetFileExtension Return type: const char * Description: Get pointer to extension for a filename string (includes dot: '.png') Param[1]: fileName (type: const char *) -Function 112: GetFileName() (1 input parameters) +Function 114: GetFileName() (1 input parameters) Name: GetFileName Return type: const char * Description: Get pointer to filename for a path string Param[1]: filePath (type: const char *) -Function 113: GetFileNameWithoutExt() (1 input parameters) +Function 115: GetFileNameWithoutExt() (1 input parameters) Name: GetFileNameWithoutExt Return type: const char * Description: Get filename string without extension (uses static string) Param[1]: filePath (type: const char *) -Function 114: GetDirectoryPath() (1 input parameters) +Function 116: GetDirectoryPath() (1 input parameters) Name: GetDirectoryPath Return type: const char * Description: Get full path for a given fileName with path (uses static string) Param[1]: filePath (type: const char *) -Function 115: GetPrevDirectoryPath() (1 input parameters) +Function 117: GetPrevDirectoryPath() (1 input parameters) Name: GetPrevDirectoryPath Return type: const char * Description: Get previous directory path for a given path (uses static string) Param[1]: dirPath (type: const char *) -Function 116: GetWorkingDirectory() (0 input parameters) +Function 118: GetWorkingDirectory() (0 input parameters) Name: GetWorkingDirectory Return type: const char * Description: Get current working directory (uses static string) No input parameters -Function 117: GetDirectoryFiles() (2 input parameters) +Function 119: GetDirectoryFiles() (2 input parameters) Name: GetDirectoryFiles Return type: char ** Description: Get filenames in a directory path (memory should be freed) Param[1]: dirPath (type: const char *) Param[2]: count (type: int *) -Function 118: ClearDirectoryFiles() (0 input parameters) +Function 120: ClearDirectoryFiles() (0 input parameters) Name: ClearDirectoryFiles Return type: void Description: Clear directory files paths buffers (free memory) No input parameters -Function 119: ChangeDirectory() (1 input parameters) +Function 121: ChangeDirectory() (1 input parameters) Name: ChangeDirectory Return type: bool Description: Change working directory, return true on success Param[1]: dir (type: const char *) -Function 120: IsFileDropped() (0 input parameters) +Function 122: IsFileDropped() (0 input parameters) Name: IsFileDropped Return type: bool Description: Check if a file has been dropped into window No input parameters -Function 121: GetDroppedFiles() (1 input parameters) +Function 123: GetDroppedFiles() (1 input parameters) Name: GetDroppedFiles Return type: char ** Description: Get dropped files names (memory should be freed) Param[1]: count (type: int *) -Function 122: ClearDroppedFiles() (0 input parameters) +Function 124: ClearDroppedFiles() (0 input parameters) Name: ClearDroppedFiles Return type: void Description: Clear dropped files paths buffer (free memory) No input parameters -Function 123: GetFileModTime() (1 input parameters) +Function 125: GetFileModTime() (1 input parameters) Name: GetFileModTime Return type: long Description: Get file modification time (last write time) Param[1]: fileName (type: const char *) -Function 124: CompressData() (3 input parameters) +Function 126: CompressData() (3 input parameters) Name: CompressData Return type: unsigned char * Description: Compress data (DEFLATE algorithm) Param[1]: data (type: unsigned char *) Param[2]: dataLength (type: int) Param[3]: compDataLength (type: int *) -Function 125: DecompressData() (3 input parameters) +Function 127: DecompressData() (3 input parameters) Name: DecompressData Return type: unsigned char * Description: Decompress data (DEFLATE algorithm) Param[1]: compData (type: unsigned char *) Param[2]: compDataLength (type: int) Param[3]: dataLength (type: int *) -Function 126: EncodeDataBase64() (3 input parameters) +Function 128: EncodeDataBase64() (3 input parameters) Name: EncodeDataBase64 Return type: char * Description: Encode data to Base64 string Param[1]: data (type: const unsigned char *) Param[2]: dataLength (type: int) Param[3]: outputLength (type: int *) -Function 127: DecodeDataBase64() (2 input parameters) +Function 129: DecodeDataBase64() (2 input parameters) Name: DecodeDataBase64 Return type: unsigned char * Description: Decode Base64 string data Param[1]: data (type: unsigned char *) Param[2]: outputLength (type: int *) -Function 128: SaveStorageValue() (2 input parameters) +Function 130: SaveStorageValue() (2 input parameters) Name: SaveStorageValue Return type: bool Description: Save integer value to storage file (to defined position), returns true on success Param[1]: position (type: unsigned int) Param[2]: value (type: int) -Function 129: LoadStorageValue() (1 input parameters) +Function 131: LoadStorageValue() (1 input parameters) Name: LoadStorageValue Return type: int Description: Load integer value from storage file (from defined position) Param[1]: position (type: unsigned int) -Function 130: OpenURL() (1 input parameters) +Function 132: OpenURL() (1 input parameters) Name: OpenURL Return type: void Description: Open URL with default system browser (if available) Param[1]: url (type: const char *) -Function 131: IsKeyPressed() (1 input parameters) +Function 133: IsKeyPressed() (1 input parameters) Name: IsKeyPressed Return type: bool Description: Check if a key has been pressed once Param[1]: key (type: int) -Function 132: IsKeyDown() (1 input parameters) +Function 134: IsKeyDown() (1 input parameters) Name: IsKeyDown Return type: bool Description: Check if a key is being pressed Param[1]: key (type: int) -Function 133: IsKeyReleased() (1 input parameters) +Function 135: IsKeyReleased() (1 input parameters) Name: IsKeyReleased Return type: bool Description: Check if a key has been released once Param[1]: key (type: int) -Function 134: IsKeyUp() (1 input parameters) +Function 136: IsKeyUp() (1 input parameters) Name: IsKeyUp Return type: bool Description: Check if a key is NOT being pressed Param[1]: key (type: int) -Function 135: SetExitKey() (1 input parameters) +Function 137: SetExitKey() (1 input parameters) Name: SetExitKey Return type: void Description: Set a custom key to exit program (default is ESC) Param[1]: key (type: int) -Function 136: GetKeyPressed() (0 input parameters) +Function 138: GetKeyPressed() (0 input parameters) Name: GetKeyPressed Return type: int Description: Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty No input parameters -Function 137: GetCharPressed() (0 input parameters) +Function 139: GetCharPressed() (0 input parameters) Name: GetCharPressed Return type: int Description: Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty No input parameters -Function 138: IsGamepadAvailable() (1 input parameters) +Function 140: IsGamepadAvailable() (1 input parameters) Name: IsGamepadAvailable Return type: bool Description: Check if a gamepad is available Param[1]: gamepad (type: int) -Function 139: GetGamepadName() (1 input parameters) +Function 141: GetGamepadName() (1 input parameters) Name: GetGamepadName Return type: const char * Description: Get gamepad internal name id Param[1]: gamepad (type: int) -Function 140: IsGamepadButtonPressed() (2 input parameters) +Function 142: IsGamepadButtonPressed() (2 input parameters) Name: IsGamepadButtonPressed Return type: bool Description: Check if a gamepad button has been pressed once Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 141: IsGamepadButtonDown() (2 input parameters) +Function 143: IsGamepadButtonDown() (2 input parameters) Name: IsGamepadButtonDown Return type: bool Description: Check if a gamepad button is being pressed Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 142: IsGamepadButtonReleased() (2 input parameters) +Function 144: IsGamepadButtonReleased() (2 input parameters) Name: IsGamepadButtonReleased Return type: bool Description: Check if a gamepad button has been released once Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 143: IsGamepadButtonUp() (2 input parameters) +Function 145: IsGamepadButtonUp() (2 input parameters) Name: IsGamepadButtonUp Return type: bool Description: Check if a gamepad button is NOT being pressed Param[1]: gamepad (type: int) Param[2]: button (type: int) -Function 144: GetGamepadButtonPressed() (0 input parameters) +Function 146: GetGamepadButtonPressed() (0 input parameters) Name: GetGamepadButtonPressed Return type: int Description: Get the last gamepad button pressed No input parameters -Function 145: GetGamepadAxisCount() (1 input parameters) +Function 147: GetGamepadAxisCount() (1 input parameters) Name: GetGamepadAxisCount Return type: int Description: Get gamepad axis count for a gamepad Param[1]: gamepad (type: int) -Function 146: GetGamepadAxisMovement() (2 input parameters) +Function 148: GetGamepadAxisMovement() (2 input parameters) Name: GetGamepadAxisMovement Return type: float Description: Get axis movement value for a gamepad axis Param[1]: gamepad (type: int) Param[2]: axis (type: int) -Function 147: SetGamepadMappings() (1 input parameters) +Function 149: SetGamepadMappings() (1 input parameters) Name: SetGamepadMappings Return type: int Description: Set internal gamepad mappings (SDL_GameControllerDB) Param[1]: mappings (type: const char *) -Function 148: IsMouseButtonPressed() (1 input parameters) +Function 150: IsMouseButtonPressed() (1 input parameters) Name: IsMouseButtonPressed Return type: bool Description: Check if a mouse button has been pressed once Param[1]: button (type: int) -Function 149: IsMouseButtonDown() (1 input parameters) +Function 151: IsMouseButtonDown() (1 input parameters) Name: IsMouseButtonDown Return type: bool Description: Check if a mouse button is being pressed Param[1]: button (type: int) -Function 150: IsMouseButtonReleased() (1 input parameters) +Function 152: IsMouseButtonReleased() (1 input parameters) Name: IsMouseButtonReleased Return type: bool Description: Check if a mouse button has been released once Param[1]: button (type: int) -Function 151: IsMouseButtonUp() (1 input parameters) +Function 153: IsMouseButtonUp() (1 input parameters) Name: IsMouseButtonUp Return type: bool Description: Check if a mouse button is NOT being pressed Param[1]: button (type: int) -Function 152: GetMouseX() (0 input parameters) +Function 154: GetMouseX() (0 input parameters) Name: GetMouseX Return type: int Description: Get mouse position X No input parameters -Function 153: GetMouseY() (0 input parameters) +Function 155: GetMouseY() (0 input parameters) Name: GetMouseY Return type: int Description: Get mouse position Y No input parameters -Function 154: GetMousePosition() (0 input parameters) +Function 156: GetMousePosition() (0 input parameters) Name: GetMousePosition Return type: Vector2 Description: Get mouse position XY No input parameters -Function 155: GetMouseDelta() (0 input parameters) +Function 157: GetMouseDelta() (0 input parameters) Name: GetMouseDelta Return type: Vector2 Description: Get mouse delta between frames No input parameters -Function 156: SetMousePosition() (2 input parameters) +Function 158: SetMousePosition() (2 input parameters) Name: SetMousePosition Return type: void Description: Set mouse position XY Param[1]: x (type: int) Param[2]: y (type: int) -Function 157: SetMouseOffset() (2 input parameters) +Function 159: SetMouseOffset() (2 input parameters) Name: SetMouseOffset Return type: void Description: Set mouse offset Param[1]: offsetX (type: int) Param[2]: offsetY (type: int) -Function 158: SetMouseScale() (2 input parameters) +Function 160: SetMouseScale() (2 input parameters) Name: SetMouseScale Return type: void Description: Set mouse scaling Param[1]: scaleX (type: float) Param[2]: scaleY (type: float) -Function 159: GetMouseWheelMove() (0 input parameters) +Function 161: GetMouseWheelMove() (0 input parameters) Name: GetMouseWheelMove Return type: float Description: Get mouse wheel movement Y No input parameters -Function 160: SetMouseCursor() (1 input parameters) +Function 162: SetMouseCursor() (1 input parameters) Name: SetMouseCursor Return type: void Description: Set mouse cursor Param[1]: cursor (type: int) -Function 161: GetTouchX() (0 input parameters) +Function 163: GetTouchX() (0 input parameters) Name: GetTouchX Return type: int Description: Get touch position X for touch point 0 (relative to screen size) No input parameters -Function 162: GetTouchY() (0 input parameters) +Function 164: GetTouchY() (0 input parameters) Name: GetTouchY Return type: int Description: Get touch position Y for touch point 0 (relative to screen size) No input parameters -Function 163: GetTouchPosition() (1 input parameters) +Function 165: GetTouchPosition() (1 input parameters) Name: GetTouchPosition Return type: Vector2 Description: Get touch position XY for a touch point index (relative to screen size) Param[1]: index (type: int) -Function 164: GetTouchPointId() (1 input parameters) +Function 166: GetTouchPointId() (1 input parameters) Name: GetTouchPointId Return type: int Description: Get touch point identifier for given index Param[1]: index (type: int) -Function 165: GetTouchPointCount() (0 input parameters) +Function 167: GetTouchPointCount() (0 input parameters) Name: GetTouchPointCount Return type: int Description: Get number of touch points No input parameters -Function 166: SetGesturesEnabled() (1 input parameters) +Function 168: SetGesturesEnabled() (1 input parameters) Name: SetGesturesEnabled Return type: void Description: Enable a set of gestures using flags Param[1]: flags (type: unsigned int) -Function 167: IsGestureDetected() (1 input parameters) +Function 169: IsGestureDetected() (1 input parameters) Name: IsGestureDetected Return type: bool Description: Check if a gesture have been detected Param[1]: gesture (type: int) -Function 168: GetGestureDetected() (0 input parameters) +Function 170: GetGestureDetected() (0 input parameters) Name: GetGestureDetected Return type: int Description: Get latest detected gesture No input parameters -Function 169: GetGestureHoldDuration() (0 input parameters) +Function 171: GetGestureHoldDuration() (0 input parameters) Name: GetGestureHoldDuration Return type: float Description: Get gesture hold time in milliseconds No input parameters -Function 170: GetGestureDragVector() (0 input parameters) +Function 172: GetGestureDragVector() (0 input parameters) Name: GetGestureDragVector Return type: Vector2 Description: Get gesture drag vector No input parameters -Function 171: GetGestureDragAngle() (0 input parameters) +Function 173: GetGestureDragAngle() (0 input parameters) Name: GetGestureDragAngle Return type: float Description: Get gesture drag angle No input parameters -Function 172: GetGesturePinchVector() (0 input parameters) +Function 174: GetGesturePinchVector() (0 input parameters) Name: GetGesturePinchVector Return type: Vector2 Description: Get gesture pinch delta No input parameters -Function 173: GetGesturePinchAngle() (0 input parameters) +Function 175: GetGesturePinchAngle() (0 input parameters) Name: GetGesturePinchAngle Return type: float Description: Get gesture pinch angle No input parameters -Function 174: SetCameraMode() (2 input parameters) +Function 176: SetCameraMode() (2 input parameters) Name: SetCameraMode Return type: void Description: Set camera mode (multiple camera modes available) Param[1]: camera (type: Camera) Param[2]: mode (type: int) -Function 175: UpdateCamera() (1 input parameters) +Function 177: UpdateCamera() (1 input parameters) Name: UpdateCamera Return type: void Description: Update camera position for selected mode Param[1]: camera (type: Camera *) -Function 176: SetCameraPanControl() (1 input parameters) +Function 178: SetCameraPanControl() (1 input parameters) Name: SetCameraPanControl Return type: void Description: Set camera pan key to combine with mouse movement (free camera) Param[1]: keyPan (type: int) -Function 177: SetCameraAltControl() (1 input parameters) +Function 179: SetCameraAltControl() (1 input parameters) Name: SetCameraAltControl Return type: void Description: Set camera alt key to combine with mouse movement (free camera) Param[1]: keyAlt (type: int) -Function 178: SetCameraSmoothZoomControl() (1 input parameters) +Function 180: SetCameraSmoothZoomControl() (1 input parameters) Name: SetCameraSmoothZoomControl Return type: void Description: Set camera smooth zoom key to combine with mouse (free camera) Param[1]: keySmoothZoom (type: int) -Function 179: SetCameraMoveControls() (6 input parameters) +Function 181: SetCameraMoveControls() (6 input parameters) Name: SetCameraMoveControls Return type: void Description: Set camera move controls (1st person and 3rd person cameras) @@ -1554,26 +1564,26 @@ Function 179: SetCameraMoveControls() (6 input parameters) Param[4]: keyLeft (type: int) Param[5]: keyUp (type: int) Param[6]: keyDown (type: int) -Function 180: SetShapesTexture() (2 input parameters) +Function 182: SetShapesTexture() (2 input parameters) Name: SetShapesTexture Return type: void Description: Set texture and rectangle to be used on shapes drawing Param[1]: texture (type: Texture2D) Param[2]: source (type: Rectangle) -Function 181: DrawPixel() (3 input parameters) +Function 183: DrawPixel() (3 input parameters) Name: DrawPixel Return type: void Description: Draw a pixel Param[1]: posX (type: int) Param[2]: posY (type: int) Param[3]: color (type: Color) -Function 182: DrawPixelV() (2 input parameters) +Function 184: DrawPixelV() (2 input parameters) Name: DrawPixelV Return type: void Description: Draw a pixel (Vector version) Param[1]: position (type: Vector2) Param[2]: color (type: Color) -Function 183: DrawLine() (5 input parameters) +Function 185: DrawLine() (5 input parameters) Name: DrawLine Return type: void Description: Draw a line @@ -1582,14 +1592,14 @@ Function 183: DrawLine() (5 input parameters) Param[3]: endPosX (type: int) Param[4]: endPosY (type: int) Param[5]: color (type: Color) -Function 184: DrawLineV() (3 input parameters) +Function 186: DrawLineV() (3 input parameters) Name: DrawLineV Return type: void Description: Draw a line (Vector version) Param[1]: startPos (type: Vector2) Param[2]: endPos (type: Vector2) Param[3]: color (type: Color) -Function 185: DrawLineEx() (4 input parameters) +Function 187: DrawLineEx() (4 input parameters) Name: DrawLineEx Return type: void Description: Draw a line defining thickness @@ -1597,7 +1607,7 @@ Function 185: DrawLineEx() (4 input parameters) Param[2]: endPos (type: Vector2) Param[3]: thick (type: float) Param[4]: color (type: Color) -Function 186: DrawLineBezier() (4 input parameters) +Function 188: DrawLineBezier() (4 input parameters) Name: DrawLineBezier Return type: void Description: Draw a line using cubic-bezier curves in-out @@ -1605,7 +1615,7 @@ Function 186: DrawLineBezier() (4 input parameters) Param[2]: endPos (type: Vector2) Param[3]: thick (type: float) Param[4]: color (type: Color) -Function 187: DrawLineBezierQuad() (5 input parameters) +Function 189: DrawLineBezierQuad() (5 input parameters) Name: DrawLineBezierQuad Return type: void Description: Draw line using quadratic bezier curves with a control point @@ -1614,7 +1624,7 @@ Function 187: DrawLineBezierQuad() (5 input parameters) Param[3]: controlPos (type: Vector2) Param[4]: thick (type: float) Param[5]: color (type: Color) -Function 188: DrawLineBezierCubic() (6 input parameters) +Function 190: DrawLineBezierCubic() (6 input parameters) Name: DrawLineBezierCubic Return type: void Description: Draw line using cubic bezier curves with 2 control points @@ -1624,14 +1634,14 @@ Function 188: DrawLineBezierCubic() (6 input parameters) Param[4]: endControlPos (type: Vector2) Param[5]: thick (type: float) Param[6]: color (type: Color) -Function 189: DrawLineStrip() (3 input parameters) +Function 191: DrawLineStrip() (3 input parameters) Name: DrawLineStrip Return type: void Description: Draw lines sequence Param[1]: points (type: Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 190: DrawCircle() (4 input parameters) +Function 192: DrawCircle() (4 input parameters) Name: DrawCircle Return type: void Description: Draw a color-filled circle @@ -1639,7 +1649,7 @@ Function 190: DrawCircle() (4 input parameters) Param[2]: centerY (type: int) Param[3]: radius (type: float) Param[4]: color (type: Color) -Function 191: DrawCircleSector() (6 input parameters) +Function 193: DrawCircleSector() (6 input parameters) Name: DrawCircleSector Return type: void Description: Draw a piece of a circle @@ -1649,7 +1659,7 @@ Function 191: DrawCircleSector() (6 input parameters) Param[4]: endAngle (type: float) Param[5]: segments (type: int) Param[6]: color (type: Color) -Function 192: DrawCircleSectorLines() (6 input parameters) +Function 194: DrawCircleSectorLines() (6 input parameters) Name: DrawCircleSectorLines Return type: void Description: Draw circle sector outline @@ -1659,7 +1669,7 @@ Function 192: DrawCircleSectorLines() (6 input parameters) Param[4]: endAngle (type: float) Param[5]: segments (type: int) Param[6]: color (type: Color) -Function 193: DrawCircleGradient() (5 input parameters) +Function 195: DrawCircleGradient() (5 input parameters) Name: DrawCircleGradient Return type: void Description: Draw a gradient-filled circle @@ -1668,14 +1678,14 @@ Function 193: DrawCircleGradient() (5 input parameters) Param[3]: radius (type: float) Param[4]: color1 (type: Color) Param[5]: color2 (type: Color) -Function 194: DrawCircleV() (3 input parameters) +Function 196: DrawCircleV() (3 input parameters) Name: DrawCircleV Return type: void Description: Draw a color-filled circle (Vector version) Param[1]: center (type: Vector2) Param[2]: radius (type: float) Param[3]: color (type: Color) -Function 195: DrawCircleLines() (4 input parameters) +Function 197: DrawCircleLines() (4 input parameters) Name: DrawCircleLines Return type: void Description: Draw circle outline @@ -1683,7 +1693,7 @@ Function 195: DrawCircleLines() (4 input parameters) Param[2]: centerY (type: int) Param[3]: radius (type: float) Param[4]: color (type: Color) -Function 196: DrawEllipse() (5 input parameters) +Function 198: DrawEllipse() (5 input parameters) Name: DrawEllipse Return type: void Description: Draw ellipse @@ -1692,7 +1702,7 @@ Function 196: DrawEllipse() (5 input parameters) Param[3]: radiusH (type: float) Param[4]: radiusV (type: float) Param[5]: color (type: Color) -Function 197: DrawEllipseLines() (5 input parameters) +Function 199: DrawEllipseLines() (5 input parameters) Name: DrawEllipseLines Return type: void Description: Draw ellipse outline @@ -1701,7 +1711,7 @@ Function 197: DrawEllipseLines() (5 input parameters) Param[3]: radiusH (type: float) Param[4]: radiusV (type: float) Param[5]: color (type: Color) -Function 198: DrawRing() (7 input parameters) +Function 200: DrawRing() (7 input parameters) Name: DrawRing Return type: void Description: Draw ring @@ -1712,7 +1722,7 @@ Function 198: DrawRing() (7 input parameters) Param[5]: endAngle (type: float) Param[6]: segments (type: int) Param[7]: color (type: Color) -Function 199: DrawRingLines() (7 input parameters) +Function 201: DrawRingLines() (7 input parameters) Name: DrawRingLines Return type: void Description: Draw ring outline @@ -1723,7 +1733,7 @@ Function 199: DrawRingLines() (7 input parameters) Param[5]: endAngle (type: float) Param[6]: segments (type: int) Param[7]: color (type: Color) -Function 200: DrawRectangle() (5 input parameters) +Function 202: DrawRectangle() (5 input parameters) Name: DrawRectangle Return type: void Description: Draw a color-filled rectangle @@ -1732,20 +1742,20 @@ Function 200: DrawRectangle() (5 input parameters) Param[3]: width (type: int) Param[4]: height (type: int) Param[5]: color (type: Color) -Function 201: DrawRectangleV() (3 input parameters) +Function 203: DrawRectangleV() (3 input parameters) Name: DrawRectangleV Return type: void Description: Draw a color-filled rectangle (Vector version) Param[1]: position (type: Vector2) Param[2]: size (type: Vector2) Param[3]: color (type: Color) -Function 202: DrawRectangleRec() (2 input parameters) +Function 204: DrawRectangleRec() (2 input parameters) Name: DrawRectangleRec Return type: void Description: Draw a color-filled rectangle Param[1]: rec (type: Rectangle) Param[2]: color (type: Color) -Function 203: DrawRectanglePro() (4 input parameters) +Function 205: DrawRectanglePro() (4 input parameters) Name: DrawRectanglePro Return type: void Description: Draw a color-filled rectangle with pro parameters @@ -1753,7 +1763,7 @@ Function 203: DrawRectanglePro() (4 input parameters) Param[2]: origin (type: Vector2) Param[3]: rotation (type: float) Param[4]: color (type: Color) -Function 204: DrawRectangleGradientV() (6 input parameters) +Function 206: DrawRectangleGradientV() (6 input parameters) Name: DrawRectangleGradientV Return type: void Description: Draw a vertical-gradient-filled rectangle @@ -1763,7 +1773,7 @@ Function 204: DrawRectangleGradientV() (6 input parameters) Param[4]: height (type: int) Param[5]: color1 (type: Color) Param[6]: color2 (type: Color) -Function 205: DrawRectangleGradientH() (6 input parameters) +Function 207: DrawRectangleGradientH() (6 input parameters) Name: DrawRectangleGradientH Return type: void Description: Draw a horizontal-gradient-filled rectangle @@ -1773,7 +1783,7 @@ Function 205: DrawRectangleGradientH() (6 input parameters) Param[4]: height (type: int) Param[5]: color1 (type: Color) Param[6]: color2 (type: Color) -Function 206: DrawRectangleGradientEx() (5 input parameters) +Function 208: DrawRectangleGradientEx() (5 input parameters) Name: DrawRectangleGradientEx Return type: void Description: Draw a gradient-filled rectangle with custom vertex colors @@ -1782,7 +1792,7 @@ Function 206: DrawRectangleGradientEx() (5 input parameters) Param[3]: col2 (type: Color) Param[4]: col3 (type: Color) Param[5]: col4 (type: Color) -Function 207: DrawRectangleLines() (5 input parameters) +Function 209: DrawRectangleLines() (5 input parameters) Name: DrawRectangleLines Return type: void Description: Draw rectangle outline @@ -1791,14 +1801,14 @@ Function 207: DrawRectangleLines() (5 input parameters) Param[3]: width (type: int) Param[4]: height (type: int) Param[5]: color (type: Color) -Function 208: DrawRectangleLinesEx() (3 input parameters) +Function 210: DrawRectangleLinesEx() (3 input parameters) Name: DrawRectangleLinesEx Return type: void Description: Draw rectangle outline with extended parameters Param[1]: rec (type: Rectangle) Param[2]: lineThick (type: float) Param[3]: color (type: Color) -Function 209: DrawRectangleRounded() (4 input parameters) +Function 211: DrawRectangleRounded() (4 input parameters) Name: DrawRectangleRounded Return type: void Description: Draw rectangle with rounded edges @@ -1806,7 +1816,7 @@ Function 209: DrawRectangleRounded() (4 input parameters) Param[2]: roundness (type: float) Param[3]: segments (type: int) Param[4]: color (type: Color) -Function 210: DrawRectangleRoundedLines() (5 input parameters) +Function 212: DrawRectangleRoundedLines() (5 input parameters) Name: DrawRectangleRoundedLines Return type: void Description: Draw rectangle with rounded edges outline @@ -1815,7 +1825,7 @@ Function 210: DrawRectangleRoundedLines() (5 input parameters) Param[3]: segments (type: int) Param[4]: lineThick (type: float) Param[5]: color (type: Color) -Function 211: DrawTriangle() (4 input parameters) +Function 213: DrawTriangle() (4 input parameters) Name: DrawTriangle Return type: void Description: Draw a color-filled triangle (vertex in counter-clockwise order!) @@ -1823,7 +1833,7 @@ Function 211: DrawTriangle() (4 input parameters) Param[2]: v2 (type: Vector2) Param[3]: v3 (type: Vector2) Param[4]: color (type: Color) -Function 212: DrawTriangleLines() (4 input parameters) +Function 214: DrawTriangleLines() (4 input parameters) Name: DrawTriangleLines Return type: void Description: Draw triangle outline (vertex in counter-clockwise order!) @@ -1831,21 +1841,21 @@ Function 212: DrawTriangleLines() (4 input parameters) Param[2]: v2 (type: Vector2) Param[3]: v3 (type: Vector2) Param[4]: color (type: Color) -Function 213: DrawTriangleFan() (3 input parameters) +Function 215: DrawTriangleFan() (3 input parameters) Name: DrawTriangleFan Return type: void Description: Draw a triangle fan defined by points (first vertex is the center) Param[1]: points (type: Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 214: DrawTriangleStrip() (3 input parameters) +Function 216: DrawTriangleStrip() (3 input parameters) Name: DrawTriangleStrip Return type: void Description: Draw a triangle strip defined by points Param[1]: points (type: Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 215: DrawPoly() (5 input parameters) +Function 217: DrawPoly() (5 input parameters) Name: DrawPoly Return type: void Description: Draw a regular polygon (Vector version) @@ -1854,7 +1864,7 @@ Function 215: DrawPoly() (5 input parameters) Param[3]: radius (type: float) Param[4]: rotation (type: float) Param[5]: color (type: Color) -Function 216: DrawPolyLines() (5 input parameters) +Function 218: DrawPolyLines() (5 input parameters) Name: DrawPolyLines Return type: void Description: Draw a polygon outline of n sides @@ -1863,7 +1873,7 @@ Function 216: DrawPolyLines() (5 input parameters) Param[3]: radius (type: float) Param[4]: rotation (type: float) Param[5]: color (type: Color) -Function 217: DrawPolyLinesEx() (6 input parameters) +Function 219: DrawPolyLinesEx() (6 input parameters) Name: DrawPolyLinesEx Return type: void Description: Draw a polygon outline of n sides with extended parameters @@ -1873,13 +1883,13 @@ Function 217: DrawPolyLinesEx() (6 input parameters) Param[4]: rotation (type: float) Param[5]: lineThick (type: float) Param[6]: color (type: Color) -Function 218: CheckCollisionRecs() (2 input parameters) +Function 220: CheckCollisionRecs() (2 input parameters) Name: CheckCollisionRecs Return type: bool Description: Check collision between two rectangles Param[1]: rec1 (type: Rectangle) Param[2]: rec2 (type: Rectangle) -Function 219: CheckCollisionCircles() (4 input parameters) +Function 221: CheckCollisionCircles() (4 input parameters) Name: CheckCollisionCircles Return type: bool Description: Check collision between two circles @@ -1887,27 +1897,27 @@ Function 219: CheckCollisionCircles() (4 input parameters) Param[2]: radius1 (type: float) Param[3]: center2 (type: Vector2) Param[4]: radius2 (type: float) -Function 220: CheckCollisionCircleRec() (3 input parameters) +Function 222: CheckCollisionCircleRec() (3 input parameters) Name: CheckCollisionCircleRec Return type: bool Description: Check collision between circle and rectangle Param[1]: center (type: Vector2) Param[2]: radius (type: float) Param[3]: rec (type: Rectangle) -Function 221: CheckCollisionPointRec() (2 input parameters) +Function 223: CheckCollisionPointRec() (2 input parameters) Name: CheckCollisionPointRec Return type: bool Description: Check if point is inside rectangle Param[1]: point (type: Vector2) Param[2]: rec (type: Rectangle) -Function 222: CheckCollisionPointCircle() (3 input parameters) +Function 224: CheckCollisionPointCircle() (3 input parameters) Name: CheckCollisionPointCircle Return type: bool Description: Check if point is inside circle Param[1]: point (type: Vector2) Param[2]: center (type: Vector2) Param[3]: radius (type: float) -Function 223: CheckCollisionPointTriangle() (4 input parameters) +Function 225: CheckCollisionPointTriangle() (4 input parameters) Name: CheckCollisionPointTriangle Return type: bool Description: Check if point is inside a triangle @@ -1915,7 +1925,7 @@ Function 223: CheckCollisionPointTriangle() (4 input parameters) Param[2]: p1 (type: Vector2) Param[3]: p2 (type: Vector2) Param[4]: p3 (type: Vector2) -Function 224: CheckCollisionLines() (5 input parameters) +Function 226: CheckCollisionLines() (5 input parameters) Name: CheckCollisionLines Return type: bool Description: Check the collision between two lines defined by two points each, returns collision point by reference @@ -1924,7 +1934,7 @@ Function 224: CheckCollisionLines() (5 input parameters) Param[3]: startPos2 (type: Vector2) Param[4]: endPos2 (type: Vector2) Param[5]: collisionPoint (type: Vector2 *) -Function 225: CheckCollisionPointLine() (4 input parameters) +Function 227: CheckCollisionPointLine() (4 input parameters) Name: CheckCollisionPointLine Return type: bool Description: Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] @@ -1932,18 +1942,18 @@ Function 225: CheckCollisionPointLine() (4 input parameters) Param[2]: p1 (type: Vector2) Param[3]: p2 (type: Vector2) Param[4]: threshold (type: int) -Function 226: GetCollisionRec() (2 input parameters) +Function 228: GetCollisionRec() (2 input parameters) Name: GetCollisionRec Return type: Rectangle Description: Get collision rectangle for two rectangles collision Param[1]: rec1 (type: Rectangle) Param[2]: rec2 (type: Rectangle) -Function 227: LoadImage() (1 input parameters) +Function 229: LoadImage() (1 input parameters) Name: LoadImage Return type: Image Description: Load image from file into CPU memory (RAM) Param[1]: fileName (type: const char *) -Function 228: LoadImageRaw() (5 input parameters) +Function 230: LoadImageRaw() (5 input parameters) Name: LoadImageRaw Return type: Image Description: Load image from RAW file data @@ -1952,54 +1962,54 @@ Function 228: LoadImageRaw() (5 input parameters) Param[3]: height (type: int) Param[4]: format (type: int) Param[5]: headerSize (type: int) -Function 229: LoadImageAnim() (2 input parameters) +Function 231: LoadImageAnim() (2 input parameters) Name: LoadImageAnim Return type: Image Description: Load image sequence from file (frames appended to image.data) Param[1]: fileName (type: const char *) Param[2]: frames (type: int *) -Function 230: LoadImageFromMemory() (3 input parameters) +Function 232: LoadImageFromMemory() (3 input parameters) Name: LoadImageFromMemory Return type: Image Description: Load image from memory buffer, fileType refers to extension: i.e. '.png' Param[1]: fileType (type: const char *) Param[2]: fileData (type: const unsigned char *) Param[3]: dataSize (type: int) -Function 231: LoadImageFromTexture() (1 input parameters) +Function 233: LoadImageFromTexture() (1 input parameters) Name: LoadImageFromTexture Return type: Image Description: Load image from GPU texture data Param[1]: texture (type: Texture2D) -Function 232: LoadImageFromScreen() (0 input parameters) +Function 234: LoadImageFromScreen() (0 input parameters) Name: LoadImageFromScreen Return type: Image Description: Load image from screen buffer and (screenshot) No input parameters -Function 233: UnloadImage() (1 input parameters) +Function 235: UnloadImage() (1 input parameters) Name: UnloadImage Return type: void Description: Unload image from CPU memory (RAM) Param[1]: image (type: Image) -Function 234: ExportImage() (2 input parameters) +Function 236: ExportImage() (2 input parameters) Name: ExportImage Return type: bool Description: Export image data to file, returns true on success Param[1]: image (type: Image) Param[2]: fileName (type: const char *) -Function 235: ExportImageAsCode() (2 input parameters) +Function 237: ExportImageAsCode() (2 input parameters) Name: ExportImageAsCode Return type: bool Description: Export image as code file defining an array of bytes, returns true on success Param[1]: image (type: Image) Param[2]: fileName (type: const char *) -Function 236: GenImageColor() (3 input parameters) +Function 238: GenImageColor() (3 input parameters) Name: GenImageColor Return type: Image Description: Generate image: plain color Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: color (type: Color) -Function 237: GenImageGradientV() (4 input parameters) +Function 239: GenImageGradientV() (4 input parameters) Name: GenImageGradientV Return type: Image Description: Generate image: vertical gradient @@ -2007,7 +2017,7 @@ Function 237: GenImageGradientV() (4 input parameters) Param[2]: height (type: int) Param[3]: top (type: Color) Param[4]: bottom (type: Color) -Function 238: GenImageGradientH() (4 input parameters) +Function 240: GenImageGradientH() (4 input parameters) Name: GenImageGradientH Return type: Image Description: Generate image: horizontal gradient @@ -2015,7 +2025,7 @@ Function 238: GenImageGradientH() (4 input parameters) Param[2]: height (type: int) Param[3]: left (type: Color) Param[4]: right (type: Color) -Function 239: GenImageGradientRadial() (5 input parameters) +Function 241: GenImageGradientRadial() (5 input parameters) Name: GenImageGradientRadial Return type: Image Description: Generate image: radial gradient @@ -2024,7 +2034,7 @@ Function 239: GenImageGradientRadial() (5 input parameters) Param[3]: density (type: float) Param[4]: inner (type: Color) Param[5]: outer (type: Color) -Function 240: GenImageChecked() (6 input parameters) +Function 242: GenImageChecked() (6 input parameters) Name: GenImageChecked Return type: Image Description: Generate image: checked @@ -2034,39 +2044,39 @@ Function 240: GenImageChecked() (6 input parameters) Param[4]: checksY (type: int) Param[5]: col1 (type: Color) Param[6]: col2 (type: Color) -Function 241: GenImageWhiteNoise() (3 input parameters) +Function 243: GenImageWhiteNoise() (3 input parameters) Name: GenImageWhiteNoise Return type: Image Description: Generate image: white noise Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: factor (type: float) -Function 242: GenImageCellular() (3 input parameters) +Function 244: GenImageCellular() (3 input parameters) Name: GenImageCellular Return type: Image Description: Generate image: cellular algorithm, bigger tileSize means bigger cells Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: tileSize (type: int) -Function 243: ImageCopy() (1 input parameters) +Function 245: ImageCopy() (1 input parameters) Name: ImageCopy Return type: Image Description: Create an image duplicate (useful for transformations) Param[1]: image (type: Image) -Function 244: ImageFromImage() (2 input parameters) +Function 246: ImageFromImage() (2 input parameters) Name: ImageFromImage Return type: Image Description: Create an image from another image piece Param[1]: image (type: Image) Param[2]: rec (type: Rectangle) -Function 245: ImageText() (3 input parameters) +Function 247: ImageText() (3 input parameters) Name: ImageText Return type: Image Description: Create an image from text (default font) Param[1]: text (type: const char *) Param[2]: fontSize (type: int) Param[3]: color (type: Color) -Function 246: ImageTextEx() (5 input parameters) +Function 248: ImageTextEx() (5 input parameters) Name: ImageTextEx Return type: Image Description: Create an image from text (custom sprite font) @@ -2075,63 +2085,63 @@ Function 246: ImageTextEx() (5 input parameters) Param[3]: fontSize (type: float) Param[4]: spacing (type: float) Param[5]: tint (type: Color) -Function 247: ImageFormat() (2 input parameters) +Function 249: ImageFormat() (2 input parameters) Name: ImageFormat Return type: void Description: Convert image data to desired format Param[1]: image (type: Image *) Param[2]: newFormat (type: int) -Function 248: ImageToPOT() (2 input parameters) +Function 250: ImageToPOT() (2 input parameters) Name: ImageToPOT Return type: void Description: Convert image to POT (power-of-two) Param[1]: image (type: Image *) Param[2]: fill (type: Color) -Function 249: ImageCrop() (2 input parameters) +Function 251: ImageCrop() (2 input parameters) Name: ImageCrop Return type: void Description: Crop an image to a defined rectangle Param[1]: image (type: Image *) Param[2]: crop (type: Rectangle) -Function 250: ImageAlphaCrop() (2 input parameters) +Function 252: ImageAlphaCrop() (2 input parameters) Name: ImageAlphaCrop Return type: void Description: Crop image depending on alpha value Param[1]: image (type: Image *) Param[2]: threshold (type: float) -Function 251: ImageAlphaClear() (3 input parameters) +Function 253: ImageAlphaClear() (3 input parameters) Name: ImageAlphaClear Return type: void Description: Clear alpha channel to desired color Param[1]: image (type: Image *) Param[2]: color (type: Color) Param[3]: threshold (type: float) -Function 252: ImageAlphaMask() (2 input parameters) +Function 254: ImageAlphaMask() (2 input parameters) Name: ImageAlphaMask Return type: void Description: Apply alpha mask to image Param[1]: image (type: Image *) Param[2]: alphaMask (type: Image) -Function 253: ImageAlphaPremultiply() (1 input parameters) +Function 255: ImageAlphaPremultiply() (1 input parameters) Name: ImageAlphaPremultiply Return type: void Description: Premultiply alpha channel Param[1]: image (type: Image *) -Function 254: ImageResize() (3 input parameters) +Function 256: ImageResize() (3 input parameters) Name: ImageResize Return type: void Description: Resize image (Bicubic scaling algorithm) Param[1]: image (type: Image *) Param[2]: newWidth (type: int) Param[3]: newHeight (type: int) -Function 255: ImageResizeNN() (3 input parameters) +Function 257: ImageResizeNN() (3 input parameters) Name: ImageResizeNN Return type: void Description: Resize image (Nearest-Neighbor scaling algorithm) Param[1]: image (type: Image *) Param[2]: newWidth (type: int) Param[3]: newHeight (type: int) -Function 256: ImageResizeCanvas() (6 input parameters) +Function 258: ImageResizeCanvas() (6 input parameters) Name: ImageResizeCanvas Return type: void Description: Resize canvas and fill with color @@ -2141,12 +2151,12 @@ Function 256: ImageResizeCanvas() (6 input parameters) Param[4]: offsetX (type: int) Param[5]: offsetY (type: int) Param[6]: fill (type: Color) -Function 257: ImageMipmaps() (1 input parameters) +Function 259: ImageMipmaps() (1 input parameters) Name: ImageMipmaps Return type: void Description: Compute all mipmap levels for a provided image Param[1]: image (type: Image *) -Function 258: ImageDither() (5 input parameters) +Function 260: ImageDither() (5 input parameters) Name: ImageDither Return type: void Description: Dither image data to 16bpp or lower (Floyd-Steinberg dithering) @@ -2155,103 +2165,103 @@ Function 258: ImageDither() (5 input parameters) Param[3]: gBpp (type: int) Param[4]: bBpp (type: int) Param[5]: aBpp (type: int) -Function 259: ImageFlipVertical() (1 input parameters) +Function 261: ImageFlipVertical() (1 input parameters) Name: ImageFlipVertical Return type: void Description: Flip image vertically Param[1]: image (type: Image *) -Function 260: ImageFlipHorizontal() (1 input parameters) +Function 262: ImageFlipHorizontal() (1 input parameters) Name: ImageFlipHorizontal Return type: void Description: Flip image horizontally Param[1]: image (type: Image *) -Function 261: ImageRotateCW() (1 input parameters) +Function 263: ImageRotateCW() (1 input parameters) Name: ImageRotateCW Return type: void Description: Rotate image clockwise 90deg Param[1]: image (type: Image *) -Function 262: ImageRotateCCW() (1 input parameters) +Function 264: ImageRotateCCW() (1 input parameters) Name: ImageRotateCCW Return type: void Description: Rotate image counter-clockwise 90deg Param[1]: image (type: Image *) -Function 263: ImageColorTint() (2 input parameters) +Function 265: ImageColorTint() (2 input parameters) Name: ImageColorTint Return type: void Description: Modify image color: tint Param[1]: image (type: Image *) Param[2]: color (type: Color) -Function 264: ImageColorInvert() (1 input parameters) +Function 266: ImageColorInvert() (1 input parameters) Name: ImageColorInvert Return type: void Description: Modify image color: invert Param[1]: image (type: Image *) -Function 265: ImageColorGrayscale() (1 input parameters) +Function 267: ImageColorGrayscale() (1 input parameters) Name: ImageColorGrayscale Return type: void Description: Modify image color: grayscale Param[1]: image (type: Image *) -Function 266: ImageColorContrast() (2 input parameters) +Function 268: ImageColorContrast() (2 input parameters) Name: ImageColorContrast Return type: void Description: Modify image color: contrast (-100 to 100) Param[1]: image (type: Image *) Param[2]: contrast (type: float) -Function 267: ImageColorBrightness() (2 input parameters) +Function 269: ImageColorBrightness() (2 input parameters) Name: ImageColorBrightness Return type: void Description: Modify image color: brightness (-255 to 255) Param[1]: image (type: Image *) Param[2]: brightness (type: int) -Function 268: ImageColorReplace() (3 input parameters) +Function 270: ImageColorReplace() (3 input parameters) Name: ImageColorReplace Return type: void Description: Modify image color: replace color Param[1]: image (type: Image *) Param[2]: color (type: Color) Param[3]: replace (type: Color) -Function 269: LoadImageColors() (1 input parameters) +Function 271: LoadImageColors() (1 input parameters) Name: LoadImageColors Return type: Color * Description: Load color data from image as a Color array (RGBA - 32bit) Param[1]: image (type: Image) -Function 270: LoadImagePalette() (3 input parameters) +Function 272: LoadImagePalette() (3 input parameters) Name: LoadImagePalette Return type: Color * Description: Load colors palette from image as a Color array (RGBA - 32bit) Param[1]: image (type: Image) Param[2]: maxPaletteSize (type: int) Param[3]: colorCount (type: int *) -Function 271: UnloadImageColors() (1 input parameters) +Function 273: UnloadImageColors() (1 input parameters) Name: UnloadImageColors Return type: void Description: Unload color data loaded with LoadImageColors() Param[1]: colors (type: Color *) -Function 272: UnloadImagePalette() (1 input parameters) +Function 274: UnloadImagePalette() (1 input parameters) Name: UnloadImagePalette Return type: void Description: Unload colors palette loaded with LoadImagePalette() Param[1]: colors (type: Color *) -Function 273: GetImageAlphaBorder() (2 input parameters) +Function 275: GetImageAlphaBorder() (2 input parameters) Name: GetImageAlphaBorder Return type: Rectangle Description: Get image alpha border rectangle Param[1]: image (type: Image) Param[2]: threshold (type: float) -Function 274: GetImageColor() (3 input parameters) +Function 276: GetImageColor() (3 input parameters) Name: GetImageColor Return type: Color Description: Get image pixel color at (x, y) position Param[1]: image (type: Image) Param[2]: x (type: int) Param[3]: y (type: int) -Function 275: ImageClearBackground() (2 input parameters) +Function 277: ImageClearBackground() (2 input parameters) Name: ImageClearBackground Return type: void Description: Clear image background with given color Param[1]: dst (type: Image *) Param[2]: color (type: Color) -Function 276: ImageDrawPixel() (4 input parameters) +Function 278: ImageDrawPixel() (4 input parameters) Name: ImageDrawPixel Return type: void Description: Draw pixel within an image @@ -2259,14 +2269,14 @@ Function 276: ImageDrawPixel() (4 input parameters) Param[2]: posX (type: int) Param[3]: posY (type: int) Param[4]: color (type: Color) -Function 277: ImageDrawPixelV() (3 input parameters) +Function 279: ImageDrawPixelV() (3 input parameters) Name: ImageDrawPixelV Return type: void Description: Draw pixel within an image (Vector version) Param[1]: dst (type: Image *) Param[2]: position (type: Vector2) Param[3]: color (type: Color) -Function 278: ImageDrawLine() (6 input parameters) +Function 280: ImageDrawLine() (6 input parameters) Name: ImageDrawLine Return type: void Description: Draw line within an image @@ -2276,7 +2286,7 @@ Function 278: ImageDrawLine() (6 input parameters) Param[4]: endPosX (type: int) Param[5]: endPosY (type: int) Param[6]: color (type: Color) -Function 279: ImageDrawLineV() (4 input parameters) +Function 281: ImageDrawLineV() (4 input parameters) Name: ImageDrawLineV Return type: void Description: Draw line within an image (Vector version) @@ -2284,7 +2294,7 @@ Function 279: ImageDrawLineV() (4 input parameters) Param[2]: start (type: Vector2) Param[3]: end (type: Vector2) Param[4]: color (type: Color) -Function 280: ImageDrawCircle() (5 input parameters) +Function 282: ImageDrawCircle() (5 input parameters) Name: ImageDrawCircle Return type: void Description: Draw circle within an image @@ -2293,7 +2303,7 @@ Function 280: ImageDrawCircle() (5 input parameters) Param[3]: centerY (type: int) Param[4]: radius (type: int) Param[5]: color (type: Color) -Function 281: ImageDrawCircleV() (4 input parameters) +Function 283: ImageDrawCircleV() (4 input parameters) Name: ImageDrawCircleV Return type: void Description: Draw circle within an image (Vector version) @@ -2301,7 +2311,7 @@ Function 281: ImageDrawCircleV() (4 input parameters) Param[2]: center (type: Vector2) Param[3]: radius (type: int) Param[4]: color (type: Color) -Function 282: ImageDrawRectangle() (6 input parameters) +Function 284: ImageDrawRectangle() (6 input parameters) Name: ImageDrawRectangle Return type: void Description: Draw rectangle within an image @@ -2311,7 +2321,7 @@ Function 282: ImageDrawRectangle() (6 input parameters) Param[4]: width (type: int) Param[5]: height (type: int) Param[6]: color (type: Color) -Function 283: ImageDrawRectangleV() (4 input parameters) +Function 285: ImageDrawRectangleV() (4 input parameters) Name: ImageDrawRectangleV Return type: void Description: Draw rectangle within an image (Vector version) @@ -2319,14 +2329,14 @@ Function 283: ImageDrawRectangleV() (4 input parameters) Param[2]: position (type: Vector2) Param[3]: size (type: Vector2) Param[4]: color (type: Color) -Function 284: ImageDrawRectangleRec() (3 input parameters) +Function 286: ImageDrawRectangleRec() (3 input parameters) Name: ImageDrawRectangleRec Return type: void Description: Draw rectangle within an image Param[1]: dst (type: Image *) Param[2]: rec (type: Rectangle) Param[3]: color (type: Color) -Function 285: ImageDrawRectangleLines() (4 input parameters) +Function 287: ImageDrawRectangleLines() (4 input parameters) Name: ImageDrawRectangleLines Return type: void Description: Draw rectangle lines within an image @@ -2334,7 +2344,7 @@ Function 285: ImageDrawRectangleLines() (4 input parameters) Param[2]: rec (type: Rectangle) Param[3]: thick (type: int) Param[4]: color (type: Color) -Function 286: ImageDraw() (5 input parameters) +Function 288: ImageDraw() (5 input parameters) Name: ImageDraw Return type: void Description: Draw a source image within a destination image (tint applied to source) @@ -2343,7 +2353,7 @@ Function 286: ImageDraw() (5 input parameters) Param[3]: srcRec (type: Rectangle) Param[4]: dstRec (type: Rectangle) Param[5]: tint (type: Color) -Function 287: ImageDrawText() (6 input parameters) +Function 289: ImageDrawText() (6 input parameters) Name: ImageDrawText Return type: void Description: Draw text (using default font) within an image (destination) @@ -2353,7 +2363,7 @@ Function 287: ImageDrawText() (6 input parameters) Param[4]: posY (type: int) Param[5]: fontSize (type: int) Param[6]: color (type: Color) -Function 288: ImageDrawTextEx() (7 input parameters) +Function 290: ImageDrawTextEx() (7 input parameters) Name: ImageDrawTextEx Return type: void Description: Draw text (custom sprite font) within an image (destination) @@ -2364,69 +2374,69 @@ Function 288: ImageDrawTextEx() (7 input parameters) Param[5]: fontSize (type: float) Param[6]: spacing (type: float) Param[7]: tint (type: Color) -Function 289: LoadTexture() (1 input parameters) +Function 291: LoadTexture() (1 input parameters) Name: LoadTexture Return type: Texture2D Description: Load texture from file into GPU memory (VRAM) Param[1]: fileName (type: const char *) -Function 290: LoadTextureFromImage() (1 input parameters) +Function 292: LoadTextureFromImage() (1 input parameters) Name: LoadTextureFromImage Return type: Texture2D Description: Load texture from image data Param[1]: image (type: Image) -Function 291: LoadTextureCubemap() (2 input parameters) +Function 293: LoadTextureCubemap() (2 input parameters) Name: LoadTextureCubemap Return type: TextureCubemap Description: Load cubemap from image, multiple image cubemap layouts supported Param[1]: image (type: Image) Param[2]: layout (type: int) -Function 292: LoadRenderTexture() (2 input parameters) +Function 294: LoadRenderTexture() (2 input parameters) Name: LoadRenderTexture Return type: RenderTexture2D Description: Load texture for rendering (framebuffer) Param[1]: width (type: int) Param[2]: height (type: int) -Function 293: UnloadTexture() (1 input parameters) +Function 295: UnloadTexture() (1 input parameters) Name: UnloadTexture Return type: void Description: Unload texture from GPU memory (VRAM) Param[1]: texture (type: Texture2D) -Function 294: UnloadRenderTexture() (1 input parameters) +Function 296: UnloadRenderTexture() (1 input parameters) Name: UnloadRenderTexture Return type: void Description: Unload render texture from GPU memory (VRAM) Param[1]: target (type: RenderTexture2D) -Function 295: UpdateTexture() (2 input parameters) +Function 297: UpdateTexture() (2 input parameters) Name: UpdateTexture Return type: void Description: Update GPU texture with new data Param[1]: texture (type: Texture2D) Param[2]: pixels (type: const void *) -Function 296: UpdateTextureRec() (3 input parameters) +Function 298: UpdateTextureRec() (3 input parameters) Name: UpdateTextureRec Return type: void Description: Update GPU texture rectangle with new data Param[1]: texture (type: Texture2D) Param[2]: rec (type: Rectangle) Param[3]: pixels (type: const void *) -Function 297: GenTextureMipmaps() (1 input parameters) +Function 299: GenTextureMipmaps() (1 input parameters) Name: GenTextureMipmaps Return type: void Description: Generate GPU mipmaps for a texture Param[1]: texture (type: Texture2D *) -Function 298: SetTextureFilter() (2 input parameters) +Function 300: SetTextureFilter() (2 input parameters) Name: SetTextureFilter Return type: void Description: Set texture scaling filter mode Param[1]: texture (type: Texture2D) Param[2]: filter (type: int) -Function 299: SetTextureWrap() (2 input parameters) +Function 301: SetTextureWrap() (2 input parameters) Name: SetTextureWrap Return type: void Description: Set texture wrapping mode Param[1]: texture (type: Texture2D) Param[2]: wrap (type: int) -Function 300: DrawTexture() (4 input parameters) +Function 302: DrawTexture() (4 input parameters) Name: DrawTexture Return type: void Description: Draw a Texture2D @@ -2434,14 +2444,14 @@ Function 300: DrawTexture() (4 input parameters) Param[2]: posX (type: int) Param[3]: posY (type: int) Param[4]: tint (type: Color) -Function 301: DrawTextureV() (3 input parameters) +Function 303: DrawTextureV() (3 input parameters) Name: DrawTextureV Return type: void Description: Draw a Texture2D with position defined as Vector2 Param[1]: texture (type: Texture2D) Param[2]: position (type: Vector2) Param[3]: tint (type: Color) -Function 302: DrawTextureEx() (5 input parameters) +Function 304: DrawTextureEx() (5 input parameters) Name: DrawTextureEx Return type: void Description: Draw a Texture2D with extended parameters @@ -2450,7 +2460,7 @@ Function 302: DrawTextureEx() (5 input parameters) Param[3]: rotation (type: float) Param[4]: scale (type: float) Param[5]: tint (type: Color) -Function 303: DrawTextureRec() (4 input parameters) +Function 305: DrawTextureRec() (4 input parameters) Name: DrawTextureRec Return type: void Description: Draw a part of a texture defined by a rectangle @@ -2458,7 +2468,7 @@ Function 303: DrawTextureRec() (4 input parameters) Param[2]: source (type: Rectangle) Param[3]: position (type: Vector2) Param[4]: tint (type: Color) -Function 304: DrawTextureQuad() (5 input parameters) +Function 306: DrawTextureQuad() (5 input parameters) Name: DrawTextureQuad Return type: void Description: Draw texture quad with tiling and offset parameters @@ -2467,7 +2477,7 @@ Function 304: DrawTextureQuad() (5 input parameters) Param[3]: offset (type: Vector2) Param[4]: quad (type: Rectangle) Param[5]: tint (type: Color) -Function 305: DrawTextureTiled() (7 input parameters) +Function 307: DrawTextureTiled() (7 input parameters) Name: DrawTextureTiled Return type: void Description: Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. @@ -2478,7 +2488,7 @@ Function 305: DrawTextureTiled() (7 input parameters) Param[5]: rotation (type: float) Param[6]: scale (type: float) Param[7]: tint (type: Color) -Function 306: DrawTexturePro() (6 input parameters) +Function 308: DrawTexturePro() (6 input parameters) Name: DrawTexturePro Return type: void Description: Draw a part of a texture defined by a rectangle with 'pro' parameters @@ -2488,7 +2498,7 @@ Function 306: DrawTexturePro() (6 input parameters) Param[4]: origin (type: Vector2) Param[5]: rotation (type: float) Param[6]: tint (type: Color) -Function 307: DrawTextureNPatch() (6 input parameters) +Function 309: DrawTextureNPatch() (6 input parameters) Name: DrawTextureNPatch Return type: void Description: Draws a texture (or part of it) that stretches or shrinks nicely @@ -2498,7 +2508,7 @@ Function 307: DrawTextureNPatch() (6 input parameters) Param[4]: origin (type: Vector2) Param[5]: rotation (type: float) Param[6]: tint (type: Color) -Function 308: DrawTexturePoly() (6 input parameters) +Function 310: DrawTexturePoly() (6 input parameters) Name: DrawTexturePoly Return type: void Description: Draw a textured polygon @@ -2508,88 +2518,88 @@ Function 308: DrawTexturePoly() (6 input parameters) Param[4]: texcoords (type: Vector2 *) Param[5]: pointCount (type: int) Param[6]: tint (type: Color) -Function 309: Fade() (2 input parameters) +Function 311: Fade() (2 input parameters) Name: Fade Return type: Color Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f Param[1]: color (type: Color) Param[2]: alpha (type: float) -Function 310: ColorToInt() (1 input parameters) +Function 312: ColorToInt() (1 input parameters) Name: ColorToInt Return type: int Description: Get hexadecimal value for a Color Param[1]: color (type: Color) -Function 311: ColorNormalize() (1 input parameters) +Function 313: ColorNormalize() (1 input parameters) Name: ColorNormalize Return type: Vector4 Description: Get Color normalized as float [0..1] Param[1]: color (type: Color) -Function 312: ColorFromNormalized() (1 input parameters) +Function 314: ColorFromNormalized() (1 input parameters) Name: ColorFromNormalized Return type: Color Description: Get Color from normalized values [0..1] Param[1]: normalized (type: Vector4) -Function 313: ColorToHSV() (1 input parameters) +Function 315: ColorToHSV() (1 input parameters) Name: ColorToHSV Return type: Vector3 Description: Get HSV values for a Color, hue [0..360], saturation/value [0..1] Param[1]: color (type: Color) -Function 314: ColorFromHSV() (3 input parameters) +Function 316: ColorFromHSV() (3 input parameters) Name: ColorFromHSV Return type: Color Description: Get a Color from HSV values, hue [0..360], saturation/value [0..1] Param[1]: hue (type: float) Param[2]: saturation (type: float) Param[3]: value (type: float) -Function 315: ColorAlpha() (2 input parameters) +Function 317: ColorAlpha() (2 input parameters) Name: ColorAlpha Return type: Color Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f Param[1]: color (type: Color) Param[2]: alpha (type: float) -Function 316: ColorAlphaBlend() (3 input parameters) +Function 318: ColorAlphaBlend() (3 input parameters) Name: ColorAlphaBlend Return type: Color Description: Get src alpha-blended into dst color with tint Param[1]: dst (type: Color) Param[2]: src (type: Color) Param[3]: tint (type: Color) -Function 317: GetColor() (1 input parameters) +Function 319: GetColor() (1 input parameters) Name: GetColor Return type: Color Description: Get Color structure from hexadecimal value Param[1]: hexValue (type: unsigned int) -Function 318: GetPixelColor() (2 input parameters) +Function 320: GetPixelColor() (2 input parameters) Name: GetPixelColor Return type: Color Description: Get Color from a source pixel pointer of certain format Param[1]: srcPtr (type: void *) Param[2]: format (type: int) -Function 319: SetPixelColor() (3 input parameters) +Function 321: SetPixelColor() (3 input parameters) Name: SetPixelColor Return type: void Description: Set color formatted into destination pixel pointer Param[1]: dstPtr (type: void *) Param[2]: color (type: Color) Param[3]: format (type: int) -Function 320: GetPixelDataSize() (3 input parameters) +Function 322: GetPixelDataSize() (3 input parameters) Name: GetPixelDataSize Return type: int Description: Get pixel data size in bytes for certain format Param[1]: width (type: int) Param[2]: height (type: int) Param[3]: format (type: int) -Function 321: GetFontDefault() (0 input parameters) +Function 323: GetFontDefault() (0 input parameters) Name: GetFontDefault Return type: Font Description: Get the default Font No input parameters -Function 322: LoadFont() (1 input parameters) +Function 324: LoadFont() (1 input parameters) Name: LoadFont Return type: Font Description: Load font from file into GPU memory (VRAM) Param[1]: fileName (type: const char *) -Function 323: LoadFontEx() (4 input parameters) +Function 325: LoadFontEx() (4 input parameters) Name: LoadFontEx Return type: Font Description: Load font from file with extended parameters @@ -2597,14 +2607,14 @@ Function 323: LoadFontEx() (4 input parameters) Param[2]: fontSize (type: int) Param[3]: fontChars (type: int *) Param[4]: glyphCount (type: int) -Function 324: LoadFontFromImage() (3 input parameters) +Function 326: LoadFontFromImage() (3 input parameters) Name: LoadFontFromImage Return type: Font Description: Load font from Image (XNA style) Param[1]: image (type: Image) Param[2]: key (type: Color) Param[3]: firstChar (type: int) -Function 325: LoadFontFromMemory() (6 input parameters) +Function 327: LoadFontFromMemory() (6 input parameters) Name: LoadFontFromMemory Return type: Font Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf' @@ -2614,7 +2624,7 @@ Function 325: LoadFontFromMemory() (6 input parameters) Param[4]: fontSize (type: int) Param[5]: fontChars (type: int *) Param[6]: glyphCount (type: int) -Function 326: LoadFontData() (6 input parameters) +Function 328: LoadFontData() (6 input parameters) Name: LoadFontData Return type: GlyphInfo * Description: Load font data for further use @@ -2624,7 +2634,7 @@ Function 326: LoadFontData() (6 input parameters) Param[4]: fontChars (type: int *) Param[5]: glyphCount (type: int) Param[6]: type (type: int) -Function 327: GenImageFontAtlas() (6 input parameters) +Function 329: GenImageFontAtlas() (6 input parameters) Name: GenImageFontAtlas Return type: Image Description: Generate image font atlas using chars info @@ -2634,24 +2644,24 @@ Function 327: GenImageFontAtlas() (6 input parameters) Param[4]: fontSize (type: int) Param[5]: padding (type: int) Param[6]: packMethod (type: int) -Function 328: UnloadFontData() (2 input parameters) +Function 330: UnloadFontData() (2 input parameters) Name: UnloadFontData Return type: void Description: Unload font chars info data (RAM) Param[1]: chars (type: GlyphInfo *) Param[2]: glyphCount (type: int) -Function 329: UnloadFont() (1 input parameters) +Function 331: UnloadFont() (1 input parameters) Name: UnloadFont Return type: void Description: Unload Font from GPU memory (VRAM) Param[1]: font (type: Font) -Function 330: DrawFPS() (2 input parameters) +Function 332: DrawFPS() (2 input parameters) Name: DrawFPS Return type: void Description: Draw current FPS Param[1]: posX (type: int) Param[2]: posY (type: int) -Function 331: DrawText() (5 input parameters) +Function 333: DrawText() (5 input parameters) Name: DrawText Return type: void Description: Draw text (using default font) @@ -2660,7 +2670,7 @@ Function 331: DrawText() (5 input parameters) Param[3]: posY (type: int) Param[4]: fontSize (type: int) Param[5]: color (type: Color) -Function 332: DrawTextEx() (6 input parameters) +Function 334: DrawTextEx() (6 input parameters) Name: DrawTextEx Return type: void Description: Draw text using font and additional parameters @@ -2670,7 +2680,7 @@ Function 332: DrawTextEx() (6 input parameters) Param[4]: fontSize (type: float) Param[5]: spacing (type: float) Param[6]: tint (type: Color) -Function 333: DrawTextPro() (8 input parameters) +Function 335: DrawTextPro() (8 input parameters) Name: DrawTextPro Return type: void Description: Draw text using Font and pro parameters (rotation) @@ -2682,7 +2692,7 @@ Function 333: DrawTextPro() (8 input parameters) Param[6]: fontSize (type: float) Param[7]: spacing (type: float) Param[8]: tint (type: Color) -Function 334: DrawTextCodepoint() (5 input parameters) +Function 336: DrawTextCodepoint() (5 input parameters) Name: DrawTextCodepoint Return type: void Description: Draw one character (codepoint) @@ -2691,13 +2701,13 @@ Function 334: DrawTextCodepoint() (5 input parameters) Param[3]: position (type: Vector2) Param[4]: fontSize (type: float) Param[5]: tint (type: Color) -Function 335: MeasureText() (2 input parameters) +Function 337: MeasureText() (2 input parameters) Name: MeasureText Return type: int Description: Measure string width for default font Param[1]: text (type: const char *) Param[2]: fontSize (type: int) -Function 336: MeasureTextEx() (4 input parameters) +Function 338: MeasureTextEx() (4 input parameters) Name: MeasureTextEx Return type: Vector2 Description: Measure string size for Font @@ -2705,163 +2715,163 @@ Function 336: MeasureTextEx() (4 input parameters) Param[2]: text (type: const char *) Param[3]: fontSize (type: float) Param[4]: spacing (type: float) -Function 337: GetGlyphIndex() (2 input parameters) +Function 339: GetGlyphIndex() (2 input parameters) Name: GetGlyphIndex Return type: int Description: Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found Param[1]: font (type: Font) Param[2]: codepoint (type: int) -Function 338: GetGlyphInfo() (2 input parameters) +Function 340: GetGlyphInfo() (2 input parameters) Name: GetGlyphInfo Return type: GlyphInfo Description: Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found Param[1]: font (type: Font) Param[2]: codepoint (type: int) -Function 339: GetGlyphAtlasRec() (2 input parameters) +Function 341: GetGlyphAtlasRec() (2 input parameters) Name: GetGlyphAtlasRec Return type: Rectangle Description: Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found Param[1]: font (type: Font) Param[2]: codepoint (type: int) -Function 340: LoadCodepoints() (2 input parameters) +Function 342: LoadCodepoints() (2 input parameters) Name: LoadCodepoints Return type: int * Description: Load all codepoints from a UTF-8 text string, codepoints count returned by parameter Param[1]: text (type: const char *) Param[2]: count (type: int *) -Function 341: UnloadCodepoints() (1 input parameters) +Function 343: UnloadCodepoints() (1 input parameters) Name: UnloadCodepoints Return type: void Description: Unload codepoints data from memory Param[1]: codepoints (type: int *) -Function 342: GetCodepointCount() (1 input parameters) +Function 344: GetCodepointCount() (1 input parameters) Name: GetCodepointCount Return type: int Description: Get total number of codepoints in a UTF-8 encoded string Param[1]: text (type: const char *) -Function 343: GetCodepoint() (2 input parameters) +Function 345: GetCodepoint() (2 input parameters) Name: GetCodepoint Return type: int Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure Param[1]: text (type: const char *) Param[2]: bytesProcessed (type: int *) -Function 344: CodepointToUTF8() (2 input parameters) +Function 346: CodepointToUTF8() (2 input parameters) Name: CodepointToUTF8 Return type: const char * Description: Encode one codepoint into UTF-8 byte array (array length returned as parameter) Param[1]: codepoint (type: int) Param[2]: byteSize (type: int *) -Function 345: TextCodepointsToUTF8() (2 input parameters) +Function 347: TextCodepointsToUTF8() (2 input parameters) Name: TextCodepointsToUTF8 Return type: char * Description: Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!) Param[1]: codepoints (type: int *) Param[2]: length (type: int) -Function 346: TextCopy() (2 input parameters) +Function 348: TextCopy() (2 input parameters) Name: TextCopy Return type: int Description: Copy one string to another, returns bytes copied Param[1]: dst (type: char *) Param[2]: src (type: const char *) -Function 347: TextIsEqual() (2 input parameters) +Function 349: TextIsEqual() (2 input parameters) Name: TextIsEqual Return type: bool Description: Check if two text string are equal Param[1]: text1 (type: const char *) Param[2]: text2 (type: const char *) -Function 348: TextLength() (1 input parameters) +Function 350: TextLength() (1 input parameters) Name: TextLength Return type: unsigned int Description: Get text length, checks for '\0' ending Param[1]: text (type: const char *) -Function 349: TextFormat() (2 input parameters) +Function 351: TextFormat() (2 input parameters) Name: TextFormat Return type: const char * Description: Text formatting with variables (sprintf() style) Param[1]: text (type: const char *) Param[2]: (type: ) -Function 350: TextSubtext() (3 input parameters) +Function 352: TextSubtext() (3 input parameters) Name: TextSubtext Return type: const char * Description: Get a piece of a text string Param[1]: text (type: const char *) Param[2]: position (type: int) Param[3]: length (type: int) -Function 351: TextReplace() (3 input parameters) +Function 353: TextReplace() (3 input parameters) Name: TextReplace Return type: char * Description: Replace text string (WARNING: memory must be freed!) Param[1]: text (type: char *) Param[2]: replace (type: const char *) Param[3]: by (type: const char *) -Function 352: TextInsert() (3 input parameters) +Function 354: TextInsert() (3 input parameters) Name: TextInsert Return type: char * Description: Insert text in a position (WARNING: memory must be freed!) Param[1]: text (type: const char *) Param[2]: insert (type: const char *) Param[3]: position (type: int) -Function 353: TextJoin() (3 input parameters) +Function 355: TextJoin() (3 input parameters) Name: TextJoin Return type: const char * Description: Join text strings with delimiter Param[1]: textList (type: const char **) Param[2]: count (type: int) Param[3]: delimiter (type: const char *) -Function 354: TextSplit() (3 input parameters) +Function 356: TextSplit() (3 input parameters) Name: TextSplit Return type: const char ** Description: Split text into multiple strings Param[1]: text (type: const char *) Param[2]: delimiter (type: char) Param[3]: count (type: int *) -Function 355: TextAppend() (3 input parameters) +Function 357: TextAppend() (3 input parameters) Name: TextAppend Return type: void Description: Append text at specific position and move cursor! Param[1]: text (type: char *) Param[2]: append (type: const char *) Param[3]: position (type: int *) -Function 356: TextFindIndex() (2 input parameters) +Function 358: TextFindIndex() (2 input parameters) Name: TextFindIndex Return type: int Description: Find first text occurrence within a string Param[1]: text (type: const char *) Param[2]: find (type: const char *) -Function 357: TextToUpper() (1 input parameters) +Function 359: TextToUpper() (1 input parameters) Name: TextToUpper Return type: const char * Description: Get upper case version of provided string Param[1]: text (type: const char *) -Function 358: TextToLower() (1 input parameters) +Function 360: TextToLower() (1 input parameters) Name: TextToLower Return type: const char * Description: Get lower case version of provided string Param[1]: text (type: const char *) -Function 359: TextToPascal() (1 input parameters) +Function 361: TextToPascal() (1 input parameters) Name: TextToPascal Return type: const char * Description: Get Pascal case notation version of provided string Param[1]: text (type: const char *) -Function 360: TextToInteger() (1 input parameters) +Function 362: TextToInteger() (1 input parameters) Name: TextToInteger Return type: int Description: Get integer value from text (negative values not supported) Param[1]: text (type: const char *) -Function 361: DrawLine3D() (3 input parameters) +Function 363: DrawLine3D() (3 input parameters) Name: DrawLine3D Return type: void Description: Draw a line in 3D world space Param[1]: startPos (type: Vector3) Param[2]: endPos (type: Vector3) Param[3]: color (type: Color) -Function 362: DrawPoint3D() (2 input parameters) +Function 364: DrawPoint3D() (2 input parameters) Name: DrawPoint3D Return type: void Description: Draw a point in 3D space, actually a small line Param[1]: position (type: Vector3) Param[2]: color (type: Color) -Function 363: DrawCircle3D() (5 input parameters) +Function 365: DrawCircle3D() (5 input parameters) Name: DrawCircle3D Return type: void Description: Draw a circle in 3D world space @@ -2870,7 +2880,7 @@ Function 363: DrawCircle3D() (5 input parameters) Param[3]: rotationAxis (type: Vector3) Param[4]: rotationAngle (type: float) Param[5]: color (type: Color) -Function 364: DrawTriangle3D() (4 input parameters) +Function 366: DrawTriangle3D() (4 input parameters) Name: DrawTriangle3D Return type: void Description: Draw a color-filled triangle (vertex in counter-clockwise order!) @@ -2878,14 +2888,14 @@ Function 364: DrawTriangle3D() (4 input parameters) Param[2]: v2 (type: Vector3) Param[3]: v3 (type: Vector3) Param[4]: color (type: Color) -Function 365: DrawTriangleStrip3D() (3 input parameters) +Function 367: DrawTriangleStrip3D() (3 input parameters) Name: DrawTriangleStrip3D Return type: void Description: Draw a triangle strip defined by points Param[1]: points (type: Vector3 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) -Function 366: DrawCube() (5 input parameters) +Function 368: DrawCube() (5 input parameters) Name: DrawCube Return type: void Description: Draw cube @@ -2894,14 +2904,14 @@ Function 366: DrawCube() (5 input parameters) Param[3]: height (type: float) Param[4]: length (type: float) Param[5]: color (type: Color) -Function 367: DrawCubeV() (3 input parameters) +Function 369: DrawCubeV() (3 input parameters) Name: DrawCubeV Return type: void Description: Draw cube (Vector version) Param[1]: position (type: Vector3) Param[2]: size (type: Vector3) Param[3]: color (type: Color) -Function 368: DrawCubeWires() (5 input parameters) +Function 370: DrawCubeWires() (5 input parameters) Name: DrawCubeWires Return type: void Description: Draw cube wires @@ -2910,14 +2920,14 @@ Function 368: DrawCubeWires() (5 input parameters) Param[3]: height (type: float) Param[4]: length (type: float) Param[5]: color (type: Color) -Function 369: DrawCubeWiresV() (3 input parameters) +Function 371: DrawCubeWiresV() (3 input parameters) Name: DrawCubeWiresV Return type: void Description: Draw cube wires (Vector version) Param[1]: position (type: Vector3) Param[2]: size (type: Vector3) Param[3]: color (type: Color) -Function 370: DrawCubeTexture() (6 input parameters) +Function 372: DrawCubeTexture() (6 input parameters) Name: DrawCubeTexture Return type: void Description: Draw cube textured @@ -2927,7 +2937,7 @@ Function 370: DrawCubeTexture() (6 input parameters) Param[4]: height (type: float) Param[5]: length (type: float) Param[6]: color (type: Color) -Function 371: DrawCubeTextureRec() (7 input parameters) +Function 373: DrawCubeTextureRec() (7 input parameters) Name: DrawCubeTextureRec Return type: void Description: Draw cube with a region of a texture @@ -2938,14 +2948,14 @@ Function 371: DrawCubeTextureRec() (7 input parameters) Param[5]: height (type: float) Param[6]: length (type: float) Param[7]: color (type: Color) -Function 372: DrawSphere() (3 input parameters) +Function 374: DrawSphere() (3 input parameters) Name: DrawSphere Return type: void Description: Draw sphere Param[1]: centerPos (type: Vector3) Param[2]: radius (type: float) Param[3]: color (type: Color) -Function 373: DrawSphereEx() (5 input parameters) +Function 375: DrawSphereEx() (5 input parameters) Name: DrawSphereEx Return type: void Description: Draw sphere with extended parameters @@ -2954,7 +2964,7 @@ Function 373: DrawSphereEx() (5 input parameters) Param[3]: rings (type: int) Param[4]: slices (type: int) Param[5]: color (type: Color) -Function 374: DrawSphereWires() (5 input parameters) +Function 376: DrawSphereWires() (5 input parameters) Name: DrawSphereWires Return type: void Description: Draw sphere wires @@ -2963,7 +2973,7 @@ Function 374: DrawSphereWires() (5 input parameters) Param[3]: rings (type: int) Param[4]: slices (type: int) Param[5]: color (type: Color) -Function 375: DrawCylinder() (6 input parameters) +Function 377: DrawCylinder() (6 input parameters) Name: DrawCylinder Return type: void Description: Draw a cylinder/cone @@ -2973,7 +2983,7 @@ Function 375: DrawCylinder() (6 input parameters) Param[4]: height (type: float) Param[5]: slices (type: int) Param[6]: color (type: Color) -Function 376: DrawCylinderEx() (6 input parameters) +Function 378: DrawCylinderEx() (6 input parameters) Name: DrawCylinderEx Return type: void Description: Draw a cylinder with base at startPos and top at endPos @@ -2983,7 +2993,7 @@ Function 376: DrawCylinderEx() (6 input parameters) Param[4]: endRadius (type: float) Param[5]: sides (type: int) Param[6]: color (type: Color) -Function 377: DrawCylinderWires() (6 input parameters) +Function 379: DrawCylinderWires() (6 input parameters) Name: DrawCylinderWires Return type: void Description: Draw a cylinder/cone wires @@ -2993,7 +3003,7 @@ Function 377: DrawCylinderWires() (6 input parameters) Param[4]: height (type: float) Param[5]: slices (type: int) Param[6]: color (type: Color) -Function 378: DrawCylinderWiresEx() (6 input parameters) +Function 380: DrawCylinderWiresEx() (6 input parameters) Name: DrawCylinderWiresEx Return type: void Description: Draw a cylinder wires with base at startPos and top at endPos @@ -3003,51 +3013,51 @@ Function 378: DrawCylinderWiresEx() (6 input parameters) Param[4]: endRadius (type: float) Param[5]: sides (type: int) Param[6]: color (type: Color) -Function 379: DrawPlane() (3 input parameters) +Function 381: DrawPlane() (3 input parameters) Name: DrawPlane Return type: void Description: Draw a plane XZ Param[1]: centerPos (type: Vector3) Param[2]: size (type: Vector2) Param[3]: color (type: Color) -Function 380: DrawRay() (2 input parameters) +Function 382: DrawRay() (2 input parameters) Name: DrawRay Return type: void Description: Draw a ray line Param[1]: ray (type: Ray) Param[2]: color (type: Color) -Function 381: DrawGrid() (2 input parameters) +Function 383: DrawGrid() (2 input parameters) Name: DrawGrid Return type: void Description: Draw a grid (centered at (0, 0, 0)) Param[1]: slices (type: int) Param[2]: spacing (type: float) -Function 382: LoadModel() (1 input parameters) +Function 384: LoadModel() (1 input parameters) Name: LoadModel Return type: Model Description: Load model from files (meshes and materials) Param[1]: fileName (type: const char *) -Function 383: LoadModelFromMesh() (1 input parameters) +Function 385: LoadModelFromMesh() (1 input parameters) Name: LoadModelFromMesh Return type: Model Description: Load model from generated mesh (default material) Param[1]: mesh (type: Mesh) -Function 384: UnloadModel() (1 input parameters) +Function 386: UnloadModel() (1 input parameters) Name: UnloadModel Return type: void Description: Unload model (including meshes) from memory (RAM and/or VRAM) Param[1]: model (type: Model) -Function 385: UnloadModelKeepMeshes() (1 input parameters) +Function 387: UnloadModelKeepMeshes() (1 input parameters) Name: UnloadModelKeepMeshes Return type: void Description: Unload model (but not meshes) from memory (RAM and/or VRAM) Param[1]: model (type: Model) -Function 386: GetModelBoundingBox() (1 input parameters) +Function 388: GetModelBoundingBox() (1 input parameters) Name: GetModelBoundingBox Return type: BoundingBox Description: Compute model bounding box limits (considers all meshes) Param[1]: model (type: Model) -Function 387: DrawModel() (4 input parameters) +Function 389: DrawModel() (4 input parameters) Name: DrawModel Return type: void Description: Draw a model (with texture if set) @@ -3055,7 +3065,7 @@ Function 387: DrawModel() (4 input parameters) Param[2]: position (type: Vector3) Param[3]: scale (type: float) Param[4]: tint (type: Color) -Function 388: DrawModelEx() (6 input parameters) +Function 390: DrawModelEx() (6 input parameters) Name: DrawModelEx Return type: void Description: Draw a model with extended parameters @@ -3065,7 +3075,7 @@ Function 388: DrawModelEx() (6 input parameters) Param[4]: rotationAngle (type: float) Param[5]: scale (type: Vector3) Param[6]: tint (type: Color) -Function 389: DrawModelWires() (4 input parameters) +Function 391: DrawModelWires() (4 input parameters) Name: DrawModelWires Return type: void Description: Draw a model wires (with texture if set) @@ -3073,7 +3083,7 @@ Function 389: DrawModelWires() (4 input parameters) Param[2]: position (type: Vector3) Param[3]: scale (type: float) Param[4]: tint (type: Color) -Function 390: DrawModelWiresEx() (6 input parameters) +Function 392: DrawModelWiresEx() (6 input parameters) Name: DrawModelWiresEx Return type: void Description: Draw a model wires (with texture if set) with extended parameters @@ -3083,13 +3093,13 @@ Function 390: DrawModelWiresEx() (6 input parameters) Param[4]: rotationAngle (type: float) Param[5]: scale (type: Vector3) Param[6]: tint (type: Color) -Function 391: DrawBoundingBox() (2 input parameters) +Function 393: DrawBoundingBox() (2 input parameters) Name: DrawBoundingBox Return type: void Description: Draw bounding box (wires) Param[1]: box (type: BoundingBox) Param[2]: color (type: Color) -Function 392: DrawBillboard() (5 input parameters) +Function 394: DrawBillboard() (5 input parameters) Name: DrawBillboard Return type: void Description: Draw a billboard texture @@ -3098,7 +3108,7 @@ Function 392: DrawBillboard() (5 input parameters) Param[3]: position (type: Vector3) Param[4]: size (type: float) Param[5]: tint (type: Color) -Function 393: DrawBillboardRec() (6 input parameters) +Function 395: DrawBillboardRec() (6 input parameters) Name: DrawBillboardRec Return type: void Description: Draw a billboard texture defined by source @@ -3108,7 +3118,7 @@ Function 393: DrawBillboardRec() (6 input parameters) Param[4]: position (type: Vector3) Param[5]: size (type: Vector2) Param[6]: tint (type: Color) -Function 394: DrawBillboardPro() (9 input parameters) +Function 396: DrawBillboardPro() (9 input parameters) Name: DrawBillboardPro Return type: void Description: Draw a billboard texture defined by source and rotation @@ -3121,13 +3131,13 @@ Function 394: DrawBillboardPro() (9 input parameters) Param[7]: origin (type: Vector2) Param[8]: rotation (type: float) Param[9]: tint (type: Color) -Function 395: UploadMesh() (2 input parameters) +Function 397: UploadMesh() (2 input parameters) Name: UploadMesh Return type: void Description: Upload mesh vertex data in GPU and provide VAO/VBO ids Param[1]: mesh (type: Mesh *) Param[2]: dynamic (type: bool) -Function 396: UpdateMeshBuffer() (5 input parameters) +Function 398: UpdateMeshBuffer() (5 input parameters) Name: UpdateMeshBuffer Return type: void Description: Update mesh vertex data in GPU for a specific buffer index @@ -3136,19 +3146,19 @@ Function 396: UpdateMeshBuffer() (5 input parameters) Param[3]: data (type: void *) Param[4]: dataSize (type: int) Param[5]: offset (type: int) -Function 397: UnloadMesh() (1 input parameters) +Function 399: UnloadMesh() (1 input parameters) Name: UnloadMesh Return type: void Description: Unload mesh data from CPU and GPU Param[1]: mesh (type: Mesh) -Function 398: DrawMesh() (3 input parameters) +Function 400: DrawMesh() (3 input parameters) Name: DrawMesh Return type: void Description: Draw a 3d mesh with material and transform Param[1]: mesh (type: Mesh) Param[2]: material (type: Material) Param[3]: transform (type: Matrix) -Function 399: DrawMeshInstanced() (4 input parameters) +Function 401: DrawMeshInstanced() (4 input parameters) Name: DrawMeshInstanced Return type: void Description: Draw multiple mesh instances with material and different transforms @@ -3156,34 +3166,34 @@ Function 399: DrawMeshInstanced() (4 input parameters) Param[2]: material (type: Material) Param[3]: transforms (type: Matrix *) Param[4]: instances (type: int) -Function 400: ExportMesh() (2 input parameters) +Function 402: ExportMesh() (2 input parameters) Name: ExportMesh Return type: bool Description: Export mesh data to file, returns true on success Param[1]: mesh (type: Mesh) Param[2]: fileName (type: const char *) -Function 401: GetMeshBoundingBox() (1 input parameters) +Function 403: GetMeshBoundingBox() (1 input parameters) Name: GetMeshBoundingBox Return type: BoundingBox Description: Compute mesh bounding box limits Param[1]: mesh (type: Mesh) -Function 402: GenMeshTangents() (1 input parameters) +Function 404: GenMeshTangents() (1 input parameters) Name: GenMeshTangents Return type: void Description: Compute mesh tangents Param[1]: mesh (type: Mesh *) -Function 403: GenMeshBinormals() (1 input parameters) +Function 405: GenMeshBinormals() (1 input parameters) Name: GenMeshBinormals Return type: void Description: Compute mesh binormals Param[1]: mesh (type: Mesh *) -Function 404: GenMeshPoly() (2 input parameters) +Function 406: GenMeshPoly() (2 input parameters) Name: GenMeshPoly Return type: Mesh Description: Generate polygonal mesh Param[1]: sides (type: int) Param[2]: radius (type: float) -Function 405: GenMeshPlane() (4 input parameters) +Function 407: GenMeshPlane() (4 input parameters) Name: GenMeshPlane Return type: Mesh Description: Generate plane mesh (with subdivisions) @@ -3191,42 +3201,42 @@ Function 405: GenMeshPlane() (4 input parameters) Param[2]: length (type: float) Param[3]: resX (type: int) Param[4]: resZ (type: int) -Function 406: GenMeshCube() (3 input parameters) +Function 408: GenMeshCube() (3 input parameters) Name: GenMeshCube Return type: Mesh Description: Generate cuboid mesh Param[1]: width (type: float) Param[2]: height (type: float) Param[3]: length (type: float) -Function 407: GenMeshSphere() (3 input parameters) +Function 409: GenMeshSphere() (3 input parameters) Name: GenMeshSphere Return type: Mesh Description: Generate sphere mesh (standard sphere) Param[1]: radius (type: float) Param[2]: rings (type: int) Param[3]: slices (type: int) -Function 408: GenMeshHemiSphere() (3 input parameters) +Function 410: GenMeshHemiSphere() (3 input parameters) Name: GenMeshHemiSphere Return type: Mesh Description: Generate half-sphere mesh (no bottom cap) Param[1]: radius (type: float) Param[2]: rings (type: int) Param[3]: slices (type: int) -Function 409: GenMeshCylinder() (3 input parameters) +Function 411: GenMeshCylinder() (3 input parameters) Name: GenMeshCylinder Return type: Mesh Description: Generate cylinder mesh Param[1]: radius (type: float) Param[2]: height (type: float) Param[3]: slices (type: int) -Function 410: GenMeshCone() (3 input parameters) +Function 412: GenMeshCone() (3 input parameters) Name: GenMeshCone Return type: Mesh Description: Generate cone/pyramid mesh Param[1]: radius (type: float) Param[2]: height (type: float) Param[3]: slices (type: int) -Function 411: GenMeshTorus() (4 input parameters) +Function 413: GenMeshTorus() (4 input parameters) Name: GenMeshTorus Return type: Mesh Description: Generate torus mesh @@ -3234,7 +3244,7 @@ Function 411: GenMeshTorus() (4 input parameters) Param[2]: size (type: float) Param[3]: radSeg (type: int) Param[4]: sides (type: int) -Function 412: GenMeshKnot() (4 input parameters) +Function 414: GenMeshKnot() (4 input parameters) Name: GenMeshKnot Return type: Mesh Description: Generate trefoil knot mesh @@ -3242,79 +3252,79 @@ Function 412: GenMeshKnot() (4 input parameters) Param[2]: size (type: float) Param[3]: radSeg (type: int) Param[4]: sides (type: int) -Function 413: GenMeshHeightmap() (2 input parameters) +Function 415: GenMeshHeightmap() (2 input parameters) Name: GenMeshHeightmap Return type: Mesh Description: Generate heightmap mesh from image data Param[1]: heightmap (type: Image) Param[2]: size (type: Vector3) -Function 414: GenMeshCubicmap() (2 input parameters) +Function 416: GenMeshCubicmap() (2 input parameters) Name: GenMeshCubicmap Return type: Mesh Description: Generate cubes-based map mesh from image data Param[1]: cubicmap (type: Image) Param[2]: cubeSize (type: Vector3) -Function 415: LoadMaterials() (2 input parameters) +Function 417: LoadMaterials() (2 input parameters) Name: LoadMaterials Return type: Material * Description: Load materials from model file Param[1]: fileName (type: const char *) Param[2]: materialCount (type: int *) -Function 416: LoadMaterialDefault() (0 input parameters) +Function 418: LoadMaterialDefault() (0 input parameters) Name: LoadMaterialDefault Return type: Material Description: Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) No input parameters -Function 417: UnloadMaterial() (1 input parameters) +Function 419: UnloadMaterial() (1 input parameters) Name: UnloadMaterial Return type: void Description: Unload material from GPU memory (VRAM) Param[1]: material (type: Material) -Function 418: SetMaterialTexture() (3 input parameters) +Function 420: SetMaterialTexture() (3 input parameters) Name: SetMaterialTexture Return type: void Description: Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) Param[1]: material (type: Material *) Param[2]: mapType (type: int) Param[3]: texture (type: Texture2D) -Function 419: SetModelMeshMaterial() (3 input parameters) +Function 421: SetModelMeshMaterial() (3 input parameters) Name: SetModelMeshMaterial Return type: void Description: Set material for a mesh Param[1]: model (type: Model *) Param[2]: meshId (type: int) Param[3]: materialId (type: int) -Function 420: LoadModelAnimations() (2 input parameters) +Function 422: LoadModelAnimations() (2 input parameters) Name: LoadModelAnimations Return type: ModelAnimation * Description: Load model animations from file Param[1]: fileName (type: const char *) Param[2]: animCount (type: unsigned int *) -Function 421: UpdateModelAnimation() (3 input parameters) +Function 423: UpdateModelAnimation() (3 input parameters) Name: UpdateModelAnimation Return type: void Description: Update model animation pose Param[1]: model (type: Model) Param[2]: anim (type: ModelAnimation) Param[3]: frame (type: int) -Function 422: UnloadModelAnimation() (1 input parameters) +Function 424: UnloadModelAnimation() (1 input parameters) Name: UnloadModelAnimation Return type: void Description: Unload animation data Param[1]: anim (type: ModelAnimation) -Function 423: UnloadModelAnimations() (2 input parameters) +Function 425: UnloadModelAnimations() (2 input parameters) Name: UnloadModelAnimations Return type: void Description: Unload animation array data Param[1]: animations (type: ModelAnimation*) Param[2]: count (type: unsigned int) -Function 424: IsModelAnimationValid() (2 input parameters) +Function 426: IsModelAnimationValid() (2 input parameters) Name: IsModelAnimationValid Return type: bool Description: Check model animation skeleton match Param[1]: model (type: Model) Param[2]: anim (type: ModelAnimation) -Function 425: CheckCollisionSpheres() (4 input parameters) +Function 427: CheckCollisionSpheres() (4 input parameters) Name: CheckCollisionSpheres Return type: bool Description: Check collision between two spheres @@ -3322,46 +3332,46 @@ Function 425: CheckCollisionSpheres() (4 input parameters) Param[2]: radius1 (type: float) Param[3]: center2 (type: Vector3) Param[4]: radius2 (type: float) -Function 426: CheckCollisionBoxes() (2 input parameters) +Function 428: CheckCollisionBoxes() (2 input parameters) Name: CheckCollisionBoxes Return type: bool Description: Check collision between two bounding boxes Param[1]: box1 (type: BoundingBox) Param[2]: box2 (type: BoundingBox) -Function 427: CheckCollisionBoxSphere() (3 input parameters) +Function 429: CheckCollisionBoxSphere() (3 input parameters) Name: CheckCollisionBoxSphere Return type: bool Description: Check collision between box and sphere Param[1]: box (type: BoundingBox) Param[2]: center (type: Vector3) Param[3]: radius (type: float) -Function 428: GetRayCollisionSphere() (3 input parameters) +Function 430: GetRayCollisionSphere() (3 input parameters) Name: GetRayCollisionSphere Return type: RayCollision Description: Get collision info between ray and sphere Param[1]: ray (type: Ray) Param[2]: center (type: Vector3) Param[3]: radius (type: float) -Function 429: GetRayCollisionBox() (2 input parameters) +Function 431: GetRayCollisionBox() (2 input parameters) Name: GetRayCollisionBox Return type: RayCollision Description: Get collision info between ray and box Param[1]: ray (type: Ray) Param[2]: box (type: BoundingBox) -Function 430: GetRayCollisionModel() (2 input parameters) +Function 432: GetRayCollisionModel() (2 input parameters) Name: GetRayCollisionModel Return type: RayCollision Description: Get collision info between ray and model Param[1]: ray (type: Ray) Param[2]: model (type: Model) -Function 431: GetRayCollisionMesh() (3 input parameters) +Function 433: GetRayCollisionMesh() (3 input parameters) Name: GetRayCollisionMesh Return type: RayCollision Description: Get collision info between ray and mesh Param[1]: ray (type: Ray) Param[2]: mesh (type: Mesh) Param[3]: transform (type: Matrix) -Function 432: GetRayCollisionTriangle() (4 input parameters) +Function 434: GetRayCollisionTriangle() (4 input parameters) Name: GetRayCollisionTriangle Return type: RayCollision Description: Get collision info between ray and triangle @@ -3369,7 +3379,7 @@ Function 432: GetRayCollisionTriangle() (4 input parameters) Param[2]: p1 (type: Vector3) Param[3]: p2 (type: Vector3) Param[4]: p3 (type: Vector3) -Function 433: GetRayCollisionQuad() (5 input parameters) +Function 435: GetRayCollisionQuad() (5 input parameters) Name: GetRayCollisionQuad Return type: RayCollision Description: Get collision info between ray and quad @@ -3378,130 +3388,130 @@ Function 433: GetRayCollisionQuad() (5 input parameters) Param[3]: p2 (type: Vector3) Param[4]: p3 (type: Vector3) Param[5]: p4 (type: Vector3) -Function 434: InitAudioDevice() (0 input parameters) +Function 436: InitAudioDevice() (0 input parameters) Name: InitAudioDevice Return type: void Description: Initialize audio device and context No input parameters -Function 435: CloseAudioDevice() (0 input parameters) +Function 437: CloseAudioDevice() (0 input parameters) Name: CloseAudioDevice Return type: void Description: Close the audio device and context No input parameters -Function 436: IsAudioDeviceReady() (0 input parameters) +Function 438: IsAudioDeviceReady() (0 input parameters) Name: IsAudioDeviceReady Return type: bool Description: Check if audio device has been initialized successfully No input parameters -Function 437: SetMasterVolume() (1 input parameters) +Function 439: SetMasterVolume() (1 input parameters) Name: SetMasterVolume Return type: void Description: Set master volume (listener) Param[1]: volume (type: float) -Function 438: LoadWave() (1 input parameters) +Function 440: LoadWave() (1 input parameters) Name: LoadWave Return type: Wave Description: Load wave data from file Param[1]: fileName (type: const char *) -Function 439: LoadWaveFromMemory() (3 input parameters) +Function 441: LoadWaveFromMemory() (3 input parameters) Name: LoadWaveFromMemory Return type: Wave Description: Load wave from memory buffer, fileType refers to extension: i.e. '.wav' Param[1]: fileType (type: const char *) Param[2]: fileData (type: const unsigned char *) Param[3]: dataSize (type: int) -Function 440: LoadSound() (1 input parameters) +Function 442: LoadSound() (1 input parameters) Name: LoadSound Return type: Sound Description: Load sound from file Param[1]: fileName (type: const char *) -Function 441: LoadSoundFromWave() (1 input parameters) +Function 443: LoadSoundFromWave() (1 input parameters) Name: LoadSoundFromWave Return type: Sound Description: Load sound from wave data Param[1]: wave (type: Wave) -Function 442: UpdateSound() (3 input parameters) +Function 444: UpdateSound() (3 input parameters) Name: UpdateSound Return type: void Description: Update sound buffer with new data Param[1]: sound (type: Sound) Param[2]: data (type: const void *) Param[3]: sampleCount (type: int) -Function 443: UnloadWave() (1 input parameters) +Function 445: UnloadWave() (1 input parameters) Name: UnloadWave Return type: void Description: Unload wave data Param[1]: wave (type: Wave) -Function 444: UnloadSound() (1 input parameters) +Function 446: UnloadSound() (1 input parameters) Name: UnloadSound Return type: void Description: Unload sound Param[1]: sound (type: Sound) -Function 445: ExportWave() (2 input parameters) +Function 447: ExportWave() (2 input parameters) Name: ExportWave Return type: bool Description: Export wave data to file, returns true on success Param[1]: wave (type: Wave) Param[2]: fileName (type: const char *) -Function 446: ExportWaveAsCode() (2 input parameters) +Function 448: ExportWaveAsCode() (2 input parameters) Name: ExportWaveAsCode Return type: bool Description: Export wave sample data to code (.h), returns true on success Param[1]: wave (type: Wave) Param[2]: fileName (type: const char *) -Function 447: PlaySound() (1 input parameters) +Function 449: PlaySound() (1 input parameters) Name: PlaySound Return type: void Description: Play a sound Param[1]: sound (type: Sound) -Function 448: StopSound() (1 input parameters) +Function 450: StopSound() (1 input parameters) Name: StopSound Return type: void Description: Stop playing a sound Param[1]: sound (type: Sound) -Function 449: PauseSound() (1 input parameters) +Function 451: PauseSound() (1 input parameters) Name: PauseSound Return type: void Description: Pause a sound Param[1]: sound (type: Sound) -Function 450: ResumeSound() (1 input parameters) +Function 452: ResumeSound() (1 input parameters) Name: ResumeSound Return type: void Description: Resume a paused sound Param[1]: sound (type: Sound) -Function 451: PlaySoundMulti() (1 input parameters) +Function 453: PlaySoundMulti() (1 input parameters) Name: PlaySoundMulti Return type: void Description: Play a sound (using multichannel buffer pool) Param[1]: sound (type: Sound) -Function 452: StopSoundMulti() (0 input parameters) +Function 454: StopSoundMulti() (0 input parameters) Name: StopSoundMulti Return type: void Description: Stop any sound playing (using multichannel buffer pool) No input parameters -Function 453: GetSoundsPlaying() (0 input parameters) +Function 455: GetSoundsPlaying() (0 input parameters) Name: GetSoundsPlaying Return type: int Description: Get number of sounds playing in the multichannel No input parameters -Function 454: IsSoundPlaying() (1 input parameters) +Function 456: IsSoundPlaying() (1 input parameters) Name: IsSoundPlaying Return type: bool Description: Check if a sound is currently playing Param[1]: sound (type: Sound) -Function 455: SetSoundVolume() (2 input parameters) +Function 457: SetSoundVolume() (2 input parameters) Name: SetSoundVolume Return type: void Description: Set volume for a sound (1.0 is max level) Param[1]: sound (type: Sound) Param[2]: volume (type: float) -Function 456: SetSoundPitch() (2 input parameters) +Function 458: SetSoundPitch() (2 input parameters) Name: SetSoundPitch Return type: void Description: Set pitch for a sound (1.0 is base level) Param[1]: sound (type: Sound) Param[2]: pitch (type: float) -Function 457: WaveFormat() (4 input parameters) +Function 459: WaveFormat() (4 input parameters) Name: WaveFormat Return type: void Description: Convert wave data to desired format @@ -3509,165 +3519,165 @@ Function 457: WaveFormat() (4 input parameters) Param[2]: sampleRate (type: int) Param[3]: sampleSize (type: int) Param[4]: channels (type: int) -Function 458: WaveCopy() (1 input parameters) +Function 460: WaveCopy() (1 input parameters) Name: WaveCopy Return type: Wave Description: Copy a wave to a new wave Param[1]: wave (type: Wave) -Function 459: WaveCrop() (3 input parameters) +Function 461: WaveCrop() (3 input parameters) Name: WaveCrop Return type: void Description: Crop a wave to defined samples range Param[1]: wave (type: Wave *) Param[2]: initSample (type: int) Param[3]: finalSample (type: int) -Function 460: LoadWaveSamples() (1 input parameters) +Function 462: LoadWaveSamples() (1 input parameters) Name: LoadWaveSamples Return type: float * Description: Load samples data from wave as a floats array Param[1]: wave (type: Wave) -Function 461: UnloadWaveSamples() (1 input parameters) +Function 463: UnloadWaveSamples() (1 input parameters) Name: UnloadWaveSamples Return type: void Description: Unload samples data loaded with LoadWaveSamples() Param[1]: samples (type: float *) -Function 462: LoadMusicStream() (1 input parameters) +Function 464: LoadMusicStream() (1 input parameters) Name: LoadMusicStream Return type: Music Description: Load music stream from file Param[1]: fileName (type: const char *) -Function 463: LoadMusicStreamFromMemory() (3 input parameters) +Function 465: LoadMusicStreamFromMemory() (3 input parameters) Name: LoadMusicStreamFromMemory Return type: Music Description: Load music stream from data Param[1]: fileType (type: const char *) Param[2]: data (type: unsigned char *) Param[3]: dataSize (type: int) -Function 464: UnloadMusicStream() (1 input parameters) +Function 466: UnloadMusicStream() (1 input parameters) Name: UnloadMusicStream Return type: void Description: Unload music stream Param[1]: music (type: Music) -Function 465: PlayMusicStream() (1 input parameters) +Function 467: PlayMusicStream() (1 input parameters) Name: PlayMusicStream Return type: void Description: Start music playing Param[1]: music (type: Music) -Function 466: IsMusicStreamPlaying() (1 input parameters) +Function 468: IsMusicStreamPlaying() (1 input parameters) Name: IsMusicStreamPlaying Return type: bool Description: Check if music is playing Param[1]: music (type: Music) -Function 467: UpdateMusicStream() (1 input parameters) +Function 469: UpdateMusicStream() (1 input parameters) Name: UpdateMusicStream Return type: void Description: Updates buffers for music streaming Param[1]: music (type: Music) -Function 468: StopMusicStream() (1 input parameters) +Function 470: StopMusicStream() (1 input parameters) Name: StopMusicStream Return type: void Description: Stop music playing Param[1]: music (type: Music) -Function 469: PauseMusicStream() (1 input parameters) +Function 471: PauseMusicStream() (1 input parameters) Name: PauseMusicStream Return type: void Description: Pause music playing Param[1]: music (type: Music) -Function 470: ResumeMusicStream() (1 input parameters) +Function 472: ResumeMusicStream() (1 input parameters) Name: ResumeMusicStream Return type: void Description: Resume playing paused music Param[1]: music (type: Music) -Function 471: SeekMusicStream() (2 input parameters) +Function 473: SeekMusicStream() (2 input parameters) Name: SeekMusicStream Return type: void Description: Seek music to a position (in seconds) Param[1]: music (type: Music) Param[2]: position (type: float) -Function 472: SetMusicVolume() (2 input parameters) +Function 474: SetMusicVolume() (2 input parameters) Name: SetMusicVolume Return type: void Description: Set volume for music (1.0 is max level) Param[1]: music (type: Music) Param[2]: volume (type: float) -Function 473: SetMusicPitch() (2 input parameters) +Function 475: SetMusicPitch() (2 input parameters) Name: SetMusicPitch Return type: void Description: Set pitch for a music (1.0 is base level) Param[1]: music (type: Music) Param[2]: pitch (type: float) -Function 474: GetMusicTimeLength() (1 input parameters) +Function 476: GetMusicTimeLength() (1 input parameters) Name: GetMusicTimeLength Return type: float Description: Get music time length (in seconds) Param[1]: music (type: Music) -Function 475: GetMusicTimePlayed() (1 input parameters) +Function 477: GetMusicTimePlayed() (1 input parameters) Name: GetMusicTimePlayed Return type: float Description: Get current music time played (in seconds) Param[1]: music (type: Music) -Function 476: LoadAudioStream() (3 input parameters) +Function 478: LoadAudioStream() (3 input parameters) Name: LoadAudioStream Return type: AudioStream Description: Load audio stream (to stream raw audio pcm data) Param[1]: sampleRate (type: unsigned int) Param[2]: sampleSize (type: unsigned int) Param[3]: channels (type: unsigned int) -Function 477: UnloadAudioStream() (1 input parameters) +Function 479: UnloadAudioStream() (1 input parameters) Name: UnloadAudioStream Return type: void Description: Unload audio stream and free memory Param[1]: stream (type: AudioStream) -Function 478: UpdateAudioStream() (3 input parameters) +Function 480: UpdateAudioStream() (3 input parameters) Name: UpdateAudioStream Return type: void Description: Update audio stream buffers with data Param[1]: stream (type: AudioStream) Param[2]: data (type: const void *) Param[3]: frameCount (type: int) -Function 479: IsAudioStreamProcessed() (1 input parameters) +Function 481: IsAudioStreamProcessed() (1 input parameters) Name: IsAudioStreamProcessed Return type: bool Description: Check if any audio stream buffers requires refill Param[1]: stream (type: AudioStream) -Function 480: PlayAudioStream() (1 input parameters) +Function 482: PlayAudioStream() (1 input parameters) Name: PlayAudioStream Return type: void Description: Play audio stream Param[1]: stream (type: AudioStream) -Function 481: PauseAudioStream() (1 input parameters) +Function 483: PauseAudioStream() (1 input parameters) Name: PauseAudioStream Return type: void Description: Pause audio stream Param[1]: stream (type: AudioStream) -Function 482: ResumeAudioStream() (1 input parameters) +Function 484: ResumeAudioStream() (1 input parameters) Name: ResumeAudioStream Return type: void Description: Resume audio stream Param[1]: stream (type: AudioStream) -Function 483: IsAudioStreamPlaying() (1 input parameters) +Function 485: IsAudioStreamPlaying() (1 input parameters) Name: IsAudioStreamPlaying Return type: bool Description: Check if audio stream is playing Param[1]: stream (type: AudioStream) -Function 484: StopAudioStream() (1 input parameters) +Function 486: StopAudioStream() (1 input parameters) Name: StopAudioStream Return type: void Description: Stop audio stream Param[1]: stream (type: AudioStream) -Function 485: SetAudioStreamVolume() (2 input parameters) +Function 487: SetAudioStreamVolume() (2 input parameters) Name: SetAudioStreamVolume Return type: void Description: Set volume for audio stream (1.0 is max level) Param[1]: stream (type: AudioStream) Param[2]: volume (type: float) -Function 486: SetAudioStreamPitch() (2 input parameters) +Function 488: SetAudioStreamPitch() (2 input parameters) Name: SetAudioStreamPitch Return type: void Description: Set pitch for audio stream (1.0 is base level) Param[1]: stream (type: AudioStream) Param[2]: pitch (type: float) -Function 487: SetAudioStreamBufferSizeDefault() (1 input parameters) +Function 489: SetAudioStreamBufferSizeDefault() (1 input parameters) Name: SetAudioStreamBufferSizeDefault Return type: void Description: Default size for new audio streams diff --git a/parser/raylib_api.xml b/parser/raylib_api.xml index 87bb4a730..ac37142e7 100644 --- a/parser/raylib_api.xml +++ b/parser/raylib_api.xml @@ -1,59 +1,59 @@ - + - + - + - + - + - + - + - + - + - + @@ -61,14 +61,14 @@ - + - + @@ -76,20 +76,20 @@ - + - + - + @@ -106,30 +106,30 @@ - + - + - + - + - + - + @@ -140,51 +140,51 @@ - + - + - + - + - + - + - + - + - + @@ -196,7 +196,7 @@ - + @@ -208,341 +208,341 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + - - - + + + - - - - + + + + - + @@ -610,6 +610,10 @@ + + + + diff --git a/parser/raylib_parser.c b/parser/raylib_parser.c index 702790984..a4171f807 100644 --- a/parser/raylib_parser.c +++ b/parser/raylib_parser.c @@ -91,7 +91,7 @@ typedef struct FunctionInfo { // Struct info data typedef struct StructInfo { char name[64]; // Struct name - char desc[64]; // Struct type description + char desc[128]; // Struct type description int fieldCount; // Number of fields in the struct char fieldType[MAX_STRUCT_FIELDS][64]; // Field type char fieldName[MAX_STRUCT_FIELDS][64]; // Field name @@ -101,11 +101,11 @@ typedef struct StructInfo { // Enum info data typedef struct EnumInfo { char name[64]; // Enum name - char desc[64]; // Enum description + char desc[128]; // Enum description int valueCount; // Number of values in enumerator char valueName[MAX_ENUM_VALUES][64]; // Value name definition int valueInteger[MAX_ENUM_VALUES]; // Value integer - char valueDesc[MAX_ENUM_VALUES][64]; // Value description + char valueDesc[MAX_ENUM_VALUES][128]; // Value description } EnumInfo; // Output format for parsed data @@ -139,7 +139,7 @@ static void GetDataTypeAndName(const char *typeName, int typeNameLen, char *type static unsigned int TextLength(const char *text); // Get text length in bytes, check for \0 character static bool IsTextEqual(const char *text1, const char *text2, unsigned int count); static void MemoryCopy(void *dest, const void *src, unsigned int count); -static char* CharReplace(char* text, char search, char replace); +static char *EscapeBackslashes(char *text); // Replace '\' by "\\" when exporting to JSON and XML static void ExportParsedData(const char *fileName, int format); // Export parsed data in desired format @@ -164,8 +164,7 @@ int main(int argc, char* argv[]) char **funcLines = (char **)malloc(MAX_FUNCS_TO_PARSE*sizeof(char *)); // Structs data (multiple lines), selected from "buffer" - char **structLines = (char **)malloc(MAX_STRUCTS_TO_PARSE*sizeof(char *)); - for (int i = 0; i < MAX_STRUCTS_TO_PARSE; i++) structLines[i] = (char *)calloc(MAX_STRUCT_LINE_LENGTH, sizeof(char)); + int *structLines = (int *)malloc(MAX_STRUCTS_TO_PARSE*sizeof(int)); // Enums lines pointers, selected from buffer "lines" int *enumLines = (int *)malloc(MAX_ENUMS_TO_PARSE*sizeof(int)); @@ -185,52 +184,34 @@ int main(int argc, char* argv[]) } } - // Read structs data (multiple lines, read directly from buffer) - // TODO: Parse structs data from "lines" instead of "buffer" -> Easier to get struct definition - for (int i = 0; i < length; i++) + // Read struct lines + for (int i = 0; i < linesCount; i++) { - // Read struct data (starting with "typedef struct", ending with '} ... ;') - // NOTE: We read it directly from buffer - if (IsTextEqual(buffer + i, "typedef struct", 14)) + // Find structs (starting with "typedef struct ... {", ending with '} ... ;') + if (IsTextEqual(lines[i], "typedef struct", 14)) { int j = 0; bool validStruct = false; // WARNING: Typedefs between types: typedef Vector4 Quaternion; + // (maybe we could export these too?) - for (int c = 0; c < 128; c++) + for (int c = 0; c < MAX_LINE_LENGTH; c++) { - if (buffer[i + c] == '{') + char v = lines[i][c]; + if (v == '{') validStruct = true; + if (v == '{' || v == ';' || v == '\0') { - validStruct = true; - break; - } - else if (buffer[i + c] == ';') - { - // Not valid struct: + // Not valid struct if it ends without '{': // i.e typedef struct rAudioBuffer rAudioBuffer; -> Typedef and forward declaration - i += c; break; } } - - if (validStruct) - { - while (buffer[i + j] != '}') - { - structLines[structCount][j] = buffer[i + j]; - j++; - } - - while (buffer[i + j] != '\n') - { - structLines[structCount][j] = buffer[i + j]; - j++; - } - - i += j; - structCount++; - } + if (!validStruct) continue; + structLines[structCount] = i; + while (lines[i][0] != '}') i++; + while (lines[i][0] != '\0') i++; + structCount++; } } @@ -259,42 +240,36 @@ int main(int argc, char* argv[]) for (int i = 0; i < structCount; i++) { - int structLineOffset = 0; + char **linesPtr = &lines[structLines[i]]; + + // Parse struct description + if (linesPtr[-1][0] == '/') + { + MemoryCopy(structs[i].desc, linesPtr[-1], TextLength(linesPtr[-1])); + } // Get struct name: typedef struct name { - for (int c = 15; c < 64 + 15; c++) + const int TDS_LEN = 15; // length of "typedef struct " + for (int c = TDS_LEN; c < 64 + TDS_LEN; c++) { - if (structLines[i][c] == '{') + if (linesPtr[0][c] == '{') { - structLineOffset = c + 2; - - MemoryCopy(structs[i].name, &structLines[i][15], c - 15 - 1); + MemoryCopy(structs[i].name, &linesPtr[0][TDS_LEN], c - TDS_LEN - 1); break; } } // Get struct fields and count them -> fields finish with ; - int j = 0; - while (structLines[i][structLineOffset + j] != '}') + int l = 1; + while (linesPtr[l][0] != '}') { // WARNING: Some structs have empty spaces and comments -> OK, processed - - int fieldStart = 0; - if ((structLines[i][structLineOffset + j] != ' ') && (structLines[i][structLineOffset + j] != '\n')) fieldStart = structLineOffset + j; - - if (fieldStart != 0) + if ((linesPtr[l][0] != ' ') && (linesPtr[l][0] != '\0')) { // Scan one field line - int c = 0; + char *fieldLine = linesPtr[l]; int fieldEndPos = 0; - char fieldLine[256] = { 0 }; - - while (structLines[i][structLineOffset + j] != '\n') - { - if (structLines[i][structLineOffset + j] == ';') fieldEndPos = c; - fieldLine[c] = structLines[i][structLineOffset + j]; - c++; j++; - } + while (fieldLine[fieldEndPos] != ';') fieldEndPos++; if (fieldLine[0] != '/') // Field line is not a comment { @@ -319,12 +294,11 @@ int main(int argc, char* argv[]) } } - j++; + l++; } } - for (int i = 0; i < MAX_STRUCTS_TO_PARSE; i++) free(structLines[i]); free(structLines); // Enum info data @@ -332,7 +306,20 @@ int main(int argc, char* argv[]) for (int i = 0; i < enumCount; i++) { - // TODO: Get enum description from lines[enumLines[i] - 1] + + // Parse enum description + // NOTE: This is not necessarily from the line immediately before, + // some of the enums have extra lines between the "description" + // and the typedef enum + for (int j = enumLines[i] - 1; j > 0; j--) + { + char *linePtr = lines[j]; + if ((linePtr[0] != '/') || (linePtr[2] != ' ')) + { + MemoryCopy(enums[i].desc, &lines[j + 1][0], sizeof(enums[i].desc) - 1); + break; + } + } for (int j = 1; j < MAX_ENUM_VALUES*2; j++) // Maximum number of lines following enum first line { @@ -367,7 +354,7 @@ int main(int argc, char* argv[]) // '=' -> value is provided // ' ' -> value is equal to previous + 1, there could be a description if not '\0' bool foundValue = false; - while (linePtr[c] != '\0') + while ((linePtr[c] != '\0') && (linePtr[c] != '/')) { if (linePtr[c] == '=') { foundValue = true; break; } c++; @@ -392,11 +379,17 @@ int main(int argc, char* argv[]) else enums[i].valueInteger[enums[i].valueCount] = atoi(integer); } else enums[i].valueInteger[enums[i].valueCount] = (enums[i].valueInteger[enums[i].valueCount - 1] + 1); - - // TODO: Parse value description if any } else enums[i].valueInteger[enums[i].valueCount] = (enums[i].valueInteger[enums[i].valueCount - 1] + 1); + // Look for description or end of line + while ((linePtr[c] != '/') && (linePtr[c] != '\0')) { c++; } + if (linePtr[c] == '/') + { + // Parse value description + MemoryCopy(enums[i].valueDesc[enums[i].valueCount], &linePtr[c], sizeof(enums[0].valueDesc[0]) - c - 1); + } + enums[i].valueCount++; } else if (linePtr[0] == '}') @@ -743,13 +736,27 @@ static bool IsTextEqual(const char *text1, const char *text2, unsigned int count return result; } -// Search and replace a character within a string. -static char* CharReplace(char* text, char search, char replace) +// Escape backslashes in a string, writing the escaped string into a static buffer +static char *EscapeBackslashes(char *text) { - for (int i = 0; text[i] != '\0'; i++) - if (text[i] == search) - text[i] = replace; - return text; + static char buffer[256] = { 0 }; + + int count = 0; + + for (int i = 0; (text[i] != '\0') && (i < 255); i++, count++) + { + buffer[count] = text[i]; + + if (text[i] == '\\') + { + buffer[count + 1] = '\\'; + count++; + } + } + + buffer[count] = '\0'; + + return buffer; } /* @@ -855,14 +862,14 @@ static void ExportParsedData(const char *fileName, int format) { fprintf(outFile, " {\n"); fprintf(outFile, " name = \"%s\",\n", structs[i].name); - fprintf(outFile, " description = \"%s\",\n", structs[i].desc); + fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(structs[i].desc + 3)); fprintf(outFile, " fields = {\n"); for (int f = 0; f < structs[i].fieldCount; f++) { fprintf(outFile, " {\n"); - fprintf(outFile, " name = \"%s\",\n", structs[i].fieldName[f]), - fprintf(outFile, " type = \"%s\",\n", structs[i].fieldType[f]), - fprintf(outFile, " description = \"%s\"\n", structs[i].fieldDesc[f] + 3), + fprintf(outFile, " name = \"%s\",\n", structs[i].fieldName[f]); + fprintf(outFile, " type = \"%s\",\n", structs[i].fieldType[f]); + fprintf(outFile, " description = \"%s\"\n", EscapeBackslashes(structs[i].fieldDesc[f] + 3)); fprintf(outFile, " }"); if (f < structs[i].fieldCount - 1) fprintf(outFile, ",\n"); else fprintf(outFile, "\n"); @@ -880,14 +887,14 @@ static void ExportParsedData(const char *fileName, int format) { fprintf(outFile, " {\n"); fprintf(outFile, " name = \"%s\",\n", enums[i].name); - fprintf(outFile, " description = \"%s\",\n", enums[i].desc + 3); + fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(enums[i].desc + 3)); fprintf(outFile, " values = {\n"); for (int e = 0; e < enums[i].valueCount; e++) { fprintf(outFile, " {\n"); - fprintf(outFile, " name = \"%s\",\n", enums[i].valueName[e]), - fprintf(outFile, " value = %i,\n", enums[i].valueInteger[e]), - fprintf(outFile, " description = \"%s\"\n", enums[i].valueDesc[e] + 3), + fprintf(outFile, " name = \"%s\",\n", enums[i].valueName[e]); + fprintf(outFile, " value = %i,\n", enums[i].valueInteger[e]); + fprintf(outFile, " description = \"%s\"\n", EscapeBackslashes(enums[i].valueDesc[e] + 3)); fprintf(outFile, " }"); if (e < enums[i].valueCount - 1) fprintf(outFile, ",\n"); else fprintf(outFile, "\n"); @@ -905,7 +912,7 @@ static void ExportParsedData(const char *fileName, int format) { fprintf(outFile, " {\n"); fprintf(outFile, " name = \"%s\",\n", funcs[i].name); - fprintf(outFile, " description = \"%s\",\n", CharReplace(funcs[i].desc, '\\', ' ') + 3); + fprintf(outFile, " description = \"%s\",\n", EscapeBackslashes(funcs[i].desc + 3)); fprintf(outFile, " returnType = \"%s\"", funcs[i].retType); if (funcs[i].paramCount == 0) fprintf(outFile, "\n"); @@ -938,14 +945,14 @@ static void ExportParsedData(const char *fileName, int format) { fprintf(outFile, " {\n"); fprintf(outFile, " \"name\": \"%s\",\n", structs[i].name); - fprintf(outFile, " \"description\": \"%s\",\n", structs[i].desc); + fprintf(outFile, " \"description\": \"%s\",\n", EscapeBackslashes(structs[i].desc + 3)); fprintf(outFile, " \"fields\": [\n"); for (int f = 0; f < structs[i].fieldCount; f++) { fprintf(outFile, " {\n"); - fprintf(outFile, " \"name\": \"%s\",\n", structs[i].fieldName[f]), - fprintf(outFile, " \"type\": \"%s\",\n", structs[i].fieldType[f]), - fprintf(outFile, " \"description\": \"%s\"\n", structs[i].fieldDesc[f] + 3), + fprintf(outFile, " \"name\": \"%s\",\n", structs[i].fieldName[f]); + fprintf(outFile, " \"type\": \"%s\",\n", structs[i].fieldType[f]); + fprintf(outFile, " \"description\": \"%s\"\n", EscapeBackslashes(structs[i].fieldDesc[f] + 3)); fprintf(outFile, " }"); if (f < structs[i].fieldCount - 1) fprintf(outFile, ",\n"); else fprintf(outFile, "\n"); @@ -963,14 +970,14 @@ static void ExportParsedData(const char *fileName, int format) { fprintf(outFile, " {\n"); fprintf(outFile, " \"name\": \"%s\",\n", enums[i].name); - fprintf(outFile, " \"description\": \"%s\",\n", enums[i].desc + 3); + fprintf(outFile, " \"description\": \"%s\",\n", EscapeBackslashes(enums[i].desc + 3)); fprintf(outFile, " \"values\": [\n"); for (int e = 0; e < enums[i].valueCount; e++) { fprintf(outFile, " {\n"); - fprintf(outFile, " \"name\": \"%s\",\n", enums[i].valueName[e]), - fprintf(outFile, " \"value\": %i,\n", enums[i].valueInteger[e]), - fprintf(outFile, " \"description\": \"%s\"\n", enums[i].valueDesc[e] + 3), + fprintf(outFile, " \"name\": \"%s\",\n", enums[i].valueName[e]); + fprintf(outFile, " \"value\": %i,\n", enums[i].valueInteger[e]); + fprintf(outFile, " \"description\": \"%s\"\n", EscapeBackslashes(enums[i].valueDesc[e] + 3)); fprintf(outFile, " }"); if (e < enums[i].valueCount - 1) fprintf(outFile, ",\n"); else fprintf(outFile, "\n"); @@ -988,7 +995,7 @@ static void ExportParsedData(const char *fileName, int format) { fprintf(outFile, " {\n"); fprintf(outFile, " \"name\": \"%s\",\n", funcs[i].name); - fprintf(outFile, " \"description\": \"%s\",\n", CharReplace(funcs[i].desc, '\\', ' ') + 3); + fprintf(outFile, " \"description\": \"%s\",\n", EscapeBackslashes(funcs[i].desc + 3)); fprintf(outFile, " \"returnType\": \"%s\"", funcs[i].retType); if (funcs[i].paramCount == 0) fprintf(outFile, "\n"); diff --git a/projects/VSCode/.vscode/c_cpp_properties.json b/projects/VSCode/.vscode/c_cpp_properties.json index c4096b3d1..cbdb51941 100644 --- a/projects/VSCode/.vscode/c_cpp_properties.json +++ b/projects/VSCode/.vscode/c_cpp_properties.json @@ -52,7 +52,7 @@ "GRAPHICS_API_OPENGL_33", "PLATFORM_DESKTOP" ], - "compilerPath": "usr/bin/clang", + "compilerPath": "/usr/bin/clang", "cStandard": "c11", "cppStandard": "c++14", "intelliSenseMode": "clang-x64" diff --git a/src/Makefile b/src/Makefile index 53d4e7680..1d7c25422 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,7 +15,7 @@ # Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline. # Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline. # -# Copyright (c) 2014-2019 Ramon Santamaria (@raysan5) +# Copyright (c) 2014-2021 Ramon Santamaria (@raysan5) # # This software is provided "as-is", without any express or implied warranty. # In no event will the authors be held liable for any damages arising from @@ -65,10 +65,17 @@ RAYLIB_LIB_NAME ?= raylib # Define resource file for DLL properties RAYLIB_RES_FILE ?= ./raylib.dll.rc.data +# Define external config flags +# NOTE: It will override config.h flags with the provided ones, +# if NONE, default config.h flags are used +RAYLIB_CONFIG_FLAGS ?= NONE + # Define raylib platform # Options: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB PLATFORM ?= PLATFORM_DESKTOP +# To define additional cflags: Use make CUSTOM_CFLAGS="" + # Include raylib modules on compilation # NOTE: Some programs like tools could not require those modules RAYLIB_MODULE_AUDIO ?= TRUE @@ -144,16 +151,6 @@ ifeq ($(PLATFORM),PLATFORM_DRM) endif endif -# RAYLIB_SRC_PATH adjustment for different platforms. -# If using GNU make, we can get the full path to the top of the tree. Windows? BSD? -# Required for ldconfig or other tools that do not perform path expansion. -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - RAYLIB_PREFIX ?= .. - RAYLIB_SRC_PATH = $(realpath $(RAYLIB_PREFIX)) - endif -endif - ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables EMSDK_PATH ?= C:/emsdk @@ -280,7 +277,11 @@ endif # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers # -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing) -CFLAGS += -Wall -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing +CFLAGS = -Wall -D_DEFAULT_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing $(CUSTOM_CFLAGS) + +ifneq ($(RAYLIB_CONFIG_FLAGS), NONE) + CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS) +endif ifeq ($(PLATFORM), PLATFORM_WEB) CFLAGS += -std=gnu99 @@ -293,7 +294,7 @@ ifeq ($(PLATFORM_OS), LINUX) endif ifeq ($(RAYLIB_BUILD_MODE),DEBUG) - CFLAGS += -g + CFLAGS += -g -D_DEBUG endif ifeq ($(RAYLIB_BUILD_MODE),RELEASE) @@ -367,14 +368,11 @@ ifeq ($(PLATFORM),PLATFORM_DRM) # which contains a conflicting type Font CFLAGS += -DEGL_NO_X11 endif - # Use Wayland display on Linux desktop ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS), LINUX) ifeq ($(USE_WAYLAND_DISPLAY),TRUE) CFLAGS += -D_GLFW_WAYLAND - else - LDLIBS = -lX11 endif endif endif @@ -383,19 +381,12 @@ endif # NOTE: Several external required libraries (stb and others) INCLUDE_PATHS = -I. -Iexternal/glfw/include -Iexternal/glfw/deps/mingw +# Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),BSD) INCLUDE_PATHS += -I/usr/local/include - LDFLAGS += -L. -Lsrc -L/usr/local/lib -L$(RAYLIB_RELEASE_PATH) - endif - ifeq ($(USE_EXTERNAL_GLFW),TRUE) - # Check the version name. If GLFW3 was built manually, it may have produced - # a static library known as libglfw3.a. In that case, the name should be -lglfw3 - LDFLAGS += -lglfw endif endif - -# Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) # RPI required libraries INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include @@ -427,18 +418,71 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) endif endif -# Define linker options +# Define linker flags (required for dynamic library generation) +LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) + +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),WINDOWS) + LDFLAGS += -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME)dll.a + endif + ifeq ($(PLATFORM_OS),OSX) + LDFLAGS += -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) + endif + ifeq ($(PLATFORM_OS),LINUX) + LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) + endif + ifeq ($(PLATFORM_OS),BSD) + LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -Lsrc -L/usr/local/lib + endif +endif +ifeq ($(PLATFORM),PLATFORM_RPI) + LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib +endif +ifeq ($(PLATFORM),PLATFORM_DRM) + LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) +endif ifeq ($(PLATFORM),PLATFORM_ANDROID) LDFLAGS += -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a LDFLAGS += -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings # Force linking of library module to define symbol LDFLAGS += -u ANativeActivity_onCreate # Library paths containing required libs - LDFLAGS += -L. -Lsrc -L$(RAYLIB_RELEASE_PATH) + LDFLAGS += -Lsrc # Avoid unresolved symbol pointing to external main() LDFLAGS += -Wl,-undefined,dynamic_lookup +endif - LDLIBS += -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm +# Define linker libraries (required for dynamic library generation) +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),WINDOWS) + LDLIBS = -static-libgcc -lopengl32 -lgdi32 -lwinmm + endif + ifeq ($(PLATFORM_OS),LINUX) + LDLIBS = -lGL -lc -lm -lpthread -ldl -lrt + ifeq ($(USE_WAYLAND_DISPLAY),FALSE) + LDLIBS += -lX11 + endif + endif + ifeq ($(PLATFORM_OS),OSX) + LDLIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo + endif + ifeq ($(PLATFORM_OS),BSD) + LDLIBS = -lGL -lpthread + endif + ifeq ($(USE_EXTERNAL_GLFW),TRUE) + # Check the version name. If GLFW3 was built manually, it may have produced + # a static library known as libglfw3.a. In that case, the name should be -lglfw3 + LDLIBS = -lglfw + endif +endif +ifeq ($(PLATFORM),PLATFORM_RPI) + LDLIBS = -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl +endif +ifeq ($(PLATFORM),PLATFORM_DRM) + LDLIBS = -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl +endif +ifeq ($(PLATFORM),PLATFORM_ANDROID) + LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm endif # Define all object files required with a wildcard @@ -492,19 +536,19 @@ else ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) # NOTE: Linking with provided resource file - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME)dll.a + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS) @echo "raylib dynamic library ($(RAYLIB_LIB_NAME).dll) and import library (lib$(RAYLIB_LIB_NAME)dll.a) generated!" endif ifeq ($(PLATFORM_OS),LINUX) # Compile raylib shared library version $(RAYLIB_VERSION). # WARNING: you should type "make clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -lGL -lc -lm -lpthread -ldl -lrt $(LDLIBS) + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so endif ifeq ($(PLATFORM_OS),OSX) - $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib $(OBJS) $(LDFLAGS) -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo + $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib $(OBJS) $(LDFLAGS) $(LDLIBS) install_name_tool -id "@rpath/lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib" $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib)!" cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib @@ -512,7 +556,7 @@ else endif ifeq ($(PLATFORM_OS),BSD) # WARNING: you should type "gmake clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -lGL -lpthread + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!" cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so @@ -521,7 +565,7 @@ else ifeq ($(PLATFORM),PLATFORM_RPI) # Compile raylib shared library version $(RAYLIB_VERSION). # WARNING: you should type "make clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -L/opt/vc/lib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so @@ -529,7 +573,7 @@ else ifeq ($(PLATFORM),PLATFORM_DRM) # Compile raylib shared library version $(RAYLIB_VERSION). # WARNING: you should type "make clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so @@ -555,40 +599,40 @@ endif # Compile core module rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile rglfw module rglfw.o : rglfw.c - $(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile shapes module rshapes.o : rshapes.c raylib.h rlgl.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile textures module rtextures.o : rtextures.c raylib.h rlgl.h utils.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile text module rtext.o : rtext.c raylib.h utils.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile utils module utils.o : utils.c utils.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile models module rmodels.o : rmodels.c raylib.h rlgl.h raymath.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile audio module raudio.o : raudio.c raylib.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) # Compile raygui module # NOTE: raygui header should be distributed with raylib.h raygui.o : raygui.c - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -DRAYGUI_IMPLEMENTATION + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) raygui.c: echo #define RAYGUI_IMPLEMENTATION > raygui.c echo #include "$(RAYLIB_MODULE_RAYGUI_PATH)/raygui.h" >> raygui.c @@ -596,7 +640,7 @@ raygui.c: # Compile physac module # NOTE: physac header should be distributed with raylib.h physac.o : physac.c - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -DPHYSAC_IMPLEMENTATION + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) physac.c: @echo #define PHYSAC_IMPLEMENTATION > physac.c @echo #include "$(RAYLIB_MODULE_PHYSAC_PATH)/physac.h" >> physac.c @@ -616,7 +660,6 @@ android_native_app_glue.o : $(NATIVE_APP_GLUE)/android_native_app_glue.c # for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig. # HINT: Add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles. # See below and ../examples/Makefile for more information. -# TODO: Add other platforms. Remove sudo requirement, i.e. add USER mode. # RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths. DESTDIR ?= /usr/local diff --git a/src/build.zig b/src/build.zig index 6bdae0f96..76d4a6611 100644 --- a/src/build.zig +++ b/src/build.zig @@ -28,7 +28,6 @@ pub fn build(b: *std.build.Builder) void { raylib.addCSourceFiles(&.{ "raudio.c", "rcore.c", - "rglfw.c", "rmodels.c", "rshapes.c", "rtext.c", @@ -38,18 +37,31 @@ pub fn build(b: *std.build.Builder) void { switch (raylib.target.toTarget().os.tag) { .windows => { + raylib.addCSourceFiles(&.{"rglfw.c"}, raylib_flags); raylib.linkSystemLibrary("winmm"); raylib.linkSystemLibrary("gdi32"); raylib.linkSystemLibrary("opengl32"); raylib.addIncludeDir("external/glfw/deps/mingw"); }, .linux => { + raylib.addCSourceFiles(&.{"rglfw.c"}, raylib_flags); raylib.linkSystemLibrary("GL"); raylib.linkSystemLibrary("rt"); raylib.linkSystemLibrary("dl"); raylib.linkSystemLibrary("m"); raylib.linkSystemLibrary("X11"); }, + .macos => { + // On macos rglfw.c include Objective-C files. + const raylib_flags_extra_macos = &[_][]const u8{ + "-ObjC", + }; + raylib.addCSourceFiles( + &.{"rglfw.c"}, + raylib_flags ++ raylib_flags_extra_macos, + ); + raylib.linkFramework("Foundation"); + }, else => { @panic("Unsupported OS"); }, diff --git a/src/config.h b/src/config.h index d3678180c..ac26a5c47 100644 --- a/src/config.h +++ b/src/config.h @@ -26,7 +26,17 @@ **********************************************************************************************/ //------------------------------------------------------------------------------------ -// Module: core - Configuration Flags +// Module selection - Some modules could be avoided +// Mandatory modules: rcore, rlgl, utils +//------------------------------------------------------------------------------------ +#define SUPPORT_MODULE_RSHAPES 1 +#define SUPPORT_MODULE_RTEXTURES 1 +#define SUPPORT_MODULE_RTEXT 1 // WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures +#define SUPPORT_MODULE_RMODELS 1 +#define SUPPORT_MODULE_RAUDIO 1 + +//------------------------------------------------------------------------------------ +// Module: rcore - Configuration Flags //------------------------------------------------------------------------------------ // Camera module is included (rcamera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital #define SUPPORT_CAMERA_SYSTEM 1 @@ -62,7 +72,7 @@ // Enabling this flag allows manual control of the frame processes, use at your own risk //#define SUPPORT_CUSTOM_FRAME_CONTROL 1 -// core: Configuration values +// rcore: Configuration values //------------------------------------------------------------------------------------ #if defined(__linux__) #define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value) @@ -127,7 +137,7 @@ //------------------------------------------------------------------------------------ -// Module: shapes - Configuration Flags +// Module: rshapes - Configuration Flags //------------------------------------------------------------------------------------ // Use QUADS instead of TRIANGLES for drawing when possible // Some lines-based shapes could still use lines @@ -135,7 +145,7 @@ //------------------------------------------------------------------------------------ -// Module: textures - Configuration Flags +// Module: rtextures - Configuration Flags //------------------------------------------------------------------------------------ // Selecte desired fileformats to be supported for image data loading #define SUPPORT_FILEFORMAT_PNG 1 @@ -143,6 +153,7 @@ //#define SUPPORT_FILEFORMAT_TGA 1 //#define SUPPORT_FILEFORMAT_JPG 1 #define SUPPORT_FILEFORMAT_GIF 1 +#define SUPPORT_FILEFORMAT_QOI 1 //#define SUPPORT_FILEFORMAT_PSD 1 #define SUPPORT_FILEFORMAT_DDS 1 #define SUPPORT_FILEFORMAT_HDR 1 @@ -151,7 +162,7 @@ //#define SUPPORT_FILEFORMAT_PKM 1 //#define SUPPORT_FILEFORMAT_PVR 1 -// Support image export functionality (.png, .bmp, .tga, .jpg) +// Support image export functionality (.png, .bmp, .tga, .jpg, .qoi) #define SUPPORT_IMAGE_EXPORT 1 // Support procedural image generation functionality (gradient, spot, perlin-noise, cellular) #define SUPPORT_IMAGE_GENERATION 1 @@ -161,7 +172,7 @@ //------------------------------------------------------------------------------------ -// Module: text - Configuration Flags +// Module: rtext - Configuration Flags //------------------------------------------------------------------------------------ // Default font is loaded on window initialization to be available for the user to render simple text // NOTE: If enabled, uses external module functions to load default raylib font @@ -174,7 +185,7 @@ // If not defined, still some functions are supported: TextLength(), TextFormat() #define SUPPORT_TEXT_MANIPULATION 1 -// text: Configuration values +// rtext: Configuration values //------------------------------------------------------------------------------------ #define MAX_TEXT_BUFFER_LENGTH 1024 // Size of internal static buffers used on some functions: // TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit() @@ -182,7 +193,7 @@ //------------------------------------------------------------------------------------ -// Module: models - Configuration Flags +// Module: rmodels - Configuration Flags //------------------------------------------------------------------------------------ // Selected desired model fileformats to be supported for loading #define SUPPORT_FILEFORMAT_OBJ 1 @@ -194,13 +205,13 @@ // NOTE: Some generated meshes DO NOT include generated texture coordinates #define SUPPORT_MESH_GENERATION 1 -// models: Configuration values +// rmodels: Configuration values //------------------------------------------------------------------------------------ #define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported #define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh //------------------------------------------------------------------------------------ -// Module: audio - Configuration Flags +// Module: raudio - Configuration Flags //------------------------------------------------------------------------------------ // Desired audio fileformats to be supported for loading #define SUPPORT_FILEFORMAT_WAV 1 @@ -210,7 +221,7 @@ #define SUPPORT_FILEFORMAT_MP3 1 //#define SUPPORT_FILEFORMAT_FLAC 1 -// audio: Configuration values +// raudio: Configuration values //------------------------------------------------------------------------------------ #define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit) #define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo diff --git a/src/external/dr_wav.h b/src/external/dr_wav.h index ef1f803e4..a119d66af 100644 --- a/src/external/dr_wav.h +++ b/src/external/dr_wav.h @@ -1,6 +1,6 @@ /* WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file. -dr_wav - v0.13.3 - TBD +dr_wav - v0.13.4 - 2021-12-08 David Reid - mackron@gmail.com @@ -125,7 +125,7 @@ extern "C" { #define DRWAV_VERSION_MAJOR 0 #define DRWAV_VERSION_MINOR 13 -#define DRWAV_VERSION_REVISION 2 +#define DRWAV_VERSION_REVISION 4 #define DRWAV_VERSION_STRING DRWAV_XSTRINGIFY(DRWAV_VERSION_MAJOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_MINOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_REVISION) #include /* For size_t. */ @@ -1335,6 +1335,7 @@ DRWAV_API drwav_bool32 drwav_fourcc_equal(const drwav_uint8* a, const char* b); #define drwav_min(a, b) (((a) < (b)) ? (a) : (b)) #define drwav_max(a, b) (((a) > (b)) ? (a) : (b)) #define drwav_clamp(x, lo, hi) (drwav_max((lo), drwav_min((hi), (x)))) +#define drwav_offset_ptr(p, offset) (((drwav_uint8*)(p)) + (offset)) #define DRWAV_MAX_SIMD_VECTOR_SIZE 64 /* 64 for AVX-512 in the future. */ @@ -2166,13 +2167,14 @@ DRWAV_PRIVATE size_t drwav__metadata_parser_read(drwav__metadata_parser* pParser } } -DRWAV_PRIVATE drwav_uint64 drwav__read_smpl_to_metadata_obj(drwav__metadata_parser* pParser, drwav_metadata* pMetadata) +DRWAV_PRIVATE drwav_uint64 drwav__read_smpl_to_metadata_obj(drwav__metadata_parser* pParser, const drwav_chunk_header* pChunkHeader, drwav_metadata* pMetadata) { drwav_uint8 smplHeaderData[DRWAV_SMPL_BYTES]; drwav_uint64 totalBytesRead = 0; size_t bytesJustRead = drwav__metadata_parser_read(pParser, smplHeaderData, sizeof(smplHeaderData), &totalBytesRead); DRWAV_ASSERT(pParser->stage == drwav__metadata_parser_stage_read); + DRWAV_ASSERT(pChunkHeader != NULL); if (bytesJustRead == sizeof(smplHeaderData)) { drwav_uint32 iSampleLoop; @@ -2187,36 +2189,43 @@ DRWAV_PRIVATE drwav_uint64 drwav__read_smpl_to_metadata_obj(drwav__metadata_pars pMetadata->data.smpl.smpteOffset = drwav_bytes_to_u32(smplHeaderData + 24); pMetadata->data.smpl.sampleLoopCount = drwav_bytes_to_u32(smplHeaderData + 28); pMetadata->data.smpl.samplerSpecificDataSizeInBytes = drwav_bytes_to_u32(smplHeaderData + 32); - pMetadata->data.smpl.pLoops = (drwav_smpl_loop*)drwav__metadata_get_memory(pParser, sizeof(drwav_smpl_loop) * pMetadata->data.smpl.sampleLoopCount, DRWAV_METADATA_ALIGNMENT); - for (iSampleLoop = 0; iSampleLoop < pMetadata->data.smpl.sampleLoopCount; ++iSampleLoop) { - drwav_uint8 smplLoopData[DRWAV_SMPL_LOOP_BYTES]; - bytesJustRead = drwav__metadata_parser_read(pParser, smplLoopData, sizeof(smplLoopData), &totalBytesRead); + /* + The loop count needs to be validated against the size of the chunk for safety so we don't + attempt to read over the boundary of the chunk. + */ + if (pMetadata->data.smpl.sampleLoopCount == (pChunkHeader->sizeInBytes - DRWAV_SMPL_BYTES) / DRWAV_SMPL_LOOP_BYTES) { + pMetadata->data.smpl.pLoops = (drwav_smpl_loop*)drwav__metadata_get_memory(pParser, sizeof(drwav_smpl_loop) * pMetadata->data.smpl.sampleLoopCount, DRWAV_METADATA_ALIGNMENT); - if (bytesJustRead == sizeof(smplLoopData)) { - pMetadata->data.smpl.pLoops[iSampleLoop].cuePointId = drwav_bytes_to_u32(smplLoopData + 0); - pMetadata->data.smpl.pLoops[iSampleLoop].type = drwav_bytes_to_u32(smplLoopData + 4); - pMetadata->data.smpl.pLoops[iSampleLoop].firstSampleByteOffset = drwav_bytes_to_u32(smplLoopData + 8); - pMetadata->data.smpl.pLoops[iSampleLoop].lastSampleByteOffset = drwav_bytes_to_u32(smplLoopData + 12); - pMetadata->data.smpl.pLoops[iSampleLoop].sampleFraction = drwav_bytes_to_u32(smplLoopData + 16); - pMetadata->data.smpl.pLoops[iSampleLoop].playCount = drwav_bytes_to_u32(smplLoopData + 20); - } else { - break; + for (iSampleLoop = 0; iSampleLoop < pMetadata->data.smpl.sampleLoopCount; ++iSampleLoop) { + drwav_uint8 smplLoopData[DRWAV_SMPL_LOOP_BYTES]; + bytesJustRead = drwav__metadata_parser_read(pParser, smplLoopData, sizeof(smplLoopData), &totalBytesRead); + + if (bytesJustRead == sizeof(smplLoopData)) { + pMetadata->data.smpl.pLoops[iSampleLoop].cuePointId = drwav_bytes_to_u32(smplLoopData + 0); + pMetadata->data.smpl.pLoops[iSampleLoop].type = drwav_bytes_to_u32(smplLoopData + 4); + pMetadata->data.smpl.pLoops[iSampleLoop].firstSampleByteOffset = drwav_bytes_to_u32(smplLoopData + 8); + pMetadata->data.smpl.pLoops[iSampleLoop].lastSampleByteOffset = drwav_bytes_to_u32(smplLoopData + 12); + pMetadata->data.smpl.pLoops[iSampleLoop].sampleFraction = drwav_bytes_to_u32(smplLoopData + 16); + pMetadata->data.smpl.pLoops[iSampleLoop].playCount = drwav_bytes_to_u32(smplLoopData + 20); + } else { + break; + } } - } - if (pMetadata->data.smpl.samplerSpecificDataSizeInBytes > 0) { - pMetadata->data.smpl.pSamplerSpecificData = drwav__metadata_get_memory(pParser, pMetadata->data.smpl.samplerSpecificDataSizeInBytes, 1); - DRWAV_ASSERT(pMetadata->data.smpl.pSamplerSpecificData != NULL); + if (pMetadata->data.smpl.samplerSpecificDataSizeInBytes > 0) { + pMetadata->data.smpl.pSamplerSpecificData = drwav__metadata_get_memory(pParser, pMetadata->data.smpl.samplerSpecificDataSizeInBytes, 1); + DRWAV_ASSERT(pMetadata->data.smpl.pSamplerSpecificData != NULL); - drwav__metadata_parser_read(pParser, pMetadata->data.smpl.pSamplerSpecificData, pMetadata->data.smpl.samplerSpecificDataSizeInBytes, &totalBytesRead); + drwav__metadata_parser_read(pParser, pMetadata->data.smpl.pSamplerSpecificData, pMetadata->data.smpl.samplerSpecificDataSizeInBytes, &totalBytesRead); + } } } return totalBytesRead; } -DRWAV_PRIVATE drwav_uint64 drwav__read_cue_to_metadata_obj(drwav__metadata_parser* pParser, drwav_metadata* pMetadata) +DRWAV_PRIVATE drwav_uint64 drwav__read_cue_to_metadata_obj(drwav__metadata_parser* pParser, const drwav_chunk_header* pChunkHeader, drwav_metadata* pMetadata) { drwav_uint8 cueHeaderSectionData[DRWAV_CUE_BYTES]; drwav_uint64 totalBytesRead = 0; @@ -2227,28 +2236,35 @@ DRWAV_PRIVATE drwav_uint64 drwav__read_cue_to_metadata_obj(drwav__metadata_parse if (bytesJustRead == sizeof(cueHeaderSectionData)) { pMetadata->type = drwav_metadata_type_cue; pMetadata->data.cue.cuePointCount = drwav_bytes_to_u32(cueHeaderSectionData); - pMetadata->data.cue.pCuePoints = (drwav_cue_point*)drwav__metadata_get_memory(pParser, sizeof(drwav_cue_point) * pMetadata->data.cue.cuePointCount, DRWAV_METADATA_ALIGNMENT); - DRWAV_ASSERT(pMetadata->data.cue.pCuePoints != NULL); - if (pMetadata->data.cue.cuePointCount > 0) { - drwav_uint32 iCuePoint; + /* + We need to validate the cue point count against the size of the chunk so we don't read + beyond the chunk. + */ + if (pMetadata->data.cue.cuePointCount == (pChunkHeader->sizeInBytes - DRWAV_CUE_BYTES) / DRWAV_CUE_POINT_BYTES) { + pMetadata->data.cue.pCuePoints = (drwav_cue_point*)drwav__metadata_get_memory(pParser, sizeof(drwav_cue_point) * pMetadata->data.cue.cuePointCount, DRWAV_METADATA_ALIGNMENT); + DRWAV_ASSERT(pMetadata->data.cue.pCuePoints != NULL); - for (iCuePoint = 0; iCuePoint < pMetadata->data.cue.cuePointCount; ++iCuePoint) { - drwav_uint8 cuePointData[DRWAV_CUE_POINT_BYTES]; - bytesJustRead = drwav__metadata_parser_read(pParser, cuePointData, sizeof(cuePointData), &totalBytesRead); + if (pMetadata->data.cue.cuePointCount > 0) { + drwav_uint32 iCuePoint; - if (bytesJustRead == sizeof(cuePointData)) { - pMetadata->data.cue.pCuePoints[iCuePoint].id = drwav_bytes_to_u32(cuePointData + 0); - pMetadata->data.cue.pCuePoints[iCuePoint].playOrderPosition = drwav_bytes_to_u32(cuePointData + 4); - pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[0] = cuePointData[8]; - pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[1] = cuePointData[9]; - pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[2] = cuePointData[10]; - pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[3] = cuePointData[11]; - pMetadata->data.cue.pCuePoints[iCuePoint].chunkStart = drwav_bytes_to_u32(cuePointData + 12); - pMetadata->data.cue.pCuePoints[iCuePoint].blockStart = drwav_bytes_to_u32(cuePointData + 16); - pMetadata->data.cue.pCuePoints[iCuePoint].sampleByteOffset = drwav_bytes_to_u32(cuePointData + 20); - } else { - break; + for (iCuePoint = 0; iCuePoint < pMetadata->data.cue.cuePointCount; ++iCuePoint) { + drwav_uint8 cuePointData[DRWAV_CUE_POINT_BYTES]; + bytesJustRead = drwav__metadata_parser_read(pParser, cuePointData, sizeof(cuePointData), &totalBytesRead); + + if (bytesJustRead == sizeof(cuePointData)) { + pMetadata->data.cue.pCuePoints[iCuePoint].id = drwav_bytes_to_u32(cuePointData + 0); + pMetadata->data.cue.pCuePoints[iCuePoint].playOrderPosition = drwav_bytes_to_u32(cuePointData + 4); + pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[0] = cuePointData[8]; + pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[1] = cuePointData[9]; + pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[2] = cuePointData[10]; + pMetadata->data.cue.pCuePoints[iCuePoint].dataChunkId[3] = cuePointData[11]; + pMetadata->data.cue.pCuePoints[iCuePoint].chunkStart = drwav_bytes_to_u32(cuePointData + 12); + pMetadata->data.cue.pCuePoints[iCuePoint].blockStart = drwav_bytes_to_u32(cuePointData + 16); + pMetadata->data.cue.pCuePoints[iCuePoint].sampleByteOffset = drwav_bytes_to_u32(cuePointData + 20); + } else { + break; + } } } } @@ -2300,7 +2316,7 @@ DRWAV_PRIVATE drwav_uint64 drwav__read_acid_to_metadata_obj(drwav__metadata_pars return bytesRead; } -DRWAV_PRIVATE size_t drwav__strlen_clamped(char* str, size_t maxToRead) +DRWAV_PRIVATE size_t drwav__strlen_clamped(const char* str, size_t maxToRead) { size_t result = 0; @@ -2311,7 +2327,7 @@ DRWAV_PRIVATE size_t drwav__strlen_clamped(char* str, size_t maxToRead) return result; } -DRWAV_PRIVATE char* drwav__metadata_copy_string(drwav__metadata_parser* pParser, char* str, size_t maxToRead) +DRWAV_PRIVATE char* drwav__metadata_copy_string(drwav__metadata_parser* pParser, const char* str, size_t maxToRead) { size_t len = drwav__strlen_clamped(str, maxToRead); @@ -2328,77 +2344,183 @@ DRWAV_PRIVATE char* drwav__metadata_copy_string(drwav__metadata_parser* pParser, } } +typedef struct +{ + const void* pBuffer; + size_t sizeInBytes; + size_t cursor; +} drwav_buffer_reader; + +DRWAV_PRIVATE drwav_result drwav_buffer_reader_init(const void* pBuffer, size_t sizeInBytes, drwav_buffer_reader* pReader) +{ + DRWAV_ASSERT(pBuffer != NULL); + DRWAV_ASSERT(pReader != NULL); + + DRWAV_ZERO_OBJECT(pReader); + + pReader->pBuffer = pBuffer; + pReader->sizeInBytes = sizeInBytes; + pReader->cursor = 0; + + return DRWAV_SUCCESS; +} + +DRWAV_PRIVATE const void* drwav_buffer_reader_ptr(const drwav_buffer_reader* pReader) +{ + DRWAV_ASSERT(pReader != NULL); + + return drwav_offset_ptr(pReader->pBuffer, pReader->cursor); +} + +DRWAV_PRIVATE drwav_result drwav_buffer_reader_seek(drwav_buffer_reader* pReader, size_t bytesToSeek) +{ + DRWAV_ASSERT(pReader != NULL); + + if (pReader->cursor + bytesToSeek > pReader->sizeInBytes) { + return DRWAV_BAD_SEEK; /* Seeking too far forward. */ + } + + pReader->cursor += bytesToSeek; + + return DRWAV_SUCCESS; +} + +DRWAV_PRIVATE drwav_result drwav_buffer_reader_read(drwav_buffer_reader* pReader, void* pDst, size_t bytesToRead, size_t* pBytesRead) +{ + drwav_result result = DRWAV_SUCCESS; + size_t bytesRemaining; + + DRWAV_ASSERT(pReader != NULL); + + if (pBytesRead != NULL) { + *pBytesRead = 0; + } + + bytesRemaining = (pReader->sizeInBytes - pReader->cursor); + if (bytesToRead > bytesRemaining) { + bytesToRead = bytesRemaining; + } + + if (pDst == NULL) { + /* Seek. */ + result = drwav_buffer_reader_seek(pReader, bytesToRead); + } else { + /* Read. */ + DRWAV_COPY_MEMORY(pDst, drwav_buffer_reader_ptr(pReader), bytesToRead); + pReader->cursor += bytesToRead; + } + + DRWAV_ASSERT(pReader->cursor <= pReader->sizeInBytes); + + if (result == DRWAV_SUCCESS) { + if (pBytesRead != NULL) { + *pBytesRead = bytesToRead; + } + } + + return DRWAV_SUCCESS; +} + +DRWAV_PRIVATE drwav_result drwav_buffer_reader_read_u16(drwav_buffer_reader* pReader, drwav_uint16* pDst) +{ + drwav_result result; + size_t bytesRead; + drwav_uint8 data[2]; + + DRWAV_ASSERT(pReader != NULL); + DRWAV_ASSERT(pDst != NULL); + + *pDst = 0; /* Safety. */ + + result = drwav_buffer_reader_read(pReader, data, sizeof(*pDst), &bytesRead); + if (result != DRWAV_SUCCESS || bytesRead != sizeof(*pDst)) { + return result; + } + + *pDst = drwav_bytes_to_u16(data); + + return DRWAV_SUCCESS; +} + +DRWAV_PRIVATE drwav_result drwav_buffer_reader_read_u32(drwav_buffer_reader* pReader, drwav_uint32* pDst) +{ + drwav_result result; + size_t bytesRead; + drwav_uint8 data[4]; + + DRWAV_ASSERT(pReader != NULL); + DRWAV_ASSERT(pDst != NULL); + + *pDst = 0; /* Safety. */ + + result = drwav_buffer_reader_read(pReader, data, sizeof(*pDst), &bytesRead); + if (result != DRWAV_SUCCESS || bytesRead != sizeof(*pDst)) { + return result; + } + + *pDst = drwav_bytes_to_u32(data); + + return DRWAV_SUCCESS; +} + + + DRWAV_PRIVATE drwav_uint64 drwav__read_bext_to_metadata_obj(drwav__metadata_parser* pParser, drwav_metadata* pMetadata, drwav_uint64 chunkSize) { drwav_uint8 bextData[DRWAV_BEXT_BYTES]; - drwav_uint64 bytesRead = drwav__metadata_parser_read(pParser, bextData, sizeof(bextData), NULL); + size_t bytesRead = drwav__metadata_parser_read(pParser, bextData, sizeof(bextData), NULL); DRWAV_ASSERT(pParser->stage == drwav__metadata_parser_stage_read); if (bytesRead == sizeof(bextData)) { - drwav_uint8* pReadPointer; + drwav_buffer_reader reader; drwav_uint32 timeReferenceLow; drwav_uint32 timeReferenceHigh; size_t extraBytes; pMetadata->type = drwav_metadata_type_bext; - pReadPointer = bextData; - pMetadata->data.bext.pDescription = drwav__metadata_copy_string(pParser, (char*)(pReadPointer), DRWAV_BEXT_DESCRIPTION_BYTES); - pReadPointer += DRWAV_BEXT_DESCRIPTION_BYTES; + if (drwav_buffer_reader_init(bextData, bytesRead, &reader) == DRWAV_SUCCESS) { + pMetadata->data.bext.pDescription = drwav__metadata_copy_string(pParser, (const char*)drwav_buffer_reader_ptr(&reader), DRWAV_BEXT_DESCRIPTION_BYTES); + drwav_buffer_reader_seek(&reader, DRWAV_BEXT_DESCRIPTION_BYTES); - pMetadata->data.bext.pOriginatorName = drwav__metadata_copy_string(pParser, (char*)(pReadPointer), DRWAV_BEXT_ORIGINATOR_NAME_BYTES); - pReadPointer += DRWAV_BEXT_ORIGINATOR_NAME_BYTES; + pMetadata->data.bext.pOriginatorName = drwav__metadata_copy_string(pParser, (const char*)drwav_buffer_reader_ptr(&reader), DRWAV_BEXT_ORIGINATOR_NAME_BYTES); + drwav_buffer_reader_seek(&reader, DRWAV_BEXT_ORIGINATOR_NAME_BYTES); - pMetadata->data.bext.pOriginatorReference = drwav__metadata_copy_string(pParser, (char*)(pReadPointer), DRWAV_BEXT_ORIGINATOR_REF_BYTES); - pReadPointer += DRWAV_BEXT_ORIGINATOR_REF_BYTES; + pMetadata->data.bext.pOriginatorReference = drwav__metadata_copy_string(pParser, (const char*)drwav_buffer_reader_ptr(&reader), DRWAV_BEXT_ORIGINATOR_REF_BYTES); + drwav_buffer_reader_seek(&reader, DRWAV_BEXT_ORIGINATOR_REF_BYTES); - memcpy(pMetadata->data.bext.pOriginationDate, pReadPointer, sizeof(pMetadata->data.bext.pOriginationDate)); - pReadPointer += sizeof(pMetadata->data.bext.pOriginationDate); + drwav_buffer_reader_read(&reader, pMetadata->data.bext.pOriginationDate, sizeof(pMetadata->data.bext.pOriginationDate), NULL); + drwav_buffer_reader_read(&reader, pMetadata->data.bext.pOriginationTime, sizeof(pMetadata->data.bext.pOriginationTime), NULL); - memcpy(pMetadata->data.bext.pOriginationTime, pReadPointer, sizeof(pMetadata->data.bext.pOriginationTime)); - pReadPointer += sizeof(pMetadata->data.bext.pOriginationTime); + drwav_buffer_reader_read_u32(&reader, &timeReferenceLow); + drwav_buffer_reader_read_u32(&reader, &timeReferenceHigh); + pMetadata->data.bext.timeReference = ((drwav_uint64)timeReferenceHigh << 32) + timeReferenceLow; - timeReferenceLow = drwav_bytes_to_u32(pReadPointer); - pReadPointer += sizeof(drwav_uint32); - timeReferenceHigh = drwav_bytes_to_u32(pReadPointer); - pReadPointer += sizeof(drwav_uint32); - pMetadata->data.bext.timeReference = ((drwav_uint64)timeReferenceHigh << 32) + timeReferenceLow; + drwav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.version); - pMetadata->data.bext.version = drwav_bytes_to_u16(pReadPointer); - pReadPointer += sizeof(drwav_uint16); + pMetadata->data.bext.pUMID = drwav__metadata_get_memory(pParser, DRWAV_BEXT_UMID_BYTES, 1); + drwav_buffer_reader_read(&reader, pMetadata->data.bext.pUMID, DRWAV_BEXT_UMID_BYTES, NULL); - pMetadata->data.bext.pUMID = drwav__metadata_get_memory(pParser, DRWAV_BEXT_UMID_BYTES, 1); - memcpy(pMetadata->data.bext.pUMID, pReadPointer, DRWAV_BEXT_UMID_BYTES); - pReadPointer += DRWAV_BEXT_UMID_BYTES; + drwav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.loudnessValue); + drwav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.loudnessRange); + drwav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.maxTruePeakLevel); + drwav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.maxMomentaryLoudness); + drwav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.maxShortTermLoudness); - pMetadata->data.bext.loudnessValue = drwav_bytes_to_u16(pReadPointer); - pReadPointer += sizeof(drwav_uint16); + DRWAV_ASSERT((drwav_offset_ptr(drwav_buffer_reader_ptr(&reader), DRWAV_BEXT_RESERVED_BYTES)) == (bextData + DRWAV_BEXT_BYTES)); - pMetadata->data.bext.loudnessRange = drwav_bytes_to_u16(pReadPointer); - pReadPointer += sizeof(drwav_uint16); + extraBytes = (size_t)(chunkSize - DRWAV_BEXT_BYTES); + if (extraBytes > 0) { + pMetadata->data.bext.pCodingHistory = (char*)drwav__metadata_get_memory(pParser, extraBytes + 1, 1); + DRWAV_ASSERT(pMetadata->data.bext.pCodingHistory != NULL); - pMetadata->data.bext.maxTruePeakLevel = drwav_bytes_to_u16(pReadPointer); - pReadPointer += sizeof(drwav_uint16); - - pMetadata->data.bext.maxMomentaryLoudness = drwav_bytes_to_u16(pReadPointer); - pReadPointer += sizeof(drwav_uint16); - - pMetadata->data.bext.maxShortTermLoudness = drwav_bytes_to_u16(pReadPointer); - pReadPointer += sizeof(drwav_uint16); - - DRWAV_ASSERT((pReadPointer + DRWAV_BEXT_RESERVED_BYTES) == (bextData + DRWAV_BEXT_BYTES)); - - extraBytes = (size_t)(chunkSize - DRWAV_BEXT_BYTES); - if (extraBytes > 0) { - pMetadata->data.bext.pCodingHistory = (char*)drwav__metadata_get_memory(pParser, extraBytes + 1, 1); - DRWAV_ASSERT(pMetadata->data.bext.pCodingHistory != NULL); - - bytesRead += drwav__metadata_parser_read(pParser, pMetadata->data.bext.pCodingHistory, extraBytes, NULL); - pMetadata->data.bext.codingHistorySize = (drwav_uint32)strlen(pMetadata->data.bext.pCodingHistory); - } else { - pMetadata->data.bext.pCodingHistory = NULL; - pMetadata->data.bext.codingHistorySize = 0; + bytesRead += drwav__metadata_parser_read(pParser, pMetadata->data.bext.pCodingHistory, extraBytes, NULL); + pMetadata->data.bext.codingHistorySize = (drwav_uint32)strlen(pMetadata->data.bext.pCodingHistory); + } else { + pMetadata->data.bext.pCodingHistory = NULL; + pMetadata->data.bext.codingHistorySize = 0; + } } } @@ -2568,18 +2690,25 @@ DRWAV_PRIVATE drwav_uint64 drwav__metadata_process_chunk(drwav__metadata_parser* bytesJustRead = drwav__metadata_parser_read(pParser, buffer, sizeof(buffer), &bytesRead); if (bytesJustRead == sizeof(buffer)) { drwav_uint32 loopCount = drwav_bytes_to_u32(buffer); + drwav_uint64 calculatedLoopCount; - bytesJustRead = drwav__metadata_parser_read(pParser, buffer, sizeof(buffer), &bytesRead); - if (bytesJustRead == sizeof(buffer)) { - drwav_uint32 samplerSpecificDataSizeInBytes = drwav_bytes_to_u32(buffer); + /* The loop count must be validated against the size of the chunk. */ + calculatedLoopCount = (pChunkHeader->sizeInBytes - DRWAV_SMPL_BYTES) / DRWAV_SMPL_LOOP_BYTES; + if (calculatedLoopCount == loopCount) { + bytesJustRead = drwav__metadata_parser_read(pParser, buffer, sizeof(buffer), &bytesRead); + if (bytesJustRead == sizeof(buffer)) { + drwav_uint32 samplerSpecificDataSizeInBytes = drwav_bytes_to_u32(buffer); - pParser->metadataCount += 1; - drwav__metadata_request_extra_memory_for_stage_2(pParser, sizeof(drwav_smpl_loop) * loopCount, DRWAV_METADATA_ALIGNMENT); - drwav__metadata_request_extra_memory_for_stage_2(pParser, samplerSpecificDataSizeInBytes, 1); - } + pParser->metadataCount += 1; + drwav__metadata_request_extra_memory_for_stage_2(pParser, sizeof(drwav_smpl_loop) * loopCount, DRWAV_METADATA_ALIGNMENT); + drwav__metadata_request_extra_memory_for_stage_2(pParser, samplerSpecificDataSizeInBytes, 1); + } + } else { + /* Loop count in header does not match the size of the chunk. */ + } } } else { - bytesRead = drwav__read_smpl_to_metadata_obj(pParser, &pParser->pMetadata[pParser->metadataCursor]); + bytesRead = drwav__read_smpl_to_metadata_obj(pParser, pChunkHeader, &pParser->pMetadata[pParser->metadataCursor]); if (bytesRead == pChunkHeader->sizeInBytes) { pParser->metadataCursor += 1; } else { @@ -2628,7 +2757,7 @@ DRWAV_PRIVATE drwav_uint64 drwav__metadata_process_chunk(drwav__metadata_parser* cueCount = (size_t)(pChunkHeader->sizeInBytes - DRWAV_CUE_BYTES) / DRWAV_CUE_POINT_BYTES; drwav__metadata_request_extra_memory_for_stage_2(pParser, sizeof(drwav_cue_point) * cueCount, DRWAV_METADATA_ALIGNMENT); } else { - bytesRead = drwav__read_cue_to_metadata_obj(pParser, &pParser->pMetadata[pParser->metadataCursor]); + bytesRead = drwav__read_cue_to_metadata_obj(pParser, pChunkHeader, &pParser->pMetadata[pParser->metadataCursor]); if (bytesRead == pChunkHeader->sizeInBytes) { pParser->metadataCursor += 1; } else { @@ -3222,7 +3351,12 @@ DRWAV_PRIVATE drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc on if (sampleCountFromFactChunk != 0) { pWav->totalPCMFrameCount = sampleCountFromFactChunk; } else { - pWav->totalPCMFrameCount = dataChunkSize / drwav_get_bytes_per_pcm_frame(pWav); + drwav_uint32 bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + if (bytesPerFrame == 0) { + return DRWAV_FALSE; /* Invalid file. */ + } + + pWav->totalPCMFrameCount = dataChunkSize / bytesPerFrame; if (pWav->translatedFormatTag == DR_WAVE_FORMAT_ADPCM) { drwav_uint64 totalBlockHeaderSizeInBytes; @@ -5135,6 +5269,7 @@ DRWAV_API drwav_result drwav_uninit(drwav* pWav) DRWAV_API size_t drwav_read_raw(drwav* pWav, size_t bytesToRead, void* pBufferOut) { size_t bytesRead; + drwav_uint32 bytesPerFrame; if (pWav == NULL || bytesToRead == 0) { return 0; /* Invalid args. */ @@ -5148,6 +5283,11 @@ DRWAV_API size_t drwav_read_raw(drwav* pWav, size_t bytesToRead, void* pBufferOu return 0; /* At end. */ } + bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + if (bytesPerFrame == 0) { + return 0; /* Could not determine the bytes per frame. */ + } + if (pBufferOut != NULL) { bytesRead = pWav->onRead(pWav->pUserData, pBufferOut, bytesToRead); } else { @@ -5184,7 +5324,7 @@ DRWAV_API size_t drwav_read_raw(drwav* pWav, size_t bytesToRead, void* pBufferOu } } - pWav->readCursorInPCMFrames += bytesRead / drwav_get_bytes_per_pcm_frame(pWav); + pWav->readCursorInPCMFrames += bytesRead / bytesPerFrame; pWav->bytesRemaining -= bytesRead; return bytesRead; @@ -5233,7 +5373,12 @@ DRWAV_API drwav_uint64 drwav_read_pcm_frames_be(drwav* pWav, drwav_uint64 frames drwav_uint64 framesRead = drwav_read_pcm_frames_le(pWav, framesToRead, pBufferOut); if (pBufferOut != NULL) { - drwav__bswap_samples(pBufferOut, framesRead*pWav->channels, drwav_get_bytes_per_pcm_frame(pWav)/pWav->channels, pWav->translatedFormatTag); + drwav_uint32 bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + if (bytesPerFrame == 0) { + return 0; /* Could not get the bytes per frame which means bytes per sample cannot be determined and we don't know how to byte swap. */ + } + + drwav__bswap_samples(pBufferOut, framesRead*pWav->channels, bytesPerFrame/pWav->channels, pWav->translatedFormatTag); } return framesRead; @@ -5348,12 +5493,18 @@ DRWAV_API drwav_bool32 drwav_seek_to_pcm_frame(drwav* pWav, drwav_uint64 targetF drwav_uint64 currentBytePos; drwav_uint64 targetBytePos; drwav_uint64 offset; + drwav_uint32 bytesPerFrame; - totalSizeInBytes = pWav->totalPCMFrameCount * drwav_get_bytes_per_pcm_frame(pWav); + bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + if (bytesPerFrame == 0) { + return DRWAV_FALSE; /* Not able to calculate offset. */ + } + + totalSizeInBytes = pWav->totalPCMFrameCount * bytesPerFrame; DRWAV_ASSERT(totalSizeInBytes >= pWav->bytesRemaining); currentBytePos = totalSizeInBytes - pWav->bytesRemaining; - targetBytePos = targetFrameIndex * drwav_get_bytes_per_pcm_frame(pWav); + targetBytePos = targetFrameIndex * bytesPerFrame; if (currentBytePos < targetBytePos) { /* Offset forwards. */ @@ -5372,7 +5523,7 @@ DRWAV_API drwav_bool32 drwav_seek_to_pcm_frame(drwav* pWav, drwav_uint64 targetF return DRWAV_FALSE; } - pWav->readCursorInPCMFrames += offset32 / drwav_get_bytes_per_pcm_frame(pWav); + pWav->readCursorInPCMFrames += offset32 / bytesPerFrame; pWav->bytesRemaining -= offset32; offset -= offset32; } @@ -5488,6 +5639,9 @@ DRWAV_API drwav_uint64 drwav_write_pcm_frames_be(drwav* pWav, drwav_uint64 frame pRunningData = (const drwav_uint8*)pData; bytesPerSample = drwav_get_bytes_per_pcm_frame(pWav) / pWav->channels; + if (bytesPerSample == 0) { + return 0; /* Cannot determine bytes per sample, or bytes per sample is less than one byte. */ + } while (bytesToWrite > 0) { drwav_uint8 temp[4096]; @@ -5763,7 +5917,7 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__ima(drwav* pWav, drwav_uin } pWav->ima.predictor[0] = drwav_bytes_to_s16(header + 0); - pWav->ima.stepIndex[0] = header[2]; + pWav->ima.stepIndex[0] = drwav_clamp(header[2], 0, (drwav_int32)drwav_countof(stepTable)-1); /* Clamp not necessary because we checked above, but adding here to silence a static analysis warning. */ pWav->ima.cachedFrames[drwav_countof(pWav->ima.cachedFrames) - 1] = pWav->ima.predictor[0]; pWav->ima.cachedFrameCount = 1; } else { @@ -5781,9 +5935,9 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__ima(drwav* pWav, drwav_uin } pWav->ima.predictor[0] = drwav_bytes_to_s16(header + 0); - pWav->ima.stepIndex[0] = header[2]; + pWav->ima.stepIndex[0] = drwav_clamp(header[2], 0, (drwav_int32)drwav_countof(stepTable)-1); /* Clamp not necessary because we checked above, but adding here to silence a static analysis warning. */ pWav->ima.predictor[1] = drwav_bytes_to_s16(header + 4); - pWav->ima.stepIndex[1] = header[6]; + pWav->ima.stepIndex[1] = drwav_clamp(header[6], 0, (drwav_int32)drwav_countof(stepTable)-1); /* Clamp not necessary because we checked above, but adding here to silence a static analysis warning. */ pWav->ima.cachedFrames[drwav_countof(pWav->ima.cachedFrames) - 2] = pWav->ima.predictor[0]; pWav->ima.cachedFrames[drwav_countof(pWav->ima.cachedFrames) - 1] = pWav->ima.predictor[1]; @@ -5928,7 +6082,7 @@ static DRWAV_INLINE drwav_int16 drwav__mulaw_to_s16(drwav_uint8 sampleIn) DRWAV_PRIVATE void drwav__pcm_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, size_t totalSampleCount, unsigned int bytesPerSample) { - unsigned int i; + size_t i; /* Special case for 8-bit sample data because it's treated as unsigned. */ if (bytesPerSample == 1) { @@ -5996,8 +6150,10 @@ DRWAV_PRIVATE void drwav__ieee_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uint64 framesToRead, drwav_int16* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; /* Fast path. */ if ((pWav->translatedFormatTag == DR_WAVE_FORMAT_PCM && pWav->bitsPerSample == 16) || pBufferOut == NULL) { @@ -6009,6 +6165,11 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uin return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6020,9 +6181,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uin DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav__pcm_to_s16(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels), bytesPerFrame/pWav->channels); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav__pcm_to_s16(pBufferOut, sampleData, (size_t)samplesRead, bytesPerSample); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6033,8 +6201,10 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uin DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__ieee(drwav* pWav, drwav_uint64 framesToRead, drwav_int16* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; if (pBufferOut == NULL) { return drwav_read_pcm_frames(pWav, framesToRead, NULL); @@ -6045,6 +6215,11 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__ieee(drwav* pWav, drwav_ui return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6056,9 +6231,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__ieee(drwav* pWav, drwav_ui DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav__ieee_to_s16(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels), bytesPerFrame/pWav->channels); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav__ieee_to_s16(pBufferOut, sampleData, (size_t)samplesRead, bytesPerSample); /* Safe cast. */ + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6069,8 +6251,10 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__ieee(drwav* pWav, drwav_ui DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__alaw(drwav* pWav, drwav_uint64 framesToRead, drwav_int16* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; if (pBufferOut == NULL) { return drwav_read_pcm_frames(pWav, framesToRead, NULL); @@ -6081,6 +6265,11 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__alaw(drwav* pWav, drwav_ui return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6092,9 +6281,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__alaw(drwav* pWav, drwav_ui DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav_alaw_to_s16(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels)); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav_alaw_to_s16(pBufferOut, sampleData, (size_t)samplesRead); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6105,8 +6301,10 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__alaw(drwav* pWav, drwav_ui DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__mulaw(drwav* pWav, drwav_uint64 framesToRead, drwav_int16* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; if (pBufferOut == NULL) { return drwav_read_pcm_frames(pWav, framesToRead, NULL); @@ -6117,6 +6315,11 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__mulaw(drwav* pWav, drwav_u return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6128,9 +6331,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s16__mulaw(drwav* pWav, drwav_u DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav_mulaw_to_s16(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels)); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav_mulaw_to_s16(pBufferOut, sampleData, (size_t)samplesRead); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6354,14 +6564,21 @@ DRWAV_PRIVATE void drwav__ieee_to_f32(float* pOut, const drwav_uint8* pIn, size_ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__pcm(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6373,9 +6590,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__pcm(drwav* pWav, drwav_uin DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav__pcm_to_f32(pBufferOut, sampleData, (size_t)framesRead*pWav->channels, bytesPerFrame/pWav->channels); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav__pcm_to_f32(pBufferOut, sampleData, (size_t)samplesRead, bytesPerSample); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6383,7 +6607,7 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__pcm(drwav* pWav, drwav_uin return totalFramesRead; } -DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__msadpcm(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) +DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__msadpcm_ima(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) { /* We're just going to borrow the implementation from the drwav_read_s16() since ADPCM is a little bit more complicated than other formats and I don't @@ -6413,41 +6637,13 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__msadpcm(drwav* pWav, drwav return totalFramesRead; } -DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__ima(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) -{ - /* - We're just going to borrow the implementation from the drwav_read_s16() since IMA-ADPCM is a little bit more complicated than other formats and I don't - want to duplicate that code. - */ - drwav_uint64 totalFramesRead; - drwav_int16 samples16[2048]; - - totalFramesRead = 0; - - while (framesToRead > 0) { - drwav_uint64 framesToReadThisIteration = drwav_min(framesToRead, drwav_countof(samples16)/pWav->channels); - drwav_uint64 framesRead = drwav_read_pcm_frames_s16(pWav, framesToReadThisIteration, samples16); - if (framesRead == 0) { - break; - } - - DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - - drwav_s16_to_f32(pBufferOut, samples16, (size_t)(framesRead*pWav->channels)); /* <-- Safe cast because we're clamping to 2048. */ - - pBufferOut += framesRead*pWav->channels; - framesToRead -= framesRead; - totalFramesRead += framesRead; - } - - return totalFramesRead; -} - DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__ieee(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; /* Fast path. */ if (pWav->translatedFormatTag == DR_WAVE_FORMAT_IEEE_FLOAT && pWav->bitsPerSample == 32) { @@ -6459,6 +6655,11 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__ieee(drwav* pWav, drwav_ui return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6470,9 +6671,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__ieee(drwav* pWav, drwav_ui DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav__ieee_to_f32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels), bytesPerFrame/pWav->channels); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav__ieee_to_f32(pBufferOut, sampleData, (size_t)samplesRead, bytesPerSample); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6483,14 +6691,21 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__ieee(drwav* pWav, drwav_ui DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6502,9 +6717,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_ui DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav_alaw_to_f32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels)); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav_alaw_to_f32(pBufferOut, sampleData, (size_t)samplesRead); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6515,14 +6737,21 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_ui DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__mulaw(drwav* pWav, drwav_uint64 framesToRead, float* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6534,9 +6763,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_f32__mulaw(drwav* pWav, drwav_u DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav_mulaw_to_f32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels)); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav_mulaw_to_f32(pBufferOut, sampleData, (size_t)samplesRead); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6563,8 +6799,8 @@ DRWAV_API drwav_uint64 drwav_read_pcm_frames_f32(drwav* pWav, drwav_uint64 frame return drwav_read_pcm_frames_f32__pcm(pWav, framesToRead, pBufferOut); } - if (pWav->translatedFormatTag == DR_WAVE_FORMAT_ADPCM) { - return drwav_read_pcm_frames_f32__msadpcm(pWav, framesToRead, pBufferOut); + if (pWav->translatedFormatTag == DR_WAVE_FORMAT_ADPCM || pWav->translatedFormatTag == DR_WAVE_FORMAT_DVI_ADPCM) { + return drwav_read_pcm_frames_f32__msadpcm_ima(pWav, framesToRead, pBufferOut); } if (pWav->translatedFormatTag == DR_WAVE_FORMAT_IEEE_FLOAT) { @@ -6579,10 +6815,6 @@ DRWAV_API drwav_uint64 drwav_read_pcm_frames_f32(drwav* pWav, drwav_uint64 frame return drwav_read_pcm_frames_f32__mulaw(pWav, framesToRead, pBufferOut); } - if (pWav->translatedFormatTag == DR_WAVE_FORMAT_DVI_ADPCM) { - return drwav_read_pcm_frames_f32__ima(pWav, framesToRead, pBufferOut); - } - return 0; } @@ -6791,8 +7023,10 @@ DRWAV_PRIVATE void drwav__ieee_to_s32(drwav_int32* pOut, const drwav_uint8* pIn, DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__pcm(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; + drwav_uint8 sampleData[4096] = {0}; drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; /* Fast path. */ if (pWav->translatedFormatTag == DR_WAVE_FORMAT_PCM && pWav->bitsPerSample == 32) { @@ -6804,6 +7038,11 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__pcm(drwav* pWav, drwav_uin return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6815,9 +7054,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__pcm(drwav* pWav, drwav_uin DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav__pcm_to_s32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels), bytesPerFrame/pWav->channels); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav__pcm_to_s32(pBufferOut, sampleData, (size_t)samplesRead, bytesPerSample); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6825,7 +7071,7 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__pcm(drwav* pWav, drwav_uin return totalFramesRead; } -DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__msadpcm(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) +DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__msadpcm_ima(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) { /* We're just going to borrow the implementation from the drwav_read_s16() since ADPCM is a little bit more complicated than other formats and I don't @@ -6853,44 +7099,24 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__msadpcm(drwav* pWav, drwav return totalFramesRead; } -DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__ima(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) -{ - /* - We're just going to borrow the implementation from the drwav_read_s16() since IMA-ADPCM is a little bit more complicated than other formats and I don't - want to duplicate that code. - */ - drwav_uint64 totalFramesRead = 0; - drwav_int16 samples16[2048]; - - while (framesToRead > 0) { - drwav_uint64 framesToReadThisIteration = drwav_min(framesToRead, drwav_countof(samples16)/pWav->channels); - drwav_uint64 framesRead = drwav_read_pcm_frames_s16(pWav, framesToReadThisIteration, samples16); - if (framesRead == 0) { - break; - } - - DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - - drwav_s16_to_s32(pBufferOut, samples16, (size_t)(framesRead*pWav->channels)); /* <-- Safe cast because we're clamping to 2048. */ - - pBufferOut += framesRead*pWav->channels; - framesToRead -= framesRead; - totalFramesRead += framesRead; - } - - return totalFramesRead; -} - DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__ieee(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; - drwav_uint32 bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + drwav_uint8 sampleData[4096] = {0}; + drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; + bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6902,9 +7128,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__ieee(drwav* pWav, drwav_ui DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav__ieee_to_s32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels), bytesPerFrame/pWav->channels); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav__ieee_to_s32(pBufferOut, sampleData, (size_t)samplesRead, bytesPerSample); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6915,13 +7148,21 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__ieee(drwav* pWav, drwav_ui DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__alaw(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; - drwav_uint32 bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + drwav_uint8 sampleData[4096] = {0}; + drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; + bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6933,9 +7174,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__alaw(drwav* pWav, drwav_ui DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav_alaw_to_s32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels)); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav_alaw_to_s32(pBufferOut, sampleData, (size_t)samplesRead); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6946,13 +7194,21 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__alaw(drwav* pWav, drwav_ui DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__mulaw(drwav* pWav, drwav_uint64 framesToRead, drwav_int32* pBufferOut) { drwav_uint64 totalFramesRead; - drwav_uint8 sampleData[4096]; - drwav_uint32 bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); + drwav_uint8 sampleData[4096] = {0}; + drwav_uint32 bytesPerFrame; + drwav_uint32 bytesPerSample; + drwav_uint64 samplesRead; + bytesPerFrame = drwav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; } + bytesPerSample = bytesPerFrame / pWav->channels; + if (bytesPerSample == 0 || (bytesPerFrame % pWav->channels) != 0) { + return 0; /* Only byte-aligned formats are supported. */ + } + totalFramesRead = 0; while (framesToRead > 0) { @@ -6964,9 +7220,16 @@ DRWAV_PRIVATE drwav_uint64 drwav_read_pcm_frames_s32__mulaw(drwav* pWav, drwav_u DRWAV_ASSERT(framesRead <= framesToReadThisIteration); /* If this fails it means there's a bug in drwav_read_pcm_frames(). */ - drwav_mulaw_to_s32(pBufferOut, sampleData, (size_t)(framesRead*pWav->channels)); + /* Validation to ensure we don't read too much from out intermediary buffer. This is to protect from invalid files. */ + samplesRead = framesRead * pWav->channels; + if ((samplesRead * bytesPerSample) > sizeof(sampleData)) { + DRWAV_ASSERT(DRWAV_FALSE); /* This should never happen with a valid file. */ + break; + } - pBufferOut += framesRead*pWav->channels; + drwav_mulaw_to_s32(pBufferOut, sampleData, (size_t)samplesRead); + + pBufferOut += samplesRead; framesToRead -= framesRead; totalFramesRead += framesRead; } @@ -6993,8 +7256,8 @@ DRWAV_API drwav_uint64 drwav_read_pcm_frames_s32(drwav* pWav, drwav_uint64 frame return drwav_read_pcm_frames_s32__pcm(pWav, framesToRead, pBufferOut); } - if (pWav->translatedFormatTag == DR_WAVE_FORMAT_ADPCM) { - return drwav_read_pcm_frames_s32__msadpcm(pWav, framesToRead, pBufferOut); + if (pWav->translatedFormatTag == DR_WAVE_FORMAT_ADPCM || pWav->translatedFormatTag == DR_WAVE_FORMAT_DVI_ADPCM) { + return drwav_read_pcm_frames_s32__msadpcm_ima(pWav, framesToRead, pBufferOut); } if (pWav->translatedFormatTag == DR_WAVE_FORMAT_IEEE_FLOAT) { @@ -7009,10 +7272,6 @@ DRWAV_API drwav_uint64 drwav_read_pcm_frames_s32(drwav* pWav, drwav_uint64 frame return drwav_read_pcm_frames_s32__mulaw(pWav, framesToRead, pBufferOut); } - if (pWav->translatedFormatTag == DR_WAVE_FORMAT_DVI_ADPCM) { - return drwav_read_pcm_frames_s32__ima(pWav, framesToRead, pBufferOut); - } - return 0; } @@ -7600,7 +7859,10 @@ DRWAV_API drwav_bool32 drwav_fourcc_equal(const drwav_uint8* a, const char* b) /* REVISION HISTORY ================ -v0.13.3 - TBD +v0.13.4 - 2021-12-08 + - Fix some static analysis warnings. + +v0.13.3 - 2021-11-24 - Fix an incorrect assertion when trying to endian swap 1-byte sample formats. This is now a no-op rather than a failed assertion. - Fix a bug with parsing of the bext chunk. diff --git a/src/external/jar_xm.h b/src/external/jar_xm.h index 82170f54d..4a1bfbf67 100644 --- a/src/external/jar_xm.h +++ b/src/external/jar_xm.h @@ -798,7 +798,7 @@ char* jar_xm_load_module(jar_xm_context_t* ctx, const char* moddata, size_t modd mod->num_patterns = READ_U16(offset + 10); mod->num_instruments = READ_U16(offset + 12); mod->patterns = (jar_xm_pattern_t*)mempool; - mod->linear_interpolation = 0; // Linear interpolation can be set after loading + mod->linear_interpolation = 1; // Linear interpolation can be set after loading mod->ramping = 1; // ramping can be set after loading mempool += mod->num_patterns * sizeof(jar_xm_pattern_t); mempool = ALIGN_PTR(mempool, 16); @@ -2253,6 +2253,7 @@ void jar_xm_reset(jar_xm_context_t* ctx) { for (uint16_t i = 0; i < jar_xm_get_number_of_channels(ctx); i++) { jar_xm_cut_note(&ctx->channels[i]); } + ctx->generated_samples = 0; ctx->current_row = 0; ctx->current_table_index = 0; ctx->current_tick = 0; diff --git a/src/external/qoi.h b/src/external/qoi.h new file mode 100644 index 000000000..5e31076bf --- /dev/null +++ b/src/external/qoi.h @@ -0,0 +1,665 @@ +/* + +QOI - The "Quite OK Image" format for fast, lossless image compression + +Dominic Szablewski - https://phoboslab.org + + +-- LICENSE: The MIT License(MIT) + +Copyright(c) 2021 Dominic Szablewski + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files(the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions : +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +-- About + +QOI encodes and decodes images in a lossless format. Compared to stb_image and +stb_image_write QOI offers 20x-50x faster encoding, 3x-4x faster decoding and +20% better compression. + + +-- Synopsis + +// Define `QOI_IMPLEMENTATION` in *one* C/C++ file before including this +// library to create the implementation. + +#define QOI_IMPLEMENTATION +#include "qoi.h" + +// Encode and store an RGBA buffer to the file system. The qoi_desc describes +// the input pixel data. +qoi_write("image_new.qoi", rgba_pixels, &(qoi_desc){ + .width = 1920, + .height = 1080, + .channels = 4, + .colorspace = QOI_SRGB +}); + +// Load and decode a QOI image from the file system into a 32bbp RGBA buffer. +// The qoi_desc struct will be filled with the width, height, number of channels +// and colorspace read from the file header. +qoi_desc desc; +void *rgba_pixels = qoi_read("image.qoi", &desc, 4); + + + +-- Documentation + +This library provides the following functions; +- qoi_read -- read and decode a QOI file +- qoi_decode -- decode the raw bytes of a QOI image from memory +- qoi_write -- encode and write a QOI file +- qoi_encode -- encode an rgba buffer into a QOI image in memory + +See the function declaration below for the signature and more information. + +If you don't want/need the qoi_read and qoi_write functions, you can define +QOI_NO_STDIO before including this library. + +This library uses malloc() and free(). To supply your own malloc implementation +you can define QOI_MALLOC and QOI_FREE before including this library. + +This library uses memset() to zero-initialize the index. To supply your own +implementation you can define QOI_ZEROARR before including this library. + + +-- Data Format + +A QOI file has a 14 byte header, followed by any number of data "chunks" and an +8-byte end marker. + +struct qoi_header_t { + char magic[4]; // magic bytes "qoif" + uint32_t width; // image width in pixels (BE) + uint32_t height; // image height in pixels (BE) + uint8_t channels; // 3 = RGB, 4 = RGBA + uint8_t colorspace; // 0 = sRGB with linear alpha, 1 = all channels linear +}; + +Images are encoded from top to bottom, left to right. The decoder and encoder +start with {r: 0, g: 0, b: 0, a: 255} as the previous pixel value. An image is +complete when all pixels specified by width * height have been covered. + +Pixels are encoded as + - a run of the previous pixel + - an index into an array of previously seen pixels + - a difference to the previous pixel value in r,g,b + - full r,g,b or r,g,b,a values + +The color channels are assumed to not be premultiplied with the alpha channel +("un-premultiplied alpha"). + +A running array[64] (zero-initialized) of previously seen pixel values is +maintained by the encoder and decoder. Each pixel that is seen by the encoder +and decoder is put into this array at the position formed by a hash function of +the color value. In the encoder, if the pixel value at the index matches the +current pixel, this index position is written to the stream as QOI_OP_INDEX. +The hash function for the index is: + + index_position = (r * 3 + g * 5 + b * 7 + a * 11) % 64 + +Each chunk starts with a 2- or 8-bit tag, followed by a number of data bits. The +bit length of chunks is divisible by 8 - i.e. all chunks are byte aligned. All +values encoded in these data bits have the most significant bit on the left. + +The 8-bit tags have precedence over the 2-bit tags. A decoder must check for the +presence of an 8-bit tag first. + +The byte stream's end is marked with 7 0x00 bytes followed a single 0x01 byte. + + +The possible chunks are: + + +.- QOI_OP_INDEX ----------. +| Byte[0] | +| 7 6 5 4 3 2 1 0 | +|-------+-----------------| +| 0 0 | index | +`-------------------------` +2-bit tag b00 +6-bit index into the color index array: 0..63 + +A valid encoder must not issue 7 or more consecutive QOI_OP_INDEX chunks to the +index 0, to avoid confusion with the 8 byte end marker. + + +.- QOI_OP_DIFF -----------. +| Byte[0] | +| 7 6 5 4 3 2 1 0 | +|-------+-----+-----+-----| +| 0 1 | dr | dg | db | +`-------------------------` +2-bit tag b01 +2-bit red channel difference from the previous pixel between -2..1 +2-bit green channel difference from the previous pixel between -2..1 +2-bit blue channel difference from the previous pixel between -2..1 + +The difference to the current channel values are using a wraparound operation, +so "1 - 2" will result in 255, while "255 + 1" will result in 0. + +Values are stored as unsigned integers with a bias of 2. E.g. -2 is stored as +0 (b00). 1 is stored as 3 (b11). + + +.- QOI_OP_LUMA -------------------------------------. +| Byte[0] | Byte[1] | +| 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 | +|-------+-----------------+-------------+-----------| +| 1 0 | green diff | dr - dg | db - dg | +`---------------------------------------------------` +2-bit tag b10 +6-bit green channel difference from the previous pixel -32..31 +4-bit red channel difference minus green channel difference -8..7 +4-bit blue channel difference minus green channel difference -8..7 + +The green channel is used to indicate the general direction of change and is +encoded in 6 bits. The red and blue channels (dr and db) base their diffs off +of the green channel difference and are encoded in 4 bits. I.e.: + dr_dg = (last_px.r - cur_px.r) - (last_px.g - cur_px.g) + db_dg = (last_px.b - cur_px.b) - (last_px.g - cur_px.g) + +The difference to the current channel values are using a wraparound operation, +so "10 - 13" will result in 253, while "250 + 7" will result in 1. + +Values are stored as unsigned integers with a bias of 32 for the green channel +and a bias of 8 for the red and blue channel. + + +.- QOI_OP_RUN ------------. +| Byte[0] | +| 7 6 5 4 3 2 1 0 | +|-------+-----------------| +| 1 1 | run | +`-------------------------` +2-bit tag b11 +6-bit run-length repeating the previous pixel: 1..62 + +The run-length is stored with a bias of -1. Note that the run-lengths 63 and 64 +(b111110 and b111111) are illegal as they are occupied by the QOI_OP_RGB and +QOI_OP_RGBA tags. + + +.- QOI_OP_RGB ------------------------------------------. +| Byte[0] | Byte[1] | Byte[2] | Byte[3] | +| 7 6 5 4 3 2 1 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 | +|-------------------------+---------+---------+---------| +| 1 1 1 1 1 1 1 0 | red | green | blue | +`-------------------------------------------------------` +8-bit tag b11111110 +8-bit red channel value +8-bit green channel value +8-bit blue channel value + + +.- QOI_OP_RGBA ---------------------------------------------------. +| Byte[0] | Byte[1] | Byte[2] | Byte[3] | Byte[4] | +| 7 6 5 4 3 2 1 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 | +|-------------------------+---------+---------+---------+---------| +| 1 1 1 1 1 1 1 1 | red | green | blue | alpha | +`-----------------------------------------------------------------` +8-bit tag b11111111 +8-bit red channel value +8-bit green channel value +8-bit blue channel value +8-bit alpha channel value + +*/ + + +/* ----------------------------------------------------------------------------- +Header - Public functions */ + +#ifndef QOI_H +#define QOI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* A pointer to a qoi_desc struct has to be supplied to all of qoi's functions. +It describes either the input format (for qoi_write and qoi_encode), or is +filled with the description read from the file header (for qoi_read and +qoi_decode). + +The colorspace in this qoi_desc is an enum where + 0 = sRGB, i.e. gamma scaled RGB channels and a linear alpha channel + 1 = all channels are linear +You may use the constants QOI_SRGB or QOI_LINEAR. The colorspace is purely +informative. It will be saved to the file header, but does not affect +en-/decoding in any way. */ + +#define QOI_SRGB 0 +#define QOI_LINEAR 1 + +typedef struct { + unsigned int width; + unsigned int height; + unsigned char channels; + unsigned char colorspace; +} qoi_desc; + +#ifndef QOI_NO_STDIO + +/* Encode raw RGB or RGBA pixels into a QOI image and write it to the file +system. The qoi_desc struct must be filled with the image width, height, +number of channels (3 = RGB, 4 = RGBA) and the colorspace. + +The function returns 0 on failure (invalid parameters, or fopen or malloc +failed) or the number of bytes written on success. */ + +int qoi_write(const char *filename, const void *data, const qoi_desc *desc); + + +/* Read and decode a QOI image from the file system. If channels is 0, the +number of channels from the file header is used. If channels is 3 or 4 the +output format will be forced into this number of channels. + +The function either returns NULL on failure (invalid data, or malloc or fopen +failed) or a pointer to the decoded pixels. On success, the qoi_desc struct +will be filled with the description from the file header. + +The returned pixel data should be free()d after use. */ + +void *qoi_read(const char *filename, qoi_desc *desc, int channels); + +#endif /* QOI_NO_STDIO */ + + +/* Encode raw RGB or RGBA pixels into a QOI image in memory. + +The function either returns NULL on failure (invalid parameters or malloc +failed) or a pointer to the encoded data on success. On success the out_len +is set to the size in bytes of the encoded data. + +The returned qoi data should be free()d after use. */ + +void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len); + + +/* Decode a QOI image from memory. + +The function either returns NULL on failure (invalid parameters or malloc +failed) or a pointer to the decoded pixels. On success, the qoi_desc struct +is filled with the description from the file header. + +The returned pixel data should be free()d after use. */ + +void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels); + + +#ifdef __cplusplus +} +#endif +#endif /* QOI_H */ + + +/* ----------------------------------------------------------------------------- +Implementation */ + +#ifdef QOI_IMPLEMENTATION +#include +#include + +#ifndef QOI_MALLOC + #define QOI_MALLOC(sz) malloc(sz) + #define QOI_FREE(p) free(p) +#endif +#ifndef QOI_ZEROARR + #define QOI_ZEROARR(a) memset((a),0,sizeof(a)) +#endif + +#define QOI_OP_INDEX 0x00 /* 00xxxxxx */ +#define QOI_OP_DIFF 0x40 /* 01xxxxxx */ +#define QOI_OP_LUMA 0x80 /* 10xxxxxx */ +#define QOI_OP_RUN 0xc0 /* 11xxxxxx */ +#define QOI_OP_RGB 0xfe /* 11111110 */ +#define QOI_OP_RGBA 0xff /* 11111111 */ + +#define QOI_MASK_2 0xc0 /* 11000000 */ + +#define QOI_COLOR_HASH(C) (C.rgba.r*3 + C.rgba.g*5 + C.rgba.b*7 + C.rgba.a*11) +#define QOI_MAGIC \ + (((unsigned int)'q') << 24 | ((unsigned int)'o') << 16 | \ + ((unsigned int)'i') << 8 | ((unsigned int)'f')) +#define QOI_HEADER_SIZE 14 + +/* 2GB is the max file size that this implementation can safely handle. We guard +against anything larger than that, assuming the worst case with 5 bytes per +pixel, rounded down to a nice clean value. 400 million pixels ought to be +enough for anybody. */ +#define QOI_PIXELS_MAX ((unsigned int)400000000) + +typedef union { + struct { unsigned char r, g, b, a; } rgba; + unsigned int v; +} qoi_rgba_t; + +static const unsigned char qoi_padding[8] = {0,0,0,0,0,0,0,1}; + +void qoi_write_32(unsigned char *bytes, int *p, unsigned int v) { + bytes[(*p)++] = (0xff000000 & v) >> 24; + bytes[(*p)++] = (0x00ff0000 & v) >> 16; + bytes[(*p)++] = (0x0000ff00 & v) >> 8; + bytes[(*p)++] = (0x000000ff & v); +} + +unsigned int qoi_read_32(const unsigned char *bytes, int *p) { + unsigned int a = bytes[(*p)++]; + unsigned int b = bytes[(*p)++]; + unsigned int c = bytes[(*p)++]; + unsigned int d = bytes[(*p)++]; + return a << 24 | b << 16 | c << 8 | d; +} + +void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) { + int i, max_size, p, run; + int px_len, px_end, px_pos, channels; + unsigned char *bytes; + const unsigned char *pixels; + qoi_rgba_t index[64]; + qoi_rgba_t px, px_prev; + + if ( + data == NULL || out_len == NULL || desc == NULL || + desc->width == 0 || desc->height == 0 || + desc->channels < 3 || desc->channels > 4 || + desc->colorspace > 1 || + desc->height >= QOI_PIXELS_MAX / desc->width + ) { + return NULL; + } + + max_size = + desc->width * desc->height * (desc->channels + 1) + + QOI_HEADER_SIZE + sizeof(qoi_padding); + + p = 0; + bytes = (unsigned char *) QOI_MALLOC(max_size); + if (!bytes) { + return NULL; + } + + qoi_write_32(bytes, &p, QOI_MAGIC); + qoi_write_32(bytes, &p, desc->width); + qoi_write_32(bytes, &p, desc->height); + bytes[p++] = desc->channels; + bytes[p++] = desc->colorspace; + + + pixels = (const unsigned char *)data; + + QOI_ZEROARR(index); + + run = 0; + px_prev.rgba.r = 0; + px_prev.rgba.g = 0; + px_prev.rgba.b = 0; + px_prev.rgba.a = 255; + px = px_prev; + + px_len = desc->width * desc->height * desc->channels; + px_end = px_len - desc->channels; + channels = desc->channels; + + for (px_pos = 0; px_pos < px_len; px_pos += channels) { + if (channels == 4) { + px = *(qoi_rgba_t *)(pixels + px_pos); + } + else { + px.rgba.r = pixels[px_pos + 0]; + px.rgba.g = pixels[px_pos + 1]; + px.rgba.b = pixels[px_pos + 2]; + } + + if (px.v == px_prev.v) { + run++; + if (run == 62 || px_pos == px_end) { + bytes[p++] = QOI_OP_RUN | (run - 1); + run = 0; + } + } + else { + int index_pos; + + if (run > 0) { + bytes[p++] = QOI_OP_RUN | (run - 1); + run = 0; + } + + index_pos = QOI_COLOR_HASH(px) % 64; + + if (index[index_pos].v == px.v) { + bytes[p++] = QOI_OP_INDEX | index_pos; + } + else { + index[index_pos] = px; + + if (px.rgba.a == px_prev.rgba.a) { + signed char vr = px.rgba.r - px_prev.rgba.r; + signed char vg = px.rgba.g - px_prev.rgba.g; + signed char vb = px.rgba.b - px_prev.rgba.b; + + signed char vg_r = vr - vg; + signed char vg_b = vb - vg; + + if ( + vr > -3 && vr < 2 && + vg > -3 && vg < 2 && + vb > -3 && vb < 2 + ) { + bytes[p++] = QOI_OP_DIFF | (vr + 2) << 4 | (vg + 2) << 2 | (vb + 2); + } + else if ( + vg_r > -9 && vg_r < 8 && + vg > -33 && vg < 32 && + vg_b > -9 && vg_b < 8 + ) { + bytes[p++] = QOI_OP_LUMA | (vg + 32); + bytes[p++] = (vg_r + 8) << 4 | (vg_b + 8); + } + else { + bytes[p++] = QOI_OP_RGB; + bytes[p++] = px.rgba.r; + bytes[p++] = px.rgba.g; + bytes[p++] = px.rgba.b; + } + } + else { + bytes[p++] = QOI_OP_RGBA; + bytes[p++] = px.rgba.r; + bytes[p++] = px.rgba.g; + bytes[p++] = px.rgba.b; + bytes[p++] = px.rgba.a; + } + } + } + px_prev = px; + } + + for (i = 0; i < (int)sizeof(qoi_padding); i++) { + bytes[p++] = qoi_padding[i]; + } + + *out_len = p; + return bytes; +} + +void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) { + const unsigned char *bytes; + unsigned int header_magic; + unsigned char *pixels; + qoi_rgba_t index[64]; + qoi_rgba_t px; + int px_len, chunks_len, px_pos; + int p = 0, run = 0; + + if ( + data == NULL || desc == NULL || + (channels != 0 && channels != 3 && channels != 4) || + size < QOI_HEADER_SIZE + (int)sizeof(qoi_padding) + ) { + return NULL; + } + + bytes = (const unsigned char *)data; + + header_magic = qoi_read_32(bytes, &p); + desc->width = qoi_read_32(bytes, &p); + desc->height = qoi_read_32(bytes, &p); + desc->channels = bytes[p++]; + desc->colorspace = bytes[p++]; + + if ( + desc->width == 0 || desc->height == 0 || + desc->channels < 3 || desc->channels > 4 || + desc->colorspace > 1 || + header_magic != QOI_MAGIC || + desc->height >= QOI_PIXELS_MAX / desc->width + ) { + return NULL; + } + + if (channels == 0) { + channels = desc->channels; + } + + px_len = desc->width * desc->height * channels; + pixels = (unsigned char *) QOI_MALLOC(px_len); + if (!pixels) { + return NULL; + } + + QOI_ZEROARR(index); + px.rgba.r = 0; + px.rgba.g = 0; + px.rgba.b = 0; + px.rgba.a = 255; + + chunks_len = size - (int)sizeof(qoi_padding); + for (px_pos = 0; px_pos < px_len; px_pos += channels) { + if (run > 0) { + run--; + } + else if (p < chunks_len) { + int b1 = bytes[p++]; + + if (b1 == QOI_OP_RGB) { + px.rgba.r = bytes[p++]; + px.rgba.g = bytes[p++]; + px.rgba.b = bytes[p++]; + } + else if (b1 == QOI_OP_RGBA) { + px.rgba.r = bytes[p++]; + px.rgba.g = bytes[p++]; + px.rgba.b = bytes[p++]; + px.rgba.a = bytes[p++]; + } + else if ((b1 & QOI_MASK_2) == QOI_OP_INDEX) { + px = index[b1]; + } + else if ((b1 & QOI_MASK_2) == QOI_OP_DIFF) { + px.rgba.r += ((b1 >> 4) & 0x03) - 2; + px.rgba.g += ((b1 >> 2) & 0x03) - 2; + px.rgba.b += ( b1 & 0x03) - 2; + } + else if ((b1 & QOI_MASK_2) == QOI_OP_LUMA) { + int b2 = bytes[p++]; + int vg = (b1 & 0x3f) - 32; + px.rgba.r += vg - 8 + ((b2 >> 4) & 0x0f); + px.rgba.g += vg; + px.rgba.b += vg - 8 + (b2 & 0x0f); + } + else if ((b1 & QOI_MASK_2) == QOI_OP_RUN) { + run = (b1 & 0x3f); + } + + index[QOI_COLOR_HASH(px) % 64] = px; + } + + if (channels == 4) { + *(qoi_rgba_t*)(pixels + px_pos) = px; + } + else { + pixels[px_pos + 0] = px.rgba.r; + pixels[px_pos + 1] = px.rgba.g; + pixels[px_pos + 2] = px.rgba.b; + } + } + + return pixels; +} + +#ifndef QOI_NO_STDIO +#include + +int qoi_write(const char *filename, const void *data, const qoi_desc *desc) { + FILE *f = fopen(filename, "wb"); + int size; + void *encoded; + + if (!f) { + return 0; + } + + encoded = qoi_encode(data, desc, &size); + if (!encoded) { + fclose(f); + return 0; + } + + fwrite(encoded, 1, size, f); + fclose(f); + + QOI_FREE(encoded); + return size; +} + +void *qoi_read(const char *filename, qoi_desc *desc, int channels) { + FILE *f = fopen(filename, "rb"); + int size, bytes_read; + void *pixels, *data; + + if (!f) { + return NULL; + } + + fseek(f, 0, SEEK_END); + size = ftell(f); + if (size <= 0) { + fclose(f); + return NULL; + } + fseek(f, 0, SEEK_SET); + + data = QOI_MALLOC(size); + if (!data) { + fclose(f); + return NULL; + } + + bytes_read = fread(data, 1, size, f); + fclose(f); + + pixels = qoi_decode(data, bytes_read, desc, channels); + QOI_FREE(data); + return pixels; +} + +#endif /* QOI_NO_STDIO */ +#endif /* QOI_IMPLEMENTATION */ diff --git a/src/external/vox_loader.h b/src/external/vox_loader.h index 0eb5cafb4..a7a161c7f 100644 --- a/src/external/vox_loader.h +++ b/src/external/vox_loader.h @@ -531,29 +531,34 @@ static void Vox_Build_Voxel(VoxArray3D* pvoxArray, int x, int y, int z, int matI int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArray3D* pvoxarray) { ////////////////////////////////////////////////// - //Read VOX file - //4 bytes: magic number ('V' 'O' 'X' 'space' ) - //4 bytes: version number (current version is 150 ) + // Read VOX file + // 4 bytes: magic number ('V' 'O' 'X' 'space') + // 4 bytes: version number (current version is 150) - unsigned long signature; + // @raysan5: Reviewed (unsigned long) -> (unsigned int), possible issue with Ubuntu 18.04 64bit + + // @raysan5: reviewed signature loading + unsigned char signature[4] = { 0 }; unsigned char* fileData = pvoxData; - unsigned char* fileDataPtr = fileData; unsigned char* endfileDataPtr = fileData + voxDataSize; - signature = *((unsigned long *)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + signature[0] = fileDataPtr[0]; + signature[1] = fileDataPtr[1]; + signature[2] = fileDataPtr[2]; + signature[3] = fileDataPtr[3]; + fileDataPtr += 4; - if (signature != 0x20584F56) //56 4F 58 20 + if ((signature[0] != 'V') && (signature[0] != 'O') && (signature[0] != 'X') && (signature[0] != ' ')) { return VOX_ERROR_INVALID_FORMAT; //"Not an MagicaVoxel File format" } - unsigned long version; - - version = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + // @raysan5: reviewed version loading + unsigned int version = 0; + version = ((unsigned int*)fileDataPtr)[0]; + fileDataPtr += 4; if (version < 150) { @@ -572,9 +577,9 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr //// children chunks : m bytes //{ child chunk 0 } //{ child chunk 1 } - unsigned long sizeX, sizeY, sizeZ; + unsigned int sizeX, sizeY, sizeZ; sizeX = sizeY = sizeZ = 0; - unsigned long numVoxels = 0; + unsigned int numVoxels = 0; while (fileDataPtr < endfileDataPtr) { @@ -583,23 +588,23 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr szChunkName[4] = 0; fileDataPtr += 4; - unsigned long chunkSize = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + unsigned int chunkSize = *((unsigned int*)fileDataPtr); + fileDataPtr += sizeof(unsigned int); //unsigned long chunkTotalChildSize = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + fileDataPtr += sizeof(unsigned int); if (strcmp(szChunkName, "SIZE") == 0) { //(4 bytes x 3 : x, y, z ) - sizeX = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + sizeX = *((unsigned int*)fileDataPtr); + fileDataPtr += sizeof(unsigned int); - sizeY = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + sizeY = *((unsigned int*)fileDataPtr); + fileDataPtr += sizeof(unsigned int); - sizeZ = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + sizeZ = *((unsigned int*)fileDataPtr); + fileDataPtr += sizeof(unsigned int); //Alloc vox array Vox_AllocArray(pvoxarray, sizeX, sizeZ, sizeY); //Reverse Y<>Z for left to right handed system @@ -610,8 +615,8 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr //(numVoxels : 4 bytes ) //(each voxel: 1 byte x 4 : x, y, z, colorIndex ) x numVoxels - numVoxels = *((unsigned long*)fileDataPtr); - fileDataPtr += sizeof(unsigned long); + numVoxels = *((unsigned int*)fileDataPtr); + fileDataPtr += sizeof(unsigned int); while (numVoxels > 0) { diff --git a/src/extras/physac.h b/src/extras/physac.h index 642c25a72..a10f96dd3 100644 --- a/src/extras/physac.h +++ b/src/extras/physac.h @@ -72,6 +72,16 @@ #if !defined(PHYSAC_H) #define PHYSAC_H +// Function specifiers in case library is build/used as a shared library (Windows) +// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll +#if defined(_WIN32) + #if defined(BUILD_LIBTYPE_SHARED) + #define PHYSACDEF __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) + #elif defined(USE_LIBTYPE_SHARED) + #define PHYSACDEF __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) + #endif +#endif + #ifndef PHYSACDEF #define PHYSACDEF // We are building or using physac as a static library #endif diff --git a/src/raudio.c b/src/raudio.c index bf2af3f71..b3df1db45 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -12,6 +12,9 @@ * * CONFIGURATION: * +* #define SUPPORT_MODULE_RAUDIO +* raudio module is included in the build +* * #define RAUDIO_STANDALONE * Define to use the module as standalone library (independently of raylib). * Required types and functions are defined in the same module. @@ -78,6 +81,8 @@ #include "utils.h" // Required for: fopen() Android mapping #endif +#if defined(SUPPORT_MODULE_RAUDIO) + #if defined(_WIN32) // To avoid conflicting windows.h symbols with raylib, some flags are defined // WARNING: Those flags avoid inclusion of some Win32 headers that could be required @@ -169,10 +174,9 @@ typedef struct tagBITMAPINFOHEADER { #include // Required for: malloc(), free() #include // Required for: FILE, fopen(), fclose(), fread() +#include // Required for: strcmp() [Used in IsFileExtension(), LoadWaveFromMemory(), LoadMusicStreamFromMemory()] #if defined(RAUDIO_STANDALONE) - #include // Required for: strcmp() [Used in IsFileExtension()] - #ifndef TRACELOG #define TRACELOG(level, ...) (void)0 #endif @@ -374,8 +378,6 @@ static void MixAudioFrames(float *framesOut, const float *framesIn, ma_uint32 fr #if defined(RAUDIO_STANDALONE) static bool IsFileExtension(const char *fileName, const char *ext); // Check file extension static const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes the dot: .png) -static bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal -static const char *TextToLower(const char *text); // Get lower case version of provided string static unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read) static bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite); // Save data to file from byte array (write) @@ -711,16 +713,14 @@ Wave LoadWave(const char *fileName) } // Load wave from memory buffer, fileType refers to extension: i.e. ".wav" +// WARNING: File extension must be provided in lower-case Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize) { Wave wave = { 0 }; - char fileExtLower[16] = { 0 }; - strcpy(fileExtLower, TextToLower(fileType)); - if (false) { } #if defined(SUPPORT_FILEFORMAT_WAV) - else if (TextIsEqual(fileExtLower, ".wav")) + else if (strcmp(fileType, ".wav") == 0) { drwav wav = { 0 }; bool success = drwav_init_memory(&wav, fileData, dataSize, NULL); @@ -742,7 +742,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int } #endif #if defined(SUPPORT_FILEFORMAT_OGG) - else if (TextIsEqual(fileExtLower, ".ogg")) + else if (strcmp(fileType, ".ogg") == 0) { stb_vorbis *oggData = stb_vorbis_open_memory((unsigned char *)fileData, dataSize, NULL, NULL); @@ -764,7 +764,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int } #endif #if defined(SUPPORT_FILEFORMAT_FLAC) - else if (TextIsEqual(fileExtLower, ".flac")) + else if (strcmp(fileType, ".flac") == 0) { unsigned long long int totalFrameCount = 0; @@ -777,7 +777,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int } #endif #if defined(SUPPORT_FILEFORMAT_MP3) - else if (TextIsEqual(fileExtLower, ".mp3")) + else if (strcmp(fileType, ".mp3") == 0) { drmp3_config config = { 0 }; unsigned long long int totalFrameCount = 0; @@ -862,17 +862,15 @@ Sound LoadSoundFromWave(Wave wave) // Unload wave data void UnloadWave(Wave wave) { - if (wave.data != NULL) RL_FREE(wave.data); - - TRACELOG(LOG_INFO, "WAVE: Unloaded wave data from RAM"); + RL_FREE(wave.data); + //TRACELOG(LOG_INFO, "WAVE: Unloaded wave data from RAM"); } // Unload sound void UnloadSound(Sound sound) { UnloadAudioBuffer(sound.stream.buffer); - - TRACELOG(LOG_INFO, "WAVE: Unloaded sound data from RAM"); + //TRACELOG(LOG_INFO, "SOUND: Unloaded sound data from RAM"); } // Update sound buffer with new data @@ -899,7 +897,8 @@ bool ExportWave(Wave wave, const char *fileName) drwav wav = { 0 }; drwav_data_format format = { 0 }; format.container = drwav_container_riff; - format.format = DR_WAVE_FORMAT_PCM; + if (wave.sampleSize == 32) format.format = DR_WAVE_FORMAT_IEEE_FLOAT; + else format.format = DR_WAVE_FORMAT_PCM; format.channels = wave.channels; format.sampleRate = wave.sampleRate; format.bitsPerSample = wave.sampleSize; @@ -946,7 +945,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName) int byteCount = 0; byteCount += sprintf(txtData + byteCount, "\n//////////////////////////////////////////////////////////////////////////////////\n"); byteCount += sprintf(txtData + byteCount, "// //\n"); - byteCount += sprintf(txtData + byteCount, "// WaveAsCode exporter v1.0 - Wave data exported as an array of bytes //\n"); + byteCount += sprintf(txtData + byteCount, "// WaveAsCode exporter v1.1 - Wave data exported as an array of bytes //\n"); byteCount += sprintf(txtData + byteCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n"); byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n"); @@ -955,27 +954,32 @@ bool ExportWaveAsCode(Wave wave, const char *fileName) byteCount += sprintf(txtData + byteCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "//////////////////////////////////////////////////////////////////////////////////\n\n"); - char varFileName[256] = { 0 }; -#if !defined(RAUDIO_STANDALONE) - // Get file name from path and convert variable name to uppercase - strcpy(varFileName, GetFileNameWithoutExt(fileName)); - for (int i = 0; varFileName[i] != '\0'; i++) if (varFileName[i] >= 'a' && varFileName[i] <= 'z') { varFileName[i] = varFileName[i] - 32; } -#else - strcpy(varFileName, fileName); -#endif + char fileNameLower[256] = { 0 }; + char fileNameUpper[256] = { 0 }; + for (int i = 0; fileName[i] != '.'; i++) { fileNameLower[i] = fileName[i]; } // Get filename without extension + for (int i = 0; fileNameLower[i] != '\0'; i++) if (fileNameLower[i] >= 'a' && fileNameLower[i] <= 'z') { fileNameUpper[i] = fileNameLower[i] - 32; } byteCount += sprintf(txtData + byteCount, "// Wave data information\n"); - byteCount += sprintf(txtData + byteCount, "#define %s_FRAME_COUNT %u\n", varFileName, wave.frameCount); - byteCount += sprintf(txtData + byteCount, "#define %s_FRAME_COUNT %u\n", varFileName, wave.frameCount); - byteCount += sprintf(txtData + byteCount, "#define %s_SAMPLE_RATE %u\n", varFileName, wave.sampleRate); - byteCount += sprintf(txtData + byteCount, "#define %s_SAMPLE_SIZE %u\n", varFileName, wave.sampleSize); - byteCount += sprintf(txtData + byteCount, "#define %s_CHANNELS %u\n\n", varFileName, wave.channels); + byteCount += sprintf(txtData + byteCount, "#define %s_FRAME_COUNT %u\n", fileNameUpper, wave.frameCount); + byteCount += sprintf(txtData + byteCount, "#define %s_SAMPLE_RATE %u\n", fileNameUpper, wave.sampleRate); + byteCount += sprintf(txtData + byteCount, "#define %s_SAMPLE_SIZE %u\n", fileNameUpper, wave.sampleSize); + byteCount += sprintf(txtData + byteCount, "#define %s_CHANNELS %u\n\n", fileNameUpper, wave.channels); - // Write byte data as hexadecimal text - // NOTE: Frame data exported is interlaced: Frame01[Sample-Channel01, Sample-Channel02, ...], Frame02[], Frame03[] - byteCount += sprintf(txtData + byteCount, "static unsigned char %s_DATA[%i] = { ", varFileName, waveDataSize); - for (int i = 0; i < waveDataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)wave.data)[i]); - byteCount += sprintf(txtData + byteCount, "0x%x };\n", ((unsigned char *)wave.data)[waveDataSize - 1]); + // Write wave data as an array of values + // Wave data is exported as byte array for 8/16bit and float array for 32bit float data + // NOTE: Frame data exported is channel-interlaced: frame01[sampleChannel1, sampleChannel2, ...], frame02[], frame03[] + if (wave.sampleSize == 32) + { + byteCount += sprintf(txtData + byteCount, "static float %sData[%i] = {\n", fileNameLower, waveDataSize/4); + for (int i = 1; i < waveDataSize/4; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "%.4ff,\n " : "%.4ff, "), ((float *)wave.data)[i - 1]); + byteCount += sprintf(txtData + byteCount, "%.4ff };\n", ((float *)wave.data)[waveDataSize/4 - 1]); + } + else + { + byteCount += sprintf(txtData + byteCount, "static unsigned char %sData[%i] = { ", fileNameLower, waveDataSize); + for (int i = 1; i < waveDataSize; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n " : "0x%x, "), ((unsigned char *)wave.data)[i - 1]); + byteCount += sprintf(txtData + byteCount, "0x%x };\n", ((unsigned char *)wave.data)[waveDataSize - 1]); + } // NOTE: Text data length exported is determined by '\0' (NULL) character success = SaveFileText(fileName, txtData); @@ -1039,8 +1043,8 @@ void PlaySoundMulti(Sound sound) AUDIO.MultiChannel.channels[index] = AUDIO.MultiChannel.poolCounter; AUDIO.MultiChannel.poolCounter++; - AUDIO.MultiChannel.pool[index]->volume = sound.stream.buffer->volume; - AUDIO.MultiChannel.pool[index]->pitch = sound.stream.buffer->pitch; + SetAudioBufferVolume(AUDIO.MultiChannel.pool[index], sound.stream.buffer->volume); + SetAudioBufferPitch(AUDIO.MultiChannel.pool[index], sound.stream.buffer->pitch); AUDIO.MultiChannel.pool[index]->looping = sound.stream.buffer->looping; AUDIO.MultiChannel.pool[index]->usage = sound.stream.buffer->usage; AUDIO.MultiChannel.pool[index]->isSubBufferProcessed[0] = false; @@ -1377,18 +1381,16 @@ Music LoadMusicStream(const char *fileName) return music; } -// extension including period ".mod" +// Load music stream from memory buffer, fileType refers to extension: i.e. ".wav" +// WARNING: File extension must be provided in lower-case Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int dataSize) { Music music = { 0 }; bool musicLoaded = false; - char fileExtLower[16] = { 0 }; - strcpy(fileExtLower, TextToLower(fileType)); - if (false) { } #if defined(SUPPORT_FILEFORMAT_WAV) - else if (TextIsEqual(fileExtLower, ".wav")) + else if (strcmp(fileType, ".wav") == 0) { drwav *ctxWav = RL_CALLOC(1, sizeof(drwav)); @@ -1410,7 +1412,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int d } #endif #if defined(SUPPORT_FILEFORMAT_FLAC) - else if (TextIsEqual(fileExtLower, ".flac")) + else if (strcmp(fileType, ".flac") == 0) { music.ctxType = MUSIC_AUDIO_FLAC; music.ctxData = drflac_open_memory((const void*)data, dataSize, NULL); @@ -1427,7 +1429,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int d } #endif #if defined(SUPPORT_FILEFORMAT_MP3) - else if (TextIsEqual(fileExtLower, ".mp3")) + else if (strcmp(fileType, ".mp3") == 0) { drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3)); int success = drmp3_init_memory(ctxMp3, (const void*)data, dataSize, NULL); @@ -1445,7 +1447,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int d } #endif #if defined(SUPPORT_FILEFORMAT_OGG) - else if (TextIsEqual(fileExtLower, ".ogg")) + else if (strcmp(fileType, ".ogg") == 0) { // Open ogg audio stream music.ctxType = MUSIC_AUDIO_OGG; @@ -1467,7 +1469,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int d } #endif #if defined(SUPPORT_FILEFORMAT_XM) - else if (TextIsEqual(fileExtLower, ".xm")) + else if (strcmp(fileType, ".xm") == 0) { jar_xm_context_t *ctxXm = NULL; int result = jar_xm_create_context_safe(&ctxXm, (const char *)data, dataSize, AUDIO.System.device.sampleRate); @@ -1494,7 +1496,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int d } #endif #if defined(SUPPORT_FILEFORMAT_MOD) - else if (TextIsEqual(fileExtLower, ".mod")) + else if (strcmp(fileType, ".mod") == 0) { jar_mod_context_t *ctxMod = (jar_mod_context_t *)RL_MALLOC(sizeof(jar_mod_context_t)); int result = 0; @@ -2261,38 +2263,6 @@ static const char *GetFileExtension(const char *fileName) return dot; } -// Check if two text string are equal -// REQUIRES: strcmp() -static bool TextIsEqual(const char *text1, const char *text2) -{ - bool result = false; - - if (strcmp(text1, text2) == 0) result = true; - - return result; -} - -// Get lower case version of provided string -// REQUIRES: tolower() -static const char *TextToLower(const char *text) -{ - #define MAX_TEXT_BUFFER_LENGTH 1024 - - static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 }; - - for (int i = 0; i < MAX_TEXT_BUFFER_LENGTH; i++) - { - if (text[i] != '\0') - { - buffer[i] = (char)tolower(text[i]); - //if ((text[i] >= 'A') && (text[i] <= 'Z')) buffer[i] = text[i] + 32; - } - else { buffer[i] = '\0'; break; } - } - - return buffer; -} - // Load data from file into a buffer static unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead) { @@ -2378,3 +2348,5 @@ static bool SaveFileText(const char *fileName, char *text) #endif #undef AudioBuffer + +#endif // SUPPORT_MODULE_RAUDIO diff --git a/src/raylib.h b/src/raylib.h index a95b07231..9be3e482d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1,6 +1,6 @@ /********************************************************************************************** * -* raylib v4.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) +* raylib v4.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) * * FEATURES: * - NO external dependencies, all required libraries included with raylib @@ -80,7 +80,7 @@ #include // Required for: va_list - Only used by TraceLogCallback -#define RAYLIB_VERSION "4.0" +#define RAYLIB_VERSION "4.1-dev" // Function specifiers in case library is build/used as a shared library (Windows) // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll @@ -929,6 +929,8 @@ RLAPI void SetWindowOpacity(float opacity); // Set window RLAPI void *GetWindowHandle(void); // Get native window handle RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height +RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI) +RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI) RLAPI int GetMonitorCount(void); // Get number of connected monitors RLAPI int GetCurrentMonitor(void); // Get current connected monitor RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position @@ -1030,7 +1032,7 @@ RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver // Files management functions -RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read) +RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read) RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData() RLAPI bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite); // Save data to file from byte array (write), returns true on success RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string @@ -1038,7 +1040,7 @@ RLAPI void UnloadFileText(char *text); // Unload file RLAPI bool SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success RLAPI bool FileExists(const char *fileName); // Check if file exists RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists -RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension (including point: .png, .wav) +RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (including point: .png, .wav) RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png') RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string) @@ -1317,7 +1319,7 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G // Font loading/unloading functions RLAPI Font GetFontDefault(void); // Get the default Font RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) -RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // Load font from file with extended parameters +RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount, int type); // Load font data for further use diff --git a/src/raymath.h b/src/raymath.h index 48846a7ad..97149625b 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -278,13 +278,11 @@ RMAPI float Vector2Distance(Vector2 v1, Vector2 v2) return result; } -// Calculate angle from two vectors in X-axis +// Calculate angle from two vectors RMAPI float Vector2Angle(Vector2 v1, Vector2 v2) { - float result = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/PI); - - if (result < 0) result += 360.0f; - + float result = atan2f(v2.y, v2.x) - atan2f(v1.y, v1.x); + return result; } @@ -328,8 +326,9 @@ RMAPI Vector2 Vector2Normalize(Vector2 v) if (length > 0) { - result.x = v.x*1.0f/length; - result.y = v.y*1.0f/length; + float ilength = 1.0f/length; + result.x = v.x*ilength; + result.y = v.y*ilength; } return result; @@ -531,18 +530,16 @@ RMAPI float Vector3Distance(Vector3 v1, Vector3 v2) return result; } -// Calculate angle between two vectors in XY and XZ -RMAPI Vector2 Vector3Angle(Vector3 v1, Vector3 v2) +// Calculate angle between two vectors +RMAPI float Vector3Angle(Vector3 v1, Vector3 v2) { - Vector2 result = { 0 }; - - float dx = v2.x - v1.x; - float dy = v2.y - v1.y; - float dz = v2.z - v1.z; - - result.x = atan2f(dx, dz); // Angle in XZ - result.y = atan2f(dy, sqrtf(dx*dx + dz*dz)); // Angle in XY - + float result = 0.0f; + + Vector3 cross = { v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x }; + float len = sqrtf(cross.x*cross.x + cross.y*cross.y + cross.z*cross.z); + float dot = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z); + result = atan2f(len, dot); + return result; } diff --git a/src/rcore.c b/src/rcore.c index f0e5876e9..c29356345 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -487,6 +487,8 @@ static CoreData CORE = { 0 }; // Global CORE state context static char **dirFilesPath = NULL; // Store directory files paths as strings static int dirFileCount = 0; // Count directory files strings +const char *raylibVersion = RAYLIB_VERSION; // raylib version symbol, it could be required for some bindings + #if defined(SUPPORT_SCREEN_CAPTURE) static int screenshotCounter = 0; // Screenshots counter #endif @@ -588,7 +590,7 @@ static bool eventsRecording = false; // Record events //---------------------------------------------------------------------------------- // Other Modules Functions Declaration (required by core) //---------------------------------------------------------------------------------- -#if defined(SUPPORT_DEFAULT_FONT) +#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) extern void LoadFontDefault(void); // [Module: text] Loads default font on InitWindow() extern void UnloadFontDefault(void); // [Module: text] Unloads default font from GPU memory #endif @@ -668,6 +670,10 @@ static void PlayAutomationEvent(unsigned int frame); // Play frame events void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime() #endif +#if !defined(SUPPORT_MODULE_RTEXT) +const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' +#endif // !SUPPORT_MODULE_RTEXT + //---------------------------------------------------------------------------------- // Module Functions Definition - Window and OpenGL Context Functions //---------------------------------------------------------------------------------- @@ -697,6 +703,35 @@ struct android_app *GetAndroidApp(void) void InitWindow(int width, int height, const char *title) { TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION); + + TRACELOG(LOG_INFO, "Supported raylib modules:"); + TRACELOG(LOG_INFO, " > rcore:..... loaded (mandatory)"); + TRACELOG(LOG_INFO, " > rlgl:...... loaded (mandatory)"); +#if defined(SUPPORT_MODULE_RSHAPES) + TRACELOG(LOG_INFO, " > rshapes:... loaded (optional)"); +#else + TRACELOG(LOG_INFO, " > rshapes:... not loaded (optional)"); +#endif +#if defined(SUPPORT_MODULE_RTEXTURES) + TRACELOG(LOG_INFO, " > rtextures:. loaded (optional)"); +#else + TRACELOG(LOG_INFO, " > rtextures:. not loaded (optional)"); +#endif +#if defined(SUPPORT_MODULE_RTEXT) + TRACELOG(LOG_INFO, " > rtext:..... loaded (optional)"); +#else + TRACELOG(LOG_INFO, " > rtext:..... not loaded (optional)"); +#endif +#if defined(SUPPORT_MODULE_RMODELS) + TRACELOG(LOG_INFO, " > rmodels:... loaded (optional)"); +#else + TRACELOG(LOG_INFO, " > rmodels:... not loaded (optional)"); +#endif +#if defined(SUPPORT_MODULE_RAUDIO) + TRACELOG(LOG_INFO, " > raudio:.... loaded (optional)"); +#else + TRACELOG(LOG_INFO, " > raudio:.... not loaded (optional)"); +#endif if ((title != NULL) && (title[0] != 0)) CORE.Window.title = title; @@ -791,24 +826,30 @@ void InitWindow(int width, int height, const char *title) // Initialize base path for storage CORE.Storage.basePath = GetWorkingDirectory(); -#if defined(SUPPORT_DEFAULT_FONT) +#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) // Load default font - // NOTE: External functions (defined in module: text) + // WARNING: External function: Module required: rtext LoadFontDefault(); + #if defined(SUPPORT_MODULE_RSHAPES) Rectangle rec = GetFontDefault().recs[95]; // NOTE: We setup a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering - SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 }); + SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 }); // WARNING: Module required: rshapes + #endif #else + #if defined(SUPPORT_MODULE_RSHAPES) // Set default texture and rectangle to be used for shapes drawing // NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8 Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; - SetShapesTexture(texture, (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); + SetShapesTexture(texture, (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); // WARNING: Module required: rshapes + #endif #endif -#if defined(PLATFORM_DESKTOP) +#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) { // Set default font texture filter for HighDPI (blurry) - SetTextureFilter(GetFontDefault().texture, TEXTURE_FILTER_BILINEAR); + // RL_TEXTURE_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps + rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR); + rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR); } #endif @@ -867,8 +908,8 @@ void CloseWindow(void) } #endif -#if defined(SUPPORT_DEFAULT_FONT) - UnloadFontDefault(); +#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) + UnloadFontDefault(); // WARNING: Module required: rtext #endif rlglClose(); // De-init rlgl @@ -1936,11 +1977,11 @@ void EndDrawing(void) { rlDrawRenderBatchActive(); // Update and draw internal render batch -#if defined(SUPPORT_MOUSE_CURSOR_POINT) +#if defined(SUPPORT_MODULE_RSHAPES) && defined(SUPPORT_MOUSE_CURSOR_POINT) // Draw a small rectangle on mouse position for user reference if (!CORE.Input.Mouse.cursorHidden) { - DrawRectangle(CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y, 3, 3, MAROON); + DrawRectangle(CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y, 3, 3, MAROON); // WARNING: Module required: rshapes rlDrawRenderBatchActive(); // Update and draw internal render batch } #endif @@ -1963,11 +2004,13 @@ void EndDrawing(void) RL_FREE(screenData); // Free image data } + #if defined(SUPPORT_MODULE_RSHAPES) && defined(SUPPORT_MODULE_RTEXT) if (((gifFrameCounter/15)%2) == 1) { - DrawCircle(30, CORE.Window.screen.height - 20, 10, MAROON); - DrawText("GIF RECORDING", 50, CORE.Window.screen.height - 25, 10, RED); + DrawCircle(30, CORE.Window.screen.height - 20, 10, MAROON); // WARNING: Module required: rshapes + DrawText("GIF RECORDING", 50, CORE.Window.screen.height - 25, 10, RED); // WARNING: Module required: rtext } + #endif rlDrawRenderBatchActive(); // Update and draw internal render batch } @@ -2194,16 +2237,20 @@ void BeginScissorMode(int x, int y, int width, int height) rlEnableScissorTest(); +#if defined(__APPLE__) + Vector2 scale = GetWindowScaleDPI(); + rlScissor((int)(x*scale.x), (int)(GetScreenHeight()*scale.y - (((y + height)*scale.y))), (int)(width*scale.x), (int)(height*scale.y)); +#else if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) { Vector2 scale = GetWindowScaleDPI(); - rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - (y + height)*scale.y), (int)(width*scale.x), (int)(height*scale.y)); } else { rlScissor(x, CORE.Window.currentFbo.height - (y + height), width, height); } +#endif } // End scissor mode @@ -2671,13 +2718,14 @@ void SetConfigFlags(unsigned int flags) // Takes a screenshot of current screen (saved a .png) void TakeScreenshot(const char *fileName) { +#if defined(SUPPORT_MODULE_RTEXTURES) unsigned char *imgData = rlReadScreenPixels(CORE.Window.render.width, CORE.Window.render.height); Image image = { imgData, CORE.Window.render.width, CORE.Window.render.height, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; char path[2048] = { 0 }; strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName)); - - ExportImage(image, path); + + ExportImage(image, path); // WARNING: Module required: rtextures RL_FREE(imgData); #if defined(PLATFORM_WEB) @@ -2687,6 +2735,9 @@ void TakeScreenshot(const char *fileName) #endif TRACELOG(LOG_INFO, "SYSTEM: [%s] Screenshot taken successfully", path); +#else + TRACELOG(LOG_WARNING,"IMAGE: ExportImage() requires module: rtextures"); +#endif } // Get a random value between min and max (both included) @@ -2736,16 +2787,16 @@ bool IsFileExtension(const char *fileName, const char *ext) if (fileExt != NULL) { -#if defined(SUPPORT_TEXT_MANIPULATION) +#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_TEXT_MANIPULATION) int extCount = 0; - const char **checkExts = TextSplit(ext, ';', &extCount); + const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext char fileExtLower[16] = { 0 }; - strcpy(fileExtLower, TextToLower(fileExt)); + strcpy(fileExtLower, TextToLower(fileExt)); // WARNING: Module required: rtext for (int i = 0; i < extCount; i++) { - if (TextIsEqual(fileExtLower, TextToLower(checkExts[i]))) + if (strcmp(fileExtLower, TextToLower(checkExts[i])) == 0) { result = true; break; @@ -3275,7 +3326,8 @@ void OpenURL(const char *url) #if defined(__APPLE__) sprintf(cmd, "open '%s'", url); #endif - system(cmd); + int result = system(cmd); + if (result == -1) TRACELOG(LOG_WARNING, "OpenURL() child process could not be created"); RL_FREE(cmd); #endif #if defined(PLATFORM_WEB) @@ -5308,13 +5360,15 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd) // Initialize random seed srand((unsigned int)time(NULL)); - #if defined(SUPPORT_DEFAULT_FONT) + #if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT) // Load default font - // NOTE: External function (defined in module: text) + // WARNING: External function: Module required: rtext LoadFontDefault(); Rectangle rec = GetFontDefault().recs[95]; // NOTE: We setup a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering - SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 }); + #if defined(SUPPORT_MODULE_RSHAPES) + SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 }); // WARNING: Module required: rshapes + #endif #endif // TODO: GPU assets reload in case of lost focus (lost context) @@ -6782,3 +6836,34 @@ static void PlayAutomationEvent(unsigned int frame) } } #endif + +#if !defined(SUPPORT_MODULE_RTEXT) +// Formatting of text with variables to 'embed' +// WARNING: String returned will expire after this function is called MAX_TEXTFORMAT_BUFFERS times +const char *TextFormat(const char *text, ...) +{ +#ifndef MAX_TEXTFORMAT_BUFFERS + #define MAX_TEXTFORMAT_BUFFERS 4 // Maximum number of static buffers for text formatting +#endif +#ifndef MAX_TEXT_BUFFER_LENGTH + #define MAX_TEXT_BUFFER_LENGTH 1024 // Maximum size of static text buffer +#endif + + // We create an array of buffers so strings don't expire until MAX_TEXTFORMAT_BUFFERS invocations + static char buffers[MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH] = { 0 }; + static int index = 0; + + char *currentBuffer = buffers[index]; + memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH); // Clear buffer before using + + va_list args; + va_start(args, text); + vsnprintf(currentBuffer, MAX_TEXT_BUFFER_LENGTH, text, args); + va_end(args); + + index += 1; // Move to next buffer for next function call + if (index >= MAX_TEXTFORMAT_BUFFERS) index = 0; + + return currentBuffer; +} +#endif // !SUPPORT_MODULE_RTEXT diff --git a/src/rlgl.h b/src/rlgl.h index b0a6e9742..0b74014f0 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -3899,6 +3899,8 @@ unsigned int rlLoadShaderBuffer(unsigned long long size, const void *data, int u glGenBuffers(1, &ssbo); glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo); glBufferData(GL_SHADER_STORAGE_BUFFER, size, data, usageHint? usageHint : RL_STREAM_COPY); + glClearBufferData(GL_SHADER_STORAGE_BUFFER, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, 0); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); #endif return ssbo; diff --git a/src/rmodels.c b/src/rmodels.c index 8f347ace0..3ee3a4708 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -4,12 +4,14 @@ * * CONFIGURATION: * +* #define SUPPORT_MODULE_RMODELS +* rmodels module is included in the build +* * #define SUPPORT_FILEFORMAT_OBJ * #define SUPPORT_FILEFORMAT_MTL * #define SUPPORT_FILEFORMAT_IQM * #define SUPPORT_FILEFORMAT_GLTF * #define SUPPORT_FILEFORMAT_VOX -* * Selected desired fileformats to be supported for model data loading. * * #define SUPPORT_MESH_GENERATION @@ -45,6 +47,8 @@ #include "config.h" // Defines module configuration flags #endif +#if defined(SUPPORT_MODULE_RMODELS) + #include "utils.h" // Required for: TRACELOG(), LoadFileData(), LoadFileText(), SaveFileText() #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 #include "raymath.h" // Required for: Vector3, Quaternion and Matrix functionality @@ -918,7 +922,7 @@ Model LoadModel(const char *fileName) if (IsFileExtension(fileName, ".iqm")) model = LoadIQM(fileName); #endif #if defined(SUPPORT_FILEFORMAT_GLTF) - if (IsFileExtension(fileName, ".gltf;.glb")) model = LoadGLTF(fileName); + if (IsFileExtension(fileName, ".gltf") || IsFileExtension(fileName, ".glb")) model = LoadGLTF(fileName); #endif #if defined(SUPPORT_FILEFORMAT_VOX) if (IsFileExtension(fileName, ".vox")) model = LoadVOX(fileName); @@ -1325,7 +1329,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform) // Set default value for unused attribute // NOTE: Required when using default shader and no VAO support float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - rlSetVertexAttributeDefault(material.shader.locs[SHADER_LOC_VERTEX_COLOR], value, SHADER_ATTRIB_VEC2, 4); + rlSetVertexAttributeDefault(material.shader.locs[SHADER_LOC_VERTEX_COLOR], value, SHADER_ATTRIB_VEC4, 4); rlDisableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR]); } } @@ -1540,7 +1544,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins // Set default value for unused attribute // NOTE: Required when using default shader and no VAO support float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - rlSetVertexAttributeDefault(material.shader.locs[SHADER_LOC_VERTEX_COLOR], value, SHADER_ATTRIB_VEC2, 4); + rlSetVertexAttributeDefault(material.shader.locs[SHADER_LOC_VERTEX_COLOR], value, SHADER_ATTRIB_VEC4, 4); rlDisableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_COLOR]); } } @@ -1620,7 +1624,7 @@ void UnloadMesh(Mesh mesh) // Unload rlgl mesh vboId data rlUnloadVertexArray(mesh.vaoId); - for (int i = 0; i < MAX_MESH_VERTEX_BUFFERS; i++) rlUnloadVertexBuffer(mesh.vboId[i]); + if (mesh.vboId != NULL) for (int i = 0; i < MAX_MESH_VERTEX_BUFFERS; i++) rlUnloadVertexBuffer(mesh.vboId[i]); RL_FREE(mesh.vboId); RL_FREE(mesh.vertices); @@ -1645,13 +1649,13 @@ bool ExportMesh(Mesh mesh, const char *fileName) if (IsFileExtension(fileName, ".obj")) { // Estimated data size, it should be enough... - int dataSize = mesh.vertexCount/3*(int)strlen("v 0000.00f 0000.00f 0000.00f") + - mesh.vertexCount/2*(int)strlen("vt 0.000f 0.00f") + - mesh.vertexCount/3*(int)strlen("vn 0.000f 0.00f 0.00f") + - mesh.triangleCount/3*(int)strlen("f 00000/00000/00000 00000/00000/00000 00000/00000/00000"); + int dataSize = mesh.vertexCount*(int)strlen("v 0000.00f 0000.00f 0000.00f") + + mesh.vertexCount*(int)strlen("vt 0.000f 0.00f") + + mesh.vertexCount*(int)strlen("vn 0.000f 0.00f 0.00f") + + mesh.triangleCount*(int)strlen("f 00000/00000/00000 00000/00000/00000 00000/00000/00000"); // NOTE: Text data buffer size is estimated considering mesh data size - char *txtData = (char *)RL_CALLOC(dataSize + 2000, sizeof(char)); + char *txtData = (char *)RL_CALLOC(dataSize*2 + 2000, sizeof(char)); int byteCount = 0; byteCount += sprintf(txtData + byteCount, "# //////////////////////////////////////////////////////////////////////////////////\n"); @@ -1661,7 +1665,7 @@ bool ExportMesh(Mesh mesh, const char *fileName) byteCount += sprintf(txtData + byteCount, "# // more info and bugs-report: github.com/raysan5/raylib //\n"); byteCount += sprintf(txtData + byteCount, "# // feedback and support: ray[at]raylib.com //\n"); byteCount += sprintf(txtData + byteCount, "# // //\n"); - byteCount += sprintf(txtData + byteCount, "# // Copyright (c) 2018 Ramon Santamaria (@raysan5) //\n"); + byteCount += sprintf(txtData + byteCount, "# // Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n"); byteCount += sprintf(txtData + byteCount, "# // //\n"); byteCount += sprintf(txtData + byteCount, "# //////////////////////////////////////////////////////////////////////////////////\n\n"); byteCount += sprintf(txtData + byteCount, "# Vertex Count: %i\n", mesh.vertexCount); @@ -1684,9 +1688,22 @@ bool ExportMesh(Mesh mesh, const char *fileName) byteCount += sprintf(txtData + byteCount, "vn %.3f %.3f %.3f\n", mesh.normals[v], mesh.normals[v + 1], mesh.normals[v + 2]); } - for (int i = 0; i < mesh.triangleCount; i++) + if (mesh.indices != NULL) { - byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", i, i, i, i + 1, i + 1, i + 1, i + 2, i + 2, i + 2); + for (int i = 0, v = 0; i < mesh.triangleCount; i++, v += 3) + { + byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", + mesh.indices[v] + 1, mesh.indices[v] + 1, mesh.indices[v] + 1, + mesh.indices[v + 1] + 1, mesh.indices[v + 1] + 1, mesh.indices[v + 1] + 1, + mesh.indices[v + 2] + 1, mesh.indices[v + 2] + 1, mesh.indices[v + 2] + 1); + } + } + else + { + for (int i = 0, v = 1; i < mesh.triangleCount; i++, v += 3) + { + byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", v, v, v, v + 1, v + 1, v + 1, v + 2, v + 2, v + 2); + } } byteCount += sprintf(txtData + byteCount, "\n"); @@ -1704,7 +1721,6 @@ bool ExportMesh(Mesh mesh, const char *fileName) return success; } - // Load materials from model file Material *LoadMaterials(const char *fileName, int *materialCount) { @@ -1771,9 +1787,12 @@ void UnloadMaterial(Material material) if (material.shader.id != rlGetShaderIdDefault()) UnloadShader(material.shader); // Unload loaded texture maps (avoid unloading default texture, managed by raylib) - for (int i = 0; i < MAX_MATERIAL_MAPS; i++) + if (material.maps != NULL) { - if (material.maps[i].texture.id != rlGetTextureIdDefault()) rlUnloadTexture(material.maps[i].texture.id); + for (int i = 0; i < MAX_MATERIAL_MAPS; i++) + { + if (material.maps[i].texture.id != rlGetTextureIdDefault()) rlUnloadTexture(material.maps[i].texture.id); + } } RL_FREE(material.maps); @@ -2249,14 +2268,14 @@ Mesh GenMeshCube(float width, float height, float length) int k = 0; // Indices can be initialized right now - for (int i = 0; i < 36; i+=6) + for (int i = 0; i < 36; i += 6) { mesh.indices[i] = 4*k; - mesh.indices[i+1] = 4*k+1; - mesh.indices[i+2] = 4*k+2; - mesh.indices[i+3] = 4*k; - mesh.indices[i+4] = 4*k+2; - mesh.indices[i+5] = 4*k+3; + mesh.indices[i + 1] = 4*k + 1; + mesh.indices[i + 2] = 4*k + 2; + mesh.indices[i + 3] = 4*k; + mesh.indices[i + 4] = 4*k + 2; + mesh.indices[i + 5] = 4*k + 3; k++; } @@ -2412,13 +2431,13 @@ Mesh GenMeshCylinder(float radius, float height, int slices) par_shapes_mesh *cylinder = par_shapes_create_cylinder(slices, 8); par_shapes_scale(cylinder, radius, radius, height); par_shapes_rotate(cylinder, -PI/2.0f, (float[]){ 1, 0, 0 }); - par_shapes_rotate(cylinder, PI/2.0f, (float[]){ 0, 1, 0 }); // Generate an orientable disk shape (top cap) par_shapes_mesh *capTop = par_shapes_create_disk(radius, slices, (float[]){ 0, 0, 0 }, (float[]){ 0, 0, 1 }); capTop->tcoords = PAR_MALLOC(float, 2*capTop->npoints); for (int i = 0; i < 2*capTop->npoints; i++) capTop->tcoords[i] = 0.0f; par_shapes_rotate(capTop, -PI/2.0f, (float[]){ 1, 0, 0 }); + par_shapes_rotate(capTop, 90*DEG2RAD, (float[]){ 0, 1, 0 }); par_shapes_translate(capTop, 0, height, 0); // Generate an orientable disk shape (bottom cap) @@ -2426,6 +2445,7 @@ Mesh GenMeshCylinder(float radius, float height, int slices) capBottom->tcoords = PAR_MALLOC(float, 2*capBottom->npoints); for (int i = 0; i < 2*capBottom->npoints; i++) capBottom->tcoords[i] = 0.95f; par_shapes_rotate(capBottom, PI/2.0f, (float[]){ 1, 0, 0 }); + par_shapes_rotate(capBottom, -90*DEG2RAD, (float[]){ 0, 1, 0 }); par_shapes_merge_and_free(cylinder, capTop); par_shapes_merge_and_free(cylinder, capBottom); @@ -4923,6 +4943,56 @@ static Model LoadGLTF(const char *fileName) } } +/* + // TODO: Load glTF meshes animation data + // REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skins + // REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skinned-mesh-attributes + //---------------------------------------------------------------------------------------------------- + for (unsigned int i = 0, meshIndex = 0; i < data->meshes_count; i++) + { + for (unsigned int p = 0; p < data->meshes[i].primitives_count; p++) + { + // NOTE: We only support primitives defined by triangles + if (data->meshes[i].primitives[p].type != cgltf_primitive_type_triangles) continue; + + for (unsigned int j = 0; j < data->meshes[i].primitives[p].attributes_count; j++) + { + // NOTE: JOINTS_1 + WEIGHT_1 will be used for +4 joints influencing a vertex -> Not supported by raylib + + if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_joints) // JOINTS_n (vec4: 4 bones max per vertex / u8, u16) + { + cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data; + + if ((attribute->component_type == cgltf_component_type_r_8u) && (attribute->type == cgltf_type_vec4)) + { + // Init raylib mesh bone ids to copy glTF attribute data + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char)); + + // Load 4 components of unsigned char data type into mesh.boneIds + LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].boneIds) + } + else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint attribute data format not supported, use vec4 u8", fileName); + } + else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_weights) // WEIGHTS_n (vec4 / u8, u16, f32) + { + cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data; + + if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec4)) + { + // Init raylib mesh bone weight to copy glTF attribute data + model.meshes[meshIndex].boneWeights = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(float)); + + // Load 4 components of float data type into mesh.boneWeights + LOAD_ATTRIBUTE(attribute, 4, float, model.meshes[meshIndex].boneWeights) + } + else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint weight attribute data format not supported, use vec4 float", fileName); + } + } + + meshIndex++; // Move to next mesh + } + } +*/ // Free all cgltf loaded data cgltf_free(data); } @@ -5039,3 +5109,5 @@ static Model LoadVOX(const char *fileName) return model; } #endif + +#endif // SUPPORT_MODULE_RMODELS diff --git a/src/rshapes.c b/src/rshapes.c index a60d52b43..23559e43c 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -17,6 +17,9 @@ * * CONFIGURATION: * +* #define SUPPORT_MODULE_RSHAPES +* rshapes module is included in the build +* * #define SUPPORT_QUADS_DRAW_MODE * Use QUADS instead of TRIANGLES for drawing when possible. Lines-based shapes still use LINES * @@ -49,6 +52,8 @@ #include "config.h" // Defines module configuration flags #endif +#if defined(SUPPORT_MODULE_RSHAPES) + #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 #include // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf() @@ -75,8 +80,8 @@ //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -Texture2D texShapes = { 1, 1, 1, 1, 7 }; // Texture used on shapes drawing (usually a white pixel) -Rectangle texShapesRec = { 0, 0, 1, 1 }; // Texture source rectangle used on shapes drawing +Texture2D texShapes = { 1, 1, 1, 1, 7 }; // Texture used on shapes drawing (usually a white pixel) +Rectangle texShapesRec = { 0.0f, 0.0f, 1.0f, 1.0f }; // Texture source rectangle used on shapes drawing //---------------------------------------------------------------------------------- // Module specific Functions Declaration @@ -1810,3 +1815,5 @@ static float EaseCubicInOut(float t, float b, float c, float d) return 0.5f*c*(t*t*t + 2.0f) + b; } + +#endif // SUPPORT_MODULE_RSHAPES diff --git a/src/rtext.c b/src/rtext.c index 137ad1864..a65f8e7f1 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -4,6 +4,9 @@ * * CONFIGURATION: * +* #define SUPPORT_MODULE_RTEXT +* rtext module is included in the build +* * #define SUPPORT_FILEFORMAT_FNT * #define SUPPORT_FILEFORMAT_TTF * Selected desired fileformats to be supported for loading. Some of those formats are @@ -53,6 +56,8 @@ #include "config.h" // Defines module configuration flags #endif +#if defined(SUPPORT_MODULE_RTEXT) + #include "utils.h" // Required for: LoadFileText() #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro() @@ -311,7 +316,7 @@ Font LoadFont(const char *fileName) Font font = { 0 }; #if defined(SUPPORT_FILEFORMAT_TTF) - if (IsFileExtension(fileName, ".ttf;.otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS); + if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS); else #endif #if defined(SUPPORT_FILEFORMAT_FNT) @@ -917,8 +922,8 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz // Character destination rectangle on screen // NOTE: We consider glyphPadding on drawing - Rectangle dstRec = { position.x + font.glyphs[index].offsetX*scaleFactor - (float)font.glyphPadding*scaleFactor, - position.y + font.glyphs[index].offsetY*scaleFactor - (float)font.glyphPadding*scaleFactor, + Rectangle dstRec = { (int)position.x + font.glyphs[index].offsetX*scaleFactor - (float)font.glyphPadding*scaleFactor, + (int)position.y + font.glyphs[index].offsetY*scaleFactor - (float)font.glyphPadding*scaleFactor, (font.recs[index].width + 2.0f*font.glyphPadding)*scaleFactor, (font.recs[index].height + 2.0f*font.glyphPadding)*scaleFactor }; @@ -1593,7 +1598,7 @@ int GetCodepoint(const char *text, int *bytesProcessed) if (((octet == 0xe0) && !((octet1 >= 0xa0) && (octet1 <= 0xbf))) || ((octet == 0xed) && !((octet1 >= 0x80) && (octet1 <= 0x9f)))) { *bytesProcessed = 2; return code; } - if ((octet >= 0xe0) && (0 <= 0xef)) + if ((octet >= 0xe0) && (octet <= 0xef)) { code = ((octet & 0xf) << 12) | ((octet1 & 0x3f) << 6) | (octet2 & 0x3f); *bytesProcessed = 3; @@ -1795,3 +1800,5 @@ static Font LoadBMFont(const char *fileName) return font; } #endif + +#endif // SUPPORT_MODULE_RTEXT diff --git a/src/rtextures.c b/src/rtextures.c index ceb1586c8..73769a90e 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -4,11 +4,15 @@ * * CONFIGURATION: * +* #define SUPPORT_MODULE_RTEXTURES +* rtextures module is included in the build +* * #define SUPPORT_FILEFORMAT_BMP * #define SUPPORT_FILEFORMAT_PNG * #define SUPPORT_FILEFORMAT_TGA * #define SUPPORT_FILEFORMAT_JPG * #define SUPPORT_FILEFORMAT_GIF +* #define SUPPORT_FILEFORMAT_QOI * #define SUPPORT_FILEFORMAT_PSD * #define SUPPORT_FILEFORMAT_PIC * #define SUPPORT_FILEFORMAT_HDR @@ -64,11 +68,13 @@ #include "config.h" // Defines module configuration flags #endif +#if defined(SUPPORT_MODULE_RTEXTURES) + #include "utils.h" // Required for: TRACELOG() and fopen() Android mapping #include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3 or ES2 #include // Required for: malloc(), free() -#include // Required for: strlen() [Used in ImageTextEx()] +#include // Required for: strlen() [Used in ImageTextEx()], strcmp() [Used in LoadImageFromMemory()] #include // Required for: fabsf() #include // Required for: sprintf() [Used in ExportImageAsCode()] @@ -124,6 +130,14 @@ // NOTE: Used to read image data (multiple formats support) #endif +#if defined(SUPPORT_FILEFORMAT_QOI) + #define QOI_MALLOC RL_MALLOC + #define QOI_FREE RL_FREE + + #define QOI_IMPLEMENTATION + #include "external/qoi.h" +#endif + #if defined(SUPPORT_IMAGE_EXPORT) #define STBIW_MALLOC RL_MALLOC #define STBIW_FREE RL_FREE @@ -202,7 +216,8 @@ Image LoadImage(const char *fileName) defined(SUPPORT_FILEFORMAT_PIC) || \ defined(SUPPORT_FILEFORMAT_HDR) || \ defined(SUPPORT_FILEFORMAT_PSD) -#define STBI_REQUIRED + + #define STBI_REQUIRED #endif // Loading file to memory @@ -286,36 +301,33 @@ Image LoadImageAnim(const char *fileName, int *frames) } // Load image from memory buffer, fileType refers to extension: i.e. ".png" +// WARNING: File extension must be provided in lower-case Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize) { Image image = { 0 }; - char fileExtLower[16] = { 0 }; - strcpy(fileExtLower, TextToLower(fileType)); - #if defined(SUPPORT_FILEFORMAT_PNG) - if ((TextIsEqual(fileExtLower, ".png")) + if ((strcmp(fileType, ".png") == 0) #else if ((false) #endif #if defined(SUPPORT_FILEFORMAT_BMP) - || (TextIsEqual(fileExtLower, ".bmp")) + || (strcmp(fileType, ".bmp") == 0) #endif #if defined(SUPPORT_FILEFORMAT_TGA) - || (TextIsEqual(fileExtLower, ".tga")) + || (strcmp(fileType, ".tga") == 0) #endif #if defined(SUPPORT_FILEFORMAT_JPG) - || (TextIsEqual(fileExtLower, ".jpg") || - TextIsEqual(fileExtLower, ".jpeg")) + || ((strcmp(fileType, ".jpg") == 0) || (strcmp(fileType, ".jpeg") == 0)) #endif #if defined(SUPPORT_FILEFORMAT_GIF) - || (TextIsEqual(fileExtLower, ".gif")) + || (strcmp(fileType, ".gif") == 0) #endif #if defined(SUPPORT_FILEFORMAT_PIC) - || (TextIsEqual(fileExtLower, ".pic")) + || (strcmp(fileType, ".pic") == 0) #endif #if defined(SUPPORT_FILEFORMAT_PSD) - || (TextIsEqual(fileExtLower, ".psd")) + || (strcmp(fileType, ".psd") == 0) #endif ) { @@ -340,7 +352,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i #endif } #if defined(SUPPORT_FILEFORMAT_HDR) - else if (TextIsEqual(fileExtLower, ".hdr")) + else if (strcmp(fileType, ".hdr") == 0) { #if defined(STBI_REQUIRED) if (fileData != NULL) @@ -362,20 +374,31 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i #endif } #endif +#if defined(SUPPORT_FILEFORMAT_QOI) + else if (strcmp(fileType, ".qoi") == 0) + { + qoi_desc desc = { 0 }; + image.data = qoi_decode(fileData, dataSize, &desc, 4); + image.width = desc.width; + image.height = desc.height; + image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; + image.mipmaps = 1; + } +#endif #if defined(SUPPORT_FILEFORMAT_DDS) - else if (TextIsEqual(fileExtLower, ".dds")) image = LoadDDS(fileData, dataSize); + else if (strcmp(fileType, ".dds") == 0) image = LoadDDS(fileData, dataSize); #endif #if defined(SUPPORT_FILEFORMAT_PKM) - else if (TextIsEqual(fileExtLower, ".pkm")) image = LoadPKM(fileData, dataSize); + else if (strcmp(fileType, ".pkm") == 0) image = LoadPKM(fileData, dataSize); #endif #if defined(SUPPORT_FILEFORMAT_KTX) - else if (TextIsEqual(fileExtLower, ".ktx")) image = LoadKTX(fileData, dataSize); + else if (strcmp(fileType, ".ktx") == 0) image = LoadKTX(fileData, dataSize); #endif #if defined(SUPPORT_FILEFORMAT_PVR) - else if (TextIsEqual(fileExtLower, ".pvr")) image = LoadPVR(fileData, dataSize); + else if (strcmp(fileType, ".pvr") == 0) image = LoadPVR(fileData, dataSize); #endif #if defined(SUPPORT_FILEFORMAT_ASTC) - else if (TextIsEqual(fileExtLower, ".astc")) image = LoadASTC(fileData, dataSize); + else if (strcmp(fileType, ".astc") == 0) image = LoadASTC(fileData, dataSize); #endif else TRACELOG(LOG_WARNING, "IMAGE: Data format not supported"); @@ -479,6 +502,26 @@ bool ExportImage(Image image, const char *fileName) #if defined(SUPPORT_FILEFORMAT_JPG) else if (IsFileExtension(fileName, ".jpg")) success = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100 #endif +#if defined(SUPPORT_FILEFORMAT_QOI) + else if (IsFileExtension(fileName, ".qoi")) + { + channels = 0; + if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) channels = 3; + else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4; + else TRACELOG(LOG_WARNING, "IMAGE: Image pixel format must be R8G8B8 or R8G8B8A8"); + + if ((channels == 3) || (channels == 4)) + { + qoi_desc desc = { 0 }; + desc.width = image.width; + desc.height = image.height; + desc.channels = channels; + desc.colorspace = QOI_SRGB; + + success = qoi_write(fileName, imgData, &desc); + } + } +#endif #if defined(SUPPORT_FILEFORMAT_KTX) else if (IsFileExtension(fileName, ".ktx")) success = SaveKTX(image, fileName); #endif @@ -732,7 +775,7 @@ Image GenImageCellular(int width, int height, int tileSize) { int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1); int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1); - seeds[i] = (Vector2){ (float)x, (float)y}; + seeds[i] = (Vector2){ (float)x, (float)y }; } for (int y = 0; y < height; y++) @@ -743,7 +786,7 @@ Image GenImageCellular(int width, int height, int tileSize) { int tileX = x/tileSize; - float minDistance = (float)strtod("Inf", NULL); + float minDistance = 65536.0f; //(float)strtod("Inf", NULL); // Check all adjacent tiles for (int i = -1; i < 2; i++) @@ -1092,35 +1135,41 @@ void ImageToPOT(Image *image, Color fill) // Create an image from text (default font) Image ImageText(const char *text, int fontSize, Color color) { + Image imText = { 0 }; +#if defined(SUPPORT_MODULE_RTEXT) int defaultFontSize = 10; // Default Font chars height in pixel if (fontSize < defaultFontSize) fontSize = defaultFontSize; int spacing = fontSize/defaultFontSize; - - Image imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); - + imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext +#else + imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle + TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext"); +#endif return imText; } // Create an image from text (custom sprite font) Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) { + Image imText = { 0 }; +#if defined(SUPPORT_MODULE_RTEXT) int size = (int)strlen(text); // Get size in bytes of text int textOffsetX = 0; // Image drawing position X int textOffsetY = 0; // Offset between lines (on line break '\n') // NOTE: Text image is generated at font base size, later scaled to desired font size - Vector2 imSize = MeasureTextEx(font, text, (float)font.baseSize, spacing); + Vector2 imSize = MeasureTextEx(font, text, (float)font.baseSize, spacing); // WARNING: Module required: rtext // Create image to store text - Image imText = GenImageColor((int)imSize.x, (int)imSize.y, BLANK); + imText = GenImageColor((int)imSize.x, (int)imSize.y, BLANK); for (int i = 0; i < size; i++) { // Get next codepoint from byte string and glyph index in font int codepointByteCount = 0; - int codepoint = GetCodepoint(&text[i], &codepointByteCount); - int index = GetGlyphIndex(font, codepoint); + int codepoint = GetCodepoint(&text[i], &codepointByteCount); // WARNING: Module required: rtext + int index = GetGlyphIndex(font, codepoint); // WARNING: Module required: rtext // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f) // but we need to draw all of the bad bytes using the '?' symbol moving one byte @@ -1155,10 +1204,14 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co TRACELOG(LOG_INFO, "IMAGE: Text scaled by factor: %f", scaleFactor); // Using nearest-neighbor scaling algorithm for default font + // WARNING: Module required: rtext if (font.texture.id == GetFontDefault().texture.id) ImageResizeNN(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor)); else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor)); } - +#else + imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle + TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext"); +#endif return imText; } @@ -2716,6 +2769,9 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color // [x] Consider fast path: no alpha blending required cases (src has no alpha) // [x] Consider fast path: same src/dst format with no alpha -> direct line copy // [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend() + // [ ] Support f32bit channels drawing + + // TODO: Support PIXELFORMAT_UNCOMPRESSED_R32, PIXELFORMAT_UNCOMPRESSED_R32G32B32, PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 Color colSrc, colDst, blend; bool blendRequired = true; @@ -2768,10 +2824,13 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color // Draw text (default font) within an image (destination) void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) { +#if defined(SUPPORT_MODULE_RTEXT) Vector2 position = { (float)posX, (float)posY }; - - // NOTE: For default font, sapcing is set to desired font size / default font size (10) - ImageDrawTextEx(dst, GetFontDefault(), text, position, (float)fontSize, (float)fontSize/10, color); + // NOTE: For default font, spacing is set to desired font size / default font size (10) + ImageDrawTextEx(dst, GetFontDefault(), text, position, (float)fontSize, (float)fontSize/10, color); // WARNING: Module required: rtext +#else + TRACELOG(LOG_WARNING, "IMAGE: ImageDrawText() requires module: rtext"); +#endif } // Draw text (custom sprite font) within an image (destination) @@ -2849,6 +2908,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout) cubemap.height = cubemap.width; } + // Layout provided or already auto-detected if (layout != CUBEMAP_LAYOUT_AUTO_DETECT) { int size = cubemap.width; @@ -2859,8 +2919,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout) if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL) { - faces = image; - for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i; + faces = ImageCopy(image); // Image data already follows expected convention } else if (layout == CUBEMAP_LAYOUT_PANORAMA) { @@ -2894,10 +2953,12 @@ TextureCubemap LoadTextureCubemap(Image image, int layout) ImageFormat(&faces, image.format); // NOTE: Image formating does not work with compressed textures + + for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE); } - for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE); - + // NOTE: Cubemap data is expected to be provided as 6 images in a single data array, + // one after the other (that's a vertical image), following convention: +X, -X, +Y, -Y, +Z, -Z cubemap.id = rlLoadTextureCubemap(faces.data, size, faces.format); if (cubemap.id == 0) TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image"); @@ -3071,6 +3132,7 @@ void SetTextureWrap(Texture2D texture, int wrap) { case TEXTURE_WRAP_REPEAT: { + // NOTE: It only works if NPOT textures are supported, i.e. OpenGL ES 2.0 could not support it rlTextureParameters(texture.id, RL_TEXTURE_WRAP_S, RL_TEXTURE_WRAP_REPEAT); rlTextureParameters(texture.id, RL_TEXTURE_WRAP_T, RL_TEXTURE_WRAP_REPEAT); } break; @@ -3132,6 +3194,8 @@ void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color // i.e tiling = { 1.0f, 1.0f } refers to all texture, offset = { 0.5f, 0.5f } moves texture origin to center void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint) { + // WARNING: This solution only works if TEXTURE_WRAP_REPEAT is supported, + // NPOT textures supported is required and OpenGL ES 2.0 could not support it Rectangle source = { offset.x*texture.width, offset.y*texture.height, tiling.x*texture.width, tiling.y*texture.height }; Vector2 origin = { 0.0f, 0.0f }; @@ -3143,6 +3207,7 @@ void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangl void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint) { if ((texture.id <= 0) || (scale <= 0.0f)) return; // Wanna see a infinite loop?!...just delete this line! + if ((source.width == 0) || (source.height == 0)) return; int tileWidth = (int)(source.width*scale), tileHeight = (int)(source.height*scale); if ((dest.width < tileWidth) && (dest.height < tileHeight)) @@ -4759,3 +4824,5 @@ static Vector4 *LoadImageDataNormalized(Image image) return pixels; } + +#endif // SUPPORT_MODULE_RTEXTURES