Merge remote-tracking branch 'raysan5/master' into drmkms

This commit is contained in:
Astie Teddy 2020-09-06 14:21:54 +02:00
commit e1ed0ffbe0
104 changed files with 32406 additions and 11699 deletions

72
.github/workflows/android.yml vendored Normal file
View File

@ -0,0 +1,72 @@
name: Android
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
ARCH: ["arm64", "x86_64"]
env:
RELEASE_NAME: raylib-dev_android_api28_${{ matrix.ARCH }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "::set-env name=RELEASE_NAME::raylib-${{ github.event.release.tag_name }}_android_api28_${{ matrix.ARCH }}"
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../..
# Generating static + shared library for 64bit arquitectures and API version 28
- name: Build Library
run: |
cd src
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=28 ANDROID_NDK="C:\PROGRA~2\Android\android-sdk\ndk-bundle" RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=28 ANDROID_NDK="C:\PROGRA~2\Android\android-sdk\ndk-bundle" RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
shell: cmd
- name: Generate Artifacts
run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/${{ env.RELEASE_NAME }}.tar.gz
asset_name: ${{ env.RELEASE_NAME }}.tar.gz
asset_content_type: application/gzip
if: github.event_name == 'release' && github.event.action == 'published'

View File

@ -1,30 +0,0 @@
name: CD - Source Build & Release - Linux
# Trigger the workflow on release publish
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
# TODO: Build project and zip generated files
- name: Build project
id: build_project
run: |
zip raylib.zip README.md
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./raylib.zip
asset_name: raylib.zip
asset_content_type: application/zip

View File

@ -1,18 +0,0 @@
name: CI - Source & Examples - Linux
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: apt-update
run: sudo apt-get update -qq
- name: apt get glfw
run: sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
- name: make src
run: cd src && make PLATFORM=PLATFORM_DESKTOP
- name: make examples
run: cd examples && make PLATFORM=PLATFORM_DESKTOP

View File

@ -1,13 +0,0 @@
name: CI - Source & Examples - macOS
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: make src
run: cd src && make PLATFORM=PLATFORM_DESKTOP
- name: make examples
run: cd examples && make PLATFORM=PLATFORM_DESKTOP

View File

@ -1,64 +0,0 @@
name: CI - Source & Examples - Windows
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
compiler: [mingw, msvc16]
bits: [32, 64]
include:
- compiler: mingw
bits: 32
CFLAGS: -m32
GENERATOR: "MinGW Makefiles"
- compiler: mingw
bits: 64
CFLAGS: -m64
GENERATOR: "MinGW Makefiles"
- compiler: msvc16
bits: 32
GENERATOR: "Visual Studio 16 2019"
ARCH: "-A Win32"
- compiler: msvc16
bits: 64
GENERATOR: "Visual Studio 16 2019"
ARCH: "-A x64"
env:
CFLAGS: ${{ matrix.CFLAGS }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Environment
run: |
mkdir build
cd build
# Trying to solve an issue with CMake and Chocolatey for MinGW
- run: cmake -E remove c:\ProgramData\chocolatey\bin\cpack.exe
if: matrix.compiler == 'mingw'
# Setup MSBuild.exe path if required
- uses: warrenbuckley/Setup-MSBuild@v1
if: matrix.compiler == 'msvc16'
- name: Build MinGW Project
run: |
cd ../raylib/src
make PLATFORM=PLATFORM_DESKTOP CC=gcc
if: matrix.compiler == 'mingw'
- name: Setup CMake Project
run: cmake -G "${{ matrix.GENERATOR }}" ${{ matrix.ARCH }} -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=OFF -DINCLUDE_EVERYTHING=ON ../raylib
if: matrix.compiler == 'msvc16'
- name: Build raylib Source & Examples
run: cmake --build . --target install
if: matrix.compiler == 'msvc16'

92
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,92 @@
name: Linux
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
bits: [32, 64]
include:
- bits: 32
ARCH: "i386"
ARCH_NAME: "i386"
COMPILER_PATH: "/user/bin"
- bits: 64
ARCH: "x86_64"
ARCH_NAME: "amd64"
COMPILER_PATH: "/user/bin"
env:
RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "::set-env name=RELEASE_NAME::raylib-${{ github.event.release.tag_name }}_linux_${{ matrix.ARCH_NAME }}"
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
sudo apt-get update -qq
sudo apt-get install gcc-multilib
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../../../raylib
# ${{ matrix.ARCH }}-linux-gnu-gcc -v
# TODO: Support 32bit (i386) 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"
# make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 32
- name: Build Library
run: |
cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 64
- name: Generate Artifacts
run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/${{ env.RELEASE_NAME }}.tar.gz
asset_name: ${{ env.RELEASE_NAME }}.tar.gz
asset_content_type: application/gzip
if: github.event_name == 'release' && github.event.action == 'published'

77
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: macOS
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: macos-latest
env:
RELEASE_NAME: raylib-dev_macos
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "::set-env name=RELEASE_NAME::raylib-${{ github.event.release.tag_name }}_macos"
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../..
# Generating static + shared library, note that i386 architecture is deprecated
# Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
# TODO: Support Universal ARCH libraries (build arm64 + x86_64 and merge)
- name: Build Library
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"
# 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
# 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"
# 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
# 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
cd ..
- name: Generate Artifacts
run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/${{ env.RELEASE_NAME }}.tar.gz
asset_name: ${{ env.RELEASE_NAME }}.tar.gz
asset_content_type: application/gzip
if: github.event_name == 'release' && github.event.action == 'published'

72
.github/workflows/webassembly.yml vendored Normal file
View File

@ -0,0 +1,72 @@
name: WebAssembly
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: windows-latest
env:
RELEASE_NAME: raylib-dev_webassembly
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v6
with:
version: 2.0.0
actions-cache-folder: 'emsdk-cache'
- name: Setup Release Version
run: |
echo "::set-env name=RELEASE_NAME::raylib-${{ github.event.release.tag_name }}_webassembly"
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../..
- name: Build Library
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"
cd ..
- name: Generate Artifacts
run: |
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
cd build
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
dir
shell: cmd
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/${{ env.RELEASE_NAME }}.zip
asset_name: ${{ env.RELEASE_NAME }}.zip
asset_content_type: application/zip
if: github.event_name == 'release' && github.event.action == 'published'

116
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,116 @@
name: Windows
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
compiler: [mingw-w64, msvc16]
bits: [32, 64]
include:
- compiler: mingw-w64
bits: 32
ARCH: "i686"
COMPILER_PATH: "C:\\msys64\\mingw32\\bin"
WINDRES_ARCH: pe-i386
- compiler: mingw-w64
bits: 64
ARCH: "x86_64"
COMPILER_PATH: "C:\\msys64\\mingw64\\bin"
WINDRES_ARCH: pe-x86-64
- compiler: msvc16
bits: 32
ARCH: "x86"
VSBINPATH: "Win32"
- compiler: msvc16
bits: 64
ARCH: "x64"
VSBINPATH: "x64"
env:
RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
GNUTARGET: default
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "::set-env name=RELEASE_NAME::raylib-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}"
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
dir
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../../../raylib
# Setup MSBuild.exe path if required
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.1
if: matrix.compiler == 'msvc16'
- name: Build Library (MinGW-w64)
run: |
cd src
set PATH=%PATH%;${{ matrix.COMPILER_PATH }}
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
${{ matrix.COMPILER_PATH }}/windres.exe --version
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
${{ matrix.COMPILER_PATH }}/windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
shell: cmd
if: matrix.compiler == 'mingw-w64'
- name: Build Library (MSVC16)
run: |
cd projects/VS2017
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
cd ../..
shell: cmd
if: matrix.compiler == 'msvc16'
- name: Generate Artifacts
run: |
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
cd build
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
dir
shell: cmd
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/${{ env.RELEASE_NAME }}.zip
asset_name: ${{ env.RELEASE_NAME }}.zip
asset_content_type: application/zip
if: github.event_name == 'release' && github.event.action == 'published'

View File

@ -33,15 +33,6 @@ matrix:
- os: osx - os: osx
osx_image: xcode9.4 osx_image: xcode9.4
env: ARCH=universal SHARED=OFF RELEASE=NO env: ARCH=universal SHARED=OFF RELEASE=NO
- os: linux
env: ARCH=arm64-android RELEASE=NO
sudo: required
- os: linux
env: ARCH=arm32-android RELEASE=NO
sudo: required
- os: linux
env: ARCH=html5 RELEASE=NO
sudo: required
- os: windows - os: windows
compiler: gcc compiler: gcc
env: ARCH=i386 SHARED=OFF RELEASE=NO env: ARCH=i386 SHARED=OFF RELEASE=NO
@ -56,38 +47,12 @@ before_install:
export DONT_TEST=1; export DONT_TEST=1;
fi fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then - if [ "$TRAVIS_OS_NAME" == "linux" ]; then
if [[ "$ARCH" == *-android ]]; then
export DONT_TEST=1;
export RAYLIB_PACKAGE_SUFFIX="-Android-arm64";
wget https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip;
unzip -qq android-ndk*.zip;
if [[ "$ARCH" == arm64-* ]]; then
export RAYLIB_PACKAGE_SUFFIX="-Android-arm64";
TOOLCHAIN_ARCH=arm64;
PREFIX=aarch64-linux-android-;
else
export RAYLIB_PACKAGE_SUFFIX="-Android-arm32";
TOOLCHAIN_ARCH=arm;
PREFIX=arm-linux-androideabi-;
fi;
export PATH=/android-ndk*/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH;
export CC=${PREFIX}clang;
export CXX=${PREFIX}clang++;
export CMAKE_ARCH_ARGS='-DPLATFORM=Android';
elif [ "$ARCH" == "html5" ]; then
export DONT_TEST=1;
export RAYLIB_PACKAGE_SUFFIX="-html5";
docker run --privileged=true -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-latest bash;
export CMAKE_ARCH_ARGS='-DPLATFORM=Web -DCMAKE_TOOLCHAIN_FILE=../cmake/emscripten.cmake';
RUNNER='docker exec -it emscripten cmake -E chdir build';
else
sudo apt-get install -y gcc-multilib sudo apt-get install -y gcc-multilib
libasound2-dev:$ARCH libasound2-dev:$ARCH
libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
libx11-dev:$ARCH libxrandr-dev:$ARCH libxrandr2:$ARCH libxi-dev:$ARCH libx11-dev:$ARCH libxrandr-dev:$ARCH libxrandr2:$ARCH libxi-dev:$ARCH
libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH; libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH;
if [ "$OPENAL" == "ON" ]; then sudo apt-get install -y libopenal-dev; fi;
if [ "$ARCH" == "i386" ]; then export CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu -DSUPPORT_FILEFORMAT_FLAC=OFF'; fi; if [ "$ARCH" == "i386" ]; then export CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu -DSUPPORT_FILEFORMAT_FLAC=OFF'; fi;
export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH"; export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH";
@ -103,7 +68,6 @@ before_install:
sudo make install; sudo make install;
popd; popd;
fi; fi;
fi;
fi fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then - if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export RAYLIB_PACKAGE_SUFFIX="-macOS"; export RAYLIB_PACKAGE_SUFFIX="-macOS";

View File

@ -4,75 +4,88 @@ Some people ported raylib to other languages in form of bindings or wrappers to
Here it is a list with the ones I'm aware of: Here it is a list with the ones I'm aware of:
| name | language | repo | | name | raylib version | language | repo |
|:------------------:|:--------------:|----------------------------------------------------------------------| |:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
| raylib | C | https://github.com/raysan5/raylib | | raylib | **3.1-dev** | [C](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib |
| raylib-cpp | C++ | https://github.com/robloach/raylib-cpp | | raylib-cpp | 3.1-dev | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp |
| Raylib-cs | C# | https://github.com/ChrisDill/Raylib-cs | | Raylib-cs | 3.0 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs |
| RaylibFS | F# | https://github.com/dallinbeutler/RaylibFS | | raylib-cppsharp | ? | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/phxvyper/raylib-cppsharp |
| raylib_d | D | https://github.com/0xFireball/raylib_d | | RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS |
| raylib-d | D | https://github.com/onroundit/raylib-d | | raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d |
| bindbc-raylib | D | https://github.com/o3o/bindbc-raylib | | raylib-d | 3.0 | [D](https://dlang.org/) | https://github.com/onroundit/raylib-d |
| raylib-go | Go | https://github.com/gen2brain/raylib-go | | bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib |
| raylib-goplus | Go | https://github.com/Lachee/raylib-goplus | | dray | 3.0 | [D](https://dlang.org/) | https://github.com/xdrie/dray |
| raylib-rs | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs | | raylib-go | 3.0 | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go |
| raylib-lua | Lua | https://github.com/raysan5/raylib-lua | | raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
| raylib-lua-ffi | Lua | https://github.com/raysan5/raylib/issues/693 | | ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
| raylib-lua-sol | Lua | https://github.com/RobLoach/raylib-lua-sol | | go-raylib | 3.1-dev | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
| raylib-lua (raylua)| Lua | https://github.com/TSnake41/raylib-lua | | raylib-rs | 3.0 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
| raylib-luamore | Lua | https://github.com/HDPLocust/raylib-luamore | | raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
| raylib-nelua | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua-mirror | | raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
| raylib-Nim | Nim | https://gitlab.com/define-private-public/raylib-Nim | | raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
| raylib-nim | Nim | https://github.com/Skrylar/raylib-nim | | raylib-lua | 3.0 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua |
| raylib-Forever | Nim | https://github.com/Guevara-chan/Raylib-Forever | | raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore |
| raylib-haskell | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell | | raylua | 3.0 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua |
| raylib-cr | Crystal | https://github.com/AregevDev/raylib-cr | | LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib |
| cray | Crystal | https://gitlab.com/Zatherz/cray | | raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua-mirror |
| raylib.cr | Crystal | https://github.com/sam0x17/raylib.cr | | raylib-Nim | ? | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim |
| raylib-pascal | Pascal | https://github.com/drezgames/raylib-pascal | | raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim |
| raylib-pas | Pascal | https://github.com/tazdij/raylib-pas | | raylib-Forever | ? | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
| Graphics-Raylib | Perl | https://github.com/athreef/Graphics-Raylib | | nim-raylib | ? | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib |
| raylib-ruby-ffi | Ruby | https://github.com/D3nX/raylib-ruby-ffi | | raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell |
| raylib-ruby | Ruby | https://github.com/a0/raylib-ruby | | raylib-cr | ? | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
| raylib-mruby | mruby | https://github.com/lihaochen910/raylib-mruby | | cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray |
| raylib-py | Python | https://github.com/overdev/raylib-py | | raylib.cr | ? | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
| raylib-python-cffi | Python | https://github.com/electronstudio/raylib-python-cffi | | raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
| jaylib | Java | https://github.com/electronstudio/jaylib/ | | raylib-pas | 2.6-dev | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas |
| raylib-java | Java | https://github.com/XoanaIO/raylib-java | | Graphics-Raylib | ? | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
| clj-raylib | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib | | raylib-ruby-ffi | ? | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
| node-raylib | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib | | raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
| QuickJS-raylib | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib | | raylib-mruby | ? | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
| raylib-js | JavaScript | https://github.com/RobLoach/raylib-js | | raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
| raylib-chaiscript | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript | | raylib-python-cffi | 2.6 | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
| raylib-squirrel | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel | | raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
| racket-raylib-2d | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d | | jaylib | 3.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
| raylib-php | PHP | https://github.com/joseph-montanez/raylib-php | | raylib-java | ? | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
| raylib-php-ffi | PHP | https://github.com/oraoto/raylib-php-ffi | | clj-raylib | ? | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
| raylib-phpcpp | PHP | https://github.com/oraoto/raylib-phpcpp | | node-raylib | 3.0 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
| raylib-factor | [Factor](https://factorcode.org/) | https://github.com/Silverbeard00/raylib-factor | | QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
| raylib-haxe | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe | | raylib-js | 2.6 | [JavaScript](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-js |
| ringraylib | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib | | raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
| cl-raylib | Common Lisp | https://github.com/longlene/cl-raylib | | raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
| raylib-scm | Chicken Scheme | https://github.com/yashrk/raylib-scm | | racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
| raylib-chibi | Chibi-Scheme | https://github.com/VincentToups/raylib-chibi | | raylib-php | ? | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php |
| Euraylib | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib | | raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi |
| raylib-wren | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren | | raylib-phpcpp | 3.0 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp |
| raylib-odin | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin | | raylib-factor | 2.5 | [Factor](https://factorcode.org/) | https://github.com/Silverbeard00/raylib-factor |
| raylib-zig | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig | | raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe |
| ray.zig | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments | | ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib |
| raylib-Ada | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada | | cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib |
| jaylib | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib | | raylib-scm | 2.5 | [Chicken Scheme](https://www.call-cc.org/) | https://github.com/yashrk/raylib-scm |
| raykit | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit | | raylib-chibi | ? | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi |
| vraylib | [V](https://vlang.io/) | https://github.com/MajorHard/vraylib | | raylib-gambit-scheme | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) | https://github.com/georgjz/raylib-gambit-scheme |
| ray.mod | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod | | Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib |
| raylib-mosaic | Mosaic | https://github.com/pluckyporcupine/raylib-mosaic | | raylib-wren | 3.0 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
| raylib-xdpw | XD Pascal | https://github.com/vtereshkov/raylib-xdpw | | raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin |
| raylib-carp | Carp | https://github.com/pluckyporcupine/raylib-carp | | raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig |
| raylib-fb | FreeBasic | https://github.com/IchMagBier/raylib-fb | | raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kevinw/raylib-jai |
| raylib-purebasic | [PureBasic](https://www.purebasic.com/) | https://github.com/D-a-n-i-l-o/raylib-purebasic | | ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
| raylib-ats2 | ATS2 | https://github.com/mephistopheles-8/raylib-ats2 | | raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
| raylib-beef | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef | | jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
| raylib.cbl | COBOL | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* | | raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
| vraylib | 2.5 | [V](https://vlang.io/) | https://github.com/MajorHard/vraylib |
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
| ray-ocaml | 3.0 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
| 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 |
| raylib-fb | 3.0 | [FreeBasic](https://www.freebasic.net/) | https://github.com/IchMagBier/raylib-fb |
| raylib-purebasic | 3.0 | [PureBasic](https://www.purebasic.com/) | https://github.com/D-a-n-i-l-o/raylib-purebasic |
| raylib-ats2 | ? | [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 | ? | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
Missing some language? Feel free to create a new binding! :) Missing some language? Feel free to create a new binding! :)

View File

@ -20,12 +20,12 @@ Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
[![Twitter Follow](https://img.shields.io/twitter/follow/raysan5?style=social)](https://twitter.com/raysan5) [![Twitter Follow](https://img.shields.io/twitter/follow/raysan5?style=social)](https://twitter.com/raysan5)
[![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?style=social)](https://www.reddit.com/r/raylib/) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?style=social)](https://www.reddit.com/r/raylib/)
[![Travis (.org)](https://img.shields.io/travis/raysan5/raylib?label=Travis%20CI%20Build%20Status%20-%20Linux,%20OSX,%20Android,%20Windows)](https://travis-ci.org/raysan5/raylib) [![Travis (.org)](https://img.shields.io/travis/raysan5/raylib?label=Linux,%20OSX,%20Windows)](https://travis-ci.org/raysan5/raylib)
[![AppVeyor](https://img.shields.io/appveyor/build/raysan5/raylib?label=AppVeyor%20CI%20Build%20Status%20-%20Windows%20(mingw,%20msvc15))](https://ci.appveyor.com/project/raysan5/raylib) [![Windows](https://github.com/raysan5/raylib/workflows/Windows/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows)
[![Linux](https://github.com/raysan5/raylib/workflows/Linux/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux)
[![Actions Status](https://github.com/raysan5/raylib/workflows/CI%20-%20Source%20&%20Examples%20-%20Windows/badge.svg)](https://github.com/raysan5/raylib/actions) [![macOS](https://github.com/raysan5/raylib/workflows/macOS/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AmacOS)
[![Actions Status](https://github.com/raysan5/raylib/workflows/CI%20-%20Source%20&%20Examples%20-%20Linux/badge.svg)](https://github.com/raysan5/raylib/actions) [![Android](https://github.com/raysan5/raylib/workflows/Android/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AAndroid)
[![Actions Status](https://github.com/raysan5/raylib/workflows/CI%20-%20Source%20&%20Examples%20-%20macOS/badge.svg)](https://github.com/raysan5/raylib/actions) [![WebAssembly](https://github.com/raysan5/raylib/workflows/WebAssembly/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
features features
-------- --------

View File

@ -15,25 +15,28 @@ The following people has contributed with a generous donation to the raylib proj
## 🥉 Bronze Contributors ## 🥉 Bronze Contributors
- minirop ([@minirop](https://github.com/minirop)) - minirop ([@minirop](https://github.com/minirop))
- Marc Agüera ([@maguera93](https://github.com/maguera93))
- Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies)) - Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies))
- Sergio ([@anidealgift](https://github.com/anidealgift)) - Sergio ([@anidealgift](https://github.com/anidealgift))
- JFons ([@JFonS](https://github.com/JFonS))
- Marc Agüera ([@maguera93](https://github.com/maguera93))
- Pau Fernández ([@pauek](https://github.com/pauek)) - Pau Fernández ([@pauek](https://github.com/pauek))
- Jens Pitkänen ([@neonmoe](https://github.com/neonmoe))
- Snowminx ([@Gamerfiend](https://github.com/Gamerfiend))
- NimbusFox ([@NimbusFox](https://github.com/NimbusFox))
- Robin Mattheussen ([@romatthe](https://github.com/romatthe))
- Rahul Nair ([@rahulunair](https://github.com/rahulunair))
- Grant Haywood ([@cinterloper](https://github.com/cinterloper))
- Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte)) - Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte))
- albatros-hmd ([@albatros-hmd](https://github.com/albatros-hmd)) - albatros-hmd ([@albatros-hmd](https://github.com/albatros-hmd))
- Grant Haywood ([@cinterloper](https://github.com/cinterloper))
- Robin Mattheussen ([@romatthe](https://github.com/romatthe))
- NimbusFox ([@NimbusFox](https://github.com/NimbusFox))
- Louis Johnson ([@louisgjohnson](https://github.com/louisgjohnson))
- JFons ([@JFonS](https://github.com/JFonS))
- Benjamin Stigsen ([@BenStigsen](https://github.com/BenStigsen)) - Benjamin Stigsen ([@BenStigsen](https://github.com/BenStigsen))
- Rahul Nair ([@rahulunair](https://github.com/rahulunair)) - Louis Johnson ([@louisgjohnson](https://github.com/louisgjohnson))
- Snowminx ([@Gamerfiend](https://github.com/Gamerfiend))
- Dani Martin ([@danimartin82](https://github.com/danimartin82)) - Dani Martin ([@danimartin82](https://github.com/danimartin82))
- Tommi Sinivuo ([@TommiSinivuo](https://github.com/TommiSinivuo)) - Tommi Sinivuo ([@TommiSinivuo](https://github.com/TommiSinivuo))
- Joakim Wennergren ([@joakimwennergren](https://github.com/joakimwennergren)) - Joakim Wennergren ([@joakimwennergren](https://github.com/joakimwennergren))
- Richard Urbanec ([@Poryg1](https://github.com/Poryg1))
- pmgl ([@pmgl](https://github.com/pmgl)) - pmgl ([@pmgl](https://github.com/pmgl))
- cob ([@majorcob](https://github.com/majorcob)) - cob ([@majorcob](https://github.com/majorcob))
- Samuel Batista ([@gamedevsam](https://github.com/gamedevsam)) - Samuel Batista ([@gamedevsam](https://github.com/gamedevsam))
- Alexandre Chêne ([@kooparse](https://github.com/kooparse)) - Alexandre Chêne ([@kooparse](https://github.com/kooparse))
- daddio69 ([@daddio69](https://github.com/daddio69))

View File

@ -1,65 +0,0 @@
#os: Visual Studio 2015
clone_depth: 5
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
init:
- cmake -E remove c:\programdata\chocolatey\bin\cpack.exe
- set PATH=%PATH:C:\Program Files (x86)\Git\usr\bin;=%
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
- if [%BITS%]==[32] set MINGW=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32
- if [%BITS%]==[64] set MINGW=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64
- if [%COMPILER%]==[mingw] set PATH=%MINGW%\bin;%PATH%
- set RAYLIB_PACKAGE_SUFFIX=-Win%BITS%-%COMPILER%
- set VERBOSE=1
environment:
matrix:
- compiler: mingw
bits: 32
examples: ON
- compiler: mingw
bits: 64
examples: ON
- compiler: msvc15
bits: 32
examples: OFF
- compiler: msvc15
bits: 64
examples: OFF
before_build:
- if [%compiler%]==[mingw] set CFLAGS=-m%BITS% & set LDFLAGS=-m%BITS% & set GENERATOR="MinGW Makefiles"
- if [%COMPILER%]==[msvc15] if [%BITS%]==[32] set GENERATOR="Visual Studio 14 2015"
- if [%COMPILER%]==[msvc15] if [%BITS%]==[64] set GENERATOR="Visual Studio 14 2015 Win64"
- mkdir build
- cd build
build_script:
- cmake -G %GENERATOR% -DCMAKE_BUILD_TYPE=Release -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DINCLUDE_EVERYTHING=ON ..
- cmake --build . --target install
after_build:
- cmake --build . --target package
before_test:
test_script:
artifacts:
- path: 'build\*.zip'
deploy:
- provider: GitHub
auth_token:
secure: OxKnnT3tlkPl9365cOO84rDWU4UkHIYJc0D3r3Tv7rB3HaR2BBhlhCnl7g3nuOJy
artifact: /.*\.zip/
draft: false
prerelease: false
force_update: true
on:
branch: master
appveyor_repo_tag: true # deploy on tag push only

View File

@ -119,7 +119,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
CLANG_PATH = $(EMSDK_PATH)/upstream/bin CLANG_PATH = $(EMSDK_PATH)/upstream/bin
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4_64bit PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4_64bit
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin NODE_PATH = $(EMSDK_PATH)/node/12.18.1_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);C:\raylib\MinGW\bin:$$(PATH)
endif endif
@ -176,6 +176,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
MAKE = make MAKE = make
endif endif
ifeq ($(PLATFORM_OS),OSX)
MAKE = make
endif
endif endif
# Define compiler flags: # Define compiler flags:
@ -196,7 +199,7 @@ ifeq ($(BUILD_MODE),DEBUG)
endif endif
else else
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS += -O3 CFLAGS += -Os
else else
CFLAGS += -s -O1 CFLAGS += -s -O1
endif endif
@ -264,7 +267,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Reset everything. # Reset everything.
# Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include # Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external #INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src/external
endif endif
endif endif
@ -287,7 +291,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Reset everything. # Reset everything.
# Precedence: immediately local, installed version, raysan5 provided libs # Precedence: immediately local, installed version, raysan5 provided libs
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
endif endif
endif endif
@ -378,7 +382,8 @@ CORE = \
core/core_scissor_test \ core/core_scissor_test \
core/core_storage_values \ core/core_storage_values \
core/core_vr_simulator \ core/core_vr_simulator \
core/core_loading_thread core/core_loading_thread \
core/core_quat_conversion
SHAPES = \ SHAPES = \
shapes/shapes_basic_shapes \ shapes/shapes_basic_shapes \

View File

@ -51,7 +51,7 @@ int main(void)
DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY); DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY); DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY);
DrawText(FormatText("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED); DrawText(TextFormat("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@ -134,7 +134,7 @@ int main(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText(FormatText("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED); DrawText(TextFormat("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED);
DrawText("click mouse button to change frequency", 10, 10, 20, DARKGRAY); DrawText("click mouse button to change frequency", 10, 10, 20, DARKGRAY);
// Draw the current buffer state proportionate to the screen // Draw the current buffer state proportionate to the screen

View File

@ -0,0 +1,10 @@
| resource | author | licence | notes |
| :------------------- | :---------: | :------ | :---- |
| country.mp3 | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
| target.ogg | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
| target.flac | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) |
| mini1111.xm | [tPORt](https://modarchive.org/index.php?request=view_by_moduleid&query=51891) | [Mod Archive Distribution license](https://modarchive.org/index.php?terms-upload) | - |

View File

@ -59,7 +59,7 @@ int main(void)
if (IsGamepadAvailable(GAMEPAD_PLAYER1)) if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{ {
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK); DrawText(TextFormat("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID)) if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
{ {
@ -106,8 +106,8 @@ int main(void)
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED); DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED);
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED); DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED);
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK); //DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK); //DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
} }
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID)) else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
{ {
@ -161,14 +161,14 @@ int main(void)
// TODO: Draw generic gamepad // TODO: Draw generic gamepad
} }
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON); DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++) for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
{ {
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY); DrawText(TextFormat("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
} }
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED); if (GetGamepadButtonPressed() != -1) DrawText(TextFormat("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY); else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
} }
else else

View File

@ -43,7 +43,7 @@ int main(void)
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON); DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY); DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY); DrawText(TextFormat("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@ -68,7 +68,7 @@ int main(void)
{ {
// Draw circle and touch index number // Draw circle and touch index number
DrawCircleV(touchPosition, 34, ORANGE); DrawCircleV(touchPosition, 34, ORANGE);
DrawText(FormatText("%d", i), touchPosition.x - 10, touchPosition.y - 70, 40, BLACK); DrawText(TextFormat("%d", i), touchPosition.x - 10, touchPosition.y - 70, 40, BLACK);
} }
} }

View File

@ -0,0 +1,131 @@
/*******************************************************************************************
*
* raylib [core] example - quat conversions
*
* Welcome to raylib!
*
* generally you should really stick to eulers OR quats...
* This tests that various conversions are equivilant.
*
* You can find all basic examples on [C:\raylib\raylib\examples] directory and
* raylib official webpage: [www.raylib.com]
*
* Enjoy using raylib. :)
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#ifndef PI2
#define PI2 PI*2
#endif
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - quat conversions");
Camera3D camera = { 0 };
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
Mesh msh = GenMeshCylinder(.2, 1, 32);
Model mod = LoadModelFromMesh(msh);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
Quaternion q1;
Matrix m1,m2,m3,m4;
Vector3 v1,v2;
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
if (!IsKeyDown(KEY_SPACE)) {
v1.x += 0.01;
v1.y += 0.03;
v1.z += 0.05;
}
if (v1.x > PI2) v1.x-=PI2;
if (v1.y > PI2) v1.y-=PI2;
if (v1.z > PI2) v1.z-=PI2;
q1 = QuaternionFromEuler(v1.x, v1.y, v1.z);
m1 = MatrixRotateZYX(v1);
m2 = QuaternionToMatrix(q1);
q1 = QuaternionFromMatrix(m1);
m3 = QuaternionToMatrix(q1);
v2 = QuaternionToEuler(q1);
v2.x*=DEG2RAD; v2.y*=DEG2RAD; v2.z*=DEG2RAD;
m4 = MatrixRotateZYX(v2);
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
mod.transform = m1;
DrawModel(mod, (Vector3){-1,0,0},1.0,RED);
mod.transform = m2;
DrawModel(mod, (Vector3){1,0,0},1.0,RED);
mod.transform = m3;
DrawModel(mod, (Vector3){0,0,0},1.0,RED);
mod.transform = m4;
DrawModel(mod, (Vector3){0,0,-1},1.0,RED);
DrawGrid(10, 1.0f);
EndMode3D();
if (v2.x<0) v2.x+=PI2;
if (v2.y<0) v2.y+=PI2;
if (v2.z<0) v2.z+=PI2;
Color cx,cy,cz;
cx=cy=cz=BLACK;
if (v1.x == v2.x) cx = GREEN;
if (v1.y == v2.y) cy = GREEN;
if (v1.z == v2.z) cz = GREEN;
DrawText(TextFormat("%2.3f",v1.x),20,20,20,cx);
DrawText(TextFormat("%2.3f",v1.y),20,40,20,cy);
DrawText(TextFormat("%2.3f",v1.z),20,60,20,cz);
DrawText(TextFormat("%2.3f",v2.x),200,20,20,cx);
DrawText(TextFormat("%2.3f",v2.y),200,40,20,cy);
DrawText(TextFormat("%2.3f",v2.z),200,60,20,cz);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@ -50,7 +50,7 @@ int main(void)
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON); DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY); DrawText(TextFormat("%i", randValue), 360, 180, 80, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@ -65,10 +65,10 @@ int main(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON); DrawText(TextFormat("SCORE: %i", score), 280, 130, 40, MAROON);
DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK); DrawText(TextFormat("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME); DrawText(TextFormat("frames: %i", framesCounter), 10, 10, 20, LIME);
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY); DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY); DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);

View File

@ -56,7 +56,7 @@ int main(void)
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3 hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
// Distortion shader (uses device lens distortion and chroma) // Distortion shader (uses device lens distortion and chroma)
Shader distortion = LoadShader(0, FormatText("resources/distortion%i.fs", GLSL_VERSION)); Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION));
SetVrConfiguration(hmd, distortion); // Set Vr device parameters for stereo rendering SetVrConfiguration(hmd, distortion); // Set Vr device parameters for stereo rendering

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
| resource | author | licence | notes |
| :------------ | :---------: | :------ | :---- |
| ps3.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| xbox.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |

View File

@ -160,25 +160,25 @@ int main(void)
EndMode3D(); EndMode3D();
// Draw some debug GUI text // Draw some debug GUI text
DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK); DrawText(TextFormat("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
if (nearestHit.hit) if (nearestHit.hit)
{ {
int ypos = 70; int ypos = 70;
DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK); DrawText(TextFormat("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f", DrawText(TextFormat("Hit Pos: %3.2f %3.2f %3.2f",
nearestHit.position.x, nearestHit.position.x,
nearestHit.position.y, nearestHit.position.y,
nearestHit.position.z), 10, ypos + 15, 10, BLACK); nearestHit.position.z), 10, ypos + 15, 10, BLACK);
DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f", DrawText(TextFormat("Hit Norm: %3.2f %3.2f %3.2f",
nearestHit.normal.x, nearestHit.normal.x,
nearestHit.normal.y, nearestHit.normal.y,
nearestHit.normal.z), 10, ypos + 30, 10, BLACK); nearestHit.normal.z), 10, ypos + 30, 10, BLACK);
if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK); if (hitTriangle) DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
} }
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY); DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);

View File

@ -195,6 +195,6 @@ void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color); DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
DrawText(FormatText("%5.1f", angle), x - MeasureText(FormatText("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY); DrawText(TextFormat("%5.1f", angle), x - MeasureText(TextFormat("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY); DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY);
} }

File diff suppressed because it is too large Load Diff

View File

@ -9,14 +9,11 @@
#version 330 #version 330
// Input vertex attributes (from vertex shader) // Input vertex attributes (from vertex shader)
in vec3 fragPosition; varying vec3 fragPosition;
// Input uniform values // Input uniform values
uniform sampler2D equirectangularMap; uniform sampler2D equirectangularMap;
// Output fragment color
out vec4 finalColor;
vec2 SampleSphericalMap(vec3 v) vec2 SampleSphericalMap(vec3 v)
{ {
vec2 uv = vec2(atan(v.z, v.x), asin(v.y)); vec2 uv = vec2(atan(v.z, v.x), asin(v.y));
@ -34,5 +31,5 @@ void main()
vec3 color = texture(equirectangularMap, uv).rgb; vec3 color = texture(equirectangularMap, uv).rgb;
// Calculate final fragment color // Calculate final fragment color
finalColor = vec4(color, 1.0); gl_FragColor = vec4(color, 1.0);
} }

View File

@ -9,14 +9,14 @@
#version 330 #version 330
// Input vertex attributes // Input vertex attributes
in vec3 vertexPosition; attribute vec3 vertexPosition;
// Input uniform values // Input uniform values
uniform mat4 projection; uniform mat4 projection;
uniform mat4 view; uniform mat4 view;
// Output vertex attributes (to fragment shader) // Output vertex attributes (to fragment shader)
out vec3 fragPosition; varying vec3 fragPosition;
void main() void main()
{ {

View File

@ -11,33 +11,24 @@
#version 110 #version 110
// Input vertex attributes (from vertex shader) // Input vertex attributes (from vertex shader)
in vec3 fragPosition; varying vec3 fragPosition;
// Input uniform values // Input uniform values
uniform samplerCube environmentMap; uniform samplerCube environmentMap;
uniform bool vflipped; uniform bool vflipped;
// Output fragment color
out vec4 finalColor;
vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) {
return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z));
}
void main() void main()
{ {
// Fetch color from texture map // Fetch color from texture map
vec3 color; vec3 color = { 0.0 };
if (vflipped ) if (vflipped) color = texture2D(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb;
color = flipTextureCube(environmentMap, fragPosition).rgb; else color = texture2D(environmentMap, fragPosition).rgb;
else
color = texture(environmentMap, fragPosition).rgb;
// Apply gamma correction // Apply gamma correction
color = color/(color + vec3(1.0)); color = color/(color + vec3(1.0));
color = pow(color, vec3(1.0/2.2)); color = pow(color, vec3(1.0/2.2));
// Calculate final fragment color // Calculate final fragment color
finalColor = vec4(color, 1.0); gl_FragColor = vec4(color, 1.0);
} }

View File

@ -20,19 +20,13 @@ uniform bool vflipped;
// Output fragment color // Output fragment color
out vec4 finalColor; out vec4 finalColor;
vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) {
return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z));
}
void main() void main()
{ {
// Fetch color from texture map // Fetch color from texture map
vec3 color; vec3 color = vec3(0.0);
if (vflipped ) if (vflipped) color = texture(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)).rgb;
color = flipTextureCube(environmentMap, fragPosition).rgb; else color = texture(environmentMap, fragPosition).rgb;
else
color = texture(environmentMap, fragPosition).rgb;
// Apply gamma correction // Apply gamma correction
color = color/(color + vec3(1.0)); color = color/(color + vec3(1.0));

View File

@ -5,8 +5,9 @@
* NOTE: This example does not require any graphic device, it can run directly on console. * NOTE: This example does not require any graphic device, it can run directly on console.
* *
* DEPENDENCIES: * DEPENDENCIES:
* mini_al.h - Audio device management lib (https://github.com/dr-soft/mini_al) * miniaudio.h - Audio device management lib (https://github.com/dr-soft/miniaudio)
* stb_vorbis.h - Ogg audio files loading (http://www.nothings.org/stb_vorbis/) * stb_vorbis.h - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
* dr_wav.h - WAV audio file loading (https://github.com/mackron/dr_libs)
* dr_mp3.h - MP3 audio file loading (https://github.com/mackron/dr_libs) * dr_mp3.h - MP3 audio file loading (https://github.com/mackron/dr_libs)
* dr_flac.h - FLAC audio file loading (https://github.com/mackron/dr_libs) * dr_flac.h - FLAC audio file loading (https://github.com/mackron/dr_libs)
* jar_xm.h - XM module file loading * jar_xm.h - XM module file loading
@ -22,7 +23,7 @@
* This example is licensed under an unmodified zlib/libpng license, which is an OSI-certified, * This example is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software: * BSD-like license that allows static linking with closed source software:
* *
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2020 Ramon Santamaria (@raysan5)
* *
* This software is provided "as-is", without any express or implied warranty. In no event * 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 the use of this software. * will the authors be held liable for any damages arising from the use of this software.
@ -48,13 +49,73 @@
#if defined(_WIN32) #if defined(_WIN32)
#include <conio.h> // Windows only, no stardard library #include <conio.h> // Windows only, no stardard library
#else #else
// Required for kbhit() function in non-Windows platforms
// Provide kbhit() function in non-Windows platforms
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#endif
#define KEY_ESCAPE 27
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
#if !defined(_WIN32)
static int kbhit(void); // Check if a key has been pressed
static char getch(); // Get pressed character
#endif
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
// Initialization
//--------------------------------------------------------------------------------------
static unsigned char key = 0;
InitAudioDevice();
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/audio/target.ogg"); // Load OGG audio file
Music music = LoadMusicStream("resources/audio/country.mp3");
PlayMusicStream(music);
printf("\nPress s or d to play sounds, ESC to stop...\n");
//--------------------------------------------------------------------------------------
// Main loop
while (key != KEY_ESCAPE)
{
if (kbhit()) key = getch();
if ((key == 's') || (key == 'S')) PlaySound(fxWav);
if ((key == 'd') || (key == 'D')) PlaySound(fxOgg);
key = 0;
UpdateMusicStream(music);
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
UnloadMusicStream(music); // Unload music stream data
CloseAudioDevice();
//--------------------------------------------------------------------------------------
return 0;
}
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
#if !defined(_WIN32)
// Check if a key has been pressed // Check if a key has been pressed
static int kbhit(void) static int kbhit(void)
{ {
@ -85,57 +146,4 @@ static int kbhit(void)
// Get pressed character // Get pressed character
static char getch() { return getchar(); } static char getch() { return getchar(); }
#endif #endif
#define KEY_ESCAPE 27
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
static unsigned char key = 0;
InitAudioDevice();
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/audio/target.ogg"); // Load OGG audio file
Music music = LoadMusicStream("resources/audio/country.mp3");
PlayMusicStream(music);
printf("\nPress s or d to play sounds...\n");
//--------------------------------------------------------------------------------------
// Main loop
while (key != KEY_ESCAPE)
{
if (kbhit()) key = getch();
if (key == 's')
{
PlaySound(fxWav);
key = 0;
}
if (key == 'd')
{
PlaySound(fxOgg);
key = 0;
}
UpdateMusicStream(music);
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
UnloadMusicStream(music); // Unload music stream data
CloseAudioDevice();
//--------------------------------------------------------------------------------------
return 0;
}

View File

@ -219,7 +219,7 @@ int main(void)
// GLFW3: Error callback // GLFW3: Error callback
static void ErrorCallback(int error, const char *description) static void ErrorCallback(int error, const char *description)
{ {
fprintf(stderr, description); fprintf(stderr, "%s", description);
} }
// GLFW3: Keyboard callback // GLFW3: Keyboard callback

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ void main()
} }
finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0))); finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
finalColor += texelColor*(ambient/10.0); finalColor += texelColor*(ambient/10.0)*colDiffuse;
// Gamma correction // Gamma correction
finalColor = pow(finalColor, vec4(1.0/2.2)); finalColor = pow(finalColor, vec4(1.0/2.2));

View File

@ -0,0 +1,40 @@
#version 330
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord; // Texture coordinates (sampler2D)
in vec4 fragColor; // Tint color
// Output fragment color
out vec4 finalColor; // Output fragment color
// Uniform inputs
uniform vec2 resolution; // Viewport resolution (in pixels)
uniform vec2 mouse; // Mouse pixel xy coordinates
uniform float time; // Total run time (in secods)
// Draw circle
vec4 DrawCircle(vec2 fragCoord, vec2 position, float radius, vec3 color)
{
float d = length(position - fragCoord) - radius;
float t = clamp(d, 0.0, 1.0);
return vec4(color, 1.0 - t);
}
void main()
{
vec2 fragCoord = gl_FragCoord.xy;
vec2 position = vec2(mouse.x, resolution.y - mouse.y);
float radius = 40.0;
// Draw background layer
vec4 colorA = vec4(0.2,0.2,0.8, 1.0);
vec4 colorB = vec4(1.0,0.7,0.2, 1.0);
vec4 layer1 = mix(colorA, colorB, abs(sin(time*0.1)));
// Draw circle layer
vec3 color = vec3(0.9, 0.16, 0.21);
vec4 layer2 = DrawCircle(fragCoord, position, radius, color);
// Blend the two layers
finalColor = mix(layer1, layer2, layer2.a);
}

View File

@ -69,8 +69,8 @@ int main(void)
modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; modelB.materials[0].maps[MAP_DIFFUSE].texture = texture;
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
Shader shader = LoadShader(FormatText("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION), Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
FormatText("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION)); TextFormat("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION));
// Get some shader loactions // Get some shader loactions
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");

View File

@ -51,7 +51,7 @@ int main(void)
// Load postprocessing shader // Load postprocessing shader
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/swirl.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/swirl.fs", GLSL_VERSION));
// Get variable (uniform) location on the shader to connect with the program // Get variable (uniform) location on the shader to connect with the program
// NOTE: If uniform variable could not be found in the shader, function returns -1 // NOTE: If uniform variable could not be found in the shader, function returns -1

View File

@ -44,7 +44,7 @@ int main(void)
// Load Eratosthenes shader // Load Eratosthenes shader
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/eratosthenes.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/eratosthenes.fs", GLSL_VERSION));
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -67,8 +67,8 @@ int main(void)
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
// Load shader and set up some uniforms // Load shader and set up some uniforms
Shader shader = LoadShader(FormatText("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION), Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
FormatText("resources/shaders/glsl%i/fog.fs", GLSL_VERSION)); TextFormat("resources/shaders/glsl%i/fog.fs", GLSL_VERSION));
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");

View File

@ -0,0 +1,129 @@
/*******************************************************************************************
*
* raylib [shaders] example - Hot reloading
*
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
*
* This example has been created using raylib 3.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2020 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include <time.h> // Required for: localtime(), asctime()
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - hot reloading");
const char *fragShaderFileName = "resources/shaders/glsl%i/reload.fs";
long fragShaderFileModTime = GetFileModTime(TextFormat(fragShaderFileName, GLSL_VERSION));
// Load raymarching shader
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, TextFormat(fragShaderFileName, GLSL_VERSION));
// Get shader locations for required uniforms
int resolutionLoc = GetShaderLocation(shader, "resolution");
int mouseLoc = GetShaderLocation(shader, "mouse");
int timeLoc = GetShaderLocation(shader, "time");
float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
float totalTime = 0.0f;
bool shaderAutoReloading = false;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
totalTime += GetFrameTime();
Vector2 mouse = GetMousePosition();
float mousePos[2] = { mouse.x, mouse.y };
// Set shader required uniform values
SetShaderValue(shader, timeLoc, &totalTime, UNIFORM_FLOAT);
SetShaderValue(shader, mouseLoc, mousePos, UNIFORM_VEC2);
// Hot shader reloading
if (shaderAutoReloading || (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
{
long currentFragShaderModTime = GetFileModTime(TextFormat(fragShaderFileName, GLSL_VERSION));
// Check if shader file has been modified
if (currentFragShaderModTime != fragShaderFileModTime)
{
// Try reloading updated shader
Shader updatedShader = LoadShader(0, TextFormat(fragShaderFileName, GLSL_VERSION));
if (updatedShader.id != GetShaderDefault().id) // It was correctly loaded
{
UnloadShader(shader);
shader = updatedShader;
// Get shader locations for required uniforms
resolutionLoc = GetShaderLocation(shader, "resolution");
mouseLoc = GetShaderLocation(shader, "mouse");
timeLoc = GetShaderLocation(shader, "time");
// Reset required uniforms
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
}
fragShaderFileModTime = currentFragShaderModTime;
}
}
if (IsKeyPressed(KEY_A)) shaderAutoReloading = !shaderAutoReloading;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// We only draw a white full-screen rectangle, frame is generated in shader
BeginShaderMode(shader);
DrawRectangle(0, 0, screenWidth, screenHeight, WHITE);
EndShaderMode();
DrawText(TextFormat("PRESS [A] to TOGGLE SHADER AUTOLOADING: %s",
shaderAutoReloading? "AUTO" : "MANUAL"), 10, 10, 10, shaderAutoReloading? RED : BLACK);
if (!shaderAutoReloading) DrawText("MOUSE CLICK to SHADER RE-LOADING", 10, 30, 10, BLACK);
DrawText(TextFormat("Shader last modification: %s", asctime(localtime(&fragShaderFileModTime))), 10, 430, 10, BLACK);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadShader(shader); // Unload shader
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -46,7 +46,7 @@ int main(void)
// Load julia set shader // Load julia set shader
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/julia_set.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/julia_set.fs", GLSL_VERSION));
// c constant to use in z^2 + c // c constant to use in z^2 + c
float c[2] = { POINTS_OF_INTEREST[0][0], POINTS_OF_INTEREST[0][1] }; float c[2] = { POINTS_OF_INTEREST[0][0], POINTS_OF_INTEREST[0][1] };

View File

@ -48,7 +48,7 @@ int main(void)
// Load shader for model // Load shader for model
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
model.materials[0].shader = shader; // Set shader effect to 3d model model.materials[0].shader = shader; // Set shader effect to 3d model
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Bind texture to model model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Bind texture to model

View File

@ -81,7 +81,7 @@ int main(void)
// Load shader to be used on some parts drawing // Load shader to be used on some parts drawing
// NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version // NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
// NOTE 2: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE 2: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/palette_switch.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/palette_switch.fs", GLSL_VERSION));
// Get variable (uniform) location on the shader to connect with the program // Get variable (uniform) location on the shader to connect with the program
// NOTE: If uniform variable could not be found in the shader, function returns -1 // NOTE: If uniform variable could not be found in the shader, function returns -1

View File

@ -84,18 +84,18 @@ int main(void)
Shader shaders[MAX_POSTPRO_SHADERS] = { 0 }; Shader shaders[MAX_POSTPRO_SHADERS] = { 0 };
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
shaders[FX_GRAYSCALE] = LoadShader(0, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); shaders[FX_GRAYSCALE] = LoadShader(0, TextFormat("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
shaders[FX_POSTERIZATION] = LoadShader(0, FormatText("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION)); shaders[FX_POSTERIZATION] = LoadShader(0, TextFormat("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION));
shaders[FX_DREAM_VISION] = LoadShader(0, FormatText("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION)); shaders[FX_DREAM_VISION] = LoadShader(0, TextFormat("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION));
shaders[FX_PIXELIZER] = LoadShader(0, FormatText("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION)); shaders[FX_PIXELIZER] = LoadShader(0, TextFormat("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION));
shaders[FX_CROSS_HATCHING] = LoadShader(0, FormatText("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION)); shaders[FX_CROSS_HATCHING] = LoadShader(0, TextFormat("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION));
shaders[FX_CROSS_STITCHING] = LoadShader(0, FormatText("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION)); shaders[FX_CROSS_STITCHING] = LoadShader(0, TextFormat("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION));
shaders[FX_PREDATOR_VIEW] = LoadShader(0, FormatText("resources/shaders/glsl%i/predator.fs", GLSL_VERSION)); shaders[FX_PREDATOR_VIEW] = LoadShader(0, TextFormat("resources/shaders/glsl%i/predator.fs", GLSL_VERSION));
shaders[FX_SCANLINES] = LoadShader(0, FormatText("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION)); shaders[FX_SCANLINES] = LoadShader(0, TextFormat("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION));
shaders[FX_FISHEYE] = LoadShader(0, FormatText("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION)); shaders[FX_FISHEYE] = LoadShader(0, TextFormat("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION));
shaders[FX_SOBEL] = LoadShader(0, FormatText("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION)); shaders[FX_SOBEL] = LoadShader(0, TextFormat("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION));
shaders[FX_BLOOM] = LoadShader(0, FormatText("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION)); shaders[FX_BLOOM] = LoadShader(0, TextFormat("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION));
shaders[FX_BLUR] = LoadShader(0, FormatText("resources/shaders/glsl%i/blur.fs", GLSL_VERSION)); shaders[FX_BLUR] = LoadShader(0, TextFormat("resources/shaders/glsl%i/blur.fs", GLSL_VERSION));
int currentShader = FX_GRAYSCALE; int currentShader = FX_GRAYSCALE;

View File

@ -40,7 +40,7 @@ int main(void)
// Load raymarching shader // Load raymarching shader
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/raymarching.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/raymarching.fs", GLSL_VERSION));
// Get shader locations for required uniforms // Get shader locations for required uniforms
int viewEyeLoc = GetShaderLocation(shader, "viewEye"); int viewEyeLoc = GetShaderLocation(shader, "viewEye");
@ -59,16 +59,6 @@ int main(void)
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Check if screen is resized
//----------------------------------------------------------------------------------
if(IsWindowResized())
{
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
}
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera UpdateCamera(&camera); // Update camera
@ -83,6 +73,15 @@ int main(void)
SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3); SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3);
SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3); SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3);
SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT); SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT);
// Check if screen is resized
if (IsWindowResized())
{
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

@ -38,7 +38,7 @@ int main(void)
// Load shader to be used on some parts drawing // Load shader to be used on some parts drawing
// NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version // NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
// NOTE 2: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader // NOTE 2: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -56,7 +56,7 @@ int main(void)
Model model3 = LoadModelFromMesh(sphere); Model model3 = LoadModelFromMesh(sphere);
// Load the shader // Load the shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/mask.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/mask.fs", GLSL_VERSION));
// Load and apply the diffuse texture (colour map) // Load and apply the diffuse texture (colour map)
Texture texDiffuse = LoadTexture("resources/plasma.png"); Texture texDiffuse = LoadTexture("resources/plasma.png");
@ -118,8 +118,8 @@ int main(void)
EndMode3D(); EndMode3D();
DrawRectangle(16, 698, MeasureText(FormatText("Frame: %i", framesCounter), 20) + 8, 42, BLUE); DrawRectangle(16, 698, MeasureText(TextFormat("Frame: %i", framesCounter), 20) + 8, 42, BLUE);
DrawText(FormatText("Frame: %i", framesCounter), 20, 700, 20, WHITE); DrawText(TextFormat("Frame: %i", framesCounter), 20, 700, 20, WHITE);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@ -93,7 +93,7 @@ int main(void)
// Use default vert shader // Use default vert shader
Shader spotShader = LoadShader(0, FormatText("resources/shaders/glsl%i/spotlight.fs", GLSL_VERSION)); Shader spotShader = LoadShader(0, TextFormat("resources/shaders/glsl%i/spotlight.fs", GLSL_VERSION));
// Get the locations of spots in the shader // Get the locations of spots in the shader
Spot spots[MAXSPOT]; Spot spots[MAXSPOT];

View File

@ -35,7 +35,7 @@ int main(void)
UnloadImage(imBlank); UnloadImage(imBlank);
// NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version // NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/cubes_panning.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/cubes_panning.fs", GLSL_VERSION));
float time = 0.0f; float time = 0.0f;
int timeLoc = GetShaderLocation(shader, "uTime"); int timeLoc = GetShaderLocation(shader, "uTime");

View File

@ -39,7 +39,7 @@ int main(void)
Texture2D texture = LoadTexture("resources/space.png"); Texture2D texture = LoadTexture("resources/space.png");
// Load shader and setup location points and values // Load shader and setup location points and values
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/wave.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/wave.fs", GLSL_VERSION));
int secondsLoc = GetShaderLocation(shader, "secondes"); int secondsLoc = GetShaderLocation(shader, "secondes");
int freqXLoc = GetShaderLocation(shader, "freqX"); int freqXLoc = GetShaderLocation(shader, "freqX");

View File

@ -90,7 +90,7 @@ int main(void)
DrawText("COLLISION!", GetScreenWidth()/2 - MeasureText("COLLISION!", 20)/2, screenUpperLimit/2 - 10, 20, BLACK); DrawText("COLLISION!", GetScreenWidth()/2 - MeasureText("COLLISION!", 20)/2, screenUpperLimit/2 - 10, 20, BLACK);
// Draw collision area // Draw collision area
DrawText(FormatText("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK); DrawText(TextFormat("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
} }
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@ -64,7 +64,7 @@ int main(void)
segments = GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", segments, 0, 100, true); segments = GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", segments, 0, 100, true);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DrawText(FormatText("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= 4)? MAROON : DARKGRAY); DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= 4)? MAROON : DARKGRAY);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@ -72,7 +72,7 @@ int main(void)
drawRect = GuiCheckBox((Rectangle){ 640, 380, 20, 20}, "DrawRect", drawRect); drawRect = GuiCheckBox((Rectangle){ 640, 380, 20, 20}, "DrawRect", drawRect);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DrawText(FormatText("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 640, 280, 10, (segments >= 4)? MAROON : DARKGRAY); DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 640, 280, 10, (segments >= 4)? MAROON : DARKGRAY);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@ -77,7 +77,7 @@ int main(void)
drawCircleLines = GuiCheckBox((Rectangle){ 600, 380, 20, 20 }, "Draw CircleLines", drawCircleLines); drawCircleLines = GuiCheckBox((Rectangle){ 600, 380, 20, 20 }, "Draw CircleLines", drawCircleLines);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DrawText(FormatText("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 600, 270, 10, (segments >= 4)? MAROON : DARKGRAY); DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 600, 270, 10, (segments >= 4)? MAROON : DARKGRAY);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@ -109,8 +109,8 @@ int main(void)
//DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED); //DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY); DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
DrawText(FormatText("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY); DrawText(TextFormat("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
DrawText(FormatText("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY); DrawText(TextFormat("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY); DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, BLACK); if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, BLACK);

View File

@ -55,7 +55,7 @@ int main(void)
UnloadImage(atlas); UnloadImage(atlas);
// Load SDF required shader (we use default vertex shader) // Load SDF required shader (we use default vertex shader)
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/sdf.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/sdf.fs", GLSL_VERSION));
SetTextureFilter(fontSDF.texture, FILTER_BILINEAR); // Required for SDF font SetTextureFilter(fontSDF.texture, FILTER_BILINEAR); // Required for SDF font
Vector2 fontPosition = { 40, screenHeight/2 - 50 }; Vector2 fontPosition = { 40, screenHeight/2 - 50 };
@ -110,7 +110,7 @@ int main(void)
else DrawText("default font", 315, 40, 30, GRAY); else DrawText("default font", 315, 40, 30, GRAY);
DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, DARKGRAY); DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, DARKGRAY);
DrawText(FormatText("RENDER SIZE: %02.02f", fontSize), GetScreenWidth() - 240, 50, 20, DARKGRAY); DrawText(TextFormat("RENDER SIZE: %02.02f", fontSize), GetScreenWidth() - 240, 50, 20, DARKGRAY);
DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, DARKGRAY); DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, DARKGRAY);
DrawText("HOLD SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, MAROON); DrawText("HOLD SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, MAROON);

View File

@ -41,13 +41,13 @@ int main(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED); DrawText(TextFormat("Score: %08i", score), 200, 80, 20, RED);
DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN); DrawText(TextFormat("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE); DrawText(TextFormat("Lives: %02i", lives), 200, 160, 40, BLUE);
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK); DrawText(TextFormat("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@ -86,7 +86,7 @@ int main(void)
DrawText(name, textBox.x + 5, textBox.y + 8, 40, MAROON); DrawText(name, textBox.x + 5, textBox.y + 8, 40, MAROON);
DrawText(FormatText("INPUT CHARS: %i/%i", letterCount, MAX_INPUT_CHARS), 315, 250, 20, DARKGRAY); DrawText(TextFormat("INPUT CHARS: %i/%i", letterCount, MAX_INPUT_CHARS), 315, 250, 20, DARKGRAY);
if (mouseOnText) if (mouseOnText)
{ {

View File

@ -98,8 +98,8 @@ int main(void)
} }
DrawRectangle(0, 0, screenWidth, 40, BLACK); DrawRectangle(0, 0, screenWidth, 40, BLACK);
DrawText(FormatText("bunnies: %i", bunniesCount), 120, 10, 20, GREEN); DrawText(TextFormat("bunnies: %i", bunniesCount), 120, 10, 20, GREEN);
DrawText(FormatText("batched draw calls: %i", 1 + bunniesCount/MAX_BATCH_ELEMENTS), 320, 10, 20, MAROON); DrawText(TextFormat("batched draw calls: %i", 1 + bunniesCount/MAX_BATCH_ELEMENTS), 320, 10, 20, MAROON);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@ -71,7 +71,7 @@ int main(void)
DrawRectangleLines(15 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED); DrawRectangleLines(15 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED);
DrawText("FRAME SPEED: ", 165, 210, 10, DARKGRAY); DrawText("FRAME SPEED: ", 165, 210, 10, DARKGRAY);
DrawText(FormatText("%02i FPS", framesSpeed), 575, 210, 10, DARKGRAY); DrawText(TextFormat("%02i FPS", framesSpeed), 575, 210, 10, DARKGRAY);
DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, DARKGRAY); DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, DARKGRAY);
for (int i = 0; i < MAX_FRAME_SPEED; i++) for (int i = 0; i < MAX_FRAME_SPEED; i++)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

View File

@ -333,6 +333,10 @@
<ClInclude Include="..\..\..\src\raymath.h" /> <ClInclude Include="..\..\..\src\raymath.h" />
<ClInclude Include="..\..\..\src\rlgl.h" /> <ClInclude Include="..\..\..\src\rlgl.h" />
<ClInclude Include="..\..\..\src\utils.h" /> <ClInclude Include="..\..\..\src\utils.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="raylib.rc" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by raylib.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -25,8 +25,8 @@
# Define required raylib variables # Define required raylib variables
PROJECT_NAME ?= game PROJECT_NAME ?= game
RAYLIB_VERSION ?= 2.5.0 RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 251 RAYLIB_API_VERSION ?= 300
RAYLIB_PATH ?= ..\.. RAYLIB_PATH ?= ..\..
# Define compiler path on Windows # Define compiler path on Windows

View File

@ -22,15 +22,38 @@ REM verbose, sorry.
REM To skip to the actual building part of the script, search for ":BUILD" REM To skip to the actual building part of the script, search for ":BUILD"
REM Checks if cl is available and skips to the argument loop if it is
REM (Prevents calling vcvarsall every time you run this script)
WHERE cl >nul 2>nul
IF %ERRORLEVEL% == 0 goto READ_ARGS
REM Activate the msvc build environment if cl isn't available yet
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" (
set VC_INIT="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
) ELSE IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
set VC_INIT="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
) ELSE IF EXIST "C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat" (
set VC_INIT="C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"
) ELSE (
REM Initialize your vc environment here if the defaults don't work
REM set VC_INIT="C:\your\path\here\vcvarsall.bat"
REM And then remove/comment out the following two lines
echo "Couldn't find vcvarsall.bat or vcbuildtools.bat, please set it manually."
exit /B
)
echo Setting up the msvc build environment, this could take some time but the next builds should be faster
REM Remove everything after %TARGET_PLATFORM% if you want to see
REM the vcvarsall.bat or vcbuildtools.bat output
call %VC_INIT% %TARGET_PLATFORM% > NUL 2>&1
:READ_ARGS
REM For the ! variable notation REM For the ! variable notation
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
REM For shifting, which the command line argument parsing needs REM For shifting, which the command line argument parsing needs
setlocal EnableExtensions setlocal EnableExtensions
:ARG_LOOP :ARG_LOOP
set ARG=%1 set ARG=%1
if "!ARG!" == "" ( goto PREPARE ) if "!ARG!" == "" ( goto BUILD )
IF NOT "x!ARG!" == "x!ARG:h=!" ( IF NOT "x!ARG!" == "x!ARG:h=!" (
goto HELP goto HELP
) )
@ -91,28 +114,6 @@ echo Build in debug, run, don't print at all: build-windows.bat -drqq
exit /B exit /B
:PREPARE
REM Activate the msvc build environment
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" (
set VC_INIT="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
) ELSE IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
set VC_INIT="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
) ELSE IF EXIST "C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat" (
set VC_INIT="C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"
) ELSE (
REM Initialize your vc environment here if the defaults don't work
REM set VC_INIT="C:\your\path\here\vcvarsall.bat"
REM And then remove/comment out the following two lines
echo "Couldn't find vcvarsall.bat or vcbuildtools.bat, please set it manually."
exit /B
)
IF DEFINED VERBOSE (
call !VC_INIT! !TARGET_PLATFORM!
) ELSE (
call !VC_INIT! !TARGET_PLATFORM! > NUL 2>&1
)
:BUILD :BUILD
REM Directories REM Directories
set "ROOT_DIR=%CD%" set "ROOT_DIR=%CD%"

View File

@ -7,7 +7,7 @@ Name: raylib
Description: Simple and easy-to-use library to enjoy videogames programming Description: Simple and easy-to-use library to enjoy videogames programming
URL: http://github.com/raysan5/raylib URL: http://github.com/raysan5/raylib
Version: @PROJECT_VERSION@ Version: @PROJECT_VERSION@
Libs: -L${libdir} -lraylib @PKG_CONFIG_LIBS_EXTRA@ Libs: -L"${libdir}" -lraylib @PKG_CONFIG_LIBS_EXTRA@
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@ Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
Requires.private: @GLFW_PKG_DEPS@ Requires.private: @GLFW_PKG_DEPS@
Cflags: -I${includedir} Cflags: -I"${includedir}"

View File

@ -176,7 +176,7 @@ if(STATIC)
set_property(TARGET raylib_static PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET raylib_static PROPERTY POSITION_INDEPENDENT_CODE ON)
endif() endif()
set_target_properties(raylib_static PROPERTIES PUBLIC_HEADER "raylib.h") set_target_properties(raylib_static PROPERTIES PUBLIC_HEADER "raylib.h")
if(NOT WIN32) # Keep lib*.(a|dll) name, but avoid *.lib files overwriting each other on Windows if(NOT MSVC) # Keep lib*.(a|dll) name, but avoid *.lib files overwriting each other on Windows
set_target_properties(raylib_static PROPERTIES OUTPUT_NAME raylib) set_target_properties(raylib_static PROPERTIES OUTPUT_NAME raylib)
endif() endif()
install( install(

View File

@ -4,10 +4,10 @@
# #
# Platforms supported: # Platforms supported:
# PLATFORM_DESKTOP: Windows (Win32, Win64) # PLATFORM_DESKTOP: Windows (Win32, Win64)
# PLATFORM_DESKTOP: Linux (32 and 64 bit) # PLATFORM_DESKTOP: Linux (i386, x64)
# PLATFORM_DESKTOP: OSX/macOS # PLATFORM_DESKTOP: OSX/macOS (arm64, x86_64)
# PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly # PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly
# PLATFORM_ANDROID: Android (ARM, ARM64) # PLATFORM_ANDROID: Android (arm, i686, arm64, x86_64)
# PLATFORM_RPI: Raspberry Pi (Raspbian) # PLATFORM_RPI: Raspberry Pi (Raspbian)
# PLATFORM_WEB: HTML5 (Chrome, Firefox) # PLATFORM_WEB: HTML5 (Chrome, Firefox)
# #
@ -42,16 +42,15 @@
.PHONY: all clean install uninstall .PHONY: all clean install uninstall
# Define required raylib variables # Define required raylib variables
RAYLIB_VERSION = 3.0.0 RAYLIB_VERSION = 3.1.0
RAYLIB_API_VERSION = 300 RAYLIB_API_VERSION = 310
# See below for alternatives. # Define raylib source code path
RAYLIB_PATH = .. RAYLIB_SRC_PATH ?= ../src
# Define default options # Define output directory for compiled library, defaults to src directory
# NOTE: If externally provided, make sure directory exists
# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB, PLATFORM_DRM RAYLIB_RELEASE_PATH ?= $(RAYLIB_SRC_PATH)
PLATFORM ?= PLATFORM_DRM
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?= STATIC RAYLIB_LIBTYPE ?= STATIC
@ -59,6 +58,16 @@ RAYLIB_LIBTYPE ?= STATIC
# Build mode for library: DEBUG or RELEASE # Build mode for library: DEBUG or RELEASE
RAYLIB_BUILD_MODE ?= DEBUG RAYLIB_BUILD_MODE ?= DEBUG
# Build output name for the library
RAYLIB_LIB_NAME ?= raylib
# Define resource file for DLL properties
RAYLIB_RES_FILE ?= ./raylib.dll.rc.data
# Define raylib platform
# Options: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
PLATFORM ?= PLATFORM_DESKTOP
# Include raylib modules on compilation # Include raylib modules on compilation
# NOTE: Some programs like tools could not require those modules # NOTE: Some programs like tools could not require those modules
RAYLIB_MODULE_AUDIO ?= TRUE RAYLIB_MODULE_AUDIO ?= TRUE
@ -66,8 +75,8 @@ RAYLIB_MODULE_MODELS ?= TRUE
RAYLIB_MODULE_RAYGUI ?= FALSE RAYLIB_MODULE_RAYGUI ?= FALSE
RAYLIB_MODULE_PHYSAC ?= FALSE RAYLIB_MODULE_PHYSAC ?= FALSE
RAYLIB_MODULE_RAYGUI_PATH ?= . RAYLIB_MODULE_RAYGUI_PATH ?= $(RAYLIB_SRC_PATH)/../../raygui/src
RAYLIB_MODULE_PHYSAC_PATH ?= . RAYLIB_MODULE_PHYSAC_PATH ?= $(RAYLIB_SRC_PATH)
# Use external GLFW library instead of rglfw module # Use external GLFW library instead of rglfw module
# TODO: Review usage of examples on Linux. # TODO: Review usage of examples on Linux.
@ -77,12 +86,6 @@ USE_EXTERNAL_GLFW ?= FALSE
# by default it uses X11 windowing system # by default it uses X11 windowing system
USE_WAYLAND_DISPLAY ?= FALSE USE_WAYLAND_DISPLAY ?= FALSE
# See below for more GRAPHICS options.
# See below for RAYLIB_RELEASE_PATH.
# See install target for *_INSTALL_PATH locations.
# Use cross-compiler for PLATFORM_RPI # Use cross-compiler for PLATFORM_RPI
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
USE_RPI_CROSS_COMPILER ?= FALSE USE_RPI_CROSS_COMPILER ?= FALSE
@ -135,13 +138,13 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
endif endif
# RAYLIB_PATH adjustment for different platforms. # 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? # 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. # Required for ldconfig or other tools that do not perform path expansion.
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_PREFIX ?= .. RAYLIB_PREFIX ?= ..
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX)) RAYLIB_SRC_PATH = $(realpath $(RAYLIB_PREFIX))
endif endif
endif endif
@ -150,32 +153,35 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
EMSDK_PATH ?= C:/emsdk EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
CLANG_PATH = $(EMSDK_PATH)/upstream/bin CLANG_PATH = $(EMSDK_PATH)/upstream/bin
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4_64bit PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4-pywin32_64bit
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin NODE_PATH = $(EMSDK_PATH)/node/12.18.1_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);C:\raylib\MinGW\bin:$$(PATH)
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android architecture: ARM64 # Android architecture
# Starting at 2019 using ARM64 is mandatory for published apps, # Starting at 2019 using arm64 is mandatory for published apps,
# and minimum required target API is Android 9 (API level 28) # and minimum required target API is Android 9 (API level 28)
ANDROID_ARCH ?= ARM ANDROID_ARCH ?= arm
ANDROID_API_VERSION = 28 ANDROID_API_VERSION ?= 28
# Android required path variables # Android required path variables
# NOTE: Starting with Android NDK r21, no more toolchain generation is required, NDK is the toolchain on itself # NOTE: Starting with Android NDK r21, no more toolchain generation is required, NDK is the toolchain on itself
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
ANDROID_NDK = C:/android-ndk-r21 ANDROID_NDK ?= C:/android-ndk
ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64 ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64
else else
ANDROID_NDK ?= /usr/lib/android/ndk ANDROID_NDK ?= /usr/lib/android/ndk
ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64 ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64
endif endif
ifeq ($(ANDROID_ARCH),ARM) # NOTE: Sysroot can also be reference from $(ANDROID_NDK)/sysroot
ANDROID_SYSROOT ?= $(ANDROID_TOOLCHAIN)/sysroot
ifeq ($(ANDROID_ARCH),arm)
ANDROID_ARCH_NAME = armeabi-v7a ANDROID_ARCH_NAME = armeabi-v7a
endif endif
ifeq ($(ANDROID_ARCH),ARM64) ifeq ($(ANDROID_ARCH),arm64)
ANDROID_ARCH_NAME = arm64-v8a ANDROID_ARCH_NAME = arm64-v8a
endif endif
ifeq ($(ANDROID_ARCH),x86) ifeq ($(ANDROID_ARCH),x86)
@ -184,15 +190,9 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),x86_64) ifeq ($(ANDROID_ARCH),x86_64)
ANDROID_ARCH_NAME = x86_64 ANDROID_ARCH_NAME = x86_64
endif endif
endif endif
# Define raylib source code path
RAYLIB_SRC_PATH ?= $(RAYLIB_PATH)/src
# Define output directory for compiled library, defaults to src directory
# NOTE: If externally provided, make sure directory exists
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
# Define raylib graphics api depending on selected platform # Define raylib graphics api depending on selected platform
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# By default use OpenGL 3.3 on desktop platforms # By default use OpenGL 3.3 on desktop platforms
@ -225,7 +225,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
GLFW_CFLAGS = -x objective-c GLFW_OSX = -x objective-c
endif endif
ifeq ($(PLATFORM_OS),BSD) ifeq ($(PLATFORM_OS),BSD)
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler # FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
@ -246,11 +246,11 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android toolchain (must be provided for desired architecture and compiler) # Android toolchain (must be provided for desired architecture and compiler)
ifeq ($(ANDROID_ARCH),ARM) ifeq ($(ANDROID_ARCH),arm)
CC = $(ANDROID_TOOLCHAIN)/bin/armv7a-linux-androideabi$(ANDROID_API_VERSION)-clang CC = $(ANDROID_TOOLCHAIN)/bin/armv7a-linux-androideabi$(ANDROID_API_VERSION)-clang
AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar
endif endif
ifeq ($(ANDROID_ARCH),ARM64) ifeq ($(ANDROID_ARCH),arm64)
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android$(ANDROID_API_VERSION)-clang CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android$(ANDROID_API_VERSION)-clang
AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar
endif endif
@ -264,7 +264,6 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
endif endif
endif endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -g include debug information on compilation # -g include debug information on compilation
@ -330,10 +329,10 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Compiler flags for arquitecture # Compiler flags for arquitecture
ifeq ($(ANDROID_ARCH),ARM) ifeq ($(ANDROID_ARCH),arm)
CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
endif endif
ifeq ($(ANDROID_ARCH),ARM64) ifeq ($(ANDROID_ARCH),arm64)
CFLAGS += -target aarch64 -mfix-cortex-a53-835769 CFLAGS += -target aarch64 -mfix-cortex-a53-835769
endif endif
ifeq ($(ANDROID_ARCH), x86) ifeq ($(ANDROID_ARCH), x86)
@ -400,15 +399,28 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue
# Android required libraries
INCLUDE_PATHS += -I$(ANDROID_TOOLCHAIN)/sysroot/usr/include
# Include android_native_app_glue.h # Include android_native_app_glue.h
INCLUDE_PATHS += -I$(NATIVE_APP_GLUE) INCLUDE_PATHS += -I$(NATIVE_APP_GLUE)
# Android required libraries
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include
ifeq ($(ANDROID_ARCH),arm)
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/arm-linux-androideabi
endif
ifeq ($(ANDROID_ARCH),arm64)
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/aarch64-linux-android
endif
ifeq ($(ANDROID_ARCH),x86)
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/i686-linux-android
endif
ifeq ($(ANDROID_ARCH),x86_64)
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/x86_64-linux-android
endif
endif endif
# Define linker options # Define linker options
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
LDFLAGS = -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a 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 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 # Force linking of library module to define symbol
LDFLAGS += -u ANativeActivity_onCreate LDFLAGS += -u ANativeActivity_onCreate
@ -417,7 +429,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Avoid unresolved symbol pointing to external main() # Avoid unresolved symbol pointing to external main()
LDFLAGS += -Wl,-undefined,dynamic_lookup LDFLAGS += -Wl,-undefined,dynamic_lookup
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm LDLIBS += -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
endif endif
# Define all object files required with a wildcard # Define all object files required with a wildcard
@ -452,7 +464,7 @@ ifeq ($(RAYLIB_MODULE_PHYSAC),TRUE)
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
OBJS += $(NATIVE_APP_GLUE)/android_native_app_glue.o OBJS += android_native_app_glue.o
endif endif
# Default target entry # Default target entry
@ -463,61 +475,61 @@ all: raylib
raylib: $(OBJS) raylib: $(OBJS)
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Compile raylib for web. # Compile raylib for web.
$(CC) -O1 $(OBJS) -o $(RAYLIB_RELEASE_PATH)/libraylib.bc $(CC) -O1 $(OBJS) -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc
@echo "raylib library generated (libraylib.bc)!" @echo "raylib library generated (lib$(RAYLIB_LIB_NAME).bc)!"
else else
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# TODO: Compile resource file raylib.dll.rc for linkage on raylib.dll generation # NOTE: Linking with provided resource file
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(RAYLIB_RELEASE_PATH)/raylib.dll.rc.data -L$(RAYLIB_RELEASE_PATH) -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylib.dll.a $(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
@echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" @echo "raylib dynamic library ($(RAYLIB_LIB_NAME).dll) and import library (lib$(RAYLIB_LIB_NAME)dll.a) generated!"
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Compile raylib shared library version $(RAYLIB_VERSION). # Compile raylib shared library version $(RAYLIB_VERSION).
# WARNING: you should type "make clean" before doing this target # WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(OBJS) -Wl,-soname,libraylib.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) -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -lGL -lc -lm -lpthread -ldl -lrt $(LDLIBS)
@echo "raylib shared library generated (libraylib.so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!"
cd $(RAYLIB_RELEASE_PATH) && ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) 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 libraylib.so.$(RAYLIB_API_VERSION) libraylib.so cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
$(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).dylib $(OBJS) -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) -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
install_name_tool -id "libraylib.$(VERSION).dylib" $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).dylib install_name_tool -id "lib$(RAYLIB_LIB_NAME).$(VERSION).dylib" $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib
@echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).dylib)!" @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib)!"
cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).dylib libraylib.$(RAYLIB_API_VERSION).dylib cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib
cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).dylib libraylib.dylib cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).dylib
endif endif
ifeq ($(PLATFORM_OS),BSD) ifeq ($(PLATFORM_OS),BSD)
# WARNING: you should type "gmake clean" before doing this target # WARNING: you should type "gmake clean" before doing this target
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -lGL -lpthread $(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
@echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!"
cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_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 libraylib.$(RAYLIB_VERSION).so libraylib.so cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# Compile raylib shared library version $(RAYLIB_VERSION). # Compile raylib shared library version $(RAYLIB_VERSION).
# WARNING: you should type "make clean" before doing this target # WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(OBJS) -Wl,-soname,libraylib.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) -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -L/opt/vc/lib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
@echo "raylib shared library generated (libraylib.so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!"
cd $(RAYLIB_RELEASE_PATH) && ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) 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 libraylib.so.$(RAYLIB_API_VERSION) libraylib.so cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
@echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!"
# WARNING: symbolic links creation on Windows should be done using mklink command, no ln available # WARNING: symbolic links creation on Windows should be done using mklink command, no ln available
ifeq ($(HOST_PLATFORM_OS),LINUX) ifeq ($(HOST_PLATFORM_OS),LINUX)
cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_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 libraylib.$(RAYLIB_VERSION).so libraylib.so cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so
endif endif
endif endif
else else
# Compile raylib static library version $(RAYLIB_VERSION) # Compile raylib static library version $(RAYLIB_VERSION)
# WARNING: You should type "make clean" before doing this target. # WARNING: You should type "make clean" before doing this target.
$(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) $(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
@echo "raylib static library generated (libraylib.a) in $(RAYLIB_RELEASE_PATH)!" @echo "raylib static library generated (lib$(RAYLIB_LIB_NAME).a) in $(RAYLIB_RELEASE_PATH)!"
endif endif
endif endif
@ -529,7 +541,7 @@ core.o : core.c raylib.h rlgl.h utils.h raymath.h camera.h gestures.h
# Compile rglfw module # Compile rglfw module
rglfw.o : rglfw.c rglfw.o : rglfw.c
$(CC) $(CFLAGS) $(GLFW_CFLAGS) -c $< $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) $(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# Compile shapes module # Compile shapes module
shapes.o : shapes.c raylib.h rlgl.h shapes.o : shapes.c raylib.h rlgl.h
@ -570,6 +582,10 @@ physac.o : physac.c physac.h
@echo #include "$(RAYLIB_MODULE_PHYSAC_PATH)/physac.h" > physac.c @echo #include "$(RAYLIB_MODULE_PHYSAC_PATH)/physac.h" > physac.c
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -DPHYSAC_IMPLEMENTATION $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -DPHYSAC_IMPLEMENTATION
# Compile android_native_app_glue module
android_native_app_glue.o : $(NATIVE_APP_GLUE)/android_native_app_glue.c
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
# Install generated and needed files to desired directories. # Install generated and needed files to desired directories.
# On GNU/Linux and BSDs, there are some standard directories that contain extra # On GNU/Linux and BSDs, there are some standard directories that contain extra
@ -599,15 +615,15 @@ ifeq ($(ROOT),root)
mkdir --parents --verbose $(RAYLIB_H_INSTALL_PATH) mkdir --parents --verbose $(RAYLIB_H_INSTALL_PATH)
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
# Installing raylib to $(RAYLIB_INSTALL_PATH). # Installing raylib to $(RAYLIB_INSTALL_PATH).
cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(RAYLIB_INSTALL_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)
cd $(RAYLIB_INSTALL_PATH); ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) cd $(RAYLIB_INSTALL_PATH); ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
cd $(RAYLIB_INSTALL_PATH); ln -fsv libraylib.so.$(RAYLIB_API_VERSION) libraylib.so cd $(RAYLIB_INSTALL_PATH); ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
# Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH. # Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH.
# Not necessary if later embedding RPATH in your executable. See examples/Makefile. # Not necessary if later embedding RPATH in your executable. See examples/Makefile.
ldconfig $(RAYLIB_INSTALL_PATH) ldconfig $(RAYLIB_INSTALL_PATH)
else else
# Installing raylib to $(RAYLIB_INSTALL_PATH). # Installing raylib to $(RAYLIB_INSTALL_PATH).
cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_INSTALL_PATH)/libraylib.a cp --update --verbose $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_INSTALL_PATH)/lib$(RAYLIB_LIB_NAME).a
endif endif
# Copying raylib development files to $(RAYLIB_H_INSTALL_PATH). # Copying raylib development files to $(RAYLIB_H_INSTALL_PATH).
cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h
@ -653,9 +669,13 @@ endif
# Clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so del *.o /s
cd $(RAYLIB_RELEASE_PATH)
del lib$(RAYLIB_LIB_NAME).a /s
del lib$(RAYLIB_LIB_NAME)dll.a /s
del $(RAYLIB_LIB_NAME).dll /s
else else
rm -fv *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so* rm -fv *.o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so*
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
rm -rf $(ANDROID_TOOLCHAIN) $(NATIVE_APP_GLUE)/android_native_app_glue.o rm -rf $(ANDROID_TOOLCHAIN) $(NATIVE_APP_GLUE)/android_native_app_glue.o

View File

@ -25,7 +25,7 @@
* *
**********************************************************************************************/ **********************************************************************************************/
#define RAYLIB_VERSION "3.0" #define RAYLIB_VERSION "3.1-dev"
// Edit to control what features Makefile'd raylib is compiled with // Edit to control what features Makefile'd raylib is compiled with
#if defined(RAYLIB_CMAKE) #if defined(RAYLIB_CMAKE)
@ -63,12 +63,56 @@
// Support saving binary data automatically to a generated storage.data file. This file is managed internally. // Support saving binary data automatically to a generated storage.data file. This file is managed internally.
#define SUPPORT_DATA_STORAGE 1 #define SUPPORT_DATA_STORAGE 1
// core: Configuration values
//------------------------------------------------------------------------------------
#if defined(__linux__)
#define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value)
#else
#define MAX_FILEPATH_LENGTH 512 // Maximum length supported for filepaths
#endif
#define MAX_GAMEPADS 4 // Max number of gamepads supported
#define MAX_GAMEPAD_AXIS 8 // Max number of axis supported (per gamepad)
#define MAX_GAMEPAD_BUTTONS 32 // Max bumber of buttons supported (per gamepad)
#define MAX_TOUCH_POINTS 10 // Maximum number of touch points supported
#define MAX_KEY_PRESSED_QUEUE 16 // Max number of characters in the key input queue
#define STORAGE_DATA_FILE "storage.data" // Automatic storage filename
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: rlgl - Configuration Flags // Module: rlgl - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Support VR simulation functionality (stereo rendering) // Support VR simulation functionality (stereo rendering)
#define SUPPORT_VR_SIMULATOR 1 #define SUPPORT_VR_SIMULATOR 1
// rlgl: Configuration values
//------------------------------------------------------------------------------------
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
#define DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch limits
#elif defined(GRAPHICS_API_OPENGL_ES2)
#define DEFAULT_BATCH_BUFFER_ELEMENTS 2048 // Default internal render batch limits
#endif
#define DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
#define DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
#define MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
#define MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
#define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance
#define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
// Default shader vertex attribute names to set location points
#define DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Binded by default to shader location: 0
#define DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Binded by default to shader location: 1
#define DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Binded by default to shader location: 2
#define DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Binded by default to shader location: 3
#define DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Binded by default to shader location: 4
#define DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Binded by default to shader location: 5
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: shapes - Configuration Flags // Module: shapes - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -79,6 +123,7 @@
// Some lines-based shapes could still use lines // Some lines-based shapes could still use lines
#define SUPPORT_QUADS_DRAW_MODE 1 #define SUPPORT_QUADS_DRAW_MODE 1
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: textures - Configuration Flags // Module: textures - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -98,13 +143,13 @@
// Support image export functionality (.png, .bmp, .tga, .jpg) // Support image export functionality (.png, .bmp, .tga, .jpg)
#define SUPPORT_IMAGE_EXPORT 1 #define SUPPORT_IMAGE_EXPORT 1
// Support procedural image generation functionality (gradient, spot, perlin-noise, cellular) // Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)
#define SUPPORT_IMAGE_GENERATION 1 #define SUPPORT_IMAGE_GENERATION 1
// Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... // Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop...
// If not defined, still some functions are supported: ImageFormat(), ImageCrop(), ImageToPOT() // If not defined, still some functions are supported: ImageFormat(), ImageCrop(), ImageToPOT()
#define SUPPORT_IMAGE_MANIPULATION 1 #define SUPPORT_IMAGE_MANIPULATION 1
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: text - Configuration Flags // Module: text - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -119,6 +164,14 @@
// If not defined, still some functions are supported: TextLength(), TextFormat() // If not defined, still some functions are supported: TextLength(), TextFormat()
#define SUPPORT_TEXT_MANIPULATION 1 #define SUPPORT_TEXT_MANIPULATION 1
// text: Configuration values
//------------------------------------------------------------------------------------
#define MAX_TEXT_BUFFER_LENGTH 1024 // Size of internal static buffers used on some functions:
// TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit()
#define MAX_TEXT_UNICODE_CHARS 512 // Maximum number of unicode codepoints: GetCodepoints()
#define MAX_TEXTSPLIT_COUNT 128 // Maximum number of substrings to split: TextSplit()
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: models - Configuration Flags // Module: models - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -131,6 +184,7 @@
// NOTE: Some generated meshes DO NOT include generated texture coordinates // NOTE: Some generated meshes DO NOT include generated texture coordinates
#define SUPPORT_MESH_GENERATION 1 #define SUPPORT_MESH_GENERATION 1
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: audio - Configuration Flags // Module: audio - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -142,6 +196,15 @@
//#define SUPPORT_FILEFORMAT_FLAC 1 //#define SUPPORT_FILEFORMAT_FLAC 1
#define SUPPORT_FILEFORMAT_MP3 1 #define SUPPORT_FILEFORMAT_MP3 1
// audio: Configuration values
//------------------------------------------------------------------------------------
#define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit)
#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
#define AUDIO_DEVICE_SAMPLE_RATE 44100 // Device output sample rate
#define DEFAULT_AUDIO_BUFFER_SIZE 4096 // Default audio buffer size for streaming
#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module: utils - Configuration Flags // Module: utils - Configuration Flags
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -150,4 +213,10 @@
#define SUPPORT_TRACELOG 1 #define SUPPORT_TRACELOG 1
//#define SUPPORT_TRACELOG_DEBUG 1 //#define SUPPORT_TRACELOG_DEBUG 1
// utils: Configuration values
//------------------------------------------------------------------------------------
#define MAX_TRACELOG_MSG_LENGTH 128 // Max length of one trace-log message
#define MAX_UWP_MESSAGES 512 // Max UWP messages to process
#endif //defined(RAYLIB_CMAKE) #endif //defined(RAYLIB_CMAKE)

View File

@ -126,7 +126,7 @@
#if !defined(EXTERNAL_CONFIG_FLAGS) #if !defined(EXTERNAL_CONFIG_FLAGS)
#include "config.h" // Defines module configuration flags #include "config.h" // Defines module configuration flags
#else #else
#define RAYLIB_VERSION "3.0" #define RAYLIB_VERSION "3.1-dev"
#endif #endif
#include "utils.h" // Required for: TRACELOG macros #include "utils.h" // Required for: TRACELOG macros
@ -282,15 +282,8 @@
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM) #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
#define USE_LAST_TOUCH_DEVICE // When multiple touchscreens are connected, only use the one with the highest event<N> number #define USE_LAST_TOUCH_DEVICE // When multiple touchscreens are connected, only use the one with the highest event<N> number
// Old device inputs system
#define DEFAULT_KEYBOARD_DEV STDIN_FILENO // Standard input
#define DEFAULT_GAMEPAD_DEV "/dev/input/js" // Gamepad input (base dev for all gamepads: js0, js1, ...) #define DEFAULT_GAMEPAD_DEV "/dev/input/js" // Gamepad input (base dev for all gamepads: js0, js1, ...)
#define DEFAULT_EVDEV_PATH "/dev/input/" // Path to the linux input events #define DEFAULT_EVDEV_PATH "/dev/input/" // Path to the linux input events
// New device input events (evdev) (must be detected)
//#define DEFAULT_KEYBOARD_DEV "/dev/input/eventN"
//#define DEFAULT_MOUSE_DEV "/dev/input/eventN"
//#define DEFAULT_GAMEPAD_DEV "/dev/input/eventN"
#endif #endif
#if defined(PLATFORM_DRM) #if defined(PLATFORM_DRM)
@ -389,6 +382,7 @@ typedef struct CoreData {
const char *title; // Window text title const pointer const char *title; // Window text title const pointer
bool ready; // Flag to check if window has been initialized successfully bool ready; // Flag to check if window has been initialized successfully
bool minimized; // Flag to check if window has been minimized bool minimized; // Flag to check if window has been minimized
bool maximized; // Flag to check if window has been maximized
bool focused; // Flag to check if window has been focused bool focused; // Flag to check if window has been focused
bool resized; // Flag to check if window has been resized bool resized; // Flag to check if window has been resized
bool fullscreen; // Flag to check if fullscreen mode required bool fullscreen; // Flag to check if fullscreen mode required
@ -445,9 +439,7 @@ typedef struct CoreData {
bool cursorHidden; // Track if cursor is hidden bool cursorHidden; // Track if cursor is hidden
bool cursorOnScreen; // Tracks if cursor is inside client area bool cursorOnScreen; // Tracks if cursor is inside client area
#if defined(PLATFORM_WEB)
bool cursorLockRequired; // Ask for cursor pointer lock on next click
#endif
char currentButtonState[3]; // Registers current mouse button state char currentButtonState[3]; // Registers current mouse button state
char previousButtonState[3]; // Registers previous mouse button state char previousButtonState[3]; // Registers previous mouse button state
int currentWheelMove; // Registers current mouse wheel variation int currentWheelMove; // Registers current mouse wheel variation
@ -542,6 +534,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height);
static void WindowIconifyCallback(GLFWwindow *window, int iconified); // GLFW3 WindowIconify Callback, runs when window is minimized/restored static void WindowIconifyCallback(GLFWwindow *window, int iconified); // GLFW3 WindowIconify Callback, runs when window is minimized/restored
static void WindowFocusCallback(GLFWwindow *window, int focused); // GLFW3 WindowFocus Callback, runs when window get/lose focus static void WindowFocusCallback(GLFWwindow *window, int focused); // GLFW3 WindowFocus Callback, runs when window get/lose focus
static void WindowDropCallback(GLFWwindow *window, int count, const char **paths); // GLFW3 Window Drop Callback, runs when drop files into window static void WindowDropCallback(GLFWwindow *window, int count, const char **paths); // GLFW3 Window Drop Callback, runs when drop files into window
static void WindowMaximizeCallback(GLFWwindow *window, int maximized); // GLFW3 Window Maximize Callback, runs when window is maximized
#endif #endif
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
@ -663,7 +656,7 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION); TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION);
CORE.Window.title = title; if ((title != NULL) && (title[0] != 0)) CORE.Window.title = title;
// Initialize required global values different than 0 // Initialize required global values different than 0
CORE.Input.Keyboard.exitKey = KEY_ESCAPE; CORE.Input.Keyboard.exitKey = KEY_ESCAPE;
@ -893,6 +886,9 @@ bool WindowShouldClose(void)
CORE.Window.shouldClose = glfwWindowShouldClose(CORE.Window.handle); CORE.Window.shouldClose = glfwWindowShouldClose(CORE.Window.handle);
// Reset close status for next frame
glfwSetWindowShouldClose(CORE.Window.handle, GLFW_FALSE);
return CORE.Window.shouldClose; return CORE.Window.shouldClose;
} }
else return true; else return true;
@ -914,6 +910,16 @@ bool IsWindowMinimized(void)
#endif #endif
} }
// Check if window has been maximized (only PLATFORM_DESKTOP)
bool IsWindowMaximized(void)
{
#if defined(PLATFORM_DESKTOP)
return CORE.Window.maximized;
#else
return false;
#endif
}
// Check if window has the focus // Check if window has the focus
bool IsWindowFocused(void) bool IsWindowFocused(void)
{ {
@ -1115,6 +1121,44 @@ void HideWindow(void)
#endif #endif
} }
// Decorate the window (only PLATFORM_DESKTOP)
void DecorateWindow(void)
{
#if defined(PLATFORM_DESKTOP)
glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_TRUE);
#endif
}
// // Undecorate the window (only PLATFORM_DESKTOP)
void UndecorateWindow(void)
{
#if defined(PLATFORM_DESKTOP)
glfwSetWindowAttrib(CORE.Window.handle, GLFW_DECORATED, GLFW_FALSE);
#endif
}
// Maximize the window, if resizable (only PLATFORM_DESKTOP)
void MaximizeWindow(void)
{
#if defined(PLATFORM_DESKTOP)
if (glfwGetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE) == GLFW_TRUE)
{
glfwMaximizeWindow(CORE.Window.handle);
}
#endif
}
// Restore the window, if resizable (only PLATFORM_DESKTOP)
void RestoreWindow(void)
{
#if defined(PLATFORM_DESKTOP)
if (glfwGetWindowAttrib(CORE.Window.handle, GLFW_RESIZABLE) == GLFW_TRUE)
{
glfwRestoreWindow(CORE.Window.handle);
}
#endif
}
// Get current screen width // Get current screen width
int GetScreenWidth(void) int GetScreenWidth(void)
{ {
@ -1342,9 +1386,6 @@ void EnableCursor(void)
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL); glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
#endif #endif
#if defined(PLATFORM_WEB)
CORE.Input.Mouse.cursorLockRequired = true;
#endif
#if defined(PLATFORM_UWP) #if defined(PLATFORM_UWP)
UWPGetMouseUnlockFunc()(); UWPGetMouseUnlockFunc()();
#endif #endif
@ -1357,9 +1398,6 @@ void DisableCursor(void)
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
#endif #endif
#if defined(PLATFORM_WEB)
CORE.Input.Mouse.cursorLockRequired = true;
#endif
#if defined(PLATFORM_UWP) #if defined(PLATFORM_UWP)
UWPGetMouseLockFunc()(); UWPGetMouseLockFunc()();
#endif #endif
@ -1492,7 +1530,7 @@ void BeginMode3D(Camera3D camera)
if (camera.type == CAMERA_PERSPECTIVE) if (camera.type == CAMERA_PERSPECTIVE)
{ {
// Setup perspective projection // Setup perspective projection
double top = 0.01*tan(camera.fovy*0.5*DEG2RAD); double top = RL_CULL_DISTANCE_NEAR*tan(camera.fovy*0.5*DEG2RAD);
double right = top*aspect; double right = top*aspect;
rlFrustum(-right, right, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); rlFrustum(-right, right, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
@ -1629,13 +1667,13 @@ Ray GetMouseRay(Vector2 mouse, Camera camera)
} }
// Unproject far/near points // Unproject far/near points
Vector3 nearPoint = rlUnproject((Vector3){ deviceCoords.x, deviceCoords.y, 0.0f }, matProj, matView); Vector3 nearPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 0.0f }, matProj, matView);
Vector3 farPoint = rlUnproject((Vector3){ deviceCoords.x, deviceCoords.y, 1.0f }, matProj, matView); Vector3 farPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 1.0f }, matProj, matView);
// Unproject the mouse cursor in the near plane. // Unproject the mouse cursor in the near plane.
// We need this as the source position because orthographic projects, compared to perspect doesn't have a // We need this as the source position because orthographic projects, compared to perspect doesn't have a
// convergence point, meaning that the "eye" of the camera is more like a plane than a point. // convergence point, meaning that the "eye" of the camera is more like a plane than a point.
Vector3 cameraPlanePointerPos = rlUnproject((Vector3){ deviceCoords.x, deviceCoords.y, -1.0f }, matProj, matView); Vector3 cameraPlanePointerPos = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, -1.0f }, matProj, matView);
// Calculate normalized direction vector // Calculate normalized direction vector
Vector3 direction = Vector3Normalize(Vector3Subtract(farPoint, nearPoint)); Vector3 direction = Vector3Normalize(Vector3Subtract(farPoint, nearPoint));
@ -2872,7 +2910,7 @@ static bool InitGraphicsDevice(int width, int height)
// HighDPI monitors are properly considered in a following similar function: SetupViewport() // HighDPI monitors are properly considered in a following similar function: SetupViewport()
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height); SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
CORE.Window.handle = glfwCreateWindow(CORE.Window.display.width, CORE.Window.display.height, CORE.Window.title, glfwGetPrimaryMonitor(), NULL); CORE.Window.handle = glfwCreateWindow(CORE.Window.display.width, CORE.Window.display.height, (CORE.Window.title != 0)? CORE.Window.title : " ", glfwGetPrimaryMonitor(), NULL);
// NOTE: Full-screen change, not working properly... // NOTE: Full-screen change, not working properly...
//glfwSetWindowMonitor(CORE.Window.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); //glfwSetWindowMonitor(CORE.Window.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
@ -2880,7 +2918,7 @@ static bool InitGraphicsDevice(int width, int height)
else else
{ {
// No-fullscreen window creation // No-fullscreen window creation
CORE.Window.handle = glfwCreateWindow(CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.title, NULL, NULL); CORE.Window.handle = glfwCreateWindow(CORE.Window.screen.width, CORE.Window.screen.height, (CORE.Window.title != 0)? CORE.Window.title : " ", NULL, NULL);
if (CORE.Window.handle) if (CORE.Window.handle)
{ {
@ -2926,6 +2964,7 @@ static bool InitGraphicsDevice(int width, int height)
glfwSetWindowIconifyCallback(CORE.Window.handle, WindowIconifyCallback); glfwSetWindowIconifyCallback(CORE.Window.handle, WindowIconifyCallback);
glfwSetWindowFocusCallback(CORE.Window.handle, WindowFocusCallback); glfwSetWindowFocusCallback(CORE.Window.handle, WindowFocusCallback);
glfwSetDropCallback(CORE.Window.handle, WindowDropCallback); glfwSetDropCallback(CORE.Window.handle, WindowDropCallback);
glfwSetWindowMaximizeCallback(CORE.Window.handle, WindowMaximizeCallback);
glfwMakeContextCurrent(CORE.Window.handle); glfwMakeContextCurrent(CORE.Window.handle);
@ -3218,6 +3257,10 @@ static bool InitGraphicsDevice(int width, int height)
// Get display size // Get display size
UWPGetDisplaySizeFunc()(&CORE.Window.display.width, &CORE.Window.display.height); UWPGetDisplaySizeFunc()(&CORE.Window.display.width, &CORE.Window.display.height);
// Use the width and height of the surface for render
CORE.Window.render.width = CORE.Window.screen.width;
CORE.Window.render.height = CORE.Window.screen.height;
#endif // PLATFORM_UWP #endif // PLATFORM_UWP
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM) #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
@ -3305,7 +3348,10 @@ static bool InitGraphicsDevice(int width, int height)
eglGetConfigAttrib(CORE.Window.device, CORE.Window.config, EGL_NATIVE_VISUAL_ID, &displayFormat); eglGetConfigAttrib(CORE.Window.device, CORE.Window.config, EGL_NATIVE_VISUAL_ID, &displayFormat);
// At this point we need to manage render size vs screen size // At this point we need to manage render size vs screen size
// NOTE: This function use and modify global module variables: CORE.Window.screen.width/CORE.Window.screen.height and CORE.Window.render.width/CORE.Window.render.height and CORE.Window.screenScale // NOTE: This function use and modify global module variables:
// -> CORE.Window.screen.width/CORE.Window.screen.height
// -> CORE.Window.render.width/CORE.Window.render.height
// -> CORE.Window.screenScale
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height); SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
ANativeWindow_setBuffersGeometry(CORE.Android.app->window, CORE.Window.render.width, CORE.Window.render.height, displayFormat); ANativeWindow_setBuffersGeometry(CORE.Android.app->window, CORE.Window.render.width, CORE.Window.render.height, displayFormat);
@ -3322,7 +3368,10 @@ static bool InitGraphicsDevice(int width, int height)
if (CORE.Window.screen.height <= 0) CORE.Window.screen.height = CORE.Window.display.height; if (CORE.Window.screen.height <= 0) CORE.Window.screen.height = CORE.Window.display.height;
// At this point we need to manage render size vs screen size // At this point we need to manage render size vs screen size
// NOTE: This function use and modify global module variables: CORE.Window.screen.width/CORE.Window.screen.height and CORE.Window.render.width/CORE.Window.render.height and CORE.Window.screenScale // NOTE: This function use and modify global module variables:
// -> CORE.Window.screen.width/CORE.Window.screen.height
// -> CORE.Window.render.width/CORE.Window.render.height
// -> CORE.Window.screenScale
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height); SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
dstRect.x = 0; dstRect.x = 0;
@ -3394,22 +3443,13 @@ static bool InitGraphicsDevice(int width, int height)
} }
else else
{ {
// Grab the width and height of the surface
#if defined(PLATFORM_UWP)
CORE.Window.render.width = CORE.Window.screen.width;
CORE.Window.render.height = CORE.Window.screen.height;
#else
CORE.Window.render.width = CORE.Window.display.width;
CORE.Window.render.height = CORE.Window.display.height;
#endif
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully"); TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height); TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height); TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height); TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y); TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
} }
#endif // PLATFORM_ANDROID || PLATFORM_RPI #endif // PLATFORM_ANDROID || PLATFORM_RPI || defined(PLATFORM_UWP)
// Initialize OpenGL context (states and resources) // Initialize OpenGL context (states and resources)
// NOTE: CORE.Window.screen.width and CORE.Window.screen.height not used, just stored as globals in rlgl // NOTE: CORE.Window.screen.width and CORE.Window.screen.height not used, just stored as globals in rlgl
@ -4124,6 +4164,12 @@ static void WindowDropCallback(GLFWwindow *window, int count, const char **paths
CORE.Window.dropFilesCount = count; CORE.Window.dropFilesCount = count;
} }
static void WindowMaximizeCallback(GLFWwindow *window, int maximized)
{
if (maximized) CORE.Window.maximized = true; // The window was maximized
else CORE.Window.maximized = false; // The window was restored
}
#endif #endif
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
@ -4409,20 +4455,19 @@ static EM_BOOL EmscriptenKeyboardCallback(int eventType, const EmscriptenKeyboar
static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
{ {
// Lock mouse pointer when click on screen // Lock mouse pointer when click on screen
if ((eventType == EMSCRIPTEN_EVENT_CLICK) && CORE.Input.Mouse.cursorLockRequired) if (eventType == EMSCRIPTEN_EVENT_CLICK)
{ {
EmscriptenPointerlockChangeEvent plce; EmscriptenPointerlockChangeEvent plce;
emscripten_get_pointerlock_status(&plce); emscripten_get_pointerlock_status(&plce);
if (!plce.isActive) emscripten_request_pointerlock(0, 1); int result = emscripten_request_pointerlock("#canvas", 1); // TODO: It does not work!
else
{
emscripten_exit_pointerlock();
emscripten_get_pointerlock_status(&plce);
//if (plce.isActive) TRACELOG(LOG_WARNING, "Pointer lock exit did not work!");
}
CORE.Input.Mouse.cursorLockRequired = false; // result -> EMSCRIPTEN_RESULT_DEFERRED
// The requested operation cannot be completed now for web security reasons,
// and has been deferred for completion in the next event handler. --> but it never happens!
//if (!plce.isActive) emscripten_request_pointerlock(0, 1);
//else emscripten_exit_pointerlock();
} }
return 0; return 0;
@ -4682,7 +4727,7 @@ static void ProcessKeyboard(void)
// Check screen capture key (raylib key: KEY_F12) // Check screen capture key (raylib key: KEY_F12)
if (CORE.Input.Keyboard.currentKeyState[301] == 1) if (CORE.Input.Keyboard.currentKeyState[301] == 1)
{ {
TakeScreenshot(FormatText("screenshot%03i.png", screenshotCounter)); TakeScreenshot(TextFormat("screenshot%03i.png", screenshotCounter));
screenshotCounter++; screenshotCounter++;
} }
#endif #endif
@ -5086,7 +5131,7 @@ static void *EventThread(void *arg)
// Check screen capture key (raylib key: KEY_F12) // Check screen capture key (raylib key: KEY_F12)
if (CORE.Input.Keyboard.currentKeyState[301] == 1) if (CORE.Input.Keyboard.currentKeyState[301] == 1)
{ {
TakeScreenshot(FormatText("screenshot%03i.png", screenshotCounter)); TakeScreenshot(TextFormat("screenshot%03i.png", screenshotCounter));
screenshotCounter++; screenshotCounter++;
} }
#endif #endif

36224
src/external/miniaudio.h vendored

File diff suppressed because it is too large Load Diff

View File

@ -2473,6 +2473,73 @@ void MeshBinormals(Mesh *mesh)
} }
} }
// Smooth (average) vertex normals
void MeshNormalsSmooth(Mesh *mesh)
{
#define EPSILON 0.000001 // A small number
int uvCounter = 0;
Vector3 *uniqueVertices = (Vector3 *)RL_CALLOC(mesh->vertexCount, sizeof(Vector3));
Vector3 *summedNormals = (Vector3 *)RL_CALLOC(mesh->vertexCount, sizeof(Vector3));
int *uniqueIndices = (int *)RL_CALLOC(mesh->vertexCount, sizeof(int));
// Sum normals grouped by vertex
for (int i = 0; i < mesh->vertexCount; i++)
{
Vector3 v = { mesh->vertices[(i + 0)*3 + 0], mesh->vertices[(i + 0)*3 + 1], mesh->vertices[(i + 0)*3 + 2] };
Vector3 n = { mesh->normals[(i + 0)*3 + 0], mesh->normals[(i + 0)*3 + 1], mesh->normals[(i + 0)*3 + 2] };
bool matched = false;
// TODO: Matching vertices is brute force O(N^2). Do it more efficiently?
for (int j = 0; j < uvCounter; j++)
{
Vector3 uv = uniqueVertices[j];
bool match = true;
match = match && fabs(uv.x - v.x) < EPSILON;
match = match && fabs(uv.y - v.y) < EPSILON;
match = match && fabs(uv.z - v.z) < EPSILON;
if (match)
{
matched = true;
summedNormals[j] = Vector3Add(summedNormals[j], n);
uniqueIndices[i] = j;
break;
}
}
if (!matched)
{
int j = uvCounter++;
uniqueVertices[j] = v;
summedNormals[j] = n;
uniqueIndices[i] = j;
}
}
// Average and update normals
for (int i = 0; i < mesh->vertexCount; i++)
{
int j = uniqueIndices[i];
Vector3 n = Vector3Normalize(summedNormals[j]);
mesh->normals[(i + 0)*3 + 0] = n.x;
mesh->normals[(i + 0)*3 + 1] = n.y;
mesh->normals[(i + 0)*3 + 2] = n.z;
}
// 2=normals, see rlUpdateMeshAt()
rlUpdateMesh(*mesh, 2, mesh->vertexCount);
RL_FREE(uniqueVertices);
RL_FREE(summedNormals);
RL_FREE(uniqueIndices);
TRACELOG(LOG_INFO, "MESH: Normals smoothed (%d vertices, %d unique)", mesh->vertexCount, uvCounter);
}
// Draw a model (with texture if set) // Draw a model (with texture if set)
void DrawModel(Model model, Vector3 position, float scale, Color tint) void DrawModel(Model model, Vector3 position, float scale, Color tint)
{ {
@ -2862,6 +2929,7 @@ RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
result.distance = distance; result.distance = distance;
result.normal = (Vector3){ 0.0, 1.0, 0.0 }; result.normal = (Vector3){ 0.0, 1.0, 0.0 };
result.position = Vector3Add(ray.position, Vector3Scale(ray.direction, distance)); result.position = Vector3Add(ray.position, Vector3Scale(ray.direction, distance));
result.position.y = groundHeight;
} }
} }
@ -3242,7 +3310,9 @@ static Model LoadIQM(const char *fileName)
for (unsigned int i = imesh[m].first_triangle; i < (imesh[m].first_triangle + imesh[m].num_triangles); i++) for (unsigned int i = imesh[m].first_triangle; i < (imesh[m].first_triangle + imesh[m].num_triangles); i++)
{ {
// IQM triangles are stored counter clockwise, but raylib sets opengl to clockwise drawing, so we swap them around // IQM triangles indexes are stored in counter-clockwise, but raylib processes the index in linear order,
// expecting they point to the counter-clockwise vertex triangle, so we need to reverse triangle indexes
// NOTE: raylib renders vertex data in counter-clockwise order (standard convention) by default
model.meshes[m].indices[tcounter + 2] = tri[i].vertex[0] - imesh[m].first_vertex; model.meshes[m].indices[tcounter + 2] = tri[i].vertex[0] - imesh[m].first_vertex;
model.meshes[m].indices[tcounter + 1] = tri[i].vertex[1] - imesh[m].first_vertex; model.meshes[m].indices[tcounter + 1] = tri[i].vertex[1] - imesh[m].first_vertex;
model.meshes[m].indices[tcounter] = tri[i].vertex[2] - imesh[m].first_vertex; model.meshes[m].indices[tcounter] = tri[i].vertex[2] - imesh[m].first_vertex;

View File

@ -159,6 +159,9 @@ typedef struct tagBITMAPINFOHEADER {
#define MA_FREE RL_FREE #define MA_FREE RL_FREE
#define MA_NO_JACK #define MA_NO_JACK
#define MA_NO_WAV
#define MA_NO_FLAC
#define MA_NO_MP3
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
#include "external/miniaudio.h" // miniaudio library #include "external/miniaudio.h" // miniaudio library
#undef PlaySound // Win32 API: windows.h > mmsystem.h defines PlaySound macro #undef PlaySound // Win32 API: windows.h > mmsystem.h defines PlaySound macro
@ -172,6 +175,20 @@ typedef struct tagBITMAPINFOHEADER {
#if !defined(TRACELOG) #if !defined(TRACELOG)
#define TRACELOG(level, ...) (void)0 #define TRACELOG(level, ...) (void)0
#endif #endif
// Allow custom memory allocators
#ifndef RL_MALLOC
#define RL_MALLOC(sz) malloc(sz)
#endif
#ifndef RL_CALLOC
#define RL_CALLOC(n,sz) calloc(n,sz)
#endif
#ifndef RL_REALLOC
#define RL_REALLOC(ptr,sz) realloc(ptr,sz)
#endif
#ifndef RL_FREE
#define RL_FREE(ptr) free(ptr)
#endif
#endif #endif
#if defined(SUPPORT_FILEFORMAT_OGG) #if defined(SUPPORT_FILEFORMAT_OGG)
@ -244,6 +261,10 @@ typedef struct tagBITMAPINFOHEADER {
#ifndef MAX_AUDIO_BUFFER_POOL_CHANNELS #ifndef MAX_AUDIO_BUFFER_POOL_CHANNELS
#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Audio pool channels #define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Audio pool channels
#endif #endif
#ifndef DEFAULT_AUDIO_BUFFER_SIZE
#define DEFAULT_AUDIO_BUFFER_SIZE 4096 // Default audio buffer size
#endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
@ -335,7 +356,7 @@ static AudioData AUDIO = { // Global AUDIO context
// After some math, considering a sampleRate of 48000, a buffer refill rate of 1/60 seconds and a // After some math, considering a sampleRate of 48000, a buffer refill rate of 1/60 seconds and a
// standard double-buffering system, a 4096 samples buffer has been chosen, it should be enough // standard double-buffering system, a 4096 samples buffer has been chosen, it should be enough
// In case of music-stalls, just increase this number // In case of music-stalls, just increase this number
.Buffer.defaultSize = 4096 .Buffer.defaultSize = DEFAULT_AUDIO_BUFFER_SIZE
}; };
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -364,6 +385,8 @@ static Wave LoadMP3(const char *fileName); // Load MP3 file
#if defined(RAUDIO_STANDALONE) #if defined(RAUDIO_STANDALONE)
static bool IsFileExtension(const char *fileName, const char *ext); // Check file extension static bool IsFileExtension(const char *fileName, const char *ext); // Check file extension
static unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read)
static void SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite); // Save data to file from byte array (write)
static void SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated static void SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated
#endif #endif
@ -437,7 +460,7 @@ void InitAudioDevice(void)
// Mixing happens on a seperate thread which means we need to synchronize. I'm using a mutex here to make things simple, but may // Mixing happens on a seperate thread which means we need to synchronize. I'm using a mutex here to make things simple, but may
// want to look at something a bit smarter later on to keep everything real-time, if that's necessary. // want to look at something a bit smarter later on to keep everything real-time, if that's necessary.
if (ma_mutex_init(&AUDIO.System.context, &AUDIO.System.lock) != MA_SUCCESS) if (ma_mutex_init(&AUDIO.System.lock) != MA_SUCCESS)
{ {
TRACELOG(LOG_ERROR, "AUDIO: Failed to create mutex for mixing"); TRACELOG(LOG_ERROR, "AUDIO: Failed to create mutex for mixing");
ma_device_uninit(&AUDIO.System.device); ma_device_uninit(&AUDIO.System.device);
@ -1071,7 +1094,10 @@ Music LoadMusicStream(const char *fileName)
music.ctxType = MUSIC_AUDIO_WAV; music.ctxType = MUSIC_AUDIO_WAV;
music.ctxData = ctxWav; music.ctxData = ctxWav;
music.stream = InitAudioStream(ctxWav->sampleRate, ctxWav->bitsPerSample, ctxWav->channels); int sampleSize = ctxWav->bitsPerSample;
if (ctxWav->bitsPerSample == 24) sampleSize = 16; // Forcing conversion to s16 on UpdateMusicStream()
music.stream = InitAudioStream(ctxWav->sampleRate, sampleSize, ctxWav->channels);
music.sampleCount = (unsigned int)ctxWav->totalPCMFrameCount*ctxWav->channels; music.sampleCount = (unsigned int)ctxWav->totalPCMFrameCount*ctxWav->channels;
music.looping = true; // Looping enabled by default music.looping = true; // Looping enabled by default
musicLoaded = true; musicLoaded = true;
@ -1328,7 +1354,8 @@ void UpdateMusicStream(Music music)
case MUSIC_AUDIO_WAV: case MUSIC_AUDIO_WAV:
{ {
// NOTE: Returns the number of samples to process (not required) // NOTE: Returns the number of samples to process (not required)
drwav_read_pcm_frames_s16((drwav *)music.ctxData, samplesCount/music.stream.channels, (short *)pcm); if (music.stream.sampleSize == 16) drwav_read_pcm_frames_s16((drwav *)music.ctxData, samplesCount/music.stream.channels, (short *)pcm);
else if (music.stream.sampleSize == 32) drwav_read_pcm_frames_f32((drwav *)music.ctxData, samplesCount/music.stream.channels, (float *)pcm);
} break; } break;
#endif #endif
@ -1867,20 +1894,6 @@ static Wave LoadWAV(const char *fileName)
{ {
Wave wave = { 0 }; Wave wave = { 0 };
// Decode an entire WAV file in one go
unsigned long long int totalPCMFrameCount = 0;
wave.data = drwav_open_file_and_read_pcm_frames_s16(fileName, &wave.channels, &wave.sampleRate, &totalPCMFrameCount, NULL);
if (wave.data == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to load WAV data", fileName);
else
{
wave.sampleCount = (unsigned int)totalPCMFrameCount*wave.channels;
wave.sampleSize = 16;
TRACELOG(LOG_INFO, "WAVE: [%s] WAV file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
}
/*
// Loading WAV from memory to avoid FILE accesses // Loading WAV from memory to avoid FILE accesses
unsigned int fileSize = 0; unsigned int fileSize = 0;
unsigned char *fileData = LoadFileData(fileName, &fileSize); unsigned char *fileData = LoadFileData(fileName, &fileSize);
@ -1902,7 +1915,7 @@ static Wave LoadWAV(const char *fileName)
drwav_uninit(&wav); drwav_uninit(&wav);
RL_FREE(fileData); RL_FREE(fileData);
*/
return wave; return wave;
} }
@ -1918,7 +1931,7 @@ static int SaveWAV(Wave wave, const char *fileName)
format.bitsPerSample = wave.sampleSize; format.bitsPerSample = wave.sampleSize;
drwav_init_file_write(&wav, fileName, &format, NULL); drwav_init_file_write(&wav, fileName, &format, NULL);
//drwav_init_memory_write(&wav, &fileData, &fileDataSize, &format, NULL); // Memory version //drwav_init_memory_write(&wav, &fileData, &fileDataSize, &format, NULL); // TODO: Memory version
drwav_write_pcm_frames(&wav, wave.sampleCount/wave.channels, wave.data); drwav_write_pcm_frames(&wav, wave.sampleCount/wave.channels, wave.data);
drwav_uninit(&wav); drwav_uninit(&wav);
@ -1937,7 +1950,11 @@ static Wave LoadOGG(const char *fileName)
{ {
Wave wave = { 0 }; Wave wave = { 0 };
stb_vorbis *oggFile = stb_vorbis_open_filename(fileName, NULL, NULL); // Loading OGG from memory to avoid FILE accesses
unsigned int fileSize = 0;
unsigned char *fileData = LoadFileData(fileName, &fileSize);
stb_vorbis *oggFile = stb_vorbis_open_memory(fileData, fileSize, NULL, NULL);
if (oggFile == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open OGG file", fileName); if (oggFile == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open OGG file", fileName);
else else
@ -1961,6 +1978,8 @@ static Wave LoadOGG(const char *fileName)
stb_vorbis_close(oggFile); stb_vorbis_close(oggFile);
} }
RL_FREE(fileData);
return wave; return wave;
} }
#endif #endif
@ -1972,9 +1991,13 @@ static Wave LoadFLAC(const char *fileName)
{ {
Wave wave = { 0 }; Wave wave = { 0 };
// Loading FLAC from memory to avoid FILE accesses
unsigned int fileSize = 0;
unsigned char *fileData = LoadFileData(fileName, &fileSize);
// Decode an entire FLAC file in one go // Decode an entire FLAC file in one go
unsigned long long int totalSampleCount = 0; unsigned long long int totalSampleCount = 0;
wave.data = drflac_open_file_and_read_pcm_frames_s16(fileName, &wave.channels, &wave.sampleRate, &totalSampleCount); wave.data = drflac_open_memory_and_read_pcm_frames_s16(fileData, fileSize, &wave.channels, &wave.sampleRate, &totalSampleCount);
if (wave.data == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to load FLAC data", fileName); if (wave.data == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to load FLAC data", fileName);
else else
@ -1985,6 +2008,8 @@ static Wave LoadFLAC(const char *fileName)
TRACELOG(LOG_INFO, "WAVE: [%s] FLAC file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo"); TRACELOG(LOG_INFO, "WAVE: [%s] FLAC file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
} }
RL_FREE(fileData);
return wave; return wave;
} }
#endif #endif
@ -1996,10 +2021,14 @@ static Wave LoadMP3(const char *fileName)
{ {
Wave wave = { 0 }; Wave wave = { 0 };
// Loading MP3 from memory to avoid FILE accesses
unsigned int fileSize = 0;
unsigned char *fileData = LoadFileData(fileName, &fileSize);
// Decode an entire MP3 file in one go // Decode an entire MP3 file in one go
unsigned long long int totalFrameCount = 0; unsigned long long int totalFrameCount = 0;
drmp3_config config = { 0 }; drmp3_config config = { 0 };
wave.data = drmp3_open_file_and_read_f32(fileName, &config, &totalFrameCount); wave.data = drmp3_open_memory_and_read_f32(fileData, fileSize, &config, &totalFrameCount);
if (wave.data == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to load MP3 data", fileName); if (wave.data == NULL) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to load MP3 data", fileName);
else else
@ -2015,6 +2044,8 @@ static Wave LoadMP3(const char *fileName)
TRACELOG(LOG_INFO, "WAVE: [%s] MP3 file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo"); TRACELOG(LOG_INFO, "WAVE: [%s] MP3 file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
} }
RL_FREE(fileData);
return wave; return wave;
} }
#endif #endif
@ -2035,6 +2066,68 @@ static bool IsFileExtension(const char *fileName, const char *ext)
return result; return result;
} }
// Load data from file into a buffer
static unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead)
{
unsigned char *data = NULL;
*bytesRead = 0;
if (fileName != NULL)
{
FILE *file = fopen(fileName, "rb");
if (file != NULL)
{
// WARNING: On binary streams SEEK_END could not be found,
// using fseek() and ftell() could not work in some (rare) cases
fseek(file, 0, SEEK_END);
int size = ftell(file);
fseek(file, 0, SEEK_SET);
if (size > 0)
{
data = (unsigned char *)RL_MALLOC(size*sizeof(unsigned char));
// NOTE: fread() returns number of read elements instead of bytes, so we read [1 byte, size elements]
unsigned int count = (unsigned int)fread(data, sizeof(unsigned char), size, file);
*bytesRead = count;
if (count != size) TRACELOG(LOG_WARNING, "FILEIO: [%s] File partially loaded", fileName);
else TRACELOG(LOG_INFO, "FILEIO: [%s] File loaded successfully", fileName);
}
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to read file", fileName);
fclose(file);
}
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open file", fileName);
}
else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid");
return data;
}
// Save data to file from buffer
static void SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite)
{
if (fileName != NULL)
{
FILE *file = fopen(fileName, "wb");
if (file != NULL)
{
unsigned int count = (unsigned int)fwrite(data, sizeof(unsigned char), bytesToWrite, file);
if (count == 0) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to write file", fileName);
else if (count != bytesToWrite) TRACELOG(LOG_WARNING, "FILEIO: [%s] File partially written", fileName);
else TRACELOG(LOG_INFO, "FILEIO: [%s] File saved successfully", fileName);
fclose(file);
}
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open file", fileName);
}
else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid");
}
// Save text data to file (write), string must be '\0' terminated // Save text data to file (write), string must be '\0' terminated
static void SaveFileText(const char *fileName, char *text) static void SaveFileText(const char *fileName, char *text)
{ {

View File

@ -1,8 +1,8 @@
GLFW_ICON ICON "raylib.ico" GLFW_ICON ICON "raylib.ico"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 3,0,0,0 FILEVERSION 3,1,0,0
PRODUCTVERSION 3,0,0,0 PRODUCTVERSION 3,1,0,0
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
@ -11,12 +11,12 @@ BEGIN
BEGIN BEGIN
//VALUE "CompanyName", "raylib technologies" //VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "raylib dynamic library (www.raylib.com)" VALUE "FileDescription", "raylib dynamic library (www.raylib.com)"
VALUE "FileVersion", "3.0.0" VALUE "FileVersion", "3.1.0"
VALUE "InternalName", "raylib_dll" VALUE "InternalName", "raylib.dll"
VALUE "LegalCopyright", "(c) 2020 Ramon Santamaria (@raysan5)" VALUE "LegalCopyright", "(c) 2020 Ramon Santamaria (@raysan5)"
//VALUE "OriginalFilename", "raylib.dll" VALUE "OriginalFilename", "raylib.dll"
VALUE "ProductName", "raylib" VALUE "ProductName", "raylib"
VALUE "ProductVersion", "3.0.0" VALUE "ProductVersion", "3.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

Binary file not shown.

View File

@ -808,7 +808,9 @@ typedef enum {
BLEND_ALPHA = 0, // Blend textures considering alpha (default) BLEND_ALPHA = 0, // Blend textures considering alpha (default)
BLEND_ADDITIVE, // Blend textures adding colors BLEND_ADDITIVE, // Blend textures adding colors
BLEND_MULTIPLIED, // Blend textures multiplying colors BLEND_MULTIPLIED, // Blend textures multiplying colors
BLEND_ADD_COLORS // Blend textures adding colors (alternative) BLEND_ADD_COLORS, // Blend textures adding colors (alternative)
BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative)
BLEND_CUSTOM // Belnd textures using custom src/dst factors (use SetBlendModeCustom())
} BlendMode; } BlendMode;
// Gestures type // Gestures type
@ -879,6 +881,7 @@ RLAPI bool WindowShouldClose(void); // Check if KE
RLAPI void CloseWindow(void); // Close window and unload OpenGL context RLAPI void CloseWindow(void); // Close window and unload OpenGL context
RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
RLAPI bool IsWindowMinimized(void); // Check if window has been minimized RLAPI bool IsWindowMinimized(void); // Check if window has been minimized
RLAPI bool IsWindowMaximized(void); // Check if window has been maximized (only PLATFORM_DESKTOP)
RLAPI bool IsWindowFocused(void); // Check if window has been focused RLAPI bool IsWindowFocused(void); // Check if window has been focused
RLAPI bool IsWindowResized(void); // Check if window has been resized RLAPI bool IsWindowResized(void); // Check if window has been resized
RLAPI bool IsWindowHidden(void); // Check if window is currently hidden RLAPI bool IsWindowHidden(void); // Check if window is currently hidden
@ -886,6 +889,10 @@ RLAPI bool IsWindowFullscreen(void); // Check if wi
RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP) RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
RLAPI void UnhideWindow(void); // Show the window RLAPI void UnhideWindow(void); // Show the window
RLAPI void HideWindow(void); // Hide the window RLAPI void HideWindow(void); // Hide the window
RLAPI void DecorateWindow(void); // Decorate the window (only PLATFORM_DESKTOP)
RLAPI void UndecorateWindow(void); // Undecorate the window (only PLATFORM_DESKTOP)
RLAPI void MaximizeWindow(void); // Maximize the window, if resizable (only PLATFORM_DESKTOP)
RLAPI void RestoreWindow(void); // Restore the window, if resizable (only PLATFORM_DESKTOP)
RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP) RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP)
RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP) RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP)
RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP) RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
@ -1106,8 +1113,8 @@ RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Ve
// Image loading functions // Image loading functions
// NOTE: This functions do not require GPU access // NOTE: This functions do not require GPU access
RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM) RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
RLAPI Image LoadImageEx(Color *pixels, int width, int height); // Load image from Color array data (RGBA - 32bit)
RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM) RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM)
RLAPI void ExportImage(Image image, const char *fileName); // Export image data to file RLAPI void ExportImage(Image image, const char *fileName); // Export image data to file
RLAPI void ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes RLAPI void ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes
@ -1334,6 +1341,7 @@ RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
RLAPI BoundingBox MeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits RLAPI BoundingBox MeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
RLAPI void MeshTangents(Mesh *mesh); // Compute mesh tangents RLAPI void MeshTangents(Mesh *mesh); // Compute mesh tangents
RLAPI void MeshBinormals(Mesh *mesh); // Compute mesh binormals RLAPI void MeshBinormals(Mesh *mesh); // Compute mesh binormals
RLAPI void MeshNormalsSmooth(Mesh *mesh); // Smooth (average) vertex normals
// Model drawing functions // Model drawing functions
RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set) RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)

View File

@ -1,8 +1,8 @@
GLFW_ICON ICON "raylib.ico" GLFW_ICON ICON "raylib.ico"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 3,0,0,0 FILEVERSION 3,1,0,0
PRODUCTVERSION 3,0,0,0 PRODUCTVERSION 3,1,0,0
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
@ -11,12 +11,12 @@ BEGIN
BEGIN BEGIN
//VALUE "CompanyName", "raylib technologies" //VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "raylib application (www.raylib.com)" VALUE "FileDescription", "raylib application (www.raylib.com)"
VALUE "FileVersion", "3.0.0" VALUE "FileVersion", "3.1.0"
VALUE "InternalName", "raylib app" VALUE "InternalName", "raylib app"
VALUE "LegalCopyright", "(c) 2020 Ramon Santamaria (@raysan5)" VALUE "LegalCopyright", "(c) 2020 Ramon Santamaria (@raysan5)"
//VALUE "OriginalFilename", "raylib_app.exe" //VALUE "OriginalFilename", "raylib_app.exe"
VALUE "ProductName", "raylib app" VALUE "ProductName", "raylib app"
VALUE "ProductVersion", "3.0.0" VALUE "ProductVersion", "3.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

Binary file not shown.

View File

@ -795,6 +795,32 @@ RMDEF Matrix MatrixSubtract(Matrix left, Matrix right)
return result; return result;
} }
// Returns two matrix multiplication
// NOTE: When multiplying matrices... the order matters!
RMDEF Matrix MatrixMultiply(Matrix left, Matrix right)
{
Matrix result = { 0 };
result.m0 = left.m0*right.m0 + left.m1*right.m4 + left.m2*right.m8 + left.m3*right.m12;
result.m1 = left.m0*right.m1 + left.m1*right.m5 + left.m2*right.m9 + left.m3*right.m13;
result.m2 = left.m0*right.m2 + left.m1*right.m6 + left.m2*right.m10 + left.m3*right.m14;
result.m3 = left.m0*right.m3 + left.m1*right.m7 + left.m2*right.m11 + left.m3*right.m15;
result.m4 = left.m4*right.m0 + left.m5*right.m4 + left.m6*right.m8 + left.m7*right.m12;
result.m5 = left.m4*right.m1 + left.m5*right.m5 + left.m6*right.m9 + left.m7*right.m13;
result.m6 = left.m4*right.m2 + left.m5*right.m6 + left.m6*right.m10 + left.m7*right.m14;
result.m7 = left.m4*right.m3 + left.m5*right.m7 + left.m6*right.m11 + left.m7*right.m15;
result.m8 = left.m8*right.m0 + left.m9*right.m4 + left.m10*right.m8 + left.m11*right.m12;
result.m9 = left.m8*right.m1 + left.m9*right.m5 + left.m10*right.m9 + left.m11*right.m13;
result.m10 = left.m8*right.m2 + left.m9*right.m6 + left.m10*right.m10 + left.m11*right.m14;
result.m11 = left.m8*right.m3 + left.m9*right.m7 + left.m10*right.m11 + left.m11*right.m15;
result.m12 = left.m12*right.m0 + left.m13*right.m4 + left.m14*right.m8 + left.m15*right.m12;
result.m13 = left.m12*right.m1 + left.m13*right.m5 + left.m14*right.m9 + left.m15*right.m13;
result.m14 = left.m12*right.m2 + left.m13*right.m6 + left.m14*right.m10 + left.m15*right.m14;
result.m15 = left.m12*right.m3 + left.m13*right.m7 + left.m14*right.m11 + left.m15*right.m15;
return result;
}
// Returns translation matrix // Returns translation matrix
RMDEF Matrix MatrixTranslate(float x, float y, float z) RMDEF Matrix MatrixTranslate(float x, float y, float z)
{ {
@ -851,33 +877,6 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle)
return result; return result;
} }
// Returns xyz-rotation matrix (angles in radians)
RMDEF Matrix MatrixRotateXYZ(Vector3 ang)
{
Matrix result = MatrixIdentity();
float cosz = cosf(-ang.z);
float sinz = sinf(-ang.z);
float cosy = cosf(-ang.y);
float siny = sinf(-ang.y);
float cosx = cosf(-ang.x);
float sinx = sinf(-ang.x);
result.m0 = cosz * cosy;
result.m4 = (cosz * siny * sinx) - (sinz * cosx);
result.m8 = (cosz * siny * cosx) + (sinz * sinx);
result.m1 = sinz * cosy;
result.m5 = (sinz * siny * sinx) + (cosz * cosx);
result.m9 = (sinz * siny * cosx) - (cosz * sinx);
result.m2 = -siny;
result.m6 = cosy * sinx;
result.m10= cosy * cosx;
return result;
}
// Returns x-rotation matrix (angle in radians) // Returns x-rotation matrix (angle in radians)
RMDEF Matrix MatrixRotateX(float angle) RMDEF Matrix MatrixRotateX(float angle)
{ {
@ -926,6 +925,46 @@ RMDEF Matrix MatrixRotateZ(float angle)
return result; return result;
} }
// Returns xyz-rotation matrix (angles in radians)
RMDEF Matrix MatrixRotateXYZ(Vector3 ang)
{
Matrix result = MatrixIdentity();
float cosz = cosf(-ang.z);
float sinz = sinf(-ang.z);
float cosy = cosf(-ang.y);
float siny = sinf(-ang.y);
float cosx = cosf(-ang.x);
float sinx = sinf(-ang.x);
result.m0 = cosz * cosy;
result.m4 = (cosz * siny * sinx) - (sinz * cosx);
result.m8 = (cosz * siny * cosx) + (sinz * sinx);
result.m1 = sinz * cosy;
result.m5 = (sinz * siny * sinx) + (cosz * cosx);
result.m9 = (sinz * siny * cosx) - (cosz * sinx);
result.m2 = -siny;
result.m6 = cosy * sinx;
result.m10= cosy * cosx;
return result;
}
// Returns zyx-rotation matrix (angles in radians)
// TODO: This solution is suboptimal, it should be possible to create this matrix in one go
// instead of using a 3 matrix multiplication
RMDEF Matrix MatrixRotateZYX(Vector3 ang)
{
Matrix result = MatrixRotateZ(ang.z);
result = MatrixMultiply(result, MatrixRotateY(ang.y));
result = MatrixMultiply(result, MatrixRotateX(ang.x));
return result;
}
// Returns scaling matrix // Returns scaling matrix
RMDEF Matrix MatrixScale(float x, float y, float z) RMDEF Matrix MatrixScale(float x, float y, float z)
{ {
@ -937,32 +976,6 @@ RMDEF Matrix MatrixScale(float x, float y, float z)
return result; return result;
} }
// Returns two matrix multiplication
// NOTE: When multiplying matrices... the order matters!
RMDEF Matrix MatrixMultiply(Matrix left, Matrix right)
{
Matrix result = { 0 };
result.m0 = left.m0*right.m0 + left.m1*right.m4 + left.m2*right.m8 + left.m3*right.m12;
result.m1 = left.m0*right.m1 + left.m1*right.m5 + left.m2*right.m9 + left.m3*right.m13;
result.m2 = left.m0*right.m2 + left.m1*right.m6 + left.m2*right.m10 + left.m3*right.m14;
result.m3 = left.m0*right.m3 + left.m1*right.m7 + left.m2*right.m11 + left.m3*right.m15;
result.m4 = left.m4*right.m0 + left.m5*right.m4 + left.m6*right.m8 + left.m7*right.m12;
result.m5 = left.m4*right.m1 + left.m5*right.m5 + left.m6*right.m9 + left.m7*right.m13;
result.m6 = left.m4*right.m2 + left.m5*right.m6 + left.m6*right.m10 + left.m7*right.m14;
result.m7 = left.m4*right.m3 + left.m5*right.m7 + left.m6*right.m11 + left.m7*right.m15;
result.m8 = left.m8*right.m0 + left.m9*right.m4 + left.m10*right.m8 + left.m11*right.m12;
result.m9 = left.m8*right.m1 + left.m9*right.m5 + left.m10*right.m9 + left.m11*right.m13;
result.m10 = left.m8*right.m2 + left.m9*right.m6 + left.m10*right.m10 + left.m11*right.m14;
result.m11 = left.m8*right.m3 + left.m9*right.m7 + left.m10*right.m11 + left.m11*right.m15;
result.m12 = left.m12*right.m0 + left.m13*right.m4 + left.m14*right.m8 + left.m15*right.m12;
result.m13 = left.m12*right.m1 + left.m13*right.m5 + left.m14*right.m9 + left.m15*right.m13;
result.m14 = left.m12*right.m2 + left.m13*right.m6 + left.m14*right.m10 + left.m15*right.m14;
result.m15 = left.m12*right.m3 + left.m13*right.m7 + left.m14*right.m11 + left.m15*right.m15;
return result;
}
// Returns perspective projection matrix // Returns perspective projection matrix
RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far) RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far)
{ {
@ -1299,54 +1312,32 @@ RMDEF Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to)
// Returns a quaternion for a given rotation matrix // Returns a quaternion for a given rotation matrix
RMDEF Quaternion QuaternionFromMatrix(Matrix mat) RMDEF Quaternion QuaternionFromMatrix(Matrix mat)
{ {
Quaternion result = { 0 }; Quaternion result = { 0.0f };
float trace = MatrixTrace(mat); if ((mat.m0 > mat.m5) && (mat.m0 > mat.m10))
if (trace > 0.0f)
{ {
float s = sqrtf(trace + 1)*2.0f; float s = sqrtf(1.0f + mat.m0 - mat.m5 - mat.m10)*2;
float invS = 1.0f/s;
result.w = s*0.25f; result.x = 0.25f*s;
result.x = (mat.m6 - mat.m9)*invS; result.y = (mat.m4 + mat.m1)/s;
result.y = (mat.m8 - mat.m2)*invS; result.z = (mat.m2 + mat.m8)/s;
result.z = (mat.m1 - mat.m4)*invS; result.w = (mat.m9 - mat.m6)/s;
}
else if (mat.m5 > mat.m10)
{
float s = sqrtf(1.0f + mat.m5 - mat.m0 - mat.m10)*2;
result.x = (mat.m4 + mat.m1)/s;
result.y = 0.25f*s;
result.z = (mat.m9 + mat.m6)/s;
result.w = (mat.m2 - mat.m8)/s;
} }
else else
{ {
float m00 = mat.m0, m11 = mat.m5, m22 = mat.m10; float s = sqrtf(1.0f + mat.m10 - mat.m0 - mat.m5)*2;
result.x = (mat.m2 + mat.m8)/s;
if (m00 > m11 && m00 > m22) result.y = (mat.m9 + mat.m6)/s;
{ result.z = 0.25f*s;
float s = (float)sqrt(1.0f + m00 - m11 - m22)*2.0f; result.w = (mat.m4 - mat.m1)/s;
float invS = 1.0f/s;
result.w = (mat.m6 - mat.m9)*invS;
result.x = s*0.25f;
result.y = (mat.m4 + mat.m1)*invS;
result.z = (mat.m8 + mat.m2)*invS;
}
else if (m11 > m22)
{
float s = sqrtf(1.0f + m11 - m00 - m22)*2.0f;
float invS = 1.0f/s;
result.w = (mat.m8 - mat.m2)*invS;
result.x = (mat.m4 + mat.m1)*invS;
result.y = s*0.25f;
result.z = (mat.m9 + mat.m6)*invS;
}
else
{
float s = sqrtf(1.0f + m22 - m00 - m11)*2.0f;
float invS = 1.0f/s;
result.w = (mat.m1 - mat.m4)*invS;
result.x = (mat.m8 + mat.m2)*invS;
result.y = (mat.m9 + mat.m6)*invS;
result.z = s*0.25f;
}
} }
return result; return result;
@ -1355,45 +1346,24 @@ RMDEF Quaternion QuaternionFromMatrix(Matrix mat)
// Returns a matrix for a given quaternion // Returns a matrix for a given quaternion
RMDEF Matrix QuaternionToMatrix(Quaternion q) RMDEF Matrix QuaternionToMatrix(Quaternion q)
{ {
Matrix result = { 0 }; Matrix result = MatrixIdentity();
float x = q.x, y = q.y, z = q.z, w = q.w; float a2 = 2*(q.x*q.x), b2=2*(q.y*q.y), c2=2*(q.z*q.z); //, d2=2*(q.w*q.w);
float x2 = x + x; float ab = 2*(q.x*q.y), ac=2*(q.x*q.z), bc=2*(q.y*q.z);
float y2 = y + y; float ad = 2*(q.x*q.w), bd=2*(q.y*q.w), cd=2*(q.z*q.w);
float z2 = z + z;
float length = QuaternionLength(q); result.m0 = 1 - b2 - c2;
float lengthSquared = length*length; result.m1 = ab - cd;
result.m2 = ac + bd;
float xx = x*x2/lengthSquared; result.m4 = ab + cd;
float xy = x*y2/lengthSquared; result.m5 = 1 - a2 - c2;
float xz = x*z2/lengthSquared; result.m6 = bc - ad;
float yy = y*y2/lengthSquared; result.m8 = ac - bd;
float yz = y*z2/lengthSquared; result.m9 = bc + ad;
float zz = z*z2/lengthSquared; result.m10 = 1 - a2 - b2;
float wx = w*x2/lengthSquared;
float wy = w*y2/lengthSquared;
float wz = w*z2/lengthSquared;
result.m0 = 1.0f - (yy + zz);
result.m1 = xy - wz;
result.m2 = xz + wy;
result.m3 = 0.0f;
result.m4 = xy + wz;
result.m5 = 1.0f - (xx + zz);
result.m6 = yz - wx;
result.m7 = 0.0f;
result.m8 = xz - wy;
result.m9 = yz + wx;
result.m10 = 1.0f - (xx + yy);
result.m11 = 0.0f;
result.m12 = 0.0f;
result.m13 = 0.0f;
result.m14 = 0.0f;
result.m15 = 1.0f;
return result; return result;
} }
@ -1507,4 +1477,27 @@ RMDEF Quaternion QuaternionTransform(Quaternion q, Matrix mat)
return result; return result;
} }
// Projects a Vector3 from screen space into object space
RMDEF Vector3 Vector3Unproject(Vector3 source, Matrix projection, Matrix view)
{
Vector3 result = { 0.0f, 0.0f, 0.0f };
// Calculate unproject matrix (multiply view patrix by projection matrix) and invert it
Matrix matViewProj = MatrixMultiply(view, projection);
matViewProj = MatrixInvert(matViewProj);
// Create quaternion from source point
Quaternion quat = { source.x, source.y, source.z, 1.0f };
// Multiply quat point by unproject matrix
quat = QuaternionTransform(quat, matViewProj);
// Normalized world points in vectors
result.x = quat.x/quat.w;
result.y = quat.y/quat.w;
result.z = quat.z/quat.w;
return result;
}
#endif // RAYMATH_H #endif // RAYMATH_H

View File

@ -125,6 +125,8 @@
#define GRAPHICS_API_OPENGL_33 #define GRAPHICS_API_OPENGL_33
#endif #endif
#define SUPPORT_RENDER_TEXTURES_HINT
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Defines and Macros // Defines and Macros
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -380,10 +382,12 @@ typedef unsigned char byte;
// Color blending modes (pre-defined) // Color blending modes (pre-defined)
typedef enum { typedef enum {
BLEND_ALPHA = 0, BLEND_ALPHA = 0, // Blend textures considering alpha (default)
BLEND_ADDITIVE, BLEND_ADDITIVE, // Blend textures adding colors
BLEND_MULTIPLIED, BLEND_MULTIPLIED, // Blend textures multiplying colors
BLEND_ADD_COLORS BLEND_ADD_COLORS, // Blend textures adding colors (alternative)
BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative)
BLEND_CUSTOM // Belnd textures using custom src/dst factors (use SetBlendModeCustom())
} BlendMode; } BlendMode;
// Shader location point type // Shader location point type
@ -517,12 +521,13 @@ RLAPI unsigned int rlLoadAttribBuffer(unsigned int vaoId, int shaderLoc, void *b
RLAPI void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states) RLAPI void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states)
RLAPI void rlglClose(void); // De-inititialize rlgl (buffers, shaders, textures) RLAPI void rlglClose(void); // De-inititialize rlgl (buffers, shaders, textures)
RLAPI void rlglDraw(void); // Update and draw default internal buffers RLAPI void rlglDraw(void); // Update and draw default internal buffers
RLAPI void rlCheckErrors(void); // Check and log OpenGL error codes
RLAPI int rlGetVersion(void); // Returns current OpenGL version RLAPI int rlGetVersion(void); // Returns current OpenGL version
RLAPI bool rlCheckBufferLimit(int vCount); // Check internal buffer overflow for a given number of vertex RLAPI bool rlCheckBufferLimit(int vCount); // Check internal buffer overflow for a given number of vertex
RLAPI void rlSetDebugMarker(const char *text); // Set debug marker for analysis RLAPI void rlSetDebugMarker(const char *text); // Set debug marker for analysis
RLAPI void rlSetBlendMode(int glSrcFactor, int glDstFactor, int glEquation); // // Set blending mode factor and equation (using OpenGL factors)
RLAPI void rlLoadExtensions(void *loader); // Load OpenGL extensions RLAPI void rlLoadExtensions(void *loader); // Load OpenGL extensions
RLAPI Vector3 rlUnproject(Vector3 source, Matrix proj, Matrix view); // Get world coordinates from screen coordinates
// Textures data management // Textures data management
RLAPI unsigned int rlLoadTexture(void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU RLAPI unsigned int rlLoadTexture(void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU
@ -853,6 +858,11 @@ typedef struct rlglData {
Shader defaultShader; // Basic shader, support vertex color and diffuse texture Shader defaultShader; // Basic shader, support vertex color and diffuse texture
Shader currentShader; // Shader to be used on rendering (by default, defaultShader) Shader currentShader; // Shader to be used on rendering (by default, defaultShader)
int currentBlendMode; // Blending mode active
int glBlendSrcFactor; // Blending source factor
int glBlendDstFactor; // Blending destination factor
int glBlendEquation; // Blending equation
int framebufferWidth; // Default framebuffer width int framebufferWidth; // Default framebuffer width
int framebufferHeight; // Default framebuffer height int framebufferHeight; // Default framebuffer height
@ -1080,7 +1090,6 @@ void rlOrtho(double left, double right, double bottom, double top, double znear,
#endif #endif
// Set the viewport area (transformation from normalized device coordinates to window coordinates) // Set the viewport area (transformation from normalized device coordinates to window coordinates)
// NOTE: Updates global variables: RLGL.State.framebufferWidth, RLGL.State.framebufferHeight
void rlViewport(int x, int y, int width, int height) void rlViewport(int x, int y, int width, int height)
{ {
glViewport(x, y, width, height); glViewport(x, y, width, height);
@ -1383,7 +1392,7 @@ void rlTextureParameters(unsigned int id, int param, int value)
// Enable rendering to texture (fbo) // Enable rendering to texture (fbo)
void rlEnableRenderTexture(unsigned int id) void rlEnableRenderTexture(unsigned int id)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(SUPPORT_RENDER_TEXTURES_HINT)
glBindFramebuffer(GL_FRAMEBUFFER, id); glBindFramebuffer(GL_FRAMEBUFFER, id);
//glDisable(GL_CULL_FACE); // Allow double side drawing for texture flipping //glDisable(GL_CULL_FACE); // Allow double side drawing for texture flipping
@ -1394,7 +1403,7 @@ void rlEnableRenderTexture(unsigned int id)
// Disable rendering to texture // Disable rendering to texture
void rlDisableRenderTexture(void) void rlDisableRenderTexture(void)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(SUPPORT_RENDER_TEXTURES_HINT)
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
//glEnable(GL_CULL_FACE); //glEnable(GL_CULL_FACE);
@ -1450,7 +1459,7 @@ void rlDeleteTextures(unsigned int id)
// Unload render texture from GPU memory // Unload render texture from GPU memory
void rlDeleteRenderTextures(RenderTexture2D target) void rlDeleteRenderTextures(RenderTexture2D target)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(SUPPORT_RENDER_TEXTURES_HINT)
if (target.texture.id > 0) glDeleteTextures(1, &target.texture.id); if (target.texture.id > 0) glDeleteTextures(1, &target.texture.id);
if (target.depth.id > 0) if (target.depth.id > 0)
{ {
@ -1562,7 +1571,7 @@ void rlglInit(int width, int height)
// TODO: Automatize extensions loading using rlLoadExtensions() and GLAD // TODO: Automatize extensions loading using rlLoadExtensions() and GLAD
// Actually, when rlglInit() is called in InitWindow() in core.c, // Actually, when rlglInit() is called in InitWindow() in core.c,
// OpenGL required extensions have already been loaded (PLATFORM_DESKTOP) // OpenGL context has already been created and required extensions loaded
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
// Get supported extensions list // Get supported extensions list
@ -1765,7 +1774,6 @@ void rlglInit(int width, int height)
glClearDepth(1.0f); // Set clear depth value (default) glClearDepth(1.0f); // Set clear depth value (default)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D)
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
// Store screen size into global variables // Store screen size into global variables
RLGL.State.framebufferWidth = width; RLGL.State.framebufferWidth = width;
RLGL.State.framebufferHeight = height; RLGL.State.framebufferHeight = height;
@ -1773,7 +1781,6 @@ void rlglInit(int width, int height)
// Init texture and rectangle used on basic shapes drawing // Init texture and rectangle used on basic shapes drawing
RLGL.State.shapesTexture = GetTextureDefault(); RLGL.State.shapesTexture = GetTextureDefault();
RLGL.State.shapesTextureRec = (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }; RLGL.State.shapesTextureRec = (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f };
#endif
TRACELOG(LOG_INFO, "RLGL: Default state initialized successfully"); TRACELOG(LOG_INFO, "RLGL: Default state initialized successfully");
} }
@ -1799,6 +1806,45 @@ void rlglDraw(void)
#endif #endif
} }
// Check and log OpenGL error codes
void rlCheckErrors() {
#if defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
int check = 1;
while (check) {
const GLenum err = glGetError();
switch (err) {
case GL_NO_ERROR:
check = 0;
break;
case 0x0500: // GL_INVALID_ENUM:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_INVALID_ENUM");
break;
case 0x0501: //GL_INVALID_VALUE:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_INVALID_VALUE");
break;
case 0x0502: //GL_INVALID_OPERATION:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_INVALID_OPERATION");
break;
case 0x0503: // GL_STACK_OVERFLOW:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_STACK_OVERFLOW");
break;
case 0x0504: // GL_STACK_UNDERFLOW:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_STACK_UNDERFLOW");
break;
case 0x0505: // GL_OUT_OF_MEMORY:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_OUT_OF_MEMORY");
break;
case 0x0506: // GL_INVALID_FRAMEBUFFER_OPERATION:
TRACELOG(LOG_WARNING, "GL: Error detected: GL_INVALID_FRAMEBUFFER_OPERATION");
break;
default:
TRACELOG(LOG_WARNING, "GL: Error detected: unknown error code %x", err);
break;
}
}
#endif
}
// Returns current OpenGL version // Returns current OpenGL version
int rlGetVersion(void) int rlGetVersion(void)
{ {
@ -1835,6 +1881,14 @@ void rlSetDebugMarker(const char *text)
#endif #endif
} }
// Set blending mode factor and equation
void rlSetBlendMode(int glSrcFactor, int glDstFactor, int glEquation)
{
RLGL.State.glBlendSrcFactor = glSrcFactor;
RLGL.State.glBlendDstFactor = glDstFactor;
RLGL.State.glBlendEquation = glEquation;
}
// Load OpenGL extensions // Load OpenGL extensions
// NOTE: External loader function could be passed as a pointer // NOTE: External loader function could be passed as a pointer
void rlLoadExtensions(void *loader) void rlLoadExtensions(void *loader)
@ -1858,29 +1912,6 @@ void rlLoadExtensions(void *loader)
#endif #endif
} }
// Get world coordinates from screen coordinates
Vector3 rlUnproject(Vector3 source, Matrix proj, Matrix view)
{
Vector3 result = { 0.0f, 0.0f, 0.0f };
// Calculate unproject matrix (multiply view patrix by projection matrix) and invert it
Matrix matViewProj = MatrixMultiply(view, proj);
matViewProj = MatrixInvert(matViewProj);
// Create quaternion from source point
Quaternion quat = { source.x, source.y, source.z, 1.0f };
// Multiply quat point by unproject matrix
quat = QuaternionTransform(quat, matViewProj);
// Normalized world points in vectors
result.x = quat.x/quat.w;
result.y = quat.y/quat.w;
result.z = quat.z/quat.w;
return result;
}
// Convert image data to OpenGL texture (returns OpenGL valid Id) // Convert image data to OpenGL texture (returns OpenGL valid Id)
unsigned int rlLoadTexture(void *data, int width, int height, int format, int mipmapCount) unsigned int rlLoadTexture(void *data, int width, int height, int format, int mipmapCount)
{ {
@ -2228,7 +2259,7 @@ RenderTexture2D rlLoadRenderTexture(int width, int height, int format, int depth
{ {
RenderTexture2D target = { 0 }; RenderTexture2D target = { 0 };
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(SUPPORT_RENDER_TEXTURES_HINT)
if (useDepthTexture && RLGL.ExtSupported.texDepth) target.depthTexture = true; if (useDepthTexture && RLGL.ExtSupported.texDepth) target.depthTexture = true;
// Create the framebuffer object // Create the framebuffer object
@ -2281,7 +2312,7 @@ RenderTexture2D rlLoadRenderTexture(int width, int height, int format, int depth
// NOTE: Attach type: 0-Color, 1-Depth renderbuffer, 2-Depth texture // NOTE: Attach type: 0-Color, 1-Depth renderbuffer, 2-Depth texture
void rlRenderTextureAttach(RenderTexture2D target, unsigned int id, int attachType) void rlRenderTextureAttach(RenderTexture2D target, unsigned int id, int attachType)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(SUPPORT_RENDER_TEXTURES_HINT)
glBindFramebuffer(GL_FRAMEBUFFER, target.id); glBindFramebuffer(GL_FRAMEBUFFER, target.id);
if (attachType == 0) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0); if (attachType == 0) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0);
@ -2300,7 +2331,7 @@ bool rlRenderTextureComplete(RenderTexture target)
{ {
bool result = false; bool result = false;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(SUPPORT_RENDER_TEXTURES_HINT)
glBindFramebuffer(GL_FRAMEBUFFER, target.id); glBindFramebuffer(GL_FRAMEBUFFER, target.id);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@ -3577,22 +3608,22 @@ Texture2D GenTextureBRDF(Shader shader, int size)
// NOTE: Only 3 blending modes supported, default blend mode is alpha // NOTE: Only 3 blending modes supported, default blend mode is alpha
void BeginBlendMode(int mode) void BeginBlendMode(int mode)
{ {
static int blendMode = 0; // Track current blending mode if (RLGL.State.currentBlendMode != mode)
if ((blendMode != mode) && (mode < 4))
{ {
rlglDraw(); rlglDraw();
switch (mode) switch (mode)
{ {
case BLEND_ALPHA: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case BLEND_ALPHA: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break;
case BLEND_ADDITIVE: glBlendFunc(GL_SRC_ALPHA, GL_ONE); break; case BLEND_ADDITIVE: glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBlendEquation(GL_FUNC_ADD); break;
case BLEND_MULTIPLIED: glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); break; case BLEND_MULTIPLIED: glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break;
case BLEND_ADD_COLORS: glBlendFunc(GL_ONE, GL_ONE); break; case BLEND_ADD_COLORS: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_FUNC_ADD); break;
case BLEND_SUBTRACT_COLORS: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_FUNC_SUBTRACT); break;
case BLEND_CUSTOM: glBlendFunc(RLGL.State.glBlendSrcFactor, RLGL.State.glBlendDstFactor); glBlendEquation(RLGL.State.glBlendEquation); break;
default: break; default: break;
} }
blendMode = mode; RLGL.State.currentBlendMode = mode;
} }
} }
@ -4074,6 +4105,8 @@ static void UnloadShaderDefault(void)
glDeleteShader(RLGL.State.defaultFShaderId); glDeleteShader(RLGL.State.defaultFShaderId);
glDeleteProgram(RLGL.State.defaultShader.id); glDeleteProgram(RLGL.State.defaultShader.id);
RL_FREE(RLGL.State.defaultShader.locs);
} }
// Load render batch // Load render batch
@ -4190,6 +4223,7 @@ static RenderBatch LoadRenderBatch(int numBuffers, int bufferElements)
//batch.draws[i].RLGL.State.modelview = MatrixIdentity(); //batch.draws[i].RLGL.State.modelview = MatrixIdentity();
} }
batch.buffersCount = numBuffers; // Record buffer count
batch.drawsCounter = 1; // Reset draws counter batch.drawsCounter = 1; // Reset draws counter
batch.currentDepth = -1.0f; // Reset depth value batch.currentDepth = -1.0f; // Reset depth value
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------

View File

@ -1246,6 +1246,7 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
// Draw a triangle fan defined by points // Draw a triangle fan defined by points
// NOTE: First vertex provided is the center, shared by all triangles // NOTE: First vertex provided is the center, shared by all triangles
// By default, following vertex should be provided in counter-clockwise order
void DrawTriangleFan(Vector2 *points, int pointsCount, Color color) void DrawTriangleFan(Vector2 *points, int pointsCount, Color color)
{ {
if (pointsCount >= 3) if (pointsCount >= 3)

View File

@ -826,7 +826,7 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f
float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
for (int i = 0; i < length; i++) for (int i = 0; i < length;)
{ {
// Get next codepoint from byte string and glyph index in font // Get next codepoint from byte string and glyph index in font
int codepointByteCount = 0; int codepointByteCount = 0;
@ -860,7 +860,7 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f
else textOffsetX += ((float)font.chars[index].advanceX*scaleFactor + spacing); else textOffsetX += ((float)font.chars[index].advanceX*scaleFactor + spacing);
} }
i += (codepointByteCount - 1); // Move text bytes counter to next codepoint i += codepointByteCount; // Move text bytes counter to next codepoint
} }
} }
@ -1703,6 +1703,9 @@ static Font LoadBMFont(const char *fileName)
int base = 0; // Useless data int base = 0; // Useless data
char *fileText = LoadFileText(fileName); char *fileText = LoadFileText(fileName);
if (fileText == NULL) return font;
char *fileTextPtr = fileText; char *fileTextPtr = fileText;
// NOTE: We skip first line, it contains no useful information // NOTE: We skip first line, it contains no useful information
@ -1734,20 +1737,24 @@ static Font LoadBMFont(const char *fileName)
TRACELOGD(" > Chars count: %i", charsCount); TRACELOGD(" > Chars count: %i", charsCount);
// Compose correct path using route of .fnt file (fileName) and imFileName // Compose correct path using route of .fnt file (fileName) and imFileName
char *texPath = NULL; char *imPath = NULL;
char *lastSlash = NULL; char *lastSlash = NULL;
lastSlash = strrchr(fileName, '/'); lastSlash = strrchr(fileName, '/');
if (lastSlash == NULL) lastSlash = strrchr(fileName, '\\'); if (lastSlash == NULL) lastSlash = strrchr(fileName, '\\');
if (lastSlash != NULL)
{
// NOTE: We need some extra space to avoid memory corruption on next allocations! // NOTE: We need some extra space to avoid memory corruption on next allocations!
texPath = RL_CALLOC(TextLength(fileName) - TextLength(lastSlash) + TextLength(imFileName) + 4, 1); imPath = RL_CALLOC(TextLength(fileName) - TextLength(lastSlash) + TextLength(imFileName) + 4, 1);
memcpy(texPath, fileName, TextLength(fileName) - TextLength(lastSlash) + 1); memcpy(imPath, fileName, TextLength(fileName) - TextLength(lastSlash) + 1);
memcpy(texPath + TextLength(fileName) - TextLength(lastSlash) + 1, imFileName, TextLength(imFileName)); memcpy(imPath + TextLength(fileName) - TextLength(lastSlash) + 1, imFileName, TextLength(imFileName));
}
else imPath = imFileName;
TRACELOGD(" > Texture loading path: %s", texPath); TRACELOGD(" > Image loading path: %s", imPath);
Image imFont = LoadImage(texPath); Image imFont = LoadImage(imPath);
if (imFont.format == UNCOMPRESSED_GRAYSCALE) if (imFont.format == UNCOMPRESSED_GRAYSCALE)
{ {
@ -1772,7 +1779,7 @@ static Font LoadBMFont(const char *fileName)
font.texture = LoadTextureFromImage(imFont); font.texture = LoadTextureFromImage(imFont);
RL_FREE(texPath); if (lastSlash != NULL) RL_FREE(imPath);
// Fill font characters info data // Fill font characters info data
font.baseSize = fontSize; font.baseSize = fontSize;

View File

@ -148,8 +148,8 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Defines and Macros // Defines and Macros
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#ifndef R5G5B5A1_ALPHA_THRESHOLD #ifndef UNCOMPRESSED_R5G5B5A1_ALPHA_THRESHOLD
#define R5G5B5A1_ALPHA_THRESHOLD 50 // Threshold over 255 to set alpha as 0 #define UNCOMPRESSED_R5G5B5A1_ALPHA_THRESHOLD 50 // Threshold over 255 to set alpha as 0
#endif #endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -170,9 +170,6 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // Module specific Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_GIF)
static Image LoadAnimatedGIF(const char *fileName, int *frames, int **delays); // Load animated GIF file
#endif
#if defined(SUPPORT_FILEFORMAT_DDS) #if defined(SUPPORT_FILEFORMAT_DDS)
static Image LoadDDS(const char *fileName); // Load DDS file static Image LoadDDS(const char *fileName); // Load DDS file
#endif #endif
@ -308,33 +305,6 @@ Image LoadImage(const char *fileName)
return image; return image;
} }
// Load image from Color array data (RGBA - 32bit)
// NOTE: Creates a copy of pixels data array
Image LoadImageEx(Color *pixels, int width, int height)
{
Image image = { 0 };
image.data = NULL;
image.width = width;
image.height = height;
image.mipmaps = 1;
image.format = UNCOMPRESSED_R8G8B8A8;
int k = 0;
image.data = (unsigned char *)RL_MALLOC(image.width*image.height*4*sizeof(unsigned char));
for (int i = 0; i < image.width*image.height*4; i += 4)
{
((unsigned char *)image.data)[i] = pixels[k].r;
((unsigned char *)image.data)[i + 1] = pixels[k].g;
((unsigned char *)image.data)[i + 2] = pixels[k].b;
((unsigned char *)image.data)[i + 3] = pixels[k].a;
k++;
}
return image;
}
// Load an image from RAW file data // Load an image from RAW file data
Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize) Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize)
{ {
@ -363,6 +333,46 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
return image; return image;
} }
// Load animated image data
// - Image.data buffer includes all frames: [image#0][image#1][image#2][...]
// - Number of frames is returned through 'frames' parameter
// - All frames are returned in RGBA format
// - Frames delay data is discarded
Image LoadImageAnim(const char *fileName, int *frames)
{
Image image = { 0 };
int framesCount = 1;
#if defined(SUPPORT_FILEFORMAT_GIF)
if (IsFileExtension(fileName, ".gif"))
{
unsigned int dataSize = 0;
unsigned char *fileData = LoadFileData(fileName, &dataSize);
if (fileData != NULL)
{
int comp = 0;
int **delays = NULL;
image.data = stbi_load_gif_from_memory(fileData, dataSize, delays, &image.width, &image.height, &framesCount, &comp, 4);
image.mipmaps = 1;
image.format = UNCOMPRESSED_R8G8B8A8;
RL_FREE(fileData);
RL_FREE(delays); // NOTE: Frames delays are discarded
}
}
#else
if (false) { }
#endif
else image = LoadImage(fileName);
// TODO: Support APNG animated images?
*frames = framesCount;
return image;
}
// Unload image from CPU memory (RAM) // Unload image from CPU memory (RAM)
void UnloadImage(Image image) void UnloadImage(Image image)
{ {
@ -932,7 +942,7 @@ void ImageFormat(Image *image, int newFormat)
r = (unsigned char)(round(pixels[i].x*31.0f)); r = (unsigned char)(round(pixels[i].x*31.0f));
g = (unsigned char)(round(pixels[i].y*31.0f)); g = (unsigned char)(round(pixels[i].y*31.0f));
b = (unsigned char)(round(pixels[i].z*31.0f)); b = (unsigned char)(round(pixels[i].z*31.0f));
a = (pixels[i].w > ((float)R5G5B5A1_ALPHA_THRESHOLD/255.0f))? 1 : 0; a = (pixels[i].w > ((float)UNCOMPRESSED_R5G5B5A1_ALPHA_THRESHOLD/255.0f))? 1 : 0;
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a; ((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a;
} }
@ -2351,7 +2361,7 @@ void ImageDrawPixel(Image *dst, int x, int y, Color color)
unsigned char r = (unsigned char)(round(coln.x*31.0f)); unsigned char r = (unsigned char)(round(coln.x*31.0f));
unsigned char g = (unsigned char)(round(coln.y*31.0f)); unsigned char g = (unsigned char)(round(coln.y*31.0f));
unsigned char b = (unsigned char)(round(coln.z*31.0f)); unsigned char b = (unsigned char)(round(coln.z*31.0f));
unsigned char a = (coln.w > ((float)R5G5B5A1_ALPHA_THRESHOLD/255.0f))? 1 : 0;; unsigned char a = (coln.w > ((float)UNCOMPRESSED_R5G5B5A1_ALPHA_THRESHOLD/255.0f))? 1 : 0;;
((unsigned short *)dst->data)[y*dst->width + x] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a; ((unsigned short *)dst->data)[y*dst->width + x] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a;
@ -3543,26 +3553,26 @@ Color GetPixelColor(void *srcPtr, int format)
case UNCOMPRESSED_GRAY_ALPHA: col = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1] }; break; case UNCOMPRESSED_GRAY_ALPHA: col = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1] }; break;
case UNCOMPRESSED_R5G6B5: case UNCOMPRESSED_R5G6B5:
{ {
col.r = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 11)*31)/255); col.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255/31);
col.g = (unsigned char)((((((unsigned short *)srcPtr)[0] >> 5) & 0b0000000000111111)*63)/255); col.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 5) & 0b0000000000111111)*255/63);
col.b = (unsigned char)(((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*31)/255); col.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255/31);
col.a = 255; col.a = 255;
} break; } break;
case UNCOMPRESSED_R5G5B5A1: case UNCOMPRESSED_R5G5B5A1:
{ {
col.r = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 11)*31)/255); col.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255/31);
col.g = (unsigned char)((((((unsigned short *)srcPtr)[0] >> 6) & 0b0000000000011111)*31)/255); col.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 6) & 0b0000000000011111)*255/31);
col.b = (unsigned char)(((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*31)/255); col.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255/31);
col.a = (((unsigned short *)srcPtr)[0] & 0b0000000000000001)? 255 : 0; col.a = (((unsigned short *)srcPtr)[0] & 0b0000000000000001)? 255 : 0;
} break; } break;
case UNCOMPRESSED_R4G4B4A4: case UNCOMPRESSED_R4G4B4A4:
{ {
col.r = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 12)*15)/255); col.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 12)*255/15);
col.g = (unsigned char)((((((unsigned short *)srcPtr)[0] >> 8) & 0b0000000000001111)*15)/255); col.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 8) & 0b0000000000001111)*255/15);
col.b = (unsigned char)((((((unsigned short *)srcPtr)[0] >> 4) & 0b0000000000001111)*15)/255); col.b = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 4) & 0b0000000000001111)*255/15);
col.a = (unsigned char)(((((unsigned short *)srcPtr)[0] & 0b0000000000001111)*15)/255); col.a = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000001111)*255/15);
} break; } break;
case UNCOMPRESSED_R8G8B8A8: col = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1], ((unsigned char *)srcPtr)[2], ((unsigned char *)srcPtr)[3] }; break; case UNCOMPRESSED_R8G8B8A8: col = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1], ((unsigned char *)srcPtr)[2], ((unsigned char *)srcPtr)[3] }; break;
@ -3620,7 +3630,7 @@ void SetPixelColor(void *dstPtr, Color color, int format)
unsigned char r = (unsigned char)(round(coln.x*31.0f)); unsigned char r = (unsigned char)(round(coln.x*31.0f));
unsigned char g = (unsigned char)(round(coln.y*31.0f)); unsigned char g = (unsigned char)(round(coln.y*31.0f));
unsigned char b = (unsigned char)(round(coln.z*31.0f)); unsigned char b = (unsigned char)(round(coln.z*31.0f));
unsigned char a = (coln.w > ((float)R5G5B5A1_ALPHA_THRESHOLD/255.0f))? 1 : 0;; unsigned char a = (coln.w > ((float)UNCOMPRESSED_R5G5B5A1_ALPHA_THRESHOLD/255.0f))? 1 : 0;;
((unsigned short *)dstPtr)[0] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a; ((unsigned short *)dstPtr)[0] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a;
@ -3706,34 +3716,6 @@ int GetPixelDataSize(int width, int height, int format)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Definition // Module specific Functions Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_GIF)
// Load animated GIF data
// - Image.data buffer includes all frames: [image#0][image#1][image#2][...]
// - Number of frames is returned through 'frames' parameter
// - Frames delay is returned through 'delays' parameter (int array)
// - All frames are returned in RGBA format
static Image LoadAnimatedGIF(const char *fileName, int *frames, int **delays)
{
Image image = { 0 };
unsigned int dataSize = 0;
unsigned char *fileData = LoadFileData(fileName, &dataSize);
if (fileData != NULL)
{
int comp = 0;
image.data = stbi_load_gif_from_memory(fileData, dataSize, delays, &image.width, &image.height, frames, &comp, 4);
image.mipmaps = 1;
image.format = UNCOMPRESSED_R8G8B8A8;
RL_FREE(fileData);
}
return image;
}
#endif
#if defined(SUPPORT_FILEFORMAT_DDS) #if defined(SUPPORT_FILEFORMAT_DDS)
// Loading DDS image data (compressed or uncompressed) // Loading DDS image data (compressed or uncompressed)
static Image LoadDDS(const char *fileName) static Image LoadDDS(const char *fileName)

Some files were not shown because too many files have changed in this diff Show More