Compare commits

...
This repository has been archived on 2025-06-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.

89 commits
master ... sdl

Author SHA1 Message Date
Richard Smith
6820db28c6 update to fixed raylib version 2024-11-19 11:41:33 +00:00
Richard Smith
f2d9201159 dont link x11 if using DRM 2024-11-18 13:58:25 +00:00
Richard Smith
581cda51dc update to 5.5 2024-11-18 13:28:44 +00:00
Richard Smith
4e0a89162b Merge remote-tracking branch 'origin/master' into sdl
# Conflicts:
#	create_stub_pyray.py
#	docs/README.html
#	docs/genindex.html
#	docs/objects.inv
#	docs/pyray.html
#	docs/raylib.html
#	docs/searchindex.js
#	dynamic/raylib/defines.py
#	make_docs.sh
#	pyray/__init__.pyi
#	raylib/__init__.pyi
#	raylib/defines.py
#	version.py
2024-11-18 13:16:50 +00:00
Richard Smith
96d620382c Merge branch 'master' into sdl
# Conflicts:
#	version.py
2024-10-24 17:43:45 +01:00
Richard Smith
1817fec006 try 2024-10-17 15:58:59 +01:00
Richard Smith
cfad3eacaa try 2024-10-17 11:31:56 +01:00
Richard Smith
e01bdb3b78 try 2024-10-17 11:25:56 +01:00
Richard Smith
509771f482 try 2024-10-16 22:11:02 +01:00
Richard Smith
3d8f36e9c7 try 2024-10-16 22:02:23 +01:00
Richard Smith
9683c579c3 try 2024-10-16 19:16:54 +01:00
Richard Smith
e97135eb8c try 2024-10-16 19:03:30 +01:00
Richard Smith
5dafa4e99a try 2024-10-16 14:22:45 +01:00
Richard Smith
be6cf57d85 try 2024-10-16 13:49:19 +01:00
Richard Smith
62ff73d0e7 try 2024-10-16 12:11:34 +01:00
Richard Smith
4670e271ca try 2024-10-16 11:21:40 +01:00
Richard Smith
adbcdce416 try 2024-10-16 03:06:52 +01:00
Richard Smith
3269b0cb9b try 2024-10-16 02:59:35 +01:00
Richard Smith
d17d3abb92 try 2024-10-16 02:44:36 +01:00
Richard Smith
b0da316441 try 2024-10-16 02:30:45 +01:00
Richard Smith
2154d36b41 update raylib 2024-10-16 02:19:24 +01:00
Richard Smith
b3ff23e6cf try 2024-10-16 01:59:21 +01:00
Richard Smith
fb3f3f9b22 try 2024-10-16 01:57:56 +01:00
Richard Smith
b8231d23b8 try 2024-10-16 01:44:19 +01:00
Richard Smith
29f5f42af7 try 2024-10-16 01:20:35 +01:00
Richard Smith
b14d0a2b3c try 2024-10-16 00:58:26 +01:00
Richard Smith
cadf3d1f0c try 2024-10-16 00:53:49 +01:00
Richard Smith
3c7289c844 try 2024-10-16 00:30:04 +01:00
Richard Smith
0bf9138122 try 2024-10-16 00:22:22 +01:00
Richard Smith
447b17446f try 2024-10-16 00:18:19 +01:00
Richard Smith
a11016ba34 try 2024-10-16 00:07:25 +01:00
Richard Smith
7899b51bbd try 2024-10-16 00:00:10 +01:00
Richard Smith
3314597eed try 2024-10-15 23:47:34 +01:00
Richard Smith
391e600693 try 2024-10-15 23:41:36 +01:00
Richard Smith
05ada5fa0d try 2024-10-15 21:00:59 +01:00
Richard Smith
10692d5168 try 2024-10-15 20:29:41 +01:00
Richard Smith
7e2da775ae try 2024-10-15 19:51:44 +01:00
Richard Smith
35c457ef7d try 2024-10-15 19:44:20 +01:00
Richard Smith
05c455b17f try 2024-10-15 19:43:04 +01:00
Richard Smith
3b0238c61d try 2024-10-15 19:28:21 +01:00
Richard Smith
05e71eae62 try 2024-10-15 19:22:58 +01:00
Richard Smith
1b73f0f8b0 try 2024-10-15 19:14:25 +01:00
Richard Smith
1f172355d3 try 2024-10-15 19:12:08 +01:00
Richard Smith
e692b7ce99 try 2024-10-15 18:57:55 +01:00
Richard Smith
7f05708aad try 2024-10-15 18:47:47 +01:00
Richard Smith
30913ef51a try 2024-10-15 18:25:57 +01:00
Richard Smith
afa5ae9463 try 2024-10-15 18:18:11 +01:00
Richard Smith
a5cb5ab6ed try 2024-10-15 18:12:09 +01:00
Richard Smith
c98bdcd961 try 2024-10-15 17:44:42 +01:00
Richard Smith
65f89be6ee try 2024-10-15 17:32:19 +01:00
Richard Smith
467263a43d try 2024-10-15 17:07:26 +01:00
Richard Smith
2ffd22435a try 2024-10-15 16:54:32 +01:00
Richard Smith
730c9d4643 try 2024-10-15 16:29:30 +01:00
Richard Smith
4c4c17d0de try 2024-10-15 16:23:03 +01:00
Richard Smith
cbdba24ff2 try 2024-10-14 19:41:34 +01:00
Richard Smith
7793b056a0 try 2024-10-14 19:35:17 +01:00
Richard Smith
5fc35c919d try 2024-10-14 19:01:12 +01:00
Richard Smith
fb417dbf71 try 2024-10-14 18:48:15 +01:00
Richard Smith
22f624d7ca try mac 2024-10-13 18:26:29 +01:00
Richard Smith
19ab15d89e try mac 2024-10-13 18:20:06 +01:00
Richard Smith
9d14fbfb23 try mac 2024-10-13 18:13:37 +01:00
Richard Smith
192d2031a7 try mac 2024-10-13 18:06:42 +01:00
richard
ac5b6b95e1 try 2024-10-12 16:32:08 +01:00
richard
ea4b0a007d try 2024-10-12 16:21:46 +01:00
Richard Smith
d0330043c1 try 2024-10-11 18:14:10 +01:00
Richard Smith
edb2d55aa6 try 2024-10-11 18:08:26 +01:00
Richard Smith
b3d05efd05 try 2024-10-11 18:01:43 +01:00
Richard Smith
d693a846ce try 2024-10-11 17:52:39 +01:00
Richard Smith
e2f8b4fb11 try 2024-10-11 17:48:32 +01:00
Richard Smith
6286a2cf66 try 2024-10-11 17:46:08 +01:00
Richard Smith
ecc3c08a45 try 2024-10-11 17:43:40 +01:00
Richard Smith
7323343ada try 2024-10-11 17:40:35 +01:00
Richard Smith
d8647daafa try 2024-10-11 17:39:11 +01:00
Richard Smith
452881e916 try 2024-10-11 17:33:25 +01:00
Richard Smith
c12365d448 try 2024-10-11 17:27:38 +01:00
Richard Smith
4a787f1c71 fix 2024-10-09 19:02:03 +01:00
Richard Smith
55a0d150c4 windows 2024-10-09 18:53:45 +01:00
Richard Smith
957584a9d4 install alsa etc before building sdl 2024-09-24 23:56:31 +01:00
Richard Smith
8db9563c53 try to set fpic 2024-09-24 23:29:29 +01:00
Richard Smith
216c4696f2 try static sdl build 2024-09-24 23:23:30 +01:00
Richard Smith
a9f2884f39 remove glfw header 2024-09-24 19:00:36 +01:00
Richard Smith
dad06219c3 sdl2 link flags 2024-09-20 19:30:14 +01:00
Richard Smith
0bf42b291e sdl dl 2024-09-20 19:10:51 +01:00
Richard Smith
dd9916a8f8 sdl dl 2024-09-20 19:07:23 +01:00
Richard Smith
0a0ceea1dd sdl 2024-09-20 18:48:53 +01:00
Richard Smith
6b7cffe86f add libxkbcommon-dev 2024-09-20 18:40:56 +01:00
Richard Smith
9b81a6d699 update headers 2024-09-20 18:36:17 +01:00
Richard Smith
a48757b815 add libwayland-dev 2024-09-20 18:30:26 +01:00
Richard Smith
271c6e1aeb latest raylib version 2024-09-20 18:25:27 +01:00
46 changed files with 4069 additions and 1472 deletions

View file

