Compare commits
No commits in common. "master" and "v4.5.0.1" have entirely different histories.
167 changed files with 18918 additions and 39392 deletions
145
.cirrus.yml
145
.cirrus.yml
|
@ -1,157 +1,38 @@
|
||||||
# download at https://api.cirrus-ci.com/v1/artifact/github/electronstudio/raylib-python-cffi/pi/binary.zip
|
#container:
|
||||||
# https://api.cirrus-ci.com/v1/artifact/github/electronstudio/raylib-python-cffi/mac/binary.zip
|
# image: python:3.11
|
||||||
|
|
||||||
pi_task:
|
# download at https://api.cirrus-ci.com/v1/artifact/github/electronstudio/raylib-python-cffi/main/binary.zip
|
||||||
arm_container:
|
|
||||||
matrix:
|
|
||||||
- image: dtcooper/raspberrypi-os:python3.12-bullseye
|
|
||||||
- image: dtcooper/raspberrypi-os:python3.11-bullseye
|
|
||||||
- image: dtcooper/raspberrypi-os:python3.10-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:
|
|
||||||
- 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 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:
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
- cd raylib-c
|
|
||||||
- mkdir 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 ..
|
|
||||||
- make -j2
|
|
||||||
- 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:
|
|
||||||
- cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
|
|
||||||
- cp physac/src/physac.h /usr/local/include/
|
|
||||||
- cp raygui/src/raygui.h /usr/local/include/
|
|
||||||
- python -m pip install --break-system-packages --upgrade pip
|
|
||||||
- python -m pip install --break-system-packages cffi
|
|
||||||
- python -m pip install --break-system-packages setuptools
|
|
||||||
- python -m pip install --break-system-packages wheel
|
|
||||||
- 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:
|
|
||||||
path: "dist/*"
|
|
||||||
|
|
||||||
mac_task:
|
task:
|
||||||
macos_instance:
|
macos_instance:
|
||||||
matrix:
|
matrix:
|
||||||
|
- image: ghcr.io/cirruslabs/macos-monterey-xcode:latest
|
||||||
|
- image: ghcr.io/cirruslabs/macos-ventura-xcode:latest
|
||||||
- image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest
|
- image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest
|
||||||
env:
|
env:
|
||||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
matrix:
|
||||||
matrix:
|
- PY_VER: "3.9"
|
||||||
- env:
|
- PY_VER: "3.10"
|
||||||
PY_VER: "3.9"
|
- PY_VER: "3.11"
|
||||||
RAYLIB_PLATFORM: Desktop
|
- PY_VER: "3.12"
|
||||||
- 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.11"
|
|
||||||
RAYLIB_PLATFORM: SDL
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.12"
|
|
||||||
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
|
||||||
- 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 -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=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 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/
|
||||||
|
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages --upgrade pip
|
||||||
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages cffi
|
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages cffi
|
||||||
- /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/*"
|
353
.github/workflows/build.yml
vendored
353
.github/workflows/build.yml
vendored
|
@ -4,39 +4,28 @@ 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-intel:
|
build-mac:
|
||||||
runs-on: macos-13
|
runs-on: macos-11
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
|
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.7', 'pypy-3.8', '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@v4
|
- uses: actions/checkout@v2
|
||||||
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@v5
|
uses: actions/setup-python@v2.2.2
|
||||||
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 }}
|
||||||
|
@ -44,130 +33,64 @@ 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 without SDL because SDL version has incorrect pkg-config
|
- name: Build raylib
|
||||||
run: |
|
run: |
|
||||||
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 -DBUILD_EXAMPLES=off -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=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 }} -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
|
- 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
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
pip3 install setuptools
|
pip3 install setuptools
|
||||||
python setup.py bdist_wheel --plat-name macosx_10_13_x86_64
|
python setup.py bdist_wheel --plat-name macosx_10_15_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@v4
|
uses: actions/upload-artifact@v2.2.4
|
||||||
with:
|
with:
|
||||||
name: wheel-mac-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
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.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ]
|
# python-version: ['3.10', '3.11.0-alpha - 3.11.0' ]
|
||||||
# raylib-platform: ['Desktop', 'SDL']
|
# # 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.0
|
|
||||||
# steps:
|
# steps:
|
||||||
# # 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 -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 .
|
|
||||||
#
|
|
||||||
# - name: Setup Python
|
# - name: Setup Python
|
||||||
# uses: actions/setup-python@v5
|
# uses: actions/setup-python@v2.2.2
|
||||||
# with:
|
# with:
|
||||||
# # 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 }}
|
||||||
# architecture: arm64
|
# architecture: x64
|
||||||
#
|
#
|
||||||
# # Runs a set of commands using the runners shell
|
# # Only build raylib for arm64 (although we could make a fat universal2 binary by asking for x86_64 as well)
|
||||||
# - name: Build raylib without SDL because SDL version has incorrect pkg-config
|
# - name: Build raylib
|
||||||
# run: |
|
# run: |
|
||||||
# cd raylib-c
|
# cd raylib-c
|
||||||
# mkdir build
|
# mkdir build
|
||||||
# cd build
|
# cd build
|
||||||
# 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 ..
|
# 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
|
# 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
|
||||||
|
@ -178,91 +101,145 @@ 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@v2.2.4
|
||||||
|
# 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@v2.2.4
|
||||||
|
# with:
|
||||||
|
# name: wheel
|
||||||
|
# path: dist/*
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
# 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.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
|
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.7', 'pypy-3.8', '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@v4
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v2.2.2
|
||||||
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 -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 ..
|
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 -j2
|
||||||
sudo make install
|
sudo make install
|
||||||
- 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
|
- 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
|
||||||
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@v4
|
uses: actions/upload-artifact@v2.2.4
|
||||||
with:
|
with:
|
||||||
name: wheel-linux-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
name: wheel
|
||||||
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@v2.2.4
|
||||||
|
# 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
|
||||||
|
@ -271,27 +248,15 @@ 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.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
|
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ]
|
||||||
raylib-platform: ['Desktop', 'SDL']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- 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@v5
|
uses: actions/setup-python@v2.2.2
|
||||||
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 }}
|
||||||
|
@ -299,27 +264,23 @@ jobs:
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v2
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
|
|
||||||
- name: Build raylib
|
- name: Build raylib
|
||||||
run: |
|
run: |
|
||||||
cd raylib-c
|
cd raylib-c
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
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 ..
|
cmake -DBUILD_EXAMPLES=off -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=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
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
pip3 install setuptools
|
pip3 install setuptools
|
||||||
del raylib\dynamic\*.so* >nul 2>&1
|
del raylib\dynamic\*.so* >nul 2>&1
|
||||||
|
@ -328,113 +289,87 @@ 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@v4
|
uses: actions/upload-artifact@v2.2.4
|
||||||
with:
|
with:
|
||||||
name: wheel-windows-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
name: wheel
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
source-distro:
|
source-distro:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
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@v4
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v2.2.2
|
||||||
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.10'
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
# The target architecture (x86, x64) of the Python interpreter.
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- 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 libwayland-dev libxkbcommon-dev
|
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 ..
|
cmake -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make -j2
|
make -j2
|
||||||
sudo make install
|
sudo make install
|
||||||
- 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
|
- name: Build raylib-python-cffi
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip3 install "cffi>=1.17.1"
|
pip3 install cffi
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
pip3 install setuptools
|
pip3 install setuptools
|
||||||
python setup.py sdist
|
python setup.py sdist
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v2.2.4
|
||||||
with:
|
with:
|
||||||
name: wheel-source
|
name: wheel
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
dynamic-distro:
|
dynamic-distro:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
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@v4
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v2.2.2
|
||||||
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.10'
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
# The target architecture (x86, x64) of the Python interpreter.
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Build raylib-python-cffi-dynamic
|
- name: Build raylib-python-cffi-dynamic
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip3 install "cffi>=1.17.1"
|
pip3 install cffi
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
pip3 install setuptools
|
pip3 install setuptools
|
||||||
cd dynamic
|
cd dynamic
|
||||||
python setup.py sdist
|
python setup.py sdist
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v2.2.4
|
||||||
with:
|
|
||||||
name: wheel-dynamic
|
|
||||||
path: dynamic/dist/*
|
|
||||||
|
|
||||||
merge:
|
|
||||||
needs: [build-mac-intel, build-windows, build-linux, source-distro, dynamic-distro]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Merge All Artifacts
|
|
||||||
uses: actions/upload-artifact/merge@v4
|
|
||||||
with:
|
with:
|
||||||
name: wheel
|
name: wheel
|
||||||
pattern: wheel-*
|
path: dynamic/dist/*
|
||||||
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -1,9 +1,9 @@
|
||||||
[submodule "raylib-c"]
|
[submodule "raylib-c"]
|
||||||
path = raylib-c
|
path = raylib-c
|
||||||
url = https://git.terah.dev/UnrealXR/raylib.git
|
url = https://github.com/raysan5/raylib.git
|
||||||
[submodule "raygui"]
|
[submodule "raygui"]
|
||||||
path = raygui
|
path = raygui
|
||||||
url = https://github.com/raysan5/raygui.git
|
url = https://github.com/raysan5/raygui.git
|
||||||
[submodule "physac"]
|
[submodule "physac"]
|
||||||
path = physac
|
path = physac
|
||||||
url = https://github.com/victorfisac/Physac.git
|
url = https://github.com/raysan5/physac.git
|
||||||
|
|
15
BUILDING.rst
15
BUILDING.rst
|
@ -13,10 +13,10 @@ Requirements for build: cmake, pkg-config.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
cd raylib-5.0
|
cd raylib-4.2.0
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ Then ask Pip to build from source:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
|
pip3 install --no-binary raylib --upgrade --force-reinstall raylib
|
||||||
|
|
||||||
Or, Build from source manually
|
Or, Build from source manually
|
||||||
------------------------------
|
------------------------------
|
||||||
|
@ -38,7 +38,7 @@ project.
|
||||||
If the Pip build doesn’t work, please submit a bug. (And if you have
|
If the Pip build doesn’t work, please submit a bug. (And if you have
|
||||||
fixed it, a PR.)
|
fixed it, a PR.)
|
||||||
|
|
||||||
Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
|
Manual instructions follow, but may be outdated, so see also 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
|
||||||
|
@ -83,6 +83,11 @@ To build a binary wheel distribution:
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
python setup.py bdist_wheel
|
python setup.py bdist_wheel
|
||||||
|
|
||||||
|
.. TODO::
|
||||||
|
There's a hardcoded path (to the raylib header files) in `raylib/build.py` you will probably need to edit.
|
||||||
|
Would be useful if some Windows user could figure out how to auto detect this.
|
||||||
|
|
||||||
|
|
||||||
Then install it:
|
Then install it:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -114,7 +119,7 @@ Build and install Raylib from the raylib-c directory.
|
||||||
cd raylib-python-cffi/raylib-c
|
cd raylib-python-cffi/raylib-c
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
||||||
|
|
|
@ -2,15 +2,9 @@ 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
|
|
||||||
exclude raylib/*.c
|
exclude raylib/*.c
|
||||||
exclude raylib/*.o
|
exclude raylib/*.o
|
||||||
include version.py
|
include version.py
|
||||||
exclude tests/*
|
|
||||||
include raylib/py.typed
|
|
||||||
include pyray/py.typed
|
|
||||||
|
|
||||||
|
|
||||||
|
|
218
README.md
218
README.md
|
@ -1,216 +1,92 @@
|
||||||
# Python Bindings for Raylib 5.5
|
# Python Bindings for Raylib 4.5
|
||||||
## Libraries: raymath, raygui, rlgl, physac and GLFW
|
|
||||||
## Backends: Desktop, SDL, DRM, Web
|
|
||||||
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
|
|
||||||
|
|
||||||

|
New CFFI API static bindings.
|
||||||
|
|
||||||
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
|
|
||||||
|
|
||||||
HELP WANTED: [writing examples](https://github.com/electronstudio/raylib-python-cffi/issues/155)
|
|
||||||
|
|
||||||
Features:
|
|
||||||
|
|
||||||
* CFFI API static bindings.
|
|
||||||
* Automatically generated to be as close as possible to
|
* Automatically generated to be as close as possible to
|
||||||
original Raylib.
|
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.
|
||||||
* Type checking with Mypy
|
* **Now includes extra libraries: raymath, raygui, rlgl and physac**
|
||||||
|
|
||||||
|
|
||||||
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
||||||
|
|
||||||
# Quickstart
|
# Quickstart
|
||||||
|
|
||||||
`pip3 install raylib==5.5.0.2 --break-system-packages`
|
`pip3 install raylib`
|
||||||
```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
|
||||||
|
|
||||||
If you are on a modern Linux you will probably want to create a venv:
|
First make sure you have the latest pip installed:
|
||||||
|
|
||||||
python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
Then make sure you have the latest pip installed:
|
|
||||||
|
|
||||||
python3 -m pip install --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
Then install
|
Then install
|
||||||
|
|
||||||
python3 -m pip install setuptools
|
python3 -m pip install setuptools
|
||||||
python3 -m pip install raylib==5.5.0.2
|
python3 -m pip install raylib
|
||||||
|
|
||||||
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
|
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64).
|
||||||
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.5.0.2
|
|
||||||
|
|
||||||
(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)
|
||||||
|
|
||||||
# Backends
|
|
||||||
|
|
||||||
## Dynamic binding version
|
## Dynamic binding version
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
You can't have multiple raylib packages installed at once.
|
## 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).
|
||||||
|
You can install an alpha or beta version by specifying the exact version number like this:
|
||||||
|
|
||||||
This is not well tested but has better support for controllers:
|
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 [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
|
If you need help you can try asking [on 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* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
|
There are two APIs, you can use either or both:
|
||||||
pyray. Do *not* `pip install 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 raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
Use [the C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||||
|
|
||||||
### If you prefer a more Pythonistic API
|
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower
|
||||||
|
|
||||||
Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||||
|
|
||||||
# Running in a web browser
|
|
||||||
|
|
||||||
[Pygbag](https://pypi.org/project/pygbag/) >=0.8.7 supports running in a web browser. Usually the latest git version
|
|
||||||
is recommended.
|
|
||||||
|
|
||||||
Make a folder `my_project` with a file `main.py`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# /// script
|
|
||||||
# dependencies = [
|
|
||||||
# "cffi",
|
|
||||||
# "raylib"
|
|
||||||
# ]
|
|
||||||
# ///
|
|
||||||
import asyncio
|
|
||||||
import platform
|
|
||||||
from pyray import *
|
|
||||||
|
|
||||||
async def main(): # You MUST have an async main function
|
|
||||||
init_window(500, 500, "Hello")
|
|
||||||
platform.window.window_resize() # You MAY want to add this line
|
|
||||||
while not window_should_close():
|
|
||||||
begin_drawing()
|
|
||||||
clear_background(WHITE)
|
|
||||||
draw_text("Hello world", 190, 200, 20, VIOLET)
|
|
||||||
end_drawing()
|
|
||||||
await asyncio.sleep(0) # You MUST call this in your main loop
|
|
||||||
close_window()
|
|
||||||
|
|
||||||
asyncio.run(main())
|
|
||||||
```
|
|
||||||
|
|
||||||
Then to create the web files and launch a web server:
|
|
||||||
|
|
||||||
python3.12 -m pip install --user --upgrade pygbag
|
|
||||||
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my_project
|
|
||||||
|
|
||||||
Point your browser to http://localhost:8000
|
|
||||||
|
|
||||||
Some features may not work, so you can disable them like this:
|
|
||||||
|
|
||||||
```python
|
|
||||||
if platform.system() != "Emscripten": # audio may not work on current version of emscripten
|
|
||||||
init_audio_device()
|
|
||||||
```
|
|
||||||
|
|
||||||
This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
|
|
||||||
Carefully read all their [documentation](https://pygame-web.github.io/).
|
|
||||||
|
|
||||||
It does work for most of [these examples](https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/)
|
|
||||||
|
|
||||||
# App showcase
|
# App showcase
|
||||||
|
|
||||||
[Tempest-raylib](https://github.com/Emtyloc/tempest-raylib)
|
|
||||||
|
|
||||||
[KarabinerKeyboard](https://github.com/bilbofroggins/KarabinerKeyboard)
|
|
||||||
|
|
||||||
[PyTaiko](https://github.com/Yonokid/PyTaiko)
|
|
||||||
|
|
||||||
[DOOM-Clone](https://github.com/StanislavPetrovV/DOOM-Clone)
|
|
||||||
|
|
||||||
[Tanki](https://github.com/pkulev/tanki)
|
[Tanki](https://github.com/pkulev/tanki)
|
||||||
|
|
||||||
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
|
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
|
||||||
|
|
||||||
[Eidolon](https://github.com/Miou-zora/Eidolon)
|
|
||||||
|
|
||||||
Add your app here!
|
Add your app here!
|
||||||
|
|
||||||
# RLZero
|
# RLZero
|
||||||
|
@ -224,43 +100,29 @@ 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
|
# License (updated)
|
||||||
|
|
||||||
Eclipse Public License, so you are free to
|
The bindings are now under the 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
|
||||||
|
|
||||||
If you need more performance, do in this order:
|
For fastest performance use Pypy rather than standard Python.
|
||||||
|
|
||||||
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
|
Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
||||||
|
|
||||||
2. Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
|
||||||
in your update loop
|
in your update loop
|
||||||
and then only convert them to C data structures when you have to call the C functions for drawing.
|
and then only convert them to C data structures when you have to call the C functions for drawing.
|
||||||
|
|
||||||
3. The raylib.* functions are potentially *slightly* faster than the pyray.* equivalents, so if you need a tiny bit more performance
|
|
||||||
you can switch your inner loop functions to these.
|
|
||||||
|
|
||||||
4. There is a version of Python that is faster than Pypy: GraalPy. However it's not fully compatible with all Python
|
|
||||||
packages. It doesn't work with CFFI and so doesn't work with this binding. But it *is* compatible with the
|
|
||||||
*Java* binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib
|
|
||||||
|
|
||||||
## Bunnymark
|
## Bunnymark
|
||||||
|
|
||||||
|
|
||||||
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
||||||
|--------------------------------|-------------------|------------------|------------|
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
| Raylib 5.0 | C | 180000 | 100% |
|
| Raylib 3.7 | C | 168100 | 100% |
|
||||||
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
|
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
||||||
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
|
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
|
||||||
| Raylib 3.7 | C | 168100 | 100% |
|
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
|
||||||
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
|
||||||
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
|
|
||||||
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
|
|
||||||
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
|
|
||||||
|
|
||||||
See also https://github.com/electronstudio/megabunny/
|
|
||||||
|
|
||||||
# Packaging your app
|
# Packaging your app
|
||||||
|
|
||||||
|
@ -275,4 +137,4 @@ You can create a standalone binary using the Nuitka compiler. For example, here
|
||||||
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
|
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
|
||||||
|
|
||||||
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
|
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
|
||||||
a book for Python beginners.
|
a book for Python beginners.
|
89
RPI.rst
89
RPI.rst
|
@ -1,97 +1,42 @@
|
||||||
Raspberry Pi
|
Raspberry Pi
|
||||||
====================
|
====================
|
||||||
|
|
||||||
Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.
|
Please use Raspberry Pi OS Bullseye. Older OSes are not tested.
|
||||||
|
|
||||||
Option 1: Binary wheel
|
We have published a binary wheel using Raylib in X11 mode. This *should* install and work on Bullseye
|
||||||
----------------------
|
with
|
||||||
|
|
||||||
We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
python -m pip install --break-system-packages raylib
|
python3.9 -m pip install raylib==4.2.1.2
|
||||||
|
|
||||||
Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
|
If it doesn't work, or we haven't published a binary wheel for the latest version,
|
||||||
installed at once.
|
or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib.
|
||||||
|
For full instructins on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
|
||||||
|
|
||||||
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.
|
This 'worked for me':
|
||||||
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
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
This should work for everyone.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
sudo apt update
|
git clone https://github.com/raysan5/raylib.git --branch 4.2.0 --single-branch
|
||||||
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev libglfw3-dev
|
|
||||||
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
|
|
||||||
cd raylib
|
cd raylib
|
||||||
mkdir build
|
mkdir build
|
||||||
rm -rf 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 -DPLATFORM="DRM" -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
sudo cp -r ../src/external/glfw/include/GLFW /usr/local/include/
|
|
||||||
|
|
||||||
Then have pip compile and install the wheel:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
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.5.0.0
|
|
||||||
|
|
||||||
Option 3: Compile Raylib from source DRM mode
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
This seems to work on Raspberry Pi 4. Note you must not be running X11 when you run your programs.
|
|
||||||
|
|
||||||
If you have ever installed Raylib or raylib-python-cffi before, remove all traces of it:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt remove raylib raylib-dev libraylib libraylib-dev
|
|
||||||
sudo rm /usr/local/lib/pkgconfig/raylib.pc
|
|
||||||
sudo rm -rf /usr/local/lib/libraylib.* /usr/lib/libraylib.*
|
|
||||||
|
|
||||||
Remove all GLFW:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt remove libglfw3-dev libglfw3
|
|
||||||
sudo rm -rf /usr/local/include/GLFW
|
|
||||||
|
|
||||||
Build a shared lib version of Raylib in DRM mode and install to /usr:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev
|
|
||||||
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
|
|
||||||
cd raylib
|
|
||||||
mkdir build
|
|
||||||
rm rf build/*
|
|
||||||
cd build
|
|
||||||
cmake -DPLATFORM="DRM" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
|
|
||||||
Then have pip compile and install the wheel:
|
Then have pip compile the wheel:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
python3 -m pip install --break-system-packages setuptools
|
pip3 install setuptools
|
||||||
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.5.0.0
|
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==4.2.1.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(or newer version)
|
||||||
|
|
||||||
.. attention::
|
.. attention::
|
||||||
|
|
||||||
If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into ``/opt/vc`` and compiled in Raylib
|
The Broadcom proprietary Open GL ES 2.0 drivers (installed by Raspbian into ``/opt/vc`` and compiled in Raylib
|
||||||
with ``PLATFORM_RPI``) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
|
with ``PLATFORM_RPI``) do not work with Bullseye and have not been tested with the bindings. They will probably
|
||||||
require additional linker arguments to be added to ``build.py``. Suggest you try ``PLATFORM_DRM`` instead.
|
require additional linker arguments to be added to ``build.py``. Suggest you use ``PLATFORM_DRM`` instead.
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
# Copyright (c) 2021 Richard Smith and others
|
|
||||||
#
|
|
||||||
# This program and the accompanying materials are made available under the
|
|
||||||
# terms of the Eclipse Public License 2.0 which is available at
|
|
||||||
# http://www.eclipse.org/legal/epl-2.0.
|
|
||||||
#
|
|
||||||
# This Source Code may also be made available under the following Secondary
|
|
||||||
# licenses when the conditions for such availability set forth in the Eclipse
|
|
||||||
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
|
|
||||||
# with the GNU Classpath Exception which is
|
|
||||||
# available at https://www.gnu.org/software/classpath/license.html.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
||||||
|
|
||||||
from raylib import rl, ffi
|
|
||||||
|
|
||||||
from inspect import ismethod, getmembers, isbuiltin
|
|
||||||
import inflection, sys, json, re
|
|
||||||
|
|
||||||
two_or = re.compile(r'''\(\s*([^\s]*)\s*\|\s*([^\s]*)\s*\)''')
|
|
||||||
three_or = re.compile(r'''\(\s*([^\s]*)\s*\|\s*([^\s]*)\s*\|\s*(^\s*)\s*\)''')
|
|
||||||
two_mult = re.compile(r'''\(\s*([^\s]*)\s*\*\s*([^\s]*)\s*\)''')
|
|
||||||
two_div = re.compile(r'''\(\s*([^\s]*)\s*/\s*([^\s]*)\s*\)''')
|
|
||||||
|
|
||||||
def process(filename):
|
|
||||||
f = open(filename, "r")
|
|
||||||
js = json.load(f)
|
|
||||||
known_define = []
|
|
||||||
known_enum = []
|
|
||||||
for e in js['enums']:
|
|
||||||
if e['name'] and e['values']:
|
|
||||||
for v in e['values']:
|
|
||||||
if v['name']:
|
|
||||||
known_enum.append(str(v['name']).strip())
|
|
||||||
for e in js['defines']:
|
|
||||||
if e['type'] in ('INT', 'FLOAT', 'STRING'):
|
|
||||||
if e['type'] == 'INT':
|
|
||||||
print(e['name'] + ": int = " + str(e['value']).strip())
|
|
||||||
elif e['type'] == 'FLOAT':
|
|
||||||
print(e['name'] + ": float = " + str(e['value']).strip())
|
|
||||||
else:
|
|
||||||
print(e['name'] + ": str = \"" + str(e['value']).strip() + '"')
|
|
||||||
known_define.append(str(e['name']).strip())
|
|
||||||
elif e['type'] == "UNKNOWN":
|
|
||||||
strval = str(e['value']).strip()
|
|
||||||
if strval.startswith("__"):
|
|
||||||
continue
|
|
||||||
if strval in known_enum:
|
|
||||||
print(e['name'] + " = raylib." + strval)
|
|
||||||
elif strval in known_define:
|
|
||||||
print(e['name'] + " = " + strval)
|
|
||||||
else:
|
|
||||||
matches = two_or.match(strval)
|
|
||||||
if not matches:
|
|
||||||
matches = three_or.match(strval)
|
|
||||||
if matches:
|
|
||||||
match_defs = [str(m).strip() for m in matches.groups()]
|
|
||||||
if all(d in known_enum for d in match_defs):
|
|
||||||
print(e['name'] + " = " + " | ".join(("raylib."+m) for m in match_defs))
|
|
||||||
elif all(d in known_define for d in match_defs):
|
|
||||||
print(e['name'] + " = " + " | ".join(match_defs))
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
known_define.append(str(e['name']).strip())
|
|
||||||
elif e['type'] == "FLOAT_MATH":
|
|
||||||
strval = str(e['value']).strip()
|
|
||||||
matches = two_mult.match(strval)
|
|
||||||
if matches:
|
|
||||||
match_defs = [str(m).strip() for m in matches.groups()]
|
|
||||||
match_parts = []
|
|
||||||
for m in match_defs:
|
|
||||||
if "." in m:
|
|
||||||
match_parts.append(m.rstrip("f"))
|
|
||||||
else:
|
|
||||||
match_parts.append(m)
|
|
||||||
if all(d in known_enum for d in match_parts):
|
|
||||||
print(e['name'] + " = " + " * ".join(("raylib." + m) for m in match_parts))
|
|
||||||
elif all(d in known_define for d in match_parts):
|
|
||||||
print(e['name'] + " = " + " * ".join(match_parts))
|
|
||||||
else:
|
|
||||||
matches = two_div.match(strval)
|
|
||||||
if matches:
|
|
||||||
match_defs = [str(m).strip() for m in matches.groups()]
|
|
||||||
match_parts = []
|
|
||||||
for m in match_defs:
|
|
||||||
if "." in m:
|
|
||||||
match_parts.append(m.rstrip("f"))
|
|
||||||
else:
|
|
||||||
match_parts.append(m)
|
|
||||||
if any(d in known_enum for d in match_parts):
|
|
||||||
print(e['name'] + " = " + " / ".join(("raylib." + m) for m in match_parts))
|
|
||||||
elif any(d in known_define for d in match_parts):
|
|
||||||
print(e['name'] + " = " + " / ".join(match_parts))
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
|
|
||||||
print("import raylib\n")
|
|
||||||
|
|
||||||
process("raylib.json")
|
|
||||||
process("raymath.json")
|
|
||||||
process("rlgl.json")
|
|
||||||
process("raygui.json")
|
|
||||||
process("physac.json")
|
|
||||||
process("glfw3.json")
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ def process(filename):
|
||||||
for e in js['enums']:
|
for e in js['enums']:
|
||||||
if e['name'] and e['values']:
|
if e['name'] and e['values']:
|
||||||
print ("class "+e['name']+"("+"IntEnum):")
|
print ("class "+e['name']+"("+"IntEnum):")
|
||||||
print(f' """{e['description']}."""')
|
|
||||||
for value in e['values']:
|
for value in e['values']:
|
||||||
print(" "+value['name']+" = "+str(value['value']))
|
print(" "+value['name']+" = "+str(value['value']))
|
||||||
print("")
|
print("")
|
||||||
|
@ -34,5 +33,4 @@ print("""from enum import IntEnum
|
||||||
|
|
||||||
process("raylib.json")
|
process("raylib.json")
|
||||||
process("raygui.json")
|
process("raygui.json")
|
||||||
process("glfw3.json")
|
|
||||||
process("physac.json")
|
|
||||||
|
|
|
@ -12,32 +12,13 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from raylib import rl, ffi
|
from raylib import rl, ffi
|
||||||
from pyray import _underscore
|
|
||||||
from inspect import ismethod, getmembers, isbuiltin
|
from inspect import ismethod, getmembers, isbuiltin
|
||||||
import inflection, sys, json
|
import inflection, sys, json
|
||||||
|
|
||||||
known_functions = {}
|
f = open("raylib.json", "r")
|
||||||
known_structs = {}
|
js = json.load(f)
|
||||||
for filename in (Path("raylib.json"), Path("raymath.json"), Path("rlgl.json"), Path("raygui.json"), Path("physac.json"),
|
|
||||||
Path("glfw3.json")):
|
|
||||||
f = open(filename, "r")
|
|
||||||
js = json.load(f)
|
|
||||||
for fn in js["functions"]:
|
|
||||||
if fn["name"] not in known_functions:
|
|
||||||
known_functions[fn["name"]] = fn
|
|
||||||
for st in js["structs"]:
|
|
||||||
if st["name"] not in known_structs:
|
|
||||||
known_structs[st["name"]] = st
|
|
||||||
for e in js['enums']:
|
|
||||||
if e['name'] and e['values']:
|
|
||||||
print("class "+e['name']+"(int):")
|
|
||||||
print(f' """{e['description']}."""')
|
|
||||||
for value in e['values']:
|
|
||||||
print(" "+value['name']+" = "+str(value['value']))
|
|
||||||
print("")
|
|
||||||
|
|
||||||
|
|
||||||
def ctype_to_python_type(t):
|
def ctype_to_python_type(t):
|
||||||
if t == '_Bool':
|
if t == '_Bool':
|
||||||
|
@ -48,69 +29,48 @@ def ctype_to_python_type(t):
|
||||||
return "int"
|
return "int"
|
||||||
elif t == "unsigned long long":
|
elif t == "unsigned long long":
|
||||||
return "int"
|
return "int"
|
||||||
elif t == "uint64_t":
|
|
||||||
return "int"
|
|
||||||
elif t == "short":
|
|
||||||
return "int"
|
|
||||||
elif t == "unsigned short":
|
|
||||||
return "int"
|
|
||||||
elif t == "double":
|
elif t == "double":
|
||||||
return "float"
|
return "float"
|
||||||
elif "char * *" in t:
|
|
||||||
return "list[str]"
|
|
||||||
elif "char *" in t:
|
elif "char *" in t:
|
||||||
return "str"
|
return "str"
|
||||||
elif t == "char":
|
elif "char" in t:
|
||||||
return "str" # not sure about this one
|
return "str" # not sure about this one
|
||||||
elif t == "unsigned char":
|
|
||||||
return "int"
|
|
||||||
elif "*" in t:
|
elif "*" in t:
|
||||||
return "Any"
|
return "Any"
|
||||||
elif "[" in t:
|
|
||||||
return "list" # TODO FIXME type of items in the list
|
|
||||||
elif t.startswith("struct"):
|
elif t.startswith("struct"):
|
||||||
return t.replace("struct ", "")
|
return t.replace("struct ","")
|
||||||
elif t.startswith("unsigned"):
|
elif t.startswith("unsigned"):
|
||||||
return t.replace("unsigned ", "")
|
return t.replace("unsigned ", "")
|
||||||
elif t.startswith("enum"):
|
|
||||||
return t.replace("enum ", "")
|
|
||||||
else:
|
else:
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
||||||
print("""from typing import Any
|
print("""from typing import Any
|
||||||
from warnings import deprecated
|
|
||||||
import _cffi_backend # type: ignore
|
|
||||||
|
|
||||||
ffi: _cffi_backend.FFI
|
|
||||||
PhysicsShapeType = int
|
def pointer(struct):
|
||||||
|
...
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# These words can be used for c arg names, but not in python
|
|
||||||
reserved_words = ("in", "list", "tuple", "set", "dict", "from", "range", "min", "max", "any", "all", "len")
|
|
||||||
|
|
||||||
for name, attr in getmembers(rl):
|
for name, attr in getmembers(rl):
|
||||||
uname = _underscore(name)
|
uname = inflection.underscore(name).replace('3_d', '_3d').replace('2_d', '_2d')
|
||||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
||||||
json_object = known_functions.get(name, None)
|
json_array = [x for x in js['functions'] if x['name'] == name]
|
||||||
if json_object is None:
|
json_object = {}
|
||||||
# this is _not_ an exported function from raylib, raymath, rlgl raygui or physac
|
if len(json_array) > 0:
|
||||||
# so we don't want it in the pyray API
|
json_object = json_array[0]
|
||||||
continue
|
|
||||||
sig = ""
|
sig = ""
|
||||||
for i, arg in enumerate(ffi.typeof(attr).args):
|
for i, arg in enumerate(ffi.typeof(attr).args):
|
||||||
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
|
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
|
||||||
"_pointer").replace(
|
"_pointer").replace(
|
||||||
" ", "") + "_" + str(i)
|
" ", "")+"_"+str(i)
|
||||||
if 'params' in json_object:
|
if 'params' in json_object:
|
||||||
p = json_object['params']
|
p = json_object['params']
|
||||||
param_name = list(p)[i]['name']
|
param_name = list(p)[i]['name']
|
||||||
# don't use a python reserved word:
|
|
||||||
if param_name in reserved_words:
|
|
||||||
param_name = param_name + "_" + str(i)
|
|
||||||
param_type = ctype_to_python_type(arg.cname)
|
param_type = ctype_to_python_type(arg.cname)
|
||||||
if "struct" in arg.cname:
|
|
||||||
param_type += "|list|tuple"
|
|
||||||
sig += f"{param_name}: {param_type},"
|
sig += f"{param_name}: {param_type},"
|
||||||
|
|
||||||
return_type = ffi.typeof(attr).result.cname
|
return_type = ffi.typeof(attr).result.cname
|
||||||
|
@ -120,77 +80,42 @@ for name, attr in getmembers(rl):
|
||||||
if 'description' in json_object:
|
if 'description' in json_object:
|
||||||
description = json_object['description']
|
description = json_object['description']
|
||||||
|
|
||||||
if 'physics' in uname:
|
print(
|
||||||
print('@deprecated("Raylib no longer recommends the use of Physac library")')
|
f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:\n """{description}"""\n ...')
|
||||||
print(f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:')
|
|
||||||
print(f' """{description}."""')
|
|
||||||
print(f' ...')
|
|
||||||
|
|
||||||
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||||
return_type = ffi.typeof(attr).result.cname
|
return_type = ffi.typeof(attr).result.cname
|
||||||
print(
|
print(
|
||||||
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
|
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
|
||||||
else:
|
else:
|
||||||
# print("*****", str(type(attr)))
|
#print("*****", str(type(attr)))
|
||||||
t = str(type(attr))[8:-2] # this isolates the type
|
t = str(type(attr))[8:-2] # this isolates the type
|
||||||
if t != "int":
|
if t != "int":
|
||||||
print(f"{name}: {t}")
|
print(f"{name}: {t}")
|
||||||
|
|
||||||
for struct in ffi.list_types()[0]:
|
for struct in ffi.list_types()[0]:
|
||||||
print("processing", struct, file=sys.stderr)
|
print("processing", struct, file=sys.stderr)
|
||||||
|
# json_array = [x for x in js['structs'] if x['name'] == name]
|
||||||
|
# json_object = {}
|
||||||
|
# if len(json_array) > 0:
|
||||||
|
# json_object = json_array[0]
|
||||||
if ffi.typeof(struct).kind == "struct":
|
if ffi.typeof(struct).kind == "struct":
|
||||||
json_object = known_structs.get(struct, None)
|
|
||||||
if json_object is None:
|
|
||||||
# this is _not_ an exported struct from raylib, raymath, rlgl raygui or physac
|
|
||||||
# so we don't want it in the pyray API
|
|
||||||
continue
|
|
||||||
if ffi.typeof(struct).fields is None:
|
if ffi.typeof(struct).fields is None:
|
||||||
print("weird empty struct, skipping " + struct, file=sys.stderr)
|
print("weird empty struct, skipping "+struct, file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
print(f"class {struct}:")
|
print(f"class {struct}:")
|
||||||
print(f' """{known_structs[struct]['description']}."""')
|
print(f' """ struct """')
|
||||||
sig = ""
|
sig = ""
|
||||||
for arg in ffi.typeof(struct).fields:
|
for arg in ffi.typeof(struct).fields:
|
||||||
ptype = ctype_to_python_type(arg[1].type.cname)
|
sig += ", " + arg[0]
|
||||||
if arg[1].type.kind == "struct":
|
|
||||||
ptype += "|list|tuple"
|
|
||||||
sig += f", {arg[0]}: {ptype}|None = None"
|
|
||||||
print(f" def __init__(self{sig}):")
|
print(f" def __init__(self{sig}):")
|
||||||
|
|
||||||
for arg in ffi.typeof(struct).fields:
|
for arg in ffi.typeof(struct).fields:
|
||||||
print(f" self.{arg[0]}:{ctype_to_python_type(arg[1].type.cname)} = {arg[0]} # type: ignore")
|
print(f" self.{arg[0]}={arg[0]}")
|
||||||
|
|
||||||
# elif ffi.typeof(struct).kind == "enum":
|
#elif ffi.typeof(struct).kind == "enum":
|
||||||
# print(f"{struct}: int")
|
# print(f"{struct}: int")
|
||||||
else:
|
else:
|
||||||
print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
|
print("ERROR UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
print("""
|
|
||||||
LIGHTGRAY : Color
|
|
||||||
GRAY : Color
|
|
||||||
DARKGRAY : Color
|
|
||||||
YELLOW : Color
|
|
||||||
GOLD : Color
|
|
||||||
ORANGE : Color
|
|
||||||
PINK : Color
|
|
||||||
RED : Color
|
|
||||||
MAROON : Color
|
|
||||||
GREEN : Color
|
|
||||||
LIME : Color
|
|
||||||
DARKGREEN : Color
|
|
||||||
SKYBLUE : Color
|
|
||||||
BLUE : Color
|
|
||||||
DARKBLUE : Color
|
|
||||||
PURPLE : Color
|
|
||||||
VIOLET : Color
|
|
||||||
DARKPURPLE : Color
|
|
||||||
BEIGE : Color
|
|
||||||
BROWN : Color
|
|
||||||
DARKBROWN : Color
|
|
||||||
WHITE : Color
|
|
||||||
BLACK : Color
|
|
||||||
BLANK : Color
|
|
||||||
MAGENTA : Color
|
|
||||||
RAYWHITE : Color
|
|
||||||
""")
|
|
||||||
|
|
|
@ -12,23 +12,15 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from raylib import rl, ffi
|
from raylib import rl, ffi
|
||||||
|
|
||||||
from inspect import ismethod, getmembers, isbuiltin
|
from inspect import ismethod, getmembers, isbuiltin
|
||||||
import inflection, sys, json
|
import inflection, sys, json
|
||||||
|
|
||||||
known_functions = {}
|
f = open("raylib.json", "r")
|
||||||
known_structs = {}
|
js = json.load(f)
|
||||||
for filename in (Path("raylib.json"), Path("raymath.json"), Path("rlgl.json"), Path("raygui.json"), Path("physac.json"),
|
|
||||||
Path("glfw3.json")):
|
|
||||||
f = open(filename, "r")
|
|
||||||
js = json.load(f)
|
|
||||||
for fn in js["functions"]:
|
|
||||||
if fn["name"] not in known_functions:
|
|
||||||
known_functions[fn["name"]] = fn
|
|
||||||
for st in js["structs"]:
|
|
||||||
if st["name"] not in known_structs:
|
|
||||||
known_structs[st["name"]] = st
|
|
||||||
|
|
||||||
|
|
||||||
def ctype_to_python_type(t):
|
def ctype_to_python_type(t):
|
||||||
|
@ -40,73 +32,50 @@ def ctype_to_python_type(t):
|
||||||
return "int"
|
return "int"
|
||||||
elif t == "unsigned long long":
|
elif t == "unsigned long long":
|
||||||
return "int"
|
return "int"
|
||||||
elif t == "uint64_t":
|
|
||||||
return "int"
|
|
||||||
elif t == "short":
|
|
||||||
return "int"
|
|
||||||
elif t == "unsigned short":
|
|
||||||
return "int"
|
|
||||||
elif t == "double":
|
elif t == "double":
|
||||||
return "float"
|
return "float"
|
||||||
elif "char * *" in t:
|
|
||||||
return "list[bytes]"
|
|
||||||
elif "char *" in t:
|
elif "char *" in t:
|
||||||
return "bytes"
|
return "str"
|
||||||
elif "char" in t:
|
elif "char" in t:
|
||||||
return "bytes" # not sure about this one
|
return "str" # not sure about this one
|
||||||
elif "*" in t:
|
elif "*" in t:
|
||||||
return "Any"
|
return "Any"
|
||||||
elif "[" in t:
|
|
||||||
return "list" # TODO FIXME type of items in the list
|
|
||||||
elif t.startswith("struct"):
|
elif t.startswith("struct"):
|
||||||
return t.replace("struct ", "")
|
return t.replace("struct ","")
|
||||||
elif t.startswith("unsigned"):
|
elif t.startswith("unsigned"):
|
||||||
return t.replace("unsigned ", "")
|
return t.replace("unsigned ", "")
|
||||||
elif t.startswith("enum"):
|
|
||||||
return t.replace("enum ", "")
|
|
||||||
else:
|
else:
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
||||||
print("""from typing import Any
|
print("""from typing import Any
|
||||||
from warnings import deprecated
|
|
||||||
import _cffi_backend # type: ignore
|
import _cffi_backend
|
||||||
|
|
||||||
ffi: _cffi_backend.FFI
|
ffi: _cffi_backend.FFI
|
||||||
rl: _cffi_backend.Lib
|
rl: _cffi_backend.Lib
|
||||||
PhysicsShapeType = int
|
|
||||||
|
|
||||||
class struct: ...
|
class struct: ...
|
||||||
|
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# These words can be used for c arg names, but not in python
|
|
||||||
reserved_words = ("in", "list", "tuple", "set", "dict", "from", "range", "min", "max", "any", "all", "len")
|
|
||||||
|
|
||||||
for name, attr in getmembers(rl):
|
for name, attr in getmembers(rl):
|
||||||
uname = name
|
uname = name
|
||||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
||||||
json_object = known_functions.get(name, {})
|
json_array = [x for x in js['functions'] if x['name'] == name]
|
||||||
|
json_object = {}
|
||||||
|
if len(json_array) > 0:
|
||||||
|
json_object = json_array[0]
|
||||||
sig = ""
|
sig = ""
|
||||||
for i, arg in enumerate(ffi.typeof(attr).args):
|
for i, arg in enumerate(ffi.typeof(attr).args):
|
||||||
if ")(" in arg.cname:
|
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
|
||||||
# fn signature in arg types
|
"_pointer").replace(
|
||||||
param_name = str(arg.cname).split("(", 1)[0] + "_callback_" + str(i)
|
" ", "")+"_"+str(i)
|
||||||
else:
|
|
||||||
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
|
|
||||||
"_pointer").replace(" ",
|
|
||||||
"") + "_" + str(
|
|
||||||
i)
|
|
||||||
if 'params' in json_object:
|
if 'params' in json_object:
|
||||||
p = json_object['params']
|
p = json_object['params']
|
||||||
# print("param_name: ", param_name, "i", i, "params: ",p,file=sys.stderr)
|
#print("param_name: ", param_name, "i", i, "params: ",p,file=sys.stderr)
|
||||||
param_name = list(p)[i]['name']
|
param_name = list(p)[i]['name']
|
||||||
# don't use a python reserved word:
|
|
||||||
if param_name in reserved_words:
|
|
||||||
param_name = param_name + "_" + str(i)
|
|
||||||
param_type = ctype_to_python_type(arg.cname)
|
param_type = ctype_to_python_type(arg.cname)
|
||||||
if "struct" in arg.cname:
|
|
||||||
param_type += "|list|tuple"
|
|
||||||
sig += f"{param_name}: {param_type},"
|
sig += f"{param_name}: {param_type},"
|
||||||
|
|
||||||
return_type = ffi.typeof(attr).result.cname
|
return_type = ffi.typeof(attr).result.cname
|
||||||
|
@ -115,19 +84,15 @@ for name, attr in getmembers(rl):
|
||||||
if 'description' in json_object:
|
if 'description' in json_object:
|
||||||
description = json_object['description']
|
description = json_object['description']
|
||||||
|
|
||||||
if 'Physics' in uname:
|
print(
|
||||||
print('@deprecated("Raylib no longer recommends the use of Physac library")')
|
f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:\n """{description}"""\n ...')
|
||||||
print(f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:')
|
|
||||||
print(f' """{description}."""')
|
|
||||||
print(f' ...')
|
|
||||||
|
|
||||||
|
|
||||||
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||||
return_type = ffi.typeof(attr).result.cname
|
return_type = ffi.typeof(attr).result.cname
|
||||||
print(
|
print(
|
||||||
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
|
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
|
||||||
else:
|
else:
|
||||||
# print("*****", str(type(attr)))
|
#print("*****", str(type(attr)))
|
||||||
print(f"{name}: {str(type(attr))[8:-2]}") # this isolates the type
|
print(f"{name}: {str(type(attr))[8:-2]}") # this isolates the type
|
||||||
|
|
||||||
for struct in ffi.list_types()[0]:
|
for struct in ffi.list_types()[0]:
|
||||||
|
@ -136,51 +101,18 @@ for struct in ffi.list_types()[0]:
|
||||||
# if ffi.typeof(struct).fields is None:
|
# if ffi.typeof(struct).fields is None:
|
||||||
# print("weird empty struct, skipping", file=sys.stderr)
|
# print("weird empty struct, skipping", file=sys.stderr)
|
||||||
# continue
|
# continue
|
||||||
print(f"class {struct}:")
|
print(f"{struct}: struct")
|
||||||
# sig = ""
|
# sig = ""
|
||||||
fields = ffi.typeof(struct).fields
|
# for arg in ffi.typeof(struct).fields:
|
||||||
if fields is not None:
|
# sig += ", " + arg[0]
|
||||||
#print(ffi.typeof(struct).fields)
|
|
||||||
#print(f" {arg}: {arg}")
|
|
||||||
# print(f" def __init__(self{sig}):")
|
# print(f" def __init__(self{sig}):")
|
||||||
#
|
#
|
||||||
for arg in ffi.typeof(struct).fields:
|
# for arg in ffi.typeof(struct).fields:
|
||||||
print(f" {arg[0]}: {ctype_to_python_type(arg[1].type.cname)}")
|
|
||||||
else:
|
|
||||||
print(" ...")
|
|
||||||
# print(f" self.{arg[0]}={arg[0]}")
|
# print(f" self.{arg[0]}={arg[0]}")
|
||||||
|
|
||||||
elif ffi.typeof(struct).kind == "enum":
|
elif ffi.typeof(struct).kind == "enum":
|
||||||
print(f"{struct} = int")
|
print(f"{struct}: int")
|
||||||
else:
|
else:
|
||||||
print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
|
print("ERROR UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
print("""
|
|
||||||
LIGHTGRAY : Color
|
|
||||||
GRAY : Color
|
|
||||||
DARKGRAY : Color
|
|
||||||
YELLOW : Color
|
|
||||||
GOLD : Color
|
|
||||||
ORANGE : Color
|
|
||||||
PINK : Color
|
|
||||||
RED : Color
|
|
||||||
MAROON : Color
|
|
||||||
GREEN : Color
|
|
||||||
LIME : Color
|
|
||||||
DARKGREEN : Color
|
|
||||||
SKYBLUE : Color
|
|
||||||
BLUE : Color
|
|
||||||
DARKBLUE : Color
|
|
||||||
PURPLE : Color
|
|
||||||
VIOLET : Color
|
|
||||||
DARKPURPLE : Color
|
|
||||||
BEIGE : Color
|
|
||||||
BROWN : Color
|
|
||||||
DARKBROWN : Color
|
|
||||||
WHITE : Color
|
|
||||||
BLACK : Color
|
|
||||||
BLANK : Color
|
|
||||||
MAGENTA : Color
|
|
||||||
RAYWHITE : Color
|
|
||||||
""")
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ 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>`_
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Sphinx build info version 1
|
# Sphinx build info version 1
|
||||||
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
|
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||||
config: f2032a6434b52f7c68551d0ad70d555b
|
config: d3f6c06ab2f036ecf2386ff26e8dd625
|
||||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Building from source — Raylib Python documentation</title>
|
<title>Building from source — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
<script src="_static/doctools.js"></script>
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<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" />
|
||||||
|
@ -45,16 +45,14 @@
|
||||||
</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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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>
|
||||||
|
@ -99,28 +97,28 @@
|
||||||
<div itemprop="articleBody">
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
<section id="building-from-source">
|
<section id="building-from-source">
|
||||||
<h1>Building from source<a class="headerlink" href="#building-from-source" title="Link to this heading"></a></h1>
|
<h1>Building from source<a class="headerlink" href="#building-from-source" title="Permalink to this heading"></a></h1>
|
||||||
<section id="have-pip-build-from-source">
|
<section id="have-pip-build-from-source">
|
||||||
<h2>Have Pip build from source<a class="headerlink" href="#have-pip-build-from-source" title="Link to this heading"></a></h2>
|
<h2>Have Pip build from source<a class="headerlink" href="#have-pip-build-from-source" title="Permalink to this heading"></a></h2>
|
||||||
<p>This is useful if the binaries don’t work on your system, or you want to use a newer version of Raylib.</p>
|
<p>This is useful if the binaries don’t work on your system, or you want to use a newer version of Raylib.</p>
|
||||||
<p>First make sure Raylib is installed. On Linux/Mac it must include the pkg-config files. Best way to ensure this
|
<p>First make sure Raylib is installed. On Linux/Mac it must include the pkg-config files. Best way to ensure this
|
||||||
is to compile and install Raylib using CMake: <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake">https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake</a></p>
|
is to compile and install Raylib using CMake: <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake">https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake</a></p>
|
||||||
<p>Requirements for build: cmake, pkg-config.</p>
|
<p>Requirements for build: cmake, pkg-config.</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="mf">5.0</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="mf">4.2.0</span>
|
||||||
<span class="n">mkdir</span> <span class="n">build</span>
|
<span class="n">mkdir</span> <span class="n">build</span>
|
||||||
<span class="n">cd</span> <span class="n">build</span>
|
<span class="n">cd</span> <span class="n">build</span>
|
||||||
<span class="n">cmake</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
|
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
|
||||||
<span class="n">make</span>
|
<span class="n">make</span>
|
||||||
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Then ask Pip to build from source:</p>
|
<p>Then ask Pip to build from source:</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</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="n">raylib</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</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="n">raylib</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section id="or-build-from-source-manually">
|
<section id="or-build-from-source-manually">
|
||||||
<h2>Or, Build from source manually<a class="headerlink" href="#or-build-from-source-manually" title="Link to this heading"></a></h2>
|
<h2>Or, Build from source manually<a class="headerlink" href="#or-build-from-source-manually" title="Permalink to this heading"></a></h2>
|
||||||
<p>Useful if the Pip build doesn’t work and you want to debug it, or you want to contribute to the
|
<p>Useful if the Pip build doesn’t work and you want to debug it, or you want to contribute to the
|
||||||
project.</p>
|
project.</p>
|
||||||
<div class="admonition attention">
|
<div class="admonition attention">
|
||||||
|
@ -128,10 +126,10 @@ project.</p>
|
||||||
<p>If the Pip build doesn’t work, please submit a bug. (And if you have
|
<p>If the Pip build doesn’t 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 are probably outdated, so see instead how we actually build the wheels
|
<p>Manual instructions follow, but may be outdated, so see also 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="Permalink to this heading"></a></h3>
|
||||||
<p>Clone this repo including submodules so you get correct version of
|
<p>Clone this repo including submodules so you get correct version of
|
||||||
Raylib.</p>
|
Raylib.</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
|
||||||
|
@ -173,7 +171,7 @@ Would be useful if some Windows user could figure out how to auto detect this.</
|
||||||
here.)</p>
|
here.)</p>
|
||||||
</section>
|
</section>
|
||||||
<section id="linux-manual-build">
|
<section id="linux-manual-build">
|
||||||
<h3>Linux manual build<a class="headerlink" href="#linux-manual-build" title="Link to this heading"></a></h3>
|
<h3>Linux manual build<a class="headerlink" href="#linux-manual-build" title="Permalink to this heading"></a></h3>
|
||||||
<p>Clone this repo including submodules so you get correct version of
|
<p>Clone this repo including submodules so you get correct version of
|
||||||
Raylib.</p>
|
Raylib.</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
|
||||||
|
@ -189,7 +187,7 @@ work!</p>
|
||||||
<span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">c</span>
|
<span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">c</span>
|
||||||
<span class="n">mkdir</span> <span class="n">build</span>
|
<span class="n">mkdir</span> <span class="n">build</span>
|
||||||
<span class="n">cd</span> <span class="n">build</span>
|
<span class="n">cd</span> <span class="n">build</span>
|
||||||
<span class="n">cmake</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
|
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
|
||||||
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -247,7 +245,7 @@ from the instructions for building the static module!</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section id="macos-manual-build">
|
<section id="macos-manual-build">
|
||||||
<h3>Macos manual build<a class="headerlink" href="#macos-manual-build" title="Link to this heading"></a></h3>
|
<h3>Macos manual build<a class="headerlink" href="#macos-manual-build" title="Permalink to this heading"></a></h3>
|
||||||
<p>These instructions have been tested on Macos 10.14.</p>
|
<p>These instructions have been tested on Macos 10.14.</p>
|
||||||
<p>Clone this repo including submodules so you get correct version of
|
<p>Clone this repo including submodules so you get correct version of
|
||||||
Raylib.</p>
|
Raylib.</p>
|
||||||
|
|
299
docs/README.html
299
docs/README.html
|
@ -1,22 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
<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.5 — Raylib Python documentation</title>
|
<title>Python Bindings for Raylib 4.5 — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
<script src="_static/doctools.js"></script>
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<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" />
|
||||||
|
@ -45,37 +45,24 @@
|
||||||
</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.5</a><ul>
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Python Bindings for Raylib 4.5</a></li>
|
||||||
<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>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#platforms-windows-mac-linux-raspberry-pi-web">Platforms: Windows, Mac, Linux, Raspberry Pi, 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>
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="#backends">Backends</a><ul>
|
|
||||||
<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="#sdl-backend">SDL backend</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="#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-more-pythonistic-api">If you prefer a more Pythonistic 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 don’t mind it might be slightly slower</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="#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">License</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="#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>
|
||||||
|
@ -103,7 +90,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.5</li>
|
<li class="breadcrumb-item active">Python Bindings for Raylib 4.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>
|
||||||
|
@ -113,238 +100,118 @@
|
||||||
<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-5">
|
<section id="python-bindings-for-raylib-4-5">
|
||||||
<h1>Python Bindings for Raylib 5.5<a class="headerlink" href="#python-bindings-for-raylib-5-5" title="Link to this heading"></a></h1>
|
<h1>Python Bindings for Raylib 4.5<a class="headerlink" href="#python-bindings-for-raylib-4-5" title="Permalink to this heading"></a></h1>
|
||||||
<section id="libraries-raymath-raygui-rlgl-physac-and-glfw">
|
<p>New CFFI API static bindings.</p>
|
||||||
<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>
|
|
||||||
</section>
|
|
||||||
<section id="platforms-windows-mac-linux-raspberry-pi-web">
|
|
||||||
<h2>Platforms: Windows, Mac, Linux, Raspberry Pi, Web<a class="headerlink" href="#platforms-windows-mac-linux-raspberry-pi-web" title="Link to this heading"></a></h2>
|
|
||||||
<p><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/raylib" /></p>
|
|
||||||
<p>Chatroom: <a class="reference external" href="https://discord.gg/fKDwt85aX6">Discord</a></p>
|
|
||||||
<p>HELP WANTED: <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues/155">writing examples</a></p>
|
|
||||||
<p>Features:</p>
|
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>CFFI API static bindings.</p></li>
|
|
||||||
<li><p>Automatically generated to be as close as possible to
|
<li><p>Automatically generated to be as close as possible to
|
||||||
original Raylib.</p></li>
|
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>Type checking with Mypy</p></li>
|
<li><p><strong>Now includes extra libraries: raymath, raygui, rlgl and physac</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="Permalink 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==5.5.0.2</span> <span class="pre">--break-system-packages</span></code></p>
|
<p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib</span></code></p>
|
||||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">pyray</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>from pyray import *
|
||||||
<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">"Hello"</span><span class="p">)</span>
|
init_window(800, 450, "Hello")
|
||||||
<span class="k">while</span> <span class="ow">not</span> <span class="n">window_should_close</span><span class="p">():</span>
|
while not window_should_close():
|
||||||
<span class="n">begin_drawing</span><span class="p">()</span>
|
begin_drawing()
|
||||||
<span class="n">clear_background</span><span class="p">(</span><span class="n">WHITE</span><span class="p">)</span>
|
clear_background(WHITE)
|
||||||
<span class="n">draw_text</span><span class="p">(</span><span class="s2">"Hello world"</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>
|
draw_text("Hello world", 190, 200, 20, VIOLET)
|
||||||
<span class="n">end_drawing</span><span class="p">()</span>
|
end_drawing()
|
||||||
<span class="n">close_window</span><span class="p">()</span>
|
close_window()
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section id="installation">
|
<section id="installation">
|
||||||
<h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
|
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading"></a></h1>
|
||||||
<p>If you are on a modern Linux you will probably want to create a venv:</p>
|
<p>First make sure you have the latest pip installed:</p>
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Then make sure you have the latest pip installed:</p>
|
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --upgrade pip
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --upgrade pip
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</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==5.5.0.2
|
python3 -m pip install raylib
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>On most platforms it should install a binary wheel. If yours isn’t available then pip will attempt to build from
|
<p>On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64).</p>
|
||||||
source, in which case you will need to have Raylib development libs installed, e.g.
|
<p>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.</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.5.0.2
|
|
||||||
</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="Permalink to this heading"></a></h2>
|
||||||
<p><span class="xref myst">Using on Rasperry Pi</span></p>
|
<p><a class="reference internal" href="RPI.html"><span class="std std-doc">Using on Rasperry Pi</span></a></p>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
|
||||||
<section id="backends">
|
|
||||||
<h1>Backends<a class="headerlink" href="#backends" title="Link to this heading"></a></h1>
|
|
||||||
<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="Permalink 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 uninstall raylib
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib_dynamic
|
||||||
python3 -m pip install raylib_dynamic
|
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>It works on some systems where the static version doesn’t, <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 doesn’t, <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>You can’t have multiple raylib packages installed at once.</p>
|
|
||||||
</section>
|
</section>
|
||||||
<section id="sdl-backend">
|
<section id="beta-testing">
|
||||||
<h2>SDL backend<a class="headerlink" href="#sdl-backend" title="Link to this heading"></a></h2>
|
<h2>Beta testing<a class="headerlink" href="#beta-testing" title="Permalink to this heading"></a></h2>
|
||||||
<p>This is not well tested but has better support for controllers:</p>
|
<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>.
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
|
You can install an alpha or beta version by specifying the exact version number like this:</p>
|
||||||
python3 -m pip install raylib_sdl
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib==4.2.0.0.dev4
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>You can’t 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 don’t 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 can’t 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="Permalink to this heading"></a></h2>
|
||||||
<p>If it doesn’t work, <span class="xref myst">try to build manually.</span>. If that works then <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>
|
<p>If it doesn’t 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 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>
|
<p>If you need help you can try asking <a class="reference external" href="https://discord.gg/raylib">on Discord</a>.</p>
|
||||||
for issues that are not Python-specific.</p>
|
|
||||||
<p>If it still doesn’t work, <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>.</p>
|
<p>If it still doesn’t 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="Permalink to this heading"></a></h1>
|
||||||
<p>There are <em>two</em> 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
|
<p>There are two APIs, you can use either or both:</p>
|
||||||
pyray. Do <em>not</em> <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">pyray</span></code>). 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="Permalink to this heading"></a></h2>
|
||||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the raylib module</a>.</p>
|
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the C API</a>.</p>
|
||||||
</section>
|
</section>
|
||||||
<section id="if-you-prefer-a-more-pythonistic-api">
|
<section id="if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">
|
||||||
<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>
|
<h2>If you prefer a slightly more Pythonistic API and don’t 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="Permalink to this heading"></a></h2>
|
||||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the pyray module</a>.</p>
|
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the Python API</a>.</p>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section id="running-in-a-web-browser">
|
|
||||||
<h1>Running in a web browser<a class="headerlink" href="#running-in-a-web-browser" title="Link to this heading"></a></h1>
|
|
||||||
<p><a class="reference external" href="https://pypi.org/project/pygbag/">Pygbag</a> >=0.8.7 supports running in a web browser. Usually the latest git version
|
|
||||||
is recommended.</p>
|
|
||||||
<p>Make a folder <code class="docutils literal notranslate"><span class="pre">my_project</span></code> with a file <code class="docutils literal notranslate"><span class="pre">main.py</span></code>:</p>
|
|
||||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># /// script</span>
|
|
||||||
<span class="c1"># dependencies = [</span>
|
|
||||||
<span class="c1"># "cffi",</span>
|
|
||||||
<span class="c1"># "raylib"</span>
|
|
||||||
<span class="c1"># ]</span>
|
|
||||||
<span class="c1"># ///</span>
|
|
||||||
<span class="kn">import</span><span class="w"> </span><span class="nn">asyncio</span>
|
|
||||||
<span class="kn">import</span><span class="w"> </span><span class="nn">platform</span>
|
|
||||||
<span class="kn">from</span><span class="w"> </span><span class="nn">pyray</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
|
|
||||||
|
|
||||||
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">main</span><span class="p">():</span> <span class="c1"># You MUST have an async main function</span>
|
|
||||||
<span class="n">init_window</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">500</span><span class="p">,</span> <span class="s2">"Hello"</span><span class="p">)</span>
|
|
||||||
<span class="n">platform</span><span class="o">.</span><span class="n">window</span><span class="o">.</span><span class="n">window_resize</span><span class="p">()</span> <span class="c1"># You MAY want to add this line</span>
|
|
||||||
<span class="k">while</span> <span class="ow">not</span> <span class="n">window_should_close</span><span class="p">():</span>
|
|
||||||
<span class="n">begin_drawing</span><span class="p">()</span>
|
|
||||||
<span class="n">clear_background</span><span class="p">(</span><span class="n">WHITE</span><span class="p">)</span>
|
|
||||||
<span class="n">draw_text</span><span class="p">(</span><span class="s2">"Hello world"</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>
|
|
||||||
<span class="n">end_drawing</span><span class="p">()</span>
|
|
||||||
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># You MUST call this in your main loop</span>
|
|
||||||
<span class="n">close_window</span><span class="p">()</span>
|
|
||||||
|
|
||||||
<span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">main</span><span class="p">())</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Then to create the web files and launch a web server:</p>
|
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3.12 -m pip install --user --upgrade pygbag
|
|
||||||
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my_project
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Point your browser to http://localhost:8000</p>
|
|
||||||
<p>Some features may not work, so you can disable them like this:</p>
|
|
||||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">platform</span><span class="o">.</span><span class="n">system</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">"Emscripten"</span><span class="p">:</span> <span class="c1"># audio may not work on current version of emscripten</span>
|
|
||||||
<span class="n">init_audio_device</span><span class="p">()</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
|
|
||||||
Carefully read all their <a class="reference external" href="https://pygame-web.github.io/">documentation</a>.</p>
|
|
||||||
<p>It does work for most of <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/">these examples</a></p>
|
|
||||||
</section>
|
|
||||||
<section id="app-showcase">
|
<section id="app-showcase">
|
||||||
<h1>App showcase<a class="headerlink" href="#app-showcase" title="Link to this heading"></a></h1>
|
<h1>App showcase<a class="headerlink" href="#app-showcase" title="Permalink to this heading"></a></h1>
|
||||||
<p><a class="reference external" href="https://github.com/Emtyloc/tempest-raylib">Tempest-raylib</a></p>
|
|
||||||
<p><a class="reference external" href="https://github.com/bilbofroggins/KarabinerKeyboard">KarabinerKeyboard</a></p>
|
|
||||||
<p><a class="reference external" href="https://github.com/Yonokid/PyTaiko">PyTaiko</a></p>
|
|
||||||
<p><a class="reference external" href="https://github.com/StanislavPetrovV/DOOM-Clone">DOOM-Clone</a></p>
|
|
||||||
<p><a class="reference external" href="https://github.com/pkulev/tanki">Tanki</a></p>
|
<p><a class="reference external" href="https://github.com/pkulev/tanki">Tanki</a></p>
|
||||||
<p><a class="reference external" href="https://pebaz.itch.io/alloy-bloxel-editor">Alloy Bloxel Editor</a></p>
|
<p><a class="reference external" href="https://pebaz.itch.io/alloy-bloxel-editor">Alloy Bloxel Editor</a></p>
|
||||||
<p><a class="reference external" href="https://github.com/Miou-zora/Eidolon">Eidolon</a></p>
|
|
||||||
<p>Add your app here!</p>
|
<p>Add your app here!</p>
|
||||||
</section>
|
</section>
|
||||||
<section id="rlzero">
|
<section id="rlzero">
|
||||||
<h1>RLZero<a class="headerlink" href="#rlzero" title="Link to this heading"></a></h1>
|
<h1>RLZero<a class="headerlink" href="#rlzero" title="Permalink to this heading"></a></h1>
|
||||||
<p>A related library (that is a work in progress!):</p>
|
<p>A related library (that is a work in progress!):</p>
|
||||||
<p><a class="reference external" href="https://github.com/electronstudio/rlzero">A simplified API for Raylib for use in education and to enable beginners to create 3d games</a></p>
|
<p><a class="reference external" href="https://github.com/electronstudio/rlzero">A simplified API for Raylib for use in education and to enable beginners to create 3d games</a></p>
|
||||||
</section>
|
</section>
|
||||||
<section id="help-wanted">
|
<section id="help-wanted">
|
||||||
<h1>Help wanted<a class="headerlink" href="#help-wanted" title="Link to this heading"></a></h1>
|
<h1>Help wanted<a class="headerlink" href="#help-wanted" title="Permalink to this heading"></a></h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>Converting more examples from C to Python</p></li>
|
<li><p>Converting more examples from C to Python</p></li>
|
||||||
<li><p>Testing on more platforms</p></li>
|
<li><p>Testing on more platforms</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<section id="license">
|
<section id="license-updated">
|
||||||
<h1>License<a class="headerlink" href="#license" title="Link to this heading"></a></h1>
|
<h1>License (updated)<a class="headerlink" href="#license-updated" title="Permalink to this heading"></a></h1>
|
||||||
<p>Eclipse Public License, so you are free to
|
<p>The bindings are now under the 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">
|
||||||
<h1>Performance<a class="headerlink" href="#performance" title="Link to this heading"></a></h1>
|
<h1>Performance<a class="headerlink" href="#performance" title="Permalink to this heading"></a></h1>
|
||||||
<p>If you need more performance, do in this order:</p>
|
<p>For fastest performance use Pypy rather than standard Python.</p>
|
||||||
<ol class="arabic simple">
|
<p>Every call to C is costly, so it’s slightly faster if you use Python data structures and functions when calculating
|
||||||
<li><p>Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.</p></li>
|
|
||||||
<li><p>Every call to C is costly, so it’s slightly faster if you use Python data structures and functions when calculating
|
|
||||||
in your update loop
|
in your update loop
|
||||||
and then only convert them to C data structures when you have to call the C functions for drawing.</p></li>
|
and then only convert them to C data structures when you have to call the C functions for drawing.</p>
|
||||||
<li><p>The raylib.* functions are potentially <em>slightly</em> faster than the pyray.* equivalents, so if you need a tiny bit more performance
|
|
||||||
you can switch your inner loop functions to these.</p></li>
|
|
||||||
<li><p>There is a version of Python that is faster than Pypy: GraalPy. However it’s not fully compatible with all Python
|
|
||||||
packages. It doesn’t work with CFFI and so doesn’t work with this binding. But it <em>is</em> compatible with the
|
|
||||||
<em>Java</em> binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib</p></li>
|
|
||||||
</ol>
|
|
||||||
<section id="bunnymark">
|
<section id="bunnymark">
|
||||||
<h2>Bunnymark<a class="headerlink" href="#bunnymark" title="Link to this heading"></a></h2>
|
<h2>Bunnymark<a class="headerlink" href="#bunnymark" title="Permalink to this heading"></a></h2>
|
||||||
<table class="docutils align-default">
|
<table class="docutils align-default">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="row-odd"><th class="head"><p>Library</p></th>
|
<tr class="row-odd"><th class="head"><p>Library</p></th>
|
||||||
|
@ -354,53 +221,37 @@ packages. It doesn’t work with CFFI and so doesn’t work with this binding.
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="row-even"><td><p>Raylib 5.0</p></td>
|
<tr class="row-even"><td><p>Raylib 3.7</p></td>
|
||||||
<td><p>C</p></td>
|
|
||||||
<td><p>180000</p></td>
|
|
||||||
<td><p>100%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-odd"><td><p>Raylib Python CFFI 5.0.0.2</p></td>
|
|
||||||
<td><p>Python 3.12</p></td>
|
|
||||||
<td><p>10500</p></td>
|
|
||||||
<td><p>5.8%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-even"><td><p>Raylib Python CFFI 5.0.0.2</p></td>
|
|
||||||
<td><p>Pypy 3.10</p></td>
|
|
||||||
<td><p>95000</p></td>
|
|
||||||
<td><p>53%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-odd"><td><p>Raylib 3.7</p></td>
|
|
||||||
<td><p>C</p></td>
|
<td><p>C</p></td>
|
||||||
<td><p>168100</p></td>
|
<td><p>168100</p></td>
|
||||||
<td><p>100%</p></td>
|
<td><p>100%</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
|
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
|
||||||
<td><p>Pypy 3.7</p></td>
|
<td><p>Pypy 3.7</p></td>
|
||||||
<td><p>33800</p></td>
|
<td><p>33800</p></td>
|
||||||
<td><p>20%</p></td>
|
<td><p>20%</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
|
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
|
||||||
<td><p>Python 3.9</p></td>
|
<td><p>Python 3.9</p></td>
|
||||||
<td><p>7700</p></td>
|
<td><p>7700</p></td>
|
||||||
<td><p>4.5%</p></td>
|
<td><p>4.5%</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
|
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
|
||||||
<td><p>Python 3.9 Nuitka</p></td>
|
<td><p>Python 3.9 Nuitka</p></td>
|
||||||
<td><p>8600</p></td>
|
<td><p>8600</p></td>
|
||||||
<td><p>5.1%</p></td>
|
<td><p>5.1%</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7 Dynamic</p></td>
|
<tr class="row-even"><td><p>Raylib Python CFFI 3.7 Dynamic</p></td>
|
||||||
<td><p>Python 3.9</p></td>
|
<td><p>Python 3.9</p></td>
|
||||||
<td><p>6300</p></td>
|
<td><p>6300</p></td>
|
||||||
<td><p>3.7%</p></td>
|
<td><p>3.7%</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>See also https://github.com/electronstudio/megabunny/</p>
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section id="packaging-your-app">
|
<section id="packaging-your-app">
|
||||||
<h1>Packaging your app<a class="headerlink" href="#packaging-your-app" title="Link to this heading"></a></h1>
|
<h1>Packaging your app<a class="headerlink" href="#packaging-your-app" title="Permalink to this heading"></a></h1>
|
||||||
<p>You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:</p>
|
<p>You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:</p>
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install nuitka
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install nuitka
|
||||||
cd examples/textures
|
cd examples/textures
|
||||||
|
@ -409,7 +260,7 @@ python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png text
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section id="advert">
|
<section id="advert">
|
||||||
<h1>Advert<a class="headerlink" href="#advert" title="Link to this heading"></a></h1>
|
<h1>Advert<a class="headerlink" href="#advert" title="Permalink to this heading"></a></h1>
|
||||||
<p><a class="reference external" href="https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git">RetroWar: 8-bit Party Battle</a> is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.</p>
|
<p><a class="reference external" href="https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git">RetroWar: 8-bit Party Battle</a> is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.</p>
|
||||||
<p><a class="reference external" href="https://github.com/electronstudio/pygame-zero-book">Coding Games With Pygame Zero & Python</a> is
|
<p><a class="reference external" href="https://github.com/electronstudio/pygame-zero-book">Coding Games With Pygame Zero & Python</a> is
|
||||||
a book for Python beginners.</p>
|
a book for Python beginners.</p>
|
||||||
|
|
117
docs/RPI.html
117
docs/RPI.html
|
@ -1,22 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Raspberry Pi — Raylib Python documentation</title>
|
<title>Raspberry Pi — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
<script src="_static/doctools.js"></script>
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<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" />
|
||||||
|
@ -44,16 +44,14 @@
|
||||||
</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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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>
|
||||||
|
@ -61,12 +59,7 @@
|
||||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
|
||||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Raspberry Pi</a><ul>
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Raspberry Pi</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#option-1-binary-wheel">Option 1: Binary wheel</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#option-2-compile-raylib-from-source-x11-mode">Option 2: Compile Raylib from source X11 mode</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#option-3-compile-raylib-from-source-drm-mode">Option 3: Compile Raylib from source DRM mode</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,80 +87,38 @@
|
||||||
<div itemprop="articleBody">
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
<section id="raspberry-pi">
|
<section id="raspberry-pi">
|
||||||
<h1>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h1>
|
<h1>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Permalink to this heading"></a></h1>
|
||||||
<p>Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.</p>
|
<p>Please use Raspberry Pi OS Bullseye. Older OSes are not tested.</p>
|
||||||
<section id="option-1-binary-wheel">
|
<p>We have published a binary wheel using Raylib in X11 mode. This <em>should</em> install and work on Bullseye
|
||||||
<h2>Option 1: Binary wheel<a class="headerlink" href="#option-1-binary-wheel" title="Link to this heading"></a></h2>
|
with</p>
|
||||||
<p>We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.</p>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span><span class="mf">.9</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">4.2.1.2</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>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 can’t have both wheels
|
<p>If it doesn’t work, or we haven’t published a binary wheel for the latest version,
|
||||||
installed at once.</p>
|
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.
|
||||||
<p>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 instructins 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>
|
<p>This ‘worked for me’:</p>
|
||||||
</section>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">raysan5</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">git</span> <span class="o">--</span><span class="n">branch</span> <span class="mf">4.2.0</span> <span class="o">--</span><span class="n">single</span><span class="o">-</span><span class="n">branch</span>
|
||||||
<section id="option-2-compile-raylib-from-source-x11-mode">
|
|
||||||
<h2>Option 2: Compile Raylib from source X11 mode<a class="headerlink" href="#option-2-compile-raylib-from-source-x11-mode" title="Link to this heading"></a></h2>
|
|
||||||
<p>This should work for everyone.</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">update</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">apt</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">pip</span> <span class="n">cmake</span> <span class="n">libegl1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgbm</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgles2</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libdrm</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglfw3</span><span class="o">-</span><span class="n">dev</span>
|
|
||||||
<span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">raysan5</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">git</span> <span class="o">--</span><span class="n">branch</span> <span class="mf">5.0</span> <span class="o">--</span><span class="n">single</span><span class="o">-</span><span class="n">branch</span>
|
|
||||||
<span class="n">cd</span> <span class="n">raylib</span>
|
<span class="n">cd</span> <span class="n">raylib</span>
|
||||||
<span class="n">mkdir</span> <span class="n">build</span>
|
<span class="n">mkdir</span> <span class="n">build</span>
|
||||||
<span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="n">build</span><span class="o">/*</span>
|
|
||||||
<span class="n">cd</span> <span class="n">build</span>
|
<span class="n">cd</span> <span class="n">build</span>
|
||||||
<span class="n">cmake</span> <span class="o">-</span><span class="n">DPLATFORM</span><span class="o">=</span><span class="s2">"Desktop"</span> <span class="o">-</span><span class="n">DOPENGL_VERSION</span><span class="o">=</span><span class="mf">2.1</span> <span class="o">-</span><span class="n">DBUILD_EXAMPLES</span><span class="o">=</span><span class="n">OFF</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
|
<span class="n">cmake</span> <span class="o">-</span><span class="n">DPLATFORM</span><span class="o">=</span><span class="s2">"DRM"</span> <span class="o">-</span><span class="n">DINCLUDE_EVERYTHING</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
|
||||||
<span class="n">make</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">cp</span> <span class="o">-</span><span class="n">r</span> <span class="o">../</span><span class="n">src</span><span class="o">/</span><span class="n">external</span><span class="o">/</span><span class="n">glfw</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">GLFW</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">include</span><span class="o">/</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<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>
|
|
||||||
<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.5.0.0</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="option-3-compile-raylib-from-source-drm-mode">
|
|
||||||
<h2>Option 3: Compile Raylib from source DRM mode<a class="headerlink" href="#option-3-compile-raylib-from-source-drm-mode" title="Link to this heading"></a></h2>
|
|
||||||
<p>This seems to work on Raspberry Pi 4. Note you must not be running X11 when you run your programs.</p>
|
|
||||||
<p>If you have ever installed Raylib or raylib-python-cffi before, remove all traces of it:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">remove</span> <span class="n">raylib</span> <span class="n">raylib</span><span class="o">-</span><span class="n">dev</span> <span class="n">libraylib</span> <span class="n">libraylib</span><span class="o">-</span><span class="n">dev</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">rm</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">pkgconfig</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">pc</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.*</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.*</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Remove all GLFW:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">remove</span> <span class="n">libglfw3</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglfw3</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">GLFW</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Build a shared lib version of Raylib in DRM mode and install to /usr:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">update</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">apt</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">pip</span> <span class="n">cmake</span> <span class="n">libegl1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgbm</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgles2</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libdrm</span><span class="o">-</span><span class="n">dev</span>
|
|
||||||
<span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">raysan5</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">git</span> <span class="o">--</span><span class="n">branch</span> <span class="mf">5.0</span> <span class="o">--</span><span class="n">single</span><span class="o">-</span><span class="n">branch</span>
|
|
||||||
<span class="n">cd</span> <span class="n">raylib</span>
|
|
||||||
<span class="n">mkdir</span> <span class="n">build</span>
|
|
||||||
<span class="n">rm</span> <span class="n">rf</span> <span class="n">build</span><span class="o">/*</span>
|
|
||||||
<span class="n">cd</span> <span class="n">build</span>
|
|
||||||
<span class="n">cmake</span> <span class="o">-</span><span class="n">DPLATFORM</span><span class="o">=</span><span class="s2">"DRM"</span> <span class="o">-</span><span class="n">DBUILD_EXAMPLES</span><span class="o">=</span><span class="n">OFF</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">-</span><span class="n">DBUILD_SHARED_LIBS</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_INSTALL_PREFIX</span><span class="p">:</span><span class="n">PATH</span><span class="o">=/</span><span class="n">usr</span> <span class="o">..</span>
|
|
||||||
<span class="n">make</span>
|
<span class="n">make</span>
|
||||||
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Then have pip compile and install the wheel:</p>
|
<p>Then have pip compile 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">pip3</span> <span class="n">install</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.5.0.0</span>
|
<span class="n">pip3</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="n">raylib</span><span class="o">==</span><span class="mf">4.2.1.2</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
|
<p>(or newer version)</p>
|
||||||
<div class="admonition attention">
|
<div class="admonition attention">
|
||||||
<p class="admonition-title">Attention</p>
|
<p class="admonition-title">Attention</p>
|
||||||
<p>If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into <code class="docutils literal notranslate"><span class="pre">/opt/vc</span></code> and compiled in Raylib
|
<p>The Broadcom proprietary Open GL ES 2.0 drivers (installed by Raspbian into <code class="docutils literal notranslate"><span class="pre">/opt/vc</span></code> and compiled in Raylib
|
||||||
with <code class="docutils literal notranslate"><span class="pre">PLATFORM_RPI</span></code>) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
|
with <code class="docutils literal notranslate"><span class="pre">PLATFORM_RPI</span></code>) do not work with Bullseye and have not been tested with the bindings. They will probably
|
||||||
require additional linker arguments to be added to <code class="docutils literal notranslate"><span class="pre">build.py</span></code>. Suggest you try <code class="docutils literal notranslate"><span class="pre">PLATFORM_DRM</span></code> instead.</p>
|
require additional linker arguments to be added to <code class="docutils literal notranslate"><span class="pre">build.py</span></code>. Suggest you use <code class="docutils literal notranslate"><span class="pre">PLATFORM_DRM</span></code> instead.</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ Requirements for build: cmake, pkg-config.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
cd raylib-5.0
|
cd raylib-4.2.0
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ Then ask Pip to build from source:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
|
pip3 install --no-binary raylib --upgrade --force-reinstall raylib
|
||||||
|
|
||||||
Or, Build from source manually
|
Or, Build from source manually
|
||||||
------------------------------
|
------------------------------
|
||||||
|
@ -38,7 +38,7 @@ project.
|
||||||
If the Pip build doesn’t work, please submit a bug. (And if you have
|
If the Pip build doesn’t work, please submit a bug. (And if you have
|
||||||
fixed it, a PR.)
|
fixed it, a PR.)
|
||||||
|
|
||||||
Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
|
Manual instructions follow, but may be outdated, so see also 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
|
||||||
|
@ -119,7 +119,7 @@ Build and install Raylib from the raylib-c directory.
|
||||||
cd raylib-python-cffi/raylib-c
|
cd raylib-python-cffi/raylib-c
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
||||||
|
|
|
@ -1,216 +1,92 @@
|
||||||
# Python Bindings for Raylib 5.5
|
# Python Bindings for Raylib 4.5
|
||||||
## Libraries: raymath, raygui, rlgl, physac and GLFW
|
|
||||||
## Backends: Desktop, SDL, DRM, Web
|
|
||||||
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
|
|
||||||
|
|
||||||

|
New CFFI API static bindings.
|
||||||
|
|
||||||
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
|
|
||||||
|
|
||||||
HELP WANTED: [writing examples](https://github.com/electronstudio/raylib-python-cffi/issues/155)
|
|
||||||
|
|
||||||
Features:
|
|
||||||
|
|
||||||
* CFFI API static bindings.
|
|
||||||
* Automatically generated to be as close as possible to
|
* Automatically generated to be as close as possible to
|
||||||
original Raylib.
|
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.
|
||||||
* Type checking with Mypy
|
* **Now includes extra libraries: raymath, raygui, rlgl and physac**
|
||||||
|
|
||||||
|
|
||||||
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
||||||
|
|
||||||
# Quickstart
|
# Quickstart
|
||||||
|
|
||||||
`pip3 install raylib==5.5.0.2 --break-system-packages`
|
`pip3 install raylib`
|
||||||
```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
|
||||||
|
|
||||||
If you are on a modern Linux you will probably want to create a venv:
|
First make sure you have the latest pip installed:
|
||||||
|
|
||||||
python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
Then make sure you have the latest pip installed:
|
|
||||||
|
|
||||||
python3 -m pip install --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
Then install
|
Then install
|
||||||
|
|
||||||
python3 -m pip install setuptools
|
python3 -m pip install setuptools
|
||||||
python3 -m pip install raylib==5.5.0.2
|
python3 -m pip install raylib
|
||||||
|
|
||||||
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
|
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64).
|
||||||
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.5.0.2
|
|
||||||
|
|
||||||
(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)
|
||||||
|
|
||||||
# Backends
|
|
||||||
|
|
||||||
## Dynamic binding version
|
## Dynamic binding version
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
You can't have multiple raylib packages installed at once.
|
## 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).
|
||||||
|
You can install an alpha or beta version by specifying the exact version number like this:
|
||||||
|
|
||||||
This is not well tested but has better support for controllers:
|
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 [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
|
If you need help you can try asking [on 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* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
|
There are two APIs, you can use either or both:
|
||||||
pyray. Do *not* `pip install 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 raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
Use [the C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||||
|
|
||||||
### If you prefer a more Pythonistic API
|
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower
|
||||||
|
|
||||||
Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||||
|
|
||||||
# Running in a web browser
|
|
||||||
|
|
||||||
[Pygbag](https://pypi.org/project/pygbag/) >=0.8.7 supports running in a web browser. Usually the latest git version
|
|
||||||
is recommended.
|
|
||||||
|
|
||||||
Make a folder `my_project` with a file `main.py`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# /// script
|
|
||||||
# dependencies = [
|
|
||||||
# "cffi",
|
|
||||||
# "raylib"
|
|
||||||
# ]
|
|
||||||
# ///
|
|
||||||
import asyncio
|
|
||||||
import platform
|
|
||||||
from pyray import *
|
|
||||||
|
|
||||||
async def main(): # You MUST have an async main function
|
|
||||||
init_window(500, 500, "Hello")
|
|
||||||
platform.window.window_resize() # You MAY want to add this line
|
|
||||||
while not window_should_close():
|
|
||||||
begin_drawing()
|
|
||||||
clear_background(WHITE)
|
|
||||||
draw_text("Hello world", 190, 200, 20, VIOLET)
|
|
||||||
end_drawing()
|
|
||||||
await asyncio.sleep(0) # You MUST call this in your main loop
|
|
||||||
close_window()
|
|
||||||
|
|
||||||
asyncio.run(main())
|
|
||||||
```
|
|
||||||
|
|
||||||
Then to create the web files and launch a web server:
|
|
||||||
|
|
||||||
python3.12 -m pip install --user --upgrade pygbag
|
|
||||||
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my_project
|
|
||||||
|
|
||||||
Point your browser to http://localhost:8000
|
|
||||||
|
|
||||||
Some features may not work, so you can disable them like this:
|
|
||||||
|
|
||||||
```python
|
|
||||||
if platform.system() != "Emscripten": # audio may not work on current version of emscripten
|
|
||||||
init_audio_device()
|
|
||||||
```
|
|
||||||
|
|
||||||
This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
|
|
||||||
Carefully read all their [documentation](https://pygame-web.github.io/).
|
|
||||||
|
|
||||||
It does work for most of [these examples](https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/)
|
|
||||||
|
|
||||||
# App showcase
|
# App showcase
|
||||||
|
|
||||||
[Tempest-raylib](https://github.com/Emtyloc/tempest-raylib)
|
|
||||||
|
|
||||||
[KarabinerKeyboard](https://github.com/bilbofroggins/KarabinerKeyboard)
|
|
||||||
|
|
||||||
[PyTaiko](https://github.com/Yonokid/PyTaiko)
|
|
||||||
|
|
||||||
[DOOM-Clone](https://github.com/StanislavPetrovV/DOOM-Clone)
|
|
||||||
|
|
||||||
[Tanki](https://github.com/pkulev/tanki)
|
[Tanki](https://github.com/pkulev/tanki)
|
||||||
|
|
||||||
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
|
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
|
||||||
|
|
||||||
[Eidolon](https://github.com/Miou-zora/Eidolon)
|
|
||||||
|
|
||||||
Add your app here!
|
Add your app here!
|
||||||
|
|
||||||
# RLZero
|
# RLZero
|
||||||
|
@ -224,43 +100,29 @@ 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
|
# License (updated)
|
||||||
|
|
||||||
Eclipse Public License, so you are free to
|
The bindings are now under the 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
|
||||||
|
|
||||||
If you need more performance, do in this order:
|
For fastest performance use Pypy rather than standard Python.
|
||||||
|
|
||||||
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
|
Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
||||||
|
|
||||||
2. Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
|
|
||||||
in your update loop
|
in your update loop
|
||||||
and then only convert them to C data structures when you have to call the C functions for drawing.
|
and then only convert them to C data structures when you have to call the C functions for drawing.
|
||||||
|
|
||||||
3. The raylib.* functions are potentially *slightly* faster than the pyray.* equivalents, so if you need a tiny bit more performance
|
|
||||||
you can switch your inner loop functions to these.
|
|
||||||
|
|
||||||
4. There is a version of Python that is faster than Pypy: GraalPy. However it's not fully compatible with all Python
|
|
||||||
packages. It doesn't work with CFFI and so doesn't work with this binding. But it *is* compatible with the
|
|
||||||
*Java* binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib
|
|
||||||
|
|
||||||
## Bunnymark
|
## Bunnymark
|
||||||
|
|
||||||
|
|
||||||
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
||||||
|--------------------------------|-------------------|------------------|------------|
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
| Raylib 5.0 | C | 180000 | 100% |
|
| Raylib 3.7 | C | 168100 | 100% |
|
||||||
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
|
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
||||||
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
|
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
|
||||||
| Raylib 3.7 | C | 168100 | 100% |
|
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
|
||||||
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
|
||||||
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
|
|
||||||
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
|
|
||||||
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
|
|
||||||
|
|
||||||
See also https://github.com/electronstudio/megabunny/
|
|
||||||
|
|
||||||
# Packaging your app
|
# Packaging your app
|
||||||
|
|
||||||
|
@ -275,4 +137,4 @@ You can create a standalone binary using the Nuitka compiler. For example, here
|
||||||
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
|
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
|
||||||
|
|
||||||
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
|
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
|
||||||
a book for Python beginners.
|
a book for Python beginners.
|
|
@ -1,97 +1,42 @@
|
||||||
Raspberry Pi
|
Raspberry Pi
|
||||||
====================
|
====================
|
||||||
|
|
||||||
Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.
|
Please use Raspberry Pi OS Bullseye. Older OSes are not tested.
|
||||||
|
|
||||||
Option 1: Binary wheel
|
We have published a binary wheel using Raylib in X11 mode. This *should* install and work on Bullseye
|
||||||
----------------------
|
with
|
||||||
|
|
||||||
We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
python -m pip install --break-system-packages raylib
|
python3.9 -m pip install raylib==4.2.1.2
|
||||||
|
|
||||||
Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
|
If it doesn't work, or we haven't published a binary wheel for the latest version,
|
||||||
installed at once.
|
or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib.
|
||||||
|
For full instructins on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
|
||||||
|
|
||||||
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.
|
This 'worked for me':
|
||||||
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
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
This should work for everyone.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
sudo apt update
|
git clone https://github.com/raysan5/raylib.git --branch 4.2.0 --single-branch
|
||||||
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev libglfw3-dev
|
|
||||||
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
|
|
||||||
cd raylib
|
cd raylib
|
||||||
mkdir build
|
mkdir build
|
||||||
rm -rf 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 -DPLATFORM="DRM" -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
sudo cp -r ../src/external/glfw/include/GLFW /usr/local/include/
|
|
||||||
|
|
||||||
Then have pip compile and install the wheel:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
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.5.0.0
|
|
||||||
|
|
||||||
Option 3: Compile Raylib from source DRM mode
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
This seems to work on Raspberry Pi 4. Note you must not be running X11 when you run your programs.
|
|
||||||
|
|
||||||
If you have ever installed Raylib or raylib-python-cffi before, remove all traces of it:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt remove raylib raylib-dev libraylib libraylib-dev
|
|
||||||
sudo rm /usr/local/lib/pkgconfig/raylib.pc
|
|
||||||
sudo rm -rf /usr/local/lib/libraylib.* /usr/lib/libraylib.*
|
|
||||||
|
|
||||||
Remove all GLFW:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt remove libglfw3-dev libglfw3
|
|
||||||
sudo rm -rf /usr/local/include/GLFW
|
|
||||||
|
|
||||||
Build a shared lib version of Raylib in DRM mode and install to /usr:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev
|
|
||||||
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
|
|
||||||
cd raylib
|
|
||||||
mkdir build
|
|
||||||
rm rf build/*
|
|
||||||
cd build
|
|
||||||
cmake -DPLATFORM="DRM" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
|
|
||||||
Then have pip compile and install the wheel:
|
Then have pip compile the wheel:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
python3 -m pip install --break-system-packages setuptools
|
pip3 install setuptools
|
||||||
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.5.0.0
|
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==4.2.1.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(or newer version)
|
||||||
|
|
||||||
.. attention::
|
.. attention::
|
||||||
|
|
||||||
If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into ``/opt/vc`` and compiled in Raylib
|
The Broadcom proprietary Open GL ES 2.0 drivers (installed by Raspbian into ``/opt/vc`` and compiled in Raylib
|
||||||
with ``PLATFORM_RPI``) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
|
with ``PLATFORM_RPI``) do not work with Bullseye and have not been tested with the bindings. They will probably
|
||||||
require additional linker arguments to be added to ``build.py``. Suggest you try ``PLATFORM_DRM`` instead.
|
require additional linker arguments to be added to ``build.py``. Suggest you use ``PLATFORM_DRM`` instead.
|
||||||
|
|
|
@ -56,6 +56,7 @@ 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>`_
|
||||||
|
|
||||||
|
|
29
docs/_static/basic.css
vendored
29
docs/_static/basic.css
vendored
|
@ -1,5 +1,12 @@
|
||||||
/*
|
/*
|
||||||
|
* basic.css
|
||||||
|
* ~~~~~~~~~
|
||||||
|
*
|
||||||
* Sphinx stylesheet -- basic theme.
|
* Sphinx stylesheet -- basic theme.
|
||||||
|
*
|
||||||
|
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||||
|
* :license: BSD, see LICENSE for details.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* -- main layout ----------------------------------------------------------- */
|
/* -- main layout ----------------------------------------------------------- */
|
||||||
|
@ -108,11 +115,15 @@ img {
|
||||||
/* -- search page ----------------------------------------------------------- */
|
/* -- search page ----------------------------------------------------------- */
|
||||||
|
|
||||||
ul.search {
|
ul.search {
|
||||||
margin-top: 10px;
|
margin: 10px 0 0 20px;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.search li {
|
ul.search li {
|
||||||
padding: 5px 0;
|
padding: 5px 0 5px 20px;
|
||||||
|
background-image: url(file.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 0 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.search li a {
|
ul.search li a {
|
||||||
|
@ -226,10 +237,6 @@ a.headerlink {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: #551A8B;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1:hover > a.headerlink,
|
h1:hover > a.headerlink,
|
||||||
h2:hover > a.headerlink,
|
h2:hover > a.headerlink,
|
||||||
h3:hover > a.headerlink,
|
h3:hover > a.headerlink,
|
||||||
|
@ -663,16 +670,6 @@ dd {
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sig dd {
|
|
||||||
margin-top: 0px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig dl {
|
|
||||||
margin-top: 0px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl > dd:last-child,
|
dl > dd:last-child,
|
||||||
dl > dd:last-child > :last-child {
|
dl > dd:last-child > :last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
2
docs/_static/css/badge_only.css
vendored
2
docs/_static/css/badge_only.css
vendored
|
@ -1 +1 @@
|
||||||
.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px}
|
.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
|
2
docs/_static/css/theme.css
vendored
2
docs/_static/css/theme.css
vendored
File diff suppressed because one or more lines are too long
7
docs/_static/doctools.js
vendored
7
docs/_static/doctools.js
vendored
|
@ -1,5 +1,12 @@
|
||||||
/*
|
/*
|
||||||
|
* doctools.js
|
||||||
|
* ~~~~~~~~~~~
|
||||||
|
*
|
||||||
* Base JavaScript utilities for all Sphinx HTML documentation.
|
* Base JavaScript utilities for all Sphinx HTML documentation.
|
||||||
|
*
|
||||||
|
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||||
|
* :license: BSD, see LICENSE for details.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
3
docs/_static/documentation_options.js
vendored
3
docs/_static/documentation_options.js
vendored
|
@ -1,4 +1,5 @@
|
||||||
const DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
|
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
||||||
VERSION: '',
|
VERSION: '',
|
||||||
LANGUAGE: 'en',
|
LANGUAGE: 'en',
|
||||||
COLLAPSE_INDEX: false,
|
COLLAPSE_INDEX: false,
|
||||||
|
|
BIN
docs/_static/fonts/Lato/lato-bold.eot
vendored
BIN
docs/_static/fonts/Lato/lato-bold.eot
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bold.ttf
vendored
BIN
docs/_static/fonts/Lato/lato-bold.ttf
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bold.woff
vendored
BIN
docs/_static/fonts/Lato/lato-bold.woff
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bold.woff2
vendored
BIN
docs/_static/fonts/Lato/lato-bold.woff2
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bolditalic.eot
vendored
BIN
docs/_static/fonts/Lato/lato-bolditalic.eot
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bolditalic.ttf
vendored
BIN
docs/_static/fonts/Lato/lato-bolditalic.ttf
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bolditalic.woff
vendored
BIN
docs/_static/fonts/Lato/lato-bolditalic.woff
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-bolditalic.woff2
vendored
BIN
docs/_static/fonts/Lato/lato-bolditalic.woff2
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-italic.eot
vendored
BIN
docs/_static/fonts/Lato/lato-italic.eot
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-italic.ttf
vendored
BIN
docs/_static/fonts/Lato/lato-italic.ttf
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-italic.woff
vendored
BIN
docs/_static/fonts/Lato/lato-italic.woff
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-italic.woff2
vendored
BIN
docs/_static/fonts/Lato/lato-italic.woff2
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-regular.eot
vendored
BIN
docs/_static/fonts/Lato/lato-regular.eot
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-regular.ttf
vendored
BIN
docs/_static/fonts/Lato/lato-regular.ttf
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-regular.woff
vendored
BIN
docs/_static/fonts/Lato/lato-regular.woff
vendored
Binary file not shown.
BIN
docs/_static/fonts/Lato/lato-regular.woff2
vendored
BIN
docs/_static/fonts/Lato/lato-regular.woff2
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
docs/_static/graphviz.css
vendored
7
docs/_static/graphviz.css
vendored
|
@ -1,5 +1,12 @@
|
||||||
/*
|
/*
|
||||||
|
* graphviz.css
|
||||||
|
* ~~~~~~~~~~~~
|
||||||
|
*
|
||||||
* Sphinx stylesheet -- graphviz extension.
|
* Sphinx stylesheet -- graphviz extension.
|
||||||
|
*
|
||||||
|
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||||
|
* :license: BSD, see LICENSE for details.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
img.graphviz {
|
img.graphviz {
|
||||||
|
|
4
docs/_static/js/html5shiv-printshiv.min.js
vendored
Normal file
4
docs/_static/js/html5shiv-printshiv.min.js
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/**
|
||||||
|
* @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||||
|
*/
|
||||||
|
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.3",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b),"object"==typeof module&&module.exports&&(module.exports=y)}("undefined"!=typeof window?window:this,document);
|
4
docs/_static/js/html5shiv.min.js
vendored
Normal file
4
docs/_static/js/html5shiv.min.js
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/**
|
||||||
|
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||||
|
*/
|
||||||
|
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
|
228
docs/_static/js/versions.js
vendored
228
docs/_static/js/versions.js
vendored
|
@ -1,228 +0,0 @@
|
||||||
const themeFlyoutDisplay = "hidden";
|
|
||||||
const themeVersionSelector = true;
|
|
||||||
const themeLanguageSelector = true;
|
|
||||||
|
|
||||||
if (themeFlyoutDisplay === "attached") {
|
|
||||||
function renderLanguages(config) {
|
|
||||||
if (!config.projects.translations.length) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the current language to the options on the selector
|
|
||||||
let languages = config.projects.translations.concat(config.projects.current);
|
|
||||||
languages = languages.sort((a, b) => a.language.name.localeCompare(b.language.name));
|
|
||||||
|
|
||||||
const languagesHTML = `
|
|
||||||
<dl>
|
|
||||||
<dt>Languages</dt>
|
|
||||||
${languages
|
|
||||||
.map(
|
|
||||||
(translation) => `
|
|
||||||
<dd ${translation.slug == config.projects.current.slug ? 'class="rtd-current-item"' : ""}>
|
|
||||||
<a href="${translation.urls.documentation}">${translation.language.code}</a>
|
|
||||||
</dd>
|
|
||||||
`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
</dl>
|
|
||||||
`;
|
|
||||||
return languagesHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderVersions(config) {
|
|
||||||
if (!config.versions.active.length) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
const versionsHTML = `
|
|
||||||
<dl>
|
|
||||||
<dt>Versions</dt>
|
|
||||||
${config.versions.active
|
|
||||||
.map(
|
|
||||||
(version) => `
|
|
||||||
<dd ${version.slug === config.versions.current.slug ? 'class="rtd-current-item"' : ""}>
|
|
||||||
<a href="${version.urls.documentation}">${version.slug}</a>
|
|
||||||
</dd>
|
|
||||||
`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
</dl>
|
|
||||||
`;
|
|
||||||
return versionsHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderDownloads(config) {
|
|
||||||
if (!Object.keys(config.versions.current.downloads).length) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
const downloadsNameDisplay = {
|
|
||||||
pdf: "PDF",
|
|
||||||
epub: "Epub",
|
|
||||||
htmlzip: "HTML",
|
|
||||||
};
|
|
||||||
|
|
||||||
const downloadsHTML = `
|
|
||||||
<dl>
|
|
||||||
<dt>Downloads</dt>
|
|
||||||
${Object.entries(config.versions.current.downloads)
|
|
||||||
.map(
|
|
||||||
([name, url]) => `
|
|
||||||
<dd>
|
|
||||||
<a href="${url}">${downloadsNameDisplay[name]}</a>
|
|
||||||
</dd>
|
|
||||||
`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
</dl>
|
|
||||||
`;
|
|
||||||
return downloadsHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("readthedocs-addons-data-ready", function (event) {
|
|
||||||
const config = event.detail.data();
|
|
||||||
|
|
||||||
const flyout = `
|
|
||||||
<div class="rst-versions" data-toggle="rst-versions" role="note">
|
|
||||||
<span class="rst-current-version" data-toggle="rst-current-version">
|
|
||||||
<span class="fa fa-book"> Read the Docs</span>
|
|
||||||
v: ${config.versions.current.slug}
|
|
||||||
<span class="fa fa-caret-down"></span>
|
|
||||||
</span>
|
|
||||||
<div class="rst-other-versions">
|
|
||||||
<div class="injected">
|
|
||||||
${renderLanguages(config)}
|
|
||||||
${renderVersions(config)}
|
|
||||||
${renderDownloads(config)}
|
|
||||||
<dl>
|
|
||||||
<dt>On Read the Docs</dt>
|
|
||||||
<dd>
|
|
||||||
<a href="${config.projects.current.urls.home}">Project Home</a>
|
|
||||||
</dd>
|
|
||||||
<dd>
|
|
||||||
<a href="${config.projects.current.urls.builds}">Builds</a>
|
|
||||||
</dd>
|
|
||||||
<dd>
|
|
||||||
<a href="${config.projects.current.urls.downloads}">Downloads</a>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt>Search</dt>
|
|
||||||
<dd>
|
|
||||||
<form id="flyout-search-form">
|
|
||||||
<input
|
|
||||||
class="wy-form"
|
|
||||||
type="text"
|
|
||||||
name="q"
|
|
||||||
aria-label="Search docs"
|
|
||||||
placeholder="Search docs"
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<hr />
|
|
||||||
<small>
|
|
||||||
<span>Hosted by <a href="https://about.readthedocs.org/?utm_source=&utm_content=flyout">Read the Docs</a></span>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Inject the generated flyout into the body HTML element.
|
|
||||||
document.body.insertAdjacentHTML("beforeend", flyout);
|
|
||||||
|
|
||||||
// Trigger the Read the Docs Addons Search modal when clicking on the "Search docs" input from inside the flyout.
|
|
||||||
document
|
|
||||||
.querySelector("#flyout-search-form")
|
|
||||||
.addEventListener("focusin", () => {
|
|
||||||
const event = new CustomEvent("readthedocs-search-show");
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (themeLanguageSelector || themeVersionSelector) {
|
|
||||||
function onSelectorSwitch(event) {
|
|
||||||
const option = event.target.selectedIndex;
|
|
||||||
const item = event.target.options[option];
|
|
||||||
window.location.href = item.dataset.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("readthedocs-addons-data-ready", function (event) {
|
|
||||||
const config = event.detail.data();
|
|
||||||
|
|
||||||
const versionSwitch = document.querySelector(
|
|
||||||
"div.switch-menus > div.version-switch",
|
|
||||||
);
|
|
||||||
if (themeVersionSelector) {
|
|
||||||
let versions = config.versions.active;
|
|
||||||
if (config.versions.current.hidden || config.versions.current.type === "external") {
|
|
||||||
versions.unshift(config.versions.current);
|
|
||||||
}
|
|
||||||
const versionSelect = `
|
|
||||||
<select>
|
|
||||||
${versions
|
|
||||||
.map(
|
|
||||||
(version) => `
|
|
||||||
<option
|
|
||||||
value="${version.slug}"
|
|
||||||
${config.versions.current.slug === version.slug ? 'selected="selected"' : ""}
|
|
||||||
data-url="${version.urls.documentation}">
|
|
||||||
${version.slug}
|
|
||||||
</option>`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
</select>
|
|
||||||
`;
|
|
||||||
|
|
||||||
versionSwitch.innerHTML = versionSelect;
|
|
||||||
versionSwitch.firstElementChild.addEventListener("change", onSelectorSwitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
const languageSwitch = document.querySelector(
|
|
||||||
"div.switch-menus > div.language-switch",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (themeLanguageSelector) {
|
|
||||||
if (config.projects.translations.length) {
|
|
||||||
// Add the current language to the options on the selector
|
|
||||||
let languages = config.projects.translations.concat(
|
|
||||||
config.projects.current,
|
|
||||||
);
|
|
||||||
languages = languages.sort((a, b) =>
|
|
||||||
a.language.name.localeCompare(b.language.name),
|
|
||||||
);
|
|
||||||
|
|
||||||
const languageSelect = `
|
|
||||||
<select>
|
|
||||||
${languages
|
|
||||||
.map(
|
|
||||||
(language) => `
|
|
||||||
<option
|
|
||||||
value="${language.language.code}"
|
|
||||||
${config.projects.current.slug === language.slug ? 'selected="selected"' : ""}
|
|
||||||
data-url="${language.urls.documentation}">
|
|
||||||
${language.language.name}
|
|
||||||
</option>`,
|
|
||||||
)
|
|
||||||
.join("\n")}
|
|
||||||
</select>
|
|
||||||
`;
|
|
||||||
|
|
||||||
languageSwitch.innerHTML = languageSelect;
|
|
||||||
languageSwitch.firstElementChild.addEventListener("change", onSelectorSwitch);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
languageSwitch.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("readthedocs-addons-data-ready", function (event) {
|
|
||||||
// Trigger the Read the Docs Addons Search modal when clicking on "Search docs" input from the topnav.
|
|
||||||
document
|
|
||||||
.querySelector("[role='search'] input")
|
|
||||||
.addEventListener("focusin", () => {
|
|
||||||
const event = new CustomEvent("readthedocs-search-show");
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
});
|
|
||||||
});
|
|
9
docs/_static/language_data.js
vendored
9
docs/_static/language_data.js
vendored
|
@ -1,12 +1,19 @@
|
||||||
/*
|
/*
|
||||||
|
* language_data.js
|
||||||
|
* ~~~~~~~~~~~~~~~~
|
||||||
|
*
|
||||||
* This script contains the language-specific data used by searchtools.js,
|
* This script contains the language-specific data used by searchtools.js,
|
||||||
* namely the list of stopwords, stemmer, scorer and splitter.
|
* namely the list of stopwords, stemmer, scorer and splitter.
|
||||||
|
*
|
||||||
|
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||||
|
* :license: BSD, see LICENSE for details.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
|
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
|
||||||
|
|
||||||
|
|
||||||
/* Non-minified version is copied as a separate JS file, if available */
|
/* Non-minified version is copied as a separate JS file, is available */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Porter Stemmer
|
* Porter Stemmer
|
||||||
|
|
67
docs/_static/pygments.css
vendored
67
docs/_static/pygments.css
vendored
|
@ -6,26 +6,25 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
|
||||||
.highlight .hll { background-color: #ffffcc }
|
.highlight .hll { background-color: #ffffcc }
|
||||||
.highlight { background: #eeffcc; }
|
.highlight { background: #eeffcc; }
|
||||||
.highlight .c { color: #408090; font-style: italic } /* Comment */
|
.highlight .c { color: #408090; font-style: italic } /* Comment */
|
||||||
.highlight .err { border: 1px solid #F00 } /* Error */
|
.highlight .err { border: 1px solid #FF0000 } /* Error */
|
||||||
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
|
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
|
||||||
.highlight .o { color: #666 } /* Operator */
|
.highlight .o { color: #666666 } /* Operator */
|
||||||
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
|
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
|
||||||
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
|
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
|
||||||
.highlight .cp { color: #007020 } /* Comment.Preproc */
|
.highlight .cp { color: #007020 } /* Comment.Preproc */
|
||||||
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
|
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
|
||||||
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
|
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
|
||||||
.highlight .cs { color: #408090; background-color: #FFF0F0 } /* Comment.Special */
|
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
|
||||||
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
||||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
.highlight .ge { font-style: italic } /* Generic.Emph */
|
||||||
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
|
.highlight .gr { color: #FF0000 } /* Generic.Error */
|
||||||
.highlight .gr { color: #F00 } /* Generic.Error */
|
|
||||||
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||||
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
||||||
.highlight .go { color: #333 } /* Generic.Output */
|
.highlight .go { color: #333333 } /* Generic.Output */
|
||||||
.highlight .gp { color: #C65D09; font-weight: bold } /* Generic.Prompt */
|
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
|
||||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
||||||
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||||
.highlight .gt { color: #04D } /* Generic.Traceback */
|
.highlight .gt { color: #0044DD } /* Generic.Traceback */
|
||||||
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
||||||
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
||||||
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
||||||
|
@ -33,43 +32,43 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
|
||||||
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
||||||
.highlight .kt { color: #902000 } /* Keyword.Type */
|
.highlight .kt { color: #902000 } /* Keyword.Type */
|
||||||
.highlight .m { color: #208050 } /* Literal.Number */
|
.highlight .m { color: #208050 } /* Literal.Number */
|
||||||
.highlight .s { color: #4070A0 } /* Literal.String */
|
.highlight .s { color: #4070a0 } /* Literal.String */
|
||||||
.highlight .na { color: #4070A0 } /* Name.Attribute */
|
.highlight .na { color: #4070a0 } /* Name.Attribute */
|
||||||
.highlight .nb { color: #007020 } /* Name.Builtin */
|
.highlight .nb { color: #007020 } /* Name.Builtin */
|
||||||
.highlight .nc { color: #0E84B5; font-weight: bold } /* Name.Class */
|
.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
|
||||||
.highlight .no { color: #60ADD5 } /* Name.Constant */
|
.highlight .no { color: #60add5 } /* Name.Constant */
|
||||||
.highlight .nd { color: #555; font-weight: bold } /* Name.Decorator */
|
.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
|
||||||
.highlight .ni { color: #D55537; font-weight: bold } /* Name.Entity */
|
.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
|
||||||
.highlight .ne { color: #007020 } /* Name.Exception */
|
.highlight .ne { color: #007020 } /* Name.Exception */
|
||||||
.highlight .nf { color: #06287E } /* Name.Function */
|
.highlight .nf { color: #06287e } /* Name.Function */
|
||||||
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
|
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
|
||||||
.highlight .nn { color: #0E84B5; font-weight: bold } /* Name.Namespace */
|
.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
|
||||||
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
||||||
.highlight .nv { color: #BB60D5 } /* Name.Variable */
|
.highlight .nv { color: #bb60d5 } /* Name.Variable */
|
||||||
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
||||||
.highlight .w { color: #BBB } /* Text.Whitespace */
|
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
||||||
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
||||||
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
||||||
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
||||||
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
||||||
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
|
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
|
||||||
.highlight .sa { color: #4070A0 } /* Literal.String.Affix */
|
.highlight .sa { color: #4070a0 } /* Literal.String.Affix */
|
||||||
.highlight .sb { color: #4070A0 } /* Literal.String.Backtick */
|
.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
|
||||||
.highlight .sc { color: #4070A0 } /* Literal.String.Char */
|
.highlight .sc { color: #4070a0 } /* Literal.String.Char */
|
||||||
.highlight .dl { color: #4070A0 } /* Literal.String.Delimiter */
|
.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
|
||||||
.highlight .sd { color: #4070A0; font-style: italic } /* Literal.String.Doc */
|
.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
|
||||||
.highlight .s2 { color: #4070A0 } /* Literal.String.Double */
|
.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
|
||||||
.highlight .se { color: #4070A0; font-weight: bold } /* Literal.String.Escape */
|
.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
|
||||||
.highlight .sh { color: #4070A0 } /* Literal.String.Heredoc */
|
.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
|
||||||
.highlight .si { color: #70A0D0; font-style: italic } /* Literal.String.Interpol */
|
.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
|
||||||
.highlight .sx { color: #C65D09 } /* Literal.String.Other */
|
.highlight .sx { color: #c65d09 } /* Literal.String.Other */
|
||||||
.highlight .sr { color: #235388 } /* Literal.String.Regex */
|
.highlight .sr { color: #235388 } /* Literal.String.Regex */
|
||||||
.highlight .s1 { color: #4070A0 } /* Literal.String.Single */
|
.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
|
||||||
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
|
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
|
||||||
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
||||||
.highlight .fm { color: #06287E } /* Name.Function.Magic */
|
.highlight .fm { color: #06287e } /* Name.Function.Magic */
|
||||||
.highlight .vc { color: #BB60D5 } /* Name.Variable.Class */
|
.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
|
||||||
.highlight .vg { color: #BB60D5 } /* Name.Variable.Global */
|
.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
|
||||||
.highlight .vi { color: #BB60D5 } /* Name.Variable.Instance */
|
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
|
||||||
.highlight .vm { color: #BB60D5 } /* Name.Variable.Magic */
|
.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
|
||||||
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
|
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
|
237
docs/_static/searchtools.js
vendored
237
docs/_static/searchtools.js
vendored
|
@ -1,5 +1,12 @@
|
||||||
/*
|
/*
|
||||||
|
* searchtools.js
|
||||||
|
* ~~~~~~~~~~~~~~~~
|
||||||
|
*
|
||||||
* Sphinx JavaScript utilities for the full-text search.
|
* Sphinx JavaScript utilities for the full-text search.
|
||||||
|
*
|
||||||
|
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||||
|
* :license: BSD, see LICENSE for details.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -13,7 +20,7 @@ if (typeof Scorer === "undefined") {
|
||||||
// and returns the new score.
|
// and returns the new score.
|
||||||
/*
|
/*
|
||||||
score: result => {
|
score: result => {
|
||||||
const [docname, title, anchor, descr, score, filename, kind] = result
|
const [docname, title, anchor, descr, score, filename] = result
|
||||||
return score
|
return score
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
|
@ -40,14 +47,6 @@ if (typeof Scorer === "undefined") {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global search result kind enum, used by themes to style search results.
|
|
||||||
class SearchResultKind {
|
|
||||||
static get index() { return "index"; }
|
|
||||||
static get object() { return "object"; }
|
|
||||||
static get text() { return "text"; }
|
|
||||||
static get title() { return "title"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
const _removeChildren = (element) => {
|
const _removeChildren = (element) => {
|
||||||
while (element && element.lastChild) element.removeChild(element.lastChild);
|
while (element && element.lastChild) element.removeChild(element.lastChild);
|
||||||
};
|
};
|
||||||
|
@ -58,20 +57,16 @@ const _removeChildren = (element) => {
|
||||||
const _escapeRegExp = (string) =>
|
const _escapeRegExp = (string) =>
|
||||||
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
||||||
|
|
||||||
const _displayItem = (item, searchTerms, highlightTerms) => {
|
const _displayItem = (item, searchTerms) => {
|
||||||
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
|
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
|
||||||
|
const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
|
||||||
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
|
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
|
||||||
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
|
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
|
||||||
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
|
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
|
||||||
const contentRoot = document.documentElement.dataset.content_root;
|
|
||||||
|
|
||||||
const [docName, title, anchor, descr, score, _filename, kind] = item;
|
const [docName, title, anchor, descr, score, _filename] = item;
|
||||||
|
|
||||||
let listItem = document.createElement("li");
|
let listItem = document.createElement("li");
|
||||||
// Add a class representing the item's type:
|
|
||||||
// can be used by a theme's CSS selector for styling
|
|
||||||
// See SearchResultKind for the class names.
|
|
||||||
listItem.classList.add(`kind-${kind}`);
|
|
||||||
let requestUrl;
|
let requestUrl;
|
||||||
let linkUrl;
|
let linkUrl;
|
||||||
if (docBuilder === "dirhtml") {
|
if (docBuilder === "dirhtml") {
|
||||||
|
@ -80,35 +75,28 @@ const _displayItem = (item, searchTerms, highlightTerms) => {
|
||||||
if (dirname.match(/\/index\/$/))
|
if (dirname.match(/\/index\/$/))
|
||||||
dirname = dirname.substring(0, dirname.length - 6);
|
dirname = dirname.substring(0, dirname.length - 6);
|
||||||
else if (dirname === "index/") dirname = "";
|
else if (dirname === "index/") dirname = "";
|
||||||
requestUrl = contentRoot + dirname;
|
requestUrl = docUrlRoot + dirname;
|
||||||
linkUrl = requestUrl;
|
linkUrl = requestUrl;
|
||||||
} else {
|
} else {
|
||||||
// normal html builders
|
// normal html builders
|
||||||
requestUrl = contentRoot + docName + docFileSuffix;
|
requestUrl = docUrlRoot + docName + docFileSuffix;
|
||||||
linkUrl = docName + docLinkSuffix;
|
linkUrl = docName + docLinkSuffix;
|
||||||
}
|
}
|
||||||
let linkEl = listItem.appendChild(document.createElement("a"));
|
let linkEl = listItem.appendChild(document.createElement("a"));
|
||||||
linkEl.href = linkUrl + anchor;
|
linkEl.href = linkUrl + anchor;
|
||||||
linkEl.dataset.score = score;
|
linkEl.dataset.score = score;
|
||||||
linkEl.innerHTML = title;
|
linkEl.innerHTML = title;
|
||||||
if (descr) {
|
if (descr)
|
||||||
listItem.appendChild(document.createElement("span")).innerHTML =
|
listItem.appendChild(document.createElement("span")).innerHTML =
|
||||||
" (" + descr + ")";
|
" (" + descr + ")";
|
||||||
// highlight search terms in the description
|
|
||||||
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
|
|
||||||
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
|
|
||||||
}
|
|
||||||
else if (showSearchSummary)
|
else if (showSearchSummary)
|
||||||
fetch(requestUrl)
|
fetch(requestUrl)
|
||||||
.then((responseData) => responseData.text())
|
.then((responseData) => responseData.text())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data)
|
if (data)
|
||||||
listItem.appendChild(
|
listItem.appendChild(
|
||||||
Search.makeSearchSummary(data, searchTerms, anchor)
|
Search.makeSearchSummary(data, searchTerms)
|
||||||
);
|
);
|
||||||
// highlight search terms in the summary
|
|
||||||
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
|
|
||||||
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
|
|
||||||
});
|
});
|
||||||
Search.output.appendChild(listItem);
|
Search.output.appendChild(listItem);
|
||||||
};
|
};
|
||||||
|
@ -120,46 +108,27 @@ const _finishSearch = (resultCount) => {
|
||||||
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
|
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
Search.status.innerText = Documentation.ngettext(
|
Search.status.innerText = _(
|
||||||
"Search finished, found one page matching the search query.",
|
`Search finished, found ${resultCount} page(s) matching the search query.`
|
||||||
"Search finished, found ${resultCount} pages matching the search query.",
|
);
|
||||||
resultCount,
|
|
||||||
).replace('${resultCount}', resultCount);
|
|
||||||
};
|
};
|
||||||
const _displayNextItem = (
|
const _displayNextItem = (
|
||||||
results,
|
results,
|
||||||
resultCount,
|
resultCount,
|
||||||
searchTerms,
|
searchTerms
|
||||||
highlightTerms,
|
|
||||||
) => {
|
) => {
|
||||||
// results left, load the summary and display it
|
// results left, load the summary and display it
|
||||||
// this is intended to be dynamic (don't sub resultsCount)
|
// this is intended to be dynamic (don't sub resultsCount)
|
||||||
if (results.length) {
|
if (results.length) {
|
||||||
_displayItem(results.pop(), searchTerms, highlightTerms);
|
_displayItem(results.pop(), searchTerms);
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
|
() => _displayNextItem(results, resultCount, searchTerms),
|
||||||
5
|
5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// search finished, update title and status message
|
// search finished, update title and status message
|
||||||
else _finishSearch(resultCount);
|
else _finishSearch(resultCount);
|
||||||
};
|
};
|
||||||
// Helper function used by query() to order search results.
|
|
||||||
// Each input is an array of [docname, title, anchor, descr, score, filename, kind].
|
|
||||||
// Order the results by score (in opposite order of appearance, since the
|
|
||||||
// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
|
|
||||||
const _orderResultsByScoreThenName = (a, b) => {
|
|
||||||
const leftScore = a[4];
|
|
||||||
const rightScore = b[4];
|
|
||||||
if (leftScore === rightScore) {
|
|
||||||
// same score: sort alphabetically
|
|
||||||
const leftTitle = a[1].toLowerCase();
|
|
||||||
const rightTitle = b[1].toLowerCase();
|
|
||||||
if (leftTitle === rightTitle) return 0;
|
|
||||||
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
|
|
||||||
}
|
|
||||||
return leftScore > rightScore ? 1 : -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
|
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
|
||||||
|
@ -183,26 +152,13 @@ const Search = {
|
||||||
_queued_query: null,
|
_queued_query: null,
|
||||||
_pulse_status: -1,
|
_pulse_status: -1,
|
||||||
|
|
||||||
htmlToText: (htmlString, anchor) => {
|
htmlToText: (htmlString) => {
|
||||||
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
|
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
|
||||||
for (const removalQuery of [".headerlink", "script", "style"]) {
|
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
|
||||||
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
|
|
||||||
}
|
|
||||||
if (anchor) {
|
|
||||||
const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
|
|
||||||
if (anchorContent) return anchorContent.textContent;
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
`Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if anchor not specified or not found, fall back to main content
|
|
||||||
const docContent = htmlElement.querySelector('[role="main"]');
|
const docContent = htmlElement.querySelector('[role="main"]');
|
||||||
if (docContent) return docContent.textContent;
|
if (docContent !== undefined) return docContent.textContent;
|
||||||
|
|
||||||
console.warn(
|
console.warn(
|
||||||
"Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
|
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
|
||||||
);
|
);
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
@ -255,7 +211,6 @@ const Search = {
|
||||||
searchSummary.classList.add("search-summary");
|
searchSummary.classList.add("search-summary");
|
||||||
searchSummary.innerText = "";
|
searchSummary.innerText = "";
|
||||||
const searchList = document.createElement("ul");
|
const searchList = document.createElement("ul");
|
||||||
searchList.setAttribute("role", "list");
|
|
||||||
searchList.classList.add("search");
|
searchList.classList.add("search");
|
||||||
|
|
||||||
const out = document.getElementById("search-results");
|
const out = document.getElementById("search-results");
|
||||||
|
@ -276,7 +231,16 @@ const Search = {
|
||||||
else Search.deferQuery(query);
|
else Search.deferQuery(query);
|
||||||
},
|
},
|
||||||
|
|
||||||
_parseQuery: (query) => {
|
/**
|
||||||
|
* execute search (requires search index to be loaded)
|
||||||
|
*/
|
||||||
|
query: (query) => {
|
||||||
|
const filenames = Search._index.filenames;
|
||||||
|
const docNames = Search._index.docnames;
|
||||||
|
const titles = Search._index.titles;
|
||||||
|
const allTitles = Search._index.alltitles;
|
||||||
|
const indexEntries = Search._index.indexentries;
|
||||||
|
|
||||||
// stem the search terms and add them to the correct list
|
// stem the search terms and add them to the correct list
|
||||||
const stemmer = new Stemmer();
|
const stemmer = new Stemmer();
|
||||||
const searchTerms = new Set();
|
const searchTerms = new Set();
|
||||||
|
@ -312,40 +276,22 @@ const Search = {
|
||||||
// console.info("required: ", [...searchTerms]);
|
// console.info("required: ", [...searchTerms]);
|
||||||
// console.info("excluded: ", [...excludedTerms]);
|
// console.info("excluded: ", [...excludedTerms]);
|
||||||
|
|
||||||
return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
|
// array of [docname, title, anchor, descr, score, filename]
|
||||||
},
|
let results = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* execute search (requires search index to be loaded)
|
|
||||||
*/
|
|
||||||
_performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
|
|
||||||
const filenames = Search._index.filenames;
|
|
||||||
const docNames = Search._index.docnames;
|
|
||||||
const titles = Search._index.titles;
|
|
||||||
const allTitles = Search._index.alltitles;
|
|
||||||
const indexEntries = Search._index.indexentries;
|
|
||||||
|
|
||||||
// Collect multiple result groups to be sorted separately and then ordered.
|
|
||||||
// Each is an array of [docname, title, anchor, descr, score, filename, kind].
|
|
||||||
const normalResults = [];
|
|
||||||
const nonMainIndexResults = [];
|
|
||||||
|
|
||||||
_removeChildren(document.getElementById("search-progress"));
|
_removeChildren(document.getElementById("search-progress"));
|
||||||
|
|
||||||
const queryLower = query.toLowerCase().trim();
|
const queryLower = query.toLowerCase();
|
||||||
for (const [title, foundTitles] of Object.entries(allTitles)) {
|
for (const [title, foundTitles] of Object.entries(allTitles)) {
|
||||||
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
|
if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
|
||||||
for (const [file, id] of foundTitles) {
|
for (const [file, id] of foundTitles) {
|
||||||
const score = Math.round(Scorer.title * queryLower.length / title.length);
|
let score = Math.round(100 * queryLower.length / title.length)
|
||||||
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
|
results.push([
|
||||||
normalResults.push([
|
|
||||||
docNames[file],
|
docNames[file],
|
||||||
titles[file] !== title ? `${titles[file]} > ${title}` : title,
|
titles[file] !== title ? `${titles[file]} > ${title}` : title,
|
||||||
id !== null ? "#" + id : "",
|
id !== null ? "#" + id : "",
|
||||||
null,
|
null,
|
||||||
score + boost,
|
score,
|
||||||
filenames[file],
|
filenames[file],
|
||||||
SearchResultKind.title,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,48 +300,46 @@ const Search = {
|
||||||
// search for explicit entries in index directives
|
// search for explicit entries in index directives
|
||||||
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
|
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
|
||||||
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
|
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
|
||||||
for (const [file, id, isMain] of foundEntries) {
|
for (const [file, id] of foundEntries) {
|
||||||
const score = Math.round(100 * queryLower.length / entry.length);
|
let score = Math.round(100 * queryLower.length / entry.length)
|
||||||
const result = [
|
results.push([
|
||||||
docNames[file],
|
docNames[file],
|
||||||
titles[file],
|
titles[file],
|
||||||
id ? "#" + id : "",
|
id ? "#" + id : "",
|
||||||
null,
|
null,
|
||||||
score,
|
score,
|
||||||
filenames[file],
|
filenames[file],
|
||||||
SearchResultKind.index,
|
]);
|
||||||
];
|
|
||||||
if (isMain) {
|
|
||||||
normalResults.push(result);
|
|
||||||
} else {
|
|
||||||
nonMainIndexResults.push(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup as object
|
// lookup as object
|
||||||
objectTerms.forEach((term) =>
|
objectTerms.forEach((term) =>
|
||||||
normalResults.push(...Search.performObjectSearch(term, objectTerms))
|
results.push(...Search.performObjectSearch(term, objectTerms))
|
||||||
);
|
);
|
||||||
|
|
||||||
// lookup as search terms in fulltext
|
// lookup as search terms in fulltext
|
||||||
normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
|
results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
|
||||||
|
|
||||||
// let the scorer override scores with a custom scoring function
|
// let the scorer override scores with a custom scoring function
|
||||||
if (Scorer.score) {
|
if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
|
||||||
normalResults.forEach((item) => (item[4] = Scorer.score(item)));
|
|
||||||
nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort each group of results by score and then alphabetically by name.
|
// now sort the results by score (in opposite order of appearance, since the
|
||||||
normalResults.sort(_orderResultsByScoreThenName);
|
// display function below uses pop() to retrieve items) and then
|
||||||
nonMainIndexResults.sort(_orderResultsByScoreThenName);
|
// alphabetically
|
||||||
|
results.sort((a, b) => {
|
||||||
// Combine the result groups in (reverse) order.
|
const leftScore = a[4];
|
||||||
// Non-main index entries are typically arbitrary cross-references,
|
const rightScore = b[4];
|
||||||
// so display them after other results.
|
if (leftScore === rightScore) {
|
||||||
let results = [...nonMainIndexResults, ...normalResults];
|
// same score: sort alphabetically
|
||||||
|
const leftTitle = a[1].toLowerCase();
|
||||||
|
const rightTitle = b[1].toLowerCase();
|
||||||
|
if (leftTitle === rightTitle) return 0;
|
||||||
|
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
|
||||||
|
}
|
||||||
|
return leftScore > rightScore ? 1 : -1;
|
||||||
|
});
|
||||||
|
|
||||||
// remove duplicate search results
|
// remove duplicate search results
|
||||||
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
|
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
|
||||||
|
@ -409,19 +353,14 @@ const Search = {
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return results.reverse();
|
results = results.reverse();
|
||||||
},
|
|
||||||
|
|
||||||
query: (query) => {
|
|
||||||
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
|
|
||||||
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
|
|
||||||
|
|
||||||
// for debugging
|
// for debugging
|
||||||
//Search.lastresults = results.slice(); // a copy
|
//Search.lastresults = results.slice(); // a copy
|
||||||
// console.info("search results:", Search.lastresults);
|
// console.info("search results:", Search.lastresults);
|
||||||
|
|
||||||
// print the results
|
// print the results
|
||||||
_displayNextItem(results, results.length, searchTerms, highlightTerms);
|
_displayNextItem(results, results.length, searchTerms);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -485,7 +424,6 @@ const Search = {
|
||||||
descr,
|
descr,
|
||||||
score,
|
score,
|
||||||
filenames[match[0]],
|
filenames[match[0]],
|
||||||
SearchResultKind.object,
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
Object.keys(objects).forEach((prefix) =>
|
Object.keys(objects).forEach((prefix) =>
|
||||||
|
@ -513,27 +451,21 @@ const Search = {
|
||||||
// perform the search on the required terms
|
// perform the search on the required terms
|
||||||
searchTerms.forEach((word) => {
|
searchTerms.forEach((word) => {
|
||||||
const files = [];
|
const files = [];
|
||||||
// find documents, if any, containing the query word in their text/title term indices
|
|
||||||
// use Object.hasOwnProperty to avoid mismatching against prototype properties
|
|
||||||
const arr = [
|
const arr = [
|
||||||
{ files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term },
|
{ files: terms[word], score: Scorer.term },
|
||||||
{ files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title },
|
{ files: titleTerms[word], score: Scorer.title },
|
||||||
];
|
];
|
||||||
// add support for partial matches
|
// add support for partial matches
|
||||||
if (word.length > 2) {
|
if (word.length > 2) {
|
||||||
const escapedWord = _escapeRegExp(word);
|
const escapedWord = _escapeRegExp(word);
|
||||||
if (!terms.hasOwnProperty(word)) {
|
Object.keys(terms).forEach((term) => {
|
||||||
Object.keys(terms).forEach((term) => {
|
if (term.match(escapedWord) && !terms[word])
|
||||||
if (term.match(escapedWord))
|
arr.push({ files: terms[term], score: Scorer.partialTerm });
|
||||||
arr.push({ files: terms[term], score: Scorer.partialTerm });
|
});
|
||||||
});
|
Object.keys(titleTerms).forEach((term) => {
|
||||||
}
|
if (term.match(escapedWord) && !titleTerms[word])
|
||||||
if (!titleTerms.hasOwnProperty(word)) {
|
arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
|
||||||
Object.keys(titleTerms).forEach((term) => {
|
});
|
||||||
if (term.match(escapedWord))
|
|
||||||
arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no match but word was a required one
|
// no match but word was a required one
|
||||||
|
@ -549,16 +481,16 @@ const Search = {
|
||||||
|
|
||||||
// set score for the word in each file
|
// set score for the word in each file
|
||||||
recordFiles.forEach((file) => {
|
recordFiles.forEach((file) => {
|
||||||
if (!scoreMap.has(file)) scoreMap.set(file, new Map());
|
if (!scoreMap.has(file)) scoreMap.set(file, {});
|
||||||
const fileScores = scoreMap.get(file);
|
scoreMap.get(file)[word] = record.score;
|
||||||
fileScores.set(word, record.score);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// create the mapping
|
// create the mapping
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
if (!fileMap.has(file)) fileMap.set(file, [word]);
|
if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
|
||||||
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
|
fileMap.get(file).push(word);
|
||||||
|
else fileMap.set(file, [word]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -590,7 +522,7 @@ const Search = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// select one (max) score for the file.
|
// select one (max) score for the file.
|
||||||
const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w)));
|
const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w]));
|
||||||
// add result to the result list
|
// add result to the result list
|
||||||
results.push([
|
results.push([
|
||||||
docNames[file],
|
docNames[file],
|
||||||
|
@ -599,7 +531,6 @@ const Search = {
|
||||||
null,
|
null,
|
||||||
score,
|
score,
|
||||||
filenames[file],
|
filenames[file],
|
||||||
SearchResultKind.text,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
@ -610,8 +541,8 @@ const Search = {
|
||||||
* search summary for a given text. keywords is a list
|
* search summary for a given text. keywords is a list
|
||||||
* of stemmed words.
|
* of stemmed words.
|
||||||
*/
|
*/
|
||||||
makeSearchSummary: (htmlText, keywords, anchor) => {
|
makeSearchSummary: (htmlText, keywords) => {
|
||||||
const text = Search.htmlToText(htmlText, anchor);
|
const text = Search.htmlToText(htmlText);
|
||||||
if (text === "") return null;
|
if (text === "") return null;
|
||||||
|
|
||||||
const textLower = text.toLowerCase();
|
const textLower = text.toLowerCase();
|
||||||
|
|
16
docs/_static/sphinx_highlight.js
vendored
16
docs/_static/sphinx_highlight.js
vendored
|
@ -29,19 +29,14 @@ const _highlight = (node, addItems, text, className) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
||||||
const rest = document.createTextNode(val.substr(pos + text.length));
|
|
||||||
parent.insertBefore(
|
parent.insertBefore(
|
||||||
span,
|
span,
|
||||||
parent.insertBefore(
|
parent.insertBefore(
|
||||||
rest,
|
document.createTextNode(val.substr(pos + text.length)),
|
||||||
node.nextSibling
|
node.nextSibling
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
node.nodeValue = val.substr(0, pos);
|
node.nodeValue = val.substr(0, pos);
|
||||||
/* There may be more occurrences of search term in this node. So call this
|
|
||||||
* function recursively on the remaining fragment.
|
|
||||||
*/
|
|
||||||
_highlight(rest, addItems, text, className);
|
|
||||||
|
|
||||||
if (isInSVG) {
|
if (isInSVG) {
|
||||||
const rect = document.createElementNS(
|
const rect = document.createElementNS(
|
||||||
|
@ -145,10 +140,5 @@ const SphinxHighlight = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_ready(() => {
|
_ready(SphinxHighlight.highlightSearchWords);
|
||||||
/* Do not call highlightSearchWords() when we are on the search page.
|
_ready(SphinxHighlight.initEscapeListener);
|
||||||
* It will highlight words from the *previous* search query.
|
|
||||||
*/
|
|
||||||
if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords();
|
|
||||||
SphinxHighlight.initEscapeListener();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Dynamic Bindings — Raylib Python documentation</title>
|
<title>Dynamic Bindings — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
<script src="_static/doctools.js"></script>
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<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" />
|
||||||
|
@ -45,16 +45,14 @@
|
||||||
</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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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>
|
||||||
|
@ -90,7 +88,7 @@
|
||||||
<div itemprop="articleBody">
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
<section id="dynamic-bindings">
|
<section id="dynamic-bindings">
|
||||||
<h1>Dynamic Bindings<a class="headerlink" href="#dynamic-bindings" title="Link to this heading"></a></h1>
|
<h1>Dynamic Bindings<a class="headerlink" href="#dynamic-bindings" title="Permalink to this heading"></a></h1>
|
||||||
<p>CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module:</p>
|
<p>CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module:</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="n">raylib_dynamic</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="n">raylib_dynamic</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
@ -104,11 +102,11 @@ Therefore I personally recommend the static ones.
|
||||||
But the dynamic bindings have the advantage that you don’t need to compile anything to install. You just need a Raylib DLL.</p>
|
But the dynamic bindings have the advantage that you don’t need to compile anything to install. You just need a Raylib DLL.</p>
|
||||||
</div>
|
</div>
|
||||||
<p>The API is exactly the same as the static one documented here. (Therefore you can’t have both modules installed at once.) The only difference is you can’t do:</p>
|
<p>The API is exactly the same as the static one documented here. (Therefore you can’t have both modules installed at once.) The only difference is you can’t do:</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">raylib</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">raylib</span> <span class="kn">import</span> <span class="o">*</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Instead you have to do:</p>
|
<p>Instead you have to do:</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">raylib</span><span class="w"> </span><span class="kn">import</span> <span class="n">rl</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">raylib</span> <span class="kn">import</span> <span class="n">rl</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix.</p>
|
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix.</p>
|
||||||
|
|
3452
docs/genindex.html
3452
docs/genindex.html
File diff suppressed because it is too large
Load diff
|
@ -1,26 +1,26 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Raylib Python — Raylib Python documentation</title>
|
<title>Raylib Python — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
<script src="_static/doctools.js"></script>
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<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.5" href="README.html" />
|
<link rel="next" title="Python Bindings for Raylib 4.5" href="README.html" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
<body class="wy-body-for-nav">
|
||||||
|
@ -44,16 +44,14 @@
|
||||||
</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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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>
|
||||||
|
@ -89,20 +87,18 @@
|
||||||
<div itemprop="articleBody">
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
<section id="raylib-python">
|
<section id="raylib-python">
|
||||||
<h1>Raylib Python<a class="headerlink" href="#raylib-python" title="Link to this heading"></a></h1>
|
<h1>Raylib Python<a class="headerlink" href="#raylib-python" title="Permalink to this heading"></a></h1>
|
||||||
<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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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>
|
||||||
|
@ -122,7 +118,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.5" 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 4.5" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
BIN
docs/objects.inv
BIN
docs/objects.inv
Binary file not shown.
|
@ -1,21 +1,21 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Python Module Index — Raylib Python documentation</title>
|
<title>Python Module Index — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
<script src="_static/doctools.js"></script>
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<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" />
|
||||||
|
@ -49,16 +49,14 @@
|
||||||
</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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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>
|
||||||
|
|
9791
docs/pyray.html
9791
docs/pyray.html
File diff suppressed because one or more lines are too long
9565
docs/raylib.html
9565
docs/raylib.html
File diff suppressed because one or more lines are too long
|
@ -1,22 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
<html class="writer-html5" lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Search — Raylib Python documentation</title>
|
<title>Search — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
<!--[if lt IE 9]>
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
<script src="_static/js/html5shiv.min.js"></script>
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
<![endif]-->
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
<script src="_static/jquery.js"></script>
|
||||||
|
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||||
|
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||||
|
<script src="_static/doctools.js"></script>
|
||||||
|
<script src="_static/sphinx_highlight.js"></script>
|
||||||
<script src="_static/js/theme.js"></script>
|
<script src="_static/js/theme.js"></script>
|
||||||
<script src="_static/searchtools.js"></script>
|
<script src="_static/searchtools.js"></script>
|
||||||
<script src="_static/language_data.js"></script>
|
<script src="_static/language_data.js"></script>
|
||||||
|
@ -45,16 +45,14 @@
|
||||||
</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.5</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 4.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#backends">Backends</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>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</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#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">License</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#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
|
@ -8,6 +8,4 @@ include raylib/*.so
|
||||||
include version.py
|
include version.py
|
||||||
exclude raylib/*.a
|
exclude raylib/*.a
|
||||||
exclude raylib/*.c
|
exclude raylib/*.c
|
||||||
exclude raylib/*.o
|
exclude raylib/*.o
|
||||||
include raylib/py.typed
|
|
||||||
include pyray/py.typed
|
|
|
@ -22,10 +22,9 @@ import itertools
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import platform
|
import platform
|
||||||
import logging
|
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
MODULE = pathlib.Path(__file__).parent
|
MODULE = pathlib.Path(__file__).parent
|
||||||
|
|
||||||
def raylib_library_path():
|
def raylib_library_path():
|
||||||
|
@ -55,9 +54,9 @@ ffi.cdef(open(MODULE / "raylib_modified.h").read().replace('RLAPI ', ''))
|
||||||
try:
|
try:
|
||||||
raylib_fname = raylib_library_path()
|
raylib_fname = raylib_library_path()
|
||||||
rl = ffi.dlopen(raylib_fname)
|
rl = ffi.dlopen(raylib_fname)
|
||||||
logger.warning('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname))
|
print('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(e)
|
print(e)
|
||||||
|
|
||||||
LIGHTGRAY =( 200, 200, 200, 255 )
|
LIGHTGRAY =( 200, 200, 200, 255 )
|
||||||
GRAY =( 130, 130, 130, 255 )
|
GRAY =( 130, 130, 130, 255 )
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,508 +1,9 @@
|
||||||
import raylib
|
import raylib
|
||||||
|
|
||||||
RAYLIB_VERSION_MAJOR: int = 5
|
MOUSE_LEFT_BUTTON = raylib.MOUSE_BUTTON_LEFT
|
||||||
RAYLIB_VERSION_MINOR: int = 5
|
MOUSE_RIGHT_BUTTON = raylib.MOUSE_BUTTON_RIGHT
|
||||||
RAYLIB_VERSION_PATCH: int = 0
|
|
||||||
RAYLIB_VERSION: str = "5.5"
|
|
||||||
PI: float = 3.141592653589793
|
|
||||||
DEG2RAD = PI / 180.0
|
|
||||||
RAD2DEG = 180.0 / PI
|
|
||||||
MOUSE_LEFT_BUTTON = raylib.MOUSE_BUTTON_LEFT
|
|
||||||
MOUSE_RIGHT_BUTTON = raylib.MOUSE_BUTTON_RIGHT
|
|
||||||
MOUSE_MIDDLE_BUTTON = raylib.MOUSE_BUTTON_MIDDLE
|
MOUSE_MIDDLE_BUTTON = raylib.MOUSE_BUTTON_MIDDLE
|
||||||
MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
|
MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
|
||||||
MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
|
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
|
|
||||||
RLGL_VERSION: str = "5.0"
|
|
||||||
RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192
|
|
||||||
RL_DEFAULT_BATCH_BUFFERS: int = 1
|
|
||||||
RL_DEFAULT_BATCH_DRAWCALLS: int = 256
|
|
||||||
RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS: int = 4
|
|
||||||
RL_MAX_MATRIX_STACK_SIZE: int = 32
|
|
||||||
RL_MAX_SHADER_LOCATIONS: int = 32
|
|
||||||
RL_TEXTURE_WRAP_S: int = 10242
|
|
||||||
RL_TEXTURE_WRAP_T: int = 10243
|
|
||||||
RL_TEXTURE_MAG_FILTER: int = 10240
|
|
||||||
RL_TEXTURE_MIN_FILTER: int = 10241
|
|
||||||
RL_TEXTURE_FILTER_NEAREST: int = 9728
|
|
||||||
RL_TEXTURE_FILTER_LINEAR: int = 9729
|
|
||||||
RL_TEXTURE_FILTER_MIP_NEAREST: int = 9984
|
|
||||||
RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR: int = 9986
|
|
||||||
RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST: int = 9985
|
|
||||||
RL_TEXTURE_FILTER_MIP_LINEAR: int = 9987
|
|
||||||
RL_TEXTURE_FILTER_ANISOTROPIC: int = 12288
|
|
||||||
RL_TEXTURE_MIPMAP_BIAS_RATIO: int = 16384
|
|
||||||
RL_TEXTURE_WRAP_REPEAT: int = 10497
|
|
||||||
RL_TEXTURE_WRAP_CLAMP: int = 33071
|
|
||||||
RL_TEXTURE_WRAP_MIRROR_REPEAT: int = 33648
|
|
||||||
RL_TEXTURE_WRAP_MIRROR_CLAMP: int = 34626
|
|
||||||
RL_MODELVIEW: int = 5888
|
|
||||||
RL_PROJECTION: int = 5889
|
|
||||||
RL_TEXTURE: int = 5890
|
|
||||||
RL_LINES: int = 1
|
|
||||||
RL_TRIANGLES: int = 4
|
|
||||||
RL_QUADS: int = 7
|
|
||||||
RL_UNSIGNED_BYTE: int = 5121
|
|
||||||
RL_FLOAT: int = 5126
|
|
||||||
RL_STREAM_DRAW: int = 35040
|
|
||||||
RL_STREAM_READ: int = 35041
|
|
||||||
RL_STREAM_COPY: int = 35042
|
|
||||||
RL_STATIC_DRAW: int = 35044
|
|
||||||
RL_STATIC_READ: int = 35045
|
|
||||||
RL_STATIC_COPY: int = 35046
|
|
||||||
RL_DYNAMIC_DRAW: int = 35048
|
|
||||||
RL_DYNAMIC_READ: int = 35049
|
|
||||||
RL_DYNAMIC_COPY: int = 35050
|
|
||||||
RL_FRAGMENT_SHADER: int = 35632
|
|
||||||
RL_VERTEX_SHADER: int = 35633
|
|
||||||
RL_COMPUTE_SHADER: int = 37305
|
|
||||||
RL_ZERO: int = 0
|
|
||||||
RL_ONE: int = 1
|
|
||||||
RL_SRC_COLOR: int = 768
|
|
||||||
RL_ONE_MINUS_SRC_COLOR: int = 769
|
|
||||||
RL_SRC_ALPHA: int = 770
|
|
||||||
RL_ONE_MINUS_SRC_ALPHA: int = 771
|
|
||||||
RL_DST_ALPHA: int = 772
|
|
||||||
RL_ONE_MINUS_DST_ALPHA: int = 773
|
|
||||||
RL_DST_COLOR: int = 774
|
|
||||||
RL_ONE_MINUS_DST_COLOR: int = 775
|
|
||||||
RL_SRC_ALPHA_SATURATE: int = 776
|
|
||||||
RL_CONSTANT_COLOR: int = 32769
|
|
||||||
RL_ONE_MINUS_CONSTANT_COLOR: int = 32770
|
|
||||||
RL_CONSTANT_ALPHA: int = 32771
|
|
||||||
RL_ONE_MINUS_CONSTANT_ALPHA: int = 32772
|
|
||||||
RL_FUNC_ADD: int = 32774
|
|
||||||
RL_MIN: int = 32775
|
|
||||||
RL_MAX: int = 32776
|
|
||||||
RL_FUNC_SUBTRACT: int = 32778
|
|
||||||
RL_FUNC_REVERSE_SUBTRACT: int = 32779
|
|
||||||
RL_BLEND_EQUATION: int = 32777
|
|
||||||
RL_BLEND_EQUATION_RGB: int = 32777
|
|
||||||
RL_BLEND_EQUATION_ALPHA: int = 34877
|
|
||||||
RL_BLEND_DST_RGB: int = 32968
|
|
||||||
RL_BLEND_SRC_RGB: int = 32969
|
|
||||||
RL_BLEND_DST_ALPHA: int = 32970
|
|
||||||
RL_BLEND_SRC_ALPHA: int = 32971
|
|
||||||
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_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS
|
|
||||||
GL_SHADING_LANGUAGE_VERSION: int = 35724
|
|
||||||
GL_COMPRESSED_RGB_S3TC_DXT1_EXT: int = 33776
|
|
||||||
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: int = 33777
|
|
||||||
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: int = 33778
|
|
||||||
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: int = 33779
|
|
||||||
GL_ETC1_RGB8_OES: int = 36196
|
|
||||||
GL_COMPRESSED_RGB8_ETC2: int = 37492
|
|
||||||
GL_COMPRESSED_RGBA8_ETC2_EAC: int = 37496
|
|
||||||
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: int = 35840
|
|
||||||
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: int = 35842
|
|
||||||
GL_COMPRESSED_RGBA_ASTC_4x4_KHR: int = 37808
|
|
||||||
GL_COMPRESSED_RGBA_ASTC_8x8_KHR: int = 37815
|
|
||||||
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: int = 34047
|
|
||||||
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_5_5_1: int = 32820
|
|
||||||
GL_UNSIGNED_SHORT_4_4_4_4: int = 32819
|
|
||||||
GL_LUMINANCE: int = 6409
|
|
||||||
GL_LUMINANCE_ALPHA: int = 6410
|
|
||||||
RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION: str = "vertexPosition"
|
|
||||||
RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD: str = "vertexTexCoord"
|
|
||||||
RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL: str = "vertexNormal"
|
|
||||||
RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR: str = "vertexColor"
|
|
||||||
RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT: str = "vertexTangent"
|
|
||||||
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_VIEW: str = "matView"
|
|
||||||
RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION: str = "matProjection"
|
|
||||||
RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL: str = "matModel"
|
|
||||||
RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL: str = "matNormal"
|
|
||||||
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_TEXTURE1: str = "texture1"
|
|
||||||
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2: str = "texture2"
|
|
||||||
RAYGUI_VERSION_MAJOR: int = 4
|
|
||||||
RAYGUI_VERSION_MINOR: int = 5
|
|
||||||
RAYGUI_VERSION_PATCH: int = 0
|
|
||||||
RAYGUI_VERSION: str = "4.5-dev"
|
|
||||||
SCROLLBAR_LEFT_SIDE: int = 0
|
|
||||||
SCROLLBAR_RIGHT_SIDE: int = 1
|
|
||||||
RAYGUI_ICON_SIZE: int = 16
|
|
||||||
RAYGUI_ICON_MAX_ICONS: int = 256
|
|
||||||
RAYGUI_ICON_MAX_NAME_LENGTH: int = 32
|
|
||||||
RAYGUI_MAX_CONTROLS: int = 16
|
|
||||||
RAYGUI_MAX_PROPS_BASE: int = 16
|
|
||||||
RAYGUI_MAX_PROPS_EXTENDED: int = 8
|
|
||||||
KEY_RIGHT: int = 262
|
|
||||||
KEY_LEFT: int = 263
|
|
||||||
KEY_DOWN: int = 264
|
|
||||||
KEY_UP: int = 265
|
|
||||||
KEY_BACKSPACE: int = 259
|
|
||||||
KEY_ENTER: int = 257
|
|
||||||
MOUSE_LEFT_BUTTON: int = 0
|
|
||||||
RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT: int = 24
|
|
||||||
RAYGUI_GROUPBOX_LINE_THICK: int = 1
|
|
||||||
RAYGUI_LINE_MARGIN_TEXT: int = 12
|
|
||||||
RAYGUI_LINE_TEXT_PADDING: int = 4
|
|
||||||
RAYGUI_PANEL_BORDER_WIDTH: int = 1
|
|
||||||
RAYGUI_TABBAR_ITEM_WIDTH: int = 160
|
|
||||||
RAYGUI_MIN_SCROLLBAR_WIDTH: int = 40
|
|
||||||
RAYGUI_MIN_SCROLLBAR_HEIGHT: int = 40
|
|
||||||
RAYGUI_MIN_MOUSE_WHEEL_SPEED: int = 20
|
|
||||||
RAYGUI_TOGGLEGROUP_MAX_ITEMS: int = 32
|
|
||||||
RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: int = 40
|
|
||||||
RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: int = 1
|
|
||||||
RAYGUI_VALUEBOX_MAX_CHARS: int = 32
|
|
||||||
RAYGUI_COLORBARALPHA_CHECKED_SIZE: int = 10
|
|
||||||
RAYGUI_MESSAGEBOX_BUTTON_HEIGHT: int = 24
|
|
||||||
RAYGUI_MESSAGEBOX_BUTTON_PADDING: int = 12
|
|
||||||
RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT: int = 24
|
|
||||||
RAYGUI_TEXTINPUTBOX_BUTTON_PADDING: int = 12
|
|
||||||
RAYGUI_TEXTINPUTBOX_HEIGHT: int = 26
|
|
||||||
RAYGUI_GRID_ALPHA: float = 0.15
|
|
||||||
MAX_LINE_BUFFER_SIZE: int = 256
|
|
||||||
ICON_TEXT_PADDING: int = 4
|
|
||||||
RAYGUI_MAX_TEXT_LINES: int = 128
|
|
||||||
RAYGUI_TEXTSPLIT_MAX_ITEMS: int = 128
|
|
||||||
RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE: int = 1024
|
|
||||||
RAYGUI_TEXTFORMAT_MAX_SIZE: int = 256
|
|
||||||
PHYSAC_MAX_BODIES: int = 64
|
|
||||||
PHYSAC_MAX_MANIFOLDS: int = 4096
|
|
||||||
PHYSAC_MAX_VERTICES: int = 24
|
|
||||||
PHYSAC_CIRCLE_VERTICES: int = 24
|
|
||||||
PHYSAC_COLLISION_ITERATIONS: int = 20
|
|
||||||
PHYSAC_PENETRATION_ALLOWANCE: float = 0.05
|
|
||||||
PHYSAC_PENETRATION_CORRECTION: float = 0.4
|
|
||||||
PHYSAC_FLT_MAX: float = 3.402823466e+38
|
|
||||||
PHYSAC_EPSILON: float = 1e-06
|
|
||||||
GLFW_VERSION_MAJOR: int = 3
|
|
||||||
GLFW_VERSION_MINOR: int = 4
|
|
||||||
GLFW_VERSION_REVISION: int = 0
|
|
||||||
GLFW_TRUE: int = 1
|
|
||||||
GLFW_FALSE: int = 0
|
|
||||||
GLFW_RELEASE: int = 0
|
|
||||||
GLFW_PRESS: int = 1
|
|
||||||
GLFW_REPEAT: int = 2
|
|
||||||
GLFW_HAT_CENTERED: int = 0
|
|
||||||
GLFW_HAT_UP: int = 1
|
|
||||||
GLFW_HAT_RIGHT: int = 2
|
|
||||||
GLFW_HAT_DOWN: int = 4
|
|
||||||
GLFW_HAT_LEFT: int = 8
|
|
||||||
GLFW_HAT_RIGHT_UP = GLFW_HAT_RIGHT | GLFW_HAT_UP
|
|
||||||
GLFW_HAT_RIGHT_DOWN = GLFW_HAT_RIGHT | GLFW_HAT_DOWN
|
|
||||||
GLFW_HAT_LEFT_UP = GLFW_HAT_LEFT | GLFW_HAT_UP
|
|
||||||
GLFW_HAT_LEFT_DOWN = GLFW_HAT_LEFT | GLFW_HAT_DOWN
|
|
||||||
GLFW_KEY_SPACE: int = 32
|
|
||||||
GLFW_KEY_APOSTROPHE: int = 39
|
|
||||||
GLFW_KEY_COMMA: int = 44
|
|
||||||
GLFW_KEY_MINUS: int = 45
|
|
||||||
GLFW_KEY_PERIOD: int = 46
|
|
||||||
GLFW_KEY_SLASH: int = 47
|
|
||||||
GLFW_KEY_0: int = 48
|
|
||||||
GLFW_KEY_1: int = 49
|
|
||||||
GLFW_KEY_2: int = 50
|
|
||||||
GLFW_KEY_3: int = 51
|
|
||||||
GLFW_KEY_4: int = 52
|
|
||||||
GLFW_KEY_5: int = 53
|
|
||||||
GLFW_KEY_6: int = 54
|
|
||||||
GLFW_KEY_7: int = 55
|
|
||||||
GLFW_KEY_8: int = 56
|
|
||||||
GLFW_KEY_9: int = 57
|
|
||||||
GLFW_KEY_SEMICOLON: int = 59
|
|
||||||
GLFW_KEY_EQUAL: int = 61
|
|
||||||
GLFW_KEY_A: int = 65
|
|
||||||
GLFW_KEY_B: int = 66
|
|
||||||
GLFW_KEY_C: int = 67
|
|
||||||
GLFW_KEY_D: int = 68
|
|
||||||
GLFW_KEY_E: int = 69
|
|
||||||
GLFW_KEY_F: int = 70
|
|
||||||
GLFW_KEY_G: int = 71
|
|
||||||
GLFW_KEY_H: int = 72
|
|
||||||
GLFW_KEY_I: int = 73
|
|
||||||
GLFW_KEY_J: int = 74
|
|
||||||
GLFW_KEY_K: int = 75
|
|
||||||
GLFW_KEY_L: int = 76
|
|
||||||
GLFW_KEY_M: int = 77
|
|
||||||
GLFW_KEY_N: int = 78
|
|
||||||
GLFW_KEY_O: int = 79
|
|
||||||
GLFW_KEY_P: int = 80
|
|
||||||
GLFW_KEY_Q: int = 81
|
|
||||||
GLFW_KEY_R: int = 82
|
|
||||||
GLFW_KEY_S: int = 83
|
|
||||||
GLFW_KEY_T: int = 84
|
|
||||||
GLFW_KEY_U: int = 85
|
|
||||||
GLFW_KEY_V: int = 86
|
|
||||||
GLFW_KEY_W: int = 87
|
|
||||||
GLFW_KEY_X: int = 88
|
|
||||||
GLFW_KEY_Y: int = 89
|
|
||||||
GLFW_KEY_Z: int = 90
|
|
||||||
GLFW_KEY_LEFT_BRACKET: int = 91
|
|
||||||
GLFW_KEY_BACKSLASH: int = 92
|
|
||||||
GLFW_KEY_RIGHT_BRACKET: int = 93
|
|
||||||
GLFW_KEY_GRAVE_ACCENT: int = 96
|
|
||||||
GLFW_KEY_WORLD_1: int = 161
|
|
||||||
GLFW_KEY_WORLD_2: int = 162
|
|
||||||
GLFW_KEY_ESCAPE: int = 256
|
|
||||||
GLFW_KEY_ENTER: int = 257
|
|
||||||
GLFW_KEY_TAB: int = 258
|
|
||||||
GLFW_KEY_BACKSPACE: int = 259
|
|
||||||
GLFW_KEY_INSERT: int = 260
|
|
||||||
GLFW_KEY_DELETE: int = 261
|
|
||||||
GLFW_KEY_RIGHT: int = 262
|
|
||||||
GLFW_KEY_LEFT: int = 263
|
|
||||||
GLFW_KEY_DOWN: int = 264
|
|
||||||
GLFW_KEY_UP: int = 265
|
|
||||||
GLFW_KEY_PAGE_UP: int = 266
|
|
||||||
GLFW_KEY_PAGE_DOWN: int = 267
|
|
||||||
GLFW_KEY_HOME: int = 268
|
|
||||||
GLFW_KEY_END: int = 269
|
|
||||||
GLFW_KEY_CAPS_LOCK: int = 280
|
|
||||||
GLFW_KEY_SCROLL_LOCK: int = 281
|
|
||||||
GLFW_KEY_NUM_LOCK: int = 282
|
|
||||||
GLFW_KEY_PRINT_SCREEN: int = 283
|
|
||||||
GLFW_KEY_PAUSE: int = 284
|
|
||||||
GLFW_KEY_F1: int = 290
|
|
||||||
GLFW_KEY_F2: int = 291
|
|
||||||
GLFW_KEY_F3: int = 292
|
|
||||||
GLFW_KEY_F4: int = 293
|
|
||||||
GLFW_KEY_F5: int = 294
|
|
||||||
GLFW_KEY_F6: int = 295
|
|
||||||
GLFW_KEY_F7: int = 296
|
|
||||||
GLFW_KEY_F8: int = 297
|
|
||||||
GLFW_KEY_F9: int = 298
|
|
||||||
GLFW_KEY_F10: int = 299
|
|
||||||
GLFW_KEY_F11: int = 300
|
|
||||||
GLFW_KEY_F12: int = 301
|
|
||||||
GLFW_KEY_F13: int = 302
|
|
||||||
GLFW_KEY_F14: int = 303
|
|
||||||
GLFW_KEY_F15: int = 304
|
|
||||||
GLFW_KEY_F16: int = 305
|
|
||||||
GLFW_KEY_F17: int = 306
|
|
||||||
GLFW_KEY_F18: int = 307
|
|
||||||
GLFW_KEY_F19: int = 308
|
|
||||||
GLFW_KEY_F20: int = 309
|
|
||||||
GLFW_KEY_F21: int = 310
|
|
||||||
GLFW_KEY_F22: int = 311
|
|
||||||
GLFW_KEY_F23: int = 312
|
|
||||||
GLFW_KEY_F24: int = 313
|
|
||||||
GLFW_KEY_F25: int = 314
|
|
||||||
GLFW_KEY_KP_0: int = 320
|
|
||||||
GLFW_KEY_KP_1: int = 321
|
|
||||||
GLFW_KEY_KP_2: int = 322
|
|
||||||
GLFW_KEY_KP_3: int = 323
|
|
||||||
GLFW_KEY_KP_4: int = 324
|
|
||||||
GLFW_KEY_KP_5: int = 325
|
|
||||||
GLFW_KEY_KP_6: int = 326
|
|
||||||
GLFW_KEY_KP_7: int = 327
|
|
||||||
GLFW_KEY_KP_8: int = 328
|
|
||||||
GLFW_KEY_KP_9: int = 329
|
|
||||||
GLFW_KEY_KP_DECIMAL: int = 330
|
|
||||||
GLFW_KEY_KP_DIVIDE: int = 331
|
|
||||||
GLFW_KEY_KP_MULTIPLY: int = 332
|
|
||||||
GLFW_KEY_KP_SUBTRACT: int = 333
|
|
||||||
GLFW_KEY_KP_ADD: int = 334
|
|
||||||
GLFW_KEY_KP_ENTER: int = 335
|
|
||||||
GLFW_KEY_KP_EQUAL: int = 336
|
|
||||||
GLFW_KEY_LEFT_SHIFT: int = 340
|
|
||||||
GLFW_KEY_LEFT_CONTROL: int = 341
|
|
||||||
GLFW_KEY_LEFT_ALT: int = 342
|
|
||||||
GLFW_KEY_LEFT_SUPER: int = 343
|
|
||||||
GLFW_KEY_RIGHT_SHIFT: int = 344
|
|
||||||
GLFW_KEY_RIGHT_CONTROL: int = 345
|
|
||||||
GLFW_KEY_RIGHT_ALT: int = 346
|
|
||||||
GLFW_KEY_RIGHT_SUPER: int = 347
|
|
||||||
GLFW_KEY_MENU: int = 348
|
|
||||||
GLFW_MOD_SHIFT: int = 1
|
|
||||||
GLFW_MOD_CONTROL: int = 2
|
|
||||||
GLFW_MOD_ALT: int = 4
|
|
||||||
GLFW_MOD_SUPER: int = 8
|
|
||||||
GLFW_MOD_CAPS_LOCK: int = 16
|
|
||||||
GLFW_MOD_NUM_LOCK: int = 32
|
|
||||||
GLFW_MOUSE_BUTTON_1: int = 0
|
|
||||||
GLFW_MOUSE_BUTTON_2: int = 1
|
|
||||||
GLFW_MOUSE_BUTTON_3: int = 2
|
|
||||||
GLFW_MOUSE_BUTTON_4: int = 3
|
|
||||||
GLFW_MOUSE_BUTTON_5: int = 4
|
|
||||||
GLFW_MOUSE_BUTTON_6: int = 5
|
|
||||||
GLFW_MOUSE_BUTTON_7: int = 6
|
|
||||||
GLFW_MOUSE_BUTTON_8: int = 7
|
|
||||||
GLFW_JOYSTICK_1: int = 0
|
|
||||||
GLFW_JOYSTICK_2: int = 1
|
|
||||||
GLFW_JOYSTICK_3: int = 2
|
|
||||||
GLFW_JOYSTICK_4: int = 3
|
|
||||||
GLFW_JOYSTICK_5: int = 4
|
|
||||||
GLFW_JOYSTICK_6: int = 5
|
|
||||||
GLFW_JOYSTICK_7: int = 6
|
|
||||||
GLFW_JOYSTICK_8: int = 7
|
|
||||||
GLFW_JOYSTICK_9: int = 8
|
|
||||||
GLFW_JOYSTICK_10: int = 9
|
|
||||||
GLFW_JOYSTICK_11: int = 10
|
|
||||||
GLFW_JOYSTICK_12: int = 11
|
|
||||||
GLFW_JOYSTICK_13: int = 12
|
|
||||||
GLFW_JOYSTICK_14: int = 13
|
|
||||||
GLFW_JOYSTICK_15: int = 14
|
|
||||||
GLFW_JOYSTICK_16: int = 15
|
|
||||||
GLFW_GAMEPAD_BUTTON_A: int = 0
|
|
||||||
GLFW_GAMEPAD_BUTTON_B: int = 1
|
|
||||||
GLFW_GAMEPAD_BUTTON_X: int = 2
|
|
||||||
GLFW_GAMEPAD_BUTTON_Y: int = 3
|
|
||||||
GLFW_GAMEPAD_BUTTON_LEFT_BUMPER: int = 4
|
|
||||||
GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER: int = 5
|
|
||||||
GLFW_GAMEPAD_BUTTON_BACK: int = 6
|
|
||||||
GLFW_GAMEPAD_BUTTON_START: int = 7
|
|
||||||
GLFW_GAMEPAD_BUTTON_GUIDE: int = 8
|
|
||||||
GLFW_GAMEPAD_BUTTON_LEFT_THUMB: int = 9
|
|
||||||
GLFW_GAMEPAD_BUTTON_RIGHT_THUMB: int = 10
|
|
||||||
GLFW_GAMEPAD_BUTTON_DPAD_UP: int = 11
|
|
||||||
GLFW_GAMEPAD_BUTTON_DPAD_RIGHT: int = 12
|
|
||||||
GLFW_GAMEPAD_BUTTON_DPAD_DOWN: int = 13
|
|
||||||
GLFW_GAMEPAD_BUTTON_DPAD_LEFT: int = 14
|
|
||||||
GLFW_GAMEPAD_AXIS_LEFT_X: int = 0
|
|
||||||
GLFW_GAMEPAD_AXIS_LEFT_Y: int = 1
|
|
||||||
GLFW_GAMEPAD_AXIS_RIGHT_X: int = 2
|
|
||||||
GLFW_GAMEPAD_AXIS_RIGHT_Y: int = 3
|
|
||||||
GLFW_GAMEPAD_AXIS_LEFT_TRIGGER: int = 4
|
|
||||||
GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER: int = 5
|
|
||||||
GLFW_NO_ERROR: int = 0
|
|
||||||
GLFW_NOT_INITIALIZED: int = 65537
|
|
||||||
GLFW_NO_CURRENT_CONTEXT: int = 65538
|
|
||||||
GLFW_INVALID_ENUM: int = 65539
|
|
||||||
GLFW_INVALID_VALUE: int = 65540
|
|
||||||
GLFW_OUT_OF_MEMORY: int = 65541
|
|
||||||
GLFW_API_UNAVAILABLE: int = 65542
|
|
||||||
GLFW_VERSION_UNAVAILABLE: int = 65543
|
|
||||||
GLFW_PLATFORM_ERROR: int = 65544
|
|
||||||
GLFW_FORMAT_UNAVAILABLE: int = 65545
|
|
||||||
GLFW_NO_WINDOW_CONTEXT: int = 65546
|
|
||||||
GLFW_CURSOR_UNAVAILABLE: int = 65547
|
|
||||||
GLFW_FEATURE_UNAVAILABLE: int = 65548
|
|
||||||
GLFW_FEATURE_UNIMPLEMENTED: int = 65549
|
|
||||||
GLFW_PLATFORM_UNAVAILABLE: int = 65550
|
|
||||||
GLFW_FOCUSED: int = 131073
|
|
||||||
GLFW_ICONIFIED: int = 131074
|
|
||||||
GLFW_RESIZABLE: int = 131075
|
|
||||||
GLFW_VISIBLE: int = 131076
|
|
||||||
GLFW_DECORATED: int = 131077
|
|
||||||
GLFW_AUTO_ICONIFY: int = 131078
|
|
||||||
GLFW_FLOATING: int = 131079
|
|
||||||
GLFW_MAXIMIZED: int = 131080
|
|
||||||
GLFW_CENTER_CURSOR: int = 131081
|
|
||||||
GLFW_TRANSPARENT_FRAMEBUFFER: int = 131082
|
|
||||||
GLFW_HOVERED: int = 131083
|
|
||||||
GLFW_FOCUS_ON_SHOW: int = 131084
|
|
||||||
GLFW_MOUSE_PASSTHROUGH: int = 131085
|
|
||||||
GLFW_POSITION_X: int = 131086
|
|
||||||
GLFW_POSITION_Y: int = 131087
|
|
||||||
GLFW_RED_BITS: int = 135169
|
|
||||||
GLFW_GREEN_BITS: int = 135170
|
|
||||||
GLFW_BLUE_BITS: int = 135171
|
|
||||||
GLFW_ALPHA_BITS: int = 135172
|
|
||||||
GLFW_DEPTH_BITS: int = 135173
|
|
||||||
GLFW_STENCIL_BITS: int = 135174
|
|
||||||
GLFW_ACCUM_RED_BITS: int = 135175
|
|
||||||
GLFW_ACCUM_GREEN_BITS: int = 135176
|
|
||||||
GLFW_ACCUM_BLUE_BITS: int = 135177
|
|
||||||
GLFW_ACCUM_ALPHA_BITS: int = 135178
|
|
||||||
GLFW_AUX_BUFFERS: int = 135179
|
|
||||||
GLFW_STEREO: int = 135180
|
|
||||||
GLFW_SAMPLES: int = 135181
|
|
||||||
GLFW_SRGB_CAPABLE: int = 135182
|
|
||||||
GLFW_REFRESH_RATE: int = 135183
|
|
||||||
GLFW_DOUBLEBUFFER: int = 135184
|
|
||||||
GLFW_CLIENT_API: int = 139265
|
|
||||||
GLFW_CONTEXT_VERSION_MAJOR: int = 139266
|
|
||||||
GLFW_CONTEXT_VERSION_MINOR: int = 139267
|
|
||||||
GLFW_CONTEXT_REVISION: int = 139268
|
|
||||||
GLFW_CONTEXT_ROBUSTNESS: int = 139269
|
|
||||||
GLFW_OPENGL_FORWARD_COMPAT: int = 139270
|
|
||||||
GLFW_CONTEXT_DEBUG: int = 139271
|
|
||||||
GLFW_OPENGL_PROFILE: int = 139272
|
|
||||||
GLFW_CONTEXT_RELEASE_BEHAVIOR: int = 139273
|
|
||||||
GLFW_CONTEXT_NO_ERROR: int = 139274
|
|
||||||
GLFW_CONTEXT_CREATION_API: int = 139275
|
|
||||||
GLFW_SCALE_TO_MONITOR: int = 139276
|
|
||||||
GLFW_SCALE_FRAMEBUFFER: int = 139277
|
|
||||||
GLFW_COCOA_RETINA_FRAMEBUFFER: int = 143361
|
|
||||||
GLFW_COCOA_FRAME_NAME: int = 143362
|
|
||||||
GLFW_COCOA_GRAPHICS_SWITCHING: int = 143363
|
|
||||||
GLFW_X11_CLASS_NAME: int = 147457
|
|
||||||
GLFW_X11_INSTANCE_NAME: int = 147458
|
|
||||||
GLFW_WIN32_KEYBOARD_MENU: int = 151553
|
|
||||||
GLFW_WIN32_SHOWDEFAULT: int = 151554
|
|
||||||
GLFW_WAYLAND_APP_ID: int = 155649
|
|
||||||
GLFW_NO_API: int = 0
|
|
||||||
GLFW_OPENGL_API: int = 196609
|
|
||||||
GLFW_OPENGL_ES_API: int = 196610
|
|
||||||
GLFW_NO_ROBUSTNESS: int = 0
|
|
||||||
GLFW_NO_RESET_NOTIFICATION: int = 200705
|
|
||||||
GLFW_LOSE_CONTEXT_ON_RESET: int = 200706
|
|
||||||
GLFW_OPENGL_ANY_PROFILE: int = 0
|
|
||||||
GLFW_OPENGL_CORE_PROFILE: int = 204801
|
|
||||||
GLFW_OPENGL_COMPAT_PROFILE: int = 204802
|
|
||||||
GLFW_CURSOR: int = 208897
|
|
||||||
GLFW_STICKY_KEYS: int = 208898
|
|
||||||
GLFW_STICKY_MOUSE_BUTTONS: int = 208899
|
|
||||||
GLFW_LOCK_KEY_MODS: int = 208900
|
|
||||||
GLFW_RAW_MOUSE_MOTION: int = 208901
|
|
||||||
GLFW_CURSOR_NORMAL: int = 212993
|
|
||||||
GLFW_CURSOR_HIDDEN: int = 212994
|
|
||||||
GLFW_CURSOR_DISABLED: int = 212995
|
|
||||||
GLFW_CURSOR_CAPTURED: int = 212996
|
|
||||||
GLFW_ANY_RELEASE_BEHAVIOR: int = 0
|
|
||||||
GLFW_RELEASE_BEHAVIOR_FLUSH: int = 217089
|
|
||||||
GLFW_RELEASE_BEHAVIOR_NONE: int = 217090
|
|
||||||
GLFW_NATIVE_CONTEXT_API: int = 221185
|
|
||||||
GLFW_EGL_CONTEXT_API: int = 221186
|
|
||||||
GLFW_OSMESA_CONTEXT_API: int = 221187
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_NONE: int = 225281
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_OPENGL: int = 225282
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_OPENGLES: int = 225283
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_D3D9: int = 225284
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_D3D11: int = 225285
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_VULKAN: int = 225287
|
|
||||||
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_ARROW_CURSOR: int = 221185
|
|
||||||
GLFW_IBEAM_CURSOR: int = 221186
|
|
||||||
GLFW_CROSSHAIR_CURSOR: int = 221187
|
|
||||||
GLFW_POINTING_HAND_CURSOR: int = 221188
|
|
||||||
GLFW_RESIZE_EW_CURSOR: int = 221189
|
|
||||||
GLFW_RESIZE_NS_CURSOR: int = 221190
|
|
||||||
GLFW_RESIZE_NWSE_CURSOR: int = 221191
|
|
||||||
GLFW_RESIZE_NESW_CURSOR: int = 221192
|
|
||||||
GLFW_RESIZE_ALL_CURSOR: int = 221193
|
|
||||||
GLFW_NOT_ALLOWED_CURSOR: int = 221194
|
|
||||||
GLFW_CONNECTED: int = 262145
|
|
||||||
GLFW_DISCONNECTED: int = 262146
|
|
||||||
GLFW_JOYSTICK_HAT_BUTTONS: int = 327681
|
|
||||||
GLFW_ANGLE_PLATFORM_TYPE: int = 327682
|
|
||||||
GLFW_PLATFORM: int = 327683
|
|
||||||
GLFW_COCOA_CHDIR_RESOURCES: int = 331777
|
|
||||||
GLFW_COCOA_MENUBAR: int = 331778
|
|
||||||
GLFW_X11_XCB_VULKAN_SURFACE: int = 335873
|
|
||||||
GLFW_WAYLAND_LIBDECOR: int = 339969
|
|
||||||
GLFW_ANY_PLATFORM: int = 393216
|
|
||||||
GLFW_PLATFORM_WIN32: int = 393217
|
|
||||||
GLFW_PLATFORM_COCOA: int = 393218
|
|
||||||
GLFW_PLATFORM_WAYLAND: int = 393219
|
|
||||||
GLFW_PLATFORM_X11: int = 393220
|
|
||||||
GLFW_PLATFORM_NULL: int = 393221
|
|
|
@ -1,7 +1,6 @@
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
|
|
||||||
class ConfigFlags(IntEnum):
|
class ConfigFlags(IntEnum):
|
||||||
"""System/Window config flags."""
|
|
||||||
FLAG_VSYNC_HINT = 64
|
FLAG_VSYNC_HINT = 64
|
||||||
FLAG_FULLSCREEN_MODE = 2
|
FLAG_FULLSCREEN_MODE = 2
|
||||||
FLAG_WINDOW_RESIZABLE = 4
|
FLAG_WINDOW_RESIZABLE = 4
|
||||||
|
@ -15,12 +14,10 @@ class ConfigFlags(IntEnum):
|
||||||
FLAG_WINDOW_TRANSPARENT = 16
|
FLAG_WINDOW_TRANSPARENT = 16
|
||||||
FLAG_WINDOW_HIGHDPI = 8192
|
FLAG_WINDOW_HIGHDPI = 8192
|
||||||
FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384
|
FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384
|
||||||
FLAG_BORDERLESS_WINDOWED_MODE = 32768
|
|
||||||
FLAG_MSAA_4X_HINT = 32
|
FLAG_MSAA_4X_HINT = 32
|
||||||
FLAG_INTERLACED_HINT = 65536
|
FLAG_INTERLACED_HINT = 65536
|
||||||
|
|
||||||
class TraceLogLevel(IntEnum):
|
class TraceLogLevel(IntEnum):
|
||||||
"""Trace log level."""
|
|
||||||
LOG_ALL = 0
|
LOG_ALL = 0
|
||||||
LOG_TRACE = 1
|
LOG_TRACE = 1
|
||||||
LOG_DEBUG = 2
|
LOG_DEBUG = 2
|
||||||
|
@ -31,7 +28,6 @@ class TraceLogLevel(IntEnum):
|
||||||
LOG_NONE = 7
|
LOG_NONE = 7
|
||||||
|
|
||||||
class KeyboardKey(IntEnum):
|
class KeyboardKey(IntEnum):
|
||||||
"""Keyboard keys (US keyboard layout)."""
|
|
||||||
KEY_NULL = 0
|
KEY_NULL = 0
|
||||||
KEY_APOSTROPHE = 39
|
KEY_APOSTROPHE = 39
|
||||||
KEY_COMMA = 44
|
KEY_COMMA = 44
|
||||||
|
@ -139,12 +135,11 @@ 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 = 5
|
KEY_MENU = 82
|
||||||
KEY_VOLUME_UP = 24
|
KEY_VOLUME_UP = 24
|
||||||
KEY_VOLUME_DOWN = 25
|
KEY_VOLUME_DOWN = 25
|
||||||
|
|
||||||
class MouseButton(IntEnum):
|
class MouseButton(IntEnum):
|
||||||
"""Mouse buttons."""
|
|
||||||
MOUSE_BUTTON_LEFT = 0
|
MOUSE_BUTTON_LEFT = 0
|
||||||
MOUSE_BUTTON_RIGHT = 1
|
MOUSE_BUTTON_RIGHT = 1
|
||||||
MOUSE_BUTTON_MIDDLE = 2
|
MOUSE_BUTTON_MIDDLE = 2
|
||||||
|
@ -154,7 +149,6 @@ class MouseButton(IntEnum):
|
||||||
MOUSE_BUTTON_BACK = 6
|
MOUSE_BUTTON_BACK = 6
|
||||||
|
|
||||||
class MouseCursor(IntEnum):
|
class MouseCursor(IntEnum):
|
||||||
"""Mouse cursor."""
|
|
||||||
MOUSE_CURSOR_DEFAULT = 0
|
MOUSE_CURSOR_DEFAULT = 0
|
||||||
MOUSE_CURSOR_ARROW = 1
|
MOUSE_CURSOR_ARROW = 1
|
||||||
MOUSE_CURSOR_IBEAM = 2
|
MOUSE_CURSOR_IBEAM = 2
|
||||||
|
@ -168,7 +162,6 @@ class MouseCursor(IntEnum):
|
||||||
MOUSE_CURSOR_NOT_ALLOWED = 10
|
MOUSE_CURSOR_NOT_ALLOWED = 10
|
||||||
|
|
||||||
class GamepadButton(IntEnum):
|
class GamepadButton(IntEnum):
|
||||||
"""Gamepad buttons."""
|
|
||||||
GAMEPAD_BUTTON_UNKNOWN = 0
|
GAMEPAD_BUTTON_UNKNOWN = 0
|
||||||
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
||||||
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
||||||
|
@ -189,7 +182,6 @@ class GamepadButton(IntEnum):
|
||||||
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
||||||
|
|
||||||
class GamepadAxis(IntEnum):
|
class GamepadAxis(IntEnum):
|
||||||
"""Gamepad axis."""
|
|
||||||
GAMEPAD_AXIS_LEFT_X = 0
|
GAMEPAD_AXIS_LEFT_X = 0
|
||||||
GAMEPAD_AXIS_LEFT_Y = 1
|
GAMEPAD_AXIS_LEFT_Y = 1
|
||||||
GAMEPAD_AXIS_RIGHT_X = 2
|
GAMEPAD_AXIS_RIGHT_X = 2
|
||||||
|
@ -198,7 +190,6 @@ class GamepadAxis(IntEnum):
|
||||||
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
||||||
|
|
||||||
class MaterialMapIndex(IntEnum):
|
class MaterialMapIndex(IntEnum):
|
||||||
"""Material map index."""
|
|
||||||
MATERIAL_MAP_ALBEDO = 0
|
MATERIAL_MAP_ALBEDO = 0
|
||||||
MATERIAL_MAP_METALNESS = 1
|
MATERIAL_MAP_METALNESS = 1
|
||||||
MATERIAL_MAP_NORMAL = 2
|
MATERIAL_MAP_NORMAL = 2
|
||||||
|
@ -212,7 +203,6 @@ class MaterialMapIndex(IntEnum):
|
||||||
MATERIAL_MAP_BRDF = 10
|
MATERIAL_MAP_BRDF = 10
|
||||||
|
|
||||||
class ShaderLocationIndex(IntEnum):
|
class ShaderLocationIndex(IntEnum):
|
||||||
"""Shader location index."""
|
|
||||||
SHADER_LOC_VERTEX_POSITION = 0
|
SHADER_LOC_VERTEX_POSITION = 0
|
||||||
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
||||||
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
||||||
|
@ -239,12 +229,8 @@ 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 data type."""
|
|
||||||
SHADER_UNIFORM_FLOAT = 0
|
SHADER_UNIFORM_FLOAT = 0
|
||||||
SHADER_UNIFORM_VEC2 = 1
|
SHADER_UNIFORM_VEC2 = 1
|
||||||
SHADER_UNIFORM_VEC3 = 2
|
SHADER_UNIFORM_VEC3 = 2
|
||||||
|
@ -256,14 +242,12 @@ class ShaderUniformDataType(IntEnum):
|
||||||
SHADER_UNIFORM_SAMPLER2D = 8
|
SHADER_UNIFORM_SAMPLER2D = 8
|
||||||
|
|
||||||
class ShaderAttributeDataType(IntEnum):
|
class ShaderAttributeDataType(IntEnum):
|
||||||
"""Shader attribute data types."""
|
|
||||||
SHADER_ATTRIB_FLOAT = 0
|
SHADER_ATTRIB_FLOAT = 0
|
||||||
SHADER_ATTRIB_VEC2 = 1
|
SHADER_ATTRIB_VEC2 = 1
|
||||||
SHADER_ATTRIB_VEC3 = 2
|
SHADER_ATTRIB_VEC3 = 2
|
||||||
SHADER_ATTRIB_VEC4 = 3
|
SHADER_ATTRIB_VEC4 = 3
|
||||||
|
|
||||||
class PixelFormat(IntEnum):
|
class PixelFormat(IntEnum):
|
||||||
"""Pixel formats."""
|
|
||||||
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
||||||
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
||||||
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
||||||
|
@ -274,23 +258,19 @@ class PixelFormat(IntEnum):
|
||||||
PIXELFORMAT_UNCOMPRESSED_R32 = 8
|
PIXELFORMAT_UNCOMPRESSED_R32 = 8
|
||||||
PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9
|
PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9
|
||||||
PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10
|
PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10
|
||||||
PIXELFORMAT_UNCOMPRESSED_R16 = 11
|
PIXELFORMAT_COMPRESSED_DXT1_RGB = 11
|
||||||
PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12
|
PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12
|
||||||
PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13
|
PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13
|
||||||
PIXELFORMAT_COMPRESSED_DXT1_RGB = 14
|
PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14
|
||||||
PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15
|
PIXELFORMAT_COMPRESSED_ETC1_RGB = 15
|
||||||
PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16
|
PIXELFORMAT_COMPRESSED_ETC2_RGB = 16
|
||||||
PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17
|
PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17
|
||||||
PIXELFORMAT_COMPRESSED_ETC1_RGB = 18
|
PIXELFORMAT_COMPRESSED_PVRT_RGB = 18
|
||||||
PIXELFORMAT_COMPRESSED_ETC2_RGB = 19
|
PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19
|
||||||
PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20
|
PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20
|
||||||
PIXELFORMAT_COMPRESSED_PVRT_RGB = 21
|
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21
|
||||||
PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22
|
|
||||||
PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23
|
|
||||||
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24
|
|
||||||
|
|
||||||
class TextureFilter(IntEnum):
|
class TextureFilter(IntEnum):
|
||||||
"""Texture parameters: filter mode."""
|
|
||||||
TEXTURE_FILTER_POINT = 0
|
TEXTURE_FILTER_POINT = 0
|
||||||
TEXTURE_FILTER_BILINEAR = 1
|
TEXTURE_FILTER_BILINEAR = 1
|
||||||
TEXTURE_FILTER_TRILINEAR = 2
|
TEXTURE_FILTER_TRILINEAR = 2
|
||||||
|
@ -299,28 +279,25 @@ class TextureFilter(IntEnum):
|
||||||
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
||||||
|
|
||||||
class TextureWrap(IntEnum):
|
class TextureWrap(IntEnum):
|
||||||
"""Texture parameters: wrap mode."""
|
|
||||||
TEXTURE_WRAP_REPEAT = 0
|
TEXTURE_WRAP_REPEAT = 0
|
||||||
TEXTURE_WRAP_CLAMP = 1
|
TEXTURE_WRAP_CLAMP = 1
|
||||||
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
||||||
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
||||||
|
|
||||||
class CubemapLayout(IntEnum):
|
class CubemapLayout(IntEnum):
|
||||||
"""Cubemap layouts."""
|
|
||||||
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
||||||
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
||||||
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 type, defines generation method."""
|
|
||||||
FONT_DEFAULT = 0
|
FONT_DEFAULT = 0
|
||||||
FONT_BITMAP = 1
|
FONT_BITMAP = 1
|
||||||
FONT_SDF = 2
|
FONT_SDF = 2
|
||||||
|
|
||||||
class BlendMode(IntEnum):
|
class BlendMode(IntEnum):
|
||||||
"""Color blending modes (pre-defined)."""
|
|
||||||
BLEND_ALPHA = 0
|
BLEND_ALPHA = 0
|
||||||
BLEND_ADDITIVE = 1
|
BLEND_ADDITIVE = 1
|
||||||
BLEND_MULTIPLIED = 2
|
BLEND_MULTIPLIED = 2
|
||||||
|
@ -331,7 +308,6 @@ class BlendMode(IntEnum):
|
||||||
BLEND_CUSTOM_SEPARATE = 7
|
BLEND_CUSTOM_SEPARATE = 7
|
||||||
|
|
||||||
class Gesture(IntEnum):
|
class Gesture(IntEnum):
|
||||||
"""Gesture."""
|
|
||||||
GESTURE_NONE = 0
|
GESTURE_NONE = 0
|
||||||
GESTURE_TAP = 1
|
GESTURE_TAP = 1
|
||||||
GESTURE_DOUBLETAP = 2
|
GESTURE_DOUBLETAP = 2
|
||||||
|
@ -345,7 +321,6 @@ class Gesture(IntEnum):
|
||||||
GESTURE_PINCH_OUT = 512
|
GESTURE_PINCH_OUT = 512
|
||||||
|
|
||||||
class CameraMode(IntEnum):
|
class CameraMode(IntEnum):
|
||||||
"""Camera system modes."""
|
|
||||||
CAMERA_CUSTOM = 0
|
CAMERA_CUSTOM = 0
|
||||||
CAMERA_FREE = 1
|
CAMERA_FREE = 1
|
||||||
CAMERA_ORBITAL = 2
|
CAMERA_ORBITAL = 2
|
||||||
|
@ -353,43 +328,26 @@ class CameraMode(IntEnum):
|
||||||
CAMERA_THIRD_PERSON = 4
|
CAMERA_THIRD_PERSON = 4
|
||||||
|
|
||||||
class CameraProjection(IntEnum):
|
class CameraProjection(IntEnum):
|
||||||
"""Camera projection."""
|
|
||||||
CAMERA_PERSPECTIVE = 0
|
CAMERA_PERSPECTIVE = 0
|
||||||
CAMERA_ORTHOGRAPHIC = 1
|
CAMERA_ORTHOGRAPHIC = 1
|
||||||
|
|
||||||
class NPatchLayout(IntEnum):
|
class NPatchLayout(IntEnum):
|
||||||
"""N-patch layout."""
|
|
||||||
NPATCH_NINE_PATCH = 0
|
NPATCH_NINE_PATCH = 0
|
||||||
NPATCH_THREE_PATCH_VERTICAL = 1
|
NPATCH_THREE_PATCH_VERTICAL = 1
|
||||||
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
||||||
|
|
||||||
class GuiState(IntEnum):
|
class GuiState(IntEnum):
|
||||||
"""Gui control state."""
|
|
||||||
STATE_NORMAL = 0
|
STATE_NORMAL = 0
|
||||||
STATE_FOCUSED = 1
|
STATE_FOCUSED = 1
|
||||||
STATE_PRESSED = 2
|
STATE_PRESSED = 2
|
||||||
STATE_DISABLED = 3
|
STATE_DISABLED = 3
|
||||||
|
|
||||||
class GuiTextAlignment(IntEnum):
|
class GuiTextAlignment(IntEnum):
|
||||||
"""Gui control text alignment."""
|
|
||||||
TEXT_ALIGN_LEFT = 0
|
TEXT_ALIGN_LEFT = 0
|
||||||
TEXT_ALIGN_CENTER = 1
|
TEXT_ALIGN_CENTER = 1
|
||||||
TEXT_ALIGN_RIGHT = 2
|
TEXT_ALIGN_RIGHT = 2
|
||||||
|
|
||||||
class GuiTextAlignmentVertical(IntEnum):
|
|
||||||
"""Gui control text alignment vertical."""
|
|
||||||
TEXT_ALIGN_TOP = 0
|
|
||||||
TEXT_ALIGN_MIDDLE = 1
|
|
||||||
TEXT_ALIGN_BOTTOM = 2
|
|
||||||
|
|
||||||
class GuiTextWrapMode(IntEnum):
|
|
||||||
"""Gui control text wrap mode."""
|
|
||||||
TEXT_WRAP_NONE = 0
|
|
||||||
TEXT_WRAP_CHAR = 1
|
|
||||||
TEXT_WRAP_WORD = 2
|
|
||||||
|
|
||||||
class GuiControl(IntEnum):
|
class GuiControl(IntEnum):
|
||||||
"""Gui controls."""
|
|
||||||
DEFAULT = 0
|
DEFAULT = 0
|
||||||
LABEL = 1
|
LABEL = 1
|
||||||
BUTTON = 2
|
BUTTON = 2
|
||||||
|
@ -408,7 +366,6 @@ class GuiControl(IntEnum):
|
||||||
STATUSBAR = 15
|
STATUSBAR = 15
|
||||||
|
|
||||||
class GuiControlProperty(IntEnum):
|
class GuiControlProperty(IntEnum):
|
||||||
"""Gui base properties for every control."""
|
|
||||||
BORDER_COLOR_NORMAL = 0
|
BORDER_COLOR_NORMAL = 0
|
||||||
BASE_COLOR_NORMAL = 1
|
BASE_COLOR_NORMAL = 1
|
||||||
TEXT_COLOR_NORMAL = 2
|
TEXT_COLOR_NORMAL = 2
|
||||||
|
@ -424,32 +381,25 @@ class GuiControlProperty(IntEnum):
|
||||||
BORDER_WIDTH = 12
|
BORDER_WIDTH = 12
|
||||||
TEXT_PADDING = 13
|
TEXT_PADDING = 13
|
||||||
TEXT_ALIGNMENT = 14
|
TEXT_ALIGNMENT = 14
|
||||||
|
RESERVED = 15
|
||||||
|
|
||||||
class GuiDefaultProperty(IntEnum):
|
class GuiDefaultProperty(IntEnum):
|
||||||
"""DEFAULT extended properties."""
|
|
||||||
TEXT_SIZE = 16
|
TEXT_SIZE = 16
|
||||||
TEXT_SPACING = 17
|
TEXT_SPACING = 17
|
||||||
LINE_COLOR = 18
|
LINE_COLOR = 18
|
||||||
BACKGROUND_COLOR = 19
|
BACKGROUND_COLOR = 19
|
||||||
TEXT_LINE_SPACING = 20
|
|
||||||
TEXT_ALIGNMENT_VERTICAL = 21
|
|
||||||
TEXT_WRAP_MODE = 22
|
|
||||||
|
|
||||||
class GuiToggleProperty(IntEnum):
|
class GuiToggleProperty(IntEnum):
|
||||||
"""Toggle/ToggleGroup."""
|
|
||||||
GROUP_PADDING = 16
|
GROUP_PADDING = 16
|
||||||
|
|
||||||
class GuiSliderProperty(IntEnum):
|
class GuiSliderProperty(IntEnum):
|
||||||
"""Slider/SliderBar."""
|
|
||||||
SLIDER_WIDTH = 16
|
SLIDER_WIDTH = 16
|
||||||
SLIDER_PADDING = 17
|
SLIDER_PADDING = 17
|
||||||
|
|
||||||
class GuiProgressBarProperty(IntEnum):
|
class GuiProgressBarProperty(IntEnum):
|
||||||
"""ProgressBar."""
|
|
||||||
PROGRESS_PADDING = 16
|
PROGRESS_PADDING = 16
|
||||||
|
|
||||||
class GuiScrollBarProperty(IntEnum):
|
class GuiScrollBarProperty(IntEnum):
|
||||||
"""ScrollBar."""
|
|
||||||
ARROWS_SIZE = 16
|
ARROWS_SIZE = 16
|
||||||
ARROWS_VISIBLE = 17
|
ARROWS_VISIBLE = 17
|
||||||
SCROLL_SLIDER_PADDING = 18
|
SCROLL_SLIDER_PADDING = 18
|
||||||
|
@ -458,40 +408,34 @@ class GuiScrollBarProperty(IntEnum):
|
||||||
SCROLL_SPEED = 21
|
SCROLL_SPEED = 21
|
||||||
|
|
||||||
class GuiCheckBoxProperty(IntEnum):
|
class GuiCheckBoxProperty(IntEnum):
|
||||||
"""CheckBox."""
|
|
||||||
CHECK_PADDING = 16
|
CHECK_PADDING = 16
|
||||||
|
|
||||||
class GuiComboBoxProperty(IntEnum):
|
class GuiComboBoxProperty(IntEnum):
|
||||||
"""ComboBox."""
|
|
||||||
COMBO_BUTTON_WIDTH = 16
|
COMBO_BUTTON_WIDTH = 16
|
||||||
COMBO_BUTTON_SPACING = 17
|
COMBO_BUTTON_SPACING = 17
|
||||||
|
|
||||||
class GuiDropdownBoxProperty(IntEnum):
|
class GuiDropdownBoxProperty(IntEnum):
|
||||||
"""DropdownBox."""
|
|
||||||
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):
|
||||||
"""TextBox/TextBoxMulti/ValueBox/Spinner."""
|
TEXT_INNER_PADDING = 16
|
||||||
TEXT_READONLY = 16
|
TEXT_LINES_SPACING = 17
|
||||||
|
TEXT_ALIGNMENT_VERTICAL = 18
|
||||||
|
TEXT_MULTILINE = 19
|
||||||
|
TEXT_WRAP_MODE = 20
|
||||||
|
|
||||||
class GuiSpinnerProperty(IntEnum):
|
class GuiSpinnerProperty(IntEnum):
|
||||||
"""Spinner."""
|
|
||||||
SPIN_BUTTON_WIDTH = 16
|
SPIN_BUTTON_WIDTH = 16
|
||||||
SPIN_BUTTON_SPACING = 17
|
SPIN_BUTTON_SPACING = 17
|
||||||
|
|
||||||
class GuiListViewProperty(IntEnum):
|
class GuiListViewProperty(IntEnum):
|
||||||
"""ListView."""
|
|
||||||
LIST_ITEMS_HEIGHT = 16
|
LIST_ITEMS_HEIGHT = 16
|
||||||
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):
|
||||||
"""ColorPicker."""
|
|
||||||
COLOR_SELECTOR_SIZE = 16
|
COLOR_SELECTOR_SIZE = 16
|
||||||
HUEBAR_WIDTH = 17
|
HUEBAR_WIDTH = 17
|
||||||
HUEBAR_PADDING = 18
|
HUEBAR_PADDING = 18
|
||||||
|
@ -499,7 +443,6 @@ class GuiColorPickerProperty(IntEnum):
|
||||||
HUEBAR_SELECTOR_OVERFLOW = 20
|
HUEBAR_SELECTOR_OVERFLOW = 20
|
||||||
|
|
||||||
class GuiIconName(IntEnum):
|
class GuiIconName(IntEnum):
|
||||||
"""."""
|
|
||||||
ICON_NONE = 0
|
ICON_NONE = 0
|
||||||
ICON_FOLDER_FILE_OPEN = 1
|
ICON_FOLDER_FILE_OPEN = 1
|
||||||
ICON_FILE_SAVE_CLASSIC = 2
|
ICON_FILE_SAVE_CLASSIC = 2
|
||||||
|
@ -719,16 +662,16 @@ class GuiIconName(IntEnum):
|
||||||
ICON_REG_EXP = 216
|
ICON_REG_EXP = 216
|
||||||
ICON_FOLDER = 217
|
ICON_FOLDER = 217
|
||||||
ICON_FILE = 218
|
ICON_FILE = 218
|
||||||
ICON_SAND_TIMER = 219
|
ICON_219 = 219
|
||||||
ICON_WARNING = 220
|
ICON_220 = 220
|
||||||
ICON_HELP_BOX = 221
|
ICON_221 = 221
|
||||||
ICON_INFO_BOX = 222
|
ICON_222 = 222
|
||||||
ICON_PRIORITY = 223
|
ICON_223 = 223
|
||||||
ICON_LAYERS_ISO = 224
|
ICON_224 = 224
|
||||||
ICON_LAYERS2 = 225
|
ICON_225 = 225
|
||||||
ICON_MLAYERS = 226
|
ICON_226 = 226
|
||||||
ICON_MAPS = 227
|
ICON_227 = 227
|
||||||
ICON_HOT = 228
|
ICON_228 = 228
|
||||||
ICON_229 = 229
|
ICON_229 = 229
|
||||||
ICON_230 = 230
|
ICON_230 = 230
|
||||||
ICON_231 = 231
|
ICON_231 = 231
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
../../raylib/raylib.h.modified
|
|
1345
dynamic/raylib/raylib_modified.h
Normal file
1345
dynamic/raylib/raylib_modified.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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_screen_to_world_ray(pos, camera)
|
ray = pr.get_mouse_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_screen_to_world_ray(pos, camera)
|
ray = pr.get_mouse_ray(pos, camera)
|
||||||
|
|
||||||
pr.close_window()
|
pr.close_window()
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
"""
|
|
||||||
|
|
||||||
raylib [audio] example - playing
|
|
||||||
|
|
||||||
"""
|
|
||||||
import dataclasses
|
|
||||||
import pyray
|
|
||||||
import raylib as rl
|
|
||||||
|
|
||||||
|
|
||||||
MAX_CIRCLES=64
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
|
||||||
class CircleWave:
|
|
||||||
position: pyray.Vector2
|
|
||||||
radius: float
|
|
||||||
alpha: float
|
|
||||||
speed: float
|
|
||||||
color: pyray.Color
|
|
||||||
|
|
||||||
screenWidth = 800
|
|
||||||
screenHeight = 450
|
|
||||||
|
|
||||||
rl.SetConfigFlags(rl.FLAG_MSAA_4X_HINT) # NOTE: Try to enable MSAA 4X
|
|
||||||
|
|
||||||
rl.InitWindow(screenWidth, screenHeight, b"raylib [audio] example - module playing (streaming)")
|
|
||||||
|
|
||||||
rl.InitAudioDevice() # Initialize audio device
|
|
||||||
|
|
||||||
colors = [pyray.ORANGE, pyray.RED, pyray.GOLD, pyray.LIME, pyray.BLUE, pyray.VIOLET, pyray.BROWN, pyray.LIGHTGRAY, pyray.PINK,
|
|
||||||
pyray.YELLOW, pyray.GREEN, pyray.SKYBLUE, pyray.PURPLE, pyray.BEIGE]
|
|
||||||
|
|
||||||
# Creates some circles for visual effect
|
|
||||||
circles = []
|
|
||||||
|
|
||||||
for i in range(MAX_CIRCLES):
|
|
||||||
rad = rl.GetRandomValue(10, 40)
|
|
||||||
pos = pyray.Vector2(
|
|
||||||
float(rl.GetRandomValue(rad, int(screenWidth) - rad)),
|
|
||||||
float(rl.GetRandomValue(rad, int(screenHeight) - rad))
|
|
||||||
)
|
|
||||||
c = CircleWave(
|
|
||||||
alpha=0.0,
|
|
||||||
radius=float(rad),
|
|
||||||
position=pos,
|
|
||||||
speed=float(rl.GetRandomValue(1, 100))/2000.0,
|
|
||||||
color=colors[rl.GetRandomValue(0, 13)]
|
|
||||||
)
|
|
||||||
circles.append(c)
|
|
||||||
|
|
||||||
music = rl.LoadMusicStream(b"resources/mini1111.xm")
|
|
||||||
music.looping = False
|
|
||||||
pitch = 1.0
|
|
||||||
|
|
||||||
rl.PlayMusicStream(music)
|
|
||||||
timePlayed = 0.0
|
|
||||||
pause = False
|
|
||||||
|
|
||||||
rl.SetTargetFPS(60) # Set our game to run at 60 frames-per-second
|
|
||||||
|
|
||||||
|
|
||||||
# Main game loop
|
|
||||||
while not rl.WindowShouldClose(): # Detect window close button or ESC key
|
|
||||||
# Update
|
|
||||||
#----------------------------------------------------------------------------------
|
|
||||||
rl.UpdateMusicStream(music) # Update music buffer with new stream data
|
|
||||||
|
|
||||||
# Restart music playing (stop and play)
|
|
||||||
if rl.IsKeyPressed(rl.KEY_SPACE):
|
|
||||||
rl.StopMusicStream(music)
|
|
||||||
rl.PlayMusicStream(music)
|
|
||||||
pause = False
|
|
||||||
|
|
||||||
# Pause/Resume music playing
|
|
||||||
if rl.IsKeyPressed(rl.KEY_P):
|
|
||||||
pause = not pause
|
|
||||||
if pause:
|
|
||||||
rl.PauseMusicStream(music)
|
|
||||||
else:
|
|
||||||
rl.ResumeMusicStream(music)
|
|
||||||
|
|
||||||
|
|
||||||
if rl.IsKeyDown(rl.KEY_DOWN):
|
|
||||||
pitch -= 0.01
|
|
||||||
elif rl.IsKeyDown(rl.KEY_UP):
|
|
||||||
pitch += 0.01
|
|
||||||
|
|
||||||
rl.SetMusicPitch(music, pitch)
|
|
||||||
|
|
||||||
# Get timePlayed scaled to bar dimensions
|
|
||||||
timePlayed = (rl.GetMusicTimePlayed(music) / rl.GetMusicTimeLength(music))*(screenWidth - 40)
|
|
||||||
|
|
||||||
# Color circles animation
|
|
||||||
for i in range(MAX_CIRCLES):
|
|
||||||
if pause:
|
|
||||||
break
|
|
||||||
|
|
||||||
circles[i].alpha += circles[i].speed
|
|
||||||
circles[i].radius += circles[i].speed*10.0
|
|
||||||
|
|
||||||
if circles[i].alpha > 1.0:
|
|
||||||
circles[i].speed *= -1
|
|
||||||
|
|
||||||
if circles[i].alpha <= 0.0:
|
|
||||||
circles[i].alpha = 0.0
|
|
||||||
rad = rl.GetRandomValue(10, 40)
|
|
||||||
pos = pyray.Vector2(
|
|
||||||
float(rl.GetRandomValue(rad, int(screenWidth) - rad)),
|
|
||||||
float(rl.GetRandomValue(rad, int(screenHeight) - rad))
|
|
||||||
)
|
|
||||||
circles[i].position = pos
|
|
||||||
circles[i].radius = float(rad)
|
|
||||||
circles[i].speed = float(rl.GetRandomValue(1, 100)) / 2000.0
|
|
||||||
circles[i].color = colors[rl.GetRandomValue(0, 13)]
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Draw
|
|
||||||
#----------------------------------------------------------------------------------
|
|
||||||
pyray.begin_drawing()
|
|
||||||
|
|
||||||
pyray.clear_background(pyray.RAYWHITE)
|
|
||||||
|
|
||||||
for i in range(MAX_CIRCLES):
|
|
||||||
pyray.draw_circle_v(circles[i].position, circles[i].radius, pyray.fade(circles[i].color, circles[i].alpha))
|
|
||||||
|
|
||||||
# Draw time bar
|
|
||||||
pyray.draw_rectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, pyray.LIGHTGRAY)
|
|
||||||
pyray.draw_rectangle(20, screenHeight - 20 - 12, int(timePlayed), 12, pyray.MAROON)
|
|
||||||
pyray.draw_rectangle_lines(20, screenHeight - 20 - 12, screenWidth - 40, 12, pyray.GRAY)
|
|
||||||
|
|
||||||
# Draw help instructions
|
|
||||||
pyray.draw_rectangle(20, 20, 425, 145, pyray.RAYWHITE)
|
|
||||||
pyray.draw_rectangle_lines(20, 20, 425, 145, pyray.GRAY)
|
|
||||||
pyray.draw_text("PRESS SPACE TO RESTART MUSIC", 40, 40, 20, pyray.BLACK)
|
|
||||||
pyray.draw_text("PRESS P TO PAUSE/RESUME", 40, 70, 20, pyray.BLACK)
|
|
||||||
pyray.draw_text("PRESS UP/DOWN TO CHANGE SPEED", 40, 100, 20, pyray.BLACK)
|
|
||||||
pyray.draw_text(f"SPEED: {pitch}", 40, 130, 20, pyray.MAROON)
|
|
||||||
|
|
||||||
pyray.end_drawing()
|
|
||||||
#----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
# De-Initialization
|
|
||||||
#--------------------------------------------------------------------------------------
|
|
||||||
rl.UnloadMusicStream(music) # Unload music stream buffers from RAM
|
|
||||||
|
|
||||||
rl.CloseAudioDevice() # Close audio device (music streaming is automatically stopped)
|
|
||||||
|
|
||||||
rl.CloseWindow() # Close window and OpenGL context
|
|
|
@ -1,101 +0,0 @@
|
||||||
"""checked with raylib-python-cffi 5.5.0.2
|
|
||||||
raylib [audio] example - Music playing (streaming)
|
|
||||||
Example complexity rating: [★☆☆☆] 1/4
|
|
||||||
Example originally created with raylib 1.3, last time updated with raylib 4.0
|
|
||||||
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
||||||
BSD-like license that allows static linking with closed source software
|
|
||||||
Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
|
|
||||||
|
|
||||||
This source has been converted from C raylib examples to Python.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import pyray as rl
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
THIS_DIR = Path(__file__).resolve().parent
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------------
|
|
||||||
# Program main entry point
|
|
||||||
# ------------------------------------------------------------------------------------
|
|
||||||
def main():
|
|
||||||
# Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
screen_width = 800
|
|
||||||
screen_height = 450
|
|
||||||
|
|
||||||
rl.init_window(
|
|
||||||
screen_width,
|
|
||||||
screen_height,
|
|
||||||
"raylib [audio] example - music playing (streaming)",
|
|
||||||
)
|
|
||||||
|
|
||||||
rl.init_audio_device() # Initialize audio device
|
|
||||||
|
|
||||||
music = rl.load_music_stream(str(THIS_DIR / "resources/country.mp3"))
|
|
||||||
|
|
||||||
rl.play_music_stream(music)
|
|
||||||
|
|
||||||
time_played = 0.0 # Time played normalized [0.0f..1.0f]
|
|
||||||
pause = False # Music playing paused
|
|
||||||
|
|
||||||
rl.set_target_fps(30) # Set our game to run at 30 frames-per-second
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Main game loop
|
|
||||||
while not rl.window_should_close(): # Detect window close button or ESC key
|
|
||||||
# Update
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
rl.update_music_stream(music) # Update music buffer with new stream data
|
|
||||||
|
|
||||||
# Restart music playing (stop and play)
|
|
||||||
if rl.is_key_pressed(rl.KEY_SPACE):
|
|
||||||
rl.stop_music_stream(music)
|
|
||||||
rl.play_music_stream(music)
|
|
||||||
|
|
||||||
# Pause/Resume music playing
|
|
||||||
if rl.is_key_pressed(rl.KEY_P):
|
|
||||||
pause = not pause
|
|
||||||
|
|
||||||
if pause:
|
|
||||||
rl.pause_music_stream(music)
|
|
||||||
else:
|
|
||||||
rl.resume_music_stream(music)
|
|
||||||
|
|
||||||
# Get normalized time played for current music stream
|
|
||||||
time_played = rl.get_music_time_played(music) / rl.get_music_time_length(music)
|
|
||||||
|
|
||||||
if time_played > 1.0:
|
|
||||||
time_played = 1.0 # Make sure time played is no longer than music
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Draw
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
rl.begin_drawing()
|
|
||||||
|
|
||||||
rl.clear_background(rl.RAYWHITE)
|
|
||||||
|
|
||||||
rl.draw_text("MUSIC SHOULD BE PLAYING!", 255, 150, 20, rl.LIGHTGRAY)
|
|
||||||
|
|
||||||
rl.draw_rectangle(200, 200, 400, 12, rl.LIGHTGRAY)
|
|
||||||
rl.draw_rectangle(200, 200, int(time_played * 400.0), 12, rl.MAROON)
|
|
||||||
rl.draw_rectangle_lines(200, 200, 400, 12, rl.GRAY)
|
|
||||||
|
|
||||||
rl.draw_text("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, rl.LIGHTGRAY)
|
|
||||||
rl.draw_text("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, rl.LIGHTGRAY)
|
|
||||||
|
|
||||||
rl.end_drawing()
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# De-Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
rl.unload_music_stream(music) # Unload music stream buffers from RAM
|
|
||||||
|
|
||||||
rl.close_audio_device() # Close audio device (music streaming is automatically stopped)
|
|
||||||
|
|
||||||
rl.close_window() # Close window and OpenGL context
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,67 +0,0 @@
|
||||||
"""checked with raylib-python-cffi 5.5.0.2
|
|
||||||
raylib [audio] example - Sound loading and playing
|
|
||||||
Example complexity rating: [★☆☆☆] 1/4
|
|
||||||
Example originally created with raylib 1.1, last time updated with raylib 3.5
|
|
||||||
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
||||||
BSD-like license that allows static linking with closed source software
|
|
||||||
Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
|
||||||
|
|
||||||
This source has been converted from C raylib examples to Python.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import pyray as rl
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Get the directory where this script is located
|
|
||||||
THIS_DIR = Path(__file__).resolve().parent
|
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
screen_width = 800
|
|
||||||
screen_height = 450
|
|
||||||
|
|
||||||
rl.init_window(
|
|
||||||
screen_width, screen_height, "raylib [audio] example - sound loading and playing"
|
|
||||||
)
|
|
||||||
|
|
||||||
rl.init_audio_device() # Initialize audio device
|
|
||||||
|
|
||||||
# Load WAV audio file using proper path resolution
|
|
||||||
fx_wav = rl.load_sound(str(THIS_DIR / "resources/sound.wav"))
|
|
||||||
# Load OGG audio file using proper path resolution
|
|
||||||
fx_ogg = rl.load_sound(str(THIS_DIR / "resources/target.ogg"))
|
|
||||||
|
|
||||||
rl.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Main game loop
|
|
||||||
while not rl.window_should_close(): # Detect window close button or ESC key
|
|
||||||
# Update
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
if rl.is_key_pressed(rl.KeyboardKey.KEY_SPACE):
|
|
||||||
rl.play_sound(fx_wav) # Play WAV sound
|
|
||||||
if rl.is_key_pressed(rl.KeyboardKey.KEY_ENTER):
|
|
||||||
rl.play_sound(fx_ogg) # Play OGG sound
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Draw
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
rl.begin_drawing()
|
|
||||||
|
|
||||||
rl.clear_background(rl.RAYWHITE)
|
|
||||||
|
|
||||||
rl.draw_text("Press SPACE to PLAY the WAV sound!", 200, 180, 20, rl.LIGHTGRAY)
|
|
||||||
rl.draw_text("Press ENTER to PLAY the OGG sound!", 200, 220, 20, rl.LIGHTGRAY)
|
|
||||||
|
|
||||||
rl.end_drawing()
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# De-Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
rl.unload_sound(fx_wav) # Unload sound data
|
|
||||||
rl.unload_sound(fx_ogg) # Unload sound data
|
|
||||||
|
|
||||||
rl.close_audio_device() # Close audio device
|
|
||||||
|
|
||||||
rl.close_window() # Close window and OpenGL context
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
|
@ -1,86 +0,0 @@
|
||||||
"""checked with raylib-python-cffi 5.5.0.2
|
|
||||||
raylib [audio] example - Playing sound multiple times
|
|
||||||
Example complexity rating: [★★☆☆] 2/4
|
|
||||||
Example originally created with raylib 4.6, last time updated with raylib 4.6
|
|
||||||
Example contributed by Jeffery Myers (@JeffM2501) and reviewed by Ramon Santamaria (@raysan5)
|
|
||||||
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
||||||
BSD-like license that allows static linking with closed source software
|
|
||||||
Copyright (c) 2023-2025 Jeffery Myers (@JeffM2501)
|
|
||||||
|
|
||||||
This source has been converted from C raylib examples to Python.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import pyray as rl
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Get the directory where this script is located
|
|
||||||
THIS_DIR = Path(__file__).resolve().parent
|
|
||||||
|
|
||||||
MAX_SOUNDS = 10
|
|
||||||
sound_array: List[rl.Sound] = []
|
|
||||||
current_sound = 0
|
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
screen_width = 800
|
|
||||||
screen_height = 450
|
|
||||||
|
|
||||||
rl.init_window(
|
|
||||||
screen_width, screen_height, "raylib [audio] example - playing sound multiple times"
|
|
||||||
)
|
|
||||||
|
|
||||||
rl.init_audio_device() # Initialize audio device
|
|
||||||
|
|
||||||
# Load the sound list
|
|
||||||
sound_array.append(
|
|
||||||
rl.load_sound(str(THIS_DIR / "resources/sound.wav"))
|
|
||||||
) # Load WAV audio file into the first slot as the 'source' sound
|
|
||||||
# this sound owns the sample data
|
|
||||||
for i in range(1, MAX_SOUNDS):
|
|
||||||
sound_array.append(
|
|
||||||
rl.load_sound_alias(sound_array[0])
|
|
||||||
) # Load an alias of the sound into slots 1-9
|
|
||||||
# These do not own the sound data, but can be played
|
|
||||||
current_sound = 0 # Set the sound list to the start
|
|
||||||
|
|
||||||
rl.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Main game loop
|
|
||||||
while not rl.window_should_close(): # Detect window close button or ESC key
|
|
||||||
# Update
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
if rl.is_key_pressed(rl.KeyboardKey.KEY_SPACE):
|
|
||||||
rl.play_sound(sound_array[current_sound]) # Play the next open sound slot
|
|
||||||
current_sound += 1 # Increment the sound slot
|
|
||||||
if (
|
|
||||||
current_sound >= MAX_SOUNDS
|
|
||||||
): # If the sound slot is out of bounds, go back to 0
|
|
||||||
current_sound = 0
|
|
||||||
|
|
||||||
# Note: a better way would be to look at the list for the first sound that is not playing and use that slot
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Draw
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
rl.begin_drawing()
|
|
||||||
|
|
||||||
rl.clear_background(rl.RAYWHITE)
|
|
||||||
|
|
||||||
rl.draw_text("Press SPACE to PLAY a WAV sound!", 200, 180, 20, rl.LIGHTGRAY)
|
|
||||||
|
|
||||||
rl.end_drawing()
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# De-Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
for i in range(1, MAX_SOUNDS):
|
|
||||||
rl.unload_sound_alias(sound_array[i]) # Unload sound aliases
|
|
||||||
rl.unload_sound(sound_array[0]) # Unload source sound data
|
|
||||||
|
|
||||||
rl.close_audio_device() # Close audio device
|
|
||||||
|
|
||||||
rl.close_window() # Close window and OpenGL context
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
|
@ -1,112 +0,0 @@
|
||||||
"""checked with raylib-python-cffi 5.5.0.2
|
|
||||||
raylib [audio] example - Playing spatialized 3D sound
|
|
||||||
Example complexity rating: [★★☆☆] 2/4
|
|
||||||
Example originally created with raylib 5.5, last time updated with raylib 5.5
|
|
||||||
Example contributed by Le Juez Victor (@Bigfoot71) and reviewed by Ramon Santamaria (@raysan5)
|
|
||||||
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
|
||||||
BSD-like license that allows static linking with closed source software
|
|
||||||
Copyright (c) 2025 Le Juez Victor (@Bigfoot71)
|
|
||||||
|
|
||||||
This source has been converted from C raylib examples to Python.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import pyray as rl
|
|
||||||
import math
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Get the directory where this script is located
|
|
||||||
THIS_DIR = Path(__file__).resolve().parent
|
|
||||||
|
|
||||||
|
|
||||||
# Sound positioning function
|
|
||||||
def set_sound_position(listener, sound, position, max_dist):
|
|
||||||
# Calculate direction vector and distance between listener and sound source
|
|
||||||
direction = rl.vector3_subtract(position, listener.position)
|
|
||||||
distance = rl.vector3_length(direction)
|
|
||||||
|
|
||||||
# Apply logarithmic distance attenuation and clamp between 0-1
|
|
||||||
attenuation = 1.0 / (1.0 + (distance / max_dist))
|
|
||||||
attenuation = rl.clamp(attenuation, 0.0, 1.0)
|
|
||||||
|
|
||||||
# Calculate normalized vectors for spatial positioning
|
|
||||||
normalized_direction = rl.vector3_normalize(direction)
|
|
||||||
forward = rl.vector3_normalize(
|
|
||||||
rl.vector3_subtract(listener.target, listener.position)
|
|
||||||
)
|
|
||||||
right = rl.vector3_normalize(rl.vector3_cross_product(listener.up, forward))
|
|
||||||
|
|
||||||
# Reduce volume for sounds behind the listener
|
|
||||||
dot_product = rl.vector3_dot_product(forward, normalized_direction)
|
|
||||||
if dot_product < 0.0:
|
|
||||||
attenuation *= 1.0 + dot_product * 0.5
|
|
||||||
|
|
||||||
# Set stereo panning based on sound position relative to listener
|
|
||||||
pan = 0.5 + 0.5 * rl.vector3_dot_product(normalized_direction, right)
|
|
||||||
|
|
||||||
# Apply final sound properties
|
|
||||||
rl.set_sound_volume(sound, attenuation)
|
|
||||||
rl.set_sound_pan(sound, pan)
|
|
||||||
|
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
screen_width = 800
|
|
||||||
screen_height = 450
|
|
||||||
|
|
||||||
rl.init_window(
|
|
||||||
screen_width, screen_height, "raylib [audio] example - Playing spatialized 3D sound"
|
|
||||||
)
|
|
||||||
|
|
||||||
rl.init_audio_device()
|
|
||||||
|
|
||||||
sound = rl.load_sound(str(THIS_DIR / "resources/coin.wav"))
|
|
||||||
|
|
||||||
camera = rl.Camera3D(
|
|
||||||
(0, 5, 5),
|
|
||||||
(0, 0, 0),
|
|
||||||
(0, 1, 0),
|
|
||||||
60.0,
|
|
||||||
rl.CameraProjection.CAMERA_PERSPECTIVE,
|
|
||||||
)
|
|
||||||
|
|
||||||
rl.disable_cursor()
|
|
||||||
|
|
||||||
rl.set_target_fps(60)
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Main game loop
|
|
||||||
while not rl.window_should_close():
|
|
||||||
# Update
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
rl.update_camera(camera, rl.CameraMode.CAMERA_FREE)
|
|
||||||
|
|
||||||
th = rl.get_time()
|
|
||||||
|
|
||||||
sphere_pos = rl.Vector3(5.0 * math.cos(th), 0.0, 5.0 * math.sin(th))
|
|
||||||
|
|
||||||
set_sound_position(camera, sound, sphere_pos, 20.0)
|
|
||||||
if not rl.is_sound_playing(sound):
|
|
||||||
rl.play_sound(sound)
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Draw
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
rl.begin_drawing()
|
|
||||||
|
|
||||||
rl.clear_background(rl.RAYWHITE)
|
|
||||||
|
|
||||||
rl.begin_mode_3d(camera)
|
|
||||||
rl.draw_grid(10, 2)
|
|
||||||
rl.draw_sphere(sphere_pos, 0.5, rl.RED)
|
|
||||||
rl.end_mode_3d()
|
|
||||||
|
|
||||||
rl.end_drawing()
|
|
||||||
# ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# De-Initialization
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
||||||
rl.unload_sound(sound)
|
|
||||||
rl.close_audio_device() # Close audio device
|
|
||||||
|
|
||||||
rl.close_window() # Close window and OpenGL context
|
|
||||||
# --------------------------------------------------------------------------------------
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,11 +1,11 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
raylib [core] example - 2D Camera System
|
raylib [core] example - 2d camera
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pyray
|
import pyray
|
||||||
|
|
||||||
from pyray import (
|
from raylib.colors import (
|
||||||
RAYWHITE,
|
RAYWHITE,
|
||||||
DARKGRAY,
|
DARKGRAY,
|
||||||
RED,
|
RED,
|
||||||
|
@ -15,12 +15,16 @@ from pyray import (
|
||||||
BLACK,
|
BLACK,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
MAX_BUILDINGS = 100
|
MAX_BUILDINGS = 100
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,'raylib [core] example - 2d camera')
|
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
'raylib [core] example - 2d camera')
|
||||||
|
|
||||||
player = pyray.Rectangle(400, 280, 40, 40)
|
player = pyray.Rectangle(400, 280, 40, 40)
|
||||||
buildings = []
|
buildings = []
|
||||||
|
@ -52,23 +56,24 @@ camera.zoom = 1.0
|
||||||
|
|
||||||
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
|
|
||||||
# Main game loop
|
# Main game loop
|
||||||
while not pyray.window_should_close(): # Detect window close button or ESC key
|
while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
# Update
|
# Update
|
||||||
|
|
||||||
# Player movement
|
# Player movement
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_RIGHT):
|
if pyray.is_key_down(pyray.KEY_RIGHT):
|
||||||
player.x += 2
|
player.x += 2
|
||||||
elif pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT):
|
elif pyray.is_key_down(pyray.KEY_LEFT):
|
||||||
player.x -= 2
|
player.x -= 2
|
||||||
|
|
||||||
# Camera target follows player
|
# Camera target follows player
|
||||||
camera.target = pyray.Vector2(player.x + 20, player.y + 20)
|
camera.target = pyray.Vector2(player.x + 20, player.y + 20)
|
||||||
|
|
||||||
# Camera rotation controls
|
# Camera rotation controls
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_A):
|
if pyray.is_key_down(pyray.KEY_A):
|
||||||
camera.rotation -= 1
|
camera.rotation -= 1
|
||||||
elif pyray.is_key_down(pyray.KeyboardKey.KEY_S):
|
elif pyray.is_key_down(pyray.KEY_S):
|
||||||
camera.rotation += 1
|
camera.rotation += 1
|
||||||
|
|
||||||
# Limit camera rotation to 80 degrees (-40 to 40)
|
# Limit camera rotation to 80 degrees (-40 to 40)
|
||||||
|
@ -86,7 +91,7 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
camera.zoom = 0.1
|
camera.zoom = 0.1
|
||||||
|
|
||||||
# Camera reset (zoom and rotation)
|
# Camera reset (zoom and rotation)
|
||||||
if pyray.is_key_pressed(pyray.KeyboardKey.KEY_R):
|
if pyray.is_key_pressed(pyray.KEY_R):
|
||||||
camera.zoom = 1.0
|
camera.zoom = 1.0
|
||||||
camera.rotation = 0.0
|
camera.rotation = 0.0
|
||||||
|
|
||||||
|
@ -128,5 +133,6 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
|
|
||||||
pyray.end_drawing()
|
pyray.end_drawing()
|
||||||
|
|
||||||
|
|
||||||
# De-Initialization
|
# De-Initialization
|
||||||
pyray.close_window() # Close window and OpenGL context
|
pyray.close_window() # Close window and OpenGL context
|
||||||
|
|
|
@ -13,14 +13,15 @@ pyray.set_target_fps(60)
|
||||||
|
|
||||||
camera = pyray.Camera2D()
|
camera = pyray.Camera2D()
|
||||||
|
|
||||||
|
camera = pyray.Camera2D()
|
||||||
camera.zoom = 1.0
|
camera.zoom = 1.0
|
||||||
|
|
||||||
pyray.set_target_fps(60)
|
pyray.set_target_fps(60);
|
||||||
|
|
||||||
# main game loop
|
# main game loop
|
||||||
while not pyray.window_should_close():
|
while not pyray.window_should_close():
|
||||||
# update
|
# update
|
||||||
if pyray.is_mouse_button_down(pyray.MouseButton.MOUSE_BUTTON_RIGHT):
|
if pyray.is_mouse_button_down(pyray.MOUSE_BUTTON_RIGHT):
|
||||||
delta = pyray.get_mouse_delta()
|
delta = pyray.get_mouse_delta()
|
||||||
delta = pyray.vector2_scale(delta, -1.0 / camera.zoom)
|
delta = pyray.vector2_scale(delta, -1.0 / camera.zoom)
|
||||||
camera.target = pyray.vector2_add(camera.target, delta)
|
camera.target = pyray.vector2_add(camera.target, delta)
|
||||||
|
@ -57,7 +58,7 @@ while not pyray.window_should_close():
|
||||||
|
|
||||||
pyray.end_mode_2d()
|
pyray.end_mode_2d()
|
||||||
|
|
||||||
pyray.draw_text("Mouse right button drag to move, mouse wheel to zoom", 10, 10, 20, pyray.WHITE)
|
pyray.draw_text("Mouse right button drag to move, mouse wheel to zoom", 10, 10, 20, pyray.WHITE);
|
||||||
|
|
||||||
pyray.end_drawing()
|
pyray.end_drawing()
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
raylib [core] example - 2D Camera platformer
|
raylib [core] example - 2d camera platformer
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
|
|
||||||
import pyray
|
import pyray
|
||||||
from pyray import (
|
from raylib.colors import (
|
||||||
DARKGRAY,
|
DARKGRAY,
|
||||||
RED,
|
RED,
|
||||||
BLACK,
|
BLACK,
|
||||||
|
@ -14,6 +14,8 @@ from pyray import (
|
||||||
LIGHTGRAY,
|
LIGHTGRAY,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
global g_evening_out, g_even_out_target
|
global g_evening_out, g_even_out_target
|
||||||
g_evening_out = False
|
g_evening_out = False
|
||||||
|
@ -25,7 +27,8 @@ PLAYER_HOR_SPD = 200.0
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, 'raylib [core] example - 2d camera')
|
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
'raylib [core] example - 2d camera')
|
||||||
|
|
||||||
|
|
||||||
# Raylib Math
|
# Raylib Math
|
||||||
|
@ -62,11 +65,11 @@ class EnvItem:
|
||||||
|
|
||||||
|
|
||||||
def update_player(player, env_items, delta):
|
def update_player(player, env_items, delta):
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT):
|
if pyray.is_key_down(pyray.KEY_LEFT):
|
||||||
player.position.x -= PLAYER_HOR_SPD * delta
|
player.position.x -= PLAYER_HOR_SPD * delta
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_RIGHT):
|
if pyray.is_key_down(pyray.KEY_RIGHT):
|
||||||
player.position.x += PLAYER_HOR_SPD * delta
|
player.position.x += PLAYER_HOR_SPD * delta
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_SPACE) and player.can_jump:
|
if pyray.is_key_down(pyray.KEY_SPACE) and player.can_jump:
|
||||||
player.speed = -PLAYER_JUMP_SPD
|
player.speed = -PLAYER_JUMP_SPD
|
||||||
player.can_jump = False
|
player.can_jump = False
|
||||||
|
|
||||||
|
@ -74,11 +77,11 @@ def update_player(player, env_items, delta):
|
||||||
for ei in env_items:
|
for ei in env_items:
|
||||||
p = player.position
|
p = player.position
|
||||||
if (
|
if (
|
||||||
ei.blocking and
|
ei.blocking and
|
||||||
ei.rect.x <= p.x and
|
ei.rect.x <= p.x and
|
||||||
ei.rect.x + ei.rect.width >= p.x and
|
ei.rect.x + ei.rect.width >= p.x and
|
||||||
ei.rect.y >= p.y and
|
ei.rect.y >= p.y and
|
||||||
ei.rect.y < p.y + player.speed * delta
|
ei.rect.y < p.y + player.speed * delta
|
||||||
):
|
):
|
||||||
hit_obstacle = True
|
hit_obstacle = True
|
||||||
player.speed = 0.0
|
player.speed = 0.0
|
||||||
|
@ -93,14 +96,14 @@ def update_player(player, env_items, delta):
|
||||||
|
|
||||||
|
|
||||||
def update_camera_center(
|
def update_camera_center(
|
||||||
camera, player, env_items, delta, width, height
|
camera, player, env_items, delta, width, height
|
||||||
):
|
):
|
||||||
camera.offset = pyray.Vector2(width / 2, height / 2)
|
camera.offset = pyray.Vector2(width / 2, height / 2)
|
||||||
camera.target = player.position
|
camera.target = player.position
|
||||||
|
|
||||||
|
|
||||||
def update_camera_center_inside_map(
|
def update_camera_center_inside_map(
|
||||||
camera, player, env_items, delta, width, height
|
camera, player, env_items, delta, width, height
|
||||||
):
|
):
|
||||||
camera.target = player.position
|
camera.target = player.position
|
||||||
camera.offset = pyray.Vector2(width / 2, height / 2)
|
camera.offset = pyray.Vector2(width / 2, height / 2)
|
||||||
|
@ -131,7 +134,7 @@ def update_camera_center_inside_map(
|
||||||
|
|
||||||
|
|
||||||
def update_camera_center_smooth_follow(
|
def update_camera_center_smooth_follow(
|
||||||
camera, player, env_items, delta, width, height
|
camera, player, env_items, delta, width, height
|
||||||
):
|
):
|
||||||
min_speed = 30
|
min_speed = 30
|
||||||
min_effect_length = 10
|
min_effect_length = 10
|
||||||
|
@ -149,7 +152,7 @@ def update_camera_center_smooth_follow(
|
||||||
|
|
||||||
|
|
||||||
def update_camera_even_out_on_landing(
|
def update_camera_even_out_on_landing(
|
||||||
camera, player, env_items, delta, width, height
|
camera, player, env_items, delta, width, height
|
||||||
):
|
):
|
||||||
global g_evening_out, g_even_out_target
|
global g_evening_out, g_even_out_target
|
||||||
|
|
||||||
|
@ -172,16 +175,16 @@ def update_camera_even_out_on_landing(
|
||||||
g_evening_out = False
|
g_evening_out = False
|
||||||
else:
|
else:
|
||||||
if (
|
if (
|
||||||
player.can_jump and
|
player.can_jump and
|
||||||
(player.speed == 0) and
|
(player.speed == 0) and
|
||||||
(player.position.y != camera.target.y)
|
(player.position.y != camera.target.y)
|
||||||
):
|
):
|
||||||
g_evening_out = True
|
g_evening_out = True
|
||||||
g_even_out_target = player.position.y
|
g_even_out_target = player.position.y
|
||||||
|
|
||||||
|
|
||||||
def update_camera_player_bounds_push(
|
def update_camera_player_bounds_push(
|
||||||
camera, player, env_items, delta, width, height
|
camera, player, env_items, delta, width, height
|
||||||
):
|
):
|
||||||
bbox = pyray.Vector2(0.2, 0.2)
|
bbox = pyray.Vector2(0.2, 0.2)
|
||||||
|
|
||||||
|
@ -204,11 +207,11 @@ def update_camera_player_bounds_push(
|
||||||
camera.target.y = player.position.y
|
camera.target.y = player.position.y
|
||||||
if player.position.x > bbox_world_max.x:
|
if player.position.x > bbox_world_max.x:
|
||||||
camera.target.x = (
|
camera.target.x = (
|
||||||
bbox_world_min.x + (player.position.x - bbox_world_max.x)
|
bbox_world_min.x + (player.position.x - bbox_world_max.x)
|
||||||
)
|
)
|
||||||
if player.position.y > bbox_world_max.y:
|
if player.position.y > bbox_world_max.y:
|
||||||
camera.target.y = (
|
camera.target.y = (
|
||||||
bbox_world_min.y + (player.position.y - bbox_world_max.y)
|
bbox_world_min.y + (player.position.y - bbox_world_max.y)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,11 +267,11 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
elif camera.zoom < 0.25:
|
elif camera.zoom < 0.25:
|
||||||
camera.zoom = 0.25
|
camera.zoom = 0.25
|
||||||
|
|
||||||
if pyray.is_key_pressed(pyray.KeyboardKey.KEY_R):
|
if pyray.is_key_pressed(pyray.KEY_R):
|
||||||
camera.zoom = 1.0
|
camera.zoom = 1.0
|
||||||
player.position = pyray.Vector2(400, 280)
|
player.position = pyray.Vector2(400, 280)
|
||||||
|
|
||||||
if pyray.is_key_pressed(pyray.KeyboardKey.KEY_C):
|
if pyray.is_key_pressed(pyray.KEY_C):
|
||||||
camera_option = (camera_option + 1) % camera_updaters_length
|
camera_option = (camera_option + 1) % camera_updaters_length
|
||||||
|
|
||||||
# Call update camera function by its pointer
|
# Call update camera function by its pointer
|
||||||
|
|
|
@ -10,7 +10,7 @@ MAX_COLUMNS = 20
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - 3d camera first person")
|
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, b"raylib [core] example - 3d camera first person")
|
||||||
|
|
||||||
# Define the camera to look into our 3d world (position, target, up vector)
|
# Define the camera to look into our 3d world (position, target, up vector)
|
||||||
camera = pyray.Camera3D()
|
camera = pyray.Camera3D()
|
||||||
|
@ -18,24 +18,24 @@ camera.position = pyray.Vector3(4.0, 2.0, 4.0)
|
||||||
camera.target = pyray.Vector3(0.0, 1.8, 0.0)
|
camera.target = pyray.Vector3(0.0, 1.8, 0.0)
|
||||||
camera.up = pyray.Vector3(0.0, 1.0, 0.0)
|
camera.up = pyray.Vector3(0.0, 1.0, 0.0)
|
||||||
camera.fovy = 60.0
|
camera.fovy = 60.0
|
||||||
camera.projection = pyray.CameraProjection.CAMERA_PERSPECTIVE
|
camera.projection = pyray.CAMERA_PERSPECTIVE
|
||||||
|
|
||||||
# Generates some random columns
|
# Generates some random columns
|
||||||
heights = []
|
heights = [None] * MAX_COLUMNS
|
||||||
positions = []
|
positions = [None] * MAX_COLUMNS
|
||||||
colors = []
|
colors = [None] * MAX_COLUMNS
|
||||||
|
|
||||||
for i in range(MAX_COLUMNS):
|
for i in range(MAX_COLUMNS):
|
||||||
heights.append(pyray.get_random_value(1, 12) * 1.0)
|
heights[i] = pyray.get_random_value(1, 12) * 1.0
|
||||||
positions.append(pyray.Vector3(pyray.get_random_value(-15, 15) * 1.0, heights[i]/2.0 * 1.0, pyray.get_random_value(-15, 15) * 1.0))
|
positions[i] = pyray.Vector3(pyray.get_random_value(-15, 15) * 1.0, heights[i]/2.0 * 1.0, pyray.get_random_value(-15, 15) * 1.0)
|
||||||
colors.append(pyray.Color(pyray.get_random_value(20, 255), pyray.get_random_value(10, 55), 30, 255))
|
colors[i] = pyray.Color(pyray.get_random_value(20, 255), pyray.get_random_value(10, 55), 30, 255)
|
||||||
|
|
||||||
|
|
||||||
pyray.set_target_fps(60)
|
pyray.set_target_fps(60)
|
||||||
|
|
||||||
while not pyray.window_should_close():
|
while not pyray.window_should_close():
|
||||||
|
|
||||||
pyray.update_camera(camera, pyray.CameraMode.CAMERA_FIRST_PERSON)
|
pyray.update_camera(camera, pyray.CAMERA_FIRST_PERSON)
|
||||||
|
|
||||||
pyray.begin_drawing()
|
pyray.begin_drawing()
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from raylib import Fade
|
||||||
|
import pyray
|
||||||
from pyray import *
|
from pyray import *
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
|
@ -12,7 +14,7 @@ camera.position = Vector3(10.0, 10.0, 10.0) # Camera position
|
||||||
camera.target = Vector3(0.0, 0.0, 0.0) # Camera looking at point
|
camera.target = Vector3(0.0, 0.0, 0.0) # Camera looking at point
|
||||||
camera.up = Vector3(0.0, 1.0, 0.0) # Camera up vector (rotation towards target)
|
camera.up = Vector3(0.0, 1.0, 0.0) # Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0 # Camera field-of-view Y
|
camera.fovy = 45.0 # Camera field-of-view Y
|
||||||
camera.projection = CameraProjection.CAMERA_PERSPECTIVE # Camera projection type
|
camera.projection = pyray.CAMERA_PERSPECTIVE # Camera projection type
|
||||||
|
|
||||||
cubePosition = Vector3(0.0, 0.0, 0.0)
|
cubePosition = Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
@ -23,9 +25,9 @@ set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
# Main game loop
|
# Main game loop
|
||||||
while not window_should_close(): # Detect window close button or ESC key
|
while not window_should_close(): # Detect window close button or ESC key
|
||||||
# Update
|
# Update
|
||||||
update_camera(camera, CameraMode.CAMERA_FREE)
|
update_camera(camera, pyray.CAMERA_FREE)
|
||||||
|
|
||||||
if is_key_pressed(KeyboardKey.KEY_Z):
|
if is_key_down(pyray.KEY_Z):
|
||||||
camera.target = Vector3(0.0, 0.0, 0.0)
|
camera.target = Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
# Draw
|
# Draw
|
||||||
|
@ -42,8 +44,8 @@ while not window_should_close(): # Detect window close button or ESC key
|
||||||
|
|
||||||
end_mode_3d()
|
end_mode_3d()
|
||||||
|
|
||||||
draw_rectangle(10, 10, 320, 93, fade(SKYBLUE, 0.5))
|
draw_rectangle(10, 10, 320, 133, Fade(SKYBLUE, 0.5))
|
||||||
draw_rectangle_lines(10, 10, 320, 93, BLUE)
|
draw_rectangle_lines(10, 10, 320, 133, BLUE)
|
||||||
|
|
||||||
draw_text("Free camera default controls:", 20, 20, 10, BLACK)
|
draw_text("Free camera default controls:", 20, 20, 10, BLACK)
|
||||||
draw_text("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY)
|
draw_text("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY)
|
|
@ -17,7 +17,7 @@ camera.position = pyray.Vector3(0.0, 10.0, 10.0) # Camera position
|
||||||
camera.target = pyray.Vector3(0.0, 0.0, 0.0) # Camera looking at point
|
camera.target = pyray.Vector3(0.0, 0.0, 0.0) # Camera looking at point
|
||||||
camera.up = pyray.Vector3(0.0, 1.0, 0.0) # Camera up vector (rotation towards target)
|
camera.up = pyray.Vector3(0.0, 1.0, 0.0) # Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0 # Camera field-of-view Y
|
camera.fovy = 45.0 # Camera field-of-view Y
|
||||||
camera.projection = pyray.CameraProjection.CAMERA_PERSPECTIVE # Camera mode type
|
camera.projection = pyray.CAMERA_PERSPECTIVE # Camera mode type
|
||||||
|
|
||||||
cube_position = pyray.Vector3(0.0, 0.0, 0.0)
|
cube_position = pyray.Vector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ while not pyray.window_should_close():
|
||||||
|
|
||||||
pyray.end_mode_3d()
|
pyray.end_mode_3d()
|
||||||
|
|
||||||
pyray.draw_text("Welcome to the third dimension!", 10, 40, 20, pyray.DARKGRAY)
|
pyray.draw_text("Welcome to the third dimension!", 10, 40, 20, pyray.DARKGRAY);
|
||||||
|
|
||||||
pyray.draw_fps(10, 10)
|
pyray.draw_fps(10, 10)
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ class GameScreen(Enum):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - basic screen manager")
|
init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
"raylib [core] example - basic screen manager")
|
||||||
|
|
||||||
frame_count = 0
|
frame_count = 0
|
||||||
set_target_fps(60)
|
set_target_fps(60)
|
||||||
|
@ -27,13 +28,13 @@ def main():
|
||||||
if frame_count > 120:
|
if frame_count > 120:
|
||||||
current_screen = GameScreen.TITLE
|
current_screen = GameScreen.TITLE
|
||||||
elif current_screen == GameScreen.TITLE:
|
elif current_screen == GameScreen.TITLE:
|
||||||
if is_key_pressed(KeyboardKey.KEY_ENTER) or is_gesture_detected(Gesture.GESTURE_TAP):
|
if is_key_pressed(KEY_ENTER) or is_gesture_detected(GESTURE_TAP):
|
||||||
current_screen = GameScreen.GAMEPLAY
|
current_screen = GameScreen.GAMEPLAY
|
||||||
elif current_screen == GameScreen.GAMEPLAY:
|
elif current_screen == GameScreen.GAMEPLAY:
|
||||||
if is_key_pressed(KeyboardKey.KEY_ENTER) or is_gesture_detected(Gesture.GESTURE_TAP):
|
if is_key_pressed(KEY_ENTER) or is_gesture_detected(GESTURE_TAP):
|
||||||
current_screen = GameScreen.ENDING
|
current_screen = GameScreen.ENDING
|
||||||
elif current_screen == GameScreen.ENDING:
|
elif current_screen == GameScreen.ENDING:
|
||||||
if is_key_pressed(KeyboardKey.KEY_ENTER) or is_gesture_detected(Gesture.GESTURE_TAP):
|
if is_key_pressed(KEY_ENTER) or is_gesture_detected(GESTURE_TAP):
|
||||||
current_screen = GameScreen.TITLE
|
current_screen = GameScreen.TITLE
|
||||||
|
|
||||||
begin_drawing()
|
begin_drawing()
|
||||||
|
|
|
@ -4,12 +4,21 @@ raylib [core] example - Basic window
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pyray
|
import pyray
|
||||||
|
from raylib.colors import (
|
||||||
|
RAYWHITE,
|
||||||
|
LIGHTGRAY,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, 'raylib [core] example - basic window')
|
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
'raylib [core] example - basic window')
|
||||||
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,9 +30,9 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
# Draw
|
# Draw
|
||||||
pyray.begin_drawing()
|
pyray.begin_drawing()
|
||||||
|
|
||||||
pyray.clear_background(pyray.RAYWHITE)
|
pyray.clear_background(RAYWHITE)
|
||||||
pyray.draw_text(
|
pyray.draw_text(
|
||||||
'Congrats! You created your first window!', 190, 200, 20, pyray.LIGHTGRAY)
|
'Congrats! You created your first window!', 190, 200, 20, LIGHTGRAY)
|
||||||
|
|
||||||
pyray.end_drawing()
|
pyray.end_drawing()
|
||||||
|
|
||||||
|
|
|
@ -11,41 +11,54 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pyray
|
import pyray
|
||||||
|
from raylib.colors import (
|
||||||
|
RAYWHITE,
|
||||||
|
DARKGRAY,
|
||||||
|
LIGHTGRAY,
|
||||||
|
GRAY
|
||||||
|
)
|
||||||
|
|
||||||
screenWidth = 800
|
screenWidth = 800
|
||||||
screenHeight = 450
|
screenHeight = 450
|
||||||
|
|
||||||
pyray.init_window(screenWidth, screenHeight, 'raylib [core] example - drop files')
|
pyray.init_window(screenWidth, screenHeight,
|
||||||
|
'raylib [core] example - drop files')
|
||||||
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
droppedFiles = pyray.FilePathList()
|
|
||||||
|
|
||||||
|
|
||||||
|
count_pointer = pyray.ffi.new("int *", 0)
|
||||||
|
count = 0
|
||||||
|
|
||||||
while not pyray.window_should_close():
|
while not pyray.window_should_close():
|
||||||
|
|
||||||
if pyray.is_file_dropped():
|
if pyray.is_file_dropped():
|
||||||
droppedFiles = pyray.load_dropped_files()
|
droppedFiles_pointer = pyray.get_dropped_files(count_pointer)
|
||||||
|
count = count_pointer[0]
|
||||||
|
# This isn't actually necessary unless you want a Python array:
|
||||||
|
droppedFiles = pyray.ffi.unpack(droppedFiles_pointer, count)
|
||||||
|
|
||||||
pyray.begin_drawing()
|
pyray.begin_drawing()
|
||||||
|
|
||||||
pyray.clear_background(pyray.RAYWHITE)
|
pyray.clear_background(RAYWHITE)
|
||||||
|
|
||||||
if droppedFiles.count == 0:
|
if count == 0:
|
||||||
pyray.draw_text("Drop your files to this window!", 100, 40, 20, pyray.DARKGRAY)
|
pyray.draw_text("Drop your files to this window!", 100, 40, 20, DARKGRAY)
|
||||||
else:
|
else:
|
||||||
pyray.draw_text("Dropped files:", 100, 40, 20, pyray.DARKGRAY)
|
pyray.draw_text("Dropped files:", 100, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
for i in range(0, droppedFiles.count):
|
for i in range(0, count):
|
||||||
if i % 2 == 0:
|
if i % 2 == 0:
|
||||||
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(pyray.LIGHTGRAY, 0.5))
|
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(LIGHTGRAY, 0.5))
|
||||||
else:
|
else:
|
||||||
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(pyray.LIGHTGRAY, 0.3))
|
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(LIGHTGRAY, 0.3))
|
||||||
pyray.draw_text(droppedFiles.paths[i], 120, 100 + 40*i, 10, pyray.GRAY)
|
filename = pyray.ffi.string(droppedFiles[i]).decode('utf-8')
|
||||||
|
# This alternative works too if you don't have a Python array:
|
||||||
|
# filename = pyray.ffi.string(droppedFiles_pointer[i]).decode('utf-8')
|
||||||
|
pyray.draw_text(filename, 120, 100 + 40*i, 10, GRAY)
|
||||||
|
|
||||||
pyray.draw_text("Drop new files...", 100, 110 + 40*droppedFiles.count, 20, pyray.DARKGRAY)
|
pyray.draw_text("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
|
||||||
pyray.end_drawing()
|
pyray.end_drawing()
|
||||||
|
|
||||||
# De-Initialization
|
# De-Initialization
|
||||||
|
pyray.clear_dropped_files()
|
||||||
pyray.close_window() # Close window and OpenGL context
|
pyray.close_window() # Close window and OpenGL context
|
||||||
|
|
65
examples/core/core_drop_files2.py
Normal file
65
examples/core/core_drop_files2.py
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
* raylib [core] example - Windows drop files
|
||||||
|
*
|
||||||
|
* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
"""
|
||||||
|
import pyray
|
||||||
|
from raylib.colors import (
|
||||||
|
RAYWHITE,
|
||||||
|
DARKGRAY,
|
||||||
|
LIGHTGRAY,
|
||||||
|
GRAY
|
||||||
|
)
|
||||||
|
|
||||||
|
screenWidth = 800
|
||||||
|
screenHeight = 450
|
||||||
|
|
||||||
|
pyray.init_window(screenWidth, screenHeight,
|
||||||
|
'raylib [core] example - drop files')
|
||||||
|
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
|
droppedFiles = []
|
||||||
|
|
||||||
|
def get_dropped_files():
|
||||||
|
count_pointer = pyray.ffi.new("int *", 0)
|
||||||
|
droppedFiles_pointer = pyray.get_dropped_files(count_pointer)
|
||||||
|
d = []
|
||||||
|
for i in range(0, count_pointer[0]):
|
||||||
|
d.append(pyray.ffi.string(droppedFiles_pointer[i]).decode('utf-8'))
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
while not pyray.window_should_close():
|
||||||
|
|
||||||
|
if pyray.is_file_dropped():
|
||||||
|
droppedFiles = get_dropped_files()
|
||||||
|
|
||||||
|
pyray.begin_drawing()
|
||||||
|
|
||||||
|
pyray.clear_background(RAYWHITE)
|
||||||
|
|
||||||
|
if len(droppedFiles) == 0:
|
||||||
|
pyray.draw_text("Drop your files to this window!", 100, 40, 20, DARKGRAY)
|
||||||
|
else:
|
||||||
|
pyray.draw_text("Dropped files:", 100, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
|
for i in range(0, len(droppedFiles)):
|
||||||
|
if i % 2 == 0:
|
||||||
|
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(LIGHTGRAY, 0.5))
|
||||||
|
else:
|
||||||
|
pyray.draw_rectangle(0, 85 + 40*i, screenWidth, 40, pyray.fade(LIGHTGRAY, 0.3))
|
||||||
|
pyray.draw_text(droppedFiles[i], 120, 100 + 40*i, 10, GRAY)
|
||||||
|
|
||||||
|
pyray.draw_text("Drop new files...", 100, 110 + 40*len(droppedFiles), 20, DARKGRAY);
|
||||||
|
pyray.end_drawing()
|
||||||
|
|
||||||
|
# De-Initialization
|
||||||
|
pyray.clear_dropped_files()
|
||||||
|
pyray.close_window() # Close window and OpenGL context
|
|
@ -4,6 +4,13 @@ raylib [core] example - Input Gestures Detection
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pyray
|
import pyray
|
||||||
|
from raylib.colors import (
|
||||||
|
RAYWHITE,
|
||||||
|
LIGHTGRAY,
|
||||||
|
DARKGRAY,
|
||||||
|
MAROON,
|
||||||
|
GRAY,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,27 +19,28 @@ MAX_GESTURE_STRINGS = 20
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, 'raylib [core] example - input gestures')
|
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
'raylib [core] example - input gestures')
|
||||||
|
|
||||||
touch_position = pyray.Vector2(0, 0)
|
touch_position = pyray.Vector2(0, 0)
|
||||||
touch_area = pyray.Rectangle(220, 10, SCREEN_WIDTH - 230, SCREEN_HEIGHT - 20)
|
touch_area = pyray.Rectangle(220, 10, SCREEN_WIDTH - 230, SCREEN_HEIGHT - 20)
|
||||||
|
|
||||||
gesture_strings = []
|
gesture_strings = []
|
||||||
|
|
||||||
current_gesture = pyray.Gesture.GESTURE_NONE
|
current_gesture = pyray.GESTURE_NONE
|
||||||
last_gesture = pyray.Gesture.GESTURE_NONE
|
last_gesture = pyray.GESTURE_NONE
|
||||||
|
|
||||||
GESTURE_LABELS = {
|
GESTURE_LABELS = {
|
||||||
pyray.Gesture.GESTURE_TAP: 'GESTURE TAP',
|
pyray.GESTURE_TAP: 'GESTURE TAP',
|
||||||
pyray.Gesture.GESTURE_DOUBLETAP: 'GESTURE DOUBLETAP',
|
pyray.GESTURE_DOUBLETAP: 'GESTURE DOUBLETAP',
|
||||||
pyray.Gesture.GESTURE_HOLD: 'GESTURE HOLD',
|
pyray.GESTURE_HOLD: 'GESTURE HOLD',
|
||||||
pyray.Gesture.GESTURE_DRAG: 'GESTURE DRAG',
|
pyray.GESTURE_DRAG: 'GESTURE DRAG',
|
||||||
pyray.Gesture.GESTURE_SWIPE_RIGHT: 'GESTURE SWIPE RIGHT',
|
pyray.GESTURE_SWIPE_RIGHT: 'GESTURE SWIPE RIGHT',
|
||||||
pyray.Gesture.GESTURE_SWIPE_LEFT: 'GESTURE SWIPE LEFT',
|
pyray.GESTURE_SWIPE_LEFT: 'GESTURE SWIPE LEFT',
|
||||||
pyray.Gesture.GESTURE_SWIPE_UP: 'GESTURE SWIPE UP',
|
pyray.GESTURE_SWIPE_UP: 'GESTURE SWIPE UP',
|
||||||
pyray.Gesture.GESTURE_SWIPE_DOWN: 'GESTURE SWIPE DOWN',
|
pyray.GESTURE_SWIPE_DOWN: 'GESTURE SWIPE DOWN',
|
||||||
pyray.Gesture.GESTURE_PINCH_IN: 'GESTURE PINCH IN',
|
pyray.GESTURE_PINCH_IN: 'GESTURE PINCH IN',
|
||||||
pyray.Gesture.GESTURE_PINCH_OUT: 'GESTURE PINCH OUT',
|
pyray.GESTURE_PINCH_OUT: 'GESTURE PINCH OUT',
|
||||||
}
|
}
|
||||||
|
|
||||||
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
@ -47,7 +55,7 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pyray.check_collision_point_rec(touch_position, touch_area)
|
pyray.check_collision_point_rec(touch_position, touch_area)
|
||||||
and current_gesture != pyray.Gesture.GESTURE_NONE
|
and current_gesture != pyray.GESTURE_NONE
|
||||||
):
|
):
|
||||||
if current_gesture != last_gesture:
|
if current_gesture != last_gesture:
|
||||||
gesture_strings.append(GESTURE_LABELS[current_gesture])
|
gesture_strings.append(GESTURE_LABELS[current_gesture])
|
||||||
|
@ -59,34 +67,34 @@ while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
# Draw
|
# Draw
|
||||||
pyray.begin_drawing()
|
pyray.begin_drawing()
|
||||||
|
|
||||||
pyray.clear_background(pyray.RAYWHITE)
|
pyray.clear_background(RAYWHITE)
|
||||||
|
|
||||||
pyray.draw_rectangle_rec(touch_area, pyray.GRAY)
|
pyray.draw_rectangle_rec(touch_area, GRAY)
|
||||||
pyray.draw_rectangle(225, 15, SCREEN_WIDTH - 240, SCREEN_HEIGHT - 30,
|
pyray.draw_rectangle(225, 15, SCREEN_WIDTH - 240, SCREEN_HEIGHT - 30,
|
||||||
pyray.RAYWHITE)
|
RAYWHITE)
|
||||||
pyray.draw_text(
|
pyray.draw_text(
|
||||||
'GESTURES TEST AREA',
|
'GESTURES TEST AREA',
|
||||||
SCREEN_WIDTH - 270, SCREEN_HEIGHT - 40, 20, pyray.fade(pyray.GRAY, 0.5)
|
SCREEN_WIDTH - 270, SCREEN_HEIGHT - 40, 20, pyray.fade(GRAY, 0.5)
|
||||||
)
|
)
|
||||||
|
|
||||||
for i, val in enumerate(gesture_strings):
|
for i, val in enumerate(gesture_strings):
|
||||||
if i % 2 == 0:
|
if i % 2 == 0:
|
||||||
pyray.draw_rectangle(
|
pyray.draw_rectangle(
|
||||||
10, 30 + 20 * i, 200, 20, pyray.fade(pyray.LIGHTGRAY, 0.5))
|
10, 30 + 20 * i, 200, 20, pyray.fade(LIGHTGRAY, 0.5))
|
||||||
else:
|
else:
|
||||||
pyray.draw_rectangle(
|
pyray.draw_rectangle(
|
||||||
10, 30 + 20 * i, 200, 20, pyray.fade(pyray.LIGHTGRAY, 0.3))
|
10, 30 + 20 * i, 200, 20, pyray.fade(LIGHTGRAY, 0.3))
|
||||||
|
|
||||||
if i < len(gesture_strings) - 1:
|
if i < len(gesture_strings) - 1:
|
||||||
pyray.draw_text(val, 35, 36 + 20 * i, 10, pyray.DARKGRAY)
|
pyray.draw_text(val, 35, 36 + 20 * i, 10, DARKGRAY)
|
||||||
else:
|
else:
|
||||||
pyray.draw_text(val, 35, 36 + 20 * i, 10, pyray.MAROON)
|
pyray.draw_text(val, 35, 36 + 20 * i, 10, MAROON)
|
||||||
|
|
||||||
pyray.draw_rectangle_lines(10, 29, 200, SCREEN_HEIGHT - 50, pyray.GRAY)
|
pyray.draw_rectangle_lines(10, 29, 200, SCREEN_HEIGHT - 50, GRAY)
|
||||||
pyray.draw_text('DETECTED GESTURES', 50, 15, 10, pyray.GRAY)
|
pyray.draw_text('DETECTED GESTURES', 50, 15, 10, GRAY)
|
||||||
|
|
||||||
if current_gesture != pyray.Gesture.GESTURE_NONE:
|
if current_gesture != pyray.GESTURE_NONE:
|
||||||
pyray.draw_circle_v(touch_position, 30, pyray.MAROON)
|
pyray.draw_circle_v(touch_position, 30, MAROON)
|
||||||
|
|
||||||
pyray.end_drawing()
|
pyray.end_drawing()
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,21 @@ raylib [core] example - Keyboard input
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pyray
|
import pyray
|
||||||
|
from raylib.colors import (
|
||||||
|
RAYWHITE,
|
||||||
|
DARKGRAY,
|
||||||
|
MAROON,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, 'raylib [core] example - keyboard input')
|
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
'raylib [core] example - keyboard input')
|
||||||
ball_position = pyray.Vector2(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)
|
ball_position = pyray.Vector2(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)
|
||||||
|
|
||||||
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
@ -19,21 +27,21 @@ pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
# Main game loop
|
# Main game loop
|
||||||
while not pyray.window_should_close(): # Detect window close button or ESC key
|
while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||||
# Update
|
# Update
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_RIGHT):
|
if pyray.is_key_down(pyray.KEY_RIGHT):
|
||||||
ball_position.x += 2
|
ball_position.x += 2
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT):
|
if pyray.is_key_down(pyray.KEY_LEFT):
|
||||||
ball_position.x -= 2
|
ball_position.x -= 2
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_UP):
|
if pyray.is_key_down(pyray.KEY_UP):
|
||||||
ball_position.y -= 2
|
ball_position.y -= 2
|
||||||
if pyray.is_key_down(pyray.KeyboardKey.KEY_DOWN):
|
if pyray.is_key_down(pyray.KEY_DOWN):
|
||||||
ball_position.y += 2
|
ball_position.y += 2
|
||||||
|
|
||||||
# Draw
|
# Draw
|
||||||
pyray.begin_drawing()
|
pyray.begin_drawing()
|
||||||
|
|
||||||
pyray.clear_background(pyray.RAYWHITE)
|
pyray.clear_background(RAYWHITE)
|
||||||
pyray.draw_text('move the ball with arrow keys', 10, 10, 20, pyray.DARKGRAY)
|
pyray.draw_text('move the ball with arrow keys', 10, 10, 20, DARKGRAY)
|
||||||
pyray.draw_circle_v(ball_position, 50, pyray.MAROON)
|
pyray.draw_circle_v(ball_position, 50, MAROON)
|
||||||
|
|
||||||
pyray.end_drawing()
|
pyray.end_drawing()
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,33 @@ raylib [core] example - Mouse input
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from pyray import *
|
from pyray import *
|
||||||
|
from raylib.colors import (
|
||||||
|
RAYWHITE,
|
||||||
|
DARKGRAY,
|
||||||
|
MAROON,
|
||||||
|
LIME,
|
||||||
|
DARKBLUE,
|
||||||
|
PURPLE,
|
||||||
|
YELLOW,
|
||||||
|
ORANGE,
|
||||||
|
BEIGE,
|
||||||
|
)
|
||||||
|
from raylib import (
|
||||||
|
MOUSE_BUTTON_LEFT,
|
||||||
|
MOUSE_BUTTON_MIDDLE,
|
||||||
|
MOUSE_BUTTON_RIGHT,
|
||||||
|
MOUSE_BUTTON_SIDE,
|
||||||
|
MOUSE_BUTTON_EXTRA,
|
||||||
|
MOUSE_BUTTON_FORWARD,
|
||||||
|
MOUSE_BUTTON_BACK
|
||||||
|
)
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
SCREEN_WIDTH = 800
|
SCREEN_WIDTH = 800
|
||||||
SCREEN_HEIGHT = 450
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, 'raylib [core] example - mouse input')
|
init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||||
|
'raylib [core] example - mouse input')
|
||||||
|
|
||||||
ball_position = Vector2(-100, -100)
|
ball_position = Vector2(-100, -100)
|
||||||
ball_color = DARKBLUE
|
ball_color = DARKBLUE
|
||||||
|
@ -22,19 +42,19 @@ while not window_should_close(): # Detect window close button or ESC key
|
||||||
# Update
|
# Update
|
||||||
ball_position = get_mouse_position()
|
ball_position = get_mouse_position()
|
||||||
|
|
||||||
if is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_LEFT):
|
if is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||||
ball_color = MAROON
|
ball_color = MAROON
|
||||||
elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_MIDDLE):
|
elif is_mouse_button_pressed(MOUSE_BUTTON_MIDDLE):
|
||||||
ball_color = LIME
|
ball_color = LIME
|
||||||
elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_RIGHT):
|
elif is_mouse_button_pressed(MOUSE_BUTTON_RIGHT):
|
||||||
ball_color = DARKBLUE
|
ball_color = DARKBLUE
|
||||||
elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_SIDE):
|
elif is_mouse_button_pressed(MOUSE_BUTTON_SIDE):
|
||||||
ball_color = PURPLE
|
ball_color = PURPLE
|
||||||
elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_EXTRA):
|
elif is_mouse_button_pressed(MOUSE_BUTTON_EXTRA):
|
||||||
ball_color = YELLOW
|
ball_color = YELLOW
|
||||||
elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_FORWARD):
|
elif is_mouse_button_pressed(MOUSE_BUTTON_FORWARD):
|
||||||
ball_color = ORANGE
|
ball_color = ORANGE
|
||||||
elif is_mouse_button_pressed(MouseButton.MOUSE_BUTTON_BACK):
|
elif is_mouse_button_pressed(MOUSE_BUTTON_BACK):
|
||||||
ball_color = BEIGE
|
ball_color = BEIGE
|
||||||
# Draw
|
# Draw
|
||||||
begin_drawing()
|
begin_drawing()
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue