Compare commits
No commits in common. "master" and "2.6.0" have entirely different histories.
307 changed files with 27573 additions and 82585 deletions
157
.cirrus.yml
157
.cirrus.yml
|
@ -1,157 +0,0 @@
|
||||||
# download at https://api.cirrus-ci.com/v1/artifact/github/electronstudio/raylib-python-cffi/pi/binary.zip
|
|
||||||
# https://api.cirrus-ci.com/v1/artifact/github/electronstudio/raylib-python-cffi/mac/binary.zip
|
|
||||||
|
|
||||||
pi_task:
|
|
||||||
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:
|
|
||||||
macos_instance:
|
|
||||||
matrix:
|
|
||||||
- image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest
|
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
|
||||||
matrix:
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.9"
|
|
||||||
RAYLIB_PLATFORM: Desktop
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.9"
|
|
||||||
RAYLIB_PLATFORM: SDL
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.10"
|
|
||||||
RAYLIB_PLATFORM: Desktop
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.10"
|
|
||||||
RAYLIB_PLATFORM: SDL
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.11"
|
|
||||||
RAYLIB_PLATFORM: Desktop
|
|
||||||
- env:
|
|
||||||
PY_VER: "3.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:
|
|
||||||
- brew update
|
|
||||||
- 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:
|
|
||||||
- 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 -j8
|
|
||||||
- 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:
|
|
||||||
- sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
|
|
||||||
- sudo cp physac/src/physac.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 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 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:
|
|
||||||
path: "dist/*"
|
|
440
.github/workflows/build.yml
vendored
440
.github/workflows/build.yml
vendored
|
@ -1,440 +0,0 @@
|
||||||
name: Build
|
|
||||||
|
|
||||||
# Controls when the workflow will run
|
|
||||||
on:
|
|
||||||
# Triggers the workflow on push or pull request events but only for the master branch
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-mac-intel:
|
|
||||||
runs-on: macos-13
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
|
|
||||||
raylib-platform: ['Desktop', 'SDL']
|
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
|
||||||
steps:
|
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
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
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
|
||||||
architecture: x64
|
|
||||||
|
|
||||||
# Runs a set of commands using the runners shell
|
|
||||||
- name: Build raylib without SDL because SDL version has incorrect pkg-config
|
|
||||||
run: |
|
|
||||||
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
|
|
||||||
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
|
|
||||||
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 raygui/src/raygui.h /usr/local/include/
|
|
||||||
|
|
||||||
- name: Build raylib-python-cffi
|
|
||||||
env:
|
|
||||||
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip3 install "cffi>=1.17.1"
|
|
||||||
pip3 install wheel
|
|
||||||
pip3 install setuptools
|
|
||||||
python setup.py bdist_wheel --plat-name macosx_10_13_x86_64
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: |
|
|
||||||
pip3 install dist/*.whl
|
|
||||||
cd /
|
|
||||||
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
|
|
||||||
cat /tmp/output
|
|
||||||
if grep -q "INFO: Initializing raylib" /tmp/output; then
|
|
||||||
echo "Passed"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "Failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-mac-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
|
||||||
path: dist/*
|
|
||||||
|
|
||||||
# build-mac-universal:
|
|
||||||
# runs-on: macos-14
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ]
|
|
||||||
# raylib-platform: ['Desktop', 'SDL']
|
|
||||||
# env:
|
|
||||||
# MACOSX_DEPLOYMENT_TARGET: 11.0
|
|
||||||
# steps:
|
|
||||||
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
# - uses: actions/checkout@v4
|
|
||||||
# with:
|
|
||||||
# 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
|
|
||||||
# uses: actions/setup-python@v5
|
|
||||||
# with:
|
|
||||||
# # Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
||||||
# python-version: ${{ matrix.python-version }}
|
|
||||||
# architecture: arm64
|
|
||||||
#
|
|
||||||
# # Runs a set of commands using the runners shell
|
|
||||||
# - name: Build raylib without SDL because SDL version has incorrect pkg-config
|
|
||||||
# run: |
|
|
||||||
# cd raylib-c
|
|
||||||
# mkdir 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 ..
|
|
||||||
# make -j2
|
|
||||||
# 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
|
|
||||||
# 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 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
|
|
||||||
# # 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
|
|
||||||
# # given that there is no SDK for universal until macosx_11_0
|
|
||||||
# - 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_12_0_arm64
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
build-linux:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
strategy:
|
|
||||||
# You can use PyPy versions in python-version.
|
|
||||||
# For example, pypy2 and pypy3
|
|
||||||
matrix:
|
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
|
|
||||||
raylib-platform: ['Desktop', 'SDL', 'DRM']
|
|
||||||
steps:
|
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
|
||||||
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
|
|
||||||
- name: Build raylib
|
|
||||||
run: |
|
|
||||||
cd raylib-c
|
|
||||||
mkdir 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 ..
|
|
||||||
make -j2
|
|
||||||
sudo make install
|
|
||||||
- name: Copy extras
|
|
||||||
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 raygui/src/raygui.h /usr/local/include/
|
|
||||||
- name: Build raylib-python-cffi
|
|
||||||
env:
|
|
||||||
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip3 install "cffi>=1.17.1"
|
|
||||||
pip3 install wheel
|
|
||||||
pip3 install setuptools
|
|
||||||
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
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-linux-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
|
||||||
path: dist/*
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
build-windows:
|
|
||||||
# The type of runner that the job will run on
|
|
||||||
runs-on: windows-2019
|
|
||||||
strategy:
|
|
||||||
# You can use PyPy versions in python-version.
|
|
||||||
# For example, pypy2 and pypy3
|
|
||||||
matrix:
|
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
|
|
||||||
raylib-platform: ['Desktop', 'SDL']
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
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
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
|
||||||
architecture: x64
|
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
|
||||||
uses: microsoft/setup-msbuild@v2
|
|
||||||
|
|
||||||
- name: Build raylib
|
|
||||||
run: |
|
|
||||||
cd raylib-c
|
|
||||||
mkdir 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 ..
|
|
||||||
msbuild raylib.sln /target:raylib /property:Configuration=Release
|
|
||||||
copy raylib\Release\raylib.lib ..\..
|
|
||||||
cd ..\..
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
- name: Build raylib-python-cffi
|
|
||||||
env:
|
|
||||||
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
|
|
||||||
run: |
|
|
||||||
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.lib .
|
|
||||||
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.dll raylib\
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip3 install "cffi>=1.17.1"
|
|
||||||
pip3 install wheel
|
|
||||||
pip3 install setuptools
|
|
||||||
del raylib\dynamic\*.so* >nul 2>&1
|
|
||||||
del raylib\dynamic\*.dll >nul 2>&1
|
|
||||||
del raylib\dynamic\*.dylib >nul 2>&1
|
|
||||||
del raylib\dynamic\32bit\* >nul 2>&1
|
|
||||||
python setup.py bdist_wheel
|
|
||||||
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
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-windows-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
|
||||||
path: dist/*
|
|
||||||
|
|
||||||
source-distro:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
||||||
python-version: '3.12'
|
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
|
||||||
architecture: x64
|
|
||||||
|
|
||||||
- name: Build raylib
|
|
||||||
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
|
|
||||||
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
|
|
||||||
sudo make install
|
|
||||||
- name: Copy extras
|
|
||||||
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 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
|
|
||||||
python setup.py sdist
|
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-source
|
|
||||||
path: dist/*
|
|
||||||
|
|
||||||
dynamic-distro:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
|
|
||||||
python-version: '3.12'
|
|
||||||
# The target architecture (x86, x64) of the Python interpreter.
|
|
||||||
architecture: x64
|
|
||||||
|
|
||||||
- name: Build raylib-python-cffi-dynamic
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip3 install "cffi>=1.17.1"
|
|
||||||
pip3 install wheel
|
|
||||||
pip3 install setuptools
|
|
||||||
cd dynamic
|
|
||||||
python setup.py sdist
|
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
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:
|
|
||||||
name: wheel
|
|
||||||
pattern: wheel-*
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,8 +4,6 @@ __pycache__/
|
||||||
|
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
docs-src/_build
|
|
||||||
.idea/
|
|
||||||
.Python
|
.Python
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
|
|
9
.gitmodules
vendored
9
.gitmodules
vendored
|
@ -1,9 +0,0 @@
|
||||||
[submodule "raylib-c"]
|
|
||||||
path = raylib-c
|
|
||||||
url = https://git.terah.dev/UnrealXR/raylib.git
|
|
||||||
[submodule "raygui"]
|
|
||||||
path = raygui
|
|
||||||
url = https://github.com/raysan5/raygui.git
|
|
||||||
[submodule "physac"]
|
|
||||||
path = physac
|
|
||||||
url = https://github.com/victorfisac/Physac.git
|
|
216
BUILDING.rst
216
BUILDING.rst
|
@ -1,216 +0,0 @@
|
||||||
Building from source
|
|
||||||
====================
|
|
||||||
|
|
||||||
Have Pip build from source
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
This is useful if the binaries don’t work on your system, or you want to use a newer version of Raylib.
|
|
||||||
|
|
||||||
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: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake
|
|
||||||
|
|
||||||
Requirements for build: cmake, pkg-config.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-5.0
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Then ask Pip to build from source:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
|
|
||||||
|
|
||||||
Or, Build from source manually
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
Useful if the Pip build doesn’t work and you want to debug it, or you want to contribute to the
|
|
||||||
project.
|
|
||||||
|
|
||||||
.. attention::
|
|
||||||
If the Pip build doesn’t work, please submit a bug. (And if you have
|
|
||||||
fixed it, a PR.)
|
|
||||||
|
|
||||||
Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
|
|
||||||
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml
|
|
||||||
|
|
||||||
Windows manual build
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Clone this repo including submodules so you get correct version of
|
|
||||||
Raylib.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
|
||||||
|
|
||||||
Open Visual C++ command shell.
|
|
||||||
|
|
||||||
Fix the symlink that doesnt work on Windows
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-python-cffi
|
|
||||||
copy raylib-c\src\raylib.h raylib\raylib.h
|
|
||||||
|
|
||||||
Build and install Raylib from the raylib-c directory.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-python-cffi/raylib-c
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
msbuild raylib.sln /target:raylib /property:Configuration=Release
|
|
||||||
copy raylib\Release\raylib.lib ..\..
|
|
||||||
cd ..\..
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To build a binary wheel distribution:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
rmdir /Q /S build
|
|
||||||
pip3 install cffi
|
|
||||||
pip3 install wheel
|
|
||||||
python setup.py bdist_wheel
|
|
||||||
|
|
||||||
Then install it:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install dist\raylib-3.7.0-cp37-cp37m-win_amd64.whl
|
|
||||||
|
|
||||||
(Note: your wheel’s filename will probably be different than the one
|
|
||||||
here.)
|
|
||||||
|
|
||||||
Linux manual build
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Clone this repo including submodules so you get correct version of
|
|
||||||
Raylib.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
|
||||||
|
|
||||||
Build and install Raylib from the raylib-c directory.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
You can instead use a different version of Raylib you installed from elsewhere, and it should still
|
|
||||||
work!
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config cmake
|
|
||||||
cd raylib-python-cffi/raylib-c
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
|
||||||
``raylib_dynamic`` binding.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
rm -rf *
|
|
||||||
cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
|
|
||||||
Build the Python library:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install cffi
|
|
||||||
rm -rf build raylib/_raylib_cffi.*
|
|
||||||
python3 raylib/build.py
|
|
||||||
|
|
||||||
.. note:: (Optional) To update the Linux dynamic libs (names will be different on other platforms):
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
rm dynamic/raylib/*.so*
|
|
||||||
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/
|
|
||||||
|
|
||||||
To build a binary wheel distribution:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install wheel
|
|
||||||
python3 setup.py bdist_wheel
|
|
||||||
|
|
||||||
|
|
||||||
Then install it:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install dist/raylib*.whl
|
|
||||||
|
|
||||||
To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
./raylib/build_multi.sh
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
pypi wont accept Linux packages unless they are built
|
|
||||||
``--plat-name manylinux2014_x86_64`` so on linux please run
|
|
||||||
``./raylib/build_multi_linux.sh`` )
|
|
||||||
|
|
||||||
.. TODO::
|
|
||||||
Separate the instructions for preparing the dynamic module
|
|
||||||
from the instructions for building the static module!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Macos manual build
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
These instructions have been tested on Macos 10.14.
|
|
||||||
|
|
||||||
Clone this repo including submodules so you get correct version of
|
|
||||||
Raylib.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
|
||||||
|
|
||||||
Build and install Raylib from the raylib-c directory.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-python-cffi/raylib-c/
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
|
|
||||||
Build and install module.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install cffi
|
|
||||||
rm -rf build raylib/_raylib_cffi.*
|
|
||||||
python3 raylib/build.py
|
|
||||||
pip3 install wheel
|
|
||||||
python3 setup.py install
|
|
||||||
|
|
||||||
|
|
368
LICENSE
368
LICENSE
|
@ -1,277 +1,165 @@
|
||||||
Eclipse Public License - v 2.0
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
1. DEFINITIONS
|
|
||||||
|
|
||||||
"Contribution" means:
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
a) in the case of the initial Contributor, the initial content
|
0. Additional Definitions.
|
||||||
Distributed under this Agreement, and
|
|
||||||
|
|
||||||
b) in the case of each subsequent Contributor:
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
i) changes to the Program, and
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
ii) additions to the Program;
|
General Public License.
|
||||||
where such changes and/or additions to the Program originate from
|
|
||||||
and are Distributed by that particular Contributor. A Contribution
|
|
||||||
"originates" from a Contributor if it was added to the Program by
|
|
||||||
such Contributor itself or anyone acting on such Contributor's behalf.
|
|
||||||
Contributions do not include changes or additions to the Program that
|
|
||||||
are not Modified Works.
|
|
||||||
|
|
||||||
"Contributor" means any person or entity that Distributes the Program.
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
"Licensed Patents" mean patent claims licensable by a Contributor which
|
An "Application" is any work that makes use of an interface provided
|
||||||
are necessarily infringed by the use or sale of its Contribution alone
|
by the Library, but which is not otherwise based on the Library.
|
||||||
or when combined with the Program.
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
"Program" means the Contributions Distributed in accordance with this
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
Agreement.
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
"Recipient" means anyone who receives the Program under this Agreement
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
or any Secondary License (as applicable), including Contributors.
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source Code or other
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
form, that is based on (or derived from) the Program and for which the
|
object code and/or source code for the Application, including any data
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
represent, as a whole, an original work of authorship.
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
"Modified Works" shall mean any work in Source Code or other form that
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
results from an addition to, deletion from, or modification of the
|
|
||||||
contents of the Program, including, for purposes of clarity any new file
|
|
||||||
in Source Code form that contains any contents of the Program. Modified
|
|
||||||
Works shall not include works that contain only declarations,
|
|
||||||
interfaces, types, classes, structures, or files of the Program solely
|
|
||||||
in each case in order to link to, bind by name, or subclass the Program
|
|
||||||
or Modified Works thereof.
|
|
||||||
|
|
||||||
"Distribute" means the acts of a) distributing or b) making available
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
in any manner that enables the transfer of a copy.
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
"Source Code" means the form of a Program preferred for making
|
2. Conveying Modified Versions.
|
||||||
modifications, including but not limited to software source code,
|
|
||||||
documentation source, and configuration files.
|
|
||||||
|
|
||||||
"Secondary License" means either the GNU General Public License,
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
Version 2.0, or any later versions of that license, including any
|
facility refers to a function or data to be supplied by an Application
|
||||||
exceptions or additional permissions as identified by the initial
|
that uses the facility (other than as an argument passed when the
|
||||||
Contributor.
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
2. GRANT OF RIGHTS
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
a) Subject to the terms of this Agreement, each Contributor hereby
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
grants Recipient a non-exclusive, worldwide, royalty-free copyright
|
this License applicable to that copy.
|
||||||
license to reproduce, prepare Derivative Works of, publicly display,
|
|
||||||
publicly perform, Distribute and sublicense the Contribution of such
|
|
||||||
Contributor, if any, and such Derivative Works.
|
|
||||||
|
|
||||||
b) Subject to the terms of this Agreement, each Contributor hereby
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
grants Recipient a non-exclusive, worldwide, royalty-free patent
|
|
||||||
license under Licensed Patents to make, use, sell, offer to sell,
|
|
||||||
import and otherwise transfer the Contribution of such Contributor,
|
|
||||||
if any, in Source Code or other form. This patent license shall
|
|
||||||
apply to the combination of the Contribution and the Program if, at
|
|
||||||
the time the Contribution is added by the Contributor, such addition
|
|
||||||
of the Contribution causes such combination to be covered by the
|
|
||||||
Licensed Patents. The patent license shall not apply to any other
|
|
||||||
combinations which include the Contribution. No hardware per se is
|
|
||||||
licensed hereunder.
|
|
||||||
|
|
||||||
c) Recipient understands that although each Contributor grants the
|
The object code form of an Application may incorporate material from
|
||||||
licenses to its Contributions set forth herein, no assurances are
|
a header file that is part of the Library. You may convey such object
|
||||||
provided by any Contributor that the Program does not infringe the
|
code under terms of your choice, provided that, if the incorporated
|
||||||
patent or other intellectual property rights of any other entity.
|
material is not limited to numerical parameters, data structure
|
||||||
Each Contributor disclaims any liability to Recipient for claims
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
brought by any other entity based on infringement of intellectual
|
(ten or fewer lines in length), you do both of the following:
|
||||||
property rights or otherwise. As a condition to exercising the
|
|
||||||
rights and licenses granted hereunder, each Recipient hereby
|
|
||||||
assumes sole responsibility to secure any other intellectual
|
|
||||||
property rights needed, if any. For example, if a third party
|
|
||||||
patent license is required to allow Recipient to Distribute the
|
|
||||||
Program, it is Recipient's responsibility to acquire that license
|
|
||||||
before distributing the Program.
|
|
||||||
|
|
||||||
d) Each Contributor represents that to its knowledge it has
|
a) Give prominent notice with each copy of the object code that the
|
||||||
sufficient copyright rights in its Contribution, if any, to grant
|
Library is used in it and that the Library and its use are
|
||||||
the copyright license set forth in this Agreement.
|
covered by this License.
|
||||||
|
|
||||||
e) Notwithstanding the terms of any Secondary License, no
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
Contributor makes additional grants to any Recipient (other than
|
document.
|
||||||
those set forth in this Agreement) as a result of such Recipient's
|
|
||||||
receipt of the Program under the terms of a Secondary License
|
|
||||||
(if permitted under the terms of Section 3).
|
|
||||||
|
|
||||||
3. REQUIREMENTS
|
4. Combined Works.
|
||||||
|
|
||||||
3.1 If a Contributor Distributes the Program in any form, then:
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
a) the Program must also be made available as Source Code, in
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
accordance with section 3.2, and the Contributor must accompany
|
the Library is used in it and that the Library and its use are
|
||||||
the Program with a statement that the Source Code for the Program
|
covered by this License.
|
||||||
is available under this Agreement, and informs Recipients how to
|
|
||||||
obtain it in a reasonable manner on or through a medium customarily
|
|
||||||
used for software exchange; and
|
|
||||||
|
|
||||||
b) the Contributor may Distribute the Program under a license
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
different than this Agreement, provided that such license:
|
document.
|
||||||
i) effectively disclaims on behalf of all other Contributors all
|
|
||||||
warranties and conditions, express and implied, including
|
|
||||||
warranties or conditions of title and non-infringement, and
|
|
||||||
implied warranties or conditions of merchantability and fitness
|
|
||||||
for a particular purpose;
|
|
||||||
|
|
||||||
ii) effectively excludes on behalf of all other Contributors all
|
c) For a Combined Work that displays copyright notices during
|
||||||
liability for damages, including direct, indirect, special,
|
execution, include the copyright notice for the Library among
|
||||||
incidental and consequential damages, such as lost profits;
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
iii) does not attempt to limit or alter the recipients' rights
|
d) Do one of the following:
|
||||||
in the Source Code under section 3.2; and
|
|
||||||
|
|
||||||
iv) requires any subsequent distribution of the Program by any
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
party to be under a license that satisfies the requirements
|
License, and the Corresponding Application Code in a form
|
||||||
of this section 3.
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
3.2 When the Program is Distributed as Source Code:
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
a) it must be made available under this Agreement, or if the
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
Program (i) is combined with other material in a separate file or
|
be required to provide such information under section 6 of the
|
||||||
files made available under a Secondary License, and (ii) the initial
|
GNU GPL, and only to the extent that such information is
|
||||||
Contributor attached to the Source Code the notice described in
|
necessary to install and execute a modified version of the
|
||||||
Exhibit A of this Agreement, then the Program may be made available
|
Combined Work produced by recombining or relinking the
|
||||||
under the terms of such Secondary Licenses, and
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
b) a copy of this Agreement must be included with each copy of
|
5. Combined Libraries.
|
||||||
the Program.
|
|
||||||
|
|
||||||
3.3 Contributors may not remove or alter any copyright, patent,
|
You may place library facilities that are a work based on the
|
||||||
trademark, attribution notices, disclaimers of warranty, or limitations
|
Library side by side in a single library together with other library
|
||||||
of liability ("notices") contained within the Program from any copy of
|
facilities that are not Applications and are not covered by this
|
||||||
the Program which they Distribute, provided that Contributors may add
|
License, and convey such a combined library under terms of your
|
||||||
their own appropriate notices.
|
choice, if you do both of the following:
|
||||||
|
|
||||||
4. COMMERCIAL DISTRIBUTION
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
Commercial distributors of software may accept certain responsibilities
|
b) Give prominent notice with the combined library that part of it
|
||||||
with respect to end users, business partners and the like. While this
|
is a work based on the Library, and explaining where to find the
|
||||||
license is intended to facilitate the commercial use of the Program,
|
accompanying uncombined form of the same work.
|
||||||
the Contributor who includes the Program in a commercial product
|
|
||||||
offering should do so in a manner which does not create potential
|
|
||||||
liability for other Contributors. Therefore, if a Contributor includes
|
|
||||||
the Program in a commercial product offering, such Contributor
|
|
||||||
("Commercial Contributor") hereby agrees to defend and indemnify every
|
|
||||||
other Contributor ("Indemnified Contributor") against any losses,
|
|
||||||
damages and costs (collectively "Losses") arising from claims, lawsuits
|
|
||||||
and other legal actions brought by a third party against the Indemnified
|
|
||||||
Contributor to the extent caused by the acts or omissions of such
|
|
||||||
Commercial Contributor in connection with its distribution of the Program
|
|
||||||
in a commercial product offering. The obligations in this section do not
|
|
||||||
apply to any claims or Losses relating to any actual or alleged
|
|
||||||
intellectual property infringement. In order to qualify, an Indemnified
|
|
||||||
Contributor must: a) promptly notify the Commercial Contributor in
|
|
||||||
writing of such claim, and b) allow the Commercial Contributor to control,
|
|
||||||
and cooperate with the Commercial Contributor in, the defense and any
|
|
||||||
related settlement negotiations. The Indemnified Contributor may
|
|
||||||
participate in any such claim at its own expense.
|
|
||||||
|
|
||||||
For example, a Contributor might include the Program in a commercial
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
product offering, Product X. That Contributor is then a Commercial
|
|
||||||
Contributor. If that Commercial Contributor then makes performance
|
|
||||||
claims, or offers warranties related to Product X, those performance
|
|
||||||
claims and warranties are such Commercial Contributor's responsibility
|
|
||||||
alone. Under this section, the Commercial Contributor would have to
|
|
||||||
defend claims against the other Contributors related to those performance
|
|
||||||
claims and warranties, and if a court requires any other Contributor to
|
|
||||||
pay any damages as a result, the Commercial Contributor must pay
|
|
||||||
those damages.
|
|
||||||
|
|
||||||
5. NO WARRANTY
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
|
Each version is given a distinguishing version number. If the
|
||||||
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
|
Library as you received it specifies that a certain numbered version
|
||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
|
of the GNU Lesser General Public License "or any later version"
|
||||||
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
|
applies to it, you have the option of following the terms and
|
||||||
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
|
conditions either of that published version or of any later version
|
||||||
PURPOSE. Each Recipient is solely responsible for determining the
|
published by the Free Software Foundation. If the Library as you
|
||||||
appropriateness of using and distributing the Program and assumes all
|
received it does not specify a version number of the GNU Lesser
|
||||||
risks associated with its exercise of rights under this Agreement,
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
including but not limited to the risks and costs of program errors,
|
General Public License ever published by the Free Software Foundation.
|
||||||
compliance with applicable laws, damage to or loss of data, programs
|
|
||||||
or equipment, and unavailability or interruption of operations.
|
|
||||||
|
|
||||||
6. DISCLAIMER OF LIABILITY
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
|
permanent authorization for you to choose that version for the
|
||||||
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
Library.
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
|
|
||||||
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
|
|
||||||
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
7. GENERAL
|
|
||||||
|
|
||||||
If any provision of this Agreement is invalid or unenforceable under
|
|
||||||
applicable law, it shall not affect the validity or enforceability of
|
|
||||||
the remainder of the terms of this Agreement, and without further
|
|
||||||
action by the parties hereto, such provision shall be reformed to the
|
|
||||||
minimum extent necessary to make such provision valid and enforceable.
|
|
||||||
|
|
||||||
If Recipient institutes patent litigation against any entity
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that the
|
|
||||||
Program itself (excluding combinations of the Program with other software
|
|
||||||
or hardware) infringes such Recipient's patent(s), then such Recipient's
|
|
||||||
rights granted under Section 2(b) shall terminate as of the date such
|
|
||||||
litigation is filed.
|
|
||||||
|
|
||||||
All Recipient's rights under this Agreement shall terminate if it
|
|
||||||
fails to comply with any of the material terms or conditions of this
|
|
||||||
Agreement and does not cure such failure in a reasonable period of
|
|
||||||
time after becoming aware of such noncompliance. If all Recipient's
|
|
||||||
rights under this Agreement terminate, Recipient agrees to cease use
|
|
||||||
and distribution of the Program as soon as reasonably practicable.
|
|
||||||
However, Recipient's obligations under this Agreement and any licenses
|
|
||||||
granted by Recipient relating to the Program shall continue and survive.
|
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute copies of this Agreement,
|
|
||||||
but in order to avoid inconsistency the Agreement is copyrighted and
|
|
||||||
may only be modified in the following manner. The Agreement Steward
|
|
||||||
reserves the right to publish new versions (including revisions) of
|
|
||||||
this Agreement from time to time. No one other than the Agreement
|
|
||||||
Steward has the right to modify this Agreement. The Eclipse Foundation
|
|
||||||
is the initial Agreement Steward. The Eclipse Foundation may assign the
|
|
||||||
responsibility to serve as the Agreement Steward to a suitable separate
|
|
||||||
entity. Each new version of the Agreement will be given a distinguishing
|
|
||||||
version number. The Program (including Contributions) may always be
|
|
||||||
Distributed subject to the version of the Agreement under which it was
|
|
||||||
received. In addition, after a new version of the Agreement is published,
|
|
||||||
Contributor may elect to Distribute the Program (including its
|
|
||||||
Contributions) under the new version.
|
|
||||||
|
|
||||||
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
|
|
||||||
receives no rights or licenses to the intellectual property of any
|
|
||||||
Contributor under this Agreement, whether expressly, by implication,
|
|
||||||
estoppel or otherwise. All rights in the Program not expressly granted
|
|
||||||
under this Agreement are reserved. Nothing in this Agreement is intended
|
|
||||||
to be enforceable by any entity that is not a Contributor or Recipient.
|
|
||||||
No third-party beneficiary rights are created under this Agreement.
|
|
||||||
|
|
||||||
Exhibit A - Form of Secondary Licenses Notice
|
|
||||||
|
|
||||||
"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: {name license(s),
|
|
||||||
version(s), and exceptions or additional permissions here}."
|
|
||||||
|
|
||||||
Simply including a copy of this Agreement, including this Exhibit A
|
|
||||||
is not sufficient to license the Source Code under Secondary Licenses.
|
|
||||||
|
|
||||||
If it is not possible or desirable to put the notice in a particular
|
|
||||||
file, then You may include the notice in a location (such as a LICENSE
|
|
||||||
file in a relevant directory) where a recipient would be likely to
|
|
||||||
look for such a notice.
|
|
||||||
|
|
||||||
You may add additional accurate notices of copyright ownership.
|
|
||||||
|
|
23
MANIFEST.in
23
MANIFEST.in
|
@ -1,16 +1,9 @@
|
||||||
include raylib/*.so
|
include raylib/static/*.so
|
||||||
include raylib/*.pyi
|
include raylib/static/*.pyd
|
||||||
include pyray/*.pyi
|
exclude raylib/static/*.a
|
||||||
include raylib/*.pyd
|
|
||||||
include raylib/*.dll
|
|
||||||
exclude raylib/*.a
|
|
||||||
include raylib/*.h
|
include raylib/*.h
|
||||||
include raylib/*.h.modified
|
exclude raylib/static/*.c
|
||||||
exclude raylib/*.c
|
exclude raylib/static/*.o
|
||||||
exclude raylib/*.o
|
include raylib/dynamic/*.dylib
|
||||||
include version.py
|
include raylib/dynamic/*.dll
|
||||||
exclude tests/*
|
include raylib/dynamic/*.so
|
||||||
include raylib/py.typed
|
|
||||||
include pyray/py.typed
|
|
||||||
|
|
||||||
|
|
383
README.md
383
README.md
|
@ -1,278 +1,115 @@
|
||||||
# Python Bindings for Raylib 5.5
|
# Python Bindings for Raylib 2.6
|
||||||
## Libraries: raymath, raygui, rlgl, physac and GLFW
|
|
||||||
## Backends: Desktop, SDL, DRM, Web
|
|
||||||
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
|
|
||||||
|
|
||||||

|
New CFFI API static bindings. Faster, fewer bugs and easier to maintain than ctypes.
|
||||||
|
|
||||||
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
|
### Advert
|
||||||
|
|
||||||
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
|
|
||||||
original Raylib.
|
|
||||||
* Faster, fewer bugs and easier to maintain than ctypes.
|
|
||||||
* Commercial-friendly license.
|
|
||||||
* Docstrings and auto-completion.
|
|
||||||
* Type checking with Mypy
|
|
||||||
|
|
||||||
|
|
||||||
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
|
||||||
|
|
||||||
# Quickstart
|
|
||||||
|
|
||||||
`pip3 install raylib==5.5.0.2 --break-system-packages`
|
|
||||||
```python
|
|
||||||
from pyray import *
|
|
||||||
init_window(800, 450, "Hello")
|
|
||||||
while not window_should_close():
|
|
||||||
begin_drawing()
|
|
||||||
clear_background(WHITE)
|
|
||||||
draw_text("Hello world", 190, 200, 20, VIOLET)
|
|
||||||
end_drawing()
|
|
||||||
close_window()
|
|
||||||
```
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
|
|
||||||
If you are on a modern Linux you will probably want to create a venv:
|
|
||||||
|
|
||||||
python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
Then make sure you have the latest pip installed:
|
|
||||||
|
|
||||||
python3 -m pip install --upgrade pip
|
|
||||||
|
|
||||||
Then install
|
|
||||||
|
|
||||||
python3 -m pip install setuptools
|
|
||||||
python3 -m pip install raylib==5.5.0.2
|
|
||||||
|
|
||||||
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
|
|
||||||
source, in which case you will need to have Raylib development libs installed, e.g.
|
|
||||||
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
|
|
||||||
|
|
||||||
[Using on Rasperry Pi](RPI.rst)
|
|
||||||
|
|
||||||
# Backends
|
|
||||||
|
|
||||||
## Dynamic binding version
|
|
||||||
|
|
||||||
There is now a separate dynamic version of this binding:
|
|
||||||
|
|
||||||
python3 -m pip uninstall raylib
|
|
||||||
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)
|
|
||||||
|
|
||||||
You can't have multiple raylib packages installed at once.
|
|
||||||
|
|
||||||
## SDL backend
|
|
||||||
|
|
||||||
This is not well tested but has better support for controllers:
|
|
||||||
|
|
||||||
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?
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
If you need help you can try asking on [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
|
|
||||||
for issues that are not Python-specific.
|
|
||||||
|
|
||||||
If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
|
|
||||||
|
|
||||||
|
|
||||||
# How to use
|
|
||||||
|
|
||||||
There are *two* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
|
|
||||||
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
|
|
||||||
|
|
||||||
Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
|
||||||
|
|
||||||
### If you prefer a more Pythonistic API
|
|
||||||
|
|
||||||
Use [the pyray module](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
|
|
||||||
|
|
||||||
[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)
|
|
||||||
|
|
||||||
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
|
|
||||||
|
|
||||||
[Eidolon](https://github.com/Miou-zora/Eidolon)
|
|
||||||
|
|
||||||
Add your app here!
|
|
||||||
|
|
||||||
# RLZero
|
|
||||||
|
|
||||||
A related library (that is a work in progress!):
|
|
||||||
|
|
||||||
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/rlzero)
|
|
||||||
|
|
||||||
# Help wanted
|
|
||||||
|
|
||||||
* Converting more examples from C to Python
|
|
||||||
* Testing on more platforms
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
Eclipse Public License, so you are free to
|
|
||||||
statically link and use in non-free / proprietary / commercial projects!
|
|
||||||
|
|
||||||
# Performance
|
|
||||||
|
|
||||||
If you need more performance, do in this order:
|
|
||||||
|
|
||||||
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
|
||||||
|--------------------------------|-------------------|------------------|------------|
|
|
||||||
| Raylib 5.0 | C | 180000 | 100% |
|
|
||||||
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
|
|
||||||
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
|
|
||||||
| Raylib 3.7 | C | 168100 | 100% |
|
|
||||||
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
|
||||||
| 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
|
|
||||||
|
|
||||||
You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:
|
|
||||||
|
|
||||||
pip3 install nuitka
|
|
||||||
cd examples/textures
|
|
||||||
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
|
|
||||||
|
|
||||||
# Advert
|
|
||||||
|
|
||||||
[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
|
# Install
|
||||||
a book for Python beginners.
|
|
||||||
|
**Windows 10 (64 bit): Python 3.6 - 3.8**
|
||||||
|
|
||||||
|
**MacOS: Python 3.6 - 3.8**
|
||||||
|
|
||||||
|
**Linux (Ubuntu 16.04+): Python 3.6 - 3.8**
|
||||||
|
|
||||||
|
We distribute a statically linked Raylib library, install from Pypi.
|
||||||
|
|
||||||
|
pip3 install raylib
|
||||||
|
|
||||||
|
If you're a different version of Python, or a Linux with incompatible libraries
|
||||||
|
then you can either *use the dynamic binding only* or else you will have to build from source. Download, compile
|
||||||
|
and install Raylib 2.6 then
|
||||||
|
|
||||||
|
cd raylib/static
|
||||||
|
python3 build_linux.py
|
||||||
|
|
||||||
|
# Use
|
||||||
|
|
||||||
|
## raylib.static
|
||||||
|
|
||||||
|
Goal is make usage as similar to the original C as CFFI will allow. There are a few differences
|
||||||
|
you can see in the examples. See test_static.py and examples/*.py for how to use.
|
||||||
|
|
||||||
|
```
|
||||||
|
from raylib.static import *
|
||||||
|
|
||||||
|
InitWindow(800, 450, b"Hello Raylib")
|
||||||
|
SetTargetFPS(60)
|
||||||
|
|
||||||
|
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
|
||||||
|
SetCameraMode(camera[0], CAMERA_ORBITAL)
|
||||||
|
|
||||||
|
while not WindowShouldClose():
|
||||||
|
UpdateCamera(camera)
|
||||||
|
BeginDrawing()
|
||||||
|
ClearBackground(RAYWHITE)
|
||||||
|
BeginMode3D(camera[0])
|
||||||
|
DrawGrid(20, 1.0)
|
||||||
|
EndMode3D()
|
||||||
|
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
|
||||||
|
EndDrawing()
|
||||||
|
CloseWindow()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## raylib.pyray
|
||||||
|
|
||||||
|
Wrapper around the static bindings. Makes the names snakecase and converts strings to bytes automatically. See test_pyray.py.
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
from raylib.pyray import PyRay
|
||||||
|
from raylib.colors import *
|
||||||
|
|
||||||
|
pyray = PyRay()
|
||||||
|
|
||||||
|
pyray.init_window(800, 450, "Hello Pyray")
|
||||||
|
pyray.set_target_fps(60)
|
||||||
|
|
||||||
|
camera = pyray.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
|
||||||
|
pyray.set_camera_mode(camera, pyray.CAMERA_ORBITAL)
|
||||||
|
|
||||||
|
while not pyray.window_should_close():
|
||||||
|
pyray.update_camera(pyray.pointer(camera))
|
||||||
|
pyray.begin_drawing()
|
||||||
|
pyray.clear_background(RAYWHITE)
|
||||||
|
pyray.begin_mode_3d(camera)
|
||||||
|
pyray.draw_grid(20, 1.0)
|
||||||
|
pyray.end_mode_3d()
|
||||||
|
pyray.draw_text("Hello world", 190, 200, 20, VIOLET)
|
||||||
|
pyray.end_drawing()
|
||||||
|
pyray.close_window()
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## raylib.dynamic
|
||||||
|
|
||||||
|
In addition to the API static bindings we have CFFI ABI dynamic bindings in order to avoid the need to compile a C extension module.
|
||||||
|
There have been some weird failures with dynamic bindings and ctypes bindings before and often the failures are silent
|
||||||
|
so you dont even know. Also the static bindings should be faster. Therefore I recommend the static ones...
|
||||||
|
|
||||||
|
BUT the dynamic bindings have the big advantage that you don't need to compile anything to install. You just need a Raylib DLL,
|
||||||
|
which we supply for Windows/Mac/Linux.
|
||||||
|
|
||||||
|
See test_dynamic.py for how to use.
|
||||||
|
|
||||||
|
## richlib
|
||||||
|
|
||||||
|
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/richlib)
|
||||||
|
|
||||||
|
# Platforms tested
|
||||||
|
|
||||||
|
* (MacOS 10.12.6 - Python 3.7)
|
||||||
|
* (Ubuntu 18.04 LTS - Python 3.6)
|
||||||
|
* Debian 10 - Python 3.7
|
||||||
|
* Windows 10 (64 bit) - Python 3.8
|
||||||
|
|
||||||
|
# HELP WANTED
|
||||||
|
|
||||||
|
* converting more examples from C to python
|
||||||
|
* testing and building on more platforms
|
||||||
|
* sorting out binary wheel distribution for Mac/Win and compile-from-source distributtion for Linux
|
||||||
|
* dealing with conversions to pointers in PyRay automatically
|
||||||
|
|
||||||
|
|
97
RPI.rst
97
RPI.rst
|
@ -1,97 +0,0 @@
|
||||||
Raspberry Pi
|
|
||||||
====================
|
|
||||||
|
|
||||||
Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.
|
|
||||||
|
|
||||||
Option 1: Binary wheel
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
python -m pip install --break-system-packages raylib
|
|
||||||
|
|
||||||
Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
|
|
||||||
installed at once.
|
|
||||||
|
|
||||||
If it doesn't work, or you're not on Bullseye, or you're 32 bit, you will need to compile your own raylib. See below.
|
|
||||||
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
|
|
||||||
|
|
||||||
Option 2: Compile Raylib from source X11 mode
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
This should work for everyone.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
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
|
|
||||||
mkdir build
|
|
||||||
rm -rf 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 ..
|
|
||||||
make
|
|
||||||
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:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. 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
|
|
||||||
with ``PLATFORM_RPI``) be aware they 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.
|
|
76
coords_demo.py
Normal file
76
coords_demo.py
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
from raylib.richlib import *
|
||||||
|
|
||||||
|
|
||||||
|
WIDTH=1200
|
||||||
|
HEIGHT=800
|
||||||
|
CAMERA=pyray.CAMERA_FIRST_PERSON
|
||||||
|
|
||||||
|
|
||||||
|
player = Box((-5, 0, -5), (1, 1, 1), 'green', True)
|
||||||
|
|
||||||
|
|
||||||
|
o = Vector([-5,-0,-5])
|
||||||
|
|
||||||
|
td = False
|
||||||
|
|
||||||
|
|
||||||
|
def init():
|
||||||
|
camera.position = (0.0, 4, 7)
|
||||||
|
camera.target = (100,100,-100)
|
||||||
|
camera.up = (0, 1, 0)
|
||||||
|
camera.fovy = 60
|
||||||
|
#rl.UpdateCamera(camera)
|
||||||
|
pyray.set_camera_mode(camera[0], pyray.CAMERA_FIRST_PERSON)
|
||||||
|
#rl.UpdateCamera(camera)
|
||||||
|
|
||||||
|
def update():
|
||||||
|
if keyboard.right:
|
||||||
|
player.pos.x += 0.1
|
||||||
|
elif keyboard.left:
|
||||||
|
player.pos.x -= 0.1
|
||||||
|
elif keyboard.up:
|
||||||
|
player.pos.y += 0.1
|
||||||
|
elif keyboard.down:
|
||||||
|
player.pos.y -= 0.1
|
||||||
|
elif keyboard.l:
|
||||||
|
player.pos.z += 0.1
|
||||||
|
elif keyboard.p:
|
||||||
|
player.pos.z-= 0.1
|
||||||
|
|
||||||
|
if pyray.is_key_pressed(pyray.KEY_Z):
|
||||||
|
global td
|
||||||
|
td = not td
|
||||||
|
|
||||||
|
|
||||||
|
def draw3d():
|
||||||
|
if td:
|
||||||
|
#pyray.draw_plane((0, 0, 0), (300,300), DARKRED)
|
||||||
|
pyray.draw_grid(10, 1)
|
||||||
|
pyray.draw_plane((player.x, 0, player.z), (1,1), GRAY)
|
||||||
|
pyray.draw_ray([o,[0,0,1]],BLUE)
|
||||||
|
pyray.draw_ray([o,[0,1,0]],GREEN)
|
||||||
|
pyray.draw_ray([o,[1,0,0]],RED)
|
||||||
|
player.draw()
|
||||||
|
|
||||||
|
|
||||||
|
def draw2dbackground():
|
||||||
|
clear('white')
|
||||||
|
origin = rl.GetWorldToScreen(o, camera[0])
|
||||||
|
rl.DrawText(b"0", int(origin.x), int(origin.y), 20, BLACK)
|
||||||
|
for i in range (0,11):
|
||||||
|
xa = rl.GetWorldToScreen((o.x+i,o.y,o.z), camera[0])
|
||||||
|
ya = rl.GetWorldToScreen((o.x,o.y+i,o.z), camera[0])
|
||||||
|
za = rl.GetWorldToScreen((o.x,o.y,o.z+i), camera[0])
|
||||||
|
pyray.draw_text(str(i), int(xa.x), int(xa.y), 20, RED)
|
||||||
|
pyray.draw_text(str(i), int(ya.x), int(ya.y), 20, GREEN)
|
||||||
|
if td:
|
||||||
|
pyray.draw_text(str(i), int(za.x), int(za.y), 20, BLUE)
|
||||||
|
|
||||||
|
pyray.draw_text(f"X: {int(player.x+5)}", 10, 10, 30, RED)
|
||||||
|
pyray.draw_text(f"Y: {int(player.y)}", 10, 50, 30, GREEN)
|
||||||
|
if td:
|
||||||
|
pyray.draw_text(f"Z: {int(player.z+5)}", 10, 110, 30, BLUE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
run()
|
|
@ -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")
|
|
||||||
|
|
|
@ -1,38 +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
|
|
||||||
|
|
||||||
def process(filename):
|
|
||||||
f = open(filename, "r")
|
|
||||||
js = json.load(f)
|
|
||||||
|
|
||||||
for e in js['enums']:
|
|
||||||
if e['name'] and e['values']:
|
|
||||||
print ("class "+e['name']+"("+"IntEnum):")
|
|
||||||
print(f' """{e['description']}."""')
|
|
||||||
for value in e['values']:
|
|
||||||
print(" "+value['name']+" = "+str(value['value']))
|
|
||||||
print("")
|
|
||||||
|
|
||||||
print("""from enum import IntEnum
|
|
||||||
""")
|
|
||||||
|
|
||||||
process("raylib.json")
|
|
||||||
process("raygui.json")
|
|
||||||
process("glfw3.json")
|
|
||||||
process("physac.json")
|
|
|
@ -1,196 +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 pathlib import Path
|
|
||||||
from raylib import rl, ffi
|
|
||||||
from pyray import _underscore
|
|
||||||
from inspect import ismethod, getmembers, isbuiltin
|
|
||||||
import inflection, sys, json
|
|
||||||
|
|
||||||
known_functions = {}
|
|
||||||
known_structs = {}
|
|
||||||
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):
|
|
||||||
if t == '_Bool':
|
|
||||||
return "bool"
|
|
||||||
elif t == 'void':
|
|
||||||
return 'None'
|
|
||||||
elif t == "long":
|
|
||||||
return "int"
|
|
||||||
elif t == "unsigned long long":
|
|
||||||
return "int"
|
|
||||||
elif t == "uint64_t":
|
|
||||||
return "int"
|
|
||||||
elif t == "short":
|
|
||||||
return "int"
|
|
||||||
elif t == "unsigned short":
|
|
||||||
return "int"
|
|
||||||
elif t == "double":
|
|
||||||
return "float"
|
|
||||||
elif "char * *" in t:
|
|
||||||
return "list[str]"
|
|
||||||
elif "char *" in t:
|
|
||||||
return "str"
|
|
||||||
elif t == "char":
|
|
||||||
return "str" # not sure about this one
|
|
||||||
elif t == "unsigned char":
|
|
||||||
return "int"
|
|
||||||
elif "*" in t:
|
|
||||||
return "Any"
|
|
||||||
elif "[" in t:
|
|
||||||
return "list" # TODO FIXME type of items in the list
|
|
||||||
elif t.startswith("struct"):
|
|
||||||
return t.replace("struct ", "")
|
|
||||||
elif t.startswith("unsigned"):
|
|
||||||
return t.replace("unsigned ", "")
|
|
||||||
elif t.startswith("enum"):
|
|
||||||
return t.replace("enum ", "")
|
|
||||||
else:
|
|
||||||
return t
|
|
||||||
|
|
||||||
|
|
||||||
print("""from typing import Any
|
|
||||||
from warnings import deprecated
|
|
||||||
import _cffi_backend # type: ignore
|
|
||||||
|
|
||||||
ffi: _cffi_backend.FFI
|
|
||||||
PhysicsShapeType = int
|
|
||||||
""")
|
|
||||||
|
|
||||||
# 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):
|
|
||||||
uname = _underscore(name)
|
|
||||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
|
||||||
json_object = known_functions.get(name, None)
|
|
||||||
if json_object is None:
|
|
||||||
# this is _not_ an exported function from raylib, raymath, rlgl raygui or physac
|
|
||||||
# so we don't want it in the pyray API
|
|
||||||
continue
|
|
||||||
sig = ""
|
|
||||||
for i, arg in enumerate(ffi.typeof(attr).args):
|
|
||||||
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
|
|
||||||
"_pointer").replace(
|
|
||||||
" ", "") + "_" + str(i)
|
|
||||||
if 'params' in json_object:
|
|
||||||
p = json_object['params']
|
|
||||||
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)
|
|
||||||
if "struct" in arg.cname:
|
|
||||||
param_type += "|list|tuple"
|
|
||||||
sig += f"{param_name}: {param_type},"
|
|
||||||
|
|
||||||
return_type = ffi.typeof(attr).result.cname
|
|
||||||
|
|
||||||
description = attr.__doc__
|
|
||||||
|
|
||||||
if 'description' in json_object:
|
|
||||||
description = json_object['description']
|
|
||||||
|
|
||||||
if 'physics' in uname:
|
|
||||||
print('@deprecated("Raylib no longer recommends the use of Physac library")')
|
|
||||||
print(f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:')
|
|
||||||
print(f' """{description}."""')
|
|
||||||
print(f' ...')
|
|
||||||
|
|
||||||
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
|
||||||
return_type = ffi.typeof(attr).result.cname
|
|
||||||
print(
|
|
||||||
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
|
|
||||||
else:
|
|
||||||
# print("*****", str(type(attr)))
|
|
||||||
t = str(type(attr))[8:-2] # this isolates the type
|
|
||||||
if t != "int":
|
|
||||||
print(f"{name}: {t}")
|
|
||||||
|
|
||||||
for struct in ffi.list_types()[0]:
|
|
||||||
print("processing", struct, file=sys.stderr)
|
|
||||||
|
|
||||||
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:
|
|
||||||
print("weird empty struct, skipping " + struct, file=sys.stderr)
|
|
||||||
continue
|
|
||||||
print(f"class {struct}:")
|
|
||||||
print(f' """{known_structs[struct]['description']}."""')
|
|
||||||
sig = ""
|
|
||||||
for arg in ffi.typeof(struct).fields:
|
|
||||||
ptype = ctype_to_python_type(arg[1].type.cname)
|
|
||||||
if arg[1].type.kind == "struct":
|
|
||||||
ptype += "|list|tuple"
|
|
||||||
sig += f", {arg[0]}: {ptype}|None = None"
|
|
||||||
print(f" def __init__(self{sig}):")
|
|
||||||
|
|
||||||
for arg in ffi.typeof(struct).fields:
|
|
||||||
print(f" self.{arg[0]}:{ctype_to_python_type(arg[1].type.cname)} = {arg[0]} # type: ignore")
|
|
||||||
|
|
||||||
# elif ffi.typeof(struct).kind == "enum":
|
|
||||||
# print(f"{struct}: int")
|
|
||||||
else:
|
|
||||||
print("WARNING: SKIPPING 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
|
|
||||||
""")
|
|
|
@ -1,186 +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 pathlib import Path
|
|
||||||
from raylib import rl, ffi
|
|
||||||
from inspect import ismethod, getmembers, isbuiltin
|
|
||||||
import inflection, sys, json
|
|
||||||
|
|
||||||
known_functions = {}
|
|
||||||
known_structs = {}
|
|
||||||
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):
|
|
||||||
if t == '_Bool':
|
|
||||||
return "bool"
|
|
||||||
elif t == 'void':
|
|
||||||
return 'None'
|
|
||||||
elif t == "long":
|
|
||||||
return "int"
|
|
||||||
elif t == "unsigned long long":
|
|
||||||
return "int"
|
|
||||||
elif t == "uint64_t":
|
|
||||||
return "int"
|
|
||||||
elif t == "short":
|
|
||||||
return "int"
|
|
||||||
elif t == "unsigned short":
|
|
||||||
return "int"
|
|
||||||
elif t == "double":
|
|
||||||
return "float"
|
|
||||||
elif "char * *" in t:
|
|
||||||
return "list[bytes]"
|
|
||||||
elif "char *" in t:
|
|
||||||
return "bytes"
|
|
||||||
elif "char" in t:
|
|
||||||
return "bytes" # not sure about this one
|
|
||||||
elif "*" in t:
|
|
||||||
return "Any"
|
|
||||||
elif "[" in t:
|
|
||||||
return "list" # TODO FIXME type of items in the list
|
|
||||||
elif t.startswith("struct"):
|
|
||||||
return t.replace("struct ", "")
|
|
||||||
elif t.startswith("unsigned"):
|
|
||||||
return t.replace("unsigned ", "")
|
|
||||||
elif t.startswith("enum"):
|
|
||||||
return t.replace("enum ", "")
|
|
||||||
else:
|
|
||||||
return t
|
|
||||||
|
|
||||||
|
|
||||||
print("""from typing import Any
|
|
||||||
from warnings import deprecated
|
|
||||||
import _cffi_backend # type: ignore
|
|
||||||
|
|
||||||
ffi: _cffi_backend.FFI
|
|
||||||
rl: _cffi_backend.Lib
|
|
||||||
PhysicsShapeType = int
|
|
||||||
|
|
||||||
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):
|
|
||||||
uname = name
|
|
||||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
|
|
||||||
json_object = known_functions.get(name, {})
|
|
||||||
sig = ""
|
|
||||||
for i, arg in enumerate(ffi.typeof(attr).args):
|
|
||||||
if ")(" in arg.cname:
|
|
||||||
# fn signature in arg types
|
|
||||||
param_name = str(arg.cname).split("(", 1)[0] + "_callback_" + str(i)
|
|
||||||
else:
|
|
||||||
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
|
|
||||||
"_pointer").replace(" ",
|
|
||||||
"") + "_" + str(
|
|
||||||
i)
|
|
||||||
if 'params' in json_object:
|
|
||||||
p = json_object['params']
|
|
||||||
# print("param_name: ", param_name, "i", i, "params: ",p,file=sys.stderr)
|
|
||||||
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)
|
|
||||||
if "struct" in arg.cname:
|
|
||||||
param_type += "|list|tuple"
|
|
||||||
sig += f"{param_name}: {param_type},"
|
|
||||||
|
|
||||||
return_type = ffi.typeof(attr).result.cname
|
|
||||||
description = attr.__doc__
|
|
||||||
|
|
||||||
if 'description' in json_object:
|
|
||||||
description = json_object['description']
|
|
||||||
|
|
||||||
if 'Physics' in uname:
|
|
||||||
print('@deprecated("Raylib no longer recommends the use of Physac library")')
|
|
||||||
print(f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:')
|
|
||||||
print(f' """{description}."""')
|
|
||||||
print(f' ...')
|
|
||||||
|
|
||||||
|
|
||||||
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
|
||||||
return_type = ffi.typeof(attr).result.cname
|
|
||||||
print(
|
|
||||||
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
|
|
||||||
else:
|
|
||||||
# print("*****", str(type(attr)))
|
|
||||||
print(f"{name}: {str(type(attr))[8:-2]}") # this isolates the type
|
|
||||||
|
|
||||||
for struct in ffi.list_types()[0]:
|
|
||||||
print("processing", struct, file=sys.stderr)
|
|
||||||
if ffi.typeof(struct).kind == "struct":
|
|
||||||
# if ffi.typeof(struct).fields is None:
|
|
||||||
# print("weird empty struct, skipping", file=sys.stderr)
|
|
||||||
# continue
|
|
||||||
print(f"class {struct}:")
|
|
||||||
# sig = ""
|
|
||||||
fields = ffi.typeof(struct).fields
|
|
||||||
if fields is not None:
|
|
||||||
#print(ffi.typeof(struct).fields)
|
|
||||||
#print(f" {arg}: {arg}")
|
|
||||||
# print(f" def __init__(self{sig}):")
|
|
||||||
#
|
|
||||||
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]}")
|
|
||||||
|
|
||||||
elif ffi.typeof(struct).kind == "enum":
|
|
||||||
print(f"{struct} = int")
|
|
||||||
else:
|
|
||||||
print("WARNING: SKIPPING 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
|
|
||||||
""")
|
|
|
@ -1 +0,0 @@
|
||||||
../BUILDING.rst
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Minimal makefile for Sphinx documentation
|
|
||||||
#
|
|
||||||
|
|
||||||
# You can set these variables from the command line, and also
|
|
||||||
# from the environment for the first two.
|
|
||||||
SPHINXOPTS ?=
|
|
||||||
SPHINXBUILD ?= sphinx-build
|
|
||||||
SOURCEDIR = .
|
|
||||||
BUILDDIR = _build
|
|
||||||
|
|
||||||
# Put it first so that "make" without argument is like "make help".
|
|
||||||
help:
|
|
||||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
||||||
|
|
||||||
.PHONY: help Makefile
|
|
||||||
|
|
||||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
||||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
||||||
%: Makefile
|
|
||||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
|
@ -1 +0,0 @@
|
||||||
../README.md
|
|
|
@ -1 +0,0 @@
|
||||||
../RPI.rst
|
|
|
@ -1 +0,0 @@
|
||||||
theme: jekyll-theme-cayman
|
|
|
@ -1,65 +0,0 @@
|
||||||
# Configuration file for the Sphinx documentation builder.
|
|
||||||
#
|
|
||||||
# This file only contains a selection of the most common options. For a full
|
|
||||||
# list see the documentation:
|
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
||||||
|
|
||||||
# -- Path setup --------------------------------------------------------------
|
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
||||||
#
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import sphinx_rtd_theme
|
|
||||||
sys.path.insert(0, os.path.abspath('../'))
|
|
||||||
|
|
||||||
|
|
||||||
# -- Project information -----------------------------------------------------
|
|
||||||
|
|
||||||
project = 'Raylib Python'
|
|
||||||
copyright = '2021, Richard Smith'
|
|
||||||
author = 'Richard Smith'
|
|
||||||
|
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
||||||
# ones.
|
|
||||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'myst_parser', 'autoapi.extension', "sphinx_rtd_theme", 'sphinx.ext.todo']
|
|
||||||
|
|
||||||
autoapi_dirs = ['../raylib', '../pyray']
|
|
||||||
|
|
||||||
autoapi_file_patterns = ['*.pyi', '*.py']
|
|
||||||
|
|
||||||
autoapi_generate_api_docs = False
|
|
||||||
|
|
||||||
|
|
||||||
autosummary_generate = True
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
|
||||||
templates_path = ['_templates']
|
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
|
||||||
# directories to ignore when looking for source files.
|
|
||||||
# This pattern also affects html_static_path and html_extra_path.
|
|
||||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output -------------------------------------------------
|
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
||||||
# a list of builtin themes.
|
|
||||||
#
|
|
||||||
html_theme = "sphinx_rtd_theme"
|
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
||||||
html_static_path = ['_static']
|
|
||||||
|
|
||||||
pygments_style = 'sphinx'
|
|
||||||
|
|
||||||
todo_include_todos = True
|
|
|
@ -1 +0,0 @@
|
||||||
../dynamic/README.rst
|
|
|
@ -1,25 +0,0 @@
|
||||||
.. RL Zero documentation master file, created by
|
|
||||||
sphinx-quickstart on Mon Jul 12 14:03:57 2021.
|
|
||||||
You can adapt this file completely to your liking, but it should at least
|
|
||||||
contain the root `toctree` directive.
|
|
||||||
|
|
||||||
Raylib Python
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 1
|
|
||||||
:caption: Contents:
|
|
||||||
|
|
||||||
README
|
|
||||||
pyray
|
|
||||||
raylib
|
|
||||||
dynamic
|
|
||||||
BUILDING
|
|
||||||
RPI
|
|
||||||
|
|
||||||
|
|
||||||
* :ref:`search`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
@ECHO OFF
|
|
||||||
|
|
||||||
pushd %~dp0
|
|
||||||
|
|
||||||
REM Command file for Sphinx documentation
|
|
||||||
|
|
||||||
if "%SPHINXBUILD%" == "" (
|
|
||||||
set SPHINXBUILD=sphinx-build
|
|
||||||
)
|
|
||||||
set SOURCEDIR=.
|
|
||||||
set BUILDDIR=_build
|
|
||||||
|
|
||||||
if "%1" == "" goto help
|
|
||||||
|
|
||||||
%SPHINXBUILD% >NUL 2>NUL
|
|
||||||
if errorlevel 9009 (
|
|
||||||
echo.
|
|
||||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
||||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
||||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
||||||
echo.may add the Sphinx directory to PATH.
|
|
||||||
echo.
|
|
||||||
echo.If you don't have Sphinx installed, grab it from
|
|
||||||
echo.http://sphinx-doc.org/
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
||||||
goto end
|
|
||||||
|
|
||||||
:help
|
|
||||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
||||||
|
|
||||||
:end
|
|
||||||
popd
|
|
|
@ -1,68 +0,0 @@
|
||||||
Python API
|
|
||||||
==============
|
|
||||||
|
|
||||||
This is a wrapper around the C API with some syntactic sugar.
|
|
||||||
|
|
||||||
The API is *still the same as Raylib*, so you should still reply on:
|
|
||||||
|
|
||||||
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
|
||||||
|
|
||||||
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
|
|
||||||
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
|
|
||||||
|
|
||||||
|
|
||||||
The *differences* are:
|
|
||||||
|
|
||||||
* the function names are in **snake_case**.
|
|
||||||
|
|
||||||
* Some string and pointer conversions are handled automatically.
|
|
||||||
|
|
||||||
* There are some helper functions to create structures.
|
|
||||||
|
|
||||||
Examples
|
|
||||||
--------
|
|
||||||
|
|
||||||
Example program:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
import pyray as pr
|
|
||||||
|
|
||||||
pr.init_window(800, 450, "Hello Pyray")
|
|
||||||
pr.set_target_fps(60)
|
|
||||||
|
|
||||||
camera = pr.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
|
|
||||||
|
|
||||||
while not pr.window_should_close():
|
|
||||||
pr.update_camera(camera, pr.CAMERA_ORBITAL)
|
|
||||||
pr.begin_drawing()
|
|
||||||
pr.clear_background(pr.RAYWHITE)
|
|
||||||
pr.begin_mode_3d(camera)
|
|
||||||
pr.draw_grid(20, 1.0)
|
|
||||||
pr.end_mode_3d()
|
|
||||||
pr.draw_text("Hello world", 190, 200, 20, pr.VIOLET)
|
|
||||||
pr.end_drawing()
|
|
||||||
pr.close_window()
|
|
||||||
|
|
||||||
.. tip:: New in 3.7.0.post9:
|
|
||||||
|
|
||||||
You can also now import the functions with no prefix:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
from pyray import *
|
|
||||||
|
|
||||||
init_window(800, 450, "Raylib texture test")
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
|
|
||||||
|
|
||||||
API reference
|
|
||||||
-------------
|
|
||||||
|
|
||||||
.. autoapimodule:: pyray
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
|
@ -1,63 +0,0 @@
|
||||||
C API
|
|
||||||
=============
|
|
||||||
|
|
||||||
The goal of the C API is make usage as similar to the original C as CFFI will allow.
|
|
||||||
So the `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
are very, very similar to the C originals.
|
|
||||||
|
|
||||||
Example program:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
from raylib import *
|
|
||||||
|
|
||||||
InitWindow(800, 450, b"Hello Raylib")
|
|
||||||
SetTargetFPS(60)
|
|
||||||
|
|
||||||
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
|
|
||||||
|
|
||||||
while not WindowShouldClose():
|
|
||||||
UpdateCamera(camera, CAMERA_ORBITAL)
|
|
||||||
BeginDrawing()
|
|
||||||
ClearBackground(RAYWHITE)
|
|
||||||
BeginMode3D(camera[0])
|
|
||||||
DrawGrid(20, 1.0)
|
|
||||||
EndMode3D()
|
|
||||||
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
|
|
||||||
EndDrawing()
|
|
||||||
CloseWindow()
|
|
||||||
|
|
||||||
If you want to be more portable (i.e. same code will work with dynamic bindings) you can prefix the functions like this:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
from raylib import ffi, rl, colors
|
|
||||||
|
|
||||||
rl.InitWindow(800, 450, b"Hello Raylib")
|
|
||||||
rl.SetTargetFPS(60)
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
|
|
||||||
|
|
||||||
.. important:: Your **primary reference** should always be
|
|
||||||
|
|
||||||
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
|
||||||
|
|
||||||
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
|
|
||||||
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
|
|
||||||
|
|
||||||
However, here is a list of available functions:
|
|
||||||
|
|
||||||
Functions API reference
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. autoapimodule:: raylib
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
myst_parser
|
|
|
@ -1,4 +0,0 @@
|
||||||
# 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.
|
|
||||||
config: f2032a6434b52f7c68551d0ad70d555b
|
|
||||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
|
|
@ -1,310 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Building from source — Raylib Python documentation</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
|
||||||
|
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
<script src="_static/js/theme.js"></script>
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="next" title="Raspberry Pi" href="RPI.html" />
|
|
||||||
<link rel="prev" title="Dynamic Bindings" href="dynamic.html" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
|
||||||
<div class="wy-grid-for-nav">
|
|
||||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
||||||
<div class="wy-side-scroll">
|
|
||||||
<div class="wy-side-nav-search" >
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="index.html" class="icon icon-home">
|
|
||||||
Raylib Python
|
|
||||||
</a>
|
|
||||||
<div role="search">
|
|
||||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
||||||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
||||||
<input type="hidden" name="check_keywords" value="yes" />
|
|
||||||
<input type="hidden" name="area" value="default" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</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>
|
|
||||||
<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#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#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#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#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#license">License</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#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="pyray.html">Python 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 current"><a class="current reference internal" href="#">Building from source</a><ul>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#have-pip-build-from-source">Have Pip build from source</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#or-build-from-source-manually">Or, Build from source manually</a><ul>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="#windows-manual-build">Windows manual build</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="#linux-manual-build">Linux manual build</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="#macos-manual-build">Macos manual build</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
||||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
||||||
<a href="index.html">Raylib Python</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="wy-nav-content">
|
|
||||||
<div class="rst-content">
|
|
||||||
<div role="navigation" aria-label="Page navigation">
|
|
||||||
<ul class="wy-breadcrumbs">
|
|
||||||
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
|
|
||||||
<li class="breadcrumb-item active">Building from source</li>
|
|
||||||
<li class="wy-breadcrumbs-aside">
|
|
||||||
<a href="_sources/BUILDING.rst.txt" rel="nofollow"> View page source</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<hr/>
|
|
||||||
</div>
|
|
||||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
||||||
<div itemprop="articleBody">
|
|
||||||
|
|
||||||
<section id="building-from-source">
|
|
||||||
<h1>Building from source<a class="headerlink" href="#building-from-source" title="Link to this heading"></a></h1>
|
|
||||||
<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>
|
|
||||||
<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
|
|
||||||
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>
|
|
||||||
<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>
|
|
||||||
<span class="n">mkdir</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">make</span>
|
|
||||||
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<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>
|
|
||||||
<p>Useful if the Pip build doesn’t work and you want to debug it, or you want to contribute to the
|
|
||||||
project.</p>
|
|
||||||
<div class="admonition attention">
|
|
||||||
<p class="admonition-title">Attention</p>
|
|
||||||
<p>If the Pip build doesn’t work, please submit a bug. (And if you have
|
|
||||||
fixed it, a PR.)</p>
|
|
||||||
</div>
|
|
||||||
<p>Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
|
|
||||||
at <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml">https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml</a></p>
|
|
||||||
<section id="windows-manual-build">
|
|
||||||
<h3>Windows manual build<a class="headerlink" href="#windows-manual-build" title="Link to this heading"></a></h3>
|
|
||||||
<p>Clone this repo including submodules so you get correct version of
|
|
||||||
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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Open Visual C++ command shell.</p>
|
|
||||||
<p>Fix the symlink that doesnt work on Windows</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="n">python</span><span class="o">-</span><span class="n">cffi</span>
|
|
||||||
<span class="n">copy</span> <span class="n">raylib</span><span class="o">-</span><span class="n">c</span>\<span class="n">src</span>\<span class="n">raylib</span><span class="o">.</span><span class="n">h</span> <span class="n">raylib</span>\<span class="n">raylib</span><span class="o">.</span><span class="n">h</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Build and install Raylib from the raylib-c directory.</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="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">cd</span> <span class="n">build</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">msbuild</span> <span class="n">raylib</span><span class="o">.</span><span class="n">sln</span> <span class="o">/</span><span class="n">target</span><span class="p">:</span><span class="n">raylib</span> <span class="o">/</span><span class="nb">property</span><span class="p">:</span><span class="n">Configuration</span><span class="o">=</span><span class="n">Release</span>
|
|
||||||
<span class="n">copy</span> <span class="n">raylib</span>\<span class="n">Release</span>\<span class="n">raylib</span><span class="o">.</span><span class="n">lib</span> <span class="o">..</span>\<span class="o">..</span>
|
|
||||||
<span class="n">cd</span> <span class="o">..</span>\<span class="o">..</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>To build a binary wheel distribution:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rmdir</span> <span class="o">/</span><span class="n">Q</span> <span class="o">/</span><span class="n">S</span> <span class="n">build</span>
|
|
||||||
<span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
|
|
||||||
<span class="n">pip3</span> <span class="n">install</span> <span class="n">wheel</span>
|
|
||||||
<span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<div class="admonition-todo admonition" id="id1">
|
|
||||||
<p class="admonition-title">Todo</p>
|
|
||||||
<p>There’s a hardcoded path (to the raylib header files) in <cite>raylib/build.py</cite> you will probably need to edit.
|
|
||||||
Would be useful if some Windows user could figure out how to auto detect this.</p>
|
|
||||||
</div>
|
|
||||||
<p>Then install it:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span>\<span class="n">raylib</span><span class="o">-</span><span class="mf">3.7.0</span><span class="o">-</span><span class="n">cp37</span><span class="o">-</span><span class="n">cp37m</span><span class="o">-</span><span class="n">win_amd64</span><span class="o">.</span><span class="n">whl</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>(Note: your wheel’s filename will probably be different than the one
|
|
||||||
here.)</p>
|
|
||||||
</section>
|
|
||||||
<section id="linux-manual-build">
|
|
||||||
<h3>Linux manual build<a class="headerlink" href="#linux-manual-build" title="Link to this heading"></a></h3>
|
|
||||||
<p>Clone this repo including submodules so you get correct version of
|
|
||||||
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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Build and install Raylib from the raylib-c directory.</p>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>You can instead use a different version of Raylib you installed from elsewhere, and it should still
|
|
||||||
work!</p>
|
|
||||||
</div>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">install</span> <span class="n">cmake</span> <span class="n">libasound2</span><span class="o">-</span><span class="n">dev</span> <span class="n">mesa</span><span class="o">-</span><span class="n">common</span><span class="o">-</span><span class="n">dev</span> <span class="n">libx11</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxrandr</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxi</span><span class="o">-</span><span class="n">dev</span> <span class="n">xorg</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgl1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglu1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">pkg</span><span class="o">-</span><span class="n">config</span> <span class="n">cmake</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">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">sudo</span> <span class="n">make</span> <span class="n">install</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>Optional: Build the Raylib shared libs, if you plan to use
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">raylib_dynamic</span></code> binding.</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="o">-</span><span class="n">rf</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">DBUILD_SHARED_LIBS</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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">../..</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Build the Python library:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
|
|
||||||
<span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="n">build</span> <span class="n">raylib</span><span class="o">/</span><span class="n">_raylib_cffi</span><span class="o">.*</span>
|
|
||||||
<span class="n">python3</span> <span class="n">raylib</span><span class="o">/</span><span class="n">build</span><span class="o">.</span><span class="n">py</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>(Optional) To update the Linux dynamic libs (names will be different on other platforms):</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="n">dynamic</span><span class="o">/</span><span class="n">raylib</span><span class="o">/*.</span><span class="n">so</span><span class="o">*</span>
|
|
||||||
<span class="n">cp</span> <span class="o">-</span><span class="n">P</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="n">so</span><span class="o">*</span> <span class="n">dynamic</span><span class="o">/</span><span class="n">raylib</span><span class="o">/</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p>To build a binary wheel distribution:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">wheel</span>
|
|
||||||
<span class="n">python3</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Then install it:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span><span class="o">/</span><span class="n">raylib</span><span class="o">*.</span><span class="n">whl</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">./</span><span class="n">raylib</span><span class="o">/</span><span class="n">build_multi</span><span class="o">.</span><span class="n">sh</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<div class="admonition warning">
|
|
||||||
<p class="admonition-title">Warning</p>
|
|
||||||
<p>pypi wont accept Linux packages unless they are built
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">--plat-name</span> <span class="pre">manylinux2014_x86_64</span></code> so on linux please run
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">./raylib/build_multi_linux.sh</span></code> )</p>
|
|
||||||
</div>
|
|
||||||
<div class="admonition-todo admonition" id="id2">
|
|
||||||
<p class="admonition-title">Todo</p>
|
|
||||||
<p>Separate the instructions for preparing the dynamic module
|
|
||||||
from the instructions for building the static module!</p>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="macos-manual-build">
|
|
||||||
<h3>Macos manual build<a class="headerlink" href="#macos-manual-build" title="Link to this heading"></a></h3>
|
|
||||||
<p>These instructions have been tested on Macos 10.14.</p>
|
|
||||||
<p>Clone this repo including submodules so you get correct version of
|
|
||||||
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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Build and install Raylib from the raylib-c directory.</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="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="o">/</span>
|
|
||||||
<span class="n">mkdir</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">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">cd</span> <span class="o">../..</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Build and install module.</p>
|
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
|
|
||||||
<span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="n">build</span> <span class="n">raylib</span><span class="o">/</span><span class="n">_raylib_cffi</span><span class="o">.*</span>
|
|
||||||
<span class="n">python3</span> <span class="n">raylib</span><span class="o">/</span><span class="n">build</span><span class="o">.</span><span class="n">py</span>
|
|
||||||
<span class="n">pip3</span> <span class="n">install</span> <span class="n">wheel</span>
|
|
||||||
<span class="n">python3</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">install</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
||||||
<a href="dynamic.html" class="btn btn-neutral float-left" title="Dynamic Bindings" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
||||||
<a href="RPI.html" class="btn btn-neutral float-right" title="Raspberry Pi" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<div role="contentinfo">
|
|
||||||
<p>© Copyright 2021, Richard Smith.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
||||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
||||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function () {
|
|
||||||
SphinxRtdTheme.Navigation.enable(true);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
449
docs/README.html
449
docs/README.html
|
@ -1,449 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Python Bindings for Raylib 5.5 — Raylib Python documentation</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
|
||||||
|
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
<script src="_static/js/theme.js"></script>
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="next" title="Python API" href="pyray.html" />
|
|
||||||
<link rel="prev" title="Raylib Python" href="index.html" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
|
||||||
<div class="wy-grid-for-nav">
|
|
||||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
||||||
<div class="wy-side-scroll">
|
|
||||||
<div class="wy-side-nav-search" >
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="index.html" class="icon icon-home">
|
|
||||||
Raylib Python
|
|
||||||
</a>
|
|
||||||
<div role="search">
|
|
||||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
||||||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
||||||
<input type="hidden" name="check_keywords" value="yes" />
|
|
||||||
<input type="hidden" name="area" value="default" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</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>
|
|
||||||
<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-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="#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>
|
|
||||||
</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="#sdl-backend">SDL backend</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#drm-backend">DRM backend</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#problems">Problems?</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<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-prefer-a-more-pythonistic-api">If you prefer a more Pythonistic API</a></li>
|
|
||||||
</ul>
|
|
||||||
</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="#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="#license">License</a></li>
|
|
||||||
<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>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="#packaging-your-app">Packaging your app</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="#advert">Advert</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python 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="BUILDING.html">Building from source</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
||||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
||||||
<a href="index.html">Raylib Python</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="wy-nav-content">
|
|
||||||
<div class="rst-content">
|
|
||||||
<div role="navigation" aria-label="Page navigation">
|
|
||||||
<ul class="wy-breadcrumbs">
|
|
||||||
<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="wy-breadcrumbs-aside">
|
|
||||||
<a href="_sources/README.md.txt" rel="nofollow"> View page source</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<hr/>
|
|
||||||
</div>
|
|
||||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
||||||
<div itemprop="articleBody">
|
|
||||||
|
|
||||||
<section id="python-bindings-for-raylib-5-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>
|
|
||||||
<section id="libraries-raymath-raygui-rlgl-physac-and-glfw">
|
|
||||||
<h2>Libraries: raymath, raygui, rlgl, physac and GLFW<a class="headerlink" href="#libraries-raymath-raygui-rlgl-physac-and-glfw" title="Link to this heading"></a></h2>
|
|
||||||
</section>
|
|
||||||
<section id="backends-desktop-sdl-drm-web">
|
|
||||||
<h2>Backends: Desktop, SDL, DRM, Web<a class="headerlink" href="#backends-desktop-sdl-drm-web" title="Link to this heading"></a></h2>
|
|
||||||
</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">
|
|
||||||
<li><p>CFFI API static bindings.</p></li>
|
|
||||||
<li><p>Automatically generated to be as close as possible to
|
|
||||||
original Raylib.</p></li>
|
|
||||||
<li><p>Faster, fewer bugs and easier to maintain than ctypes.</p></li>
|
|
||||||
<li><p>Commercial-friendly license.</p></li>
|
|
||||||
<li><p>Docstrings and auto-completion.</p></li>
|
|
||||||
<li><p>Type checking with Mypy</p></li>
|
|
||||||
</ul>
|
|
||||||
<p><a class="reference external" href="http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="quickstart">
|
|
||||||
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1>
|
|
||||||
<p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib==5.5.0.2</span> <span class="pre">--break-system-packages</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>
|
|
||||||
<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>
|
|
||||||
<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="n">close_window</span><span class="p">()</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="installation">
|
|
||||||
<h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
|
|
||||||
<p>If you are on a modern Linux you will probably want to create a venv:</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
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Then install</p>
|
|
||||||
<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
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>On most platforms it should install a binary wheel. If yours isn’t available then pip will attempt to build from
|
|
||||||
source, in which case you will need to have Raylib development libs installed, e.g.
|
|
||||||
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">
|
|
||||||
<h2>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h2>
|
|
||||||
<p><span class="xref myst">Using on Rasperry Pi</span></p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="backends">
|
|
||||||
<h1>Backends<a class="headerlink" href="#backends" title="Link to this heading"></a></h1>
|
|
||||||
<section id="dynamic-binding-version">
|
|
||||||
<h2>Dynamic binding version<a class="headerlink" href="#dynamic-binding-version" title="Link to this heading"></a></h2>
|
|
||||||
<p>There is now a separate dynamic version of this binding:</p>
|
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
|
|
||||||
python3 -m pip install raylib_dynamic
|
|
||||||
</pre></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>You can’t have multiple raylib packages installed at once.</p>
|
|
||||||
</section>
|
|
||||||
<section id="sdl-backend">
|
|
||||||
<h2>SDL backend<a class="headerlink" href="#sdl-backend" title="Link to this heading"></a></h2>
|
|
||||||
<p>This is not well tested but has better support for controllers:</p>
|
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
|
|
||||||
python3 -m pip install raylib_sdl
|
|
||||||
</pre></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 id="problems">
|
|
||||||
<h2>Problems?<a class="headerlink" href="#problems" title="Link 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>
|
|
||||||
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>
|
|
||||||
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>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="how-to-use">
|
|
||||||
<h1>How to use<a class="headerlink" href="#how-to-use" title="Link 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
|
|
||||||
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">
|
|
||||||
<h2>If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API<a class="headerlink" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api" title="Link to this heading"></a></h2>
|
|
||||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the raylib module</a>.</p>
|
|
||||||
</section>
|
|
||||||
<section id="if-you-prefer-a-more-pythonistic-api">
|
|
||||||
<h2>If you prefer a more Pythonistic API<a class="headerlink" href="#if-you-prefer-a-more-pythonistic-api" title="Link to this heading"></a></h2>
|
|
||||||
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the pyray module</a>.</p>
|
|
||||||
</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">
|
|
||||||
<h1>App showcase<a class="headerlink" href="#app-showcase" title="Link 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://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>
|
|
||||||
</section>
|
|
||||||
<section id="rlzero">
|
|
||||||
<h1>RLZero<a class="headerlink" href="#rlzero" title="Link to this heading"></a></h1>
|
|
||||||
<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>
|
|
||||||
</section>
|
|
||||||
<section id="help-wanted">
|
|
||||||
<h1>Help wanted<a class="headerlink" href="#help-wanted" title="Link to this heading"></a></h1>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>Converting more examples from C to Python</p></li>
|
|
||||||
<li><p>Testing on more platforms</p></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="license">
|
|
||||||
<h1>License<a class="headerlink" href="#license" title="Link to this heading"></a></h1>
|
|
||||||
<p>Eclipse Public License, so you are free to
|
|
||||||
statically link and use in non-free / proprietary / commercial projects!</p>
|
|
||||||
</section>
|
|
||||||
<section id="performance">
|
|
||||||
<h1>Performance<a class="headerlink" href="#performance" title="Link to this heading"></a></h1>
|
|
||||||
<p>If you need more performance, do in this order:</p>
|
|
||||||
<ol class="arabic simple">
|
|
||||||
<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
|
|
||||||
and then only convert them to C data structures when you have to call the C functions for drawing.</p></li>
|
|
||||||
<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">
|
|
||||||
<h2>Bunnymark<a class="headerlink" href="#bunnymark" title="Link to this heading"></a></h2>
|
|
||||||
<table class="docutils align-default">
|
|
||||||
<thead>
|
|
||||||
<tr class="row-odd"><th class="head"><p>Library</p></th>
|
|
||||||
<th class="head"><p>Implementation</p></th>
|
|
||||||
<th class="head"><p>Bunnies (60 FPS)</p></th>
|
|
||||||
<th class="head"><p>Percentage</p></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="row-even"><td><p>Raylib 5.0</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>168100</p></td>
|
|
||||||
<td><p>100%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
|
|
||||||
<td><p>Pypy 3.7</p></td>
|
|
||||||
<td><p>33800</p></td>
|
|
||||||
<td><p>20%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
|
|
||||||
<td><p>Python 3.9</p></td>
|
|
||||||
<td><p>7700</p></td>
|
|
||||||
<td><p>4.5%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
|
|
||||||
<td><p>Python 3.9 Nuitka</p></td>
|
|
||||||
<td><p>8600</p></td>
|
|
||||||
<td><p>5.1%</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7 Dynamic</p></td>
|
|
||||||
<td><p>Python 3.9</p></td>
|
|
||||||
<td><p>6300</p></td>
|
|
||||||
<td><p>3.7%</p></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p>See also https://github.com/electronstudio/megabunny/</p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="packaging-your-app">
|
|
||||||
<h1>Packaging your app<a class="headerlink" href="#packaging-your-app" title="Link 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>
|
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install nuitka
|
|
||||||
cd examples/textures
|
|
||||||
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="advert">
|
|
||||||
<h1>Advert<a class="headerlink" href="#advert" title="Link 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://github.com/electronstudio/pygame-zero-book">Coding Games With Pygame Zero & Python</a> is
|
|
||||||
a book for Python beginners.</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
||||||
<a href="index.html" class="btn btn-neutral float-left" title="Raylib Python" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
||||||
<a href="pyray.html" class="btn btn-neutral float-right" title="Python API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<div role="contentinfo">
|
|
||||||
<p>© Copyright 2021, Richard Smith.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
||||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
||||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function () {
|
|
||||||
SphinxRtdTheme.Navigation.enable(true);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
203
docs/RPI.html
203
docs/RPI.html
|
@ -1,203 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Raspberry Pi — Raylib Python documentation</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
|
||||||
|
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
<script src="_static/js/theme.js"></script>
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="prev" title="Building from source" href="BUILDING.html" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
|
||||||
<div class="wy-grid-for-nav">
|
|
||||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
||||||
<div class="wy-side-scroll">
|
|
||||||
<div class="wy-side-nav-search" >
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="index.html" class="icon icon-home">
|
|
||||||
Raylib Python
|
|
||||||
</a>
|
|
||||||
<div role="search">
|
|
||||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
||||||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
||||||
<input type="hidden" name="check_keywords" value="yes" />
|
|
||||||
<input type="hidden" name="area" value="default" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</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>
|
|
||||||
<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#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#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#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#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#license">License</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#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="pyray.html">Python 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="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-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>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
||||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
||||||
<a href="index.html">Raylib Python</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="wy-nav-content">
|
|
||||||
<div class="rst-content">
|
|
||||||
<div role="navigation" aria-label="Page navigation">
|
|
||||||
<ul class="wy-breadcrumbs">
|
|
||||||
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
|
|
||||||
<li class="breadcrumb-item active">Raspberry Pi</li>
|
|
||||||
<li class="wy-breadcrumbs-aside">
|
|
||||||
<a href="_sources/RPI.rst.txt" rel="nofollow"> View page source</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<hr/>
|
|
||||||
</div>
|
|
||||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
||||||
<div itemprop="articleBody">
|
|
||||||
|
|
||||||
<section id="raspberry-pi">
|
|
||||||
<h1>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h1>
|
|
||||||
<p>Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.</p>
|
|
||||||
<section id="option-1-binary-wheel">
|
|
||||||
<h2>Option 1: Binary wheel<a class="headerlink" href="#option-1-binary-wheel" title="Link to this heading"></a></h2>
|
|
||||||
<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">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>
|
|
||||||
</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
|
|
||||||
installed at once.</p>
|
|
||||||
<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 instructions on this, see <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi">https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi</a> . If you need help with this ask Raylib.</p>
|
|
||||||
</section>
|
|
||||||
<section 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">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">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">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">sudo</span> <span class="n">make</span> <span class="n">install</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>
|
|
||||||
<div class="admonition attention">
|
|
||||||
<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
|
|
||||||
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
|
|
||||||
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>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
||||||
<a href="BUILDING.html" class="btn btn-neutral float-left" title="Building from source" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<div role="contentinfo">
|
|
||||||
<p>© Copyright 2021, Richard Smith.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
||||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
||||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function () {
|
|
||||||
SphinxRtdTheme.Navigation.enable(true);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,221 +0,0 @@
|
||||||
Building from source
|
|
||||||
====================
|
|
||||||
|
|
||||||
Have Pip build from source
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
This is useful if the binaries don’t work on your system, or you want to use a newer version of Raylib.
|
|
||||||
|
|
||||||
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: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake
|
|
||||||
|
|
||||||
Requirements for build: cmake, pkg-config.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-5.0
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Then ask Pip to build from source:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
|
|
||||||
|
|
||||||
Or, Build from source manually
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
Useful if the Pip build doesn’t work and you want to debug it, or you want to contribute to the
|
|
||||||
project.
|
|
||||||
|
|
||||||
.. attention::
|
|
||||||
If the Pip build doesn’t work, please submit a bug. (And if you have
|
|
||||||
fixed it, a PR.)
|
|
||||||
|
|
||||||
Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
|
|
||||||
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml
|
|
||||||
|
|
||||||
Windows manual build
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Clone this repo including submodules so you get correct version of
|
|
||||||
Raylib.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
|
||||||
|
|
||||||
Open Visual C++ command shell.
|
|
||||||
|
|
||||||
Fix the symlink that doesnt work on Windows
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-python-cffi
|
|
||||||
copy raylib-c\src\raylib.h raylib\raylib.h
|
|
||||||
|
|
||||||
Build and install Raylib from the raylib-c directory.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-python-cffi/raylib-c
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
msbuild raylib.sln /target:raylib /property:Configuration=Release
|
|
||||||
copy raylib\Release\raylib.lib ..\..
|
|
||||||
cd ..\..
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To build a binary wheel distribution:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
rmdir /Q /S build
|
|
||||||
pip3 install cffi
|
|
||||||
pip3 install 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:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install dist\raylib-3.7.0-cp37-cp37m-win_amd64.whl
|
|
||||||
|
|
||||||
(Note: your wheel’s filename will probably be different than the one
|
|
||||||
here.)
|
|
||||||
|
|
||||||
Linux manual build
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Clone this repo including submodules so you get correct version of
|
|
||||||
Raylib.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
|
||||||
|
|
||||||
Build and install Raylib from the raylib-c directory.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
You can instead use a different version of Raylib you installed from elsewhere, and it should still
|
|
||||||
work!
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config cmake
|
|
||||||
cd raylib-python-cffi/raylib-c
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
.. note:: Optional: Build the Raylib shared libs, if you plan to use
|
|
||||||
``raylib_dynamic`` binding.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
rm -rf *
|
|
||||||
cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
|
|
||||||
Build the Python library:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install cffi
|
|
||||||
rm -rf build raylib/_raylib_cffi.*
|
|
||||||
python3 raylib/build.py
|
|
||||||
|
|
||||||
.. note:: (Optional) To update the Linux dynamic libs (names will be different on other platforms):
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
rm dynamic/raylib/*.so*
|
|
||||||
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/
|
|
||||||
|
|
||||||
To build a binary wheel distribution:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install wheel
|
|
||||||
python3 setup.py bdist_wheel
|
|
||||||
|
|
||||||
|
|
||||||
Then install it:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install dist/raylib*.whl
|
|
||||||
|
|
||||||
To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
./raylib/build_multi.sh
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
pypi wont accept Linux packages unless they are built
|
|
||||||
``--plat-name manylinux2014_x86_64`` so on linux please run
|
|
||||||
``./raylib/build_multi_linux.sh`` )
|
|
||||||
|
|
||||||
.. TODO::
|
|
||||||
Separate the instructions for preparing the dynamic module
|
|
||||||
from the instructions for building the static module!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Macos manual build
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
These instructions have been tested on Macos 10.14.
|
|
||||||
|
|
||||||
Clone this repo including submodules so you get correct version of
|
|
||||||
Raylib.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
|
|
||||||
|
|
||||||
Build and install Raylib from the raylib-c directory.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd raylib-python-cffi/raylib-c/
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
|
|
||||||
Build and install module.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
pip3 install cffi
|
|
||||||
rm -rf build raylib/_raylib_cffi.*
|
|
||||||
python3 raylib/build.py
|
|
||||||
pip3 install wheel
|
|
||||||
python3 setup.py install
|
|
||||||
|
|
||||||
|
|
|
@ -1,278 +0,0 @@
|
||||||
# Python Bindings for Raylib 5.5
|
|
||||||
## Libraries: raymath, raygui, rlgl, physac and GLFW
|
|
||||||
## Backends: Desktop, SDL, DRM, Web
|
|
||||||
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
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
|
|
||||||
original Raylib.
|
|
||||||
* Faster, fewer bugs and easier to maintain than ctypes.
|
|
||||||
* Commercial-friendly license.
|
|
||||||
* Docstrings and auto-completion.
|
|
||||||
* Type checking with Mypy
|
|
||||||
|
|
||||||
|
|
||||||
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
|
||||||
|
|
||||||
# Quickstart
|
|
||||||
|
|
||||||
`pip3 install raylib==5.5.0.2 --break-system-packages`
|
|
||||||
```python
|
|
||||||
from pyray import *
|
|
||||||
init_window(800, 450, "Hello")
|
|
||||||
while not window_should_close():
|
|
||||||
begin_drawing()
|
|
||||||
clear_background(WHITE)
|
|
||||||
draw_text("Hello world", 190, 200, 20, VIOLET)
|
|
||||||
end_drawing()
|
|
||||||
close_window()
|
|
||||||
```
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
|
|
||||||
If you are on a modern Linux you will probably want to create a venv:
|
|
||||||
|
|
||||||
python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
Then make sure you have the latest pip installed:
|
|
||||||
|
|
||||||
python3 -m pip install --upgrade pip
|
|
||||||
|
|
||||||
Then install
|
|
||||||
|
|
||||||
python3 -m pip install setuptools
|
|
||||||
python3 -m pip install raylib==5.5.0.2
|
|
||||||
|
|
||||||
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
|
|
||||||
source, in which case you will need to have Raylib development libs installed, e.g.
|
|
||||||
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
|
|
||||||
|
|
||||||
[Using on Rasperry Pi](RPI.rst)
|
|
||||||
|
|
||||||
# Backends
|
|
||||||
|
|
||||||
## Dynamic binding version
|
|
||||||
|
|
||||||
There is now a separate dynamic version of this binding:
|
|
||||||
|
|
||||||
python3 -m pip uninstall raylib
|
|
||||||
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)
|
|
||||||
|
|
||||||
You can't have multiple raylib packages installed at once.
|
|
||||||
|
|
||||||
## SDL backend
|
|
||||||
|
|
||||||
This is not well tested but has better support for controllers:
|
|
||||||
|
|
||||||
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?
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
If you need help you can try asking on [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
|
|
||||||
for issues that are not Python-specific.
|
|
||||||
|
|
||||||
If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
|
|
||||||
|
|
||||||
|
|
||||||
# How to use
|
|
||||||
|
|
||||||
There are *two* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
|
|
||||||
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
|
|
||||||
|
|
||||||
Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
|
||||||
|
|
||||||
### If you prefer a more Pythonistic API
|
|
||||||
|
|
||||||
Use [the pyray module](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
|
|
||||||
|
|
||||||
[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)
|
|
||||||
|
|
||||||
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
|
|
||||||
|
|
||||||
[Eidolon](https://github.com/Miou-zora/Eidolon)
|
|
||||||
|
|
||||||
Add your app here!
|
|
||||||
|
|
||||||
# RLZero
|
|
||||||
|
|
||||||
A related library (that is a work in progress!):
|
|
||||||
|
|
||||||
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/rlzero)
|
|
||||||
|
|
||||||
# Help wanted
|
|
||||||
|
|
||||||
* Converting more examples from C to Python
|
|
||||||
* Testing on more platforms
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
Eclipse Public License, so you are free to
|
|
||||||
statically link and use in non-free / proprietary / commercial projects!
|
|
||||||
|
|
||||||
# Performance
|
|
||||||
|
|
||||||
If you need more performance, do in this order:
|
|
||||||
|
|
||||||
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|
|
||||||
|--------------------------------|-------------------|------------------|------------|
|
|
||||||
| Raylib 5.0 | C | 180000 | 100% |
|
|
||||||
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
|
|
||||||
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
|
|
||||||
| Raylib 3.7 | C | 168100 | 100% |
|
|
||||||
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
|
|
||||||
| 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
|
|
||||||
|
|
||||||
You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:
|
|
||||||
|
|
||||||
pip3 install nuitka
|
|
||||||
cd examples/textures
|
|
||||||
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
|
|
||||||
|
|
||||||
# Advert
|
|
||||||
|
|
||||||
[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
|
|
||||||
a book for Python beginners.
|
|
|
@ -1,97 +0,0 @@
|
||||||
Raspberry Pi
|
|
||||||
====================
|
|
||||||
|
|
||||||
Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.
|
|
||||||
|
|
||||||
Option 1: Binary wheel
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
python -m pip install --break-system-packages raylib
|
|
||||||
|
|
||||||
Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
|
|
||||||
installed at once.
|
|
||||||
|
|
||||||
If it doesn't work, or you're not on Bullseye, or you're 32 bit, you will need to compile your own raylib. See below.
|
|
||||||
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
|
|
||||||
|
|
||||||
Option 2: Compile Raylib from source X11 mode
|
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
This should work for everyone.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
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
|
|
||||||
mkdir build
|
|
||||||
rm -rf 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 ..
|
|
||||||
make
|
|
||||||
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:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. 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
|
|
||||||
with ``PLATFORM_RPI``) be aware they 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.
|
|
|
@ -1,41 +0,0 @@
|
||||||
Dynamic Bindings
|
|
||||||
================
|
|
||||||
|
|
||||||
CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module::
|
|
||||||
|
|
||||||
python3 -m pip install raylib_dynamic
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
There have been some weird failures with dynamic bindings and ctypes bindings before and often the
|
|
||||||
failures are silent
|
|
||||||
so you don't even know something has gone wrong and you don't get proper stacktraces. Also the static bindings are faster.
|
|
||||||
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.
|
|
||||||
|
|
||||||
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::
|
|
||||||
|
|
||||||
from raylib import *
|
|
||||||
|
|
||||||
Instead you have to do::
|
|
||||||
|
|
||||||
from raylib import rl
|
|
||||||
|
|
||||||
Then you access the functions with ``rl.`` prefix.
|
|
||||||
|
|
||||||
See https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py for an example.
|
|
||||||
|
|
||||||
If you use the ``rl.`` prefix then code will work on both static and dynamic bindings.
|
|
||||||
|
|
||||||
.. tip::
|
|
||||||
|
|
||||||
If you access functions via ``import pyray`` then there is no difference at all, but be warned this hasn't been tested much.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Standard Raylib DLLs do not include additional libraries like Raygui, Physac, etc. So these functions won't work.
|
|
||||||
|
|
||||||
.. important::
|
|
||||||
|
|
||||||
If your system already has the Raylib library installed, you can set the environment variable ``USE_EXTERNAL_RAYLIB`` and it will
|
|
||||||
always be used instead of the bundled DLLs.
|
|
|
@ -1,25 +0,0 @@
|
||||||
.. RL Zero documentation master file, created by
|
|
||||||
sphinx-quickstart on Mon Jul 12 14:03:57 2021.
|
|
||||||
You can adapt this file completely to your liking, but it should at least
|
|
||||||
contain the root `toctree` directive.
|
|
||||||
|
|
||||||
Raylib Python
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 1
|
|
||||||
:caption: Contents:
|
|
||||||
|
|
||||||
README
|
|
||||||
pyray
|
|
||||||
raylib
|
|
||||||
dynamic
|
|
||||||
BUILDING
|
|
||||||
RPI
|
|
||||||
|
|
||||||
|
|
||||||
* :ref:`search`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
Python API
|
|
||||||
==============
|
|
||||||
|
|
||||||
This is a wrapper around the C API with some syntactic sugar.
|
|
||||||
|
|
||||||
The API is *still the same as Raylib*, so you should still reply on:
|
|
||||||
|
|
||||||
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
|
||||||
|
|
||||||
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
|
|
||||||
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
|
|
||||||
|
|
||||||
|
|
||||||
The *differences* are:
|
|
||||||
|
|
||||||
* the function names are in **snake_case**.
|
|
||||||
|
|
||||||
* Some string and pointer conversions are handled automatically.
|
|
||||||
|
|
||||||
* There are some helper functions to create structures.
|
|
||||||
|
|
||||||
Examples
|
|
||||||
--------
|
|
||||||
|
|
||||||
Example program:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
import pyray as pr
|
|
||||||
|
|
||||||
pr.init_window(800, 450, "Hello Pyray")
|
|
||||||
pr.set_target_fps(60)
|
|
||||||
|
|
||||||
camera = pr.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
|
|
||||||
|
|
||||||
while not pr.window_should_close():
|
|
||||||
pr.update_camera(camera, pr.CAMERA_ORBITAL)
|
|
||||||
pr.begin_drawing()
|
|
||||||
pr.clear_background(pr.RAYWHITE)
|
|
||||||
pr.begin_mode_3d(camera)
|
|
||||||
pr.draw_grid(20, 1.0)
|
|
||||||
pr.end_mode_3d()
|
|
||||||
pr.draw_text("Hello world", 190, 200, 20, pr.VIOLET)
|
|
||||||
pr.end_drawing()
|
|
||||||
pr.close_window()
|
|
||||||
|
|
||||||
.. tip:: New in 3.7.0.post9:
|
|
||||||
|
|
||||||
You can also now import the functions with no prefix:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
from pyray import *
|
|
||||||
|
|
||||||
init_window(800, 450, "Raylib texture test")
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
|
|
||||||
|
|
||||||
API reference
|
|
||||||
-------------
|
|
||||||
|
|
||||||
.. autoapimodule:: pyray
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
|
@ -1,63 +0,0 @@
|
||||||
C API
|
|
||||||
=============
|
|
||||||
|
|
||||||
The goal of the C API is make usage as similar to the original C as CFFI will allow.
|
|
||||||
So the `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
are very, very similar to the C originals.
|
|
||||||
|
|
||||||
Example program:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
from raylib import *
|
|
||||||
|
|
||||||
InitWindow(800, 450, b"Hello Raylib")
|
|
||||||
SetTargetFPS(60)
|
|
||||||
|
|
||||||
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
|
|
||||||
|
|
||||||
while not WindowShouldClose():
|
|
||||||
UpdateCamera(camera, CAMERA_ORBITAL)
|
|
||||||
BeginDrawing()
|
|
||||||
ClearBackground(RAYWHITE)
|
|
||||||
BeginMode3D(camera[0])
|
|
||||||
DrawGrid(20, 1.0)
|
|
||||||
EndMode3D()
|
|
||||||
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
|
|
||||||
EndDrawing()
|
|
||||||
CloseWindow()
|
|
||||||
|
|
||||||
If you want to be more portable (i.e. same code will work with dynamic bindings) you can prefix the functions like this:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
from raylib import ffi, rl, colors
|
|
||||||
|
|
||||||
rl.InitWindow(800, 450, b"Hello Raylib")
|
|
||||||
rl.SetTargetFPS(60)
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
|
|
||||||
|
|
||||||
.. important:: Your **primary reference** should always be
|
|
||||||
|
|
||||||
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
|
|
||||||
|
|
||||||
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
|
||||||
|
|
||||||
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
|
|
||||||
|
|
||||||
However, here is a list of available functions:
|
|
||||||
|
|
||||||
Functions API reference
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. autoapimodule:: raylib
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
123
docs/_static/_sphinx_javascript_frameworks_compat.js
vendored
123
docs/_static/_sphinx_javascript_frameworks_compat.js
vendored
|
@ -1,123 +0,0 @@
|
||||||
/* Compatability shim for jQuery and underscores.js.
|
|
||||||
*
|
|
||||||
* Copyright Sphinx contributors
|
|
||||||
* Released under the two clause BSD licence
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* small helper function to urldecode strings
|
|
||||||
*
|
|
||||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
|
|
||||||
*/
|
|
||||||
jQuery.urldecode = function(x) {
|
|
||||||
if (!x) {
|
|
||||||
return x
|
|
||||||
}
|
|
||||||
return decodeURIComponent(x.replace(/\+/g, ' '));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* small helper function to urlencode strings
|
|
||||||
*/
|
|
||||||
jQuery.urlencode = encodeURIComponent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns the parsed url parameters of the
|
|
||||||
* current request. Multiple values per key are supported,
|
|
||||||
* it will always return arrays of strings for the value parts.
|
|
||||||
*/
|
|
||||||
jQuery.getQueryParameters = function(s) {
|
|
||||||
if (typeof s === 'undefined')
|
|
||||||
s = document.location.search;
|
|
||||||
var parts = s.substr(s.indexOf('?') + 1).split('&');
|
|
||||||
var result = {};
|
|
||||||
for (var i = 0; i < parts.length; i++) {
|
|
||||||
var tmp = parts[i].split('=', 2);
|
|
||||||
var key = jQuery.urldecode(tmp[0]);
|
|
||||||
var value = jQuery.urldecode(tmp[1]);
|
|
||||||
if (key in result)
|
|
||||||
result[key].push(value);
|
|
||||||
else
|
|
||||||
result[key] = [value];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* highlight a given string on a jquery object by wrapping it in
|
|
||||||
* span elements with the given class name.
|
|
||||||
*/
|
|
||||||
jQuery.fn.highlightText = function(text, className) {
|
|
||||||
function highlight(node, addItems) {
|
|
||||||
if (node.nodeType === 3) {
|
|
||||||
var val = node.nodeValue;
|
|
||||||
var pos = val.toLowerCase().indexOf(text);
|
|
||||||
if (pos >= 0 &&
|
|
||||||
!jQuery(node.parentNode).hasClass(className) &&
|
|
||||||
!jQuery(node.parentNode).hasClass("nohighlight")) {
|
|
||||||
var span;
|
|
||||||
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
|
|
||||||
if (isInSVG) {
|
|
||||||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
||||||
} else {
|
|
||||||
span = document.createElement("span");
|
|
||||||
span.className = className;
|
|
||||||
}
|
|
||||||
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
|
||||||
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
|
|
||||||
document.createTextNode(val.substr(pos + text.length)),
|
|
||||||
node.nextSibling));
|
|
||||||
node.nodeValue = val.substr(0, pos);
|
|
||||||
if (isInSVG) {
|
|
||||||
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
var bbox = node.parentElement.getBBox();
|
|
||||||
rect.x.baseVal.value = bbox.x;
|
|
||||||
rect.y.baseVal.value = bbox.y;
|
|
||||||
rect.width.baseVal.value = bbox.width;
|
|
||||||
rect.height.baseVal.value = bbox.height;
|
|
||||||
rect.setAttribute('class', className);
|
|
||||||
addItems.push({
|
|
||||||
"parent": node.parentNode,
|
|
||||||
"target": rect});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!jQuery(node).is("button, select, textarea")) {
|
|
||||||
jQuery.each(node.childNodes, function() {
|
|
||||||
highlight(this, addItems);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var addItems = [];
|
|
||||||
var result = this.each(function() {
|
|
||||||
highlight(this, addItems);
|
|
||||||
});
|
|
||||||
for (var i = 0; i < addItems.length; ++i) {
|
|
||||||
jQuery(addItems[i].parent).before(addItems[i].target);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* backward compatibility for jQuery.browser
|
|
||||||
* This will be supported until firefox bug is fixed.
|
|
||||||
*/
|
|
||||||
if (!jQuery.browser) {
|
|
||||||
jQuery.uaMatch = function(ua) {
|
|
||||||
ua = ua.toLowerCase();
|
|
||||||
|
|
||||||
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
|
||||||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
|
|
||||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
|
|
||||||
/(msie) ([\w.]+)/.exec(ua) ||
|
|
||||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
|
||||||
[];
|
|
||||||
|
|
||||||
return {
|
|
||||||
browser: match[ 1 ] || "",
|
|
||||||
version: match[ 2 ] || "0"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
jQuery.browser = {};
|
|
||||||
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
|
|
||||||
}
|
|
906
docs/_static/basic.css
vendored
906
docs/_static/basic.css
vendored
|
@ -1,906 +0,0 @@
|
||||||
/*
|
|
||||||
* Sphinx stylesheet -- basic theme.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -- main layout ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.clearer {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.section::after {
|
|
||||||
display: block;
|
|
||||||
content: '';
|
|
||||||
clear: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- relbar ---------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.related {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related h3 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 0 0 10px;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related li.right {
|
|
||||||
float: right;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- sidebar --------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.sphinxsidebarwrapper {
|
|
||||||
padding: 10px 5px 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar {
|
|
||||||
float: left;
|
|
||||||
width: 230px;
|
|
||||||
margin-left: -100%;
|
|
||||||
font-size: 90%;
|
|
||||||
word-wrap: break-word;
|
|
||||||
overflow-wrap : break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul ul,
|
|
||||||
div.sphinxsidebar ul.want-points {
|
|
||||||
margin-left: 20px;
|
|
||||||
list-style: square;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul ul {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar form {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar input {
|
|
||||||
border: 1px solid #98dbcc;
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar #searchbox form.search {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar #searchbox input[type="text"] {
|
|
||||||
float: left;
|
|
||||||
width: 80%;
|
|
||||||
padding: 0.25em;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar #searchbox input[type="submit"] {
|
|
||||||
float: left;
|
|
||||||
width: 20%;
|
|
||||||
border-left: none;
|
|
||||||
padding: 0.25em;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
img {
|
|
||||||
border: 0;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- search page ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
ul.search {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.search li {
|
|
||||||
padding: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.search li a {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.search li p.context {
|
|
||||||
color: #888;
|
|
||||||
margin: 2px 0 0 30px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.keywordmatches li.goodmatch a {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- index page ------------------------------------------------------------ */
|
|
||||||
|
|
||||||
table.contentstable {
|
|
||||||
width: 90%;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.contentstable p.biglink {
|
|
||||||
line-height: 150%;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.biglink {
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.linkdescr {
|
|
||||||
font-style: italic;
|
|
||||||
padding-top: 5px;
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- general index --------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.indextable {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable td {
|
|
||||||
text-align: left;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable ul {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable > tbody > tr > td > ul {
|
|
||||||
padding-left: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable tr.pcap {
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable tr.cap {
|
|
||||||
margin-top: 10px;
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.toggler {
|
|
||||||
margin-right: 3px;
|
|
||||||
margin-top: 3px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.modindex-jumpbox {
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
margin: 1em 0 1em 0;
|
|
||||||
padding: 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.genindex-jumpbox {
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
margin: 1em 0 1em 0;
|
|
||||||
padding: 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- domain module index --------------------------------------------------- */
|
|
||||||
|
|
||||||
table.modindextable td {
|
|
||||||
padding: 2px;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- general body styles --------------------------------------------------- */
|
|
||||||
|
|
||||||
div.body {
|
|
||||||
min-width: 360px;
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p, div.body dd, div.body li, div.body blockquote {
|
|
||||||
-moz-hyphens: auto;
|
|
||||||
-ms-hyphens: auto;
|
|
||||||
-webkit-hyphens: auto;
|
|
||||||
hyphens: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.headerlink {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: #551A8B;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1:hover > a.headerlink,
|
|
||||||
h2:hover > a.headerlink,
|
|
||||||
h3:hover > a.headerlink,
|
|
||||||
h4:hover > a.headerlink,
|
|
||||||
h5:hover > a.headerlink,
|
|
||||||
h6:hover > a.headerlink,
|
|
||||||
dt:hover > a.headerlink,
|
|
||||||
caption:hover > a.headerlink,
|
|
||||||
p.caption:hover > a.headerlink,
|
|
||||||
div.code-block-caption:hover > a.headerlink {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p.caption {
|
|
||||||
text-align: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body td {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.first {
|
|
||||||
margin-top: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.rubric {
|
|
||||||
margin-top: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-left, figure.align-left, .figure.align-left, object.align-left {
|
|
||||||
clear: left;
|
|
||||||
float: left;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-right, figure.align-right, .figure.align-right, object.align-right {
|
|
||||||
clear: right;
|
|
||||||
float: right;
|
|
||||||
margin-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-center, figure.align-center, .figure.align-center, object.align-center {
|
|
||||||
display: block;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-default, figure.align-default, .figure.align-default {
|
|
||||||
display: block;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-left {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-default {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- sidebars -------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.sidebar,
|
|
||||||
aside.sidebar {
|
|
||||||
margin: 0 0 0.5em 1em;
|
|
||||||
border: 1px solid #ddb;
|
|
||||||
padding: 7px;
|
|
||||||
background-color: #ffe;
|
|
||||||
width: 40%;
|
|
||||||
float: right;
|
|
||||||
clear: right;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.sidebar-title {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav.contents,
|
|
||||||
aside.topic,
|
|
||||||
div.admonition, div.topic, blockquote {
|
|
||||||
clear: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- topics ---------------------------------------------------------------- */
|
|
||||||
|
|
||||||
nav.contents,
|
|
||||||
aside.topic,
|
|
||||||
div.topic {
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 7px;
|
|
||||||
margin: 10px 0 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.topic-title {
|
|
||||||
font-size: 1.1em;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- admonitions ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.admonition {
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
padding: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.admonition dt {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.admonition-title {
|
|
||||||
margin: 0px 10px 5px 0px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p.centered {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- content of sidebars/topics/admonitions -------------------------------- */
|
|
||||||
|
|
||||||
div.sidebar > :last-child,
|
|
||||||
aside.sidebar > :last-child,
|
|
||||||
nav.contents > :last-child,
|
|
||||||
aside.topic > :last-child,
|
|
||||||
div.topic > :last-child,
|
|
||||||
div.admonition > :last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sidebar::after,
|
|
||||||
aside.sidebar::after,
|
|
||||||
nav.contents::after,
|
|
||||||
aside.topic::after,
|
|
||||||
div.topic::after,
|
|
||||||
div.admonition::after,
|
|
||||||
blockquote::after {
|
|
||||||
display: block;
|
|
||||||
content: '';
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- tables ---------------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.docutils {
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
border: 0;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.align-center {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.align-default {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table caption span.caption-number {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
table caption span.caption-text {
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils td, table.docutils th {
|
|
||||||
padding: 1px 8px 1px 5px;
|
|
||||||
border-top: 0;
|
|
||||||
border-left: 0;
|
|
||||||
border-right: 0;
|
|
||||||
border-bottom: 1px solid #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
text-align: left;
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.citation {
|
|
||||||
border-left: solid 1px gray;
|
|
||||||
margin-left: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.citation td {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
th > :first-child,
|
|
||||||
td > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
th > :last-child,
|
|
||||||
td > :last-child {
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- figures --------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.figure, figure {
|
|
||||||
margin: 0.5em;
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.figure p.caption, figcaption {
|
|
||||||
padding: 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.figure p.caption span.caption-number,
|
|
||||||
figcaption span.caption-number {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.figure p.caption span.caption-text,
|
|
||||||
figcaption span.caption-text {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- field list styles ----------------------------------------------------- */
|
|
||||||
|
|
||||||
table.field-list td, table.field-list th {
|
|
||||||
border: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list ul {
|
|
||||||
margin: 0;
|
|
||||||
padding-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-name {
|
|
||||||
-moz-hyphens: manual;
|
|
||||||
-ms-hyphens: manual;
|
|
||||||
-webkit-hyphens: manual;
|
|
||||||
hyphens: manual;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- hlist styles ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.hlist {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.hlist td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- object description styles --------------------------------------------- */
|
|
||||||
|
|
||||||
.sig {
|
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-name, code.descname {
|
|
||||||
background-color: transparent;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-name {
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.descname {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-prename, code.descclassname {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.optional {
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-paren {
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-param.n {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* C++ specific styling */
|
|
||||||
|
|
||||||
.sig-inline.c-texpr,
|
|
||||||
.sig-inline.cpp-texpr {
|
|
||||||
font-family: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .k, .sig.c .kt,
|
|
||||||
.sig.cpp .k, .sig.cpp .kt {
|
|
||||||
color: #0033B3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .m,
|
|
||||||
.sig.cpp .m {
|
|
||||||
color: #1750EB;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .s, .sig.c .sc,
|
|
||||||
.sig.cpp .s, .sig.cpp .sc {
|
|
||||||
color: #067D17;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -- other body styles ----------------------------------------------------- */
|
|
||||||
|
|
||||||
ol.arabic {
|
|
||||||
list-style: decimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.loweralpha {
|
|
||||||
list-style: lower-alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.upperalpha {
|
|
||||||
list-style: upper-alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.lowerroman {
|
|
||||||
list-style: lower-roman;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.upperroman {
|
|
||||||
list-style: upper-roman;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(li) > ol > li:first-child > :first-child,
|
|
||||||
:not(li) > ul > li:first-child > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(li) > ol > li:last-child > :last-child,
|
|
||||||
:not(li) > ul > li:last-child > :last-child {
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple ol p,
|
|
||||||
ol.simple ul p,
|
|
||||||
ul.simple ol p,
|
|
||||||
ul.simple ul p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple > li:not(:first-child) > p,
|
|
||||||
ul.simple > li:not(:first-child) > p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple p,
|
|
||||||
ul.simple p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside.footnote > span,
|
|
||||||
div.citation > span {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
aside.footnote > span:last-of-type,
|
|
||||||
div.citation > span:last-of-type {
|
|
||||||
padding-right: 0.5em;
|
|
||||||
}
|
|
||||||
aside.footnote > p {
|
|
||||||
margin-left: 2em;
|
|
||||||
}
|
|
||||||
div.citation > p {
|
|
||||||
margin-left: 4em;
|
|
||||||
}
|
|
||||||
aside.footnote > p:last-of-type,
|
|
||||||
div.citation > p:last-of-type {
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
aside.footnote > p:last-of-type:after,
|
|
||||||
div.citation > p:last-of-type:after {
|
|
||||||
content: "";
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: fit-content(30%) auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list > dt {
|
|
||||||
font-weight: bold;
|
|
||||||
word-break: break-word;
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list > dd {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
margin-top: 0em;
|
|
||||||
margin-left: 0em;
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd ul, dd table {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd {
|
|
||||||
margin-top: 3px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
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 > :last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dt:target, span.highlighted {
|
|
||||||
background-color: #fbe54e;
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.highlighted {
|
|
||||||
fill: #fbe54e;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.glossary dt {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.versionmodified {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.system-message {
|
|
||||||
background-color: #fda;
|
|
||||||
padding: 5px;
|
|
||||||
border: 3px solid red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footnote:target {
|
|
||||||
background-color: #ffa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line-block {
|
|
||||||
display: block;
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line-block .line-block {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
margin-left: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.guilabel, .menuselection {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.accelerator {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classifier {
|
|
||||||
font-style: oblique;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classifier:before {
|
|
||||||
font-style: normal;
|
|
||||||
margin: 0 0.5em;
|
|
||||||
content: ":";
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
abbr, acronym {
|
|
||||||
border-bottom: dotted 1px;
|
|
||||||
cursor: help;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- code displays --------------------------------------------------------- */
|
|
||||||
|
|
||||||
pre {
|
|
||||||
overflow: auto;
|
|
||||||
overflow-y: hidden; /* fixes display issues on Chrome browsers */
|
|
||||||
}
|
|
||||||
|
|
||||||
pre, div[class*="highlight-"] {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.pre {
|
|
||||||
-moz-hyphens: none;
|
|
||||||
-ms-hyphens: none;
|
|
||||||
-webkit-hyphens: none;
|
|
||||||
hyphens: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
div[class*="highlight-"] {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.linenos pre {
|
|
||||||
border: 0;
|
|
||||||
background-color: transparent;
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable tbody {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable tr {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td.linenos {
|
|
||||||
padding-right: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td.code {
|
|
||||||
flex: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.highlight .hll {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.highlight pre,
|
|
||||||
table.highlighttable pre {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption + div {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption {
|
|
||||||
margin-top: 1em;
|
|
||||||
padding: 2px 5px;
|
|
||||||
font-size: small;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption code {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td.linenos,
|
|
||||||
span.linenos,
|
|
||||||
div.highlight span.gp { /* gp: Generic.Prompt */
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: text; /* Safari fallback only */
|
|
||||||
-webkit-user-select: none; /* Chrome/Safari */
|
|
||||||
-moz-user-select: none; /* Firefox */
|
|
||||||
-ms-user-select: none; /* IE10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption span.caption-number {
|
|
||||||
padding: 0.1em 0.3em;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption span.caption-text {
|
|
||||||
}
|
|
||||||
|
|
||||||
div.literal-block-wrapper {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.xref, a code {
|
|
||||||
background-color: transparent;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.viewcode-link {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.viewcode-back {
|
|
||||||
float: right;
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.viewcode-block:target {
|
|
||||||
margin: -1px -10px;
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- math display ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
img.math {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.math p {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.eqno {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.eqno a.headerlink {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.math:hover a.headerlink {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- printout stylesheet --------------------------------------------------- */
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
div.document,
|
|
||||||
div.documentwrapper,
|
|
||||||
div.bodywrapper {
|
|
||||||
margin: 0 !important;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar,
|
|
||||||
div.related,
|
|
||||||
div.footer,
|
|
||||||
#top-link {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
1
docs/_static/css/badge_only.css
vendored
1
docs/_static/css/badge_only.css
vendored
|
@ -1 +0,0 @@
|
||||||
.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}
|
|
BIN
docs/_static/css/fonts/Roboto-Slab-Bold.woff
vendored
BIN
docs/_static/css/fonts/Roboto-Slab-Bold.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/Roboto-Slab-Bold.woff2
vendored
BIN
docs/_static/css/fonts/Roboto-Slab-Bold.woff2
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/Roboto-Slab-Regular.woff
vendored
BIN
docs/_static/css/fonts/Roboto-Slab-Regular.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/Roboto-Slab-Regular.woff2
vendored
BIN
docs/_static/css/fonts/Roboto-Slab-Regular.woff2
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/fontawesome-webfont.eot
vendored
BIN
docs/_static/css/fonts/fontawesome-webfont.eot
vendored
Binary file not shown.
2671
docs/_static/css/fonts/fontawesome-webfont.svg
vendored
2671
docs/_static/css/fonts/fontawesome-webfont.svg
vendored
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 434 KiB |
BIN
docs/_static/css/fonts/fontawesome-webfont.ttf
vendored
BIN
docs/_static/css/fonts/fontawesome-webfont.ttf
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/fontawesome-webfont.woff
vendored
BIN
docs/_static/css/fonts/fontawesome-webfont.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/fontawesome-webfont.woff2
vendored
BIN
docs/_static/css/fonts/fontawesome-webfont.woff2
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-bold-italic.woff
vendored
BIN
docs/_static/css/fonts/lato-bold-italic.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-bold-italic.woff2
vendored
BIN
docs/_static/css/fonts/lato-bold-italic.woff2
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-bold.woff
vendored
BIN
docs/_static/css/fonts/lato-bold.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-bold.woff2
vendored
BIN
docs/_static/css/fonts/lato-bold.woff2
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-normal-italic.woff
vendored
BIN
docs/_static/css/fonts/lato-normal-italic.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-normal-italic.woff2
vendored
BIN
docs/_static/css/fonts/lato-normal-italic.woff2
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-normal.woff
vendored
BIN
docs/_static/css/fonts/lato-normal.woff
vendored
Binary file not shown.
BIN
docs/_static/css/fonts/lato-normal.woff2
vendored
BIN
docs/_static/css/fonts/lato-normal.woff2
vendored
Binary file not shown.
4
docs/_static/css/theme.css
vendored
4
docs/_static/css/theme.css
vendored
File diff suppressed because one or more lines are too long
149
docs/_static/doctools.js
vendored
149
docs/_static/doctools.js
vendored
|
@ -1,149 +0,0 @@
|
||||||
/*
|
|
||||||
* Base JavaScript utilities for all Sphinx HTML documentation.
|
|
||||||
*/
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([
|
|
||||||
"TEXTAREA",
|
|
||||||
"INPUT",
|
|
||||||
"SELECT",
|
|
||||||
"BUTTON",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const _ready = (callback) => {
|
|
||||||
if (document.readyState !== "loading") {
|
|
||||||
callback();
|
|
||||||
} else {
|
|
||||||
document.addEventListener("DOMContentLoaded", callback);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small JavaScript module for the documentation.
|
|
||||||
*/
|
|
||||||
const Documentation = {
|
|
||||||
init: () => {
|
|
||||||
Documentation.initDomainIndexTable();
|
|
||||||
Documentation.initOnKeyListeners();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* i18n support
|
|
||||||
*/
|
|
||||||
TRANSLATIONS: {},
|
|
||||||
PLURAL_EXPR: (n) => (n === 1 ? 0 : 1),
|
|
||||||
LOCALE: "unknown",
|
|
||||||
|
|
||||||
// gettext and ngettext don't access this so that the functions
|
|
||||||
// can safely bound to a different name (_ = Documentation.gettext)
|
|
||||||
gettext: (string) => {
|
|
||||||
const translated = Documentation.TRANSLATIONS[string];
|
|
||||||
switch (typeof translated) {
|
|
||||||
case "undefined":
|
|
||||||
return string; // no translation
|
|
||||||
case "string":
|
|
||||||
return translated; // translation exists
|
|
||||||
default:
|
|
||||||
return translated[0]; // (singular, plural) translation tuple exists
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
ngettext: (singular, plural, n) => {
|
|
||||||
const translated = Documentation.TRANSLATIONS[singular];
|
|
||||||
if (typeof translated !== "undefined")
|
|
||||||
return translated[Documentation.PLURAL_EXPR(n)];
|
|
||||||
return n === 1 ? singular : plural;
|
|
||||||
},
|
|
||||||
|
|
||||||
addTranslations: (catalog) => {
|
|
||||||
Object.assign(Documentation.TRANSLATIONS, catalog.messages);
|
|
||||||
Documentation.PLURAL_EXPR = new Function(
|
|
||||||
"n",
|
|
||||||
`return (${catalog.plural_expr})`
|
|
||||||
);
|
|
||||||
Documentation.LOCALE = catalog.locale;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper function to focus on search bar
|
|
||||||
*/
|
|
||||||
focusSearchBar: () => {
|
|
||||||
document.querySelectorAll("input[name=q]")[0]?.focus();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise the domain index toggle buttons
|
|
||||||
*/
|
|
||||||
initDomainIndexTable: () => {
|
|
||||||
const toggler = (el) => {
|
|
||||||
const idNumber = el.id.substr(7);
|
|
||||||
const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`);
|
|
||||||
if (el.src.substr(-9) === "minus.png") {
|
|
||||||
el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`;
|
|
||||||
toggledRows.forEach((el) => (el.style.display = "none"));
|
|
||||||
} else {
|
|
||||||
el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`;
|
|
||||||
toggledRows.forEach((el) => (el.style.display = ""));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const togglerElements = document.querySelectorAll("img.toggler");
|
|
||||||
togglerElements.forEach((el) =>
|
|
||||||
el.addEventListener("click", (event) => toggler(event.currentTarget))
|
|
||||||
);
|
|
||||||
togglerElements.forEach((el) => (el.style.display = ""));
|
|
||||||
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler);
|
|
||||||
},
|
|
||||||
|
|
||||||
initOnKeyListeners: () => {
|
|
||||||
// only install a listener if it is really needed
|
|
||||||
if (
|
|
||||||
!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
|
|
||||||
!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
document.addEventListener("keydown", (event) => {
|
|
||||||
// bail for input elements
|
|
||||||
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
|
|
||||||
// bail with special keys
|
|
||||||
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
||||||
|
|
||||||
if (!event.shiftKey) {
|
|
||||||
switch (event.key) {
|
|
||||||
case "ArrowLeft":
|
|
||||||
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
|
|
||||||
|
|
||||||
const prevLink = document.querySelector('link[rel="prev"]');
|
|
||||||
if (prevLink && prevLink.href) {
|
|
||||||
window.location.href = prevLink.href;
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "ArrowRight":
|
|
||||||
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
|
|
||||||
|
|
||||||
const nextLink = document.querySelector('link[rel="next"]');
|
|
||||||
if (nextLink && nextLink.href) {
|
|
||||||
window.location.href = nextLink.href;
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// some keyboard layouts may need Shift to get /
|
|
||||||
switch (event.key) {
|
|
||||||
case "/":
|
|
||||||
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
|
|
||||||
Documentation.focusSearchBar();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// quick alias for translations
|
|
||||||
const _ = Documentation.gettext;
|
|
||||||
|
|
||||||
_ready(Documentation.init);
|
|
13
docs/_static/documentation_options.js
vendored
13
docs/_static/documentation_options.js
vendored
|
@ -1,13 +0,0 @@
|
||||||
const DOCUMENTATION_OPTIONS = {
|
|
||||||
VERSION: '',
|
|
||||||
LANGUAGE: 'en',
|
|
||||||
COLLAPSE_INDEX: false,
|
|
||||||
BUILDER: 'html',
|
|
||||||
FILE_SUFFIX: '.html',
|
|
||||||
LINK_SUFFIX: '.html',
|
|
||||||
HAS_SOURCE: true,
|
|
||||||
SOURCELINK_SUFFIX: '.txt',
|
|
||||||
NAVIGATION_WITH_KEYS: false,
|
|
||||||
SHOW_SEARCH_SUMMARY: true,
|
|
||||||
ENABLE_SEARCH_SHORTCUTS: true,
|
|
||||||
};
|
|
BIN
docs/_static/file.png
vendored
BIN
docs/_static/file.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 286 B |
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.
12
docs/_static/graphviz.css
vendored
12
docs/_static/graphviz.css
vendored
|
@ -1,12 +0,0 @@
|
||||||
/*
|
|
||||||
* Sphinx stylesheet -- graphviz extension.
|
|
||||||
*/
|
|
||||||
|
|
||||||
img.graphviz {
|
|
||||||
border: 0;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
object.graphviz {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
2
docs/_static/jquery.js
vendored
2
docs/_static/jquery.js
vendored
File diff suppressed because one or more lines are too long
1
docs/_static/js/badge_only.js
vendored
1
docs/_static/js/badge_only.js
vendored
|
@ -1 +0,0 @@
|
||||||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}});
|
|
1
docs/_static/js/theme.js
vendored
1
docs/_static/js/theme.js
vendored
File diff suppressed because one or more lines are too long
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);
|
|
||||||
});
|
|
||||||
});
|
|
192
docs/_static/language_data.js
vendored
192
docs/_static/language_data.js
vendored
|
@ -1,192 +0,0 @@
|
||||||
/*
|
|
||||||
* This script contains the language-specific data used by searchtools.js,
|
|
||||||
* namely the list of stopwords, stemmer, scorer and splitter.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Porter Stemmer
|
|
||||||
*/
|
|
||||||
var Stemmer = function() {
|
|
||||||
|
|
||||||
var step2list = {
|
|
||||||
ational: 'ate',
|
|
||||||
tional: 'tion',
|
|
||||||
enci: 'ence',
|
|
||||||
anci: 'ance',
|
|
||||||
izer: 'ize',
|
|
||||||
bli: 'ble',
|
|
||||||
alli: 'al',
|
|
||||||
entli: 'ent',
|
|
||||||
eli: 'e',
|
|
||||||
ousli: 'ous',
|
|
||||||
ization: 'ize',
|
|
||||||
ation: 'ate',
|
|
||||||
ator: 'ate',
|
|
||||||
alism: 'al',
|
|
||||||
iveness: 'ive',
|
|
||||||
fulness: 'ful',
|
|
||||||
ousness: 'ous',
|
|
||||||
aliti: 'al',
|
|
||||||
iviti: 'ive',
|
|
||||||
biliti: 'ble',
|
|
||||||
logi: 'log'
|
|
||||||
};
|
|
||||||
|
|
||||||
var step3list = {
|
|
||||||
icate: 'ic',
|
|
||||||
ative: '',
|
|
||||||
alize: 'al',
|
|
||||||
iciti: 'ic',
|
|
||||||
ical: 'ic',
|
|
||||||
ful: '',
|
|
||||||
ness: ''
|
|
||||||
};
|
|
||||||
|
|
||||||
var c = "[^aeiou]"; // consonant
|
|
||||||
var v = "[aeiouy]"; // vowel
|
|
||||||
var C = c + "[^aeiouy]*"; // consonant sequence
|
|
||||||
var V = v + "[aeiou]*"; // vowel sequence
|
|
||||||
|
|
||||||
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
|
|
||||||
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
|
|
||||||
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
|
|
||||||
var s_v = "^(" + C + ")?" + v; // vowel in stem
|
|
||||||
|
|
||||||
this.stemWord = function (w) {
|
|
||||||
var stem;
|
|
||||||
var suffix;
|
|
||||||
var firstch;
|
|
||||||
var origword = w;
|
|
||||||
|
|
||||||
if (w.length < 3)
|
|
||||||
return w;
|
|
||||||
|
|
||||||
var re;
|
|
||||||
var re2;
|
|
||||||
var re3;
|
|
||||||
var re4;
|
|
||||||
|
|
||||||
firstch = w.substr(0,1);
|
|
||||||
if (firstch == "y")
|
|
||||||
w = firstch.toUpperCase() + w.substr(1);
|
|
||||||
|
|
||||||
// Step 1a
|
|
||||||
re = /^(.+?)(ss|i)es$/;
|
|
||||||
re2 = /^(.+?)([^s])s$/;
|
|
||||||
|
|
||||||
if (re.test(w))
|
|
||||||
w = w.replace(re,"$1$2");
|
|
||||||
else if (re2.test(w))
|
|
||||||
w = w.replace(re2,"$1$2");
|
|
||||||
|
|
||||||
// Step 1b
|
|
||||||
re = /^(.+?)eed$/;
|
|
||||||
re2 = /^(.+?)(ed|ing)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
re = new RegExp(mgr0);
|
|
||||||
if (re.test(fp[1])) {
|
|
||||||
re = /.$/;
|
|
||||||
w = w.replace(re,"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (re2.test(w)) {
|
|
||||||
var fp = re2.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re2 = new RegExp(s_v);
|
|
||||||
if (re2.test(stem)) {
|
|
||||||
w = stem;
|
|
||||||
re2 = /(at|bl|iz)$/;
|
|
||||||
re3 = new RegExp("([^aeiouylsz])\\1$");
|
|
||||||
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
|
||||||
if (re2.test(w))
|
|
||||||
w = w + "e";
|
|
||||||
else if (re3.test(w)) {
|
|
||||||
re = /.$/;
|
|
||||||
w = w.replace(re,"");
|
|
||||||
}
|
|
||||||
else if (re4.test(w))
|
|
||||||
w = w + "e";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 1c
|
|
||||||
re = /^(.+?)y$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re = new RegExp(s_v);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem + "i";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 2
|
|
||||||
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
suffix = fp[2];
|
|
||||||
re = new RegExp(mgr0);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem + step2list[suffix];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 3
|
|
||||||
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
suffix = fp[2];
|
|
||||||
re = new RegExp(mgr0);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem + step3list[suffix];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 4
|
|
||||||
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
|
|
||||||
re2 = /^(.+?)(s|t)(ion)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re = new RegExp(mgr1);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem;
|
|
||||||
}
|
|
||||||
else if (re2.test(w)) {
|
|
||||||
var fp = re2.exec(w);
|
|
||||||
stem = fp[1] + fp[2];
|
|
||||||
re2 = new RegExp(mgr1);
|
|
||||||
if (re2.test(stem))
|
|
||||||
w = stem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 5
|
|
||||||
re = /^(.+?)e$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re = new RegExp(mgr1);
|
|
||||||
re2 = new RegExp(meq1);
|
|
||||||
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
|
||||||
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
|
|
||||||
w = stem;
|
|
||||||
}
|
|
||||||
re = /ll$/;
|
|
||||||
re2 = new RegExp(mgr1);
|
|
||||||
if (re.test(w) && re2.test(w)) {
|
|
||||||
re = /.$/;
|
|
||||||
w = w.replace(re,"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// and turn initial Y back to y
|
|
||||||
if (firstch == "y")
|
|
||||||
w = firstch.toLowerCase() + w.substr(1);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
BIN
docs/_static/minus.png
vendored
BIN
docs/_static/minus.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 90 B |
BIN
docs/_static/plus.png
vendored
BIN
docs/_static/plus.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 90 B |
75
docs/_static/pygments.css
vendored
75
docs/_static/pygments.css
vendored
|
@ -1,75 +0,0 @@
|
||||||
pre { line-height: 125%; }
|
|
||||||
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
||||||
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
||||||
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
||||||
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
||||||
.highlight .hll { background-color: #ffffcc }
|
|
||||||
.highlight { background: #eeffcc; }
|
|
||||||
.highlight .c { color: #408090; font-style: italic } /* Comment */
|
|
||||||
.highlight .err { border: 1px solid #F00 } /* Error */
|
|
||||||
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
|
|
||||||
.highlight .o { color: #666 } /* Operator */
|
|
||||||
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
|
|
||||||
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
|
|
||||||
.highlight .cp { color: #007020 } /* Comment.Preproc */
|
|
||||||
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
|
|
||||||
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
|
|
||||||
.highlight .cs { color: #408090; background-color: #FFF0F0 } /* Comment.Special */
|
|
||||||
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
|
||||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
|
||||||
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
|
|
||||||
.highlight .gr { color: #F00 } /* Generic.Error */
|
|
||||||
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
|
||||||
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
|
||||||
.highlight .go { color: #333 } /* Generic.Output */
|
|
||||||
.highlight .gp { color: #C65D09; font-weight: bold } /* Generic.Prompt */
|
|
||||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
|
||||||
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
|
||||||
.highlight .gt { color: #04D } /* Generic.Traceback */
|
|
||||||
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
|
||||||
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
|
||||||
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
|
||||||
.highlight .kp { color: #007020 } /* Keyword.Pseudo */
|
|
||||||
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
|
||||||
.highlight .kt { color: #902000 } /* Keyword.Type */
|
|
||||||
.highlight .m { color: #208050 } /* Literal.Number */
|
|
||||||
.highlight .s { color: #4070A0 } /* Literal.String */
|
|
||||||
.highlight .na { color: #4070A0 } /* Name.Attribute */
|
|
||||||
.highlight .nb { color: #007020 } /* Name.Builtin */
|
|
||||||
.highlight .nc { color: #0E84B5; font-weight: bold } /* Name.Class */
|
|
||||||
.highlight .no { color: #60ADD5 } /* Name.Constant */
|
|
||||||
.highlight .nd { color: #555; font-weight: bold } /* Name.Decorator */
|
|
||||||
.highlight .ni { color: #D55537; font-weight: bold } /* Name.Entity */
|
|
||||||
.highlight .ne { color: #007020 } /* Name.Exception */
|
|
||||||
.highlight .nf { color: #06287E } /* Name.Function */
|
|
||||||
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
|
|
||||||
.highlight .nn { color: #0E84B5; font-weight: bold } /* Name.Namespace */
|
|
||||||
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
|
||||||
.highlight .nv { color: #BB60D5 } /* Name.Variable */
|
|
||||||
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
|
||||||
.highlight .w { color: #BBB } /* Text.Whitespace */
|
|
||||||
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
|
||||||
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
|
||||||
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
|
||||||
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
|
||||||
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
|
|
||||||
.highlight .sa { color: #4070A0 } /* Literal.String.Affix */
|
|
||||||
.highlight .sb { color: #4070A0 } /* Literal.String.Backtick */
|
|
||||||
.highlight .sc { color: #4070A0 } /* Literal.String.Char */
|
|
||||||
.highlight .dl { color: #4070A0 } /* Literal.String.Delimiter */
|
|
||||||
.highlight .sd { color: #4070A0; font-style: italic } /* Literal.String.Doc */
|
|
||||||
.highlight .s2 { color: #4070A0 } /* Literal.String.Double */
|
|
||||||
.highlight .se { color: #4070A0; font-weight: bold } /* Literal.String.Escape */
|
|
||||||
.highlight .sh { color: #4070A0 } /* Literal.String.Heredoc */
|
|
||||||
.highlight .si { color: #70A0D0; font-style: italic } /* Literal.String.Interpol */
|
|
||||||
.highlight .sx { color: #C65D09 } /* Literal.String.Other */
|
|
||||||
.highlight .sr { color: #235388 } /* Literal.String.Regex */
|
|
||||||
.highlight .s1 { color: #4070A0 } /* Literal.String.Single */
|
|
||||||
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
|
|
||||||
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
|
||||||
.highlight .fm { color: #06287E } /* Name.Function.Magic */
|
|
||||||
.highlight .vc { color: #BB60D5 } /* Name.Variable.Class */
|
|
||||||
.highlight .vg { color: #BB60D5 } /* Name.Variable.Global */
|
|
||||||
.highlight .vi { color: #BB60D5 } /* Name.Variable.Instance */
|
|
||||||
.highlight .vm { color: #BB60D5 } /* Name.Variable.Magic */
|
|
||||||
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
|
|
635
docs/_static/searchtools.js
vendored
635
docs/_static/searchtools.js
vendored
|
@ -1,635 +0,0 @@
|
||||||
/*
|
|
||||||
* Sphinx JavaScript utilities for the full-text search.
|
|
||||||
*/
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple result scoring code.
|
|
||||||
*/
|
|
||||||
if (typeof Scorer === "undefined") {
|
|
||||||
var Scorer = {
|
|
||||||
// Implement the following function to further tweak the score for each result
|
|
||||||
// The function takes a result array [docname, title, anchor, descr, score, filename]
|
|
||||||
// and returns the new score.
|
|
||||||
/*
|
|
||||||
score: result => {
|
|
||||||
const [docname, title, anchor, descr, score, filename, kind] = result
|
|
||||||
return score
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
// query matches the full name of an object
|
|
||||||
objNameMatch: 11,
|
|
||||||
// or matches in the last dotted part of the object name
|
|
||||||
objPartialMatch: 6,
|
|
||||||
// Additive scores depending on the priority of the object
|
|
||||||
objPrio: {
|
|
||||||
0: 15, // used to be importantResults
|
|
||||||
1: 5, // used to be objectResults
|
|
||||||
2: -5, // used to be unimportantResults
|
|
||||||
},
|
|
||||||
// Used when the priority is not in the mapping.
|
|
||||||
objPrioDefault: 0,
|
|
||||||
|
|
||||||
// query found in title
|
|
||||||
title: 15,
|
|
||||||
partialTitle: 7,
|
|
||||||
// query found in terms
|
|
||||||
term: 5,
|
|
||||||
partialTerm: 2,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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) => {
|
|
||||||
while (element && element.lastChild) element.removeChild(element.lastChild);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
|
||||||
*/
|
|
||||||
const _escapeRegExp = (string) =>
|
|
||||||
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
||||||
|
|
||||||
const _displayItem = (item, searchTerms, highlightTerms) => {
|
|
||||||
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
|
|
||||||
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
|
|
||||||
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
|
|
||||||
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
|
|
||||||
const contentRoot = document.documentElement.dataset.content_root;
|
|
||||||
|
|
||||||
const [docName, title, anchor, descr, score, _filename, kind] = item;
|
|
||||||
|
|
||||||
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 linkUrl;
|
|
||||||
if (docBuilder === "dirhtml") {
|
|
||||||
// dirhtml builder
|
|
||||||
let dirname = docName + "/";
|
|
||||||
if (dirname.match(/\/index\/$/))
|
|
||||||
dirname = dirname.substring(0, dirname.length - 6);
|
|
||||||
else if (dirname === "index/") dirname = "";
|
|
||||||
requestUrl = contentRoot + dirname;
|
|
||||||
linkUrl = requestUrl;
|
|
||||||
} else {
|
|
||||||
// normal html builders
|
|
||||||
requestUrl = contentRoot + docName + docFileSuffix;
|
|
||||||
linkUrl = docName + docLinkSuffix;
|
|
||||||
}
|
|
||||||
let linkEl = listItem.appendChild(document.createElement("a"));
|
|
||||||
linkEl.href = linkUrl + anchor;
|
|
||||||
linkEl.dataset.score = score;
|
|
||||||
linkEl.innerHTML = title;
|
|
||||||
if (descr) {
|
|
||||||
listItem.appendChild(document.createElement("span")).innerHTML =
|
|
||||||
" (" + 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)
|
|
||||||
fetch(requestUrl)
|
|
||||||
.then((responseData) => responseData.text())
|
|
||||||
.then((data) => {
|
|
||||||
if (data)
|
|
||||||
listItem.appendChild(
|
|
||||||
Search.makeSearchSummary(data, searchTerms, anchor)
|
|
||||||
);
|
|
||||||
// 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);
|
|
||||||
};
|
|
||||||
const _finishSearch = (resultCount) => {
|
|
||||||
Search.stopPulse();
|
|
||||||
Search.title.innerText = _("Search Results");
|
|
||||||
if (!resultCount)
|
|
||||||
Search.status.innerText = Documentation.gettext(
|
|
||||||
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
|
|
||||||
);
|
|
||||||
else
|
|
||||||
Search.status.innerText = Documentation.ngettext(
|
|
||||||
"Search finished, found one page matching the search query.",
|
|
||||||
"Search finished, found ${resultCount} pages matching the search query.",
|
|
||||||
resultCount,
|
|
||||||
).replace('${resultCount}', resultCount);
|
|
||||||
};
|
|
||||||
const _displayNextItem = (
|
|
||||||
results,
|
|
||||||
resultCount,
|
|
||||||
searchTerms,
|
|
||||||
highlightTerms,
|
|
||||||
) => {
|
|
||||||
// results left, load the summary and display it
|
|
||||||
// this is intended to be dynamic (don't sub resultsCount)
|
|
||||||
if (results.length) {
|
|
||||||
_displayItem(results.pop(), searchTerms, highlightTerms);
|
|
||||||
setTimeout(
|
|
||||||
() => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
|
|
||||||
5
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// search finished, update title and status message
|
|
||||||
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
|
|
||||||
* custom function per language.
|
|
||||||
*
|
|
||||||
* The regular expression works by splitting the string on consecutive characters
|
|
||||||
* that are not Unicode letters, numbers, underscores, or emoji characters.
|
|
||||||
* This is the same as ``\W+`` in Python, preserving the surrogate pair area.
|
|
||||||
*/
|
|
||||||
if (typeof splitQuery === "undefined") {
|
|
||||||
var splitQuery = (query) => query
|
|
||||||
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu)
|
|
||||||
.filter(term => term) // remove remaining empty strings
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search Module
|
|
||||||
*/
|
|
||||||
const Search = {
|
|
||||||
_index: null,
|
|
||||||
_queued_query: null,
|
|
||||||
_pulse_status: -1,
|
|
||||||
|
|
||||||
htmlToText: (htmlString, anchor) => {
|
|
||||||
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
|
|
||||||
for (const removalQuery of [".headerlink", "script", "style"]) {
|
|
||||||
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"]');
|
|
||||||
if (docContent) return docContent.textContent;
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
"Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
|
|
||||||
);
|
|
||||||
return "";
|
|
||||||
},
|
|
||||||
|
|
||||||
init: () => {
|
|
||||||
const query = new URLSearchParams(window.location.search).get("q");
|
|
||||||
document
|
|
||||||
.querySelectorAll('input[name="q"]')
|
|
||||||
.forEach((el) => (el.value = query));
|
|
||||||
if (query) Search.performSearch(query);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadIndex: (url) =>
|
|
||||||
(document.body.appendChild(document.createElement("script")).src = url),
|
|
||||||
|
|
||||||
setIndex: (index) => {
|
|
||||||
Search._index = index;
|
|
||||||
if (Search._queued_query !== null) {
|
|
||||||
const query = Search._queued_query;
|
|
||||||
Search._queued_query = null;
|
|
||||||
Search.query(query);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
hasIndex: () => Search._index !== null,
|
|
||||||
|
|
||||||
deferQuery: (query) => (Search._queued_query = query),
|
|
||||||
|
|
||||||
stopPulse: () => (Search._pulse_status = -1),
|
|
||||||
|
|
||||||
startPulse: () => {
|
|
||||||
if (Search._pulse_status >= 0) return;
|
|
||||||
|
|
||||||
const pulse = () => {
|
|
||||||
Search._pulse_status = (Search._pulse_status + 1) % 4;
|
|
||||||
Search.dots.innerText = ".".repeat(Search._pulse_status);
|
|
||||||
if (Search._pulse_status >= 0) window.setTimeout(pulse, 500);
|
|
||||||
};
|
|
||||||
pulse();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* perform a search for something (or wait until index is loaded)
|
|
||||||
*/
|
|
||||||
performSearch: (query) => {
|
|
||||||
// create the required interface elements
|
|
||||||
const searchText = document.createElement("h2");
|
|
||||||
searchText.textContent = _("Searching");
|
|
||||||
const searchSummary = document.createElement("p");
|
|
||||||
searchSummary.classList.add("search-summary");
|
|
||||||
searchSummary.innerText = "";
|
|
||||||
const searchList = document.createElement("ul");
|
|
||||||
searchList.setAttribute("role", "list");
|
|
||||||
searchList.classList.add("search");
|
|
||||||
|
|
||||||
const out = document.getElementById("search-results");
|
|
||||||
Search.title = out.appendChild(searchText);
|
|
||||||
Search.dots = Search.title.appendChild(document.createElement("span"));
|
|
||||||
Search.status = out.appendChild(searchSummary);
|
|
||||||
Search.output = out.appendChild(searchList);
|
|
||||||
|
|
||||||
const searchProgress = document.getElementById("search-progress");
|
|
||||||
// Some themes don't use the search progress node
|
|
||||||
if (searchProgress) {
|
|
||||||
searchProgress.innerText = _("Preparing search...");
|
|
||||||
}
|
|
||||||
Search.startPulse();
|
|
||||||
|
|
||||||
// index already loaded, the browser was quick!
|
|
||||||
if (Search.hasIndex()) Search.query(query);
|
|
||||||
else Search.deferQuery(query);
|
|
||||||
},
|
|
||||||
|
|
||||||
_parseQuery: (query) => {
|
|
||||||
// stem the search terms and add them to the correct list
|
|
||||||
const stemmer = new Stemmer();
|
|
||||||
const searchTerms = new Set();
|
|
||||||
const excludedTerms = new Set();
|
|
||||||
const highlightTerms = new Set();
|
|
||||||
const objectTerms = new Set(splitQuery(query.toLowerCase().trim()));
|
|
||||||
splitQuery(query.trim()).forEach((queryTerm) => {
|
|
||||||
const queryTermLower = queryTerm.toLowerCase();
|
|
||||||
|
|
||||||
// maybe skip this "word"
|
|
||||||
// stopwords array is from language_data.js
|
|
||||||
if (
|
|
||||||
stopwords.indexOf(queryTermLower) !== -1 ||
|
|
||||||
queryTerm.match(/^\d+$/)
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// stem the word
|
|
||||||
let word = stemmer.stemWord(queryTermLower);
|
|
||||||
// select the correct list
|
|
||||||
if (word[0] === "-") excludedTerms.add(word.substr(1));
|
|
||||||
else {
|
|
||||||
searchTerms.add(word);
|
|
||||||
highlightTerms.add(queryTermLower);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js
|
|
||||||
localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" "))
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.debug("SEARCH: searching for:");
|
|
||||||
// console.info("required: ", [...searchTerms]);
|
|
||||||
// console.info("excluded: ", [...excludedTerms]);
|
|
||||||
|
|
||||||
return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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"));
|
|
||||||
|
|
||||||
const queryLower = query.toLowerCase().trim();
|
|
||||||
for (const [title, foundTitles] of Object.entries(allTitles)) {
|
|
||||||
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
|
|
||||||
for (const [file, id] of foundTitles) {
|
|
||||||
const score = Math.round(Scorer.title * queryLower.length / title.length);
|
|
||||||
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
|
|
||||||
normalResults.push([
|
|
||||||
docNames[file],
|
|
||||||
titles[file] !== title ? `${titles[file]} > ${title}` : title,
|
|
||||||
id !== null ? "#" + id : "",
|
|
||||||
null,
|
|
||||||
score + boost,
|
|
||||||
filenames[file],
|
|
||||||
SearchResultKind.title,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// search for explicit entries in index directives
|
|
||||||
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
|
|
||||||
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
|
|
||||||
for (const [file, id, isMain] of foundEntries) {
|
|
||||||
const score = Math.round(100 * queryLower.length / entry.length);
|
|
||||||
const result = [
|
|
||||||
docNames[file],
|
|
||||||
titles[file],
|
|
||||||
id ? "#" + id : "",
|
|
||||||
null,
|
|
||||||
score,
|
|
||||||
filenames[file],
|
|
||||||
SearchResultKind.index,
|
|
||||||
];
|
|
||||||
if (isMain) {
|
|
||||||
normalResults.push(result);
|
|
||||||
} else {
|
|
||||||
nonMainIndexResults.push(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// lookup as object
|
|
||||||
objectTerms.forEach((term) =>
|
|
||||||
normalResults.push(...Search.performObjectSearch(term, objectTerms))
|
|
||||||
);
|
|
||||||
|
|
||||||
// lookup as search terms in fulltext
|
|
||||||
normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
|
|
||||||
|
|
||||||
// let the scorer override scores with a custom scoring function
|
|
||||||
if (Scorer.score) {
|
|
||||||
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.
|
|
||||||
normalResults.sort(_orderResultsByScoreThenName);
|
|
||||||
nonMainIndexResults.sort(_orderResultsByScoreThenName);
|
|
||||||
|
|
||||||
// Combine the result groups in (reverse) order.
|
|
||||||
// Non-main index entries are typically arbitrary cross-references,
|
|
||||||
// so display them after other results.
|
|
||||||
let results = [...nonMainIndexResults, ...normalResults];
|
|
||||||
|
|
||||||
// remove duplicate search results
|
|
||||||
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
|
|
||||||
let seen = new Set();
|
|
||||||
results = results.reverse().reduce((acc, result) => {
|
|
||||||
let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(',');
|
|
||||||
if (!seen.has(resultStr)) {
|
|
||||||
acc.push(result);
|
|
||||||
seen.add(resultStr);
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return results.reverse();
|
|
||||||
},
|
|
||||||
|
|
||||||
query: (query) => {
|
|
||||||
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
|
|
||||||
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
|
|
||||||
|
|
||||||
// for debugging
|
|
||||||
//Search.lastresults = results.slice(); // a copy
|
|
||||||
// console.info("search results:", Search.lastresults);
|
|
||||||
|
|
||||||
// print the results
|
|
||||||
_displayNextItem(results, results.length, searchTerms, highlightTerms);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* search for object names
|
|
||||||
*/
|
|
||||||
performObjectSearch: (object, objectTerms) => {
|
|
||||||
const filenames = Search._index.filenames;
|
|
||||||
const docNames = Search._index.docnames;
|
|
||||||
const objects = Search._index.objects;
|
|
||||||
const objNames = Search._index.objnames;
|
|
||||||
const titles = Search._index.titles;
|
|
||||||
|
|
||||||
const results = [];
|
|
||||||
|
|
||||||
const objectSearchCallback = (prefix, match) => {
|
|
||||||
const name = match[4]
|
|
||||||
const fullname = (prefix ? prefix + "." : "") + name;
|
|
||||||
const fullnameLower = fullname.toLowerCase();
|
|
||||||
if (fullnameLower.indexOf(object) < 0) return;
|
|
||||||
|
|
||||||
let score = 0;
|
|
||||||
const parts = fullnameLower.split(".");
|
|
||||||
|
|
||||||
// check for different match types: exact matches of full name or
|
|
||||||
// "last name" (i.e. last dotted part)
|
|
||||||
if (fullnameLower === object || parts.slice(-1)[0] === object)
|
|
||||||
score += Scorer.objNameMatch;
|
|
||||||
else if (parts.slice(-1)[0].indexOf(object) > -1)
|
|
||||||
score += Scorer.objPartialMatch; // matches in last name
|
|
||||||
|
|
||||||
const objName = objNames[match[1]][2];
|
|
||||||
const title = titles[match[0]];
|
|
||||||
|
|
||||||
// If more than one term searched for, we require other words to be
|
|
||||||
// found in the name/title/description
|
|
||||||
const otherTerms = new Set(objectTerms);
|
|
||||||
otherTerms.delete(object);
|
|
||||||
if (otherTerms.size > 0) {
|
|
||||||
const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase();
|
|
||||||
if (
|
|
||||||
[...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0)
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let anchor = match[3];
|
|
||||||
if (anchor === "") anchor = fullname;
|
|
||||||
else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname;
|
|
||||||
|
|
||||||
const descr = objName + _(", in ") + title;
|
|
||||||
|
|
||||||
// add custom score for some objects according to scorer
|
|
||||||
if (Scorer.objPrio.hasOwnProperty(match[2]))
|
|
||||||
score += Scorer.objPrio[match[2]];
|
|
||||||
else score += Scorer.objPrioDefault;
|
|
||||||
|
|
||||||
results.push([
|
|
||||||
docNames[match[0]],
|
|
||||||
fullname,
|
|
||||||
"#" + anchor,
|
|
||||||
descr,
|
|
||||||
score,
|
|
||||||
filenames[match[0]],
|
|
||||||
SearchResultKind.object,
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
Object.keys(objects).forEach((prefix) =>
|
|
||||||
objects[prefix].forEach((array) =>
|
|
||||||
objectSearchCallback(prefix, array)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return results;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* search for full-text terms in the index
|
|
||||||
*/
|
|
||||||
performTermsSearch: (searchTerms, excludedTerms) => {
|
|
||||||
// prepare search
|
|
||||||
const terms = Search._index.terms;
|
|
||||||
const titleTerms = Search._index.titleterms;
|
|
||||||
const filenames = Search._index.filenames;
|
|
||||||
const docNames = Search._index.docnames;
|
|
||||||
const titles = Search._index.titles;
|
|
||||||
|
|
||||||
const scoreMap = new Map();
|
|
||||||
const fileMap = new Map();
|
|
||||||
|
|
||||||
// perform the search on the required terms
|
|
||||||
searchTerms.forEach((word) => {
|
|
||||||
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 = [
|
|
||||||
{ files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term },
|
|
||||||
{ files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title },
|
|
||||||
];
|
|
||||||
// add support for partial matches
|
|
||||||
if (word.length > 2) {
|
|
||||||
const escapedWord = _escapeRegExp(word);
|
|
||||||
if (!terms.hasOwnProperty(word)) {
|
|
||||||
Object.keys(terms).forEach((term) => {
|
|
||||||
if (term.match(escapedWord))
|
|
||||||
arr.push({ files: terms[term], score: Scorer.partialTerm });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!titleTerms.hasOwnProperty(word)) {
|
|
||||||
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
|
|
||||||
if (arr.every((record) => record.files === undefined)) return;
|
|
||||||
|
|
||||||
// found search word in contents
|
|
||||||
arr.forEach((record) => {
|
|
||||||
if (record.files === undefined) return;
|
|
||||||
|
|
||||||
let recordFiles = record.files;
|
|
||||||
if (recordFiles.length === undefined) recordFiles = [recordFiles];
|
|
||||||
files.push(...recordFiles);
|
|
||||||
|
|
||||||
// set score for the word in each file
|
|
||||||
recordFiles.forEach((file) => {
|
|
||||||
if (!scoreMap.has(file)) scoreMap.set(file, new Map());
|
|
||||||
const fileScores = scoreMap.get(file);
|
|
||||||
fileScores.set(word, record.score);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// create the mapping
|
|
||||||
files.forEach((file) => {
|
|
||||||
if (!fileMap.has(file)) fileMap.set(file, [word]);
|
|
||||||
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// now check if the files don't contain excluded terms
|
|
||||||
const results = [];
|
|
||||||
for (const [file, wordList] of fileMap) {
|
|
||||||
// check if all requirements are matched
|
|
||||||
|
|
||||||
// as search terms with length < 3 are discarded
|
|
||||||
const filteredTermCount = [...searchTerms].filter(
|
|
||||||
(term) => term.length > 2
|
|
||||||
).length;
|
|
||||||
if (
|
|
||||||
wordList.length !== searchTerms.size &&
|
|
||||||
wordList.length !== filteredTermCount
|
|
||||||
)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// ensure that none of the excluded terms is in the search result
|
|
||||||
if (
|
|
||||||
[...excludedTerms].some(
|
|
||||||
(term) =>
|
|
||||||
terms[term] === file ||
|
|
||||||
titleTerms[term] === file ||
|
|
||||||
(terms[term] || []).includes(file) ||
|
|
||||||
(titleTerms[term] || []).includes(file)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// select one (max) score for the file.
|
|
||||||
const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w)));
|
|
||||||
// add result to the result list
|
|
||||||
results.push([
|
|
||||||
docNames[file],
|
|
||||||
titles[file],
|
|
||||||
"",
|
|
||||||
null,
|
|
||||||
score,
|
|
||||||
filenames[file],
|
|
||||||
SearchResultKind.text,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper function to return a node containing the
|
|
||||||
* search summary for a given text. keywords is a list
|
|
||||||
* of stemmed words.
|
|
||||||
*/
|
|
||||||
makeSearchSummary: (htmlText, keywords, anchor) => {
|
|
||||||
const text = Search.htmlToText(htmlText, anchor);
|
|
||||||
if (text === "") return null;
|
|
||||||
|
|
||||||
const textLower = text.toLowerCase();
|
|
||||||
const actualStartPosition = [...keywords]
|
|
||||||
.map((k) => textLower.indexOf(k.toLowerCase()))
|
|
||||||
.filter((i) => i > -1)
|
|
||||||
.slice(-1)[0];
|
|
||||||
const startWithContext = Math.max(actualStartPosition - 120, 0);
|
|
||||||
|
|
||||||
const top = startWithContext === 0 ? "" : "...";
|
|
||||||
const tail = startWithContext + 240 < text.length ? "..." : "";
|
|
||||||
|
|
||||||
let summary = document.createElement("p");
|
|
||||||
summary.classList.add("context");
|
|
||||||
summary.textContent = top + text.substr(startWithContext, 240).trim() + tail;
|
|
||||||
|
|
||||||
return summary;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
_ready(Search.init);
|
|
154
docs/_static/sphinx_highlight.js
vendored
154
docs/_static/sphinx_highlight.js
vendored
|
@ -1,154 +0,0 @@
|
||||||
/* Highlighting utilities for Sphinx HTML documentation. */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const SPHINX_HIGHLIGHT_ENABLED = true
|
|
||||||
|
|
||||||
/**
|
|
||||||
* highlight a given string on a node by wrapping it in
|
|
||||||
* span elements with the given class name.
|
|
||||||
*/
|
|
||||||
const _highlight = (node, addItems, text, className) => {
|
|
||||||
if (node.nodeType === Node.TEXT_NODE) {
|
|
||||||
const val = node.nodeValue;
|
|
||||||
const parent = node.parentNode;
|
|
||||||
const pos = val.toLowerCase().indexOf(text);
|
|
||||||
if (
|
|
||||||
pos >= 0 &&
|
|
||||||
!parent.classList.contains(className) &&
|
|
||||||
!parent.classList.contains("nohighlight")
|
|
||||||
) {
|
|
||||||
let span;
|
|
||||||
|
|
||||||
const closestNode = parent.closest("body, svg, foreignObject");
|
|
||||||
const isInSVG = closestNode && closestNode.matches("svg");
|
|
||||||
if (isInSVG) {
|
|
||||||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
||||||
} else {
|
|
||||||
span = document.createElement("span");
|
|
||||||
span.classList.add(className);
|
|
||||||
}
|
|
||||||
|
|
||||||
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
|
||||||
const rest = document.createTextNode(val.substr(pos + text.length));
|
|
||||||
parent.insertBefore(
|
|
||||||
span,
|
|
||||||
parent.insertBefore(
|
|
||||||
rest,
|
|
||||||
node.nextSibling
|
|
||||||
)
|
|
||||||
);
|
|
||||||
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) {
|
|
||||||
const rect = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg",
|
|
||||||
"rect"
|
|
||||||
);
|
|
||||||
const bbox = parent.getBBox();
|
|
||||||
rect.x.baseVal.value = bbox.x;
|
|
||||||
rect.y.baseVal.value = bbox.y;
|
|
||||||
rect.width.baseVal.value = bbox.width;
|
|
||||||
rect.height.baseVal.value = bbox.height;
|
|
||||||
rect.setAttribute("class", className);
|
|
||||||
addItems.push({ parent: parent, target: rect });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (node.matches && !node.matches("button, select, textarea")) {
|
|
||||||
node.childNodes.forEach((el) => _highlight(el, addItems, text, className));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const _highlightText = (thisNode, text, className) => {
|
|
||||||
let addItems = [];
|
|
||||||
_highlight(thisNode, addItems, text, className);
|
|
||||||
addItems.forEach((obj) =>
|
|
||||||
obj.parent.insertAdjacentElement("beforebegin", obj.target)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small JavaScript module for the documentation.
|
|
||||||
*/
|
|
||||||
const SphinxHighlight = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* highlight the search words provided in localstorage in the text
|
|
||||||
*/
|
|
||||||
highlightSearchWords: () => {
|
|
||||||
if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight
|
|
||||||
|
|
||||||
// get and clear terms from localstorage
|
|
||||||
const url = new URL(window.location);
|
|
||||||
const highlight =
|
|
||||||
localStorage.getItem("sphinx_highlight_terms")
|
|
||||||
|| url.searchParams.get("highlight")
|
|
||||||
|| "";
|
|
||||||
localStorage.removeItem("sphinx_highlight_terms")
|
|
||||||
url.searchParams.delete("highlight");
|
|
||||||
window.history.replaceState({}, "", url);
|
|
||||||
|
|
||||||
// get individual terms from highlight string
|
|
||||||
const terms = highlight.toLowerCase().split(/\s+/).filter(x => x);
|
|
||||||
if (terms.length === 0) return; // nothing to do
|
|
||||||
|
|
||||||
// There should never be more than one element matching "div.body"
|
|
||||||
const divBody = document.querySelectorAll("div.body");
|
|
||||||
const body = divBody.length ? divBody[0] : document.querySelector("body");
|
|
||||||
window.setTimeout(() => {
|
|
||||||
terms.forEach((term) => _highlightText(body, term, "highlighted"));
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
const searchBox = document.getElementById("searchbox");
|
|
||||||
if (searchBox === null) return;
|
|
||||||
searchBox.appendChild(
|
|
||||||
document
|
|
||||||
.createRange()
|
|
||||||
.createContextualFragment(
|
|
||||||
'<p class="highlight-link">' +
|
|
||||||
'<a href="javascript:SphinxHighlight.hideSearchWords()">' +
|
|
||||||
_("Hide Search Matches") +
|
|
||||||
"</a></p>"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper function to hide the search marks again
|
|
||||||
*/
|
|
||||||
hideSearchWords: () => {
|
|
||||||
document
|
|
||||||
.querySelectorAll("#searchbox .highlight-link")
|
|
||||||
.forEach((el) => el.remove());
|
|
||||||
document
|
|
||||||
.querySelectorAll("span.highlighted")
|
|
||||||
.forEach((el) => el.classList.remove("highlighted"));
|
|
||||||
localStorage.removeItem("sphinx_highlight_terms")
|
|
||||||
},
|
|
||||||
|
|
||||||
initEscapeListener: () => {
|
|
||||||
// only install a listener if it is really needed
|
|
||||||
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return;
|
|
||||||
|
|
||||||
document.addEventListener("keydown", (event) => {
|
|
||||||
// bail for input elements
|
|
||||||
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
|
|
||||||
// bail with special keys
|
|
||||||
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
||||||
if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) {
|
|
||||||
SphinxHighlight.hideSearchWords();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
_ready(() => {
|
|
||||||
/* Do not call highlightSearchWords() when we are on the search page.
|
|
||||||
* It will highlight words from the *previous* search query.
|
|
||||||
*/
|
|
||||||
if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords();
|
|
||||||
SphinxHighlight.initEscapeListener();
|
|
||||||
});
|
|
|
@ -1,163 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Dynamic Bindings — Raylib Python documentation</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
|
||||||
|
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
<script src="_static/js/theme.js"></script>
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="next" title="Building from source" href="BUILDING.html" />
|
|
||||||
<link rel="prev" title="C API" href="raylib.html" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
|
||||||
<div class="wy-grid-for-nav">
|
|
||||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
||||||
<div class="wy-side-scroll">
|
|
||||||
<div class="wy-side-nav-search" >
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="index.html" class="icon icon-home">
|
|
||||||
Raylib Python
|
|
||||||
</a>
|
|
||||||
<div role="search">
|
|
||||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
||||||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
||||||
<input type="hidden" name="check_keywords" value="yes" />
|
|
||||||
<input type="hidden" name="area" value="default" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</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>
|
|
||||||
<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#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#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#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#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#license">License</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#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="pyray.html">Python API</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
|
|
||||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">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="RPI.html">Raspberry Pi</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
||||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
||||||
<a href="index.html">Raylib Python</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="wy-nav-content">
|
|
||||||
<div class="rst-content">
|
|
||||||
<div role="navigation" aria-label="Page navigation">
|
|
||||||
<ul class="wy-breadcrumbs">
|
|
||||||
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
|
|
||||||
<li class="breadcrumb-item active">Dynamic Bindings</li>
|
|
||||||
<li class="wy-breadcrumbs-aside">
|
|
||||||
<a href="_sources/dynamic.rst.txt" rel="nofollow"> View page source</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<hr/>
|
|
||||||
</div>
|
|
||||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
||||||
<div itemprop="articleBody">
|
|
||||||
|
|
||||||
<section id="dynamic-bindings">
|
|
||||||
<h1>Dynamic Bindings<a class="headerlink" href="#dynamic-bindings" title="Link 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>
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
<div class="admonition warning">
|
|
||||||
<p class="admonition-title">Warning</p>
|
|
||||||
<p>There have been some weird failures with dynamic bindings and ctypes bindings before and often the
|
|
||||||
failures are silent
|
|
||||||
so you don’t even know something has gone wrong and you don’t get proper stacktraces. Also the static bindings are faster.
|
|
||||||
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>
|
|
||||||
</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>
|
|
||||||
<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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<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>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix.</p>
|
|
||||||
<p>See <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py">https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py</a> for an example.</p>
|
|
||||||
<p>If you use the <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix then code will work on both static and dynamic bindings.</p>
|
|
||||||
<div class="admonition tip">
|
|
||||||
<p class="admonition-title">Tip</p>
|
|
||||||
<p>If you access functions via <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">pyray</span></code> then there is no difference at all, but be warned this hasn’t been tested much.</p>
|
|
||||||
</div>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>Standard Raylib DLLs do not include additional libraries like Raygui, Physac, etc. So these functions won’t work.</p>
|
|
||||||
</div>
|
|
||||||
<div class="admonition important">
|
|
||||||
<p class="admonition-title">Important</p>
|
|
||||||
<p>If your system already has the Raylib library installed, you can set the environment variable <code class="docutils literal notranslate"><span class="pre">USE_EXTERNAL_RAYLIB</span></code> and it will
|
|
||||||
always be used instead of the bundled DLLs.</p>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
||||||
<a href="raylib.html" class="btn btn-neutral float-left" title="C API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
||||||
<a href="BUILDING.html" class="btn btn-neutral float-right" title="Building from source" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<div role="contentinfo">
|
|
||||||
<p>© Copyright 2021, Richard Smith.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
||||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
||||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function () {
|
|
||||||
SphinxRtdTheme.Navigation.enable(true);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
11317
docs/genindex.html
11317
docs/genindex.html
File diff suppressed because it is too large
Load diff
151
docs/index.html
151
docs/index.html
|
@ -1,151 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="writer-html5" lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Raylib Python — Raylib Python documentation</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
|
||||||
|
|
||||||
|
|
||||||
<script src="_static/jquery.js?v=5d32c60e"></script>
|
|
||||||
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
||||||
<script src="_static/documentation_options.js?v=5929fcd5"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
<script src="_static/js/theme.js"></script>
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="next" title="Python Bindings for Raylib 5.5" href="README.html" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="wy-body-for-nav">
|
|
||||||
<div class="wy-grid-for-nav">
|
|
||||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
||||||
<div class="wy-side-scroll">
|
|
||||||
<div class="wy-side-nav-search" >
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="#" class="icon icon-home">
|
|
||||||
Raylib Python
|
|
||||||
</a>
|
|
||||||
<div role="search">
|
|
||||||
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
||||||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
||||||
<input type="hidden" name="check_keywords" value="yes" />
|
|
||||||
<input type="hidden" name="area" value="default" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</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>
|
|
||||||
<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#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#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#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#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#license">License</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#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="pyray.html">Python 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="BUILDING.html">Building from source</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
||||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
||||||
<a href="#">Raylib Python</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="wy-nav-content">
|
|
||||||
<div class="rst-content">
|
|
||||||
<div role="navigation" aria-label="Page navigation">
|
|
||||||
<ul class="wy-breadcrumbs">
|
|
||||||
<li><a href="#" class="icon icon-home" aria-label="Home"></a></li>
|
|
||||||
<li class="breadcrumb-item active">Raylib Python</li>
|
|
||||||
<li class="wy-breadcrumbs-aside">
|
|
||||||
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<hr/>
|
|
||||||
</div>
|
|
||||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
||||||
<div itemprop="articleBody">
|
|
||||||
|
|
||||||
<section id="raylib-python">
|
|
||||||
<h1>Raylib Python<a class="headerlink" href="#raylib-python" title="Link to this heading"></a></h1>
|
|
||||||
<div class="toctree-wrapper compound">
|
|
||||||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
|
||||||
<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#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#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#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#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#license">License</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="README.html#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="pyray.html">Python 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="BUILDING.html">Building from source</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<div role="contentinfo">
|
|
||||||
<p>© Copyright 2021, Richard Smith.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
||||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
||||||
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
||||||
|
|
||||||
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function () {
|
|
||||||
SphinxRtdTheme.Navigation.enable(true);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue