Merge branch 'raysan5:master' into master
This commit is contained in:
commit
9177fe23a2
4
.github/workflows/linux.yml
vendored
4
.github/workflows/linux.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
12
.github/workflows/macos.yml
vendored
12
.github/workflows/macos.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
6
.github/workflows/webassembly.yml
vendored
6
.github/workflows/webassembly.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
142
BINDINGS.md
142
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)* |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
15
SPONSORS.md
15
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
cmd /c if exist %NAMEPART%.exe %NAMEPART%.exe
|
||||
|
|
|
|||
|
|
@ -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) |
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,59 +1,59 @@
|
|||
<?xml version="1.0" encoding="Windows-1252" ?>
|
||||
<raylibAPI>
|
||||
<Structs count="31">
|
||||
<Struct name="Vector2" fieldCount="2" desc="">
|
||||
<Struct name="Vector2" fieldCount="2" desc="Vector2, 2 components">
|
||||
<Field type="float" name="x" desc="Vector x component" />
|
||||
<Field type="float" name="y" desc="Vector y component" />
|
||||
</Struct>
|
||||
<Struct name="Vector3" fieldCount="3" desc="">
|
||||
<Struct name="Vector3" fieldCount="3" desc="Vector3, 3 components">
|
||||
<Field type="float" name="x" desc="Vector x component" />
|
||||
<Field type="float" name="y" desc="Vector y component" />
|
||||
<Field type="float" name="z" desc="Vector z component" />
|
||||
</Struct>
|
||||
<Struct name="Vector4" fieldCount="4" desc="">
|
||||
<Struct name="Vector4" fieldCount="4" desc="Vector4, 4 components">
|
||||
<Field type="float" name="x" desc="Vector x component" />
|
||||
<Field type="float" name="y" desc="Vector y component" />
|
||||
<Field type="float" name="z" desc="Vector z component" />
|
||||
<Field type="float" name="w" desc="Vector w component" />
|
||||
</Struct>
|
||||
<Struct name="Matrix" fieldCount="4" desc="">
|
||||
<Struct name="Matrix" fieldCount="4" desc="Matrix, 4x4 components, column major, OpenGL style, right handed">
|
||||
<Field type="float" name="m0, m4, m8, m12" desc="Matrix first row (4 components)" />
|
||||
<Field type="float" name="m1, m5, m9, m13" desc="Matrix second row (4 components)" />
|
||||
<Field type="float" name="m2, m6, m10, m14" desc="Matrix third row (4 components)" />
|
||||
<Field type="float" name="m3, m7, m11, m15" desc="Matrix fourth row (4 components)" />
|
||||
</Struct>
|
||||
<Struct name="Color" fieldCount="4" desc="">
|
||||
<Struct name="Color" fieldCount="4" desc="Color, 4 components, R8G8B8A8 (32bit)">
|
||||
<Field type="unsigned char" name="r" desc="Color red value" />
|
||||
<Field type="unsigned char" name="g" desc="Color green value" />
|
||||
<Field type="unsigned char" name="b" desc="Color blue value" />
|
||||
<Field type="unsigned char" name="a" desc="Color alpha value" />
|
||||
</Struct>
|
||||
<Struct name="Rectangle" fieldCount="4" desc="">
|
||||
<Struct name="Rectangle" fieldCount="4" desc="Rectangle, 4 components">
|
||||
<Field type="float" name="x" desc="Rectangle top-left corner position x" />
|
||||
<Field type="float" name="y" desc="Rectangle top-left corner position y" />
|
||||
<Field type="float" name="width" desc="Rectangle width" />
|
||||
<Field type="float" name="height" desc="Rectangle height" />
|
||||
</Struct>
|
||||
<Struct name="Image" fieldCount="5" desc="">
|
||||
<Struct name="Image" fieldCount="5" desc="Image, pixel data stored in CPU memory (RAM)">
|
||||
<Field type="void *" name="data" desc="Image raw data" />
|
||||
<Field type="int" name="width" desc="Image base width" />
|
||||
<Field type="int" name="height" desc="Image base height" />
|
||||
<Field type="int" name="mipmaps" desc="Mipmap levels, 1 by default" />
|
||||
<Field type="int" name="format" desc="Data format (PixelFormat type)" />
|
||||
</Struct>
|
||||
<Struct name="Texture" fieldCount="5" desc="">
|
||||
<Struct name="Texture" fieldCount="5" desc="Texture, tex data stored in GPU memory (VRAM)">
|
||||
<Field type="unsigned int" name="id" desc="OpenGL texture id" />
|
||||
<Field type="int" name="width" desc="Texture base width" />
|
||||
<Field type="int" name="height" desc="Texture base height" />
|
||||
<Field type="int" name="mipmaps" desc="Mipmap levels, 1 by default" />
|
||||
<Field type="int" name="format" desc="Data format (PixelFormat type)" />
|
||||
</Struct>
|
||||
<Struct name="RenderTexture" fieldCount="3" desc="">
|
||||
<Struct name="RenderTexture" fieldCount="3" desc="RenderTexture, fbo for texture rendering">
|
||||
<Field type="unsigned int" name="id" desc="OpenGL framebuffer object id" />
|
||||
<Field type="Texture" name="texture" desc="Color buffer attachment texture" />
|
||||
<Field type="Texture" name="depth" desc="Depth buffer attachment texture" />
|
||||
</Struct>
|
||||
<Struct name="NPatchInfo" fieldCount="6" desc="">
|
||||
<Struct name="NPatchInfo" fieldCount="6" desc="NPatchInfo, n-patch layout info">
|
||||
<Field type="Rectangle" name="source" desc="Texture source rectangle" />
|
||||
<Field type="int" name="left" desc="Left border offset" />
|
||||
<Field type="int" name="top" desc="Top border offset" />
|
||||
|
|
@ -61,14 +61,14 @@
|
|||
<Field type="int" name="bottom" desc="Bottom border offset" />
|
||||
<Field type="int" name="layout" desc="Layout of the n-patch: 3x3, 1x3 or 3x1" />
|
||||
</Struct>
|
||||
<Struct name="GlyphInfo" fieldCount="5" desc="">
|
||||
<Struct name="GlyphInfo" fieldCount="5" desc="GlyphInfo, font characters glyphs info">
|
||||
<Field type="int" name="value" desc="Character value (Unicode)" />
|
||||
<Field type="int" name="offsetX" desc="Character offset X when drawing" />
|
||||
<Field type="int" name="offsetY" desc="Character offset Y when drawing" />
|
||||
<Field type="int" name="advanceX" desc="Character advance position X" />
|
||||
<Field type="Image" name="image" desc="Character image data" />
|
||||
</Struct>
|
||||
<Struct name="Font" fieldCount="6" desc="">
|
||||
<Struct name="Font" fieldCount="6" desc="Font, font texture and GlyphInfo array data">
|
||||
<Field type="int" name="baseSize" desc="Base size (default chars height)" />
|
||||
<Field type="int" name="glyphCount" desc="Number of glyph characters" />
|
||||
<Field type="int" name="glyphPadding" desc="Padding around the glyph characters" />
|
||||
|
|
@ -76,20 +76,20 @@
|
|||
<Field type="Rectangle *" name="recs" desc="Rectangles in texture for the glyphs" />
|
||||
<Field type="GlyphInfo *" name="glyphs" desc="Glyphs info data" />
|
||||
</Struct>
|
||||
<Struct name="Camera3D" fieldCount="5" desc="">
|
||||
<Struct name="Camera3D" fieldCount="5" desc="Camera, defines position/orientation in 3d space">
|
||||
<Field type="Vector3" name="position" desc="Camera position" />
|
||||
<Field type="Vector3" name="target" desc="Camera target it looks-at" />
|
||||
<Field type="Vector3" name="up" desc="Camera up vector (rotation over its axis)" />
|
||||
<Field type="float" name="fovy" desc="Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic" />
|
||||
<Field type="int" name="projection" desc="Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC" />
|
||||
</Struct>
|
||||
<Struct name="Camera2D" fieldCount="4" desc="">
|
||||
<Struct name="Camera2D" fieldCount="4" desc="Camera2D, defines position/orientation in 2d space">
|
||||
<Field type="Vector2" name="offset" desc="Camera offset (displacement from target)" />
|
||||
<Field type="Vector2" name="target" desc="Camera target (rotation and zoom origin)" />
|
||||
<Field type="float" name="rotation" desc="Camera rotation in degrees" />
|
||||
<Field type="float" name="zoom" desc="Camera zoom (scaling), should be 1.0f by default" />
|
||||
</Struct>
|
||||
<Struct name="Mesh" fieldCount="15" desc="">
|
||||
<Struct name="Mesh" fieldCount="15" desc="Mesh, vertex data and vao/vbo">
|
||||
<Field type="int" name="vertexCount" desc="Number of vertices stored in arrays" />
|
||||
<Field type="int" name="triangleCount" desc="Number of triangles stored (indexed or not)" />
|
||||
<Field type="float *" name="vertices" desc="Vertex position (XYZ - 3 components per vertex) (shader-location = 0)" />
|
||||
|
|
@ -106,30 +106,30 @@
|
|||
<Field type="unsigned int" name="vaoId" desc="OpenGL Vertex Array Object id" />
|
||||
<Field type="unsigned int *" name="vboId" desc="OpenGL Vertex Buffer Objects id (default vertex data)" />
|
||||
</Struct>
|
||||
<Struct name="Shader" fieldCount="2" desc="">
|
||||
<Struct name="Shader" fieldCount="2" desc="Shader">
|
||||
<Field type="unsigned int" name="id" desc="Shader program id" />
|
||||
<Field type="int *" name="locs" desc="Shader locations array (RL_MAX_SHADER_LOCATIONS)" />
|
||||
</Struct>
|
||||
<Struct name="MaterialMap" fieldCount="3" desc="">
|
||||
<Struct name="MaterialMap" fieldCount="3" desc="MaterialMap">
|
||||
<Field type="Texture2D" name="texture" desc="Material map texture" />
|
||||
<Field type="Color" name="color" desc="Material map color" />
|
||||
<Field type="float" name="value" desc="Material map value" />
|
||||
</Struct>
|
||||
<Struct name="Material" fieldCount="3" desc="">
|
||||
<Struct name="Material" fieldCount="3" desc="Material, includes shader and maps">
|
||||
<Field type="Shader" name="shader" desc="Material shader" />
|
||||
<Field type="MaterialMap *" name="maps" desc="Material maps array (MAX_MATERIAL_MAPS)" />
|
||||
<Field type="float" name="params[4]" desc="Material generic parameters (if required)" />
|
||||
</Struct>
|
||||
<Struct name="Transform" fieldCount="3" desc="">
|
||||
<Struct name="Transform" fieldCount="3" desc="Transform, vectex transformation data">
|
||||
<Field type="Vector3" name="translation" desc="Translation" />
|
||||
<Field type="Quaternion" name="rotation" desc="Rotation" />
|
||||
<Field type="Vector3" name="scale" desc="Scale" />
|
||||
</Struct>
|
||||
<Struct name="BoneInfo" fieldCount="2" desc="">
|
||||
<Struct name="BoneInfo" fieldCount="2" desc="Bone, skeletal animation bone">
|
||||
<Field type="char" name="name[32]" desc="Bone name" />
|
||||
<Field type="int" name="parent" desc="Bone parent" />
|
||||
</Struct>
|
||||
<Struct name="Model" fieldCount="9" desc="">
|
||||
<Struct name="Model" fieldCount="9" desc="Model, meshes, materials and animation data">
|
||||
<Field type="Matrix" name="transform" desc="Local transform matrix" />
|
||||
<Field type="int" name="meshCount" desc="Number of meshes" />
|
||||
<Field type="int" name="materialCount" desc="Number of materials" />
|
||||
|
|
@ -140,51 +140,51 @@
|
|||
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
|
||||
<Field type="Transform *" name="bindPose" desc="Bones base transformation (pose)" />
|
||||
</Struct>
|
||||
<Struct name="ModelAnimation" fieldCount="4" desc="">
|
||||
<Struct name="ModelAnimation" fieldCount="4" desc="ModelAnimation">
|
||||
<Field type="int" name="boneCount" desc="Number of bones" />
|
||||
<Field type="int" name="frameCount" desc="Number of animation frames" />
|
||||
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
|
||||
<Field type="Transform **" name="framePoses" desc="Poses array by frame" />
|
||||
</Struct>
|
||||
<Struct name="Ray" fieldCount="2" desc="">
|
||||
<Struct name="Ray" fieldCount="2" desc="Ray, ray for raycasting">
|
||||
<Field type="Vector3" name="position" desc="Ray position (origin)" />
|
||||
<Field type="Vector3" name="direction" desc="Ray direction" />
|
||||
</Struct>
|
||||
<Struct name="RayCollision" fieldCount="4" desc="">
|
||||
<Struct name="RayCollision" fieldCount="4" desc="RayCollision, ray hit information">
|
||||
<Field type="bool" name="hit" desc="Did the ray hit something?" />
|
||||
<Field type="float" name="distance" desc="Distance to nearest hit" />
|
||||
<Field type="Vector3" name="point" desc="Point of nearest hit" />
|
||||
<Field type="Vector3" name="normal" desc="Surface normal of hit" />
|
||||
</Struct>
|
||||
<Struct name="BoundingBox" fieldCount="2" desc="">
|
||||
<Struct name="BoundingBox" fieldCount="2" desc="BoundingBox">
|
||||
<Field type="Vector3" name="min" desc="Minimum vertex box-corner" />
|
||||
<Field type="Vector3" name="max" desc="Maximum vertex box-corner" />
|
||||
</Struct>
|
||||
<Struct name="Wave" fieldCount="5" desc="">
|
||||
<Struct name="Wave" fieldCount="5" desc="Wave, audio wave data">
|
||||
<Field type="unsigned int" name="frameCount" desc="Total number of frames (considering channels)" />
|
||||
<Field type="unsigned int" name="sampleRate" desc="Frequency (samples per second)" />
|
||||
<Field type="unsigned int" name="sampleSize" desc="Bit depth (bits per sample): 8, 16, 32 (24 not supported)" />
|
||||
<Field type="unsigned int" name="channels" desc="Number of channels (1-mono, 2-stereo, ...)" />
|
||||
<Field type="void *" name="data" desc="Buffer data pointer" />
|
||||
</Struct>
|
||||
<Struct name="AudioStream" fieldCount="4" desc="">
|
||||
<Struct name="AudioStream" fieldCount="4" desc="AudioStream, custom audio stream">
|
||||
<Field type="rAudioBuffer *" name="buffer" desc="Pointer to internal data used by the audio system" />
|
||||
<Field type="unsigned int" name="sampleRate" desc="Frequency (samples per second)" />
|
||||
<Field type="unsigned int" name="sampleSize" desc="Bit depth (bits per sample): 8, 16, 32 (24 not supported)" />
|
||||
<Field type="unsigned int" name="channels" desc="Number of channels (1-mono, 2-stereo, ...)" />
|
||||
</Struct>
|
||||
<Struct name="Sound" fieldCount="2" desc="">
|
||||
<Struct name="Sound" fieldCount="2" desc="Sound">
|
||||
<Field type="AudioStream" name="stream" desc="Audio stream" />
|
||||
<Field type="unsigned int" name="frameCount" desc="Total number of frames (considering channels)" />
|
||||
</Struct>
|
||||
<Struct name="Music" fieldCount="5" desc="">
|
||||
<Struct name="Music" fieldCount="5" desc="Music, audio stream, anything longer than ~10 seconds should be streamed">
|
||||
<Field type="AudioStream" name="stream" desc="Audio stream" />
|
||||
<Field type="unsigned int" name="frameCount" desc="Total number of frames (considering channels)" />
|
||||
<Field type="bool" name="looping" desc="Music looping enable" />
|
||||
<Field type="int" name="ctxType" desc="Type of music context (audio filetype)" />
|
||||
<Field type="void *" name="ctxData" desc="Audio context data, depends on type" />
|
||||
</Struct>
|
||||
<Struct name="VrDeviceInfo" fieldCount="10" desc="">
|
||||
<Struct name="VrDeviceInfo" fieldCount="10" desc="VrDeviceInfo, Head-Mounted-Display device parameters">
|
||||
<Field type="int" name="hResolution" desc="Horizontal resolution in pixels" />
|
||||
<Field type="int" name="vResolution" desc="Vertical resolution in pixels" />
|
||||
<Field type="float" name="hScreenSize" desc="Horizontal size in meters" />
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
<Field type="float" name="lensDistortionValues[4]" desc="Lens distortion constant parameters" />
|
||||
<Field type="float" name="chromaAbCorrection[4]" desc="Chromatic aberration correction parameters" />
|
||||
</Struct>
|
||||
<Struct name="VrStereoConfig" fieldCount="8" desc="">
|
||||
<Struct name="VrStereoConfig" fieldCount="8" desc="VrStereoConfig, VR stereo rendering configuration for simulator">
|
||||
<Field type="Matrix" name="projection[2]" desc="VR projection matrices (per eye)" />
|
||||
<Field type="Matrix" name="viewOffset[2]" desc="VR view offset matrices (per eye)" />
|
||||
<Field type="float" name="leftLensCenter[2]" desc="VR left lens center" />
|
||||
|
|
@ -208,341 +208,341 @@
|
|||
</Struct>
|
||||
</Structs>
|
||||
<Enums count="21">
|
||||
<Enum name="ConfigFlags" valueCount="14" desc="">
|
||||
<Value name="FLAG_VSYNC_HINT" integer="64" desc="" />
|
||||
<Value name="FLAG_FULLSCREEN_MODE" integer="2" desc="" />
|
||||
<Value name="FLAG_WINDOW_RESIZABLE" integer="4" desc="" />
|
||||
<Value name="FLAG_WINDOW_UNDECORATED" integer="8" desc="" />
|
||||
<Value name="FLAG_WINDOW_HIDDEN" integer="128" desc="" />
|
||||
<Value name="FLAG_WINDOW_MINIMIZED" integer="512" desc="" />
|
||||
<Value name="FLAG_WINDOW_MAXIMIZED" integer="1024" desc="" />
|
||||
<Value name="FLAG_WINDOW_UNFOCUSED" integer="2048" desc="" />
|
||||
<Value name="FLAG_WINDOW_TOPMOST" integer="4096" desc="" />
|
||||
<Value name="FLAG_WINDOW_ALWAYS_RUN" integer="256" desc="" />
|
||||
<Value name="FLAG_WINDOW_TRANSPARENT" integer="16" desc="" />
|
||||
<Value name="FLAG_WINDOW_HIGHDPI" integer="8192" desc="" />
|
||||
<Value name="FLAG_MSAA_4X_HINT" integer="32" desc="" />
|
||||
<Value name="FLAG_INTERLACED_HINT" integer="65536" desc="" />
|
||||
<Enum name="ConfigFlags" valueCount="14" desc="System/Window config flags">
|
||||
<Value name="FLAG_VSYNC_HINT" integer="64" desc="Set to try enabling V-Sync on GPU" />
|
||||
<Value name="FLAG_FULLSCREEN_MODE" integer="2" desc="Set to run program in fullscreen" />
|
||||
<Value name="FLAG_WINDOW_RESIZABLE" integer="4" desc="Set to allow resizable window" />
|
||||
<Value name="FLAG_WINDOW_UNDECORATED" integer="8" desc="Set to disable window decoration (frame and buttons)" />
|
||||
<Value name="FLAG_WINDOW_HIDDEN" integer="128" desc="Set to hide window" />
|
||||
<Value name="FLAG_WINDOW_MINIMIZED" integer="512" desc="Set to minimize window (iconify)" />
|
||||
<Value name="FLAG_WINDOW_MAXIMIZED" integer="1024" desc="Set to maximize window (expanded to monitor)" />
|
||||
<Value name="FLAG_WINDOW_UNFOCUSED" integer="2048" desc="Set to window non focused" />
|
||||
<Value name="FLAG_WINDOW_TOPMOST" integer="4096" desc="Set to window always on top" />
|
||||
<Value name="FLAG_WINDOW_ALWAYS_RUN" integer="256" desc="Set to allow windows running while minimized" />
|
||||
<Value name="FLAG_WINDOW_TRANSPARENT" integer="16" desc="Set to allow transparent framebuffer" />
|
||||
<Value name="FLAG_WINDOW_HIGHDPI" integer="8192" desc="Set to support HighDPI" />
|
||||
<Value name="FLAG_MSAA_4X_HINT" integer="32" desc="Set to try enabling MSAA 4X" />
|
||||
<Value name="FLAG_INTERLACED_HINT" integer="65536" desc="Set to try enabling interlaced video format (for V3D)" />
|
||||
</Enum>
|
||||
<Enum name="TraceLogLevel" valueCount="8" desc="">
|
||||
<Value name="LOG_ALL" integer="0" desc="" />
|
||||
<Value name="LOG_TRACE" integer="1" desc="" />
|
||||
<Value name="LOG_DEBUG" integer="2" desc="" />
|
||||
<Value name="LOG_INFO" integer="3" desc="" />
|
||||
<Value name="LOG_WARNING" integer="4" desc="" />
|
||||
<Value name="LOG_ERROR" integer="5" desc="" />
|
||||
<Value name="LOG_FATAL" integer="6" desc="" />
|
||||
<Value name="LOG_NONE" integer="7" desc="" />
|
||||
<Enum name="TraceLogLevel" valueCount="8" desc="Trace log level">
|
||||
<Value name="LOG_ALL" integer="0" desc="Display all logs" />
|
||||
<Value name="LOG_TRACE" integer="1" desc="Trace logging, intended for internal use only" />
|
||||
<Value name="LOG_DEBUG" integer="2" desc="Debug logging, used for internal debugging, it should be disabled on release builds" />
|
||||
<Value name="LOG_INFO" integer="3" desc="Info logging, used for program execution info" />
|
||||
<Value name="LOG_WARNING" integer="4" desc="Warning logging, used on recoverable failures" />
|
||||
<Value name="LOG_ERROR" integer="5" desc="Error logging, used on unrecoverable failures" />
|
||||
<Value name="LOG_FATAL" integer="6" desc="Fatal logging, used to abort program: exit(EXIT_FAILURE)" />
|
||||
<Value name="LOG_NONE" integer="7" desc="Disable logging" />
|
||||
</Enum>
|
||||
<Enum name="KeyboardKey" valueCount="110" desc="">
|
||||
<Value name="KEY_NULL" integer="0" desc="" />
|
||||
<Value name="KEY_APOSTROPHE" integer="39" desc="" />
|
||||
<Value name="KEY_COMMA" integer="44" desc="" />
|
||||
<Value name="KEY_MINUS" integer="45" desc="" />
|
||||
<Value name="KEY_PERIOD" integer="46" desc="" />
|
||||
<Value name="KEY_SLASH" integer="47" desc="" />
|
||||
<Value name="KEY_ZERO" integer="48" desc="" />
|
||||
<Value name="KEY_ONE" integer="49" desc="" />
|
||||
<Value name="KEY_TWO" integer="50" desc="" />
|
||||
<Value name="KEY_THREE" integer="51" desc="" />
|
||||
<Value name="KEY_FOUR" integer="52" desc="" />
|
||||
<Value name="KEY_FIVE" integer="53" desc="" />
|
||||
<Value name="KEY_SIX" integer="54" desc="" />
|
||||
<Value name="KEY_SEVEN" integer="55" desc="" />
|
||||
<Value name="KEY_EIGHT" integer="56" desc="" />
|
||||
<Value name="KEY_NINE" integer="57" desc="" />
|
||||
<Value name="KEY_SEMICOLON" integer="59" desc="" />
|
||||
<Value name="KEY_EQUAL" integer="61" desc="" />
|
||||
<Value name="KEY_A" integer="65" desc="" />
|
||||
<Value name="KEY_B" integer="66" desc="" />
|
||||
<Value name="KEY_C" integer="67" desc="" />
|
||||
<Value name="KEY_D" integer="68" desc="" />
|
||||
<Value name="KEY_E" integer="69" desc="" />
|
||||
<Value name="KEY_F" integer="70" desc="" />
|
||||
<Value name="KEY_G" integer="71" desc="" />
|
||||
<Value name="KEY_H" integer="72" desc="" />
|
||||
<Value name="KEY_I" integer="73" desc="" />
|
||||
<Value name="KEY_J" integer="74" desc="" />
|
||||
<Value name="KEY_K" integer="75" desc="" />
|
||||
<Value name="KEY_L" integer="76" desc="" />
|
||||
<Value name="KEY_M" integer="77" desc="" />
|
||||
<Value name="KEY_N" integer="78" desc="" />
|
||||
<Value name="KEY_O" integer="79" desc="" />
|
||||
<Value name="KEY_P" integer="80" desc="" />
|
||||
<Value name="KEY_Q" integer="81" desc="" />
|
||||
<Value name="KEY_R" integer="82" desc="" />
|
||||
<Value name="KEY_S" integer="83" desc="" />
|
||||
<Value name="KEY_T" integer="84" desc="" />
|
||||
<Value name="KEY_U" integer="85" desc="" />
|
||||
<Value name="KEY_V" integer="86" desc="" />
|
||||
<Value name="KEY_W" integer="87" desc="" />
|
||||
<Value name="KEY_X" integer="88" desc="" />
|
||||
<Value name="KEY_Y" integer="89" desc="" />
|
||||
<Value name="KEY_Z" integer="90" desc="" />
|
||||
<Value name="KEY_LEFT_BRACKET" integer="91" desc="" />
|
||||
<Value name="KEY_BACKSLASH" integer="92" desc="" />
|
||||
<Value name="KEY_RIGHT_BRACKET" integer="93" desc="" />
|
||||
<Value name="KEY_GRAVE" integer="96" desc="" />
|
||||
<Value name="KEY_SPACE" integer="32" desc="" />
|
||||
<Value name="KEY_ESCAPE" integer="256" desc="" />
|
||||
<Value name="KEY_ENTER" integer="257" desc="" />
|
||||
<Value name="KEY_TAB" integer="258" desc="" />
|
||||
<Value name="KEY_BACKSPACE" integer="259" desc="" />
|
||||
<Value name="KEY_INSERT" integer="260" desc="" />
|
||||
<Value name="KEY_DELETE" integer="261" desc="" />
|
||||
<Value name="KEY_RIGHT" integer="262" desc="" />
|
||||
<Value name="KEY_LEFT" integer="263" desc="" />
|
||||
<Value name="KEY_DOWN" integer="264" desc="" />
|
||||
<Value name="KEY_UP" integer="265" desc="" />
|
||||
<Value name="KEY_PAGE_UP" integer="266" desc="" />
|
||||
<Value name="KEY_PAGE_DOWN" integer="267" desc="" />
|
||||
<Value name="KEY_HOME" integer="268" desc="" />
|
||||
<Value name="KEY_END" integer="269" desc="" />
|
||||
<Value name="KEY_CAPS_LOCK" integer="280" desc="" />
|
||||
<Value name="KEY_SCROLL_LOCK" integer="281" desc="" />
|
||||
<Value name="KEY_NUM_LOCK" integer="282" desc="" />
|
||||
<Value name="KEY_PRINT_SCREEN" integer="283" desc="" />
|
||||
<Value name="KEY_PAUSE" integer="284" desc="" />
|
||||
<Value name="KEY_F1" integer="290" desc="" />
|
||||
<Value name="KEY_F2" integer="291" desc="" />
|
||||
<Value name="KEY_F3" integer="292" desc="" />
|
||||
<Value name="KEY_F4" integer="293" desc="" />
|
||||
<Value name="KEY_F5" integer="294" desc="" />
|
||||
<Value name="KEY_F6" integer="295" desc="" />
|
||||
<Value name="KEY_F7" integer="296" desc="" />
|
||||
<Value name="KEY_F8" integer="297" desc="" />
|
||||
<Value name="KEY_F9" integer="298" desc="" />
|
||||
<Value name="KEY_F10" integer="299" desc="" />
|
||||
<Value name="KEY_F11" integer="300" desc="" />
|
||||
<Value name="KEY_F12" integer="301" desc="" />
|
||||
<Value name="KEY_LEFT_SHIFT" integer="340" desc="" />
|
||||
<Value name="KEY_LEFT_CONTROL" integer="341" desc="" />
|
||||
<Value name="KEY_LEFT_ALT" integer="342" desc="" />
|
||||
<Value name="KEY_LEFT_SUPER" integer="343" desc="" />
|
||||
<Value name="KEY_RIGHT_SHIFT" integer="344" desc="" />
|
||||
<Value name="KEY_RIGHT_CONTROL" integer="345" desc="" />
|
||||
<Value name="KEY_RIGHT_ALT" integer="346" desc="" />
|
||||
<Value name="KEY_RIGHT_SUPER" integer="347" desc="" />
|
||||
<Value name="KEY_KB_MENU" integer="348" desc="" />
|
||||
<Value name="KEY_KP_0" integer="320" desc="" />
|
||||
<Value name="KEY_KP_1" integer="321" desc="" />
|
||||
<Value name="KEY_KP_2" integer="322" desc="" />
|
||||
<Value name="KEY_KP_3" integer="323" desc="" />
|
||||
<Value name="KEY_KP_4" integer="324" desc="" />
|
||||
<Value name="KEY_KP_5" integer="325" desc="" />
|
||||
<Value name="KEY_KP_6" integer="326" desc="" />
|
||||
<Value name="KEY_KP_7" integer="327" desc="" />
|
||||
<Value name="KEY_KP_8" integer="328" desc="" />
|
||||
<Value name="KEY_KP_9" integer="329" desc="" />
|
||||
<Value name="KEY_KP_DECIMAL" integer="330" desc="" />
|
||||
<Value name="KEY_KP_DIVIDE" integer="331" desc="" />
|
||||
<Value name="KEY_KP_MULTIPLY" integer="332" desc="" />
|
||||
<Value name="KEY_KP_SUBTRACT" integer="333" desc="" />
|
||||
<Value name="KEY_KP_ADD" integer="334" desc="" />
|
||||
<Value name="KEY_KP_ENTER" integer="335" desc="" />
|
||||
<Value name="KEY_KP_EQUAL" integer="336" desc="" />
|
||||
<Value name="KEY_BACK" integer="4" desc="" />
|
||||
<Value name="KEY_MENU" integer="82" desc="" />
|
||||
<Value name="KEY_VOLUME_UP" integer="24" desc="" />
|
||||
<Value name="KEY_VOLUME_DOWN" integer="25" desc="" />
|
||||
<Enum name="KeyboardKey" valueCount="110" desc="Keyboard keys (US keyboard layout)">
|
||||
<Value name="KEY_NULL" integer="0" desc="Key: NULL, used for no key pressed" />
|
||||
<Value name="KEY_APOSTROPHE" integer="39" desc="Key: '" />
|
||||
<Value name="KEY_COMMA" integer="44" desc="Key: ," />
|
||||
<Value name="KEY_MINUS" integer="45" desc="Key: -" />
|
||||
<Value name="KEY_PERIOD" integer="46" desc="Key: ." />
|
||||
<Value name="KEY_SLASH" integer="47" desc="Key: /" />
|
||||
<Value name="KEY_ZERO" integer="48" desc="Key: 0" />
|
||||
<Value name="KEY_ONE" integer="49" desc="Key: 1" />
|
||||
<Value name="KEY_TWO" integer="50" desc="Key: 2" />
|
||||
<Value name="KEY_THREE" integer="51" desc="Key: 3" />
|
||||
<Value name="KEY_FOUR" integer="52" desc="Key: 4" />
|
||||
<Value name="KEY_FIVE" integer="53" desc="Key: 5" />
|
||||
<Value name="KEY_SIX" integer="54" desc="Key: 6" />
|
||||
<Value name="KEY_SEVEN" integer="55" desc="Key: 7" />
|
||||
<Value name="KEY_EIGHT" integer="56" desc="Key: 8" />
|
||||
<Value name="KEY_NINE" integer="57" desc="Key: 9" />
|
||||
<Value name="KEY_SEMICOLON" integer="59" desc="Key: ;" />
|
||||
<Value name="KEY_EQUAL" integer="61" desc="Key: =" />
|
||||
<Value name="KEY_A" integer="65" desc="Key: A | a" />
|
||||
<Value name="KEY_B" integer="66" desc="Key: B | b" />
|
||||
<Value name="KEY_C" integer="67" desc="Key: C | c" />
|
||||
<Value name="KEY_D" integer="68" desc="Key: D | d" />
|
||||
<Value name="KEY_E" integer="69" desc="Key: E | e" />
|
||||
<Value name="KEY_F" integer="70" desc="Key: F | f" />
|
||||
<Value name="KEY_G" integer="71" desc="Key: G | g" />
|
||||
<Value name="KEY_H" integer="72" desc="Key: H | h" />
|
||||
<Value name="KEY_I" integer="73" desc="Key: I | i" />
|
||||
<Value name="KEY_J" integer="74" desc="Key: J | j" />
|
||||
<Value name="KEY_K" integer="75" desc="Key: K | k" />
|
||||
<Value name="KEY_L" integer="76" desc="Key: L | l" />
|
||||
<Value name="KEY_M" integer="77" desc="Key: M | m" />
|
||||
<Value name="KEY_N" integer="78" desc="Key: N | n" />
|
||||
<Value name="KEY_O" integer="79" desc="Key: O | o" />
|
||||
<Value name="KEY_P" integer="80" desc="Key: P | p" />
|
||||
<Value name="KEY_Q" integer="81" desc="Key: Q | q" />
|
||||
<Value name="KEY_R" integer="82" desc="Key: R | r" />
|
||||
<Value name="KEY_S" integer="83" desc="Key: S | s" />
|
||||
<Value name="KEY_T" integer="84" desc="Key: T | t" />
|
||||
<Value name="KEY_U" integer="85" desc="Key: U | u" />
|
||||
<Value name="KEY_V" integer="86" desc="Key: V | v" />
|
||||
<Value name="KEY_W" integer="87" desc="Key: W | w" />
|
||||
<Value name="KEY_X" integer="88" desc="Key: X | x" />
|
||||
<Value name="KEY_Y" integer="89" desc="Key: Y | y" />
|
||||
<Value name="KEY_Z" integer="90" desc="Key: Z | z" />
|
||||
<Value name="KEY_LEFT_BRACKET" integer="91" desc="Key: [" />
|
||||
<Value name="KEY_BACKSLASH" integer="92" desc="Key: '\'" />
|
||||
<Value name="KEY_RIGHT_BRACKET" integer="93" desc="Key: ]" />
|
||||
<Value name="KEY_GRAVE" integer="96" desc="Key: `" />
|
||||
<Value name="KEY_SPACE" integer="32" desc="Key: Space" />
|
||||
<Value name="KEY_ESCAPE" integer="256" desc="Key: Esc" />
|
||||
<Value name="KEY_ENTER" integer="257" desc="Key: Enter" />
|
||||
<Value name="KEY_TAB" integer="258" desc="Key: Tab" />
|
||||
<Value name="KEY_BACKSPACE" integer="259" desc="Key: Backspace" />
|
||||
<Value name="KEY_INSERT" integer="260" desc="Key: Ins" />
|
||||
<Value name="KEY_DELETE" integer="261" desc="Key: Del" />
|
||||
<Value name="KEY_RIGHT" integer="262" desc="Key: Cursor right" />
|
||||
<Value name="KEY_LEFT" integer="263" desc="Key: Cursor left" />
|
||||
<Value name="KEY_DOWN" integer="264" desc="Key: Cursor down" />
|
||||
<Value name="KEY_UP" integer="265" desc="Key: Cursor up" />
|
||||
<Value name="KEY_PAGE_UP" integer="266" desc="Key: Page up" />
|
||||
<Value name="KEY_PAGE_DOWN" integer="267" desc="Key: Page down" />
|
||||
<Value name="KEY_HOME" integer="268" desc="Key: Home" />
|
||||
<Value name="KEY_END" integer="269" desc="Key: End" />
|
||||
<Value name="KEY_CAPS_LOCK" integer="280" desc="Key: Caps lock" />
|
||||
<Value name="KEY_SCROLL_LOCK" integer="281" desc="Key: Scroll down" />
|
||||
<Value name="KEY_NUM_LOCK" integer="282" desc="Key: Num lock" />
|
||||
<Value name="KEY_PRINT_SCREEN" integer="283" desc="Key: Print screen" />
|
||||
<Value name="KEY_PAUSE" integer="284" desc="Key: Pause" />
|
||||
<Value name="KEY_F1" integer="290" desc="Key: F1" />
|
||||
<Value name="KEY_F2" integer="291" desc="Key: F2" />
|
||||
<Value name="KEY_F3" integer="292" desc="Key: F3" />
|
||||
<Value name="KEY_F4" integer="293" desc="Key: F4" />
|
||||
<Value name="KEY_F5" integer="294" desc="Key: F5" />
|
||||
<Value name="KEY_F6" integer="295" desc="Key: F6" />
|
||||
<Value name="KEY_F7" integer="296" desc="Key: F7" />
|
||||
<Value name="KEY_F8" integer="297" desc="Key: F8" />
|
||||
<Value name="KEY_F9" integer="298" desc="Key: F9" />
|
||||
<Value name="KEY_F10" integer="299" desc="Key: F10" />
|
||||
<Value name="KEY_F11" integer="300" desc="Key: F11" />
|
||||
<Value name="KEY_F12" integer="301" desc="Key: F12" />
|
||||
<Value name="KEY_LEFT_SHIFT" integer="340" desc="Key: Shift left" />
|
||||
<Value name="KEY_LEFT_CONTROL" integer="341" desc="Key: Control left" />
|
||||
<Value name="KEY_LEFT_ALT" integer="342" desc="Key: Alt left" />
|
||||
<Value name="KEY_LEFT_SUPER" integer="343" desc="Key: Super left" />
|
||||
<Value name="KEY_RIGHT_SHIFT" integer="344" desc="Key: Shift right" />
|
||||
<Value name="KEY_RIGHT_CONTROL" integer="345" desc="Key: Control right" />
|
||||
<Value name="KEY_RIGHT_ALT" integer="346" desc="Key: Alt right" />
|
||||
<Value name="KEY_RIGHT_SUPER" integer="347" desc="Key: Super right" />
|
||||
<Value name="KEY_KB_MENU" integer="348" desc="Key: KB menu" />
|
||||
<Value name="KEY_KP_0" integer="320" desc="Key: Keypad 0" />
|
||||
<Value name="KEY_KP_1" integer="321" desc="Key: Keypad 1" />
|
||||
<Value name="KEY_KP_2" integer="322" desc="Key: Keypad 2" />
|
||||
<Value name="KEY_KP_3" integer="323" desc="Key: Keypad 3" />
|
||||
<Value name="KEY_KP_4" integer="324" desc="Key: Keypad 4" />
|
||||
<Value name="KEY_KP_5" integer="325" desc="Key: Keypad 5" />
|
||||
<Value name="KEY_KP_6" integer="326" desc="Key: Keypad 6" />
|
||||
<Value name="KEY_KP_7" integer="327" desc="Key: Keypad 7" />
|
||||
<Value name="KEY_KP_8" integer="328" desc="Key: Keypad 8" />
|
||||
<Value name="KEY_KP_9" integer="329" desc="Key: Keypad 9" />
|
||||
<Value name="KEY_KP_DECIMAL" integer="330" desc="Key: Keypad ." />
|
||||
<Value name="KEY_KP_DIVIDE" integer="331" desc="Key: Keypad /" />
|
||||
<Value name="KEY_KP_MULTIPLY" integer="332" desc="Key: Keypad *" />
|
||||
<Value name="KEY_KP_SUBTRACT" integer="333" desc="Key: Keypad -" />
|
||||
<Value name="KEY_KP_ADD" integer="334" desc="Key: Keypad +" />
|
||||
<Value name="KEY_KP_ENTER" integer="335" desc="Key: Keypad Enter" />
|
||||
<Value name="KEY_KP_EQUAL" integer="336" desc="Key: Keypad =" />
|
||||
<Value name="KEY_BACK" integer="4" desc="Key: Android back button" />
|
||||
<Value name="KEY_MENU" integer="82" desc="Key: Android menu button" />
|
||||
<Value name="KEY_VOLUME_UP" integer="24" desc="Key: Android volume up button" />
|
||||
<Value name="KEY_VOLUME_DOWN" integer="25" desc="Key: Android volume down button" />
|
||||
</Enum>
|
||||
<Enum name="MouseButton" valueCount="7" desc="">
|
||||
<Value name="MOUSE_BUTTON_LEFT" integer="0" desc="" />
|
||||
<Value name="MOUSE_BUTTON_RIGHT" integer="1" desc="" />
|
||||
<Value name="MOUSE_BUTTON_MIDDLE" integer="2" desc="" />
|
||||
<Value name="MOUSE_BUTTON_SIDE" integer="3" desc="" />
|
||||
<Value name="MOUSE_BUTTON_EXTRA" integer="4" desc="" />
|
||||
<Value name="MOUSE_BUTTON_FORWARD" integer="5" desc="" />
|
||||
<Value name="MOUSE_BUTTON_BACK" integer="6" desc="" />
|
||||
<Enum name="MouseButton" valueCount="7" desc="Mouse buttons">
|
||||
<Value name="MOUSE_BUTTON_LEFT" integer="0" desc="Mouse button left" />
|
||||
<Value name="MOUSE_BUTTON_RIGHT" integer="1" desc="Mouse button right" />
|
||||
<Value name="MOUSE_BUTTON_MIDDLE" integer="2" desc="Mouse button middle (pressed wheel)" />
|
||||
<Value name="MOUSE_BUTTON_SIDE" integer="3" desc="Mouse button side (advanced mouse device)" />
|
||||
<Value name="MOUSE_BUTTON_EXTRA" integer="4" desc="Mouse button extra (advanced mouse device)" />
|
||||
<Value name="MOUSE_BUTTON_FORWARD" integer="5" desc="Mouse button fordward (advanced mouse device)" />
|
||||
<Value name="MOUSE_BUTTON_BACK" integer="6" desc="Mouse button back (advanced mouse device)" />
|
||||
</Enum>
|
||||
<Enum name="MouseCursor" valueCount="11" desc="">
|
||||
<Value name="MOUSE_CURSOR_DEFAULT" integer="0" desc="" />
|
||||
<Value name="MOUSE_CURSOR_ARROW" integer="1" desc="" />
|
||||
<Value name="MOUSE_CURSOR_IBEAM" integer="2" desc="" />
|
||||
<Value name="MOUSE_CURSOR_CROSSHAIR" integer="3" desc="" />
|
||||
<Value name="MOUSE_CURSOR_POINTING_HAND" integer="4" desc="" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_EW" integer="5" desc="" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_NS" integer="6" desc="" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_NWSE" integer="7" desc="" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_NESW" integer="8" desc="" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_ALL" integer="9" desc="" />
|
||||
<Value name="MOUSE_CURSOR_NOT_ALLOWED" integer="10" desc="" />
|
||||
<Enum name="MouseCursor" valueCount="11" desc="Mouse cursor">
|
||||
<Value name="MOUSE_CURSOR_DEFAULT" integer="0" desc="Default pointer shape" />
|
||||
<Value name="MOUSE_CURSOR_ARROW" integer="1" desc="Arrow shape" />
|
||||
<Value name="MOUSE_CURSOR_IBEAM" integer="2" desc="Text writing cursor shape" />
|
||||
<Value name="MOUSE_CURSOR_CROSSHAIR" integer="3" desc="Cross shape" />
|
||||
<Value name="MOUSE_CURSOR_POINTING_HAND" integer="4" desc="Pointing hand cursor" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_EW" integer="5" desc="Horizontal resize/move arrow shape" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_NS" integer="6" desc="Vertical resize/move arrow shape" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_NWSE" integer="7" desc="Top-left to bottom-right diagonal resize/move arrow shape" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_NESW" integer="8" desc="The top-right to bottom-left diagonal resize/move arrow shape" />
|
||||
<Value name="MOUSE_CURSOR_RESIZE_ALL" integer="9" desc="The omni-directional resize/move cursor shape" />
|
||||
<Value name="MOUSE_CURSOR_NOT_ALLOWED" integer="10" desc="The operation-not-allowed shape" />
|
||||
</Enum>
|
||||
<Enum name="GamepadButton" valueCount="18" desc="">
|
||||
<Value name="GAMEPAD_BUTTON_UNKNOWN" integer="0" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_UP" integer="1" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_RIGHT" integer="2" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_DOWN" integer="3" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_LEFT" integer="4" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_UP" integer="5" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_RIGHT" integer="6" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_DOWN" integer="7" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_LEFT" integer="8" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_TRIGGER_1" integer="9" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_TRIGGER_2" integer="10" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_1" integer="11" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_2" integer="12" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE_LEFT" integer="13" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE" integer="14" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE_RIGHT" integer="15" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_THUMB" integer="16" desc="" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_THUMB" integer="17" desc="" />
|
||||
<Enum name="GamepadButton" valueCount="18" desc="Gamepad buttons">
|
||||
<Value name="GAMEPAD_BUTTON_UNKNOWN" integer="0" desc="Unknown button, just for error checking" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_UP" integer="1" desc="Gamepad left DPAD up button" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_RIGHT" integer="2" desc="Gamepad left DPAD right button" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_DOWN" integer="3" desc="Gamepad left DPAD down button" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_FACE_LEFT" integer="4" desc="Gamepad left DPAD left button" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_UP" integer="5" desc="Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_RIGHT" integer="6" desc="Gamepad right button right (i.e. PS3: Square, Xbox: X)" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_DOWN" integer="7" desc="Gamepad right button down (i.e. PS3: Cross, Xbox: A)" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_LEFT" integer="8" desc="Gamepad right button left (i.e. PS3: Circle, Xbox: B)" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_TRIGGER_1" integer="9" desc="Gamepad top/back trigger left (first), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_TRIGGER_2" integer="10" desc="Gamepad top/back trigger left (second), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_1" integer="11" desc="Gamepad top/back trigger right (one), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_2" integer="12" desc="Gamepad top/back trigger right (second), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE_LEFT" integer="13" desc="Gamepad center buttons, left one (i.e. PS3: Select)" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE" integer="14" desc="Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE_RIGHT" integer="15" desc="Gamepad center buttons, right one (i.e. PS3: Start)" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_THUMB" integer="16" desc="Gamepad joystick pressed button left" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_THUMB" integer="17" desc="Gamepad joystick pressed button right" />
|
||||
</Enum>
|
||||
<Enum name="GamepadAxis" valueCount="6" desc="">
|
||||
<Value name="GAMEPAD_AXIS_LEFT_X" integer="0" desc="" />
|
||||
<Value name="GAMEPAD_AXIS_LEFT_Y" integer="1" desc="" />
|
||||
<Value name="GAMEPAD_AXIS_RIGHT_X" integer="2" desc="" />
|
||||
<Value name="GAMEPAD_AXIS_RIGHT_Y" integer="3" desc="" />
|
||||
<Value name="GAMEPAD_AXIS_LEFT_TRIGGER" integer="4" desc="" />
|
||||
<Value name="GAMEPAD_AXIS_RIGHT_TRIGGER" integer="5" desc="" />
|
||||
<Enum name="GamepadAxis" valueCount="6" desc="Gamepad axis">
|
||||
<Value name="GAMEPAD_AXIS_LEFT_X" integer="0" desc="Gamepad left stick X axis" />
|
||||
<Value name="GAMEPAD_AXIS_LEFT_Y" integer="1" desc="Gamepad left stick Y axis" />
|
||||
<Value name="GAMEPAD_AXIS_RIGHT_X" integer="2" desc="Gamepad right stick X axis" />
|
||||
<Value name="GAMEPAD_AXIS_RIGHT_Y" integer="3" desc="Gamepad right stick Y axis" />
|
||||
<Value name="GAMEPAD_AXIS_LEFT_TRIGGER" integer="4" desc="Gamepad back trigger left, pressure level: [1..-1]" />
|
||||
<Value name="GAMEPAD_AXIS_RIGHT_TRIGGER" integer="5" desc="Gamepad back trigger right, pressure level: [1..-1]" />
|
||||
</Enum>
|
||||
<Enum name="MaterialMapIndex" valueCount="11" desc="">
|
||||
<Value name="MATERIAL_MAP_ALBEDO" integer="0" desc="" />
|
||||
<Value name="MATERIAL_MAP_METALNESS" integer="1" desc="" />
|
||||
<Value name="MATERIAL_MAP_NORMAL" integer="2" desc="" />
|
||||
<Value name="MATERIAL_MAP_ROUGHNESS" integer="3" desc="" />
|
||||
<Value name="MATERIAL_MAP_OCCLUSION" integer="4" desc="" />
|
||||
<Value name="MATERIAL_MAP_EMISSION" integer="5" desc="" />
|
||||
<Value name="MATERIAL_MAP_HEIGHT" integer="6" desc="" />
|
||||
<Value name="MATERIAL_MAP_CUBEMAP" integer="7" desc="" />
|
||||
<Value name="MATERIAL_MAP_IRRADIANCE" integer="8" desc="" />
|
||||
<Value name="MATERIAL_MAP_PREFILTER" integer="9" desc="" />
|
||||
<Value name="MATERIAL_MAP_BRDF" integer="10" desc="" />
|
||||
<Enum name="MaterialMapIndex" valueCount="11" desc="Material map index">
|
||||
<Value name="MATERIAL_MAP_ALBEDO" integer="0" desc="Albedo material (same as: MATERIAL_MAP_DIFFUSE)" />
|
||||
<Value name="MATERIAL_MAP_METALNESS" integer="1" desc="Metalness material (same as: MATERIAL_MAP_SPECULAR)" />
|
||||
<Value name="MATERIAL_MAP_NORMAL" integer="2" desc="Normal material" />
|
||||
<Value name="MATERIAL_MAP_ROUGHNESS" integer="3" desc="Roughness material" />
|
||||
<Value name="MATERIAL_MAP_OCCLUSION" integer="4" desc="Ambient occlusion material" />
|
||||
<Value name="MATERIAL_MAP_EMISSION" integer="5" desc="Emission material" />
|
||||
<Value name="MATERIAL_MAP_HEIGHT" integer="6" desc="Heightmap material" />
|
||||
<Value name="MATERIAL_MAP_CUBEMAP" integer="7" desc="Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" />
|
||||
<Value name="MATERIAL_MAP_IRRADIANCE" integer="8" desc="Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" />
|
||||
<Value name="MATERIAL_MAP_PREFILTER" integer="9" desc="Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" />
|
||||
<Value name="MATERIAL_MAP_BRDF" integer="10" desc="Brdf material" />
|
||||
</Enum>
|
||||
<Enum name="ShaderLocationIndex" valueCount="26" desc="">
|
||||
<Value name="SHADER_LOC_VERTEX_POSITION" integer="0" desc="" />
|
||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD01" integer="1" desc="" />
|
||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD02" integer="2" desc="" />
|
||||
<Value name="SHADER_LOC_VERTEX_NORMAL" integer="3" desc="" />
|
||||
<Value name="SHADER_LOC_VERTEX_TANGENT" integer="4" desc="" />
|
||||
<Value name="SHADER_LOC_VERTEX_COLOR" integer="5" desc="" />
|
||||
<Value name="SHADER_LOC_MATRIX_MVP" integer="6" desc="" />
|
||||
<Value name="SHADER_LOC_MATRIX_VIEW" integer="7" desc="" />
|
||||
<Value name="SHADER_LOC_MATRIX_PROJECTION" integer="8" desc="" />
|
||||
<Value name="SHADER_LOC_MATRIX_MODEL" integer="9" desc="" />
|
||||
<Value name="SHADER_LOC_MATRIX_NORMAL" integer="10" desc="" />
|
||||
<Value name="SHADER_LOC_VECTOR_VIEW" integer="11" desc="" />
|
||||
<Value name="SHADER_LOC_COLOR_DIFFUSE" integer="12" desc="" />
|
||||
<Value name="SHADER_LOC_COLOR_SPECULAR" integer="13" desc="" />
|
||||
<Value name="SHADER_LOC_COLOR_AMBIENT" integer="14" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_ALBEDO" integer="15" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_METALNESS" integer="16" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_NORMAL" integer="17" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_ROUGHNESS" integer="18" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_OCCLUSION" integer="19" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_EMISSION" integer="20" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_HEIGHT" integer="21" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_CUBEMAP" integer="22" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_IRRADIANCE" integer="23" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_PREFILTER" integer="24" desc="" />
|
||||
<Value name="SHADER_LOC_MAP_BRDF" integer="25" desc="" />
|
||||
<Enum name="ShaderLocationIndex" valueCount="26" desc="Shader location index">
|
||||
<Value name="SHADER_LOC_VERTEX_POSITION" integer="0" desc="Shader location: vertex attribute: position" />
|
||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD01" integer="1" desc="Shader location: vertex attribute: texcoord01" />
|
||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD02" integer="2" desc="Shader location: vertex attribute: texcoord02" />
|
||||
<Value name="SHADER_LOC_VERTEX_NORMAL" integer="3" desc="Shader location: vertex attribute: normal" />
|
||||
<Value name="SHADER_LOC_VERTEX_TANGENT" integer="4" desc="Shader location: vertex attribute: tangent" />
|
||||
<Value name="SHADER_LOC_VERTEX_COLOR" integer="5" desc="Shader location: vertex attribute: color" />
|
||||
<Value name="SHADER_LOC_MATRIX_MVP" integer="6" desc="Shader location: matrix uniform: model-view-projection" />
|
||||
<Value name="SHADER_LOC_MATRIX_VIEW" integer="7" desc="Shader location: matrix uniform: view (camera transform)" />
|
||||
<Value name="SHADER_LOC_MATRIX_PROJECTION" integer="8" desc="Shader location: matrix uniform: projection" />
|
||||
<Value name="SHADER_LOC_MATRIX_MODEL" integer="9" desc="Shader location: matrix uniform: model (transform)" />
|
||||
<Value name="SHADER_LOC_MATRIX_NORMAL" integer="10" desc="Shader location: matrix uniform: normal" />
|
||||
<Value name="SHADER_LOC_VECTOR_VIEW" integer="11" desc="Shader location: vector uniform: view" />
|
||||
<Value name="SHADER_LOC_COLOR_DIFFUSE" integer="12" desc="Shader location: vector uniform: diffuse color" />
|
||||
<Value name="SHADER_LOC_COLOR_SPECULAR" integer="13" desc="Shader location: vector uniform: specular color" />
|
||||
<Value name="SHADER_LOC_COLOR_AMBIENT" integer="14" desc="Shader location: vector uniform: ambient color" />
|
||||
<Value name="SHADER_LOC_MAP_ALBEDO" integer="15" desc="Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE)" />
|
||||
<Value name="SHADER_LOC_MAP_METALNESS" integer="16" desc="Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR)" />
|
||||
<Value name="SHADER_LOC_MAP_NORMAL" integer="17" desc="Shader location: sampler2d texture: normal" />
|
||||
<Value name="SHADER_LOC_MAP_ROUGHNESS" integer="18" desc="Shader location: sampler2d texture: roughness" />
|
||||
<Value name="SHADER_LOC_MAP_OCCLUSION" integer="19" desc="Shader location: sampler2d texture: occlusion" />
|
||||
<Value name="SHADER_LOC_MAP_EMISSION" integer="20" desc="Shader location: sampler2d texture: emission" />
|
||||
<Value name="SHADER_LOC_MAP_HEIGHT" integer="21" desc="Shader location: sampler2d texture: height" />
|
||||
<Value name="SHADER_LOC_MAP_CUBEMAP" integer="22" desc="Shader location: samplerCube texture: cubemap" />
|
||||
<Value name="SHADER_LOC_MAP_IRRADIANCE" integer="23" desc="Shader location: samplerCube texture: irradiance" />
|
||||
<Value name="SHADER_LOC_MAP_PREFILTER" integer="24" desc="Shader location: samplerCube texture: prefilter" />
|
||||
<Value name="SHADER_LOC_MAP_BRDF" integer="25" desc="Shader location: sampler2d texture: brdf" />
|
||||
</Enum>
|
||||
<Enum name="ShaderUniformDataType" valueCount="9" desc="">
|
||||
<Value name="SHADER_UNIFORM_FLOAT" integer="0" desc="" />
|
||||
<Value name="SHADER_UNIFORM_VEC2" integer="1" desc="" />
|
||||
<Value name="SHADER_UNIFORM_VEC3" integer="2" desc="" />
|
||||
<Value name="SHADER_UNIFORM_VEC4" integer="3" desc="" />
|
||||
<Value name="SHADER_UNIFORM_INT" integer="4" desc="" />
|
||||
<Value name="SHADER_UNIFORM_IVEC2" integer="5" desc="" />
|
||||
<Value name="SHADER_UNIFORM_IVEC3" integer="6" desc="" />
|
||||
<Value name="SHADER_UNIFORM_IVEC4" integer="7" desc="" />
|
||||
<Value name="SHADER_UNIFORM_SAMPLER2D" integer="8" desc="" />
|
||||
<Enum name="ShaderUniformDataType" valueCount="9" desc="Shader uniform data type">
|
||||
<Value name="SHADER_UNIFORM_FLOAT" integer="0" desc="Shader uniform type: float" />
|
||||
<Value name="SHADER_UNIFORM_VEC2" integer="1" desc="Shader uniform type: vec2 (2 float)" />
|
||||
<Value name="SHADER_UNIFORM_VEC3" integer="2" desc="Shader uniform type: vec3 (3 float)" />
|
||||
<Value name="SHADER_UNIFORM_VEC4" integer="3" desc="Shader uniform type: vec4 (4 float)" />
|
||||
<Value name="SHADER_UNIFORM_INT" integer="4" desc="Shader uniform type: int" />
|
||||
<Value name="SHADER_UNIFORM_IVEC2" integer="5" desc="Shader uniform type: ivec2 (2 int)" />
|
||||
<Value name="SHADER_UNIFORM_IVEC3" integer="6" desc="Shader uniform type: ivec3 (3 int)" />
|
||||
<Value name="SHADER_UNIFORM_IVEC4" integer="7" desc="Shader uniform type: ivec4 (4 int)" />
|
||||
<Value name="SHADER_UNIFORM_SAMPLER2D" integer="8" desc="Shader uniform type: sampler2d" />
|
||||
</Enum>
|
||||
<Enum name="ShaderAttributeDataType" valueCount="4" desc="">
|
||||
<Value name="SHADER_ATTRIB_FLOAT" integer="0" desc="" />
|
||||
<Value name="SHADER_ATTRIB_VEC2" integer="1" desc="" />
|
||||
<Value name="SHADER_ATTRIB_VEC3" integer="2" desc="" />
|
||||
<Value name="SHADER_ATTRIB_VEC4" integer="3" desc="" />
|
||||
<Enum name="ShaderAttributeDataType" valueCount="4" desc="Shader attribute data types">
|
||||
<Value name="SHADER_ATTRIB_FLOAT" integer="0" desc="Shader attribute type: float" />
|
||||
<Value name="SHADER_ATTRIB_VEC2" integer="1" desc="Shader attribute type: vec2 (2 float)" />
|
||||
<Value name="SHADER_ATTRIB_VEC3" integer="2" desc="Shader attribute type: vec3 (3 float)" />
|
||||
<Value name="SHADER_ATTRIB_VEC4" integer="3" desc="Shader attribute type: vec4 (4 float)" />
|
||||
</Enum>
|
||||
<Enum name="PixelFormat" valueCount="21" desc="">
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAYSCALE" integer="1" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA" integer="2" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R5G6B5" integer="3" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R8G8B8" integer="4" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R5G5B5A1" integer="5" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R4G4B4A4" integer="6" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R8G8B8A8" integer="7" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R32" integer="8" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R32G32B32" integer="9" desc="" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R32G32B32A32" integer="10" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT1_RGB" integer="11" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT1_RGBA" integer="12" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT3_RGBA" integer="13" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT5_RGBA" integer="14" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ETC1_RGB" integer="15" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ETC2_RGB" integer="16" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA" integer="17" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_PVRT_RGB" integer="18" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_PVRT_RGBA" integer="19" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA" integer="20" desc="" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA" integer="21" desc="" />
|
||||
<Enum name="PixelFormat" valueCount="21" desc="Pixel formats">
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAYSCALE" integer="1" desc="8 bit per pixel (no alpha)" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA" integer="2" desc="8*2 bpp (2 channels)" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R5G6B5" integer="3" desc="16 bpp" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R8G8B8" integer="4" desc="24 bpp" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R5G5B5A1" integer="5" desc="16 bpp (1 bit alpha)" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R4G4B4A4" integer="6" desc="16 bpp (4 bit alpha)" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R8G8B8A8" integer="7" desc="32 bpp" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R32" integer="8" desc="32 bpp (1 channel - float)" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R32G32B32" integer="9" desc="32*3 bpp (3 channels - float)" />
|
||||
<Value name="PIXELFORMAT_UNCOMPRESSED_R32G32B32A32" integer="10" desc="32*4 bpp (4 channels - float)" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT1_RGB" integer="11" desc="4 bpp (no alpha)" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT1_RGBA" integer="12" desc="4 bpp (1 bit alpha)" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT3_RGBA" integer="13" desc="8 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_DXT5_RGBA" integer="14" desc="8 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ETC1_RGB" integer="15" desc="4 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ETC2_RGB" integer="16" desc="4 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA" integer="17" desc="8 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_PVRT_RGB" integer="18" desc="4 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_PVRT_RGBA" integer="19" desc="4 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA" integer="20" desc="8 bpp" />
|
||||
<Value name="PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA" integer="21" desc="2 bpp" />
|
||||
</Enum>
|
||||
<Enum name="TextureFilter" valueCount="6" desc="">
|
||||
<Value name="TEXTURE_FILTER_POINT" integer="0" desc="" />
|
||||
<Value name="TEXTURE_FILTER_BILINEAR" integer="1" desc="" />
|
||||
<Value name="TEXTURE_FILTER_TRILINEAR" integer="2" desc="" />
|
||||
<Value name="TEXTURE_FILTER_ANISOTROPIC_4X" integer="3" desc="" />
|
||||
<Value name="TEXTURE_FILTER_ANISOTROPIC_8X" integer="4" desc="" />
|
||||
<Value name="TEXTURE_FILTER_ANISOTROPIC_16X" integer="5" desc="" />
|
||||
<Enum name="TextureFilter" valueCount="6" desc="Texture parameters: filter mode">
|
||||
<Value name="TEXTURE_FILTER_POINT" integer="0" desc="No filter, just pixel approximation" />
|
||||
<Value name="TEXTURE_FILTER_BILINEAR" integer="1" desc="Linear filtering" />
|
||||
<Value name="TEXTURE_FILTER_TRILINEAR" integer="2" desc="Trilinear filtering (linear with mipmaps)" />
|
||||
<Value name="TEXTURE_FILTER_ANISOTROPIC_4X" integer="3" desc="Anisotropic filtering 4x" />
|
||||
<Value name="TEXTURE_FILTER_ANISOTROPIC_8X" integer="4" desc="Anisotropic filtering 8x" />
|
||||
<Value name="TEXTURE_FILTER_ANISOTROPIC_16X" integer="5" desc="Anisotropic filtering 16x" />
|
||||
</Enum>
|
||||
<Enum name="TextureWrap" valueCount="4" desc="">
|
||||
<Value name="TEXTURE_WRAP_REPEAT" integer="0" desc="" />
|
||||
<Value name="TEXTURE_WRAP_CLAMP" integer="1" desc="" />
|
||||
<Value name="TEXTURE_WRAP_MIRROR_REPEAT" integer="2" desc="" />
|
||||
<Value name="TEXTURE_WRAP_MIRROR_CLAMP" integer="3" desc="" />
|
||||
<Enum name="TextureWrap" valueCount="4" desc="Texture parameters: wrap mode">
|
||||
<Value name="TEXTURE_WRAP_REPEAT" integer="0" desc="Repeats texture in tiled mode" />
|
||||
<Value name="TEXTURE_WRAP_CLAMP" integer="1" desc="Clamps texture to edge pixel in tiled mode" />
|
||||
<Value name="TEXTURE_WRAP_MIRROR_REPEAT" integer="2" desc="Mirrors and repeats the texture in tiled mode" />
|
||||
<Value name="TEXTURE_WRAP_MIRROR_CLAMP" integer="3" desc="Mirrors and clamps to border the texture in tiled mode" />
|
||||
</Enum>
|
||||
<Enum name="CubemapLayout" valueCount="6" desc="">
|
||||
<Value name="CUBEMAP_LAYOUT_AUTO_DETECT" integer="0" desc="" />
|
||||
<Value name="CUBEMAP_LAYOUT_LINE_VERTICAL" integer="1" desc="" />
|
||||
<Value name="CUBEMAP_LAYOUT_LINE_HORIZONTAL" integer="2" desc="" />
|
||||
<Value name="CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR" integer="3" desc="" />
|
||||
<Value name="CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE" integer="4" desc="" />
|
||||
<Value name="CUBEMAP_LAYOUT_PANORAMA" integer="5" desc="" />
|
||||
<Enum name="CubemapLayout" valueCount="6" desc="Cubemap layouts">
|
||||
<Value name="CUBEMAP_LAYOUT_AUTO_DETECT" integer="0" desc="Automatically detect layout type" />
|
||||
<Value name="CUBEMAP_LAYOUT_LINE_VERTICAL" integer="1" desc="Layout is defined by a vertical line with faces" />
|
||||
<Value name="CUBEMAP_LAYOUT_LINE_HORIZONTAL" integer="2" desc="Layout is defined by an horizontal line with faces" />
|
||||
<Value name="CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR" integer="3" desc="Layout is defined by a 3x4 cross with cubemap faces" />
|
||||
<Value name="CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE" integer="4" desc="Layout is defined by a 4x3 cross with cubemap faces" />
|
||||
<Value name="CUBEMAP_LAYOUT_PANORAMA" integer="5" desc="Layout is defined by a panorama image (equirectangular map)" />
|
||||
</Enum>
|
||||
<Enum name="FontType" valueCount="3" desc="">
|
||||
<Value name="FONT_DEFAULT" integer="0" desc="" />
|
||||
<Value name="FONT_BITMAP" integer="1" desc="" />
|
||||
<Value name="FONT_SDF" integer="2" desc="" />
|
||||
<Enum name="FontType" valueCount="3" desc="Font type, defines generation method">
|
||||
<Value name="FONT_DEFAULT" integer="0" desc="Default font generation, anti-aliased" />
|
||||
<Value name="FONT_BITMAP" integer="1" desc="Bitmap font generation, no anti-aliasing" />
|
||||
<Value name="FONT_SDF" integer="2" desc="SDF font generation, requires external shader" />
|
||||
</Enum>
|
||||
<Enum name="BlendMode" valueCount="6" desc="">
|
||||
<Value name="BLEND_ALPHA" integer="0" desc="" />
|
||||
<Value name="BLEND_ADDITIVE" integer="1" desc="" />
|
||||
<Value name="BLEND_MULTIPLIED" integer="2" desc="" />
|
||||
<Value name="BLEND_ADD_COLORS" integer="3" desc="" />
|
||||
<Value name="BLEND_SUBTRACT_COLORS" integer="4" desc="" />
|
||||
<Value name="BLEND_CUSTOM" integer="5" desc="" />
|
||||
<Enum name="BlendMode" valueCount="6" desc="Color blending modes (pre-defined)">
|
||||
<Value name="BLEND_ALPHA" integer="0" desc="Blend textures considering alpha (default)" />
|
||||
<Value name="BLEND_ADDITIVE" integer="1" desc="Blend textures adding colors" />
|
||||
<Value name="BLEND_MULTIPLIED" integer="2" desc="Blend textures multiplying colors" />
|
||||
<Value name="BLEND_ADD_COLORS" integer="3" desc="Blend textures adding colors (alternative)" />
|
||||
<Value name="BLEND_SUBTRACT_COLORS" integer="4" desc="Blend textures subtracting colors (alternative)" />
|
||||
<Value name="BLEND_CUSTOM" integer="5" desc="Belnd textures using custom src/dst factors (use rlSetBlendMode())" />
|
||||
</Enum>
|
||||
<Enum name="Gesture" valueCount="11" desc="">
|
||||
<Value name="GESTURE_NONE" integer="0" desc="" />
|
||||
<Value name="GESTURE_TAP" integer="1" desc="" />
|
||||
<Value name="GESTURE_DOUBLETAP" integer="2" desc="" />
|
||||
<Value name="GESTURE_HOLD" integer="4" desc="" />
|
||||
<Value name="GESTURE_DRAG" integer="8" desc="" />
|
||||
<Value name="GESTURE_SWIPE_RIGHT" integer="16" desc="" />
|
||||
<Value name="GESTURE_SWIPE_LEFT" integer="32" desc="" />
|
||||
<Value name="GESTURE_SWIPE_UP" integer="64" desc="" />
|
||||
<Value name="GESTURE_SWIPE_DOWN" integer="128" desc="" />
|
||||
<Value name="GESTURE_PINCH_IN" integer="256" desc="" />
|
||||
<Value name="GESTURE_PINCH_OUT" integer="512" desc="" />
|
||||
<Enum name="Gesture" valueCount="11" desc="Gesture">
|
||||
<Value name="GESTURE_NONE" integer="0" desc="No gesture" />
|
||||
<Value name="GESTURE_TAP" integer="1" desc="Tap gesture" />
|
||||
<Value name="GESTURE_DOUBLETAP" integer="2" desc="Double tap gesture" />
|
||||
<Value name="GESTURE_HOLD" integer="4" desc="Hold gesture" />
|
||||
<Value name="GESTURE_DRAG" integer="8" desc="Drag gesture" />
|
||||
<Value name="GESTURE_SWIPE_RIGHT" integer="16" desc="Swipe right gesture" />
|
||||
<Value name="GESTURE_SWIPE_LEFT" integer="32" desc="Swipe left gesture" />
|
||||
<Value name="GESTURE_SWIPE_UP" integer="64" desc="Swipe up gesture" />
|
||||
<Value name="GESTURE_SWIPE_DOWN" integer="128" desc="Swipe down gesture" />
|
||||
<Value name="GESTURE_PINCH_IN" integer="256" desc="Pinch in gesture" />
|
||||
<Value name="GESTURE_PINCH_OUT" integer="512" desc="Pinch out gesture" />
|
||||
</Enum>
|
||||
<Enum name="CameraMode" valueCount="5" desc="">
|
||||
<Value name="CAMERA_CUSTOM" integer="0" desc="" />
|
||||
<Value name="CAMERA_FREE" integer="1" desc="" />
|
||||
<Value name="CAMERA_ORBITAL" integer="2" desc="" />
|
||||
<Value name="CAMERA_FIRST_PERSON" integer="3" desc="" />
|
||||
<Value name="CAMERA_THIRD_PERSON" integer="4" desc="" />
|
||||
<Enum name="CameraMode" valueCount="5" desc="Camera system modes">
|
||||
<Value name="CAMERA_CUSTOM" integer="0" desc="Custom camera" />
|
||||
<Value name="CAMERA_FREE" integer="1" desc="Free camera" />
|
||||
<Value name="CAMERA_ORBITAL" integer="2" desc="Orbital camera" />
|
||||
<Value name="CAMERA_FIRST_PERSON" integer="3" desc="First person camera" />
|
||||
<Value name="CAMERA_THIRD_PERSON" integer="4" desc="Third person camera" />
|
||||
</Enum>
|
||||
<Enum name="CameraProjection" valueCount="2" desc="">
|
||||
<Value name="CAMERA_PERSPECTIVE" integer="0" desc="" />
|
||||
<Value name="CAMERA_ORTHOGRAPHIC" integer="1" desc="" />
|
||||
<Enum name="CameraProjection" valueCount="2" desc="Camera projection">
|
||||
<Value name="CAMERA_PERSPECTIVE" integer="0" desc="Perspective projection" />
|
||||
<Value name="CAMERA_ORTHOGRAPHIC" integer="1" desc="Orthographic projection" />
|
||||
</Enum>
|
||||
<Enum name="NPatchLayout" valueCount="3" desc="">
|
||||
<Value name="NPATCH_NINE_PATCH" integer="0" desc="" />
|
||||
<Value name="NPATCH_THREE_PATCH_VERTICAL" integer="1" desc="" />
|
||||
<Value name="NPATCH_THREE_PATCH_HORIZONTAL" integer="2" desc="" />
|
||||
<Enum name="NPatchLayout" valueCount="3" desc="N-patch layout">
|
||||
<Value name="NPATCH_NINE_PATCH" integer="0" desc="Npatch layout: 3x3 tiles" />
|
||||
<Value name="NPATCH_THREE_PATCH_VERTICAL" integer="1" desc="Npatch layout: 1x3 tiles" />
|
||||
<Value name="NPATCH_THREE_PATCH_HORIZONTAL" integer="2" desc="Npatch layout: 3x1 tiles" />
|
||||
</Enum>
|
||||
</Enums>
|
||||
<Functions count="487">
|
||||
<Functions count="489">
|
||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||
<Param type="int" name="width" desc="" />
|
||||
<Param type="int" name="height" desc="" />
|
||||
|
|
@ -610,6 +610,10 @@
|
|||
</Function>
|
||||
<Function name="GetScreenHeight" retType="int" paramCount="0" desc="Get current screen height">
|
||||
</Function>
|
||||
<Function name="GetRenderWidth" retType="int" paramCount="0" desc="Get current render width (it considers HiDPI)">
|
||||
</Function>
|
||||
<Function name="GetRenderHeight" retType="int" paramCount="0" desc="Get current render height (it considers HiDPI)">
|
||||
</Function>
|
||||
<Function name="GetMonitorCount" retType="int" paramCount="0" desc="Get number of connected monitors">
|
||||
</Function>
|
||||
<Function name="GetCurrentMonitor" retType="int" paramCount="0" desc="Get current connected monitor">
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
131
src/Makefile
131
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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
},
|
||||
|
|
|
|||
33
src/config.h
33
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
|
||||
|
|
|
|||
706
src/external/dr_wav.h
vendored
706
src/external/dr_wav.h
vendored
File diff suppressed because it is too large
Load Diff
3
src/external/jar_xm.h
vendored
3
src/external/jar_xm.h
vendored
|
|
@ -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;
|
||||
|
|
|
|||
665
src/external/qoi.h
vendored
Normal file
665
src/external/qoi.h
vendored
Normal file
|
|
@ -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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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 <stdio.h>
|
||||
|
||||
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 */
|
||||
55
src/external/vox_loader.h
vendored
55
src/external/vox_loader.h
vendored
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
132
src/raudio.c
132
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 <stdlib.h> // Required for: malloc(), free()
|
||||
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fread()
|
||||
#include <string.h> // Required for: strcmp() [Used in IsFileExtension(), LoadWaveFromMemory(), LoadMusicStreamFromMemory()]
|
||||
|
||||
#if defined(RAUDIO_STANDALONE)
|
||||
#include <string.h> // 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
|
||||
|
|
|
|||
12
src/raylib.h
12
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 <stdarg.h> // 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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
133
src/rcore.c
133
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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
118
src/rmodels.c
118
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
|
||||
|
|
|
|||
|
|
@ -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 <math.h> // 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
|
||||
|
|
|
|||
15
src/rtext.c
15
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
|
||||
|
|
|
|||
139
src/rtextures.c
139
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 <stdlib.h> // Required for: malloc(), free()
|
||||
#include <string.h> // Required for: strlen() [Used in ImageTextEx()]
|
||||
#include <string.h> // Required for: strlen() [Used in ImageTextEx()], strcmp() [Used in LoadImageFromMemory()]
|
||||
#include <math.h> // Required for: fabsf()
|
||||
#include <stdio.h> // 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user