@ -4,21 +4,45 @@
pi_task: pi_task:
arm_container: arm_container:
matrix: matrix:
- image: dtcooper/raspberrypi-os:python-bullseye - image: dtcooper/raspberrypi-os:python3.12-bullseye
- image: dtcooper/raspberrypi-os:python3.11-bullseye - image: dtcooper/raspberrypi-os:python3.11-bullseye
- image: dtcooper/raspberrypi-os:python3.10-bullseye - image: dtcooper/raspberrypi-os:python3.10-bullseye
- image: dtcooper/raspberrypi-os:python3.9-bullseye - image: dtcooper/raspberrypi-os:python3.9-bullseye
env:
matrix:
- RAYLIB_PLATFORM: "Desktop"
RAYLIB_OPENGL: "2.1"
- RAYLIB_PLATFORM: "SDL"
RAYLIB_OPENGL: "2.1"
- RAYLIB_PLATFORM: "DRM"
RAYLIB_OPENGL: "ES 2.0"
setup_script: setup_script:
- apt update - apt update
- apt -y install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev - apt -y install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev libgbm-dev libdrm-dev
build_sdl_script:
- wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
- tar xvfz release-2.30.7.tar.gz
- mkdir buildsdl
- cd buildsdl
- cmake ../SDL-release-2.30.7 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
- cmake --build . --config Release
- cmake --install .
- cd ..
build_raylib_script: build_raylib_script:
- git submodule update --init --recursive - git submodule update --init --recursive
- cd raylib-c - cd raylib-c
- mkdir build - mkdir build
- cd build - cd build
- cmake -DPLATFORM="Desktop" -DOPENGL_VERSION=2.1 -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release .. - cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
- make -j2 - make -j2
- make install - make install
build_raylib_again_script:
- cd raylib-c
- mkdir build2
- cd build2
- cmake -DPLATFORM=${RAYLIB_PLATFORM} -DOPENGL_VERSION="${RAYLIB_OPENGL}" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
- make -j2
- cp raylib/libraylib.a /usr/local/lib/libraylib.a
build_script: build_script:
- cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/ - cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
- cp physac/src/physac.h /usr/local/include/ - cp physac/src/physac.h /usr/local/include/
@ -28,6 +52,18 @@ pi_task:
- python -m pip install --break-system-packages setuptools - python -m pip install --break-system-packages setuptools
- python -m pip install --break-system-packages wheel - python -m pip install --break-system-packages wheel
- python setup.py bdist_wheel --plat-name manylinux2014_aarch64 - python setup.py bdist_wheel --plat-name manylinux2014_aarch64
test_script:
- python -m pip install --break-system-packages dist/*.whl
- cd /
- python -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
- cat /tmp/output
- if grep -q "INFO: Initializing raylib" /tmp/output; then
- echo "Passed"
- exit 0
- else
- echo "Failed"
- exit 1
- fi
artifacts: artifacts:
path: "dist/*" path: "dist/*"
@ -36,14 +72,46 @@ mac_task:
matrix: matrix:
- image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest - image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest
env: env:
matrix: MACOSX_DEPLOYMENT_TARGET: "11.0"
- PY_VER: "3.9" matrix:
- PY_VER: "3.10" - env:
- PY_VER: "3.11" PY_VER: "3.9"
- PY_VER: "3.12" RAYLIB_PLATFORM: Desktop
- env:
PY_VER: "3.9"
RAYLIB_PLATFORM: SDL
- env:
PY_VER: "3.10"
RAYLIB_PLATFORM: Desktop
- env:
PY_VER: "3.10"
RAYLIB_PLATFORM: SDL
- env:
PY_VER: "3.11"
RAYLIB_PLATFORM: Desktop
- env:
PY_VER: "3.12"
RAYLIB_PLATFORM: SDL
- env:
PY_VER: "3.13"
RAYLIB_PLATFORM: Desktop
- env:
PY_VER: "3.13"
RAYLIB_PLATFORM: SDL
setup_script: setup_script:
- brew update - brew update
- brew install python@${PY_VER} - brew install python@${PY_VER}
build_sdl_script:
- wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
- tar xvfz release-2.30.7.tar.gz
- mkdir buildsdl
- cd buildsdl
- cmake ../SDL-release-2.30.7 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
- cmake --build . --config Release
- sudo cmake --install .
- cd ..
build_raylib_script: build_raylib_script:
- git submodule update --init --recursive - git submodule update --init --recursive
- cd raylib-c - cd raylib-c
@ -52,6 +120,13 @@ mac_task:
- cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release .. - cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
- make -j8 - make -j8
- sudo make install - sudo make install
build_raylib_again_script:
- cd raylib-c
- mkdir build2
- cd build2
- cmake -DPLATFORM=${RAYLIB_PLATFORM} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
- make -j8
- sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
build_script: build_script:
- sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/ - sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
- sudo cp physac/src/physac.h /usr/local/include/ - sudo cp physac/src/physac.h /usr/local/include/
@ -61,5 +136,17 @@ mac_task:
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages setuptools - /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages setuptools
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages wheel - /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages wheel
- /opt/homebrew/bin/python${PY_VER} setup.py bdist_wheel - /opt/homebrew/bin/python${PY_VER} setup.py bdist_wheel
test_script:
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages dist/*.whl
- cd /
- /opt/homebrew/bin/python${PY_VER} -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
- cat /tmp/output
- if grep -q "INFO: Initializing raylib" /tmp/output; then
- echo "Passed"
- exit 0
- else
- echo "Failed"
- exit 1
- fi
artifacts: artifacts:
path: "dist/*" path: "dist/*"

View file

@ -4,28 +4,39 @@ name: Build
on: on:
# Triggers the workflow on push or pull request events but only for the master branch # Triggers the workflow on push or pull request events but only for the master branch
push: push:
branches: [ master ]
pull_request: pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build-mac: build-mac-intel:
runs-on: macos-12 runs-on: macos-12
strategy: strategy:
matrix: matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-beta - 3.13.0', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ] python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10' ]
raylib-platform: ['Desktop', 'SDL']
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
tar xvfz release-2.30.7.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.30.7 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2.2.2 uses: actions/setup-python@v5
with: with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax. # Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
@ -33,7 +44,7 @@ jobs:
architecture: x64 architecture: x64
# Runs a set of commands using the runners shell # Runs a set of commands using the runners shell
- name: Build raylib - name: Build raylib without SDL because SDL version has incorrect pkg-config
run: | run: |
cd raylib-c cd raylib-c
mkdir build mkdir build
@ -42,6 +53,15 @@ jobs:
make -j2 make -j2
sudo make install sudo make install
- name: Build raylib with SDL if selected
run: |
cd raylib-c
mkdir build2
cd build2
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
- name: Copy extras - name: Copy extras
run: | run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/ sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
@ -49,12 +69,28 @@ jobs:
sudo cp raygui/src/raygui.h /usr/local/include/ sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi - name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1" pip3 install "cffi>=1.17.1"
pip3 install wheel pip3 install wheel
pip3 install setuptools pip3 install setuptools
python setup.py bdist_wheel --plat-name macosx_10_15_x86_64 python setup.py bdist_wheel --plat-name macosx_10_13_x86_64
- name: Test
run: |
pip3 install dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel - name: Upload build Artifact wheel
uses: actions/upload-artifact@v3.2.1 uses: actions/upload-artifact@v3.2.1
@ -62,37 +98,76 @@ jobs:
name: wheel name: wheel
path: dist/* path: dist/*
# build-mac-universal:
# build-mac12-arm64: # runs-on: macos-14
# runs-on: macos-12
# strategy: # strategy:
# matrix: # matrix:
# python-version: ['3.10', '3.11.0-alpha - 3.11.0' ] # python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ]
# # Requires universal2 build of python, which we get if we ask for 3.10.5 x86! Pypy not available in universal2 # raylib-platform: ['Desktop', 'SDL']
# env:
# MACOSX_DEPLOYMENT_TARGET: 11.0
# steps: # steps:
# - uses: actions/checkout@v2 # # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v4
# with: # with:
# submodules: recursive # submodules: recursive
# #
# - name: Setup Python # - name: Build SDL
# uses: actions/setup-python@v2.2.2 # run: |
# with: # wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
# python-version: ${{ matrix.python-version }} # tar xvfz release-2.30.7.tar.gz
# architecture: x64 # mkdir build
# cd build
# cmake ../SDL-release-2.30.7 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
# cmake --build . --config Release
# sudo cmake --install .
# #
# # Only build raylib for arm64 (although we could make a fat universal2 binary by asking for x86_64 as well) # - name: Setup Python
# - name: Build raylib # uses: actions/setup-python@v5
# with:
# # Version range or exact version of a Python version to use, using SemVer's version range syntax.
# python-version: ${{ matrix.python-version }}
# architecture: arm64
#
# # Runs a set of commands using the runners shell
# - name: Build raylib without SDL because SDL version has incorrect pkg-config
# run: | # run: |
# cd raylib-c # cd raylib-c
# mkdir build # mkdir build
# cd build # cd build
# cmake -DBUILD_EXAMPLES=off -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release .. # cmake -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
# make -j2 # make -j2
# sudo make install # sudo make install
#
# - name: Build raylib with SDL if selected
# run: |
# cd raylib-c
# mkdir build2
# cd build2
# cmake -DPLATFORM=${{ matrix.raylib-platform }} -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DPLATFORM=SDL -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
# make -j2
# sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
#
# - name: Copy extras # - name: Copy extras
# run: | # run: |
# sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
# sudo cp physac/src/physac.h /usr/local/include/ # sudo cp physac/src/physac.h /usr/local/include/
# sudo cp raygui/src/raygui.h /usr/local/include/ # sudo cp raygui/src/raygui.h /usr/local/include/
#
# - name: Build raylib-python-cffi
# run: |
# python -m pip install --upgrade pip
# pip3 install "cffi>=1.17.1"
# pip3 install wheel
# pip3 install setuptools
# RAYLIB_PLATFORM=${{ matrix.raylib-platform }} python setup.py bdist_wheel
#
# - name: Upload build Artifact wheel
# uses: actions/upload-artifact@v3.2.1
# with:
# name: wheel
# path: dist/*
# #
# # Name defaults to universal2 and it technically is, but we override name to arm64. Why don't we make a working universal2 wheel? Because # # Name defaults to universal2 and it technically is, but we override name to arm64. Why don't we make a working universal2 wheel? Because
# # I'd rather have a separate x86_64 that I can test, and I want it to work on 10_15 but I'm not sure a 'macosx_10_15_universal2' is valid # # I'd rather have a separate x86_64 that I can test, and I want it to work on 10_15 but I'm not sure a 'macosx_10_15_universal2' is valid
@ -103,62 +178,7 @@ jobs:
# pip3 install cffi # pip3 install cffi
# pip3 install wheel # pip3 install wheel
# python setup.py bdist_wheel --plat-name macosx_12_0_arm64 # python setup.py bdist_wheel --plat-name macosx_12_0_arm64
#
#
# - name: Upload build Artifact wheel
# uses: actions/upload-artifact@v3.2.1
# with:
# name: wheel
# path: dist/*
#
#
# build-mac11-arm64:
# runs-on: macos-11
# strategy:
# matrix:
# python-version: [ '3.10.5' ]
# # Requires universal2 build of python, which we get if we ask for 3.10.5 x86! Pypy not available in universal2
# env:
# MACOSX_DEPLOYMENT_TARGET: 11.6
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: recursive
#
# - name: Setup Python
# uses: actions/setup-python@v2.2.2
# with:
# python-version: ${{ matrix.python-version }}
# architecture: x64
#
# # build raylib for arm64 and x86_64 as well
# - name: Build raylib
# run: |
# cd raylib-c
# mkdir build
# cd build
# cmake -DBUILD_EXAMPLES=off -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
# make -j2
# sudo make install
# - name: Copy extras
# run: |
# sudo cp physac/src/physac.h /usr/local/include/
# sudo cp raygui/src/raygui.h /usr/local/include/
#
#
# - name: Build raylib-python-cffi
# run: |
# python -m pip install --upgrade pip
# pip3 install cffi
# pip3 install wheel
# python setup.py bdist_wheel --plat-name macosx_11_0_arm64
#
# - name: Upload build Artifact wheel
# uses: actions/upload-artifact@v3.2.1
# with:
# name: wheel
# path: dist/*
#
build-linux: build-linux:
@ -167,30 +187,43 @@ jobs:
# You can use PyPy versions in python-version. # You can use PyPy versions in python-version.
# For example, pypy2 and pypy3 # For example, pypy2 and pypy3
matrix: matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-beta - 3.13.0', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ] python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10' ]
raylib-platform: ['Desktop', 'SDL', 'DRM']
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2.2.2 uses: actions/setup-python@v5
with: with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax. # Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter. # The target architecture (x86, x64) of the Python interpreter.
architecture: x64 architecture: x64
- name: install prereqs
run: |
sudo apt update
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
tar xvfz release-2.30.7.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.30.7 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
# Runs a set of commands using the runners shell # Runs a set of commands using the runners shell
- name: Build raylib - name: Build raylib
run: | run: |
sudo apt update
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
cd raylib-c cd raylib-c
mkdir build mkdir build
cd build cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release -DOpenGL_GL_PREFERENCE=GLVND .. cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release -DOpenGL_GL_PREFERENCE=GLVND ..
make -j2 make -j2
sudo make install sudo make install
- name: Copy extras - name: Copy extras
@ -199,12 +232,28 @@ jobs:
sudo cp physac/src/physac.h /usr/local/include/ sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/ sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi - name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1" pip3 install "cffi>=1.17.1"
pip3 install wheel pip3 install wheel
pip3 install setuptools pip3 install setuptools
python setup.py bdist_wheel --plat-name manylinux2014_x86_64 python setup.py bdist_wheel --plat-name manylinux2014_x86_64
- name: Test
run: |
pip3 install dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel - name: Upload build Artifact wheel
uses: actions/upload-artifact@v3.2.1 uses: actions/upload-artifact@v3.2.1
@ -213,36 +262,7 @@ jobs:
path: dist/* path: dist/*
# build-rpi:
# runs-on: rpi
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v2
# with:
# submodules: recursive
#
# - name: Build raylib
# run: |
# cd raylib-c
# mkdir build
# cd build
# cmake -DBUILD_EXAMPLES=off -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release -DOpenGL_GL_PREFERENCE=GLVND ..
# make -j2
# make install
# - name: Copy extras
# run: |
# cp physac/src/physac.h /usr/local/include/
# cp raygui/src/raygui.h /usr/local/include/
#
# - name: Build raylib-python-cffi
# run: |
# python3 setup.py bdist_wheel
#
# - name: Upload build Artifact wheel
# uses: actions/upload-artifact@v3.2.1
# with:
# name: wheel
# path: dist/*
build-windows: build-windows:
# The type of runner that the job will run on # The type of runner that the job will run on
@ -251,15 +271,27 @@ jobs:
# You can use PyPy versions in python-version. # You can use PyPy versions in python-version.
# For example, pypy2 and pypy3 # For example, pypy2 and pypy3
matrix: matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-beta - 3.13.0', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ] python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10' ]
raylib-platform: ['Desktop', 'SDL']
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4
- uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- name: Download SDL2
run: curl -L -o SDL2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.30.8/SDL2-devel-2.30.8-VC.zip
- name: Create extraction directory
run: mkdir ${{ runner.temp }}\SDL2
- name: Unzip SDL2
run: tar -xf SDL2.zip -C ${{ runner.temp }}\SDL2 --strip-components=1
- name: Set SDL2_DIR environment variable
run: echo SDL2_DIR=${{ runner.temp }}\SDL2\cmake >> $env:GITHUB_ENV
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2.2.2 uses: actions/setup-python@v5
with: with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax. # Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
@ -274,14 +306,18 @@ jobs:
cd raylib-c cd raylib-c
mkdir build mkdir build
cd build cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release .. cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\.. copy raylib\Release\raylib.lib ..\..
cd ..\.. cd ..\..
shell: cmd shell: cmd
- name: Build raylib-python-cffi - name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: | run: |
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.lib .
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.dll raylib\
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1" pip3 install "cffi>=1.17.1"
pip3 install wheel pip3 install wheel
@ -292,6 +328,21 @@ jobs:
del raylib\dynamic\32bit\* >nul 2>&1 del raylib\dynamic\32bit\* >nul 2>&1
python setup.py bdist_wheel python setup.py bdist_wheel
shell: cmd shell: cmd
- name: Test
shell: bash
run: |
pip3 install --no-deps dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel - name: Upload build Artifact wheel
uses: actions/upload-artifact@v3.2.1 uses: actions/upload-artifact@v3.2.1
@ -304,12 +355,12 @@ jobs:
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2.2.2 uses: actions/setup-python@v5
with: with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax. # Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: '3.12' python-version: '3.12'
@ -319,7 +370,7 @@ jobs:
- name: Build raylib - name: Build raylib
run: | run: |
sudo apt update sudo apt update
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
cd raylib-c cd raylib-c
mkdir build mkdir build
cd build cd build
@ -351,12 +402,12 @@ jobs:
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2.2.2 uses: actions/setup-python@v5
with: with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax. # Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: '3.12' python-version: '3.12'

View file

@ -38,7 +38,7 @@ project.
If the Pip build doesnt work, please submit a bug. (And if you have If the Pip build doesnt work, please submit a bug. (And if you have
fixed it, a PR.) fixed it, a PR.)
Manual instructions follow, but may be outdated, so see also how we actually build the wheels Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml
Windows manual build Windows manual build

View file

@ -2,6 +2,7 @@ include raylib/*.so
include raylib/*.pyi include raylib/*.pyi
include pyray/*.pyi include pyray/*.pyi
include raylib/*.pyd include raylib/*.pyd
include raylib/*.dll
exclude raylib/*.a exclude raylib/*.a
include raylib/*.h include raylib/*.h
include raylib/*.h.modified include raylib/*.h.modified

102
README.md
View file

@ -1,6 +1,8 @@
# Python Bindings for Raylib 5.0 # Python Bindings for Raylib 5.5
## Libraries: raymath, raygui, rlgl, physac and GLFW
## Backends: Desktop, SDL, DRM, Web
Chatroom: [Discord](https://discord.gg/fKDwt85aX6) or [Matrix](https://matrix.to/#/#raylib-python-cffi:matrix.org) Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
New CFFI API static bindings. New CFFI API static bindings.
* Automatically generated to be as close as possible to * Automatically generated to be as close as possible to
@ -8,23 +10,23 @@ original Raylib.
* Faster, fewer bugs and easier to maintain than ctypes. * Faster, fewer bugs and easier to maintain than ctypes.
* Commercial-friendly license. * Commercial-friendly license.
* Docstrings and auto-completion. * Docstrings and auto-completion.
* **Now includes extra libraries: raymath, raygui, rlgl, physac and GLFW**
[Full documentation](http://electronstudio.github.io/raylib-python-cffi) [Full documentation](http://electronstudio.github.io/raylib-python-cffi)
# Quickstart # Quickstart
`pip3 install raylib` `pip3 install raylib==5.0.0.4`
```python
from pyray import * from pyray import *
init_window(800, 450, "Hello") init_window(800, 450, "Hello")
while not window_should_close(): while not window_should_close():
begin_drawing() begin_drawing()
clear_background(WHITE) clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET) draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing() end_drawing()
close_window() close_window()
```
# Installation # Installation
@ -35,13 +37,41 @@ First make sure you have the latest pip installed:
Then install Then install
python3 -m pip install setuptools python3 -m pip install setuptools
python3 -m pip install raylib python3 -m pip install raylib==5.0.0.4
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 12 x64/arm64, Linux Ubuntu2004 x64/arm64). On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
source, in which case you will need to have Raylib development libs installed, e.g.
If yours isn't available then pip will attempt to build from source, in which case you will need to have Raylib development libs installed, e.g.
using homebrew, apt, etc. using homebrew, apt, etc.
## Windows
Binaries require x64 Windows 10 or newer. (For x86 or older Windows you will have to build from source.)
Use an [official Windows Python release](https://www.python.org/downloads/windows/) rather than WSL, MSYS, etc.
## MacOS
Binaries require:
* arm64 MacOS 14
* x64 MacOS 10.13, or newer.
Older MacOS requires building from source but this is usually simple:
brew install pkg-config
brew install raylib
python3 -m pip install raylib==5.0.0.4
(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
if you want to test them.)
## Linux
Binaries require OS newer than Ubuntu 2020, x64 or arm64. Otherwise build from source.
(Pip should attempt automatically but will need Raylib itself installed and also pkg-config.)
The arm64 binaries are built on Raspberry Pi arm64 Bullseye with OpenGL 2.0
so may not work on other boards.
## Raspberry Pi ## Raspberry Pi
[Using on Rasperry Pi](RPI.rst) [Using on Rasperry Pi](RPI.rst)
@ -50,38 +80,52 @@ using homebrew, apt, etc.
There is now a separate dynamic version of this binding: There is now a separate dynamic version of this binding:
python3 -m pip uninstall raylib
python3 -m pip install raylib_dynamic python3 -m pip install raylib_dynamic
It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html) It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
## Beta testing ## SDL backend
If you find a bug, it may be fixed in the [latest dev release](https://github.com/electronstudio/raylib-python-cffi/releases). This is not well tested but has better support for controllers:
You can install an alpha or beta version by specifying the exact version number like this:
python3 -m pip install raylib==4.2.0.0.dev4 python3 -m pip uninstall raylib
python3 -m pip install raylib_sdl
You can't have multiple raylib packages installed at once.
## DRM backend
This uses the Linux framebuffer for devices that don't run X11/Wayland:
python3 -m pip uninstall raylib
python3 -m pip install raylib_drm
You can't have multiple raylib packages installed at once.
## Problems? ## Problems?
If it doesn't work, [try to build manually.](BUILDING.rst). If that works then [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues) If it doesn't work, [try to build manually.](BUILDING.rst). If that works then [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues)
to let us know what you did. to let us know what you did.
If you need help you can try asking [on Discord](https://discord.gg/raylib). If you need help you can try asking on [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
for issues that are not Python-specific.
If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues). If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
# How to use # How to use
There are two APIs, you can use either or both: There are two modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
pyray). You can use either or both:
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API ### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
Use [the C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html). Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower ### If you prefer a more Pythonistic API
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html). Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
# Running in a web browser # Running in a web browser
@ -143,9 +187,9 @@ A related library (that is a work in progress!):
* Converting more examples from C to Python * Converting more examples from C to Python
* Testing on more platforms * Testing on more platforms
# License (updated) # License
The bindings are now under the Eclipse Public License, so you are free to Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects! statically link and use in non-free / proprietary / commercial projects!
# Performance # Performance

View file

@ -12,7 +12,10 @@ We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11
python -m pip install --break-system-packages raylib python -m pip install --break-system-packages raylib
If it doesn't work, or you're not on Bullseye, or you're 32 bit, or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib. See below. Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
installed at once.
If it doesn't work, or you're not on Bullseye, or you're 32 bit, you will need to compile your own raylib. See below.
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib. For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
Option 2: Compile Raylib from source X11 mode Option 2: Compile Raylib from source X11 mode
@ -39,7 +42,7 @@ Then have pip compile and install the wheel:
:: ::
python3 -m pip install --break-system-packages setuptools python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.3 python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.4
Option 3: Compile Raylib from source DRM mode Option 3: Compile Raylib from source DRM mode
--------------------------------------------- ---------------------------------------------
@ -82,7 +85,7 @@ Then have pip compile and install the wheel:
:: ::
python3 -m pip install --break-system-packages setuptools python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.3 python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.4

View file

@ -158,7 +158,7 @@ for struct in ffi.list_types()[0]:
# elif ffi.typeof(struct).kind == "enum": # elif ffi.typeof(struct).kind == "enum":
# print(f"{struct}: int") # print(f"{struct}: int")
else: else:
print("ERROR UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr) print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
print(""" print("""
LIGHTGRAY : Color LIGHTGRAY : Color

View file

@ -148,7 +148,7 @@ for struct in ffi.list_types()[0]:
elif ffi.typeof(struct).kind == "enum": elif ffi.typeof(struct).kind == "enum":
print(f"{struct} = int") print(f"{struct} = int")
else: else:
print("ERROR UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr) print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
print(""" print("""

View file

@ -56,7 +56,6 @@ Example program:
init_window(800, 450, "Raylib texture test") init_window(800, 450, "Raylib texture test")
... ...
(You don't need to use the PyRay() class anymore.)
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_ `See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_

View file

@ -45,7 +45,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current"> <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -53,7 +53,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
@ -127,7 +127,7 @@ project.</p>
<p>If the Pip build doesnt work, please submit a bug. (And if you have <p>If the Pip build doesnt work, please submit a bug. (And if you have
fixed it, a PR.)</p> fixed it, a PR.)</p>
</div> </div>
<p>Manual instructions follow, but may be outdated, so see also how we actually build the wheels <p>Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
at <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml">https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml</a></p> at <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml">https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml</a></p>
<section id="windows-manual-build"> <section id="windows-manual-build">
<h3>Windows manual build<a class="headerlink" href="#windows-manual-build" title="Link to this heading"></a></h3> <h3>Windows manual build<a class="headerlink" href="#windows-manual-build" title="Link to this heading"></a></h3>

View file

@ -6,7 +6,7 @@
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /> <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Bindings for Raylib 5.0 &mdash; Raylib Python documentation</title> <title>Python Bindings for Raylib 5.5 &mdash; Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" /> <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" /> <link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
@ -45,25 +45,33 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current"> <ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="#">Python Bindings for Raylib 5.5</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#libraries-raymath-raygui-rlgl-physac-and-glfw">Libraries: raymath, raygui, rlgl, physac and GLFW</a></li>
<li class="toctree-l2"><a class="reference internal" href="#backends-desktop-sdl-drm-web">Backends: Desktop, SDL, DRM, Web</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a><ul> <li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#macos">MacOS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#linux">Linux</a></li>
<li class="toctree-l2"><a class="reference internal" href="#raspberry-pi">Raspberry Pi</a></li> <li class="toctree-l2"><a class="reference internal" href="#raspberry-pi">Raspberry Pi</a></li>
<li class="toctree-l2"><a class="reference internal" href="#dynamic-binding-version">Dynamic binding version</a></li> <li class="toctree-l2"><a class="reference internal" href="#dynamic-binding-version">Dynamic binding version</a></li>
<li class="toctree-l2"><a class="reference internal" href="#beta-testing">Beta testing</a></li> <li class="toctree-l2"><a class="reference internal" href="#sdl-backend">SDL backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="#drm-backend">DRM backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="#problems">Problems?</a></li> <li class="toctree-l2"><a class="reference internal" href="#problems">Problems?</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="#how-to-use">How to use</a><ul> <li class="toctree-l1"><a class="reference internal" href="#how-to-use">How to use</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API</a></li> <li class="toctree-l2"><a class="reference internal" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API</a></li>
<li class="toctree-l2"><a class="reference internal" href="#if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">If you prefer a slightly more Pythonistic API and dont mind it might be slightly slower</a></li> <li class="toctree-l2"><a class="reference internal" href="#if-you-prefer-a-more-pythonistic-api">If you prefer a more Pythonistic API</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="#running-in-a-web-browser">Running in a web browser</a></li> <li class="toctree-l1"><a class="reference internal" href="#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="#performance">Performance</a><ul> <li class="toctree-l1"><a class="reference internal" href="#performance">Performance</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#bunnymark">Bunnymark</a></li> <li class="toctree-l2"><a class="reference internal" href="#bunnymark">Bunnymark</a></li>
</ul> </ul>
@ -91,7 +99,7 @@
<div role="navigation" aria-label="Page navigation"> <div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs"> <ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li> <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Python Bindings for Raylib 5.0</li> <li class="breadcrumb-item active">Python Bindings for Raylib 5.5</li>
<li class="wy-breadcrumbs-aside"> <li class="wy-breadcrumbs-aside">
<a href="_sources/README.md.txt" rel="nofollow"> View page source</a> <a href="_sources/README.md.txt" rel="nofollow"> View page source</a>
</li> </li>
@ -101,9 +109,14 @@
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody"> <div itemprop="articleBody">
<section id="python-bindings-for-raylib-5-0"> <section id="python-bindings-for-raylib-5-5">
<h1>Python Bindings for Raylib 5.0<a class="headerlink" href="#python-bindings-for-raylib-5-0" title="Link to this heading"></a></h1> <h1>Python Bindings for Raylib 5.5<a class="headerlink" href="#python-bindings-for-raylib-5-5" title="Link to this heading"></a></h1>
<p>Chatroom: <a class="reference external" href="https://discord.gg/fKDwt85aX6">Discord</a> or <a class="reference external" href="https://matrix.to/#/#raylib-python-cffi:matrix.org">Matrix</a></p> <section id="libraries-raymath-raygui-rlgl-physac-and-glfw">
<h2>Libraries: raymath, raygui, rlgl, physac and GLFW<a class="headerlink" href="#libraries-raymath-raygui-rlgl-physac-and-glfw" title="Link to this heading"></a></h2>
</section>
<section id="backends-desktop-sdl-drm-web">
<h2>Backends: Desktop, SDL, DRM, Web<a class="headerlink" href="#backends-desktop-sdl-drm-web" title="Link to this heading"></a></h2>
<p>Chatroom: <a class="reference external" href="https://discord.gg/fKDwt85aX6">Discord</a></p>
<p>New CFFI API static bindings.</p> <p>New CFFI API static bindings.</p>
<ul class="simple"> <ul class="simple">
<li><p>Automatically generated to be as close as possible to <li><p>Automatically generated to be as close as possible to
@ -111,21 +124,21 @@ original Raylib.</p></li>
<li><p>Faster, fewer bugs and easier to maintain than ctypes.</p></li> <li><p>Faster, fewer bugs and easier to maintain than ctypes.</p></li>
<li><p>Commercial-friendly license.</p></li> <li><p>Commercial-friendly license.</p></li>
<li><p>Docstrings and auto-completion.</p></li> <li><p>Docstrings and auto-completion.</p></li>
<li><p><strong>Now includes extra libraries: raymath, raygui, rlgl, physac and GLFW</strong></p></li>
</ul> </ul>
<p><a class="reference external" href="http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p> <p><a class="reference external" href="http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p>
</section> </section>
</section>
<section id="quickstart"> <section id="quickstart">
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1> <h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib</span></code></p> <p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib==5.0.0.4</span></code></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>from pyray import * <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pyray</span> <span class="kn">import</span> <span class="o">*</span>
init_window(800, 450, &quot;Hello&quot;) <span class="n">init_window</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">450</span><span class="p">,</span> <span class="s2">&quot;Hello&quot;</span><span class="p">)</span>
while not window_should_close(): <span class="k">while</span> <span class="ow">not</span> <span class="n">window_should_close</span><span class="p">():</span>
begin_drawing() <span class="n">begin_drawing</span><span class="p">()</span>
clear_background(WHITE) <span class="n">clear_background</span><span class="p">(</span><span class="n">WHITE</span><span class="p">)</span>
draw_text(&quot;Hello world&quot;, 190, 200, 20, VIOLET) <span class="n">draw_text</span><span class="p">(</span><span class="s2">&quot;Hello world&quot;</span><span class="p">,</span> <span class="mi">190</span><span class="p">,</span> <span class="mi">200</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="n">VIOLET</span><span class="p">)</span>
end_drawing() <span class="n">end_drawing</span><span class="p">()</span>
close_window() <span class="n">close_window</span><span class="p">()</span>
</pre></div> </pre></div>
</div> </div>
</section> </section>
@ -137,12 +150,40 @@ close_window()
</div> </div>
<p>Then install</p> <p>Then install</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install setuptools <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install setuptools
python3 -m pip install raylib python3 -m pip install raylib==5.0.0.4
</pre></div> </pre></div>
</div> </div>
<p>On most platforms it should install a binary wheel (Windows 10 x64, MacOS 12 x64/arm64, Linux Ubuntu2004 x64/arm64).</p> <p>On most platforms it should install a binary wheel. If yours isnt available then pip will attempt to build from
<p>If yours isnt available then pip will attempt to build from source, in which case you will need to have Raylib development libs installed, e.g. source, in which case you will need to have Raylib development libs installed, e.g.
using homebrew, apt, etc.</p> using homebrew, apt, etc.</p>
<section id="windows">
<h2>Windows<a class="headerlink" href="#windows" title="Link to this heading"></a></h2>
<p>Binaries require x64 Windows 10 or newer. (For x86 or older Windows you will have to build from source.)</p>
<p>Use an <a class="reference external" href="https://www.python.org/downloads/windows/">official Windows Python release</a> rather than WSL, MSYS, etc.</p>
</section>
<section id="macos">
<h2>MacOS<a class="headerlink" href="#macos" title="Link to this heading"></a></h2>
<p>Binaries require:</p>
<ul class="simple">
<li><p>arm64 MacOS 14</p></li>
<li><p>x64 MacOS 10.13, or newer.</p></li>
</ul>
<p>Older MacOS requires building from source but this is usually simple:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>brew install pkg-config
brew install raylib
python3 -m pip install raylib==5.0.0.4
</pre></div>
</div>
<p>(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
if you want to test them.)</p>
</section>
<section id="linux">
<h2>Linux<a class="headerlink" href="#linux" title="Link to this heading"></a></h2>
<p>Binaries require OS newer than Ubuntu 2020, x64 or arm64. Otherwise build from source.
(Pip should attempt automatically but will need Raylib itself installed and also pkg-config.)</p>
<p>The arm64 binaries are built on Raspberry Pi arm64 Bullseye with OpenGL 2.0
so may not work on other boards.</p>
</section>
<section id="raspberry-pi"> <section id="raspberry-pi">
<h2>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h2> <h2>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h2>
<p><a class="reference internal" href="RPI.html"><span class="std std-doc">Using on Rasperry Pi</span></a></p> <p><a class="reference internal" href="RPI.html"><span class="std std-doc">Using on Rasperry Pi</span></a></p>
@ -150,37 +191,50 @@ using homebrew, apt, etc.</p>
<section id="dynamic-binding-version"> <section id="dynamic-binding-version">
<h2>Dynamic binding version<a class="headerlink" href="#dynamic-binding-version" title="Link to this heading"></a></h2> <h2>Dynamic binding version<a class="headerlink" href="#dynamic-binding-version" title="Link to this heading"></a></h2>
<p>There is now a separate dynamic version of this binding:</p> <p>There is now a separate dynamic version of this binding:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib_dynamic <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
python3 -m pip install raylib_dynamic
</pre></div> </pre></div>
</div> </div>
<p>It works on some systems where the static version doesnt, <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/dynamic.html">but be sure to read these caveats before using it</a></p> <p>It works on some systems where the static version doesnt, <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/dynamic.html">but be sure to read these caveats before using it</a></p>
</section> </section>
<section id="beta-testing"> <section id="sdl-backend">
<h2>Beta testing<a class="headerlink" href="#beta-testing" title="Link to this heading"></a></h2> <h2>SDL backend<a class="headerlink" href="#sdl-backend" title="Link to this heading"></a></h2>
<p>If you find a bug, it may be fixed in the <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/releases">latest dev release</a>. <p>This is not well tested but has better support for controllers:</p>
You can install an alpha or beta version by specifying the exact version number like this:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib==4.2.0.0.dev4 python3 -m pip install raylib_sdl
</pre></div> </pre></div>
</div> </div>
<p>You cant have multiple raylib packages installed at once.</p>
</section>
<section id="drm-backend">
<h2>DRM backend<a class="headerlink" href="#drm-backend" title="Link to this heading"></a></h2>
<p>This uses the Linux framebuffer for devices that dont run X11/Wayland:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
python3 -m pip install raylib_drm
</pre></div>
</div>
<p>You cant have multiple raylib packages installed at once.</p>
</section> </section>
<section id="problems"> <section id="problems">
<h2>Problems?<a class="headerlink" href="#problems" title="Link to this heading"></a></h2> <h2>Problems?<a class="headerlink" href="#problems" title="Link to this heading"></a></h2>
<p>If it doesnt work, <a class="reference internal" href="BUILDING.html"><span class="std std-doc">try to build manually.</span></a>. If that works then <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a> <p>If it doesnt work, <a class="reference internal" href="BUILDING.html"><span class="std std-doc">try to build manually.</span></a>. If that works then <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>
to let us know what you did.</p> to let us know what you did.</p>
<p>If you need help you can try asking <a class="reference external" href="https://discord.gg/raylib">on Discord</a>.</p> <p>If you need help you can try asking on <a class="reference external" href="https://discord.gg/fKDwt85aX6">our discord</a>. There is also a large <a class="reference external" href="https://discord.gg/raylib">Raylib discord</a>
for issues that are not Python-specific.</p>
<p>If it still doesnt work, <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>.</p> <p>If it still doesnt work, <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>.</p>
</section> </section>
</section> </section>
<section id="how-to-use"> <section id="how-to-use">
<h1>How to use<a class="headerlink" href="#how-to-use" title="Link to this heading"></a></h1> <h1>How to use<a class="headerlink" href="#how-to-use" title="Link to this heading"></a></h1>
<p>There are two APIs, you can use either or both:</p> <p>There are two modules in the raylib package, <code class="docutils literal notranslate"><span class="pre">raylib</span></code> and <code class="docutils literal notranslate"><span class="pre">pyray</span></code>. (There is no separate package for
pyray). You can use either or both:</p>
<section id="if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api"> <section id="if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">
<h2>If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API<a class="headerlink" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api" title="Link to this heading"></a></h2> <h2>If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API<a class="headerlink" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api" title="Link to this heading"></a></h2>
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the C API</a>.</p> <p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the raylib module</a>.</p>
</section> </section>
<section id="if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower"> <section id="if-you-prefer-a-more-pythonistic-api">
<h2>If you prefer a slightly more Pythonistic API and dont mind it might be slightly slower<a class="headerlink" href="#if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower" title="Link to this heading"></a></h2> <h2>If you prefer a more Pythonistic API<a class="headerlink" href="#if-you-prefer-a-more-pythonistic-api" title="Link to this heading"></a></h2>
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the Python API</a>.</p> <p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the pyray module</a>.</p>
</section> </section>
</section> </section>
<section id="running-in-a-web-browser"> <section id="running-in-a-web-browser">
@ -239,9 +293,9 @@ Carefully read all their <a class="reference external" href="https://pygame-web.
<li><p>Testing on more platforms</p></li> <li><p>Testing on more platforms</p></li>
</ul> </ul>
</section> </section>
<section id="license-updated"> <section id="license">
<h1>License (updated)<a class="headerlink" href="#license-updated" title="Link to this heading"></a></h1> <h1>License<a class="headerlink" href="#license" title="Link to this heading"></a></h1>
<p>The bindings are now under the Eclipse Public License, so you are free to <p>Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects!</p> statically link and use in non-free / proprietary / commercial projects!</p>
</section> </section>
<section id="performance"> <section id="performance">

View file

@ -44,7 +44,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current"> <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -52,7 +52,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
@ -101,7 +101,9 @@
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span>
</pre></div> </pre></div>
</div> </div>
<p>If it doesnt work, or youre not on Bullseye, or youre 32 bit, or if you want to use Raylib in <code class="docutils literal notranslate"><span class="pre">PLATFORM_DRM</span></code> mode, you will need to compile your own raylib. See below. <p>Alternatively there is a DRM wheel called <code class="docutils literal notranslate"><span class="pre">raylib_drm</span></code> to use the framebuffer without X11. You cant have both wheels
installed at once.</p>
<p>If it doesnt work, or youre not on Bullseye, or youre 32 bit, you will need to compile your own raylib. See below.
For full instructions on this, see <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi">https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi</a> . If you need help with this ask Raylib.</p> For full instructions on this, see <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi">https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi</a> . If you need help with this ask Raylib.</p>
</section> </section>
<section id="option-2-compile-raylib-from-source-x11-mode"> <section id="option-2-compile-raylib-from-source-x11-mode">
@ -122,7 +124,7 @@ For full instructions on this, see <a class="reference external" href="https://g
</div> </div>
<p>Then have pip compile and install the wheel:</p> <p>Then have pip compile and install the wheel:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">setuptools</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">setuptools</span>
<span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">5.0.0.3</span> <span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">5.0.0.4</span>
</pre></div> </pre></div>
</div> </div>
</section> </section>
@ -155,7 +157,7 @@ For full instructions on this, see <a class="reference external" href="https://g
</div> </div>
<p>Then have pip compile and install the wheel:</p> <p>Then have pip compile and install the wheel:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">setuptools</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">setuptools</span>
<span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">5.0.0.3</span> <span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">5.0.0.4</span>
</pre></div> </pre></div>
</div> </div>
<div class="admonition attention"> <div class="admonition attention">

View file

@ -38,7 +38,7 @@ project.
If the Pip build doesnt work, please submit a bug. (And if you have If the Pip build doesnt work, please submit a bug. (And if you have
fixed it, a PR.) fixed it, a PR.)
Manual instructions follow, but may be outdated, so see also how we actually build the wheels Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml
Windows manual build Windows manual build

View file

@ -1,6 +1,8 @@
# Python Bindings for Raylib 5.0 # Python Bindings for Raylib 5.5
## Libraries: raymath, raygui, rlgl, physac and GLFW
## Backends: Desktop, SDL, DRM, Web
Chatroom: [Discord](https://discord.gg/fKDwt85aX6) or [Matrix](https://matrix.to/#/#raylib-python-cffi:matrix.org) Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
New CFFI API static bindings. New CFFI API static bindings.
* Automatically generated to be as close as possible to * Automatically generated to be as close as possible to
@ -8,23 +10,23 @@ original Raylib.
* Faster, fewer bugs and easier to maintain than ctypes. * Faster, fewer bugs and easier to maintain than ctypes.
* Commercial-friendly license. * Commercial-friendly license.
* Docstrings and auto-completion. * Docstrings and auto-completion.
* **Now includes extra libraries: raymath, raygui, rlgl, physac and GLFW**
[Full documentation](http://electronstudio.github.io/raylib-python-cffi) [Full documentation](http://electronstudio.github.io/raylib-python-cffi)
# Quickstart # Quickstart
`pip3 install raylib` `pip3 install raylib==5.0.0.4`
```python
from pyray import * from pyray import *
init_window(800, 450, "Hello") init_window(800, 450, "Hello")
while not window_should_close(): while not window_should_close():
begin_drawing() begin_drawing()
clear_background(WHITE) clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET) draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing() end_drawing()
close_window() close_window()
```
# Installation # Installation
@ -35,13 +37,41 @@ First make sure you have the latest pip installed:
Then install Then install
python3 -m pip install setuptools python3 -m pip install setuptools
python3 -m pip install raylib python3 -m pip install raylib==5.0.0.4
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 12 x64/arm64, Linux Ubuntu2004 x64/arm64). On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
source, in which case you will need to have Raylib development libs installed, e.g.
If yours isn't available then pip will attempt to build from source, in which case you will need to have Raylib development libs installed, e.g.
using homebrew, apt, etc. using homebrew, apt, etc.
## Windows
Binaries require x64 Windows 10 or newer. (For x86 or older Windows you will have to build from source.)
Use an [official Windows Python release](https://www.python.org/downloads/windows/) rather than WSL, MSYS, etc.
## MacOS
Binaries require:
* arm64 MacOS 14
* x64 MacOS 10.13, or newer.
Older MacOS requires building from source but this is usually simple:
brew install pkg-config
brew install raylib
python3 -m pip install raylib==5.0.0.4
(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
if you want to test them.)
## Linux
Binaries require OS newer than Ubuntu 2020, x64 or arm64. Otherwise build from source.
(Pip should attempt automatically but will need Raylib itself installed and also pkg-config.)
The arm64 binaries are built on Raspberry Pi arm64 Bullseye with OpenGL 2.0
so may not work on other boards.
## Raspberry Pi ## Raspberry Pi
[Using on Rasperry Pi](RPI.rst) [Using on Rasperry Pi](RPI.rst)
@ -50,38 +80,52 @@ using homebrew, apt, etc.
There is now a separate dynamic version of this binding: There is now a separate dynamic version of this binding:
python3 -m pip uninstall raylib
python3 -m pip install raylib_dynamic python3 -m pip install raylib_dynamic
It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html) It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
## Beta testing ## SDL backend
If you find a bug, it may be fixed in the [latest dev release](https://github.com/electronstudio/raylib-python-cffi/releases). This is not well tested but has better support for controllers:
You can install an alpha or beta version by specifying the exact version number like this:
python3 -m pip install raylib==4.2.0.0.dev4 python3 -m pip uninstall raylib
python3 -m pip install raylib_sdl
You can't have multiple raylib packages installed at once.
## DRM backend
This uses the Linux framebuffer for devices that don't run X11/Wayland:
python3 -m pip uninstall raylib
python3 -m pip install raylib_drm
You can't have multiple raylib packages installed at once.
## Problems? ## Problems?
If it doesn't work, [try to build manually.](BUILDING.rst). If that works then [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues) If it doesn't work, [try to build manually.](BUILDING.rst). If that works then [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues)
to let us know what you did. to let us know what you did.
If you need help you can try asking [on Discord](https://discord.gg/raylib). If you need help you can try asking on [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
for issues that are not Python-specific.
If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues). If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
# How to use # How to use
There are two APIs, you can use either or both: There are two modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
pyray). You can use either or both:
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API ### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
Use [the C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html). Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower ### If you prefer a more Pythonistic API
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html). Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
# Running in a web browser # Running in a web browser
@ -143,9 +187,9 @@ A related library (that is a work in progress!):
* Converting more examples from C to Python * Converting more examples from C to Python
* Testing on more platforms * Testing on more platforms
# License (updated) # License
The bindings are now under the Eclipse Public License, so you are free to Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects! statically link and use in non-free / proprietary / commercial projects!
# Performance # Performance

View file

@ -12,7 +12,10 @@ We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11
python -m pip install --break-system-packages raylib python -m pip install --break-system-packages raylib
If it doesn't work, or you're not on Bullseye, or you're 32 bit, or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib. See below. Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
installed at once.
If it doesn't work, or you're not on Bullseye, or you're 32 bit, you will need to compile your own raylib. See below.
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib. For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
Option 2: Compile Raylib from source X11 mode Option 2: Compile Raylib from source X11 mode
@ -39,7 +42,7 @@ Then have pip compile and install the wheel:
:: ::
python3 -m pip install --break-system-packages setuptools python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.3 python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.4
Option 3: Compile Raylib from source DRM mode Option 3: Compile Raylib from source DRM mode
--------------------------------------------- ---------------------------------------------
@ -82,7 +85,7 @@ Then have pip compile and install the wheel:
:: ::
python3 -m pip install --break-system-packages setuptools python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.3 python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.4

View file

@ -56,7 +56,6 @@ Example program:
init_window(800, 450, "Raylib texture test") init_window(800, 450, "Raylib texture test")
... ...
(You don't need to use the PyRay() class anymore.)
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_ `See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_

View file

@ -45,7 +45,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current"> <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -53,7 +53,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,7 @@
<script src="_static/js/theme.js"></script> <script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
<link rel="next" title="Python Bindings for Raylib 5.0" href="README.html" /> <link rel="next" title="Python Bindings for Raylib 5.5" href="README.html" />
</head> </head>
<body class="wy-body-for-nav"> <body class="wy-body-for-nav">
@ -44,7 +44,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul> <ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -52,7 +52,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
@ -92,7 +92,7 @@
<div class="toctree-wrapper compound"> <div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul> <ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -100,7 +100,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
@ -120,7 +120,7 @@
</div> </div>
</div> </div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="README.html" class="btn btn-neutral float-right" title="Python Bindings for Raylib 5.0" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> <a href="README.html" class="btn btn-neutral float-right" title="Python Bindings for Raylib 5.5" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div> </div>
<hr/> <hr/>

Binary file not shown.

View file

@ -49,7 +49,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul> <ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -57,7 +57,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -45,7 +45,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul> <ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.0</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
@ -53,7 +53,7 @@
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license-updated">License (updated)</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li> <li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
import raylib import raylib
RAYLIB_VERSION_MAJOR: int = 5 RAYLIB_VERSION_MAJOR: int = 5
RAYLIB_VERSION_MINOR: int = 0 RAYLIB_VERSION_MINOR: int = 5
RAYLIB_VERSION_PATCH: int = 0 RAYLIB_VERSION_PATCH: int = 0
RAYLIB_VERSION: str = "5.0" RAYLIB_VERSION: str = "5.5"
PI: float = 3.141592653589793 PI: float = 3.141592653589793
DEG2RAD = PI / 180.0 DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI RAD2DEG = 180.0 / PI
@ -15,7 +15,7 @@ MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS
EPSILON: float = 1e-06 EPSILON: float = 1e-06
RLGL_VERSION: str = "4.5" RLGL_VERSION: str = "5.0"
RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192 RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192
RL_DEFAULT_BATCH_BUFFERS: int = 1 RL_DEFAULT_BATCH_BUFFERS: int = 1
RL_DEFAULT_BATCH_DRAWCALLS: int = 256 RL_DEFAULT_BATCH_DRAWCALLS: int = 256
@ -86,6 +86,17 @@ RL_BLEND_SRC_RGB: int = 32969
RL_BLEND_DST_ALPHA: int = 32970 RL_BLEND_DST_ALPHA: int = 32970
RL_BLEND_SRC_ALPHA: int = 32971 RL_BLEND_SRC_ALPHA: int = 32971
RL_BLEND_COLOR: int = 32773 RL_BLEND_COLOR: int = 32773
RL_READ_FRAMEBUFFER: int = 36008
RL_DRAW_FRAMEBUFFER: int = 36009
RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION: int = 0
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD: int = 1
RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL: int = 2
RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR: int = 3
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT: int = 4
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2: int = 5
RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES: int = 6
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS: int = 7
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8
RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO
RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS
GL_SHADING_LANGUAGE_VERSION: int = 35724 GL_SHADING_LANGUAGE_VERSION: int = 35724
@ -102,6 +113,8 @@ GL_COMPRESSED_RGBA_ASTC_4x4_KHR: int = 37808
GL_COMPRESSED_RGBA_ASTC_8x8_KHR: int = 37815 GL_COMPRESSED_RGBA_ASTC_8x8_KHR: int = 37815
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: int = 34047 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: int = 34047
GL_TEXTURE_MAX_ANISOTROPY_EXT: int = 34046 GL_TEXTURE_MAX_ANISOTROPY_EXT: int = 34046
GL_PROGRAM_POINT_SIZE: int = 34370
GL_LINE_WIDTH: int = 2849
GL_UNSIGNED_SHORT_5_6_5: int = 33635 GL_UNSIGNED_SHORT_5_6_5: int = 33635
GL_UNSIGNED_SHORT_5_5_5_1: int = 32820 GL_UNSIGNED_SHORT_5_5_5_1: int = 32820
GL_UNSIGNED_SHORT_4_4_4_4: int = 32819 GL_UNSIGNED_SHORT_4_4_4_4: int = 32819
@ -113,19 +126,22 @@ RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL: str = "vertexNormal"
RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR: str = "vertexColor" RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR: str = "vertexColor"
RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT: str = "vertexTangent" RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT: str = "vertexTangent"
RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2: str = "vertexTexCoord2" RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2: str = "vertexTexCoord2"
RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS: str = "vertexBoneIds"
RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS: str = "vertexBoneWeights"
RL_DEFAULT_SHADER_UNIFORM_NAME_MVP: str = "mvp" RL_DEFAULT_SHADER_UNIFORM_NAME_MVP: str = "mvp"
RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW: str = "matView" RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW: str = "matView"
RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION: str = "matProjection" RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION: str = "matProjection"
RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL: str = "matModel" RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL: str = "matModel"
RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL: str = "matNormal" RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL: str = "matNormal"
RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR: str = "colDiffuse" RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR: str = "colDiffuse"
RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES: str = "boneMatrices"
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0: str = "texture0" RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0: str = "texture0"
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1: str = "texture1" RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1: str = "texture1"
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2: str = "texture2" RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2: str = "texture2"
RAYGUI_VERSION_MAJOR: int = 4 RAYGUI_VERSION_MAJOR: int = 4
RAYGUI_VERSION_MINOR: int = 0 RAYGUI_VERSION_MINOR: int = 5
RAYGUI_VERSION_PATCH: int = 0 RAYGUI_VERSION_PATCH: int = 0
RAYGUI_VERSION: str = "4.0" RAYGUI_VERSION: str = "4.5-dev"
SCROLLBAR_LEFT_SIDE: int = 0 SCROLLBAR_LEFT_SIDE: int = 0
SCROLLBAR_RIGHT_SIDE: int = 1 SCROLLBAR_RIGHT_SIDE: int = 1
RAYGUI_ICON_SIZE: int = 16 RAYGUI_ICON_SIZE: int = 16
@ -149,6 +165,7 @@ RAYGUI_PANEL_BORDER_WIDTH: int = 1
RAYGUI_TABBAR_ITEM_WIDTH: int = 160 RAYGUI_TABBAR_ITEM_WIDTH: int = 160
RAYGUI_MIN_SCROLLBAR_WIDTH: int = 40 RAYGUI_MIN_SCROLLBAR_WIDTH: int = 40
RAYGUI_MIN_SCROLLBAR_HEIGHT: int = 40 RAYGUI_MIN_SCROLLBAR_HEIGHT: int = 40
RAYGUI_MIN_MOUSE_WHEEL_SPEED: int = 20
RAYGUI_TOGGLEGROUP_MAX_ITEMS: int = 32 RAYGUI_TOGGLEGROUP_MAX_ITEMS: int = 32
RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: int = 40 RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: int = 40
RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: int = 1 RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: int = 1
@ -423,12 +440,14 @@ GLFW_CONTEXT_RELEASE_BEHAVIOR: int = 139273
GLFW_CONTEXT_NO_ERROR: int = 139274 GLFW_CONTEXT_NO_ERROR: int = 139274
GLFW_CONTEXT_CREATION_API: int = 139275 GLFW_CONTEXT_CREATION_API: int = 139275
GLFW_SCALE_TO_MONITOR: int = 139276 GLFW_SCALE_TO_MONITOR: int = 139276
GLFW_SCALE_FRAMEBUFFER: int = 139277
GLFW_COCOA_RETINA_FRAMEBUFFER: int = 143361 GLFW_COCOA_RETINA_FRAMEBUFFER: int = 143361
GLFW_COCOA_FRAME_NAME: int = 143362 GLFW_COCOA_FRAME_NAME: int = 143362
GLFW_COCOA_GRAPHICS_SWITCHING: int = 143363 GLFW_COCOA_GRAPHICS_SWITCHING: int = 143363
GLFW_X11_CLASS_NAME: int = 147457 GLFW_X11_CLASS_NAME: int = 147457
GLFW_X11_INSTANCE_NAME: int = 147458 GLFW_X11_INSTANCE_NAME: int = 147458
GLFW_WIN32_KEYBOARD_MENU: int = 151553 GLFW_WIN32_KEYBOARD_MENU: int = 151553
GLFW_WIN32_SHOWDEFAULT: int = 151554
GLFW_WAYLAND_APP_ID: int = 155649 GLFW_WAYLAND_APP_ID: int = 155649
GLFW_NO_API: int = 0 GLFW_NO_API: int = 0
GLFW_OPENGL_API: int = 196609 GLFW_OPENGL_API: int = 196609
@ -461,6 +480,8 @@ GLFW_ANGLE_PLATFORM_TYPE_D3D9: int = 225284
GLFW_ANGLE_PLATFORM_TYPE_D3D11: int = 225285 GLFW_ANGLE_PLATFORM_TYPE_D3D11: int = 225285
GLFW_ANGLE_PLATFORM_TYPE_VULKAN: int = 225287 GLFW_ANGLE_PLATFORM_TYPE_VULKAN: int = 225287
GLFW_ANGLE_PLATFORM_TYPE_METAL: int = 225288 GLFW_ANGLE_PLATFORM_TYPE_METAL: int = 225288
GLFW_WAYLAND_PREFER_LIBDECOR: int = 229377
GLFW_WAYLAND_DISABLE_LIBDECOR: int = 229378
GLFW_ANY_POSITION: int = 2147483648 GLFW_ANY_POSITION: int = 2147483648
GLFW_ARROW_CURSOR: int = 221185 GLFW_ARROW_CURSOR: int = 221185
GLFW_IBEAM_CURSOR: int = 221186 GLFW_IBEAM_CURSOR: int = 221186
@ -480,6 +501,7 @@ GLFW_PLATFORM: int = 327683
GLFW_COCOA_CHDIR_RESOURCES: int = 331777 GLFW_COCOA_CHDIR_RESOURCES: int = 331777
GLFW_COCOA_MENUBAR: int = 331778 GLFW_COCOA_MENUBAR: int = 331778
GLFW_X11_XCB_VULKAN_SURFACE: int = 335873 GLFW_X11_XCB_VULKAN_SURFACE: int = 335873
GLFW_WAYLAND_LIBDECOR: int = 339969
GLFW_ANY_PLATFORM: int = 393216 GLFW_ANY_PLATFORM: int = 393216
GLFW_PLATFORM_WIN32: int = 393217 GLFW_PLATFORM_WIN32: int = 393217
GLFW_PLATFORM_COCOA: int = 393218 GLFW_PLATFORM_COCOA: int = 393218

View file

@ -136,7 +136,7 @@ class KeyboardKey(IntEnum):
KEY_KP_ENTER = 335 KEY_KP_ENTER = 335
KEY_KP_EQUAL = 336 KEY_KP_EQUAL = 336
KEY_BACK = 4 KEY_BACK = 4
KEY_MENU = 82 KEY_MENU = 5
KEY_VOLUME_UP = 24 KEY_VOLUME_UP = 24
KEY_VOLUME_DOWN = 25 KEY_VOLUME_DOWN = 25
@ -230,6 +230,9 @@ class ShaderLocationIndex(IntEnum):
SHADER_LOC_MAP_IRRADIANCE = 23 SHADER_LOC_MAP_IRRADIANCE = 23
SHADER_LOC_MAP_PREFILTER = 24 SHADER_LOC_MAP_PREFILTER = 24
SHADER_LOC_MAP_BRDF = 25 SHADER_LOC_MAP_BRDF = 25
SHADER_LOC_VERTEX_BONEIDS = 26
SHADER_LOC_VERTEX_BONEWEIGHTS = 27
SHADER_LOC_BONE_MATRICES = 28
class ShaderUniformDataType(IntEnum): class ShaderUniformDataType(IntEnum):
SHADER_UNIFORM_FLOAT = 0 SHADER_UNIFORM_FLOAT = 0
@ -294,7 +297,6 @@ class CubemapLayout(IntEnum):
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
CUBEMAP_LAYOUT_PANORAMA = 5
class FontType(IntEnum): class FontType(IntEnum):
FONT_DEFAULT = 0 FONT_DEFAULT = 0
@ -433,6 +435,8 @@ class GuiComboBoxProperty(IntEnum):
class GuiDropdownBoxProperty(IntEnum): class GuiDropdownBoxProperty(IntEnum):
ARROW_PADDING = 16 ARROW_PADDING = 16
DROPDOWN_ITEMS_SPACING = 17 DROPDOWN_ITEMS_SPACING = 17
DROPDOWN_ARROW_HIDDEN = 18
DROPDOWN_ROLL_UP = 19
class GuiTextBoxProperty(IntEnum): class GuiTextBoxProperty(IntEnum):
TEXT_READONLY = 16 TEXT_READONLY = 16
@ -446,6 +450,7 @@ class GuiListViewProperty(IntEnum):
LIST_ITEMS_SPACING = 17 LIST_ITEMS_SPACING = 17
SCROLLBAR_WIDTH = 18 SCROLLBAR_WIDTH = 18
SCROLLBAR_SIDE = 19 SCROLLBAR_SIDE = 19
LIST_ITEMS_BORDER_WIDTH = 20
class GuiColorPickerProperty(IntEnum): class GuiColorPickerProperty(IntEnum):
COLOR_SELECTOR_SIZE = 16 COLOR_SELECTOR_SIZE = 16
@ -675,15 +680,15 @@ class GuiIconName(IntEnum):
ICON_FOLDER = 217 ICON_FOLDER = 217
ICON_FILE = 218 ICON_FILE = 218
ICON_SAND_TIMER = 219 ICON_SAND_TIMER = 219
ICON_220 = 220 ICON_WARNING = 220
ICON_221 = 221 ICON_HELP_BOX = 221
ICON_222 = 222 ICON_INFO_BOX = 222
ICON_223 = 223 ICON_PRIORITY = 223
ICON_224 = 224 ICON_LAYERS_ISO = 224
ICON_225 = 225 ICON_LAYERS2 = 225
ICON_226 = 226 ICON_MLAYERS = 226
ICON_227 = 227 ICON_MAPS = 227
ICON_228 = 228 ICON_HOT = 228
ICON_229 = 229 ICON_229 = 229
ICON_230 = 230 ICON_230 = 230
ICON_231 = 231 ICON_231 = 231

View file

@ -21,7 +21,7 @@ model.materials.maps[pr.MATERIAL_MAP_ALBEDO].texture = texture
pr.unload_image(image) pr.unload_image(image)
pos = pr.get_mouse_position() pos = pr.get_mouse_position()
ray = pr.get_mouse_ray(pos, camera) ray = pr.get_screen_to_world_ray(pos, camera)
while not pr.window_should_close(): while not pr.window_should_close():
@ -36,6 +36,6 @@ while not pr.window_should_close():
pr.end_drawing() pr.end_drawing()
pos = pr.get_mouse_position() pos = pr.get_mouse_position()
ray = pr.get_mouse_ray(pos, camera) ray = pr.get_screen_to_world_ray(pos, camera)
pr.close_window() pr.close_window()

View file

@ -2,6 +2,7 @@
echo "building and installing raylib" echo "building and installing raylib"
cd raylib-c cd raylib-c
rm -rf build
mkdir build mkdir build
cd build cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release .. cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
@ -16,7 +17,7 @@ sudo cp -v ./raylib-c/src/rlgl.h /usr/local/include/
sudo cp -v ./raylib-c/src/raymath.h /usr/local/include/ sudo cp -v ./raylib-c/src/raymath.h /usr/local/include/
sudo cp -v ./raygui/src/raygui.h /usr/local/include/ sudo cp -v ./raygui/src/raygui.h /usr/local/include/
sudo cp -v ./physac/src/physac.h /usr/local/include/ sudo cp -v ./physac/src/physac.h /usr/local/include/
sudo cp -rv raylib-c/src/external/glfw/include/GLFW /usr/local/include sudo cp -rv ./raylib-c/src/external/glfw/include/GLFW /usr/local/include/
echo "building raylib_parser" echo "building raylib_parser"
@ -38,6 +39,7 @@ python3 raylib/build.py
echo "creating enums.py" echo "creating enums.py"
python3 -m pip install inflection --break-system-packages # TODO: venv
python3 create_enums.py > raylib/enums.py python3 create_enums.py > raylib/enums.py
python3 create_enums.py > dynamic/raylib/enums.py python3 create_enums.py > dynamic/raylib/enums.py

File diff suppressed because it is too large Load diff

2
raygui

@ -1 +1 @@
Subproject commit 25c8c65a6e5f0f4d4b564a0343861898c6f2778b Subproject commit 1e03efca48c50c5ea4b4a053d5bf04bad58d3e43

@ -1 +1 @@
Subproject commit ae50bfa2cc569c0f8d5bc4315d39db64005b1b08 Subproject commit 26548c10620c4ae6937cf8b506c777a006b33c16

File diff suppressed because it is too large Load diff

View file

@ -25,12 +25,13 @@ import sys
import subprocess import subprocess
import time import time
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
def check_raylib_installed(): def check_raylib_installed():
return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0 return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0
def check_SDL_installed():
return subprocess.run(['pkg-config', '--exists', 'sdl2'], text=True, stdout=subprocess.PIPE).returncode == 0
def get_the_include_path(): def get_the_include_path():
return subprocess.run(['pkg-config', '--variable=includedir', 'raylib'], text=True, return subprocess.run(['pkg-config', '--variable=includedir', 'raylib'], text=True,
@ -106,6 +107,9 @@ def build_unix():
if not check_raylib_installed(): if not check_raylib_installed():
raise Exception("ERROR: raylib not found by pkg-config. Please install pkg-config and Raylib.") raise Exception("ERROR: raylib not found by pkg-config. Please install pkg-config and Raylib.")
if RAYLIB_PLATFORM=="SDL" and not check_SDL_installed():
raise Exception("ERROR: SDL2 not found by pkg-config. Please install pkg-config and SDL2.")
raylib_h = get_the_include_path() + "/raylib.h" raylib_h = get_the_include_path() + "/raylib.h"
rlgl_h = get_the_include_path() + "/rlgl.h" rlgl_h = get_the_include_path() + "/rlgl.h"
raymath_h = get_the_include_path() + "/raymath.h" raymath_h = get_the_include_path() + "/raymath.h"
@ -126,7 +130,7 @@ def build_unix():
""" """
glfw3_h = get_the_include_path() + "/GLFW/glfw3.h" glfw3_h = get_the_include_path() + "/GLFW/glfw3.h"
if check_header_exists(glfw3_h): if RAYLIB_PLATFORM=="Desktop" and check_header_exists(glfw3_h):
ffi_includes += """ ffi_includes += """
#include "GLFW/glfw3.h" #include "GLFW/glfw3.h"
""" """
@ -154,7 +158,7 @@ def build_unix():
ffibuilder.cdef(pre_process_header(raygui_h)) ffibuilder.cdef(pre_process_header(raygui_h))
if os.path.isfile(physac_h): if os.path.isfile(physac_h):
ffibuilder.cdef(pre_process_header(physac_h)) ffibuilder.cdef(pre_process_header(physac_h))
if os.path.isfile(glfw3_h): if RAYLIB_PLATFORM=="Desktop" and os.path.isfile(glfw3_h):
ffibuilder.cdef(pre_process_header(glfw3_h)) ffibuilder.cdef(pre_process_header(glfw3_h))
@ -163,15 +167,28 @@ def build_unix():
extra_link_args = [get_the_lib_path() + '/libraylib.a', '-framework', 'OpenGL', '-framework', 'Cocoa', extra_link_args = [get_the_lib_path() + '/libraylib.a', '-framework', 'OpenGL', '-framework', 'Cocoa',
'-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework', '-framework', 'IOKit', '-framework', 'CoreFoundation', '-framework',
'CoreVideo'] 'CoreVideo']
if RAYLIB_PLATFORM=="SDL":
extra_link_args += ['/usr/local/lib/libSDL2.a', '-framework', 'CoreHaptics', '-framework', 'ForceFeedback',
'-framework', 'GameController']
libraries = [] libraries = []
extra_compile_args = ["-Wno-error=incompatible-function-pointer-types", "-D_CFFI_NO_LIMITED_API"] extra_compile_args = ["-Wno-error=incompatible-function-pointer-types", "-D_CFFI_NO_LIMITED_API"]
else: #platform.system() == "Linux": else: #platform.system() == "Linux":
print("BUILDING FOR LINUX") print("BUILDING FOR LINUX")
extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL', extra_link_args = get_lib_flags() + [ '-lm', '-lpthread', '-lGL',
'-lrt', '-lm', '-ldl', '-lX11', '-lpthread', '-latomic'] '-lrt', '-lm', '-ldl', '-lpthread', '-latomic']
if RAYLIB_PLATFORM=="SDL":
extra_link_args += ['-lX11','-lSDL2']
elif RAYLIB_PLATFORM=="DRM":
extra_link_args += ['-lEGL', '-lgbm']
else:
extra_link_args += ['-lX11']
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"] extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
libraries = ['GL', 'm', 'pthread', 'dl', 'rt', 'X11', 'atomic'] libraries = [] # Not sure why but we put them in extra_link_args instead so *shouldnt* be needed here
print("extra_link_args: "+str(extra_link_args))
print("extra_compile_args: "+str(extra_compile_args))
print("libraries: "+str(libraries))
ffibuilder.set_source("raylib._raylib_cffi", ffibuilder.set_source("raylib._raylib_cffi",
ffi_includes, ffi_includes,
py_limited_api=False, py_limited_api=False,
@ -184,26 +201,41 @@ def build_unix():
def build_windows(): def build_windows():
print("BUILDING FOR WINDOWS") print("BUILDING FOR WINDOWS")
ffibuilder.cdef(open("raylib/raylib.h.modified").read()) ffibuilder.cdef(open("raylib/raylib.h.modified").read())
ffibuilder.cdef(open("raylib/glfw3.h.modified").read()) if RAYLIB_PLATFORM=="Desktop":
ffibuilder.cdef(open("raylib/glfw3.h.modified").read())
ffibuilder.cdef(open("raylib/rlgl.h.modified").read()) ffibuilder.cdef(open("raylib/rlgl.h.modified").read())
ffibuilder.cdef(open("raylib/raygui.h.modified").read()) ffibuilder.cdef(open("raylib/raygui.h.modified").read())
ffibuilder.cdef(open("raylib/physac.h.modified").read()) ffibuilder.cdef(open("raylib/physac.h.modified").read())
ffibuilder.cdef(open("raylib/raymath.h.modified").read()) ffibuilder.cdef(open("raylib/raymath.h.modified").read())
ffibuilder.set_source("raylib._raylib_cffi", """
ffi_includes = """
#include "raylib.h" #include "raylib.h"
#include "rlgl.h" #include "rlgl.h"
#include "raymath.h" #include "raymath.h"
#include "GLFW/glfw3.h" """
if RAYLIB_PLATFORM=="Desktop":
ffi_includes += """
#include "GLFW/glfw3.h"
"""
ffi_includes += """
#define RAYGUI_IMPLEMENTATION #define RAYGUI_IMPLEMENTATION
#define RAYGUI_SUPPORT_RICONS #define RAYGUI_SUPPORT_RICONS
#include "raygui.h" #include "raygui.h"
#define PHYSAC_IMPLEMENTATION #define PHYSAC_IMPLEMENTATION
#include "physac.h" #include "physac.h"
""", """
libraries = ['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm']
if RAYLIB_PLATFORM=="SDL":
libraries += ['SDL2']
print("libraries: "+str(libraries))
ffibuilder.set_source("raylib._raylib_cffi", ffi_includes,
extra_link_args=['/NODEFAULTLIB:MSVCRTD'], extra_link_args=['/NODEFAULTLIB:MSVCRTD'],
extra_compile_args="/D_CFFI_NO_LIMITED_API", extra_compile_args=["/D_CFFI_NO_LIMITED_API"],
py_limited_api=False, py_limited_api=False,
libraries=['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm'], libraries=libraries,
include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src', include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src',
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include', 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include',
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src', 'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src',

View file

@ -1,9 +1,9 @@
import raylib import raylib
RAYLIB_VERSION_MAJOR: int = 5 RAYLIB_VERSION_MAJOR: int = 5
RAYLIB_VERSION_MINOR: int = 0 RAYLIB_VERSION_MINOR: int = 5
RAYLIB_VERSION_PATCH: int = 0 RAYLIB_VERSION_PATCH: int = 0
RAYLIB_VERSION: str = "5.0" RAYLIB_VERSION: str = "5.5"
PI: float = 3.141592653589793 PI: float = 3.141592653589793
DEG2RAD = PI / 180.0 DEG2RAD = PI / 180.0
RAD2DEG = 180.0 / PI RAD2DEG = 180.0 / PI
@ -15,7 +15,7 @@ MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS
EPSILON: float = 1e-06 EPSILON: float = 1e-06
RLGL_VERSION: str = "4.5" RLGL_VERSION: str = "5.0"
RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192 RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192
RL_DEFAULT_BATCH_BUFFERS: int = 1 RL_DEFAULT_BATCH_BUFFERS: int = 1
RL_DEFAULT_BATCH_DRAWCALLS: int = 256 RL_DEFAULT_BATCH_DRAWCALLS: int = 256
@ -86,6 +86,17 @@ RL_BLEND_SRC_RGB: int = 32969
RL_BLEND_DST_ALPHA: int = 32970 RL_BLEND_DST_ALPHA: int = 32970
RL_BLEND_SRC_ALPHA: int = 32971 RL_BLEND_SRC_ALPHA: int = 32971
RL_BLEND_COLOR: int = 32773 RL_BLEND_COLOR: int = 32773
RL_READ_FRAMEBUFFER: int = 36008
RL_DRAW_FRAMEBUFFER: int = 36009
RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION: int = 0
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD: int = 1
RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL: int = 2
RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR: int = 3
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT: int = 4
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2: int = 5
RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES: int = 6
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS: int = 7
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8
RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO
RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS
GL_SHADING_LANGUAGE_VERSION: int = 35724 GL_SHADING_LANGUAGE_VERSION: int = 35724
@ -102,6 +113,8 @@ GL_COMPRESSED_RGBA_ASTC_4x4_KHR: int = 37808
GL_COMPRESSED_RGBA_ASTC_8x8_KHR: int = 37815 GL_COMPRESSED_RGBA_ASTC_8x8_KHR: int = 37815
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: int = 34047 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: int = 34047
GL_TEXTURE_MAX_ANISOTROPY_EXT: int = 34046 GL_TEXTURE_MAX_ANISOTROPY_EXT: int = 34046
GL_PROGRAM_POINT_SIZE: int = 34370
GL_LINE_WIDTH: int = 2849
GL_UNSIGNED_SHORT_5_6_5: int = 33635 GL_UNSIGNED_SHORT_5_6_5: int = 33635
GL_UNSIGNED_SHORT_5_5_5_1: int = 32820 GL_UNSIGNED_SHORT_5_5_5_1: int = 32820
GL_UNSIGNED_SHORT_4_4_4_4: int = 32819 GL_UNSIGNED_SHORT_4_4_4_4: int = 32819
@ -113,19 +126,22 @@ RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL: str = "vertexNormal"
RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR: str = "vertexColor" RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR: str = "vertexColor"
RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT: str = "vertexTangent" RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT: str = "vertexTangent"
RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2: str = "vertexTexCoord2" RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2: str = "vertexTexCoord2"
RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS: str = "vertexBoneIds"
RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS: str = "vertexBoneWeights"
RL_DEFAULT_SHADER_UNIFORM_NAME_MVP: str = "mvp" RL_DEFAULT_SHADER_UNIFORM_NAME_MVP: str = "mvp"
RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW: str = "matView" RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW: str = "matView"
RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION: str = "matProjection" RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION: str = "matProjection"
RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL: str = "matModel" RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL: str = "matModel"
RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL: str = "matNormal" RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL: str = "matNormal"
RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR: str = "colDiffuse" RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR: str = "colDiffuse"
RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES: str = "boneMatrices"
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0: str = "texture0" RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0: str = "texture0"
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1: str = "texture1" RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1: str = "texture1"
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2: str = "texture2" RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2: str = "texture2"
RAYGUI_VERSION_MAJOR: int = 4 RAYGUI_VERSION_MAJOR: int = 4
RAYGUI_VERSION_MINOR: int = 0 RAYGUI_VERSION_MINOR: int = 5
RAYGUI_VERSION_PATCH: int = 0 RAYGUI_VERSION_PATCH: int = 0
RAYGUI_VERSION: str = "4.0" RAYGUI_VERSION: str = "4.5-dev"
SCROLLBAR_LEFT_SIDE: int = 0 SCROLLBAR_LEFT_SIDE: int = 0
SCROLLBAR_RIGHT_SIDE: int = 1 SCROLLBAR_RIGHT_SIDE: int = 1
RAYGUI_ICON_SIZE: int = 16 RAYGUI_ICON_SIZE: int = 16
@ -149,6 +165,7 @@ RAYGUI_PANEL_BORDER_WIDTH: int = 1
RAYGUI_TABBAR_ITEM_WIDTH: int = 160 RAYGUI_TABBAR_ITEM_WIDTH: int = 160
RAYGUI_MIN_SCROLLBAR_WIDTH: int = 40 RAYGUI_MIN_SCROLLBAR_WIDTH: int = 40
RAYGUI_MIN_SCROLLBAR_HEIGHT: int = 40 RAYGUI_MIN_SCROLLBAR_HEIGHT: int = 40
RAYGUI_MIN_MOUSE_WHEEL_SPEED: int = 20
RAYGUI_TOGGLEGROUP_MAX_ITEMS: int = 32 RAYGUI_TOGGLEGROUP_MAX_ITEMS: int = 32
RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: int = 40 RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: int = 40
RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: int = 1 RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: int = 1
@ -423,12 +440,14 @@ GLFW_CONTEXT_RELEASE_BEHAVIOR: int = 139273
GLFW_CONTEXT_NO_ERROR: int = 139274 GLFW_CONTEXT_NO_ERROR: int = 139274
GLFW_CONTEXT_CREATION_API: int = 139275 GLFW_CONTEXT_CREATION_API: int = 139275
GLFW_SCALE_TO_MONITOR: int = 139276 GLFW_SCALE_TO_MONITOR: int = 139276
GLFW_SCALE_FRAMEBUFFER: int = 139277
GLFW_COCOA_RETINA_FRAMEBUFFER: int = 143361 GLFW_COCOA_RETINA_FRAMEBUFFER: int = 143361
GLFW_COCOA_FRAME_NAME: int = 143362 GLFW_COCOA_FRAME_NAME: int = 143362
GLFW_COCOA_GRAPHICS_SWITCHING: int = 143363 GLFW_COCOA_GRAPHICS_SWITCHING: int = 143363
GLFW_X11_CLASS_NAME: int = 147457 GLFW_X11_CLASS_NAME: int = 147457
GLFW_X11_INSTANCE_NAME: int = 147458 GLFW_X11_INSTANCE_NAME: int = 147458
GLFW_WIN32_KEYBOARD_MENU: int = 151553 GLFW_WIN32_KEYBOARD_MENU: int = 151553
GLFW_WIN32_SHOWDEFAULT: int = 151554
GLFW_WAYLAND_APP_ID: int = 155649 GLFW_WAYLAND_APP_ID: int = 155649
GLFW_NO_API: int = 0 GLFW_NO_API: int = 0
GLFW_OPENGL_API: int = 196609 GLFW_OPENGL_API: int = 196609
@ -461,6 +480,8 @@ GLFW_ANGLE_PLATFORM_TYPE_D3D9: int = 225284
GLFW_ANGLE_PLATFORM_TYPE_D3D11: int = 225285 GLFW_ANGLE_PLATFORM_TYPE_D3D11: int = 225285
GLFW_ANGLE_PLATFORM_TYPE_VULKAN: int = 225287 GLFW_ANGLE_PLATFORM_TYPE_VULKAN: int = 225287
GLFW_ANGLE_PLATFORM_TYPE_METAL: int = 225288 GLFW_ANGLE_PLATFORM_TYPE_METAL: int = 225288
GLFW_WAYLAND_PREFER_LIBDECOR: int = 229377
GLFW_WAYLAND_DISABLE_LIBDECOR: int = 229378
GLFW_ANY_POSITION: int = 2147483648 GLFW_ANY_POSITION: int = 2147483648
GLFW_ARROW_CURSOR: int = 221185 GLFW_ARROW_CURSOR: int = 221185
GLFW_IBEAM_CURSOR: int = 221186 GLFW_IBEAM_CURSOR: int = 221186
@ -480,6 +501,7 @@ GLFW_PLATFORM: int = 327683
GLFW_COCOA_CHDIR_RESOURCES: int = 331777 GLFW_COCOA_CHDIR_RESOURCES: int = 331777
GLFW_COCOA_MENUBAR: int = 331778 GLFW_COCOA_MENUBAR: int = 331778
GLFW_X11_XCB_VULKAN_SURFACE: int = 335873 GLFW_X11_XCB_VULKAN_SURFACE: int = 335873
GLFW_WAYLAND_LIBDECOR: int = 339969
GLFW_ANY_PLATFORM: int = 393216 GLFW_ANY_PLATFORM: int = 393216
GLFW_PLATFORM_WIN32: int = 393217 GLFW_PLATFORM_WIN32: int = 393217
GLFW_PLATFORM_COCOA: int = 393218 GLFW_PLATFORM_COCOA: int = 393218

View file

@ -136,7 +136,7 @@ class KeyboardKey(IntEnum):
KEY_KP_ENTER = 335 KEY_KP_ENTER = 335
KEY_KP_EQUAL = 336 KEY_KP_EQUAL = 336
KEY_BACK = 4 KEY_BACK = 4
KEY_MENU = 82 KEY_MENU = 5
KEY_VOLUME_UP = 24 KEY_VOLUME_UP = 24
KEY_VOLUME_DOWN = 25 KEY_VOLUME_DOWN = 25
@ -230,6 +230,9 @@ class ShaderLocationIndex(IntEnum):
SHADER_LOC_MAP_IRRADIANCE = 23 SHADER_LOC_MAP_IRRADIANCE = 23
SHADER_LOC_MAP_PREFILTER = 24 SHADER_LOC_MAP_PREFILTER = 24
SHADER_LOC_MAP_BRDF = 25 SHADER_LOC_MAP_BRDF = 25
SHADER_LOC_VERTEX_BONEIDS = 26
SHADER_LOC_VERTEX_BONEWEIGHTS = 27
SHADER_LOC_BONE_MATRICES = 28
class ShaderUniformDataType(IntEnum): class ShaderUniformDataType(IntEnum):
SHADER_UNIFORM_FLOAT = 0 SHADER_UNIFORM_FLOAT = 0
@ -294,7 +297,6 @@ class CubemapLayout(IntEnum):
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
CUBEMAP_LAYOUT_PANORAMA = 5
class FontType(IntEnum): class FontType(IntEnum):
FONT_DEFAULT = 0 FONT_DEFAULT = 0
@ -433,6 +435,8 @@ class GuiComboBoxProperty(IntEnum):
class GuiDropdownBoxProperty(IntEnum): class GuiDropdownBoxProperty(IntEnum):
ARROW_PADDING = 16 ARROW_PADDING = 16
DROPDOWN_ITEMS_SPACING = 17 DROPDOWN_ITEMS_SPACING = 17
DROPDOWN_ARROW_HIDDEN = 18
DROPDOWN_ROLL_UP = 19
class GuiTextBoxProperty(IntEnum): class GuiTextBoxProperty(IntEnum):
TEXT_READONLY = 16 TEXT_READONLY = 16
@ -446,6 +450,7 @@ class GuiListViewProperty(IntEnum):
LIST_ITEMS_SPACING = 17 LIST_ITEMS_SPACING = 17
SCROLLBAR_WIDTH = 18 SCROLLBAR_WIDTH = 18
SCROLLBAR_SIDE = 19 SCROLLBAR_SIDE = 19
LIST_ITEMS_BORDER_WIDTH = 20
class GuiColorPickerProperty(IntEnum): class GuiColorPickerProperty(IntEnum):
COLOR_SELECTOR_SIZE = 16 COLOR_SELECTOR_SIZE = 16
@ -675,15 +680,15 @@ class GuiIconName(IntEnum):
ICON_FOLDER = 217 ICON_FOLDER = 217
ICON_FILE = 218 ICON_FILE = 218
ICON_SAND_TIMER = 219 ICON_SAND_TIMER = 219
ICON_220 = 220 ICON_WARNING = 220
ICON_221 = 221 ICON_HELP_BOX = 221
ICON_222 = 222 ICON_INFO_BOX = 222
ICON_223 = 223 ICON_PRIORITY = 223
ICON_224 = 224 ICON_LAYERS_ISO = 224
ICON_225 = 225 ICON_LAYERS2 = 225
ICON_226 = 226 ICON_MLAYERS = 226
ICON_227 = 227 ICON_MAPS = 227
ICON_228 = 228 ICON_HOT = 228
ICON_229 = 229 ICON_229 = 229
ICON_230 = 230 ICON_230 = 230
ICON_231 = 231 ICON_231 = 231

View file

@ -169,9 +169,11 @@
* *
* @ingroup input * @ingroup input
* @{ */ * @{ */
/*! @ingroup input
*/
/*! @} */ /*! @} */
/*! @defgroup keys Keyboard keys /*! @defgroup keys Keyboard key tokens
* @brief Keyboard key IDs. * @brief Keyboard key tokens.
* *
* See [key input](@ref input_key) for how these are used. * See [key input](@ref input_key) for how these are used.
* *
@ -193,7 +195,6 @@
* @ingroup input * @ingroup input
* @{ * @{
*/ */
/* The unknown key */
/* Printable keys */ /* Printable keys */
/* Function keys */ /* Function keys */
/*! @} */ /*! @} */
@ -420,11 +421,11 @@
*/ */
/*! @brief Platform unavailable or no matching platform was found. /*! @brief Platform unavailable or no matching platform was found.
* *
* If emitted during initialization, no matching platform was found. If @ref * If emitted during initialization, no matching platform was found. If the @ref
* GLFW_PLATFORM is set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of the * GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of
* platforms supported by this library binary, except for the Null platform. If set to * the platforms supported by this library binary, except for the Null platform. If the
* a specific platform, it is either not supported by this library binary or GLFW was not * init hint was set to a specific platform, it is either not supported by this library
* able to detect it. * binary or GLFW was not able to detect it.
* *
* If emitted by a native access function, GLFW was initialized for a different platform * If emitted by a native access function, GLFW was initialized for a different platform
* than the function is for. * than the function is for.
@ -640,8 +641,14 @@
/*! @brief Window content area scaling window /*! @brief Window content area scaling window
* [window hint](@ref GLFW_SCALE_TO_MONITOR). * [window hint](@ref GLFW_SCALE_TO_MONITOR).
*/ */
/*! @brief macOS specific /*! @brief Window framebuffer scaling
* [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). * [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
*/
/*! @brief Legacy name for compatibility.
*
* This is an alias for the
* [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
* compatibility with earlier versions.
*/ */
/*! @brief macOS specific /*! @brief macOS specific
* [window hint](@ref GLFW_COCOA_FRAME_NAME_hint). * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).
@ -655,6 +662,8 @@
/*! @brief X11 specific /*! @brief X11 specific
* [window hint](@ref GLFW_X11_CLASS_NAME_hint). * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
*/ */
/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint).
*/
/*! @brief Wayland specific /*! @brief Wayland specific
* [window hint](@ref GLFW_WAYLAND_APP_ID_hint). * [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
* *
@ -703,11 +712,11 @@
* @note @macos This shape is provided by a private system API and may fail * @note @macos This shape is provided by a private system API and may fail
* with @ref GLFW_CURSOR_UNAVAILABLE in the future. * with @ref GLFW_CURSOR_UNAVAILABLE in the future.
* *
* @note @x11 This shape is provided by a newer standard not supported by all
* cursor themes.
*
* @note @wayland This shape is provided by a newer standard not supported by * @note @wayland This shape is provided by a newer standard not supported by
* all cursor themes. * all cursor themes.
*
* @note @x11 This shape is provided by a newer standard not supported by all
* cursor themes.
*/ */
/*! @brief The top-right to bottom-left diagonal resize/move arrow shape. /*! @brief The top-right to bottom-left diagonal resize/move arrow shape.
* *
@ -717,11 +726,11 @@
* @note @macos This shape is provided by a private system API and may fail * @note @macos This shape is provided by a private system API and may fail
* with @ref GLFW_CURSOR_UNAVAILABLE in the future. * with @ref GLFW_CURSOR_UNAVAILABLE in the future.
* *
* @note @x11 This shape is provided by a newer standard not supported by all
* cursor themes.
*
* @note @wayland This shape is provided by a newer standard not supported by * @note @wayland This shape is provided by a newer standard not supported by
* all cursor themes. * all cursor themes.
*
* @note @x11 This shape is provided by a newer standard not supported by all
* cursor themes.
*/ */
/*! @brief The omni-directional resize/move cursor shape. /*! @brief The omni-directional resize/move cursor shape.
* *
@ -733,11 +742,11 @@
* The operation-not-allowed shape. This is usually a circle with a diagonal * The operation-not-allowed shape. This is usually a circle with a diagonal
* line through it. * line through it.
* *
* @note @x11 This shape is provided by a newer standard not supported by all
* cursor themes.
*
* @note @wayland This shape is provided by a newer standard not supported by * @note @wayland This shape is provided by a newer standard not supported by
* all cursor themes. * all cursor themes.
*
* @note @x11 This shape is provided by a newer standard not supported by all
* cursor themes.
*/ */
/*! @brief Legacy name for compatibility. /*! @brief Legacy name for compatibility.
* *
@ -778,6 +787,10 @@
* *
* X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint). * X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint).
*/ */
/*! @brief Wayland specific init hint.
*
* Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
*/
/*! @} */ /*! @} */
/*! @addtogroup init /*! @addtogroup init
* @{ */ * @{ */
@ -860,16 +873,25 @@ typedef struct GLFWcursor GLFWcursor;
* or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation * or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
* failures gracefully yet. * failures gracefully yet.
* *
* This function may be called during @ref glfwInit but before the library is * This function must support being called during @ref glfwInit but before the library is
* flagged as initialized, as well as during @ref glfwTerminate after the * flagged as initialized, as well as during @ref glfwTerminate after the library is no
* library is no longer flagged as initialized. * longer flagged as initialized.
* *
* Any memory allocated by this function will be deallocated during library * Any memory allocated via this function will be deallocated via the same allocator
* termination or earlier. * during library termination or earlier.
*
* Any memory allocated via this function must be suitably aligned for any object type.
* If you are using C99 or earlier, this alignment is platform-dependent but will be the
* same as what `malloc` provides. If you are using C11 or later, this is the value of
* `alignof(max_align_t)`.
* *
* The size will always be greater than zero. Allocations of size zero are filtered out * The size will always be greater than zero. Allocations of size zero are filtered out
* before reaching the custom allocator. * before reaching the custom allocator.
* *
* If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
*
* This function must not call any GLFW function.
*
* @param[in] size The minimum size, in bytes, of the memory block. * @param[in] size The minimum size, in bytes, of the memory block.
* @param[in] user The user-defined pointer from the allocator. * @param[in] user The user-defined pointer from the allocator.
* @return The address of the newly allocated memory block, or `NULL` if an * @return The address of the newly allocated memory block, or `NULL` if an
@ -880,7 +902,8 @@ typedef struct GLFWcursor GLFWcursor;
* *
* @reentrancy This function should not call any GLFW function. * @reentrancy This function should not call any GLFW function.
* *
* @thread_safety This function may be called from any thread that calls GLFW functions. * @thread_safety This function must support being called from any thread that calls GLFW
* functions.
* *
* @sa @ref init_allocator * @sa @ref init_allocator
* @sa @ref GLFWallocator * @sa @ref GLFWallocator
@ -902,16 +925,26 @@ typedef void* (* GLFWallocatefun)(size_t size, void* user);
* `NULL` if allocation failed. Note that not all parts of GLFW handle allocation * `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
* failures gracefully yet. * failures gracefully yet.
* *
* This function may be called during @ref glfwInit but before the library is * This function must support being called during @ref glfwInit but before the library is
* flagged as initialized, as well as during @ref glfwTerminate after the * flagged as initialized, as well as during @ref glfwTerminate after the library is no
* library is no longer flagged as initialized. * longer flagged as initialized.
* *
* Any memory allocated by this function will be deallocated during library * Any memory allocated via this function will be deallocated via the same allocator
* termination or earlier. * during library termination or earlier.
*
* Any memory allocated via this function must be suitably aligned for any object type.
* If you are using C99 or earlier, this alignment is platform-dependent but will be the
* same as what `realloc` provides. If you are using C11 or later, this is the value of
* `alignof(max_align_t)`.
* *
* The block address will never be `NULL` and the size will always be greater than zero. * The block address will never be `NULL` and the size will always be greater than zero.
* Reallocations of a block to size zero are converted into deallocations. Reallocations * Reallocations of a block to size zero are converted into deallocations before reaching
* of `NULL` to a non-zero size are converted into regular allocations. * the custom allocator. Reallocations of `NULL` to a non-zero size are converted into
* regular allocations before reaching the custom allocator.
*
* If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
*
* This function must not call any GLFW function.
* *
* @param[in] block The address of the memory block to reallocate. * @param[in] block The address of the memory block to reallocate.
* @param[in] size The new minimum size, in bytes, of the memory block. * @param[in] size The new minimum size, in bytes, of the memory block.
@ -924,7 +957,8 @@ typedef void* (* GLFWallocatefun)(size_t size, void* user);
* *
* @reentrancy This function should not call any GLFW function. * @reentrancy This function should not call any GLFW function.
* *
* @thread_safety This function may be called from any thread that calls GLFW functions. * @thread_safety This function must support being called from any thread that calls GLFW
* functions.
* *
* @sa @ref init_allocator * @sa @ref init_allocator
* @sa @ref GLFWallocator * @sa @ref GLFWallocator
@ -945,13 +979,17 @@ typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
* This function may deallocate the specified memory block. This memory block * This function may deallocate the specified memory block. This memory block
* will have been allocated with the same allocator. * will have been allocated with the same allocator.
* *
* This function may be called during @ref glfwInit but before the library is * This function must support being called during @ref glfwInit but before the library is
* flagged as initialized, as well as during @ref glfwTerminate after the * flagged as initialized, as well as during @ref glfwTerminate after the library is no
* library is no longer flagged as initialized. * longer flagged as initialized.
* *
* The block address will never be `NULL`. Deallocations of `NULL` are filtered out * The block address will never be `NULL`. Deallocations of `NULL` are filtered out
* before reaching the custom allocator. * before reaching the custom allocator.
* *
* If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
*
* This function must not call any GLFW function.
*
* @param[in] block The address of the memory block to deallocate. * @param[in] block The address of the memory block to deallocate.
* @param[in] user The user-defined pointer from the allocator. * @param[in] user The user-defined pointer from the allocator.
* *
@ -960,7 +998,8 @@ typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
* *
* @reentrancy This function should not call any GLFW function. * @reentrancy This function should not call any GLFW function.
* *
* @thread_safety This function may be called from any thread that calls GLFW functions. * @thread_safety This function must support being called from any thread that calls GLFW
* functions.
* *
* @sa @ref init_allocator * @sa @ref init_allocator
* @sa @ref GLFWallocator * @sa @ref GLFWallocator
@ -1503,7 +1542,10 @@ typedef struct GLFWgamepadstate
*/ */
float axes[6]; float axes[6];
} GLFWgamepadstate; } GLFWgamepadstate;
/*! @brief /*! @brief Custom heap memory allocator.
*
* This describes a custom heap memory allocator for GLFW. To set an allocator, pass it
* to @ref glfwInitAllocator before initializing the library.
* *
* @sa @ref init_allocator * @sa @ref init_allocator
* @sa @ref glfwInitAllocator * @sa @ref glfwInitAllocator
@ -1514,9 +1556,21 @@ typedef struct GLFWgamepadstate
*/ */
typedef struct GLFWallocator typedef struct GLFWallocator
{ {
/*! The memory allocation function. See @ref GLFWallocatefun for details about
* allocation function.
*/
GLFWallocatefun allocate; GLFWallocatefun allocate;
/*! The memory reallocation function. See @ref GLFWreallocatefun for details about
* reallocation function.
*/
GLFWreallocatefun reallocate; GLFWreallocatefun reallocate;
/*! The memory deallocation function. See @ref GLFWdeallocatefun for details about
* deallocation function.
*/
GLFWdeallocatefun deallocate; GLFWdeallocatefun deallocate;
/*! The user pointer for this custom allocator. This value will be passed to the
* allocator functions.
*/
void* user; void* user;
} GLFWallocator; } GLFWallocator;
/************************************************************************* /*************************************************************************
@ -1558,6 +1612,13 @@ typedef struct GLFWallocator
* and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init * and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init
* hint. * hint.
* *
* @remark __Wayland, X11:__ If the library was compiled with support for both
* Wayland and X11, and the @ref GLFW_PLATFORM init hint is set to
* `GLFW_ANY_PLATFORM`, the `XDG_SESSION_TYPE` environment variable affects
* which platform is picked. If the environment variable is not set, or is set
* to something other than `wayland` or `x11`, the regular detection mechanism
* will be used instead.
*
* @remark @x11 This function will set the `LC_CTYPE` category of the * @remark @x11 This function will set the `LC_CTYPE` category of the
* application locale according to the current environment if that category is * application locale according to the current environment if that category is
* still "C". This is because the "C" locale breaks Unicode text input. * still "C". This is because the "C" locale breaks Unicode text input.
@ -1643,8 +1704,12 @@ typedef struct GLFWallocator
* To use the default allocator, call this function with a `NULL` argument. * To use the default allocator, call this function with a `NULL` argument.
* *
* If you specify an allocator struct, every member must be a valid function * If you specify an allocator struct, every member must be a valid function
* pointer. If any member is `NULL`, this function emits @ref * pointer. If any member is `NULL`, this function will emit @ref
* GLFW_INVALID_VALUE and the init allocator is unchanged. * GLFW_INVALID_VALUE and the init allocator will be unchanged.
*
* The functions in the allocator must fulfil a number of requirements. See the
* documentation for @ref GLFWallocatefun, @ref GLFWreallocatefun and @ref
* GLFWdeallocatefun for details.
* *
* @param[in] allocator The allocator to use at the next initialization, or * @param[in] allocator The allocator to use at the next initialization, or
* `NULL` to use the default one. * `NULL` to use the default one.
@ -1952,9 +2017,10 @@ typedef struct GLFWallocator
* specified monitor. * specified monitor.
* *
* Some platforms do not provide accurate monitor size information, either * Some platforms do not provide accurate monitor size information, either
* because the monitor * because the monitor [EDID][] data is incorrect or because the driver does
* [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) * not report it accurately.
* data is incorrect or because the driver does not report it accurately. *
* [EDID]: https://en.wikipedia.org/wiki/Extended_display_identification_data
* *
* Any or all of the size arguments may be `NULL`. If an error occurs, all * Any or all of the size arguments may be `NULL`. If an error occurs, all
* non-`NULL` size arguments will be set to zero. * non-`NULL` size arguments will be set to zero.
@ -2000,6 +2066,9 @@ typedef struct GLFWallocator
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland Fractional scaling information is not yet available for
* monitors, so this function only returns integer content scales.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref monitor_scale * @sa @ref monitor_scale
@ -2189,11 +2258,11 @@ typedef struct GLFWallocator
* @param[in] monitor The monitor whose gamma ramp to set. * @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] gamma The desired exponent. * @param[in] gamma The desired exponent.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark @wayland Gamma handling is a privileged protocol, this function
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -2212,11 +2281,11 @@ typedef struct GLFWallocator
* @return The current gamma ramp, or `NULL` if an * @return The current gamma ramp, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
* GLFW_PLATFORM_ERROR. * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark @wayland Gamma handling is a privileged protocol, this function
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
* returning `NULL`. * returning `NULL`.
* *
* @pointer_lifetime The returned structure and its arrays are allocated and * @pointer_lifetime The returned structure and its arrays are allocated and
@ -2250,8 +2319,8 @@ typedef struct GLFWallocator
* @param[in] monitor The monitor whose gamma ramp to set. * @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] ramp The gamma ramp to use. * @param[in] ramp The gamma ramp to use.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
* GLFW_PLATFORM_ERROR. * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark The size of the specified gamma ramp should match the size of the * @remark The size of the specified gamma ramp should match the size of the
* current ramp for that monitor. * current ramp for that monitor.
@ -2259,7 +2328,7 @@ typedef struct GLFWallocator
* @remark @win32 The gamma ramp size must be 256. * @remark @win32 The gamma ramp size must be 256.
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark @wayland Gamma handling is a privileged protocol, this function
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @pointer_lifetime The specified gamma ramp is copied before this function * @pointer_lifetime The specified gamma ramp is copied before this function
* returns. * returns.
@ -2427,8 +2496,8 @@ typedef struct GLFWallocator
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
* GLFW_PLATFORM_ERROR. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
* *
* @remark @win32 Window creation will fail if the Microsoft GDI software * @remark @win32 Window creation will fail if the Microsoft GDI software
* OpenGL implementation is the only one available. * OpenGL implementation is the only one available.
@ -2450,23 +2519,35 @@ typedef struct GLFWallocator
* @remark @macos The GLFW window has no icon, as it is not a document * @remark @macos The GLFW window has no icon, as it is not a document
* window, but the dock icon will be the same as the application bundle's icon. * window, but the dock icon will be the same as the application bundle's icon.
* For more information on bundles, see the * For more information on bundles, see the
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
* in the Mac Developer Library. *
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
* *
* @remark @macos On OS X 10.10 and later the window frame will not be rendered * @remark @macos On OS X 10.10 and later the window frame will not be rendered
* at full resolution on Retina displays unless the * at full resolution on Retina displays unless the
* [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
* hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
* application bundle's `Info.plist`. For more information, see * application bundle's `Info.plist`. For more information, see
* [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html) * [High Resolution Guidelines for OS X][hidpi-guide] in the Mac Developer
* in the Mac Developer Library. The GLFW test and example programs use * Library. The GLFW test and example programs use a custom `Info.plist`
* a custom `Info.plist` template for this, which can be found as * template for this, which can be found as `CMake/Info.plist.in` in the source
* `CMake/Info.plist.in` in the source tree. * tree.
*
* [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
* *
* @remark @macos When activating frame autosaving with * @remark @macos When activating frame autosaving with
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
* window size and position may be overridden by previously saved values. * window size and position may be overridden by previously saved values.
* *
* @remark @wayland GLFW uses [libdecor][] where available to create its window
* decorations. This in turn uses server-side XDG decorations where available
* and provides high quality client-side decorations on compositors like GNOME.
* If both XDG decorations and libdecor are unavailable, GLFW falls back to
* a very simple set of window decorations that only support moving, resizing
* and the window manager's right-click menu.
*
* [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
*
* @remark @x11 Some window managers will not respect the placement of * @remark @x11 Some window managers will not respect the placement of
* initially hidden windows. * initially hidden windows.
* *
@ -2483,20 +2564,6 @@ typedef struct GLFWallocator
* [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
* override this. * override this.
* *
* @remark @wayland Compositors should implement the xdg-decoration protocol
* for GLFW to decorate the window properly. If this protocol isn't
* supported, or if the compositor prefers client-side decorations, a very
* simple fallback frame will be drawn using the wp_viewporter protocol. A
* compositor can still emit close, maximize or fullscreen events, using for
* instance a keybind mechanism. If neither of these protocols is supported,
* the window won't be decorated.
*
* @remark @wayland A full screen window will not attempt to change the mode,
* no matter what the requested size or refresh rate.
*
* @remark @wayland Screensaver inhibition requires the idle-inhibit protocol
* to be implemented in the user's compositor.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_creation * @sa @ref window_creation
@ -2575,6 +2642,37 @@ typedef struct GLFWallocator
* @ingroup window * @ingroup window
*/ */
void glfwSetWindowShouldClose(GLFWwindow* window, int value); void glfwSetWindowShouldClose(GLFWwindow* window, int value);
/*! @brief Returns the title of the specified window.
*
* This function returns the window title, encoded as UTF-8, of the specified
* window. This is the title set previously by @ref glfwCreateWindow
* or @ref glfwSetWindowTitle.
*
* @param[in] window The window to query.
* @return The UTF-8 encoded window title, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark The returned title is currently a copy of the title last set by @ref
* glfwCreateWindow or @ref glfwSetWindowTitle. It does not include any
* additional text which may be appended by the platform or another program.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
* glfwGetWindowTitle or @ref glfwSetWindowTitle, or until the library is
* terminated.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_title
* @sa @ref glfwSetWindowTitle
*
* @since Added in version 3.4.
*
* @ingroup window
*/
const char* glfwGetWindowTitle(GLFWwindow* window);
/*! @brief Sets the title of the specified window. /*! @brief Sets the title of the specified window.
* *
* This function sets the window title, encoded as UTF-8, of the specified * This function sets the window title, encoded as UTF-8, of the specified
@ -2592,6 +2690,7 @@ typedef struct GLFWallocator
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_title * @sa @ref window_title
* @sa @ref glfwGetWindowTitle
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * @glfw3 Added window handle parameter.
@ -2630,8 +2729,9 @@ typedef struct GLFWallocator
* @remark @macos Regular windows do not have icons on macOS. This function * @remark @macos Regular windows do not have icons on macOS. This function
* will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as * will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as
* the application bundle's icon. For more information on bundles, see the * the application bundle's icon. For more information on bundles, see the
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
* in the Mac Developer Library. *
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
* *
* @remark @wayland There is no existing protocol to change an icon, the * @remark @wayland There is no existing protocol to change an icon, the
* window will thus inherit the one defined in the application's desktop file. * window will thus inherit the one defined in the application's desktop file.
@ -2849,9 +2949,6 @@ typedef struct GLFWallocator
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland A full screen window will not attempt to change the mode,
* no matter what the requested size.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_size * @sa @ref window_size
@ -3172,11 +3269,11 @@ typedef struct GLFWallocator
* *
* @param[in] window The window to give input focus. * @param[in] window The window to give input focus.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland It is not possible for an application to set the input * @remark @wayland The compositor will likely ignore focus requests unless
* focus. This function will emit @ref GLFW_FEATURE_UNAVAILABLE. * another window created by the same application already has input focus.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -3278,9 +3375,6 @@ typedef struct GLFWallocator
* @remark @wayland The desired window position is ignored, as there is no way * @remark @wayland The desired window position is ignored, as there is no way
* for an application to set this property. * for an application to set this property.
* *
* @remark @wayland Setting the window to full screen will not attempt to
* change the mode, no matter what the requested size or refresh rate.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_monitor * @sa @ref window_monitor
@ -3351,11 +3445,15 @@ typedef struct GLFWallocator
* @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
* GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark Calling @ref glfwGetWindowAttrib will always return the latest * @remark Calling @ref glfwGetWindowAttrib will always return the latest
* value, even if that value is ignored by the current mode of the window. * value, even if that value is ignored by the current mode of the window.
* *
* @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
* not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_attribs * @sa @ref window_attribs
@ -4011,8 +4109,8 @@ typedef struct GLFWallocator
* @param[in] scancode The scancode of the key to query. * @param[in] scancode The scancode of the key to query.
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`. * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
* *
* @remark The contents of the returned string may change when a keyboard * @remark The contents of the returned string may change when a keyboard
* layout change event is received. * layout change event is received.
@ -4033,15 +4131,18 @@ typedef struct GLFWallocator
* *
* This function returns the platform-specific scancode of the specified key. * This function returns the platform-specific scancode of the specified key.
* *
* If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this * If the specified [key token](@ref keys) corresponds to a physical key not
* method will return `-1`. * supported on the current platform then this method will return `-1`.
* Calling this function with anything other than a key token will return `-1`
* and generate a @ref GLFW_INVALID_ENUM error.
* *
* @param[in] key Any [named key](@ref keys). * @param[in] key Any [key token](@ref keys).
* @return The platform-specific scancode for the key, or `-1` if an * @return The platform-specific scancode for the key, or `-1` if the key is
* [error](@ref error_handling) occurred. * not supported on the current platform or an [error](@ref error_handling)
* occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * GLFW_INVALID_ENUM.
* *
* @thread_safety This function may be called from any thread. * @thread_safety This function may be called from any thread.
* *
@ -4178,11 +4279,11 @@ typedef struct GLFWallocator
* @param[in] ypos The desired y-coordinate, relative to the top edge of the * @param[in] ypos The desired y-coordinate, relative to the top edge of the
* content area. * content area.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland This function will only work when the cursor mode is * @remark @wayland This function will only work when the cursor mode is
* `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4341,9 +4442,9 @@ typedef struct GLFWallocator
* [character callback](@ref glfwSetCharCallback) instead. * [character callback](@ref glfwSetCharCallback) instead.
* *
* When a window loses input focus, it will generate synthetic key release * When a window loses input focus, it will generate synthetic key release
* events for all pressed keys. You can tell these events from user-generated * events for all pressed keys with associated key tokens. You can tell these
* events by the fact that the synthetic ones are generated after the focus * events from user-generated events by the fact that the synthetic ones are
* loss event has been processed, i.e. after the * generated after the focus loss event has been processed, i.e. after the
* [window focus callback](@ref glfwSetWindowFocusCallback) has been called. * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
* *
* The scancode of a key is specific to that platform or sometimes even to that * The scancode of a key is specific to that platform or sometimes even to that
@ -4617,8 +4718,6 @@ typedef struct GLFWallocator
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark @wayland File drop is currently unimplemented.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref path_drop * @sa @ref path_drop
@ -5071,6 +5170,11 @@ typedef struct GLFWallocator
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @win32 The clipboard on Windows has a single global lock for reading and
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
* It is safe to try this multiple times.
*
* @pointer_lifetime The specified string is copied before this function * @pointer_lifetime The specified string is copied before this function
* returns. * returns.
* *
@ -5098,6 +5202,11 @@ typedef struct GLFWallocator
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* *
* @remark @win32 The clipboard on Windows has a single global lock for reading and
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
* It is safe to try this multiple times.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You * @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref * should not free it yourself. It is valid until the next call to @ref
* glfwGetClipboardString or @ref glfwSetClipboardString, or until the library * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
@ -5215,12 +5324,15 @@ typedef struct GLFWallocator
* thread. * thread.
* *
* This function makes the OpenGL or OpenGL ES context of the specified window * This function makes the OpenGL or OpenGL ES context of the specified window
* current on the calling thread. A context must only be made current on * current on the calling thread. It can also detach the current context from
* a single thread at a time and each thread can have only a single current * the calling thread without making a new one current by passing in `NULL`.
* context at a time.
* *
* When moving a context between threads, you must make it non-current on the * A context must only be made current on a single thread at a time and each
* old thread before making it current on the new one. * thread can have only a single current context at a time. Making a context
* current detaches any previously current context on the calling thread.
*
* When moving a context between threads, you must detach it (make it
* non-current) on the old thread before making it current on the new one.
* *
* By default, making a context non-current implicitly forces a pipeline flush. * By default, making a context non-current implicitly forces a pipeline flush.
* On machines that support `GL_KHR_context_flush_control`, you can control * On machines that support `GL_KHR_context_flush_control`, you can control
@ -5235,6 +5347,10 @@ typedef struct GLFWallocator
* @param[in] window The window whose context to make current, or `NULL` to * @param[in] window The window whose context to make current, or `NULL` to
* detach the current context. * detach the current context.
* *
* @remarks If the previously current context was created via a different
* context creation API than the one passed to this function, GLFW will still
* detach the previous one from its API before making the new one current.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
* *

View file

@ -1,6 +1,6 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raygui v4.0 - A simple and easy-to-use immediate-mode gui library * raygui v4.5-dev - A simple and easy-to-use immediate-mode gui library
* *
* DESCRIPTION: * DESCRIPTION:
* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also * raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also
@ -26,7 +26,7 @@
* NOTES: * NOTES:
* - WARNING: GuiLoadStyle() and GuiLoadStyle{Custom}() functions, allocate memory for * - WARNING: GuiLoadStyle() and GuiLoadStyle{Custom}() functions, allocate memory for
* font atlas recs and glyphs, freeing that memory is (usually) up to the user, * font atlas recs and glyphs, freeing that memory is (usually) up to the user,
* no unload function is explicitly provided... but note that GuiLoadStyleDefaulf() unloads * no unload function is explicitly provided... but note that GuiLoadStyleDefault() unloads
* by default any previously loaded font (texture, recs, glyphs). * by default any previously loaded font (texture, recs, glyphs).
* - Global UI alpha (guiAlpha) is applied inside GuiDrawRectangle() and GuiDrawText() functions * - Global UI alpha (guiAlpha) is applied inside GuiDrawRectangle() and GuiDrawText() functions
* *
@ -136,11 +136,29 @@
* *
* #define RAYGUI_DEBUG_RECS_BOUNDS * #define RAYGUI_DEBUG_RECS_BOUNDS
* Draw control bounds rectangles for debug * Draw control bounds rectangles for debug
* *
* #define RAYGUI_DEBUG_TEXT_BOUNDS * #define RAYGUI_DEBUG_TEXT_BOUNDS
* Draw text bounds rectangles for debug * Draw text bounds rectangles for debug
* *
* VERSIONS HISTORY: * VERSIONS HISTORY:
* 4.5-dev (Sep-2024) Current dev version...
* ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes
* ADDED: GuiValueBoxFloat()
* ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP
* ADDED: GuiListView() property: LIST_ITEMS_BORDER_WIDTH
* ADDED: Multiple new icons
* REVIEWED: GuiTabBar(), close tab with mouse middle button
* REVIEWED: GuiScrollPanel(), scroll speed proportional to content
* REVIEWED: GuiDropdownBox(), support roll up and hidden arrow
* REVIEWED: GuiTextBox(), cursor position initialization
* REVIEWED: GuiSliderPro(), control value change check
* REVIEWED: GuiGrid(), simplified implementation
* REVIEWED: GuiIconText(), increase buffer size and reviewed padding
* REVIEWED: GuiDrawText(), improved wrap mode drawing
* REVIEWED: GuiScrollBar(), minor tweaks
* REVIEWED: Functions descriptions, removed wrong return value reference
* REDESIGNED: GuiColorPanel(), improved HSV <-> RGBA convertion
*
* 4.0 (12-Sep-2023) ADDED: GuiToggleSlider() * 4.0 (12-Sep-2023) ADDED: GuiToggleSlider()
* ADDED: GuiColorPickerHSV() and GuiColorPanelHSV() * ADDED: GuiColorPickerHSV() and GuiColorPanelHSV()
* ADDED: Multiple new icons, mostly compiler related * ADDED: Multiple new icons, mostly compiler related
@ -246,7 +264,7 @@
* 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria. * 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria.
* *
* DEPENDENCIES: * DEPENDENCIES:
* raylib 4.6-dev Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing * raylib 5.0 - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing
* *
* STANDALONE MODE: * STANDALONE MODE:
* By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled * By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled
@ -291,7 +309,7 @@
* *
* LICENSE: zlib/libpng * LICENSE: zlib/libpng
* *
* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2024 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.
@ -431,11 +449,11 @@ typedef enum {
TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding) TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding)
TEXT_WRAP_MODE // Text wrap-mode inside text bounds TEXT_WRAP_MODE // Text wrap-mode inside text bounds
//TEXT_DECORATION // Text decoration: 0-None, 1-Underline, 2-Line-through, 3-Overline //TEXT_DECORATION // Text decoration: 0-None, 1-Underline, 2-Line-through, 3-Overline
//TEXT_DECORATION_THICK // Text decoration line thikness //TEXT_DECORATION_THICK // Text decoration line thickness
} GuiDefaultProperty; } GuiDefaultProperty;
// Other possible text properties: // Other possible text properties:
// TEXT_WEIGHT // Normal, Italic, Bold -> Requires specific font change // TEXT_WEIGHT // Normal, Italic, Bold -> Requires specific font change
// TEXT_INDENT // Text indentation -> Now using TEXT_PADDING... // TEXT_INDENT // Text indentation -> Now using TEXT_PADDING...
// Label // Label
//typedef enum { } GuiLabelProperty; //typedef enum { } GuiLabelProperty;
// Button/Spinner // Button/Spinner
@ -474,7 +492,9 @@ typedef enum {
// DropdownBox // DropdownBox
typedef enum { typedef enum {
ARROW_PADDING = 16, // DropdownBox arrow separation from border and items ARROW_PADDING = 16, // DropdownBox arrow separation from border and items
DROPDOWN_ITEMS_SPACING // DropdownBox items separation DROPDOWN_ITEMS_SPACING, // DropdownBox items separation
DROPDOWN_ARROW_HIDDEN, // DropdownBox arrow hidden
DROPDOWN_ROLL_UP // DropdownBox roll up flag (default rolls down)
} GuiDropdownBoxProperty; } GuiDropdownBoxProperty;
// TextBox/TextBoxMulti/ValueBox/Spinner // TextBox/TextBoxMulti/ValueBox/Spinner
typedef enum { typedef enum {
@ -491,6 +511,7 @@ typedef enum {
LIST_ITEMS_SPACING, // ListView items separation LIST_ITEMS_SPACING, // ListView items separation
SCROLLBAR_WIDTH, // ListView scrollbar size (usually width) SCROLLBAR_WIDTH, // ListView scrollbar size (usually width)
SCROLLBAR_SIDE, // ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) SCROLLBAR_SIDE, // ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE)
LIST_ITEMS_BORDER_WIDTH // ListView items border width
} GuiListViewProperty; } GuiListViewProperty;
// ColorPicker // ColorPicker
typedef enum { typedef enum {
@ -545,26 +566,27 @@ typedef enum {
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1 /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view); // Scroll Panel control /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view); // Scroll Panel control
// Basic controls set // Basic controls set
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiLabel(Rectangle bounds, const char *text); // Label control, shows text /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiLabel(Rectangle bounds, const char *text); // Label control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiLabelButton(Rectangle bounds, const char *text); // Label button control, returns true when clicked
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiToggle(Rectangle bounds, const char *text, bool *active); // Toggle Button control, returns true when active /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiToggle(Rectangle bounds, const char *text, bool *active); // Toggle Button control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiToggleGroup(Rectangle bounds, const char *text, int *active); // Toggle Group control, returns active toggle index /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiToggleGroup(Rectangle bounds, const char *text, int *active); // Toggle Group control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiToggleSlider(Rectangle bounds, const char *text, int *active); // Toggle Slider control, returns true when clicked /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiToggleSlider(Rectangle bounds, const char *text, int *active); // Toggle Slider control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiCheckBox(Rectangle bounds, const char *text, bool *checked); // Check Box control, returns true when active /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiCheckBox(Rectangle bounds, const char *text, bool *checked); // Check Box control, returns true when active
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiComboBox(Rectangle bounds, const char *text, int *active); // Combo Box control, returns selected item index /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiComboBox(Rectangle bounds, const char *text, int *active); // Combo Box control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float *value, bool editMode); // Value box control for float values
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider control, returns selected value /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider Bar control, returns selected value /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider Bar control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Progress Bar control, shows current progress value /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Progress Bar control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell); // Grid control, returns mouse cell position /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell); // Grid control
// Advance controls set // Advance controls set
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active); // List View control, returns selected list item index /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active); // List View control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus); // List View with extended parameters /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus); // List View with extended parameters
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive); // Text Input Box control, ask for text, supports secret /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive); // Text Input Box control, ask for text, supports secret
@ -573,7 +595,7 @@ typedef enum {
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha); // Color Bar Alpha control /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha); // Color Bar Alpha control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorBarHue(Rectangle bounds, const char *text, float *value); // Color Bar Hue control /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorBarHue(Rectangle bounds, const char *text, float *value); // Color Bar Hue control
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Picker control that avoids conversion to RGB on each call (multiple color controls) /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Picker control that avoids conversion to RGB on each call (multiple color controls)
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Panel control that returns HSV color value, used by GuiColorPickerHSV() /* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV()
//---------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Icons enumeration // Icons enumeration
@ -799,15 +821,15 @@ typedef enum {
ICON_FOLDER = 217, ICON_FOLDER = 217,
ICON_FILE = 218, ICON_FILE = 218,
ICON_SAND_TIMER = 219, ICON_SAND_TIMER = 219,
ICON_220 = 220, ICON_WARNING = 220,
ICON_221 = 221, ICON_HELP_BOX = 221,
ICON_222 = 222, ICON_INFO_BOX = 222,
ICON_223 = 223, ICON_PRIORITY = 223,
ICON_224 = 224, ICON_LAYERS_ISO = 224,
ICON_225 = 225, ICON_LAYERS2 = 225,
ICON_226 = 226, ICON_MLAYERS = 226,
ICON_227 = 227, ICON_MAPS = 227,
ICON_228 = 228, ICON_HOT = 228,
ICON_229 = 229, ICON_229 = 229,
ICON_230 = 230, ICON_230 = 230,
ICON_231 = 231, ICON_231 = 231,

View file

@ -1,22 +1,22 @@
/********************************************************************************************** /**********************************************************************************************
* *
* raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) * raylib v5.5 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
* *
* FEATURES: * FEATURES:
* - NO external dependencies, all required libraries included with raylib * - NO external dependencies, all required libraries included with raylib
* - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, * - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly,
* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5. * MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5.
* - Written in plain C code (C99) in PascalCase/camelCase notation * - Written in plain C code (C99) in PascalCase/camelCase notation
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3 or ES2 - choose at compile) * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3, ES2, ES3 - choose at compile)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] * - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* - Multiple Fonts formats supported (TTF, XNA fonts, AngelCode fonts) * - Multiple Fonts formats supported (TTF, OTF, FNT, BDF, Sprite fonts)
* - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC) * - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more! * - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
* - Flexible Materials system, supporting classic maps and PBR maps * - Flexible Materials system, supporting classic maps and PBR maps
* - Animated 3D models supported (skeletal bones animation) (IQM) * - Animated 3D models supported (skeletal bones animation) (IQM, M3D, GLTF)
* - Shaders support, including Model shaders and Postprocessing shaders * - Shaders support, including Model shaders and Postprocessing shaders
* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath] * - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD) * - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, QOA, XM, MOD)
* - VR stereo rendering with configurable HMD device parameters * - VR stereo rendering with configurable HMD device parameters
* - Bindings to multiple programming languages available! * - Bindings to multiple programming languages available!
* *
@ -27,29 +27,35 @@
* - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2) * - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2)
* *
* DEPENDENCIES (included): * DEPENDENCIES (included):
* [rcore] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input (PLATFORM_DESKTOP) * [rcore][GLFW] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input
* [rlgl] glad (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (PLATFORM_DESKTOP) * [rcore][RGFW] rgfw (ColleagueRiley - github.com/ColleagueRiley/RGFW) for window/context management and input
* [rlgl] glad/glad_gles2 (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading
* [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management * [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management
* *
* OPTIONAL DEPENDENCIES (included): * OPTIONAL DEPENDENCIES (included):
* [rcore] msf_gif (Miles Fogle) for GIF recording * [rcore] msf_gif (Miles Fogle) for GIF recording
* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm * [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm
* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm * [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm
* [rcore] rprand (Ramon Snatamaria) for pseudo-random numbers generation
* [rtextures] qoi (Dominic Szablewski - https://phoboslab.org) for QOI image manage
* [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...) * [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
* [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG) * [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
* [rtextures] stb_image_resize (Sean Barret) for image resizing algorithms * [rtextures] stb_image_resize2 (Sean Barret) for image resizing algorithms
* [rtextures] stb_perlin (Sean Barret) for Perlin Noise image generation
* [rtext] stb_truetype (Sean Barret) for ttf fonts loading * [rtext] stb_truetype (Sean Barret) for ttf fonts loading
* [rtext] stb_rect_pack (Sean Barret) for rectangles packing * [rtext] stb_rect_pack (Sean Barret) for rectangles packing
* [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation * [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation
* [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL) * [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
* [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF) * [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF)
* [rmodels] Model3D (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d) * [rmodels] m3d (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d)
* [rmodels] vox_loader (Johann Nadalutti) for models loading (VOX)
* [raudio] dr_wav (David Reid) for WAV audio file loading * [raudio] dr_wav (David Reid) for WAV audio file loading
* [raudio] dr_flac (David Reid) for FLAC audio file loading * [raudio] dr_flac (David Reid) for FLAC audio file loading
* [raudio] dr_mp3 (David Reid) for MP3 audio file loading * [raudio] dr_mp3 (David Reid) for MP3 audio file loading
* [raudio] stb_vorbis (Sean Barret) for OGG audio loading * [raudio] stb_vorbis (Sean Barret) for OGG audio loading
* [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading * [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
* [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading * [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
* [raudio] qoa (Dominic Szablewski - https://phoboslab.org) for QOA audio manage
* *
* *
* LICENSE: zlib/libpng * LICENSE: zlib/libpng
@ -57,7 +63,7 @@
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, * raylib 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) 2013-2023 Ramon Santamaria (@raysan5) * Copyright (c) 2013-2024 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.
@ -75,8 +81,9 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
* *
**********************************************************************************************/ **********************************************************************************************/
// Function specifiers in case library is build/used as a shared library (Windows) // Function specifiers in case library is build/used as a shared library
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
// NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Some basic Defines // Some basic Defines
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -224,8 +231,10 @@ typedef struct Mesh {
// Animation vertex data // Animation vertex data
float *animVertices; // Animated vertex positions (after bones transformations) float *animVertices; // Animated vertex positions (after bones transformations)
float *animNormals; // Animated normals (after bones transformations) float *animNormals; // Animated normals (after bones transformations)
unsigned char *boneIds; // Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) unsigned char *boneIds; // Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)
float *boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning) float *boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)
Matrix *boneMatrices; // Bones animated transformation matrices
int boneCount; // Number of bones
// OpenGL identifiers // OpenGL identifiers
unsigned int vaoId; // OpenGL Vertex Array Object id unsigned int vaoId; // OpenGL Vertex Array Object id
unsigned int *vboId; // OpenGL Vertex Buffer Objects id (default vertex data) unsigned int *vboId; // OpenGL Vertex Buffer Objects id (default vertex data)
@ -282,7 +291,7 @@ typedef struct ModelAnimation {
// Ray, ray for raycasting // Ray, ray for raycasting
typedef struct Ray { typedef struct Ray {
Vector3 position; // Ray position (origin) Vector3 position; // Ray position (origin)
Vector3 direction; // Ray direction Vector3 direction; // Ray direction (normalized)
} Ray; } Ray;
// RayCollision, ray hit information // RayCollision, ray hit information
typedef struct RayCollision { typedef struct RayCollision {
@ -335,7 +344,6 @@ typedef struct VrDeviceInfo {
int vResolution; // Vertical resolution in pixels int vResolution; // Vertical resolution in pixels
float hScreenSize; // Horizontal size in meters float hScreenSize; // Horizontal size in meters
float vScreenSize; // Vertical size in meters float vScreenSize; // Vertical size in meters
float vScreenCenter; // Screen center in meters
float eyeToScreenDistance; // Distance between eye and display in meters float eyeToScreenDistance; // Distance between eye and display in meters
float lensSeparationDistance; // Lens separation distance in meters float lensSeparationDistance; // Lens separation distance in meters
float interpupillaryDistance; // IPD (distance between pupils) in meters float interpupillaryDistance; // IPD (distance between pupils) in meters
@ -522,7 +530,7 @@ typedef enum {
KEY_KP_EQUAL = 336, // Key: Keypad = KEY_KP_EQUAL = 336, // Key: Keypad =
// Android key buttons // Android key buttons
KEY_BACK = 4, // Key: Android back button KEY_BACK = 4, // Key: Android back button
KEY_MENU = 82, // Key: Android menu button KEY_MENU = 5, // Key: Android menu button
KEY_VOLUME_UP = 24, // Key: Android volume up button KEY_VOLUME_UP = 24, // Key: Android volume up button
KEY_VOLUME_DOWN = 25 // Key: Android volume down button KEY_VOLUME_DOWN = 25 // Key: Android volume down button
} KeyboardKey; } KeyboardKey;
@ -559,12 +567,12 @@ typedef enum {
GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Gamepad left DPAD down button GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Gamepad left DPAD down button
GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Gamepad left DPAD left button GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Gamepad left DPAD left button
GAMEPAD_BUTTON_RIGHT_FACE_UP, // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) GAMEPAD_BUTTON_RIGHT_FACE_UP, // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // Gamepad right button right (i.e. PS3: Square, Xbox: X) GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // Gamepad right button right (i.e. PS3: Circle, Xbox: B)
GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // Gamepad right button down (i.e. PS3: Cross, Xbox: A) GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // Gamepad right button down (i.e. PS3: Cross, Xbox: A)
GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Circle, Xbox: B) GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Square, Xbox: X)
GAMEPAD_BUTTON_LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button GAMEPAD_BUTTON_LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button
GAMEPAD_BUTTON_LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button GAMEPAD_BUTTON_LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button
GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (one), it could be a trailing button GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (first), it could be a trailing button
GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button
GAMEPAD_BUTTON_MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select) GAMEPAD_BUTTON_MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select)
GAMEPAD_BUTTON_MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) GAMEPAD_BUTTON_MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
@ -622,7 +630,10 @@ typedef enum {
SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap
SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance
SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter
SHADER_LOC_MAP_BRDF // Shader location: sampler2d texture: brdf SHADER_LOC_MAP_BRDF, // Shader location: sampler2d texture: brdf
SHADER_LOC_VERTEX_BONEIDS, // Shader location: vertex attribute: boneIds
SHADER_LOC_VERTEX_BONEWEIGHTS, // Shader location: vertex attribute: boneWeights
SHADER_LOC_BONE_MATRICES // Shader location: array of matrices uniform: boneMatrices
} ShaderLocationIndex; } ShaderLocationIndex;
// Shader uniform data type // Shader uniform data type
typedef enum { typedef enum {
@ -695,8 +706,7 @@ typedef enum {
CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces
CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE // Layout is defined by a 4x3 cross with cubemap faces
CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map)
} CubemapLayout; } CubemapLayout;
// Font type, defines generation method // Font type, defines generation method
typedef enum { typedef enum {
@ -732,11 +742,11 @@ typedef enum {
} Gesture; } Gesture;
// Camera system modes // Camera system modes
typedef enum { typedef enum {
CAMERA_CUSTOM = 0, // Custom camera CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing)
CAMERA_FREE, // Free camera CAMERA_FREE, // Camera free mode
CAMERA_ORBITAL, // Orbital camera CAMERA_ORBITAL, // Camera orbital, around target, zoom supported
CAMERA_FIRST_PERSON, // First person camera CAMERA_FIRST_PERSON, // Camera first person
CAMERA_THIRD_PERSON // Third person camera CAMERA_THIRD_PERSON // Camera third person
} CameraMode; } CameraMode;
// Camera projection // Camera projection
typedef enum { typedef enum {
@ -750,7 +760,7 @@ typedef enum {
NPATCH_THREE_PATCH_HORIZONTAL // Npatch layout: 3x1 tiles NPATCH_THREE_PATCH_HORIZONTAL // Npatch layout: 3x1 tiles
} NPatchLayout; } NPatchLayout;
// Callbacks to hook some internal functions // Callbacks to hook some internal functions
// WARNING: These callbacks are intended for advance users // WARNING: These callbacks are intended for advanced users
typedef void (*TraceLogCallback)(int logLevel, const char *text, void * args); // Logging: Redirect trace log messages typedef void (*TraceLogCallback)(int logLevel, const char *text, void * args); // Logging: Redirect trace log messages
typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data
typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data
@ -769,36 +779,36 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
bool IsWindowReady(void); // Check if window has been initialized successfully bool IsWindowReady(void); // Check if window has been initialized successfully
bool IsWindowFullscreen(void); // Check if window is currently fullscreen bool IsWindowFullscreen(void); // Check if window is currently fullscreen
bool IsWindowHidden(void); // Check if window is currently hidden (only PLATFORM_DESKTOP) bool IsWindowHidden(void); // Check if window is currently hidden
bool IsWindowMinimized(void); // Check if window is currently minimized (only PLATFORM_DESKTOP) bool IsWindowMinimized(void); // Check if window is currently minimized
bool IsWindowMaximized(void); // Check if window is currently maximized (only PLATFORM_DESKTOP) bool IsWindowMaximized(void); // Check if window is currently maximized
bool IsWindowFocused(void); // Check if window is currently focused (only PLATFORM_DESKTOP) bool IsWindowFocused(void); // Check if window is currently focused
bool IsWindowResized(void); // Check if window has been resized last frame bool IsWindowResized(void); // Check if window has been resized last frame
bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP) void SetWindowState(unsigned int flags); // Set window configuration state using flags
void ClearWindowState(unsigned int flags); // Clear window configuration state flags void ClearWindowState(unsigned int flags); // Clear window configuration state flags
void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed, resizes monitor to match window resolution
void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed (only PLATFORM_DESKTOP) void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed, resizes window to match monitor resolution
void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP) void MaximizeWindow(void); // Set window state: maximized, if resizable
void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP) void MinimizeWindow(void); // Set window state: minimized, if resizable
void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP) void RestoreWindow(void); // Set window state: not minimized/maximized
void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit)
void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit)
void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB) void SetWindowTitle(const char *title); // Set title for window
void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP) void SetWindowPosition(int x, int y); // Set window position on screen
void SetWindowMonitor(int monitor); // Set monitor for the current window void SetWindowMonitor(int monitor); // Set monitor for the current window
void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
void SetWindowSize(int width, int height); // Set window dimensions void SetWindowSize(int width, int height); // Set window dimensions
void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f]
void SetWindowFocused(void); // Set window focused (only PLATFORM_DESKTOP) void SetWindowFocused(void); // Set window focused
void *GetWindowHandle(void); // Get native window handle void *GetWindowHandle(void); // Get native window handle
int GetScreenWidth(void); // Get current screen width int GetScreenWidth(void); // Get current screen width
int GetScreenHeight(void); // Get current screen height int GetScreenHeight(void); // Get current screen height
int GetRenderWidth(void); // Get current render width (it considers HiDPI) int GetRenderWidth(void); // Get current render width (it considers HiDPI)
int GetRenderHeight(void); // Get current render height (it considers HiDPI) int GetRenderHeight(void); // Get current render height (it considers HiDPI)
int GetMonitorCount(void); // Get number of connected monitors int GetMonitorCount(void); // Get number of connected monitors
int GetCurrentMonitor(void); // Get current connected monitor int GetCurrentMonitor(void); // Get current monitor where window is placed
Vector2 GetMonitorPosition(int monitor); // Get specified monitor position Vector2 GetMonitorPosition(int monitor); // Get specified monitor position
int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor) int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor)
int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor) int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor)
@ -810,6 +820,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
void SetClipboardText(const char *text); // Set clipboard text content void SetClipboardText(const char *text); // Set clipboard text content
const char *GetClipboardText(void); // Get clipboard text content const char *GetClipboardText(void); // Get clipboard text content
Image GetClipboardImage(void); // Get clipboard image content
void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling
// Cursor-related functions // Cursor-related functions
@ -844,7 +855,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// NOTE: Shader functionality is not available on OpenGL 1.1 // NOTE: Shader functionality is not available on OpenGL 1.1
Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
bool IsShaderReady(Shader shader); // Check if a shader is ready bool IsShaderValid(Shader shader); // Check if a shader is valid (loaded on GPU)
int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
@ -853,20 +864,21 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d) void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d)
void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM) void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
// Screen-space-related functions // Screen-space-related functions
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Get a ray trace from mouse position Ray GetScreenToWorldRay(Vector2 position, Camera camera); // Get a ray trace from screen position (i.e mouse)
Matrix GetCameraMatrix(Camera camera); // Get camera transform matrix (view matrix) Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); // Get a ray trace from screen position (i.e mouse) in a viewport
Matrix GetCameraMatrix2D(Camera2D camera); // Get camera 2d transform matrix
Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position
Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position
Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position
Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position
Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position
Matrix GetCameraMatrix(Camera camera); // Get camera transform matrix (view matrix)
Matrix GetCameraMatrix2D(Camera2D camera); // Get camera 2d transform matrix
// Timing-related functions // Timing-related functions
void SetTargetFPS(int fps); // Set target FPS (maximum) void SetTargetFPS(int fps); // Set target FPS (maximum)
float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time) float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time)
double GetTime(void); // Get elapsed time in seconds since InitWindow() double GetTime(void); // Get elapsed time in seconds since InitWindow()
int GetFPS(void); // Get current FPS int GetFPS(void); // Get current FPS
// Custom frame control functions // Custom frame control functions
// NOTE: Those functions are intended for advance users that want full control over the frame processing // NOTE: Those functions are intended for advanced users that want full control over the frame processing
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents() // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL // To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing) void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
@ -889,7 +901,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator
void MemFree(void *ptr); // Internal memory free void MemFree(void *ptr); // Internal memory free
// Set custom callbacks // Set custom callbacks
// WARNING: Callbacks setup is intended for advance users // WARNING: Callbacks setup is intended for advanced users
void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
@ -916,10 +928,12 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string) const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
const char *GetWorkingDirectory(void); // Get current working directory (uses static string) const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string) const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
bool ChangeDirectory(const char *dir); // Change working directory, return true on success bool ChangeDirectory(const char *dir); // Change working directory, return true on success
bool IsPathFile(const char *path); // Check if a given path is a file or a directory bool IsPathFile(const char *path); // Check if a given path is a file or a directory
bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result
void UnloadDirectoryFiles(FilePathList files); // Unload filepaths void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
bool IsFileDropped(void); // Check if a file has been dropped into window bool IsFileDropped(void); // Check if a file has been dropped into window
FilePathList LoadDroppedFiles(void); // Load dropped filepaths FilePathList LoadDroppedFiles(void); // Load dropped filepaths
@ -930,9 +944,12 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree() unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree()
char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree() char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree()
unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree() unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code
unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes)
unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes)
// Automation events functionality // Automation events functionality
AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
void UnloadAutomationEventList(AutomationEventList *list); // Unload automation events list from file void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
@ -944,7 +961,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Input-related functions: keyboard // Input-related functions: keyboard
bool IsKeyPressed(int key); // Check if a key has been pressed once bool IsKeyPressed(int key); // Check if a key has been pressed once
bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again (Only PLATFORM_DESKTOP) bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again
bool IsKeyDown(int key); // Check if a key is being pressed bool IsKeyDown(int key); // Check if a key is being pressed
bool IsKeyReleased(int key); // Check if a key has been released once bool IsKeyReleased(int key); // Check if a key has been released once
bool IsKeyUp(int key); // Check if a key is NOT being pressed bool IsKeyUp(int key); // Check if a key is NOT being pressed
@ -962,6 +979,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB) int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds)
// Input-related functions: mouse // Input-related functions: mouse
bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once
bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed
@ -989,7 +1007,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected
int GetGestureDetected(void); // Get latest detected gesture int GetGestureDetected(void); // Get latest detected gesture
float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds float GetGestureHoldDuration(void); // Get gesture hold time in seconds
Vector2 GetGestureDragVector(void); // Get gesture drag vector Vector2 GetGestureDragVector(void); // Get gesture drag vector
float GetGestureDragAngle(void); // Get gesture drag angle float GetGestureDragAngle(void); // Get gesture drag angle
Vector2 GetGesturePinchVector(void); // Get gesture pinch delta Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
@ -1006,18 +1024,20 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// NOTE: It can be useful when using basic shapes and one single font, // NOTE: It can be useful when using basic shapes and one single font,
// defining a font char white rectangle would allow drawing everything in a single draw call // defining a font char white rectangle would allow drawing everything in a single draw call
void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing
Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
// Basic shapes drawing functions // Basic shapes drawing functions
void DrawPixel(int posX, int posY, Color color); // Draw a pixel void DrawPixel(int posX, int posY, Color color); // Draw a pixel using geometry [Can be slow, use with care]
void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version) void DrawPixelV(Vector2 position, Color color); // Draw a pixel using geometry (Vector version) [Can be slow, use with care]
void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines) void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads) void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines) void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer); // Draw a gradient-filled circle
void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version) void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
@ -1029,26 +1049,27 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight); // Draw a gradient-filled rectangle with custom vertex colors
void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle lines with rounded edges
void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!) void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center) void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
// Splines drawing functions // Splines drawing functions
void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
@ -1064,12 +1085,13 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle
bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Texture Loading and Drawing Functions (Module: textures) // Texture Loading and Drawing Functions (Module: textures)
@ -1078,12 +1100,12 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// NOTE: These functions do not require GPU access // NOTE: These functions do not require GPU access
Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM) Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
Image LoadImageSvg(const char *fileNameOrString, int width, int height); // Load image from SVG file data or string with specified size
Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data) Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
Image LoadImageAnimFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int *frames); // Load image sequence from memory buffer
Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png' Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png'
Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data
Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot) Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot)
bool IsImageReady(Image image); // Check if an image is ready bool IsImageValid(Image image); // Check if an image is valid (data and parameters)
void UnloadImage(Image image); // Unload image from CPU memory (RAM) void UnloadImage(Image image); // Unload image from CPU memory (RAM)
bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success
unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer
@ -1101,6 +1123,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// Image manipulation functions // Image manipulation functions
Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece
Image ImageFromChannel(Image image, int selectedChannel); // Create an image from a selected channel of another image (GRAYSCALE)
Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font) Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font) Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
void ImageFormat(Image *image, int newFormat); // Convert image data to desired format void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
@ -1111,6 +1134,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize); // Apply custom square convolution kernel to image
void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
@ -1140,6 +1164,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version) void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version) void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color color); // Draw a line defining thickness within an image
void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version) void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
@ -1148,6 +1173,11 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version) void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source) void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination) void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination) void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
@ -1157,9 +1187,9 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
Texture2D LoadTextureFromImage(Image image); // Load texture from image data Texture2D LoadTextureFromImage(Image image); // Load texture from image data
TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer) RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
bool IsTextureReady(Texture2D texture); // Check if a texture is ready bool IsTextureValid(Texture2D texture); // Check if a texture is valid (loaded in GPU)
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM) void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
bool IsRenderTextureReady(RenderTexture2D target); // Check if a render texture is ready bool IsRenderTextureValid(RenderTexture2D target); // Check if a render texture is valid (loaded in GPU)
void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM) void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
@ -1175,8 +1205,9 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely
// Color/pixel related functions // Color/pixel related functions
bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal
Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
int ColorToInt(Color color); // Get hexadecimal value for a Color int ColorToInt(Color color); // Get hexadecimal value for a Color (0xRRGGBBAA)
Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1] Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1]
Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1] Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1]
Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1] Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1]
@ -1186,6 +1217,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f
Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
Color ColorLerp(Color color1, Color color2, float factor); // Get color lerp interpolation between two colors, factor [0.0f..1.0f]
Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
@ -1196,10 +1228,10 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// Font loading/unloading functions // Font loading/unloading functions
Font GetFontDefault(void); // Get the default Font Font GetFontDefault(void); // Get the default Font
Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
bool IsFontReady(Font font); // Check if a font is ready bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use
Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM) void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
@ -1236,7 +1268,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf() style) const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf() style)
const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!) char *TextReplace(const char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!)
char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!) char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!)
const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
@ -1245,7 +1277,10 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
const char *TextToUpper(const char *text); // Get upper case version of provided string const char *TextToUpper(const char *text); // Get upper case version of provided string
const char *TextToLower(const char *text); // Get lower case version of provided string const char *TextToLower(const char *text); // Get lower case version of provided string
const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
int TextToInteger(const char *text); // Get integer value from text (negative values not supported) int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
float TextToFloat(const char *text); // Get float value from text (negative values not supported)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models) // Basic 3d Shapes Drawing Functions (Module: models)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -1254,7 +1289,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version) void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
@ -1277,7 +1312,7 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// Model management functions // Model management functions
Model LoadModel(const char *fileName); // Load model from files (meshes and materials) Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material) Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
bool IsModelReady(Model model); // Check if a model is ready bool IsModelValid(Model model); // Check if a model is valid (loaded in GPU, VAO/VBOs)
void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM) void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes) BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
// Model drawing functions // Model drawing functions
@ -1285,8 +1320,10 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set) void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
void DrawModelPoints(Model model, Vector3 position, float scale, Color tint); // Draw a model as points
void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model as points with extended parameters
void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires) void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
// Mesh management functions // Mesh management functions
@ -1295,9 +1332,10 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU
void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms
bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
void GenMeshTangents(Mesh *mesh); // Compute mesh tangents void GenMeshTangents(Mesh *mesh); // Compute mesh tangents
bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
bool ExportMeshAsCode(Mesh mesh, const char *fileName); // Export mesh as code file (.h) defining multiple arrays of vertex attributes
// Mesh generation functions // Mesh generation functions
Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh
Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions) Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
@ -1313,13 +1351,14 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
// Material loading/unloading functions // Material loading/unloading functions
Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
bool IsMaterialReady(Material material); // Check if a material is ready bool IsMaterialValid(Material material); // Check if a material is valid (shader assigned, map textures loaded in GPU)
void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM) void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
// Model animations loading/unloading functions // Model animations loading/unloading functions
ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file
void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose (CPU)
void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame); // Update model animation mesh bone matrices (GPU skinning)
void UnloadModelAnimation(ModelAnimation anim); // Unload animation data void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
@ -1345,11 +1384,11 @@ typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
// Wave/Sound loading/unloading functions // Wave/Sound loading/unloading functions
Wave LoadWave(const char *fileName); // Load wave data from file Wave LoadWave(const char *fileName); // Load wave data from file
Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load wave from memory buffer, fileType refers to extension: i.e. '.wav' Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
bool IsWaveReady(Wave wave); // Checks if wave data is ready bool IsWaveValid(Wave wave); // Checks if wave data is valid (data loaded and parameters)
Sound LoadSound(const char *fileName); // Load sound from file Sound LoadSound(const char *fileName); // Load sound from file
Sound LoadSoundFromWave(Wave wave); // Load sound from wave data Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
bool IsSoundReady(Sound sound); // Checks if a sound is ready bool IsSoundValid(Sound sound); // Checks if a sound is valid (data loaded and buffers initialized)
void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
void UnloadWave(Wave wave); // Unload wave data void UnloadWave(Wave wave); // Unload wave data
void UnloadSound(Sound sound); // Unload sound void UnloadSound(Sound sound); // Unload sound
@ -1366,14 +1405,14 @@ typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level) void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center) void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
Wave WaveCopy(Wave wave); // Copy a wave to a new wave Wave WaveCopy(Wave wave); // Copy a wave to a new wave
void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range
void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array
void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples() void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples()
// Music management functions // Music management functions
Music LoadMusicStream(const char *fileName); // Load music stream from file Music LoadMusicStream(const char *fileName); // Load music stream from file
Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data
bool IsMusicReady(Music music); // Checks if a music stream is ready bool IsMusicValid(Music music); // Checks if a music stream is valid (context and buffers initialized)
void UnloadMusicStream(Music music); // Unload music stream void UnloadMusicStream(Music music); // Unload music stream
void PlayMusicStream(Music music); // Start music playing void PlayMusicStream(Music music); // Start music playing
bool IsMusicStreamPlaying(Music music); // Check if music is playing bool IsMusicStreamPlaying(Music music); // Check if music is playing
@ -1389,7 +1428,7 @@ typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
float GetMusicTimePlayed(Music music); // Get current music time played (in seconds) float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
// AudioStream management functions // AudioStream management functions
AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Load audio stream (to stream raw audio pcm data) AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Load audio stream (to stream raw audio pcm data)
bool IsAudioStreamReady(AudioStream stream); // Checks if an audio stream is ready bool IsAudioStreamValid(AudioStream stream); // Checks if an audio stream is valid (buffers initialized)
void UnloadAudioStream(AudioStream stream); // Unload audio stream and free memory void UnloadAudioStream(AudioStream stream); // Unload audio stream and free memory
void UpdateAudioStream(AudioStream stream, const void *data, int frameCount); // Update audio stream buffers with data void UpdateAudioStream(AudioStream stream, const void *data, int frameCount); // Update audio stream buffers with data
bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
@ -1403,7 +1442,7 @@ typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered) void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as <float>s void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float'
void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as <float>s void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline

View file

@ -1,6 +1,6 @@
/********************************************************************************************** /**********************************************************************************************
* *
* raymath v1.5 - Math functions to work with Vector2, Vector3, Matrix and Quaternions * raymath v2.0 - Math functions to work with Vector2, Vector3, Matrix and Quaternions
* *
* CONVENTIONS: * CONVENTIONS:
* - Matrix structure is defined as row-major (memory layout) but parameters naming AND all * - Matrix structure is defined as row-major (memory layout) but parameters naming AND all
@ -12,7 +12,7 @@
* - Functions are always self-contained, no function use another raymath function inside, * - Functions are always self-contained, no function use another raymath function inside,
* required code is directly re-implemented inside * required code is directly re-implemented inside
* - Functions input parameters are always received by value (2 unavoidable exceptions) * - Functions input parameters are always received by value (2 unavoidable exceptions)
* - Functions use always a "result" variable for return * - Functions use always a "result" variable for return (except C++ operators)
* - Functions are always defined inline * - Functions are always defined inline
* - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience) * - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience)
* - No compound literals used to make sure libray is compatible with C++ * - No compound literals used to make sure libray is compatible with C++
@ -26,10 +26,12 @@
* #define RAYMATH_STATIC_INLINE * #define RAYMATH_STATIC_INLINE
* This may use up lots of memory. * This may use up lots of memory.
* *
* #define RAYMATH_DISABLE_CPP_OPERATORS
* Disables C++ operator overloads for raymath types.
* *
* LICENSE: zlib/libpng * LICENSE: zlib/libpng
* *
* Copyright (c) 2015-2023 Ramon Santamaria (@raysan5) * Copyright (c) 2015-2024 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.
@ -99,14 +101,21 @@ inline /* Functions may be inlined or external definition used*/ Vector2 Vector2
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Normalize(Vector2 v);// Transforms a Vector2 by a given Matrix inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Normalize(Vector2 v);// Transforms a Vector2 by a given Matrix
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Transform(Vector2 v, Matrix mat);// Calculate linear interpolation between two vectors inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Transform(Vector2 v, Matrix mat);// Calculate linear interpolation between two vectors
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);// Calculate reflected vector to normal inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);// Calculate reflected vector to normal
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Reflect(Vector2 v, Vector2 normal);// Rotate vector by angle inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Reflect(Vector2 v, Vector2 normal);// Get min value for each pair of components
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Min(Vector2 v1, Vector2 v2);// Get max value for each pair of components
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Max(Vector2 v1, Vector2 v2);// Rotate vector by angle
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Rotate(Vector2 v, float angle);// Move Vector towards target inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Rotate(Vector2 v, float angle);// Move Vector towards target
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance);// Invert the given vector inline /* Functions may be inlined or external definition used*/ Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance);// Invert the given vector
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Invert(Vector2 v);// Clamp the components of the vector between inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Invert(Vector2 v);// Clamp the components of the vector between
// min and max values specified by the given vectors // min and max values specified by the given vectors
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max);// Clamp the magnitude of the vector between two min and max values inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max);// Clamp the magnitude of the vector between two min and max values
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2ClampValue(Vector2 v, float min, float max);// Check whether two given vectors are almost equal inline /* Functions may be inlined or external definition used*/ Vector2 Vector2ClampValue(Vector2 v, float min, float max);// Check whether two given vectors are almost equal
inline /* Functions may be inlined or external definition used*/ int Vector2Equals(Vector2 p, Vector2 q);//---------------------------------------------------------------------------------- inline /* Functions may be inlined or external definition used*/ int Vector2Equals(Vector2 p, Vector2 q);// Compute the direction of a refracted ray
// v: normalized direction of the incoming ray
// n: normalized normal vector of the interface of two optical media
// r: ratio of the refractive index of the medium from where the ray comes
// to the refractive index of the medium on the other side of the surface
inline /* Functions may be inlined or external definition used*/ Vector2 Vector2Refract(Vector2 v, Vector2 n, float r);//----------------------------------------------------------------------------------
// Module Functions Definition - Vector3 math // Module Functions Definition - Vector3 math
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Vector with components value 0.0f // Vector with components value 0.0f
@ -136,8 +145,11 @@ inline /* Functions may be inlined or external definition used*/ Vector3 Vector3
inline /* Functions may be inlined or external definition used*/ void Vector3OrthoNormalize(Vector3 *v1, Vector3 *v2);// Transforms a Vector3 by a given Matrix inline /* Functions may be inlined or external definition used*/ void Vector3OrthoNormalize(Vector3 *v1, Vector3 *v2);// Transforms a Vector3 by a given Matrix
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Transform(Vector3 v, Matrix mat);// Transform a vector by quaternion rotation inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Transform(Vector3 v, Matrix mat);// Transform a vector by quaternion rotation
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);// Rotates a vector around an axis inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);// Rotates a vector around an axis
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);// Calculate linear interpolation between two vectors inline /* Functions may be inlined or external definition used*/ Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);// Move Vector towards target
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);// Calculate reflected vector to normal inline /* Functions may be inlined or external definition used*/ Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance);// Calculate linear interpolation between two vectors
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);// Calculate cubic hermite interpolation between two vectors and their tangents
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount);// Calculate reflected vector to normal
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Reflect(Vector3 v, Vector3 normal);// Get min value for each pair of components inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Reflect(Vector3 v, Vector3 normal);// Get min value for each pair of components
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Min(Vector3 v1, Vector3 v2);// Get max value for each pair of components inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Min(Vector3 v1, Vector3 v2);// Get max value for each pair of components
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Max(Vector3 v1, Vector3 v2);// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c) inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Max(Vector3 v1, Vector3 v2);// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)
@ -156,6 +168,21 @@ inline /* Functions may be inlined or external definition used*/ int Vector3Equa
// r: ratio of the refractive index of the medium from where the ray comes // r: ratio of the refractive index of the medium from where the ray comes
// to the refractive index of the medium on the other side of the surface // to the refractive index of the medium on the other side of the surface
inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Refract(Vector3 v, Vector3 n, float r);//---------------------------------------------------------------------------------- inline /* Functions may be inlined or external definition used*/ Vector3 Vector3Refract(Vector3 v, Vector3 n, float r);//----------------------------------------------------------------------------------
// Module Functions Definition - Vector4 math
//----------------------------------------------------------------------------------
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Zero(void);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4One(void);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Add(Vector4 v1, Vector4 v2);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4AddValue(Vector4 v, float add);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Subtract(Vector4 v1, Vector4 v2);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4SubtractValue(Vector4 v, float add);inline /* Functions may be inlined or external definition used*/ float Vector4Length(Vector4 v);inline /* Functions may be inlined or external definition used*/ float Vector4LengthSqr(Vector4 v);inline /* Functions may be inlined or external definition used*/ float Vector4DotProduct(Vector4 v1, Vector4 v2);// Calculate distance between two vectors
inline /* Functions may be inlined or external definition used*/ float Vector4Distance(Vector4 v1, Vector4 v2);// Calculate square distance between two vectors
inline /* Functions may be inlined or external definition used*/ float Vector4DistanceSqr(Vector4 v1, Vector4 v2);inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Scale(Vector4 v, float scale);// Multiply vector by vector
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Multiply(Vector4 v1, Vector4 v2);// Negate vector
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Negate(Vector4 v);// Divide vector by vector
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Divide(Vector4 v1, Vector4 v2);// Normalize provided vector
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Normalize(Vector4 v);// Get min value for each pair of components
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Min(Vector4 v1, Vector4 v2);// Get max value for each pair of components
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Max(Vector4 v1, Vector4 v2);// Calculate linear interpolation between two vectors
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Lerp(Vector4 v1, Vector4 v2, float amount);// Move Vector towards target
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4MoveTowards(Vector4 v, Vector4 target, float maxDistance);// Invert the given vector
inline /* Functions may be inlined or external definition used*/ Vector4 Vector4Invert(Vector4 v);// Check whether two given vectors are almost equal
inline /* Functions may be inlined or external definition used*/ int Vector4Equals(Vector4 p, Vector4 q);//----------------------------------------------------------------------------------
// Module Functions Definition - Matrix math // Module Functions Definition - Matrix math
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Compute matrix determinant // Compute matrix determinant
@ -182,7 +209,7 @@ inline /* Functions may be inlined or external definition used*/ Matrix MatrixRo
// NOTE: Angle must be provided in radians // NOTE: Angle must be provided in radians
inline /* Functions may be inlined or external definition used*/ Matrix MatrixRotateZYX(Vector3 angle);// Get scaling matrix inline /* Functions may be inlined or external definition used*/ Matrix MatrixRotateZYX(Vector3 angle);// Get scaling matrix
inline /* Functions may be inlined or external definition used*/ Matrix MatrixScale(float x, float y, float z);// Get perspective projection matrix inline /* Functions may be inlined or external definition used*/ Matrix MatrixScale(float x, float y, float z);// Get perspective projection matrix
inline /* Functions may be inlined or external definition used*/ Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far);// Get perspective projection matrix inline /* Functions may be inlined or external definition used*/ Matrix MatrixFrustum(double left, double right, double bottom, double top, double nearPlane, double farPlane);// Get perspective projection matrix
// NOTE: Fovy angle must be provided in radians // NOTE: Fovy angle must be provided in radians
inline /* Functions may be inlined or external definition used*/ Matrix MatrixPerspective(double fovY, double aspect, double nearPlane, double farPlane);// Get orthographic projection matrix inline /* Functions may be inlined or external definition used*/ Matrix MatrixPerspective(double fovY, double aspect, double nearPlane, double farPlane);// Get orthographic projection matrix
inline /* Functions may be inlined or external definition used*/ Matrix MatrixOrtho(double left, double right, double bottom, double top, double nearPlane, double farPlane);// Get camera look-at matrix (view matrix) inline /* Functions may be inlined or external definition used*/ Matrix MatrixOrtho(double left, double right, double bottom, double top, double nearPlane, double farPlane);// Get camera look-at matrix (view matrix)
@ -204,7 +231,9 @@ inline /* Functions may be inlined or external definition used*/ Quaternion Quat
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);// Calculate linear interpolation between two quaternions inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);// Calculate linear interpolation between two quaternions
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);// Calculate slerp-optimized interpolation between two quaternions inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);// Calculate slerp-optimized interpolation between two quaternions
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);// Calculates spherical linear interpolation between two quaternions inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);// Calculates spherical linear interpolation between two quaternions
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);// Calculate quaternion based on the rotation from one vector to another inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);// Calculate quaternion cubic spline interpolation using Cubic Hermite Spline algorithm
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionCubicHermiteSpline(Quaternion q1, Quaternion outTangent1, Quaternion q2, Quaternion inTangent2, float t);// Calculate quaternion based on the rotation from one vector to another
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);// Get a quaternion for a given rotation matrix inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);// Get a quaternion for a given rotation matrix
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionFromMatrix(Matrix mat);// Get a matrix for a given quaternion inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionFromMatrix(Matrix mat);// Get a matrix for a given quaternion
inline /* Functions may be inlined or external definition used*/ Matrix QuaternionToMatrix(Quaternion q);// Get rotation quaternion for an angle and axis inline /* Functions may be inlined or external definition used*/ Matrix QuaternionToMatrix(Quaternion q);// Get rotation quaternion for an angle and axis
@ -216,4 +245,5 @@ inline /* Functions may be inlined or external definition used*/ Quaternion Quat
// NOTE: Angles are returned in a Vector3 struct in radians // NOTE: Angles are returned in a Vector3 struct in radians
inline /* Functions may be inlined or external definition used*/ Vector3 QuaternionToEuler(Quaternion q);// Transform a quaternion given a transformation matrix inline /* Functions may be inlined or external definition used*/ Vector3 QuaternionToEuler(Quaternion q);// Transform a quaternion given a transformation matrix
inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionTransform(Quaternion q, Matrix mat);// Check whether two given quaternions are almost equal inline /* Functions may be inlined or external definition used*/ Quaternion QuaternionTransform(Quaternion q, Matrix mat);// Check whether two given quaternions are almost equal
inline /* Functions may be inlined or external definition used*/ int QuaternionEquals(Quaternion p, Quaternion q); inline /* Functions may be inlined or external definition used*/ int QuaternionEquals(Quaternion p, Quaternion q);// Decompose a transformation matrix into its rotational, translational and scaling components
inline /* Functions may be inlined or external definition used*/ void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale);

View file

@ -1,6 +1,6 @@
/********************************************************************************************** /**********************************************************************************************
* *
* rlgl v4.5 - A multi-OpenGL abstraction layer with an immediate-mode style API * rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API
* *
* DESCRIPTION: * DESCRIPTION:
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0) * An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
@ -8,17 +8,17 @@
* *
* ADDITIONAL NOTES: * ADDITIONAL NOTES:
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are * When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
* initialized on rlglInit() to accumulate vertex data. * initialized on rlglInit() to accumulate vertex data
* *
* When an internal state change is required all the stored vertex data is renderer in batch, * When an internal state change is required all the stored vertex data is renderer in batch,
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch. * additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch
* *
* Some resources are also loaded for convenience, here the complete list: * Some resources are also loaded for convenience, here the complete list:
* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data * - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data
* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8 * - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8
* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs) * - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs)
* *
* Internal buffer (and resources) must be manually unloaded calling rlglClose(). * Internal buffer (and resources) must be manually unloaded calling rlglClose()
* *
* CONFIGURATION: * CONFIGURATION:
* #define GRAPHICS_API_OPENGL_11 * #define GRAPHICS_API_OPENGL_11
@ -32,9 +32,9 @@
* required by any other module, use rlGetVersion() to check it * required by any other module, use rlGetVersion() to check it
* *
* #define RLGL_IMPLEMENTATION * #define RLGL_IMPLEMENTATION
* Generates the implementation of the library into the included file. * Generates the implementation of the library into the included file
* If not defined, the library is in header only mode and can be included in other headers * If not defined, the library is in header only mode and can be included in other headers
* or source files without problems. But only ONE file should hold the implementation. * or source files without problems. But only ONE file should hold the implementation
* *
* #define RLGL_RENDER_TEXTURES_HINT * #define RLGL_RENDER_TEXTURES_HINT
* Enable framebuffer objects (fbo) support (enabled by default) * Enable framebuffer objects (fbo) support (enabled by default)
@ -62,18 +62,21 @@
* When loading a shader, the following vertex attributes and uniform * When loading a shader, the following vertex attributes and uniform
* location names are tried to be set automatically: * location names are tried to be set automatically:
* *
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0 * #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1 * #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2 * #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3 * #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4 * #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: 5 * #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS "vertexBoneIds" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix * #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix * #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix * #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix * #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)) * #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)))
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) * #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES "boneMatrices" // bone matrices
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) * #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) * #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) * #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
@ -85,7 +88,7 @@
* *
* LICENSE: zlib/libpng * LICENSE: zlib/libpng
* *
* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2024 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.
@ -103,8 +106,9 @@
* 3. This notice may not be removed or altered from any source distribution. * 3. This notice may not be removed or altered from any source distribution.
* *
**********************************************************************************************/ **********************************************************************************************/
// Function specifiers in case library is build/used as a shared library (Windows) // Function specifiers in case library is build/used as a shared library
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
// NOTE: visibility(default) attribute makes symbols "visible" when compiled with -fvisibility=hidden
// Function specifiers definition // Function specifiers definition
// Support TRACELOG macros // Support TRACELOG macros
// Allow custom memory allocators // Allow custom memory allocators
@ -133,6 +137,7 @@
// GL Shader type // GL Shader type
// GL blending factors // GL blending factors
// GL blending functions/equations // GL blending functions/equations
// Default shader vertex attribute locations
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -141,10 +146,11 @@ typedef struct rlVertexBuffer {
int elementCount; // Number of elements in the buffer (QUADS) int elementCount; // Number of elements in the buffer (QUADS)
float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
float *normals; // Vertex normal (XYZ - 3 components per vertex) (shader-location = 2)
unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
unsigned int *indices; // Vertex indices (in case vertex data comes indexed) (6 indices per quad) unsigned int *indices; // Vertex indices (in case vertex data comes indexed) (6 indices per quad)
unsigned int vaoId; // OpenGL Vertex Array Object id unsigned int vaoId; // OpenGL Vertex Array Object id
unsigned int vboId[4]; // OpenGL Vertex Buffer Objects id (4 types of vertex data) unsigned int vboId[5]; // OpenGL Vertex Buffer Objects id (5 types of vertex data)
} rlVertexBuffer; } rlVertexBuffer;
// Draw call type // Draw call type
// NOTE: Only texture changes register a new draw, other state-change-related elements are not // NOTE: Only texture changes register a new draw, other state-change-related elements are not
@ -279,6 +285,10 @@ typedef enum {
RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int) RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int) RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int) RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
RL_SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int
RL_SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int)
RL_SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int)
RL_SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int)
RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
} rlShaderUniformDataType; } rlShaderUniformDataType;
// Shader attribute data types // Shader attribute data types
@ -332,6 +342,9 @@ typedef enum {
void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar); void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar); void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar);
void rlViewport(int x, int y, int width, int height); // Set the viewport area void rlViewport(int x, int y, int width, int height); // Set the viewport area
void rlSetClipPlanes(double nearPlane, double farPlane); // Set clip planes distances
double rlGetCullDistanceNear(void); // Get cull plane distance near
double rlGetCullDistanceFar(void); // Get cull plane distance far
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Functions Declaration - Vertex level operations // Functions Declaration - Vertex level operations
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -355,10 +368,10 @@ typedef enum {
void rlDisableVertexArray(void); // Disable vertex array (VAO, if supported) void rlDisableVertexArray(void); // Disable vertex array (VAO, if supported)
void rlEnableVertexBuffer(unsigned int id); // Enable vertex buffer (VBO) void rlEnableVertexBuffer(unsigned int id); // Enable vertex buffer (VBO)
void rlDisableVertexBuffer(void); // Disable vertex buffer (VBO) void rlDisableVertexBuffer(void); // Disable vertex buffer (VBO)
void rlEnableVertexBufferElement(unsigned int id);// Enable vertex buffer element (VBO element) void rlEnableVertexBufferElement(unsigned int id); // Enable vertex buffer element (VBO element)
void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element) void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element)
void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index
void rlDisableVertexAttribute(unsigned int index);// Disable vertex attribute index void rlDisableVertexAttribute(unsigned int index); // Disable vertex attribute index
// Textures state // Textures state
void rlActiveTextureSlot(int slot); // Select and active a texture slot void rlActiveTextureSlot(int slot); // Select and active a texture slot
void rlEnableTexture(unsigned int id); // Enable texture void rlEnableTexture(unsigned int id); // Enable texture
@ -373,8 +386,10 @@ typedef enum {
// Framebuffer state // Framebuffer state
void rlEnableFramebuffer(unsigned int id); // Enable render texture (fbo) void rlEnableFramebuffer(unsigned int id); // Enable render texture (fbo)
void rlDisableFramebuffer(void); // Disable render texture (fbo), return to default framebuffer void rlDisableFramebuffer(void); // Disable render texture (fbo), return to default framebuffer
unsigned int rlGetActiveFramebuffer(void); // Get the currently active render texture (fbo), 0 for default framebuffer
void rlActiveDrawBuffers(int count); // Activate multiple draw color buffers void rlActiveDrawBuffers(int count); // Activate multiple draw color buffers
void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); // Blit active framebuffer to main framebuffer void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); // Blit active framebuffer to main framebuffer
void rlBindFramebuffer(unsigned int target, unsigned int framebuffer); // Bind framebuffer (FBO)
// General render state // General render state
void rlEnableColorBlend(void); // Enable color blending void rlEnableColorBlend(void); // Enable color blending
void rlDisableColorBlend(void); // Disable color blending void rlDisableColorBlend(void); // Disable color blending
@ -384,13 +399,14 @@ typedef enum {
void rlDisableDepthMask(void); // Disable depth write void rlDisableDepthMask(void); // Disable depth write
void rlEnableBackfaceCulling(void); // Enable backface culling void rlEnableBackfaceCulling(void); // Enable backface culling
void rlDisableBackfaceCulling(void); // Disable backface culling void rlDisableBackfaceCulling(void); // Disable backface culling
void rlColorMask(bool r, bool g, bool b, bool a); // Color mask control
void rlSetCullFace(int mode); // Set face culling mode void rlSetCullFace(int mode); // Set face culling mode
void rlEnableScissorTest(void); // Enable scissor test void rlEnableScissorTest(void); // Enable scissor test
void rlDisableScissorTest(void); // Disable scissor test void rlDisableScissorTest(void); // Disable scissor test
void rlScissor(int x, int y, int width, int height); // Scissor test void rlScissor(int x, int y, int width, int height); // Scissor test
void rlEnableWireMode(void); // Enable wire mode void rlEnableWireMode(void); // Enable wire mode
void rlEnablePointMode(void); // Enable point mode void rlEnablePointMode(void); // Enable point mode
void rlDisableWireMode(void); // Disable wire mode ( and point ) maybe rename void rlDisableWireMode(void); // Disable wire (and point) mode
void rlSetLineWidth(float width); // Set the line drawing width void rlSetLineWidth(float width); // Set the line drawing width
float rlGetLineWidth(void); // Get the line drawing width float rlGetLineWidth(void); // Get the line drawing width
void rlEnableSmoothLines(void); // Enable line aliasing void rlEnableSmoothLines(void); // Enable line aliasing
@ -432,24 +448,24 @@ typedef enum {
//------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------
// Vertex buffers management // Vertex buffers management
unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported
unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer attribute unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer object
unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load a new attributes element buffer unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load vertex buffer elements object
void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update GPU buffer with new data void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update vertex buffer object data on GPU buffer
void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements with new data void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements data on GPU buffer
void rlUnloadVertexArray(unsigned int vaoId); void rlUnloadVertexArray(unsigned int vaoId); // Unload vertex array (vao)
void rlUnloadVertexBuffer(unsigned int vboId); void rlUnloadVertexBuffer(unsigned int vboId); // Unload vertex buffer object
void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer); void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, int offset); // Set vertex attribute data configuration
void rlSetVertexAttributeDivisor(unsigned int index, int divisor); void rlSetVertexAttributeDivisor(unsigned int index, int divisor); // Set vertex attribute data divisor
void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value, when attribute to provided
void rlDrawVertexArray(int offset, int count); void rlDrawVertexArray(int offset, int count); // Draw vertex array (currently active vao)
void rlDrawVertexArrayElements(int offset, int count, const void *buffer); void rlDrawVertexArrayElements(int offset, int count, const void *buffer); // Draw vertex array elements
void rlDrawVertexArrayInstanced(int offset, int count, int instances); void rlDrawVertexArrayInstanced(int offset, int count, int instances); // Draw vertex array (currently active vao) with instancing
void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); // Draw vertex array elements with instancing
// Textures management // Textures management
unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture data
unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo)
unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap unsigned int rlLoadTextureCubemap(const void *data, int size, int format, int mipmapCount); // Load texture cubemap data
void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update GPU texture with new data void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update texture with new data on GPU
void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats
const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format
void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory
@ -457,7 +473,7 @@ typedef enum {
void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data
unsigned char *rlReadScreenPixels(int width, int height); // Read screen pixel data (color buffer) unsigned char *rlReadScreenPixels(int width, int height); // Read screen pixel data (color buffer)
// Framebuffer management (fbo) // Framebuffer management (fbo)
unsigned int rlLoadFramebuffer(int width, int height); // Load an empty framebuffer unsigned int rlLoadFramebuffer(void); // Load an empty framebuffer
void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer
bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete
void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU
@ -470,6 +486,7 @@ typedef enum {
int rlGetLocationAttrib(unsigned int shaderId, const char *attribName); // Get shader location attribute int rlGetLocationAttrib(unsigned int shaderId, const char *attribName); // Get shader location attribute
void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform
void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix
void rlSetUniformMatrices(int locIndex, const Matrix *mat, int count); // Set shader value matrices
void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler
void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations) void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations)
// Compute shader management // Compute shader management

View file

@ -1,7 +1,7 @@
import pathlib import pathlib
from setuptools import setup from setuptools import setup
from setuptools.dist import Distribution from setuptools.dist import Distribution
import os
# The directory containing this file # The directory containing this file
HERE = pathlib.Path(__file__).parent HERE = pathlib.Path(__file__).parent
@ -10,6 +10,13 @@ HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text() README = (HERE / "README.md").read_text()
VERSION = (HERE / "version.py").read_text().split()[-1].strip("\"'") VERSION = (HERE / "version.py").read_text().split()[-1].strip("\"'")
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
if RAYLIB_PLATFORM == "SDL":
NAME = "raylib_sdl"
elif RAYLIB_PLATFORM == "DRM":
NAME = "raylib_drm"
else:
NAME = "raylib"
class BinaryDistribution(Distribution): class BinaryDistribution(Distribution):
"""Distribution which always forces a binary package with platform name""" """Distribution which always forces a binary package with platform name"""
@ -18,7 +25,7 @@ class BinaryDistribution(Distribution):
# This call to setup() does all the work # This call to setup() does all the work
setup( setup(
name="raylib", name=NAME,
version=VERSION, version=VERSION,
description="Python CFFI bindings for Raylib", description="Python CFFI bindings for Raylib",
long_description=README, long_description=README,

View file

@ -21,7 +21,7 @@ model.materials.maps[pr.MaterialMapIndex.MATERIAL_MAP_ALBEDO].texture = texture
pr.unload_image(image) pr.unload_image(image)
pos = pr.get_mouse_position() pos = pr.get_mouse_position()
ray = pr.get_mouse_ray(pos, camera) ray = pr.get_screen_to_world_ray(pos, camera)
#rayhit = pr.get_ray_collision_ground(ray, 0) #rayhit = pr.get_ray_collision_ground(ray, 0)
#print(str(rayhit.position.x)) #print(str(rayhit.position.x))
@ -37,7 +37,7 @@ while not pr.window_should_close():
pr.end_drawing() pr.end_drawing()
pos = pr.get_mouse_position() pos = pr.get_mouse_position()
ray = pr.get_mouse_ray(pos, camera) ray = pr.get_screen_to_world_ray(pos, camera)
#rayhit = pr.get_ray_collision_ground(ray, 0) #rayhit = pr.get_ray_collision_ground(ray, 0)
#print(str(rayhit.position.x)) #print(str(rayhit.position.x))

View file

@ -21,7 +21,7 @@ model.materials.maps[MATERIAL_MAP_ALBEDO].texture = texture
unload_image(image) unload_image(image)
pos = get_mouse_position() pos = get_mouse_position()
ray = get_mouse_ray(pos, camera) ray = get_screen_to_world_ray(pos, camera)
#rayhit = get_ray_collision_ground(ray, 0) #rayhit = get_ray_collision_ground(ray, 0)
#print(str(rayhit.position.x)) #print(str(rayhit.position.x))
@ -33,11 +33,11 @@ while not window_should_close():
draw_model(model, (-8.0, 0.0, -8.0), 1.0, RED) draw_model(model, (-8.0, 0.0, -8.0), 1.0, RED)
draw_grid(20, 1.0) draw_grid(20, 1.0)
end_mode_3d() end_mode_3d()
draw_text("This mesh should be textured", 190, 200, 20, VIOLET) draw_text("This mesh should be tesxtured", 190, 200, 20, VIOLET)
end_drawing() end_drawing()
pos = get_mouse_position() pos = get_mouse_position()
ray = get_mouse_ray(pos, camera) ray = get_screen_to_world_ray(pos, camera)
#rayhit = get_ray_collision_ground(ray, 0) #rayhit = get_ray_collision_ground(ray, 0)
#print(str(rayhit.position.x)) #print(str(rayhit.position.x))

View file

@ -1 +1 @@
__version__ = "5.0.0.5" __version__ = "5.5.0.0"