Compare commits
26 commits
Author | SHA1 | Date | |
---|---|---|---|
249b5b7c35 | |||
1e195e4ac9 | |||
51e50d4cb9 | |||
|
8e85d28ca8 | ||
|
8d5d810925 | ||
|
c58d89fd86 | ||
|
f551fca1f3 | ||
|
11c5b1a728 | ||
|
d3fcb40408 | ||
|
d8e4385990 | ||
|
7971275111 | ||
|
2df1ac470b | ||
|
67e6bf2405 | ||
|
5575f6b7b0 | ||
|
171177618b | ||
|
5593f2e392 | ||
|
002e4ca4d9 | ||
|
56d06bdf32 | ||
|
22af40317d | ||
|
8a45dfad6d | ||
|
32061daadb | ||
|
4bdd922417 | ||
|
bf1622c5c2 | ||
|
d6ba624c6e | ||
|
2c79346ae2 | ||
|
94958bbdc2 |
52 changed files with 10646 additions and 9939 deletions
|
@ -89,6 +89,12 @@ mac_task:
|
||||||
- env:
|
- env:
|
||||||
PY_VER: "3.11"
|
PY_VER: "3.11"
|
||||||
RAYLIB_PLATFORM: Desktop
|
RAYLIB_PLATFORM: Desktop
|
||||||
|
- env:
|
||||||
|
PY_VER: "3.11"
|
||||||
|
RAYLIB_PLATFORM: SDL
|
||||||
|
- env:
|
||||||
|
PY_VER: "3.12"
|
||||||
|
RAYLIB_PLATFORM: Desktop
|
||||||
- env:
|
- env:
|
||||||
PY_VER: "3.12"
|
PY_VER: "3.12"
|
||||||
RAYLIB_PLATFORM: SDL
|
RAYLIB_PLATFORM: SDL
|
||||||
|
@ -131,7 +137,6 @@ mac_task:
|
||||||
- sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
|
- sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
|
||||||
- sudo cp physac/src/physac.h /usr/local/include/
|
- sudo cp physac/src/physac.h /usr/local/include/
|
||||||
- sudo cp raygui/src/raygui.h /usr/local/include/
|
- sudo cp raygui/src/raygui.h /usr/local/include/
|
||||||
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages --upgrade pip
|
|
||||||
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages cffi
|
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages cffi
|
||||||
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages setuptools
|
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages setuptools
|
||||||
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages wheel
|
- /opt/homebrew/bin/python${PY_VER} -m pip install --break-system-packages wheel
|
||||||
|
|
46
.github/workflows/build.yml
vendored
46
.github/workflows/build.yml
vendored
|
@ -12,10 +12,10 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-mac-intel:
|
build-mac-intel:
|
||||||
runs-on: macos-12
|
runs-on: macos-13
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10' ]
|
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']
|
raylib-platform: ['Desktop', 'SDL']
|
||||||
env:
|
env:
|
||||||
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
||||||
|
@ -93,9 +93,9 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v3.2.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wheel
|
name: wheel-mac-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
# build-mac-universal:
|
# build-mac-universal:
|
||||||
|
@ -182,12 +182,12 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
# You can use PyPy versions in python-version.
|
# You can use PyPy versions in python-version.
|
||||||
# For example, pypy2 and pypy3
|
# For example, pypy2 and pypy3
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10' ]
|
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']
|
raylib-platform: ['Desktop', 'SDL', 'DRM']
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
@ -256,9 +256,9 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v3.2.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wheel
|
name: wheel-linux-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ jobs:
|
||||||
# You can use PyPy versions in python-version.
|
# You can use PyPy versions in python-version.
|
||||||
# For example, pypy2 and pypy3
|
# For example, pypy2 and pypy3
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10' ]
|
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']
|
raylib-platform: ['Desktop', 'SDL']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -299,7 +299,7 @@ jobs:
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
- name: Build raylib
|
- name: Build raylib
|
||||||
run: |
|
run: |
|
||||||
|
@ -345,13 +345,13 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v3.2.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wheel
|
name: wheel-windows-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
source-distro:
|
source-distro:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
@ -392,13 +392,13 @@ jobs:
|
||||||
python setup.py sdist
|
python setup.py sdist
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v3.2.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wheel
|
name: wheel-source
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
dynamic-distro:
|
dynamic-distro:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
@ -424,7 +424,17 @@ jobs:
|
||||||
python setup.py sdist
|
python setup.py sdist
|
||||||
|
|
||||||
- name: Upload build Artifact wheel
|
- name: Upload build Artifact wheel
|
||||||
uses: actions/upload-artifact@v3.2.1
|
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:
|
with:
|
||||||
name: wheel
|
name: wheel
|
||||||
path: dynamic/dist/*
|
pattern: wheel-*
|
||||||
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -1,9 +1,9 @@
|
||||||
[submodule "raylib-c"]
|
[submodule "raylib-c"]
|
||||||
path = raylib-c
|
path = raylib-c
|
||||||
url = https://github.com/raysan5/raylib.git
|
url = https://git.terah.dev/UnrealXR/raylib.git
|
||||||
[submodule "raygui"]
|
[submodule "raygui"]
|
||||||
path = raygui
|
path = raygui
|
||||||
url = https://github.com/raysan5/raygui.git
|
url = https://github.com/raysan5/raygui.git
|
||||||
[submodule "physac"]
|
[submodule "physac"]
|
||||||
path = physac
|
path = physac
|
||||||
url = https://github.com/raysan5/physac.git
|
url = https://github.com/victorfisac/Physac.git
|
||||||
|
|
|
@ -83,11 +83,6 @@ To build a binary wheel distribution:
|
||||||
pip3 install wheel
|
pip3 install wheel
|
||||||
python setup.py bdist_wheel
|
python setup.py bdist_wheel
|
||||||
|
|
||||||
.. TODO::
|
|
||||||
There's a hardcoded path (to the raylib header files) in `raylib/build.py` you will probably need to edit.
|
|
||||||
Would be useful if some Windows user could figure out how to auto detect this.
|
|
||||||
|
|
||||||
|
|
||||||
Then install it:
|
Then install it:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
15
README.md
15
README.md
|
@ -24,7 +24,7 @@ original Raylib.
|
||||||
|
|
||||||
# Quickstart
|
# Quickstart
|
||||||
|
|
||||||
`pip3 install raylib==5.5.0.0`
|
`pip3 install raylib==5.5.0.2 --break-system-packages`
|
||||||
```python
|
```python
|
||||||
from pyray import *
|
from pyray import *
|
||||||
init_window(800, 450, "Hello")
|
init_window(800, 450, "Hello")
|
||||||
|
@ -38,14 +38,19 @@ close_window()
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
First make sure you have the latest pip installed:
|
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
|
python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
Then install
|
Then install
|
||||||
|
|
||||||
python3 -m pip install setuptools
|
python3 -m pip install setuptools
|
||||||
python3 -m pip install raylib==5.5.0.0
|
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
|
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.
|
source, in which case you will need to have Raylib development libs installed, e.g.
|
||||||
|
@ -67,7 +72,7 @@ Older MacOS requires building from source but this is usually simple:
|
||||||
|
|
||||||
brew install pkg-config
|
brew install pkg-config
|
||||||
brew install raylib
|
brew install raylib
|
||||||
python3 -m pip install raylib==5.5.0.0
|
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
|
(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.)
|
if you want to test them.)
|
||||||
|
@ -181,7 +186,7 @@ Point your browser to http://localhost:8000
|
||||||
Some features may not work, so you can disable them like this:
|
Some features may not work, so you can disable them like this:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
if platform.system() != "Emscripten": # audio does not work on current version of emscripten
|
if platform.system() != "Emscripten": # audio may not work on current version of emscripten
|
||||||
init_audio_device()
|
init_audio_device()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ def process(filename):
|
||||||
for e in js['enums']:
|
for e in js['enums']:
|
||||||
if e['name'] and e['values']:
|
if e['name'] and e['values']:
|
||||||
print ("class "+e['name']+"("+"IntEnum):")
|
print ("class "+e['name']+"("+"IntEnum):")
|
||||||
|
print(f' """{e['description']}."""')
|
||||||
for value in e['values']:
|
for value in e['values']:
|
||||||
print(" "+value['name']+" = "+str(value['value']))
|
print(" "+value['name']+" = "+str(value['value']))
|
||||||
print("")
|
print("")
|
||||||
|
@ -34,3 +35,4 @@ print("""from enum import IntEnum
|
||||||
process("raylib.json")
|
process("raylib.json")
|
||||||
process("raygui.json")
|
process("raygui.json")
|
||||||
process("glfw3.json")
|
process("glfw3.json")
|
||||||
|
process("physac.json")
|
||||||
|
|
|
@ -33,6 +33,7 @@ for filename in (Path("raylib.json"), Path("raymath.json"), Path("rlgl.json"), P
|
||||||
for e in js['enums']:
|
for e in js['enums']:
|
||||||
if e['name'] and e['values']:
|
if e['name'] and e['values']:
|
||||||
print("class "+e['name']+"(int):")
|
print("class "+e['name']+"(int):")
|
||||||
|
print(f' """{e['description']}."""')
|
||||||
for value in e['values']:
|
for value in e['values']:
|
||||||
print(" "+value['name']+" = "+str(value['value']))
|
print(" "+value['name']+" = "+str(value['value']))
|
||||||
print("")
|
print("")
|
||||||
|
@ -78,10 +79,11 @@ def ctype_to_python_type(t):
|
||||||
|
|
||||||
|
|
||||||
print("""from typing import Any
|
print("""from typing import Any
|
||||||
|
from warnings import deprecated
|
||||||
import _cffi_backend # type: ignore
|
import _cffi_backend # type: ignore
|
||||||
|
|
||||||
ffi: _cffi_backend.FFI
|
ffi: _cffi_backend.FFI
|
||||||
|
PhysicsShapeType = int
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# These words can be used for c arg names, but not in python
|
# These words can be used for c arg names, but not in python
|
||||||
|
@ -118,8 +120,11 @@ for name, attr in getmembers(rl):
|
||||||
if 'description' in json_object:
|
if 'description' in json_object:
|
||||||
description = json_object['description']
|
description = json_object['description']
|
||||||
|
|
||||||
print(
|
if 'physics' in uname:
|
||||||
f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:\n """{description}"""\n ...')
|
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'>":
|
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||||
return_type = ffi.typeof(attr).result.cname
|
return_type = ffi.typeof(attr).result.cname
|
||||||
|
@ -144,7 +149,7 @@ for struct in ffi.list_types()[0]:
|
||||||
print("weird empty struct, skipping " + struct, file=sys.stderr)
|
print("weird empty struct, skipping " + struct, file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
print(f"class {struct}:")
|
print(f"class {struct}:")
|
||||||
print(f' """ struct """')
|
print(f' """{known_structs[struct]['description']}."""')
|
||||||
sig = ""
|
sig = ""
|
||||||
for arg in ffi.typeof(struct).fields:
|
for arg in ffi.typeof(struct).fields:
|
||||||
ptype = ctype_to_python_type(arg[1].type.cname)
|
ptype = ctype_to_python_type(arg[1].type.cname)
|
||||||
|
|
|
@ -69,11 +69,12 @@ def ctype_to_python_type(t):
|
||||||
|
|
||||||
|
|
||||||
print("""from typing import Any
|
print("""from typing import Any
|
||||||
|
from warnings import deprecated
|
||||||
import _cffi_backend # type: ignore
|
import _cffi_backend # type: ignore
|
||||||
|
|
||||||
ffi: _cffi_backend.FFI
|
ffi: _cffi_backend.FFI
|
||||||
rl: _cffi_backend.Lib
|
rl: _cffi_backend.Lib
|
||||||
|
PhysicsShapeType = int
|
||||||
|
|
||||||
class struct: ...
|
class struct: ...
|
||||||
|
|
||||||
|
@ -114,8 +115,12 @@ for name, attr in getmembers(rl):
|
||||||
if 'description' in json_object:
|
if 'description' in json_object:
|
||||||
description = json_object['description']
|
description = json_object['description']
|
||||||
|
|
||||||
print(
|
if 'Physics' in uname:
|
||||||
f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:\n """{description}"""\n ...')
|
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'>":
|
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||||
return_type = ffi.typeof(attr).result.cname
|
return_type = ffi.typeof(attr).result.cname
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Sphinx build info version 1
|
# Sphinx build info version 1
|
||||||
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
|
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||||
config: 6b88b88b20947586d6498748ffd23a92
|
config: f2032a6434b52f7c68551d0ad70d555b
|
||||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Building from source — Raylib Python documentation</title>
|
<title>Building from source — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<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/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Python Bindings for Raylib 5.5 — Raylib Python documentation</title>
|
<title>Python Bindings for Raylib 5.5 — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
@ -123,8 +123,10 @@
|
||||||
</section>
|
</section>
|
||||||
<section id="platforms-windows-mac-linux-raspberry-pi-web">
|
<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>
|
<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>Chatroom: <a class="reference external" href="https://discord.gg/fKDwt85aX6">Discord</a></p>
|
||||||
<p><a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues/155">HELP WANTED: writing examples</a></p>
|
<p>HELP WANTED: <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues/155">writing examples</a></p>
|
||||||
|
<p>Features:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>CFFI API static bindings.</p></li>
|
<li><p>CFFI API static bindings.</p></li>
|
||||||
<li><p>Automatically generated to be as close as possible to
|
<li><p>Automatically generated to be as close as possible to
|
||||||
|
@ -139,8 +141,8 @@ original Raylib.</p></li>
|
||||||
</section>
|
</section>
|
||||||
<section id="quickstart">
|
<section id="quickstart">
|
||||||
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1>
|
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1>
|
||||||
<p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib==5.5.0.0</span></code></p>
|
<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="nn">pyray</span> <span class="kn">import</span> <span class="o">*</span>
|
<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="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="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">begin_drawing</span><span class="p">()</span>
|
||||||
|
@ -153,13 +155,18 @@ original Raylib.</p></li>
|
||||||
</section>
|
</section>
|
||||||
<section id="installation">
|
<section id="installation">
|
||||||
<h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
|
<h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
|
||||||
<p>First make sure you have the latest pip installed:</p>
|
<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
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --upgrade pip
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Then install</p>
|
<p>Then install</p>
|
||||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install setuptools
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install setuptools
|
||||||
python3 -m pip install raylib==5.5.0.0
|
python3 -m pip install raylib==5.5.0.2
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>On most platforms it should install a binary wheel. If yours isn’t available then pip will attempt to build from
|
<p>On most platforms it should install a binary wheel. If yours isn’t available then pip will attempt to build from
|
||||||
|
@ -180,7 +187,7 @@ using homebrew, apt, etc.</p>
|
||||||
<p>Older MacOS requires building from source but this is usually simple:</p>
|
<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
|
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>brew install pkg-config
|
||||||
brew install raylib
|
brew install raylib
|
||||||
python3 -m pip install raylib==5.5.0.0
|
python3 -m pip install raylib==5.5.0.2
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</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
|
<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
|
||||||
|
@ -195,7 +202,7 @@ so may not work on other boards.</p>
|
||||||
</section>
|
</section>
|
||||||
<section id="raspberry-pi">
|
<section id="raspberry-pi">
|
||||||
<h2>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h2>
|
<h2>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h2>
|
||||||
<p><a class="reference internal" href="RPI.html"><span class="std std-doc">Using on Rasperry Pi</span></a></p>
|
<p><span class="xref myst">Using on Rasperry Pi</span></p>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section id="backends">
|
<section id="backends">
|
||||||
|
@ -230,7 +237,7 @@ python3 -m pip install raylib_drm
|
||||||
</section>
|
</section>
|
||||||
<section id="problems">
|
<section id="problems">
|
||||||
<h2>Problems?<a class="headerlink" href="#problems" title="Link to this heading"></a></h2>
|
<h2>Problems?<a class="headerlink" href="#problems" title="Link to this heading"></a></h2>
|
||||||
<p>If it doesn’t work, <a class="reference internal" href="BUILDING.html"><span class="std std-doc">try to build manually.</span></a>. If that works then <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>
|
<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>
|
to let us know what you did.</p>
|
||||||
<p>If you need help you can try asking on <a class="reference external" href="https://discord.gg/fKDwt85aX6">our discord</a>. There is also a large <a class="reference external" href="https://discord.gg/raylib">Raylib discord</a>
|
<p>If you need help you can try asking 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>
|
for issues that are not Python-specific.</p>
|
||||||
|
@ -261,11 +268,11 @@ is recommended.</p>
|
||||||
<span class="c1"># "raylib"</span>
|
<span class="c1"># "raylib"</span>
|
||||||
<span class="c1"># ]</span>
|
<span class="c1"># ]</span>
|
||||||
<span class="c1"># ///</span>
|
<span class="c1"># ///</span>
|
||||||
<span class="kn">import</span> <span class="nn">asyncio</span>
|
<span class="kn">import</span><span class="w"> </span><span class="nn">asyncio</span>
|
||||||
<span class="kn">import</span> <span class="nn">platform</span>
|
<span class="kn">import</span><span class="w"> </span><span class="nn">platform</span>
|
||||||
<span class="kn">from</span> <span class="nn">pyray</span> <span class="kn">import</span> <span class="o">*</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="nf">main</span><span class="p">():</span> <span class="c1"># You MUST have an async main function</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">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="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="k">while</span> <span class="ow">not</span> <span class="n">window_should_close</span><span class="p">():</span>
|
||||||
|
@ -286,7 +293,7 @@ python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my
|
||||||
</div>
|
</div>
|
||||||
<p>Point your browser to http://localhost:8000</p>
|
<p>Point your browser to http://localhost:8000</p>
|
||||||
<p>Some features may not work, so you can disable them like this:</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 does not work on current version of emscripten</span>
|
<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>
|
<span class="n">init_audio_device</span><span class="p">()</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Raspberry Pi — Raylib Python documentation</title>
|
<title>Raspberry Pi — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<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/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,13 @@
|
||||||
## Backends: Desktop, SDL, DRM, Web
|
## Backends: Desktop, SDL, DRM, Web
|
||||||
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
|
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
|
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
|
||||||
|
|
||||||
[HELP WANTED: writing examples](https://github.com/electronstudio/raylib-python-cffi/issues/155)
|
HELP WANTED: [writing examples](https://github.com/electronstudio/raylib-python-cffi/issues/155)
|
||||||
|
|
||||||
|
Features:
|
||||||
|
|
||||||
* CFFI API static bindings.
|
* CFFI API static bindings.
|
||||||
* Automatically generated to be as close as possible to
|
* Automatically generated to be as close as possible to
|
||||||
|
@ -20,7 +24,7 @@ original Raylib.
|
||||||
|
|
||||||
# Quickstart
|
# Quickstart
|
||||||
|
|
||||||
`pip3 install raylib==5.5.0.0`
|
`pip3 install raylib==5.5.0.2 --break-system-packages`
|
||||||
```python
|
```python
|
||||||
from pyray import *
|
from pyray import *
|
||||||
init_window(800, 450, "Hello")
|
init_window(800, 450, "Hello")
|
||||||
|
@ -34,14 +38,19 @@ close_window()
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
First make sure you have the latest pip installed:
|
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
|
python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
Then install
|
Then install
|
||||||
|
|
||||||
python3 -m pip install setuptools
|
python3 -m pip install setuptools
|
||||||
python3 -m pip install raylib==5.5.0.0
|
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
|
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.
|
source, in which case you will need to have Raylib development libs installed, e.g.
|
||||||
|
@ -63,7 +72,7 @@ Older MacOS requires building from source but this is usually simple:
|
||||||
|
|
||||||
brew install pkg-config
|
brew install pkg-config
|
||||||
brew install raylib
|
brew install raylib
|
||||||
python3 -m pip install raylib==5.5.0.0
|
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
|
(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.)
|
if you want to test them.)
|
||||||
|
@ -177,7 +186,7 @@ Point your browser to http://localhost:8000
|
||||||
Some features may not work, so you can disable them like this:
|
Some features may not work, so you can disable them like this:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
if platform.system() != "Emscripten": # audio does not work on current version of emscripten
|
if platform.system() != "Emscripten": # audio may not work on current version of emscripten
|
||||||
init_audio_device()
|
init_audio_device()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
8
docs/_static/basic.css
vendored
8
docs/_static/basic.css
vendored
|
@ -741,14 +741,6 @@ abbr, acronym {
|
||||||
cursor: help;
|
cursor: help;
|
||||||
}
|
}
|
||||||
|
|
||||||
.translated {
|
|
||||||
background-color: rgba(207, 255, 207, 0.2)
|
|
||||||
}
|
|
||||||
|
|
||||||
.untranslated {
|
|
||||||
background-color: rgba(255, 207, 207, 0.2)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- code displays --------------------------------------------------------- */
|
/* -- code displays --------------------------------------------------------- */
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
|
|
10
docs/_static/js/versions.js
vendored
10
docs/_static/js/versions.js
vendored
|
@ -1,6 +1,6 @@
|
||||||
const themeFlyoutDisplay = "hidden";
|
const themeFlyoutDisplay = "hidden";
|
||||||
const themeVersionSelector = "True";
|
const themeVersionSelector = true;
|
||||||
const themeLanguageSelector = "True";
|
const themeLanguageSelector = true;
|
||||||
|
|
||||||
if (themeFlyoutDisplay === "attached") {
|
if (themeFlyoutDisplay === "attached") {
|
||||||
function renderLanguages(config) {
|
function renderLanguages(config) {
|
||||||
|
@ -8,10 +8,14 @@ if (themeFlyoutDisplay === "attached") {
|
||||||
return "";
|
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 = `
|
const languagesHTML = `
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Languages</dt>
|
<dt>Languages</dt>
|
||||||
${config.projects.translations
|
${languages
|
||||||
.map(
|
.map(
|
||||||
(translation) => `
|
(translation) => `
|
||||||
<dd ${translation.slug == config.projects.current.slug ? 'class="rtd-current-item"' : ""}>
|
<dd ${translation.slug == config.projects.current.slug ? 'class="rtd-current-item"' : ""}>
|
||||||
|
|
66
docs/_static/pygments.css
vendored
66
docs/_static/pygments.css
vendored
|
@ -6,26 +6,26 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
|
||||||
.highlight .hll { background-color: #ffffcc }
|
.highlight .hll { background-color: #ffffcc }
|
||||||
.highlight { background: #eeffcc; }
|
.highlight { background: #eeffcc; }
|
||||||
.highlight .c { color: #408090; font-style: italic } /* Comment */
|
.highlight .c { color: #408090; font-style: italic } /* Comment */
|
||||||
.highlight .err { border: 1px solid #FF0000 } /* Error */
|
.highlight .err { border: 1px solid #F00 } /* Error */
|
||||||
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
|
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
|
||||||
.highlight .o { color: #666666 } /* Operator */
|
.highlight .o { color: #666 } /* Operator */
|
||||||
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
|
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
|
||||||
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
|
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
|
||||||
.highlight .cp { color: #007020 } /* Comment.Preproc */
|
.highlight .cp { color: #007020 } /* Comment.Preproc */
|
||||||
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
|
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
|
||||||
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
|
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
|
||||||
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
|
.highlight .cs { color: #408090; background-color: #FFF0F0 } /* Comment.Special */
|
||||||
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
||||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
.highlight .ge { font-style: italic } /* Generic.Emph */
|
||||||
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
|
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
|
||||||
.highlight .gr { color: #FF0000 } /* Generic.Error */
|
.highlight .gr { color: #F00 } /* Generic.Error */
|
||||||
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||||
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
||||||
.highlight .go { color: #333333 } /* Generic.Output */
|
.highlight .go { color: #333 } /* Generic.Output */
|
||||||
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
|
.highlight .gp { color: #C65D09; font-weight: bold } /* Generic.Prompt */
|
||||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
||||||
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||||
.highlight .gt { color: #0044DD } /* Generic.Traceback */
|
.highlight .gt { color: #04D } /* Generic.Traceback */
|
||||||
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
||||||
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
||||||
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
||||||
|
@ -33,43 +33,43 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
|
||||||
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
||||||
.highlight .kt { color: #902000 } /* Keyword.Type */
|
.highlight .kt { color: #902000 } /* Keyword.Type */
|
||||||
.highlight .m { color: #208050 } /* Literal.Number */
|
.highlight .m { color: #208050 } /* Literal.Number */
|
||||||
.highlight .s { color: #4070a0 } /* Literal.String */
|
.highlight .s { color: #4070A0 } /* Literal.String */
|
||||||
.highlight .na { color: #4070a0 } /* Name.Attribute */
|
.highlight .na { color: #4070A0 } /* Name.Attribute */
|
||||||
.highlight .nb { color: #007020 } /* Name.Builtin */
|
.highlight .nb { color: #007020 } /* Name.Builtin */
|
||||||
.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
|
.highlight .nc { color: #0E84B5; font-weight: bold } /* Name.Class */
|
||||||
.highlight .no { color: #60add5 } /* Name.Constant */
|
.highlight .no { color: #60ADD5 } /* Name.Constant */
|
||||||
.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
|
.highlight .nd { color: #555; font-weight: bold } /* Name.Decorator */
|
||||||
.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
|
.highlight .ni { color: #D55537; font-weight: bold } /* Name.Entity */
|
||||||
.highlight .ne { color: #007020 } /* Name.Exception */
|
.highlight .ne { color: #007020 } /* Name.Exception */
|
||||||
.highlight .nf { color: #06287e } /* Name.Function */
|
.highlight .nf { color: #06287E } /* Name.Function */
|
||||||
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
|
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
|
||||||
.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
|
.highlight .nn { color: #0E84B5; font-weight: bold } /* Name.Namespace */
|
||||||
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
||||||
.highlight .nv { color: #bb60d5 } /* Name.Variable */
|
.highlight .nv { color: #BB60D5 } /* Name.Variable */
|
||||||
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
||||||
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
.highlight .w { color: #BBB } /* Text.Whitespace */
|
||||||
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
||||||
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
||||||
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
||||||
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
||||||
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
|
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
|
||||||
.highlight .sa { color: #4070a0 } /* Literal.String.Affix */
|
.highlight .sa { color: #4070A0 } /* Literal.String.Affix */
|
||||||
.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
|
.highlight .sb { color: #4070A0 } /* Literal.String.Backtick */
|
||||||
.highlight .sc { color: #4070a0 } /* Literal.String.Char */
|
.highlight .sc { color: #4070A0 } /* Literal.String.Char */
|
||||||
.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
|
.highlight .dl { color: #4070A0 } /* Literal.String.Delimiter */
|
||||||
.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
|
.highlight .sd { color: #4070A0; font-style: italic } /* Literal.String.Doc */
|
||||||
.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
|
.highlight .s2 { color: #4070A0 } /* Literal.String.Double */
|
||||||
.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
|
.highlight .se { color: #4070A0; font-weight: bold } /* Literal.String.Escape */
|
||||||
.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
|
.highlight .sh { color: #4070A0 } /* Literal.String.Heredoc */
|
||||||
.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
|
.highlight .si { color: #70A0D0; font-style: italic } /* Literal.String.Interpol */
|
||||||
.highlight .sx { color: #c65d09 } /* Literal.String.Other */
|
.highlight .sx { color: #C65D09 } /* Literal.String.Other */
|
||||||
.highlight .sr { color: #235388 } /* Literal.String.Regex */
|
.highlight .sr { color: #235388 } /* Literal.String.Regex */
|
||||||
.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
|
.highlight .s1 { color: #4070A0 } /* Literal.String.Single */
|
||||||
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
|
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
|
||||||
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
||||||
.highlight .fm { color: #06287e } /* Name.Function.Magic */
|
.highlight .fm { color: #06287E } /* Name.Function.Magic */
|
||||||
.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
|
.highlight .vc { color: #BB60D5 } /* Name.Variable.Class */
|
||||||
.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
|
.highlight .vg { color: #BB60D5 } /* Name.Variable.Global */
|
||||||
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
|
.highlight .vi { color: #BB60D5 } /* Name.Variable.Instance */
|
||||||
.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
|
.highlight .vm { color: #BB60D5 } /* Name.Variable.Magic */
|
||||||
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
|
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
|
13
docs/_static/searchtools.js
vendored
13
docs/_static/searchtools.js
vendored
|
@ -513,9 +513,11 @@ const Search = {
|
||||||
// perform the search on the required terms
|
// perform the search on the required terms
|
||||||
searchTerms.forEach((word) => {
|
searchTerms.forEach((word) => {
|
||||||
const files = [];
|
const files = [];
|
||||||
|
// find documents, if any, containing the query word in their text/title term indices
|
||||||
|
// use Object.hasOwnProperty to avoid mismatching against prototype properties
|
||||||
const arr = [
|
const arr = [
|
||||||
{ files: terms[word], score: Scorer.term },
|
{ files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term },
|
||||||
{ files: titleTerms[word], score: Scorer.title },
|
{ files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title },
|
||||||
];
|
];
|
||||||
// add support for partial matches
|
// add support for partial matches
|
||||||
if (word.length > 2) {
|
if (word.length > 2) {
|
||||||
|
@ -547,8 +549,9 @@ const Search = {
|
||||||
|
|
||||||
// set score for the word in each file
|
// set score for the word in each file
|
||||||
recordFiles.forEach((file) => {
|
recordFiles.forEach((file) => {
|
||||||
if (!scoreMap.has(file)) scoreMap.set(file, {});
|
if (!scoreMap.has(file)) scoreMap.set(file, new Map());
|
||||||
scoreMap.get(file)[word] = record.score;
|
const fileScores = scoreMap.get(file);
|
||||||
|
fileScores.set(word, record.score);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -587,7 +590,7 @@ const Search = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// select one (max) score for the file.
|
// select one (max) score for the file.
|
||||||
const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w]));
|
const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w)));
|
||||||
// add result to the result list
|
// add result to the result list
|
||||||
results.push([
|
results.push([
|
||||||
docNames[file],
|
docNames[file],
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Dynamic Bindings — Raylib Python documentation</title>
|
<title>Dynamic Bindings — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<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/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ Therefore I personally recommend the static ones.
|
||||||
But the dynamic bindings have the advantage that you don’t need to compile anything to install. You just need a Raylib DLL.</p>
|
But the dynamic bindings have the advantage that you don’t need to compile anything to install. You just need a Raylib DLL.</p>
|
||||||
</div>
|
</div>
|
||||||
<p>The API is exactly the same as the static one documented here. (Therefore you can’t have both modules installed at once.) The only difference is you can’t do:</p>
|
<p>The API is exactly the same as the static one documented here. (Therefore you can’t have both modules installed at once.) The only difference is you can’t do:</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">raylib</span> <span class="kn">import</span> <span class="o">*</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">raylib</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Instead you have to do:</p>
|
<p>Instead you have to do:</p>
|
||||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">raylib</span> <span class="kn">import</span> <span class="n">rl</span>
|
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">raylib</span><span class="w"> </span><span class="kn">import</span> <span class="n">rl</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix.</p>
|
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix.</p>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Index — Raylib Python documentation</title>
|
<title>Index — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Raylib Python — Raylib Python documentation</title>
|
<title>Raylib Python — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<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/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Python Module Index — Raylib Python documentation</title>
|
<title>Python Module Index — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<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/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
|
3836
docs/pyray.html
3836
docs/pyray.html
File diff suppressed because one or more lines are too long
2537
docs/raylib.html
2537
docs/raylib.html
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Search — Raylib Python documentation</title>
|
<title>Search — Raylib Python documentation</title>
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
|
<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/css/theme.css?v=e59714d7" />
|
||||||
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -22,9 +22,10 @@ import itertools
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import platform
|
import platform
|
||||||
|
import logging
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
MODULE = pathlib.Path(__file__).parent
|
MODULE = pathlib.Path(__file__).parent
|
||||||
|
|
||||||
def raylib_library_path():
|
def raylib_library_path():
|
||||||
|
@ -54,9 +55,9 @@ ffi.cdef(open(MODULE / "raylib_modified.h").read().replace('RLAPI ', ''))
|
||||||
try:
|
try:
|
||||||
raylib_fname = raylib_library_path()
|
raylib_fname = raylib_library_path()
|
||||||
rl = ffi.dlopen(raylib_fname)
|
rl = ffi.dlopen(raylib_fname)
|
||||||
print('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname))
|
logger.warning('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
logger.exception(e)
|
||||||
|
|
||||||
LIGHTGRAY =( 200, 200, 200, 255 )
|
LIGHTGRAY =( 200, 200, 200, 255 )
|
||||||
GRAY =( 130, 130, 130, 255 )
|
GRAY =( 130, 130, 130, 255 )
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -186,12 +186,10 @@ RAYGUI_TEXTFORMAT_MAX_SIZE: int = 256
|
||||||
PHYSAC_MAX_BODIES: int = 64
|
PHYSAC_MAX_BODIES: int = 64
|
||||||
PHYSAC_MAX_MANIFOLDS: int = 4096
|
PHYSAC_MAX_MANIFOLDS: int = 4096
|
||||||
PHYSAC_MAX_VERTICES: int = 24
|
PHYSAC_MAX_VERTICES: int = 24
|
||||||
PHYSAC_DEFAULT_CIRCLE_VERTICES: int = 24
|
PHYSAC_CIRCLE_VERTICES: int = 24
|
||||||
PHYSAC_COLLISION_ITERATIONS: int = 100
|
PHYSAC_COLLISION_ITERATIONS: int = 20
|
||||||
PHYSAC_PENETRATION_ALLOWANCE: float = 0.05
|
PHYSAC_PENETRATION_ALLOWANCE: float = 0.05
|
||||||
PHYSAC_PENETRATION_CORRECTION: float = 0.4
|
PHYSAC_PENETRATION_CORRECTION: float = 0.4
|
||||||
PHYSAC_PI: float = 3.141592653589793
|
|
||||||
PHYSAC_DEG2RAD = PHYSAC_PI / 180.0
|
|
||||||
PHYSAC_FLT_MAX: float = 3.402823466e+38
|
PHYSAC_FLT_MAX: float = 3.402823466e+38
|
||||||
PHYSAC_EPSILON: float = 1e-06
|
PHYSAC_EPSILON: float = 1e-06
|
||||||
GLFW_VERSION_MAJOR: int = 3
|
GLFW_VERSION_MAJOR: int = 3
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
|
|
||||||
class ConfigFlags(IntEnum):
|
class ConfigFlags(IntEnum):
|
||||||
|
"""System/Window config flags."""
|
||||||
FLAG_VSYNC_HINT = 64
|
FLAG_VSYNC_HINT = 64
|
||||||
FLAG_FULLSCREEN_MODE = 2
|
FLAG_FULLSCREEN_MODE = 2
|
||||||
FLAG_WINDOW_RESIZABLE = 4
|
FLAG_WINDOW_RESIZABLE = 4
|
||||||
|
@ -19,6 +20,7 @@ class ConfigFlags(IntEnum):
|
||||||
FLAG_INTERLACED_HINT = 65536
|
FLAG_INTERLACED_HINT = 65536
|
||||||
|
|
||||||
class TraceLogLevel(IntEnum):
|
class TraceLogLevel(IntEnum):
|
||||||
|
"""Trace log level."""
|
||||||
LOG_ALL = 0
|
LOG_ALL = 0
|
||||||
LOG_TRACE = 1
|
LOG_TRACE = 1
|
||||||
LOG_DEBUG = 2
|
LOG_DEBUG = 2
|
||||||
|
@ -29,6 +31,7 @@ class TraceLogLevel(IntEnum):
|
||||||
LOG_NONE = 7
|
LOG_NONE = 7
|
||||||
|
|
||||||
class KeyboardKey(IntEnum):
|
class KeyboardKey(IntEnum):
|
||||||
|
"""Keyboard keys (US keyboard layout)."""
|
||||||
KEY_NULL = 0
|
KEY_NULL = 0
|
||||||
KEY_APOSTROPHE = 39
|
KEY_APOSTROPHE = 39
|
||||||
KEY_COMMA = 44
|
KEY_COMMA = 44
|
||||||
|
@ -141,6 +144,7 @@ class KeyboardKey(IntEnum):
|
||||||
KEY_VOLUME_DOWN = 25
|
KEY_VOLUME_DOWN = 25
|
||||||
|
|
||||||
class MouseButton(IntEnum):
|
class MouseButton(IntEnum):
|
||||||
|
"""Mouse buttons."""
|
||||||
MOUSE_BUTTON_LEFT = 0
|
MOUSE_BUTTON_LEFT = 0
|
||||||
MOUSE_BUTTON_RIGHT = 1
|
MOUSE_BUTTON_RIGHT = 1
|
||||||
MOUSE_BUTTON_MIDDLE = 2
|
MOUSE_BUTTON_MIDDLE = 2
|
||||||
|
@ -150,6 +154,7 @@ class MouseButton(IntEnum):
|
||||||
MOUSE_BUTTON_BACK = 6
|
MOUSE_BUTTON_BACK = 6
|
||||||
|
|
||||||
class MouseCursor(IntEnum):
|
class MouseCursor(IntEnum):
|
||||||
|
"""Mouse cursor."""
|
||||||
MOUSE_CURSOR_DEFAULT = 0
|
MOUSE_CURSOR_DEFAULT = 0
|
||||||
MOUSE_CURSOR_ARROW = 1
|
MOUSE_CURSOR_ARROW = 1
|
||||||
MOUSE_CURSOR_IBEAM = 2
|
MOUSE_CURSOR_IBEAM = 2
|
||||||
|
@ -163,6 +168,7 @@ class MouseCursor(IntEnum):
|
||||||
MOUSE_CURSOR_NOT_ALLOWED = 10
|
MOUSE_CURSOR_NOT_ALLOWED = 10
|
||||||
|
|
||||||
class GamepadButton(IntEnum):
|
class GamepadButton(IntEnum):
|
||||||
|
"""Gamepad buttons."""
|
||||||
GAMEPAD_BUTTON_UNKNOWN = 0
|
GAMEPAD_BUTTON_UNKNOWN = 0
|
||||||
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
||||||
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
||||||
|
@ -183,6 +189,7 @@ class GamepadButton(IntEnum):
|
||||||
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
||||||
|
|
||||||
class GamepadAxis(IntEnum):
|
class GamepadAxis(IntEnum):
|
||||||
|
"""Gamepad axis."""
|
||||||
GAMEPAD_AXIS_LEFT_X = 0
|
GAMEPAD_AXIS_LEFT_X = 0
|
||||||
GAMEPAD_AXIS_LEFT_Y = 1
|
GAMEPAD_AXIS_LEFT_Y = 1
|
||||||
GAMEPAD_AXIS_RIGHT_X = 2
|
GAMEPAD_AXIS_RIGHT_X = 2
|
||||||
|
@ -191,6 +198,7 @@ class GamepadAxis(IntEnum):
|
||||||
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
||||||
|
|
||||||
class MaterialMapIndex(IntEnum):
|
class MaterialMapIndex(IntEnum):
|
||||||
|
"""Material map index."""
|
||||||
MATERIAL_MAP_ALBEDO = 0
|
MATERIAL_MAP_ALBEDO = 0
|
||||||
MATERIAL_MAP_METALNESS = 1
|
MATERIAL_MAP_METALNESS = 1
|
||||||
MATERIAL_MAP_NORMAL = 2
|
MATERIAL_MAP_NORMAL = 2
|
||||||
|
@ -204,6 +212,7 @@ class MaterialMapIndex(IntEnum):
|
||||||
MATERIAL_MAP_BRDF = 10
|
MATERIAL_MAP_BRDF = 10
|
||||||
|
|
||||||
class ShaderLocationIndex(IntEnum):
|
class ShaderLocationIndex(IntEnum):
|
||||||
|
"""Shader location index."""
|
||||||
SHADER_LOC_VERTEX_POSITION = 0
|
SHADER_LOC_VERTEX_POSITION = 0
|
||||||
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
||||||
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
||||||
|
@ -235,6 +244,7 @@ class ShaderLocationIndex(IntEnum):
|
||||||
SHADER_LOC_BONE_MATRICES = 28
|
SHADER_LOC_BONE_MATRICES = 28
|
||||||
|
|
||||||
class ShaderUniformDataType(IntEnum):
|
class ShaderUniformDataType(IntEnum):
|
||||||
|
"""Shader uniform data type."""
|
||||||
SHADER_UNIFORM_FLOAT = 0
|
SHADER_UNIFORM_FLOAT = 0
|
||||||
SHADER_UNIFORM_VEC2 = 1
|
SHADER_UNIFORM_VEC2 = 1
|
||||||
SHADER_UNIFORM_VEC3 = 2
|
SHADER_UNIFORM_VEC3 = 2
|
||||||
|
@ -246,12 +256,14 @@ class ShaderUniformDataType(IntEnum):
|
||||||
SHADER_UNIFORM_SAMPLER2D = 8
|
SHADER_UNIFORM_SAMPLER2D = 8
|
||||||
|
|
||||||
class ShaderAttributeDataType(IntEnum):
|
class ShaderAttributeDataType(IntEnum):
|
||||||
|
"""Shader attribute data types."""
|
||||||
SHADER_ATTRIB_FLOAT = 0
|
SHADER_ATTRIB_FLOAT = 0
|
||||||
SHADER_ATTRIB_VEC2 = 1
|
SHADER_ATTRIB_VEC2 = 1
|
||||||
SHADER_ATTRIB_VEC3 = 2
|
SHADER_ATTRIB_VEC3 = 2
|
||||||
SHADER_ATTRIB_VEC4 = 3
|
SHADER_ATTRIB_VEC4 = 3
|
||||||
|
|
||||||
class PixelFormat(IntEnum):
|
class PixelFormat(IntEnum):
|
||||||
|
"""Pixel formats."""
|
||||||
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
||||||
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
||||||
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
||||||
|
@ -278,6 +290,7 @@ class PixelFormat(IntEnum):
|
||||||
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24
|
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24
|
||||||
|
|
||||||
class TextureFilter(IntEnum):
|
class TextureFilter(IntEnum):
|
||||||
|
"""Texture parameters: filter mode."""
|
||||||
TEXTURE_FILTER_POINT = 0
|
TEXTURE_FILTER_POINT = 0
|
||||||
TEXTURE_FILTER_BILINEAR = 1
|
TEXTURE_FILTER_BILINEAR = 1
|
||||||
TEXTURE_FILTER_TRILINEAR = 2
|
TEXTURE_FILTER_TRILINEAR = 2
|
||||||
|
@ -286,12 +299,14 @@ class TextureFilter(IntEnum):
|
||||||
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
||||||
|
|
||||||
class TextureWrap(IntEnum):
|
class TextureWrap(IntEnum):
|
||||||
|
"""Texture parameters: wrap mode."""
|
||||||
TEXTURE_WRAP_REPEAT = 0
|
TEXTURE_WRAP_REPEAT = 0
|
||||||
TEXTURE_WRAP_CLAMP = 1
|
TEXTURE_WRAP_CLAMP = 1
|
||||||
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
||||||
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
||||||
|
|
||||||
class CubemapLayout(IntEnum):
|
class CubemapLayout(IntEnum):
|
||||||
|
"""Cubemap layouts."""
|
||||||
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
||||||
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
||||||
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
|
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
|
||||||
|
@ -299,11 +314,13 @@ class CubemapLayout(IntEnum):
|
||||||
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
|
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
|
||||||
|
|
||||||
class FontType(IntEnum):
|
class FontType(IntEnum):
|
||||||
|
"""Font type, defines generation method."""
|
||||||
FONT_DEFAULT = 0
|
FONT_DEFAULT = 0
|
||||||
FONT_BITMAP = 1
|
FONT_BITMAP = 1
|
||||||
FONT_SDF = 2
|
FONT_SDF = 2
|
||||||
|
|
||||||
class BlendMode(IntEnum):
|
class BlendMode(IntEnum):
|
||||||
|
"""Color blending modes (pre-defined)."""
|
||||||
BLEND_ALPHA = 0
|
BLEND_ALPHA = 0
|
||||||
BLEND_ADDITIVE = 1
|
BLEND_ADDITIVE = 1
|
||||||
BLEND_MULTIPLIED = 2
|
BLEND_MULTIPLIED = 2
|
||||||
|
@ -314,6 +331,7 @@ class BlendMode(IntEnum):
|
||||||
BLEND_CUSTOM_SEPARATE = 7
|
BLEND_CUSTOM_SEPARATE = 7
|
||||||
|
|
||||||
class Gesture(IntEnum):
|
class Gesture(IntEnum):
|
||||||
|
"""Gesture."""
|
||||||
GESTURE_NONE = 0
|
GESTURE_NONE = 0
|
||||||
GESTURE_TAP = 1
|
GESTURE_TAP = 1
|
||||||
GESTURE_DOUBLETAP = 2
|
GESTURE_DOUBLETAP = 2
|
||||||
|
@ -327,6 +345,7 @@ class Gesture(IntEnum):
|
||||||
GESTURE_PINCH_OUT = 512
|
GESTURE_PINCH_OUT = 512
|
||||||
|
|
||||||
class CameraMode(IntEnum):
|
class CameraMode(IntEnum):
|
||||||
|
"""Camera system modes."""
|
||||||
CAMERA_CUSTOM = 0
|
CAMERA_CUSTOM = 0
|
||||||
CAMERA_FREE = 1
|
CAMERA_FREE = 1
|
||||||
CAMERA_ORBITAL = 2
|
CAMERA_ORBITAL = 2
|
||||||
|
@ -334,36 +353,43 @@ class CameraMode(IntEnum):
|
||||||
CAMERA_THIRD_PERSON = 4
|
CAMERA_THIRD_PERSON = 4
|
||||||
|
|
||||||
class CameraProjection(IntEnum):
|
class CameraProjection(IntEnum):
|
||||||
|
"""Camera projection."""
|
||||||
CAMERA_PERSPECTIVE = 0
|
CAMERA_PERSPECTIVE = 0
|
||||||
CAMERA_ORTHOGRAPHIC = 1
|
CAMERA_ORTHOGRAPHIC = 1
|
||||||
|
|
||||||
class NPatchLayout(IntEnum):
|
class NPatchLayout(IntEnum):
|
||||||
|
"""N-patch layout."""
|
||||||
NPATCH_NINE_PATCH = 0
|
NPATCH_NINE_PATCH = 0
|
||||||
NPATCH_THREE_PATCH_VERTICAL = 1
|
NPATCH_THREE_PATCH_VERTICAL = 1
|
||||||
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
||||||
|
|
||||||
class GuiState(IntEnum):
|
class GuiState(IntEnum):
|
||||||
|
"""Gui control state."""
|
||||||
STATE_NORMAL = 0
|
STATE_NORMAL = 0
|
||||||
STATE_FOCUSED = 1
|
STATE_FOCUSED = 1
|
||||||
STATE_PRESSED = 2
|
STATE_PRESSED = 2
|
||||||
STATE_DISABLED = 3
|
STATE_DISABLED = 3
|
||||||
|
|
||||||
class GuiTextAlignment(IntEnum):
|
class GuiTextAlignment(IntEnum):
|
||||||
|
"""Gui control text alignment."""
|
||||||
TEXT_ALIGN_LEFT = 0
|
TEXT_ALIGN_LEFT = 0
|
||||||
TEXT_ALIGN_CENTER = 1
|
TEXT_ALIGN_CENTER = 1
|
||||||
TEXT_ALIGN_RIGHT = 2
|
TEXT_ALIGN_RIGHT = 2
|
||||||
|
|
||||||
class GuiTextAlignmentVertical(IntEnum):
|
class GuiTextAlignmentVertical(IntEnum):
|
||||||
|
"""Gui control text alignment vertical."""
|
||||||
TEXT_ALIGN_TOP = 0
|
TEXT_ALIGN_TOP = 0
|
||||||
TEXT_ALIGN_MIDDLE = 1
|
TEXT_ALIGN_MIDDLE = 1
|
||||||
TEXT_ALIGN_BOTTOM = 2
|
TEXT_ALIGN_BOTTOM = 2
|
||||||
|
|
||||||
class GuiTextWrapMode(IntEnum):
|
class GuiTextWrapMode(IntEnum):
|
||||||
|
"""Gui control text wrap mode."""
|
||||||
TEXT_WRAP_NONE = 0
|
TEXT_WRAP_NONE = 0
|
||||||
TEXT_WRAP_CHAR = 1
|
TEXT_WRAP_CHAR = 1
|
||||||
TEXT_WRAP_WORD = 2
|
TEXT_WRAP_WORD = 2
|
||||||
|
|
||||||
class GuiControl(IntEnum):
|
class GuiControl(IntEnum):
|
||||||
|
"""Gui controls."""
|
||||||
DEFAULT = 0
|
DEFAULT = 0
|
||||||
LABEL = 1
|
LABEL = 1
|
||||||
BUTTON = 2
|
BUTTON = 2
|
||||||
|
@ -382,6 +408,7 @@ class GuiControl(IntEnum):
|
||||||
STATUSBAR = 15
|
STATUSBAR = 15
|
||||||
|
|
||||||
class GuiControlProperty(IntEnum):
|
class GuiControlProperty(IntEnum):
|
||||||
|
"""Gui base properties for every control."""
|
||||||
BORDER_COLOR_NORMAL = 0
|
BORDER_COLOR_NORMAL = 0
|
||||||
BASE_COLOR_NORMAL = 1
|
BASE_COLOR_NORMAL = 1
|
||||||
TEXT_COLOR_NORMAL = 2
|
TEXT_COLOR_NORMAL = 2
|
||||||
|
@ -399,6 +426,7 @@ class GuiControlProperty(IntEnum):
|
||||||
TEXT_ALIGNMENT = 14
|
TEXT_ALIGNMENT = 14
|
||||||
|
|
||||||
class GuiDefaultProperty(IntEnum):
|
class GuiDefaultProperty(IntEnum):
|
||||||
|
"""DEFAULT extended properties."""
|
||||||
TEXT_SIZE = 16
|
TEXT_SIZE = 16
|
||||||
TEXT_SPACING = 17
|
TEXT_SPACING = 17
|
||||||
LINE_COLOR = 18
|
LINE_COLOR = 18
|
||||||
|
@ -408,16 +436,20 @@ class GuiDefaultProperty(IntEnum):
|
||||||
TEXT_WRAP_MODE = 22
|
TEXT_WRAP_MODE = 22
|
||||||
|
|
||||||
class GuiToggleProperty(IntEnum):
|
class GuiToggleProperty(IntEnum):
|
||||||
|
"""Toggle/ToggleGroup."""
|
||||||
GROUP_PADDING = 16
|
GROUP_PADDING = 16
|
||||||
|
|
||||||
class GuiSliderProperty(IntEnum):
|
class GuiSliderProperty(IntEnum):
|
||||||
|
"""Slider/SliderBar."""
|
||||||
SLIDER_WIDTH = 16
|
SLIDER_WIDTH = 16
|
||||||
SLIDER_PADDING = 17
|
SLIDER_PADDING = 17
|
||||||
|
|
||||||
class GuiProgressBarProperty(IntEnum):
|
class GuiProgressBarProperty(IntEnum):
|
||||||
|
"""ProgressBar."""
|
||||||
PROGRESS_PADDING = 16
|
PROGRESS_PADDING = 16
|
||||||
|
|
||||||
class GuiScrollBarProperty(IntEnum):
|
class GuiScrollBarProperty(IntEnum):
|
||||||
|
"""ScrollBar."""
|
||||||
ARROWS_SIZE = 16
|
ARROWS_SIZE = 16
|
||||||
ARROWS_VISIBLE = 17
|
ARROWS_VISIBLE = 17
|
||||||
SCROLL_SLIDER_PADDING = 18
|
SCROLL_SLIDER_PADDING = 18
|
||||||
|
@ -426,26 +458,32 @@ class GuiScrollBarProperty(IntEnum):
|
||||||
SCROLL_SPEED = 21
|
SCROLL_SPEED = 21
|
||||||
|
|
||||||
class GuiCheckBoxProperty(IntEnum):
|
class GuiCheckBoxProperty(IntEnum):
|
||||||
|
"""CheckBox."""
|
||||||
CHECK_PADDING = 16
|
CHECK_PADDING = 16
|
||||||
|
|
||||||
class GuiComboBoxProperty(IntEnum):
|
class GuiComboBoxProperty(IntEnum):
|
||||||
|
"""ComboBox."""
|
||||||
COMBO_BUTTON_WIDTH = 16
|
COMBO_BUTTON_WIDTH = 16
|
||||||
COMBO_BUTTON_SPACING = 17
|
COMBO_BUTTON_SPACING = 17
|
||||||
|
|
||||||
class GuiDropdownBoxProperty(IntEnum):
|
class GuiDropdownBoxProperty(IntEnum):
|
||||||
|
"""DropdownBox."""
|
||||||
ARROW_PADDING = 16
|
ARROW_PADDING = 16
|
||||||
DROPDOWN_ITEMS_SPACING = 17
|
DROPDOWN_ITEMS_SPACING = 17
|
||||||
DROPDOWN_ARROW_HIDDEN = 18
|
DROPDOWN_ARROW_HIDDEN = 18
|
||||||
DROPDOWN_ROLL_UP = 19
|
DROPDOWN_ROLL_UP = 19
|
||||||
|
|
||||||
class GuiTextBoxProperty(IntEnum):
|
class GuiTextBoxProperty(IntEnum):
|
||||||
|
"""TextBox/TextBoxMulti/ValueBox/Spinner."""
|
||||||
TEXT_READONLY = 16
|
TEXT_READONLY = 16
|
||||||
|
|
||||||
class GuiSpinnerProperty(IntEnum):
|
class GuiSpinnerProperty(IntEnum):
|
||||||
|
"""Spinner."""
|
||||||
SPIN_BUTTON_WIDTH = 16
|
SPIN_BUTTON_WIDTH = 16
|
||||||
SPIN_BUTTON_SPACING = 17
|
SPIN_BUTTON_SPACING = 17
|
||||||
|
|
||||||
class GuiListViewProperty(IntEnum):
|
class GuiListViewProperty(IntEnum):
|
||||||
|
"""ListView."""
|
||||||
LIST_ITEMS_HEIGHT = 16
|
LIST_ITEMS_HEIGHT = 16
|
||||||
LIST_ITEMS_SPACING = 17
|
LIST_ITEMS_SPACING = 17
|
||||||
SCROLLBAR_WIDTH = 18
|
SCROLLBAR_WIDTH = 18
|
||||||
|
@ -453,6 +491,7 @@ class GuiListViewProperty(IntEnum):
|
||||||
LIST_ITEMS_BORDER_WIDTH = 20
|
LIST_ITEMS_BORDER_WIDTH = 20
|
||||||
|
|
||||||
class GuiColorPickerProperty(IntEnum):
|
class GuiColorPickerProperty(IntEnum):
|
||||||
|
"""ColorPicker."""
|
||||||
COLOR_SELECTOR_SIZE = 16
|
COLOR_SELECTOR_SIZE = 16
|
||||||
HUEBAR_WIDTH = 17
|
HUEBAR_WIDTH = 17
|
||||||
HUEBAR_PADDING = 18
|
HUEBAR_PADDING = 18
|
||||||
|
@ -460,6 +499,7 @@ class GuiColorPickerProperty(IntEnum):
|
||||||
HUEBAR_SELECTOR_OVERFLOW = 20
|
HUEBAR_SELECTOR_OVERFLOW = 20
|
||||||
|
|
||||||
class GuiIconName(IntEnum):
|
class GuiIconName(IntEnum):
|
||||||
|
"""."""
|
||||||
ICON_NONE = 0
|
ICON_NONE = 0
|
||||||
ICON_FOLDER_FILE_OPEN = 1
|
ICON_FOLDER_FILE_OPEN = 1
|
||||||
ICON_FILE_SAVE_CLASSIC = 2
|
ICON_FILE_SAVE_CLASSIC = 2
|
||||||
|
|
101
examples/audio/audio_music_stream.py
Normal file
101
examples/audio/audio_music_stream.py
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
"""checked with raylib-python-cffi 5.5.0.2
|
||||||
|
raylib [audio] example - Music playing (streaming)
|
||||||
|
Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
Example originally created with raylib 1.3, last time updated with raylib 4.0
|
||||||
|
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
BSD-like license that allows static linking with closed source software
|
||||||
|
Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
This source has been converted from C raylib examples to Python.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pyray as rl
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
THIS_DIR = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
# Program main entry point
|
||||||
|
# ------------------------------------------------------------------------------------
|
||||||
|
def main():
|
||||||
|
# Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
screen_width = 800
|
||||||
|
screen_height = 450
|
||||||
|
|
||||||
|
rl.init_window(
|
||||||
|
screen_width,
|
||||||
|
screen_height,
|
||||||
|
"raylib [audio] example - music playing (streaming)",
|
||||||
|
)
|
||||||
|
|
||||||
|
rl.init_audio_device() # Initialize audio device
|
||||||
|
|
||||||
|
music = rl.load_music_stream(str(THIS_DIR / "resources/country.mp3"))
|
||||||
|
|
||||||
|
rl.play_music_stream(music)
|
||||||
|
|
||||||
|
time_played = 0.0 # Time played normalized [0.0f..1.0f]
|
||||||
|
pause = False # Music playing paused
|
||||||
|
|
||||||
|
rl.set_target_fps(30) # Set our game to run at 30 frames-per-second
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Main game loop
|
||||||
|
while not rl.window_should_close(): # Detect window close button or ESC key
|
||||||
|
# Update
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
rl.update_music_stream(music) # Update music buffer with new stream data
|
||||||
|
|
||||||
|
# Restart music playing (stop and play)
|
||||||
|
if rl.is_key_pressed(rl.KEY_SPACE):
|
||||||
|
rl.stop_music_stream(music)
|
||||||
|
rl.play_music_stream(music)
|
||||||
|
|
||||||
|
# Pause/Resume music playing
|
||||||
|
if rl.is_key_pressed(rl.KEY_P):
|
||||||
|
pause = not pause
|
||||||
|
|
||||||
|
if pause:
|
||||||
|
rl.pause_music_stream(music)
|
||||||
|
else:
|
||||||
|
rl.resume_music_stream(music)
|
||||||
|
|
||||||
|
# Get normalized time played for current music stream
|
||||||
|
time_played = rl.get_music_time_played(music) / rl.get_music_time_length(music)
|
||||||
|
|
||||||
|
if time_played > 1.0:
|
||||||
|
time_played = 1.0 # Make sure time played is no longer than music
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Draw
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
rl.begin_drawing()
|
||||||
|
|
||||||
|
rl.clear_background(rl.RAYWHITE)
|
||||||
|
|
||||||
|
rl.draw_text("MUSIC SHOULD BE PLAYING!", 255, 150, 20, rl.LIGHTGRAY)
|
||||||
|
|
||||||
|
rl.draw_rectangle(200, 200, 400, 12, rl.LIGHTGRAY)
|
||||||
|
rl.draw_rectangle(200, 200, int(time_played * 400.0), 12, rl.MAROON)
|
||||||
|
rl.draw_rectangle_lines(200, 200, 400, 12, rl.GRAY)
|
||||||
|
|
||||||
|
rl.draw_text("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, rl.LIGHTGRAY)
|
||||||
|
rl.draw_text("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, rl.LIGHTGRAY)
|
||||||
|
|
||||||
|
rl.end_drawing()
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# De-Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
rl.unload_music_stream(music) # Unload music stream buffers from RAM
|
||||||
|
|
||||||
|
rl.close_audio_device() # Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
rl.close_window() # Close window and OpenGL context
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
67
examples/audio/audio_sound_loading.py
Normal file
67
examples/audio/audio_sound_loading.py
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
"""checked with raylib-python-cffi 5.5.0.2
|
||||||
|
raylib [audio] example - Sound loading and playing
|
||||||
|
Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
Example originally created with raylib 1.1, last time updated with raylib 3.5
|
||||||
|
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
BSD-like license that allows static linking with closed source software
|
||||||
|
Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
This source has been converted from C raylib examples to Python.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pyray as rl
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Get the directory where this script is located
|
||||||
|
THIS_DIR = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
screen_width = 800
|
||||||
|
screen_height = 450
|
||||||
|
|
||||||
|
rl.init_window(
|
||||||
|
screen_width, screen_height, "raylib [audio] example - sound loading and playing"
|
||||||
|
)
|
||||||
|
|
||||||
|
rl.init_audio_device() # Initialize audio device
|
||||||
|
|
||||||
|
# Load WAV audio file using proper path resolution
|
||||||
|
fx_wav = rl.load_sound(str(THIS_DIR / "resources/sound.wav"))
|
||||||
|
# Load OGG audio file using proper path resolution
|
||||||
|
fx_ogg = rl.load_sound(str(THIS_DIR / "resources/target.ogg"))
|
||||||
|
|
||||||
|
rl.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Main game loop
|
||||||
|
while not rl.window_should_close(): # Detect window close button or ESC key
|
||||||
|
# Update
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
if rl.is_key_pressed(rl.KeyboardKey.KEY_SPACE):
|
||||||
|
rl.play_sound(fx_wav) # Play WAV sound
|
||||||
|
if rl.is_key_pressed(rl.KeyboardKey.KEY_ENTER):
|
||||||
|
rl.play_sound(fx_ogg) # Play OGG sound
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Draw
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
rl.begin_drawing()
|
||||||
|
|
||||||
|
rl.clear_background(rl.RAYWHITE)
|
||||||
|
|
||||||
|
rl.draw_text("Press SPACE to PLAY the WAV sound!", 200, 180, 20, rl.LIGHTGRAY)
|
||||||
|
rl.draw_text("Press ENTER to PLAY the OGG sound!", 200, 220, 20, rl.LIGHTGRAY)
|
||||||
|
|
||||||
|
rl.end_drawing()
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# De-Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
rl.unload_sound(fx_wav) # Unload sound data
|
||||||
|
rl.unload_sound(fx_ogg) # Unload sound data
|
||||||
|
|
||||||
|
rl.close_audio_device() # Close audio device
|
||||||
|
|
||||||
|
rl.close_window() # Close window and OpenGL context
|
||||||
|
# --------------------------------------------------------------------------------------
|
86
examples/audio/audio_sound_multi.py
Normal file
86
examples/audio/audio_sound_multi.py
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
"""checked with raylib-python-cffi 5.5.0.2
|
||||||
|
raylib [audio] example - Playing sound multiple times
|
||||||
|
Example complexity rating: [★★☆☆] 2/4
|
||||||
|
Example originally created with raylib 4.6, last time updated with raylib 4.6
|
||||||
|
Example contributed by Jeffery Myers (@JeffM2501) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
BSD-like license that allows static linking with closed source software
|
||||||
|
Copyright (c) 2023-2025 Jeffery Myers (@JeffM2501)
|
||||||
|
|
||||||
|
This source has been converted from C raylib examples to Python.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
import pyray as rl
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Get the directory where this script is located
|
||||||
|
THIS_DIR = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
MAX_SOUNDS = 10
|
||||||
|
sound_array: List[rl.Sound] = []
|
||||||
|
current_sound = 0
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
screen_width = 800
|
||||||
|
screen_height = 450
|
||||||
|
|
||||||
|
rl.init_window(
|
||||||
|
screen_width, screen_height, "raylib [audio] example - playing sound multiple times"
|
||||||
|
)
|
||||||
|
|
||||||
|
rl.init_audio_device() # Initialize audio device
|
||||||
|
|
||||||
|
# Load the sound list
|
||||||
|
sound_array.append(
|
||||||
|
rl.load_sound(str(THIS_DIR / "resources/sound.wav"))
|
||||||
|
) # Load WAV audio file into the first slot as the 'source' sound
|
||||||
|
# this sound owns the sample data
|
||||||
|
for i in range(1, MAX_SOUNDS):
|
||||||
|
sound_array.append(
|
||||||
|
rl.load_sound_alias(sound_array[0])
|
||||||
|
) # Load an alias of the sound into slots 1-9
|
||||||
|
# These do not own the sound data, but can be played
|
||||||
|
current_sound = 0 # Set the sound list to the start
|
||||||
|
|
||||||
|
rl.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Main game loop
|
||||||
|
while not rl.window_should_close(): # Detect window close button or ESC key
|
||||||
|
# Update
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
if rl.is_key_pressed(rl.KeyboardKey.KEY_SPACE):
|
||||||
|
rl.play_sound(sound_array[current_sound]) # Play the next open sound slot
|
||||||
|
current_sound += 1 # Increment the sound slot
|
||||||
|
if (
|
||||||
|
current_sound >= MAX_SOUNDS
|
||||||
|
): # If the sound slot is out of bounds, go back to 0
|
||||||
|
current_sound = 0
|
||||||
|
|
||||||
|
# Note: a better way would be to look at the list for the first sound that is not playing and use that slot
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Draw
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
rl.begin_drawing()
|
||||||
|
|
||||||
|
rl.clear_background(rl.RAYWHITE)
|
||||||
|
|
||||||
|
rl.draw_text("Press SPACE to PLAY a WAV sound!", 200, 180, 20, rl.LIGHTGRAY)
|
||||||
|
|
||||||
|
rl.end_drawing()
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# De-Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
for i in range(1, MAX_SOUNDS):
|
||||||
|
rl.unload_sound_alias(sound_array[i]) # Unload sound aliases
|
||||||
|
rl.unload_sound(sound_array[0]) # Unload source sound data
|
||||||
|
|
||||||
|
rl.close_audio_device() # Close audio device
|
||||||
|
|
||||||
|
rl.close_window() # Close window and OpenGL context
|
||||||
|
# --------------------------------------------------------------------------------------
|
112
examples/audio/audio_sound_positioning.py
Normal file
112
examples/audio/audio_sound_positioning.py
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
"""checked with raylib-python-cffi 5.5.0.2
|
||||||
|
raylib [audio] example - Playing spatialized 3D sound
|
||||||
|
Example complexity rating: [★★☆☆] 2/4
|
||||||
|
Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
|
Example contributed by Le Juez Victor (@Bigfoot71) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
BSD-like license that allows static linking with closed source software
|
||||||
|
Copyright (c) 2025 Le Juez Victor (@Bigfoot71)
|
||||||
|
|
||||||
|
This source has been converted from C raylib examples to Python.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pyray as rl
|
||||||
|
import math
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Get the directory where this script is located
|
||||||
|
THIS_DIR = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
|
||||||
|
# Sound positioning function
|
||||||
|
def set_sound_position(listener, sound, position, max_dist):
|
||||||
|
# Calculate direction vector and distance between listener and sound source
|
||||||
|
direction = rl.vector3_subtract(position, listener.position)
|
||||||
|
distance = rl.vector3_length(direction)
|
||||||
|
|
||||||
|
# Apply logarithmic distance attenuation and clamp between 0-1
|
||||||
|
attenuation = 1.0 / (1.0 + (distance / max_dist))
|
||||||
|
attenuation = rl.clamp(attenuation, 0.0, 1.0)
|
||||||
|
|
||||||
|
# Calculate normalized vectors for spatial positioning
|
||||||
|
normalized_direction = rl.vector3_normalize(direction)
|
||||||
|
forward = rl.vector3_normalize(
|
||||||
|
rl.vector3_subtract(listener.target, listener.position)
|
||||||
|
)
|
||||||
|
right = rl.vector3_normalize(rl.vector3_cross_product(listener.up, forward))
|
||||||
|
|
||||||
|
# Reduce volume for sounds behind the listener
|
||||||
|
dot_product = rl.vector3_dot_product(forward, normalized_direction)
|
||||||
|
if dot_product < 0.0:
|
||||||
|
attenuation *= 1.0 + dot_product * 0.5
|
||||||
|
|
||||||
|
# Set stereo panning based on sound position relative to listener
|
||||||
|
pan = 0.5 + 0.5 * rl.vector3_dot_product(normalized_direction, right)
|
||||||
|
|
||||||
|
# Apply final sound properties
|
||||||
|
rl.set_sound_volume(sound, attenuation)
|
||||||
|
rl.set_sound_pan(sound, pan)
|
||||||
|
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
screen_width = 800
|
||||||
|
screen_height = 450
|
||||||
|
|
||||||
|
rl.init_window(
|
||||||
|
screen_width, screen_height, "raylib [audio] example - Playing spatialized 3D sound"
|
||||||
|
)
|
||||||
|
|
||||||
|
rl.init_audio_device()
|
||||||
|
|
||||||
|
sound = rl.load_sound(str(THIS_DIR / "resources/coin.wav"))
|
||||||
|
|
||||||
|
camera = rl.Camera3D(
|
||||||
|
(0, 5, 5),
|
||||||
|
(0, 0, 0),
|
||||||
|
(0, 1, 0),
|
||||||
|
60.0,
|
||||||
|
rl.CameraProjection.CAMERA_PERSPECTIVE,
|
||||||
|
)
|
||||||
|
|
||||||
|
rl.disable_cursor()
|
||||||
|
|
||||||
|
rl.set_target_fps(60)
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Main game loop
|
||||||
|
while not rl.window_should_close():
|
||||||
|
# Update
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
rl.update_camera(camera, rl.CameraMode.CAMERA_FREE)
|
||||||
|
|
||||||
|
th = rl.get_time()
|
||||||
|
|
||||||
|
sphere_pos = rl.Vector3(5.0 * math.cos(th), 0.0, 5.0 * math.sin(th))
|
||||||
|
|
||||||
|
set_sound_position(camera, sound, sphere_pos, 20.0)
|
||||||
|
if not rl.is_sound_playing(sound):
|
||||||
|
rl.play_sound(sound)
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Draw
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
rl.begin_drawing()
|
||||||
|
|
||||||
|
rl.clear_background(rl.RAYWHITE)
|
||||||
|
|
||||||
|
rl.begin_mode_3d(camera)
|
||||||
|
rl.draw_grid(10, 2)
|
||||||
|
rl.draw_sphere(sphere_pos, 0.5, rl.RED)
|
||||||
|
rl.end_mode_3d()
|
||||||
|
|
||||||
|
rl.end_drawing()
|
||||||
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# De-Initialization
|
||||||
|
# --------------------------------------------------------------------------------------
|
||||||
|
rl.unload_sound(sound)
|
||||||
|
rl.close_audio_device() # Close audio device
|
||||||
|
|
||||||
|
rl.close_window() # Close window and OpenGL context
|
||||||
|
# --------------------------------------------------------------------------------------
|
BIN
examples/audio/resources/coin.wav
Normal file
BIN
examples/audio/resources/coin.wav
Normal file
Binary file not shown.
BIN
examples/audio/resources/sound.wav
Normal file
BIN
examples/audio/resources/sound.wav
Normal file
Binary file not shown.
BIN
examples/audio/resources/target.ogg
Normal file
BIN
examples/audio/resources/target.ogg
Normal file
Binary file not shown.
|
@ -25,10 +25,10 @@ SetTargetFPS(60)
|
||||||
while not WindowShouldClose():
|
while not WindowShouldClose():
|
||||||
# Update
|
# Update
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
UpdatePhysics() # Update physics system
|
|
||||||
|
|
||||||
if IsKeyPressed(KEY_R): # Reset physics system
|
if IsKeyPressed(KEY_R): # Reset physics system
|
||||||
ResetPhysics()
|
ClosePhysics()
|
||||||
|
InitPhysics()
|
||||||
|
|
||||||
floor = CreatePhysicsBodyRectangle((SCREEN_WIDTH/2, SCREEN_HEIGHT), 500, 100, 10)
|
floor = CreatePhysicsBodyRectangle((SCREEN_WIDTH/2, SCREEN_HEIGHT), 500, 100, 10)
|
||||||
floor.enabled = False
|
floor.enabled = False
|
||||||
|
|
78
examples/textures/textures_sprite_anim.py
Normal file
78
examples/textures/textures_sprite_anim.py
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# Tested with version: 5.5.0.2
|
||||||
|
# by @Lightnet
|
||||||
|
|
||||||
|
from pyray import *
|
||||||
|
|
||||||
|
|
||||||
|
currentFrame = 0
|
||||||
|
framesCounter = 0
|
||||||
|
framesSpeed = 8
|
||||||
|
# Initialization
|
||||||
|
SCREEN_WIDTH = 800
|
||||||
|
SCREEN_HEIGHT = 450
|
||||||
|
|
||||||
|
MAX_FRAME_SPEED = 15
|
||||||
|
MIN_FRAME_SPEED = 1
|
||||||
|
|
||||||
|
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [texture] example - sprite anim")
|
||||||
|
|
||||||
|
#need to set in case of animation snyc
|
||||||
|
set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
|
scarfy = load_texture("resources/scarfy.png") # Texture loading
|
||||||
|
|
||||||
|
frameRec = Rectangle(0.0, 0.0, scarfy.width/6, scarfy.height)
|
||||||
|
|
||||||
|
position = Vector2(350.0, 280.0)
|
||||||
|
|
||||||
|
# Main game loop
|
||||||
|
while not window_should_close(): # Detect window close button or ESC key
|
||||||
|
|
||||||
|
framesCounter += 1
|
||||||
|
|
||||||
|
if framesCounter >= 60/framesSpeed:
|
||||||
|
framesCounter = 0
|
||||||
|
currentFrame += 1
|
||||||
|
if currentFrame > 5:
|
||||||
|
currentFrame = 0
|
||||||
|
|
||||||
|
frameRec.x = float(currentFrame) * float(scarfy.width/6)
|
||||||
|
# Control speed animation
|
||||||
|
if (is_key_pressed(KeyboardKey.KEY_RIGHT)):
|
||||||
|
framesSpeed += 1
|
||||||
|
elif is_key_pressed(KeyboardKey.KEY_LEFT):
|
||||||
|
framesSpeed -= 1
|
||||||
|
|
||||||
|
if framesSpeed > MAX_FRAME_SPEED:
|
||||||
|
framesSpeed = MAX_FRAME_SPEED
|
||||||
|
elif framesSpeed < MIN_FRAME_SPEED:
|
||||||
|
framesSpeed = MIN_FRAME_SPEED
|
||||||
|
|
||||||
|
begin_drawing()
|
||||||
|
|
||||||
|
clear_background(RAYWHITE)
|
||||||
|
#draw sheet block
|
||||||
|
draw_rectangle_lines(15, 40, scarfy.width, scarfy.height, LIME)
|
||||||
|
#draw current frame render
|
||||||
|
draw_rectangle_lines(15 + int(frameRec.x), 40 + int(frameRec.y), int(frameRec.width), int(frameRec.height), RED)
|
||||||
|
draw_text("FRAME SPEED: ", 165, 210, 10, DARKGRAY)
|
||||||
|
draw_text(f" FPS {framesSpeed}", 575, 210, 10, DARKGRAY) #format string
|
||||||
|
draw_text("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, DARKGRAY)
|
||||||
|
#display bar framesSpeed cap
|
||||||
|
for i in range(MAX_FRAME_SPEED):
|
||||||
|
if i < framesSpeed:
|
||||||
|
draw_rectangle(250 + 21*i, 205, 20, 20, RED)
|
||||||
|
draw_rectangle_lines(250 + 21*i, 205, 20, 20, MAROON)
|
||||||
|
#draw sprite sheet texture
|
||||||
|
draw_texture(scarfy, 15, 40, WHITE)
|
||||||
|
#draw sprite animation
|
||||||
|
draw_texture_rec(scarfy, frameRec, position,WHITE)
|
||||||
|
|
||||||
|
draw_text("(c) Scarfy sprite by Eiden Marsal", SCREEN_WIDTH - 200, SCREEN_HEIGHT - 20, 10, GRAY)
|
||||||
|
|
||||||
|
end_drawing()
|
||||||
|
|
||||||
|
# De-Initialization
|
||||||
|
unload_texture(scarfy)
|
||||||
|
|
||||||
|
close_window() # Close window and OpenGL context
|
2
physac
2
physac
|
@ -1 +1 @@
|
||||||
Subproject commit 4a8e17f263fb8e1150b3fbafc96f880c7d7a4833
|
Subproject commit 587b63926010593eedf29ef74e3aa22c1a507925
|
|
@ -126,7 +126,7 @@ def _make_struct_constructor_function(struct):
|
||||||
or isinstance(arg, (array, bytes, bytearray, memoryview)))):
|
or isinstance(arg, (array, bytes, bytearray, memoryview)))):
|
||||||
arg = ffi.from_buffer(field[1].type, arg)
|
arg = ffi.from_buffer(field[1].type, arg)
|
||||||
modified_args.append(arg)
|
modified_args.append(arg)
|
||||||
s = ffi.new(f"struct {struct} *", modified_args)[0]
|
s = ffi.new(f"{struct} *", modified_args)[0]
|
||||||
global_weakkeydict[s] = modified_args
|
global_weakkeydict[s] = modified_args
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
2337
pyray/__init__.pyi
2337
pyray/__init__.pyi
File diff suppressed because it is too large
Load diff
2
raylib-c
2
raylib-c
|
@ -1 +1 @@
|
||||||
Subproject commit 26548c10620c4ae6937cf8b506c777a006b33c16
|
Subproject commit 15afe89aff2fc7da96ab5de80bde7f6186971cde
|
|
@ -13,18 +13,22 @@
|
||||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ._raylib_cffi import ffi, lib as rl
|
from ._raylib_cffi import ffi, lib as rl
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
print("\n*** ERROR LOADING NATIVE CODE ***\n")
|
logger.error("*** ERROR LOADING NATIVE CODE ***")
|
||||||
print("See https://github.com/electronstudio/raylib-python-cffi/issues/142\n", file=sys.stderr)
|
logger.error("See https://github.com/electronstudio/raylib-python-cffi/issues/142")
|
||||||
print("Your Python is: "+str(sys.implementation)+"\n", file=sys.stderr)
|
logger.error("Your Python is: %s", str(sys.implementation))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
from raylib._raylib_cffi.lib import *
|
from raylib._raylib_cffi.lib import *
|
||||||
from raylib.colors import *
|
from raylib.colors import *
|
||||||
from raylib.defines import *
|
from raylib.defines import *
|
||||||
import cffi
|
import cffi
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
print("RAYLIB STATIC "+__version__+" LOADED", file=sys.stderr)
|
logger.warning("RAYLIB STATIC %s LOADED", __version__)
|
||||||
|
|
||||||
|
|
2192
raylib/__init__.pyi
2192
raylib/__init__.pyi
File diff suppressed because it is too large
Load diff
|
@ -24,8 +24,14 @@ import platform
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
THIS_DIR = Path(__file__).resolve().parent
|
||||||
|
REPO_ROOT = THIS_DIR.parent
|
||||||
|
|
||||||
|
|
||||||
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
|
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
|
||||||
|
ENABLE_WAYLAND_DRM_LEASING = os.getenv("ENABLE_WAYLAND_DRM_LEASING")
|
||||||
|
|
||||||
def check_raylib_installed():
|
def check_raylib_installed():
|
||||||
return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0
|
return subprocess.run(['pkg-config', '--exists', 'raylib'], text=True, stdout=subprocess.PIPE).returncode == 0
|
||||||
|
@ -42,6 +48,17 @@ def get_the_lib_path():
|
||||||
return subprocess.run(['pkg-config', '--variable=libdir', 'raylib'], text=True,
|
return subprocess.run(['pkg-config', '--variable=libdir', 'raylib'], text=True,
|
||||||
stdout=subprocess.PIPE).stdout.strip()
|
stdout=subprocess.PIPE).stdout.strip()
|
||||||
|
|
||||||
|
def get_specified_libs(lib_target):
|
||||||
|
libs = subprocess.run(['pkg-config', '--libs', lib_target], text=True,
|
||||||
|
stdout=subprocess.PIPE).stdout.strip().split()
|
||||||
|
|
||||||
|
if libs == "":
|
||||||
|
raise ValueError(f"Failed to get specified libs ({lib_target})")
|
||||||
|
|
||||||
|
print(f"{lib_target}: {libs}")
|
||||||
|
|
||||||
|
return libs
|
||||||
|
|
||||||
def get_lib_flags():
|
def get_lib_flags():
|
||||||
return subprocess.run(['pkg-config', '--libs', 'raylib'], text=True,
|
return subprocess.run(['pkg-config', '--libs', 'raylib'], text=True,
|
||||||
stdout=subprocess.PIPE).stdout.strip().split()
|
stdout=subprocess.PIPE).stdout.strip().split()
|
||||||
|
@ -179,7 +196,11 @@ def build_unix():
|
||||||
if RAYLIB_PLATFORM=="SDL":
|
if RAYLIB_PLATFORM=="SDL":
|
||||||
extra_link_args += ['-lX11','-lSDL2']
|
extra_link_args += ['-lX11','-lSDL2']
|
||||||
elif RAYLIB_PLATFORM=="DRM":
|
elif RAYLIB_PLATFORM=="DRM":
|
||||||
extra_link_args += ['-lEGL', '-lgbm']
|
extra_link_args += get_specified_libs("egl")
|
||||||
|
extra_link_args += get_specified_libs("gbm")
|
||||||
|
|
||||||
|
if ENABLE_WAYLAND_DRM_LEASING != "":
|
||||||
|
extra_link_args += get_specified_libs("wayland-client")
|
||||||
else:
|
else:
|
||||||
extra_link_args += ['-lX11']
|
extra_link_args += ['-lX11']
|
||||||
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
|
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
|
||||||
|
@ -200,13 +221,13 @@ def build_unix():
|
||||||
|
|
||||||
def build_windows():
|
def build_windows():
|
||||||
print("BUILDING FOR WINDOWS")
|
print("BUILDING FOR WINDOWS")
|
||||||
ffibuilder.cdef(open("raylib/raylib.h.modified").read())
|
ffibuilder.cdef((THIS_DIR / "raylib.h.modified").read_text())
|
||||||
if RAYLIB_PLATFORM=="Desktop":
|
if RAYLIB_PLATFORM=="Desktop":
|
||||||
ffibuilder.cdef(open("raylib/glfw3.h.modified").read())
|
ffibuilder.cdef((THIS_DIR / "glfw3.h.modified").read_text())
|
||||||
ffibuilder.cdef(open("raylib/rlgl.h.modified").read())
|
ffibuilder.cdef((THIS_DIR / "rlgl.h.modified").read_text())
|
||||||
ffibuilder.cdef(open("raylib/raygui.h.modified").read())
|
ffibuilder.cdef((THIS_DIR / "raygui.h.modified").read_text())
|
||||||
ffibuilder.cdef(open("raylib/physac.h.modified").read())
|
ffibuilder.cdef((THIS_DIR / "physac.h.modified").read_text())
|
||||||
ffibuilder.cdef(open("raylib/raymath.h.modified").read())
|
ffibuilder.cdef((THIS_DIR / "raymath.h.modified").read_text())
|
||||||
|
|
||||||
ffi_includes = """
|
ffi_includes = """
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
@ -224,6 +245,7 @@ def build_windows():
|
||||||
#define RAYGUI_SUPPORT_RICONS
|
#define RAYGUI_SUPPORT_RICONS
|
||||||
#include "raygui.h"
|
#include "raygui.h"
|
||||||
#define PHYSAC_IMPLEMENTATION
|
#define PHYSAC_IMPLEMENTATION
|
||||||
|
#define PHYSAC_NO_THREADS
|
||||||
#include "physac.h"
|
#include "physac.h"
|
||||||
"""
|
"""
|
||||||
libraries = ['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm']
|
libraries = ['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm']
|
||||||
|
@ -236,10 +258,10 @@ def build_windows():
|
||||||
extra_compile_args=["/D_CFFI_NO_LIMITED_API"],
|
extra_compile_args=["/D_CFFI_NO_LIMITED_API"],
|
||||||
py_limited_api=False,
|
py_limited_api=False,
|
||||||
libraries=libraries,
|
libraries=libraries,
|
||||||
include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src',
|
include_dirs=[str(REPO_ROOT / 'raylib-c/src'),
|
||||||
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include',
|
str(REPO_ROOT / 'raylib-c/src/external/glfw/include'),
|
||||||
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src',
|
str(REPO_ROOT / 'raygui/src'),
|
||||||
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\physac\\src'],
|
str(REPO_ROOT / 'physac/src')],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -186,12 +186,10 @@ RAYGUI_TEXTFORMAT_MAX_SIZE: int = 256
|
||||||
PHYSAC_MAX_BODIES: int = 64
|
PHYSAC_MAX_BODIES: int = 64
|
||||||
PHYSAC_MAX_MANIFOLDS: int = 4096
|
PHYSAC_MAX_MANIFOLDS: int = 4096
|
||||||
PHYSAC_MAX_VERTICES: int = 24
|
PHYSAC_MAX_VERTICES: int = 24
|
||||||
PHYSAC_DEFAULT_CIRCLE_VERTICES: int = 24
|
PHYSAC_CIRCLE_VERTICES: int = 24
|
||||||
PHYSAC_COLLISION_ITERATIONS: int = 100
|
PHYSAC_COLLISION_ITERATIONS: int = 20
|
||||||
PHYSAC_PENETRATION_ALLOWANCE: float = 0.05
|
PHYSAC_PENETRATION_ALLOWANCE: float = 0.05
|
||||||
PHYSAC_PENETRATION_CORRECTION: float = 0.4
|
PHYSAC_PENETRATION_CORRECTION: float = 0.4
|
||||||
PHYSAC_PI: float = 3.141592653589793
|
|
||||||
PHYSAC_DEG2RAD = PHYSAC_PI / 180.0
|
|
||||||
PHYSAC_FLT_MAX: float = 3.402823466e+38
|
PHYSAC_FLT_MAX: float = 3.402823466e+38
|
||||||
PHYSAC_EPSILON: float = 1e-06
|
PHYSAC_EPSILON: float = 1e-06
|
||||||
GLFW_VERSION_MAJOR: int = 3
|
GLFW_VERSION_MAJOR: int = 3
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
|
|
||||||
class ConfigFlags(IntEnum):
|
class ConfigFlags(IntEnum):
|
||||||
|
"""System/Window config flags."""
|
||||||
FLAG_VSYNC_HINT = 64
|
FLAG_VSYNC_HINT = 64
|
||||||
FLAG_FULLSCREEN_MODE = 2
|
FLAG_FULLSCREEN_MODE = 2
|
||||||
FLAG_WINDOW_RESIZABLE = 4
|
FLAG_WINDOW_RESIZABLE = 4
|
||||||
|
@ -19,6 +20,7 @@ class ConfigFlags(IntEnum):
|
||||||
FLAG_INTERLACED_HINT = 65536
|
FLAG_INTERLACED_HINT = 65536
|
||||||
|
|
||||||
class TraceLogLevel(IntEnum):
|
class TraceLogLevel(IntEnum):
|
||||||
|
"""Trace log level."""
|
||||||
LOG_ALL = 0
|
LOG_ALL = 0
|
||||||
LOG_TRACE = 1
|
LOG_TRACE = 1
|
||||||
LOG_DEBUG = 2
|
LOG_DEBUG = 2
|
||||||
|
@ -29,6 +31,7 @@ class TraceLogLevel(IntEnum):
|
||||||
LOG_NONE = 7
|
LOG_NONE = 7
|
||||||
|
|
||||||
class KeyboardKey(IntEnum):
|
class KeyboardKey(IntEnum):
|
||||||
|
"""Keyboard keys (US keyboard layout)."""
|
||||||
KEY_NULL = 0
|
KEY_NULL = 0
|
||||||
KEY_APOSTROPHE = 39
|
KEY_APOSTROPHE = 39
|
||||||
KEY_COMMA = 44
|
KEY_COMMA = 44
|
||||||
|
@ -141,6 +144,7 @@ class KeyboardKey(IntEnum):
|
||||||
KEY_VOLUME_DOWN = 25
|
KEY_VOLUME_DOWN = 25
|
||||||
|
|
||||||
class MouseButton(IntEnum):
|
class MouseButton(IntEnum):
|
||||||
|
"""Mouse buttons."""
|
||||||
MOUSE_BUTTON_LEFT = 0
|
MOUSE_BUTTON_LEFT = 0
|
||||||
MOUSE_BUTTON_RIGHT = 1
|
MOUSE_BUTTON_RIGHT = 1
|
||||||
MOUSE_BUTTON_MIDDLE = 2
|
MOUSE_BUTTON_MIDDLE = 2
|
||||||
|
@ -150,6 +154,7 @@ class MouseButton(IntEnum):
|
||||||
MOUSE_BUTTON_BACK = 6
|
MOUSE_BUTTON_BACK = 6
|
||||||
|
|
||||||
class MouseCursor(IntEnum):
|
class MouseCursor(IntEnum):
|
||||||
|
"""Mouse cursor."""
|
||||||
MOUSE_CURSOR_DEFAULT = 0
|
MOUSE_CURSOR_DEFAULT = 0
|
||||||
MOUSE_CURSOR_ARROW = 1
|
MOUSE_CURSOR_ARROW = 1
|
||||||
MOUSE_CURSOR_IBEAM = 2
|
MOUSE_CURSOR_IBEAM = 2
|
||||||
|
@ -163,6 +168,7 @@ class MouseCursor(IntEnum):
|
||||||
MOUSE_CURSOR_NOT_ALLOWED = 10
|
MOUSE_CURSOR_NOT_ALLOWED = 10
|
||||||
|
|
||||||
class GamepadButton(IntEnum):
|
class GamepadButton(IntEnum):
|
||||||
|
"""Gamepad buttons."""
|
||||||
GAMEPAD_BUTTON_UNKNOWN = 0
|
GAMEPAD_BUTTON_UNKNOWN = 0
|
||||||
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
||||||
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
||||||
|
@ -183,6 +189,7 @@ class GamepadButton(IntEnum):
|
||||||
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
||||||
|
|
||||||
class GamepadAxis(IntEnum):
|
class GamepadAxis(IntEnum):
|
||||||
|
"""Gamepad axis."""
|
||||||
GAMEPAD_AXIS_LEFT_X = 0
|
GAMEPAD_AXIS_LEFT_X = 0
|
||||||
GAMEPAD_AXIS_LEFT_Y = 1
|
GAMEPAD_AXIS_LEFT_Y = 1
|
||||||
GAMEPAD_AXIS_RIGHT_X = 2
|
GAMEPAD_AXIS_RIGHT_X = 2
|
||||||
|
@ -191,6 +198,7 @@ class GamepadAxis(IntEnum):
|
||||||
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
||||||
|
|
||||||
class MaterialMapIndex(IntEnum):
|
class MaterialMapIndex(IntEnum):
|
||||||
|
"""Material map index."""
|
||||||
MATERIAL_MAP_ALBEDO = 0
|
MATERIAL_MAP_ALBEDO = 0
|
||||||
MATERIAL_MAP_METALNESS = 1
|
MATERIAL_MAP_METALNESS = 1
|
||||||
MATERIAL_MAP_NORMAL = 2
|
MATERIAL_MAP_NORMAL = 2
|
||||||
|
@ -204,6 +212,7 @@ class MaterialMapIndex(IntEnum):
|
||||||
MATERIAL_MAP_BRDF = 10
|
MATERIAL_MAP_BRDF = 10
|
||||||
|
|
||||||
class ShaderLocationIndex(IntEnum):
|
class ShaderLocationIndex(IntEnum):
|
||||||
|
"""Shader location index."""
|
||||||
SHADER_LOC_VERTEX_POSITION = 0
|
SHADER_LOC_VERTEX_POSITION = 0
|
||||||
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
||||||
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
||||||
|
@ -235,6 +244,7 @@ class ShaderLocationIndex(IntEnum):
|
||||||
SHADER_LOC_BONE_MATRICES = 28
|
SHADER_LOC_BONE_MATRICES = 28
|
||||||
|
|
||||||
class ShaderUniformDataType(IntEnum):
|
class ShaderUniformDataType(IntEnum):
|
||||||
|
"""Shader uniform data type."""
|
||||||
SHADER_UNIFORM_FLOAT = 0
|
SHADER_UNIFORM_FLOAT = 0
|
||||||
SHADER_UNIFORM_VEC2 = 1
|
SHADER_UNIFORM_VEC2 = 1
|
||||||
SHADER_UNIFORM_VEC3 = 2
|
SHADER_UNIFORM_VEC3 = 2
|
||||||
|
@ -246,12 +256,14 @@ class ShaderUniformDataType(IntEnum):
|
||||||
SHADER_UNIFORM_SAMPLER2D = 8
|
SHADER_UNIFORM_SAMPLER2D = 8
|
||||||
|
|
||||||
class ShaderAttributeDataType(IntEnum):
|
class ShaderAttributeDataType(IntEnum):
|
||||||
|
"""Shader attribute data types."""
|
||||||
SHADER_ATTRIB_FLOAT = 0
|
SHADER_ATTRIB_FLOAT = 0
|
||||||
SHADER_ATTRIB_VEC2 = 1
|
SHADER_ATTRIB_VEC2 = 1
|
||||||
SHADER_ATTRIB_VEC3 = 2
|
SHADER_ATTRIB_VEC3 = 2
|
||||||
SHADER_ATTRIB_VEC4 = 3
|
SHADER_ATTRIB_VEC4 = 3
|
||||||
|
|
||||||
class PixelFormat(IntEnum):
|
class PixelFormat(IntEnum):
|
||||||
|
"""Pixel formats."""
|
||||||
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
||||||
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
||||||
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
||||||
|
@ -278,6 +290,7 @@ class PixelFormat(IntEnum):
|
||||||
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24
|
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24
|
||||||
|
|
||||||
class TextureFilter(IntEnum):
|
class TextureFilter(IntEnum):
|
||||||
|
"""Texture parameters: filter mode."""
|
||||||
TEXTURE_FILTER_POINT = 0
|
TEXTURE_FILTER_POINT = 0
|
||||||
TEXTURE_FILTER_BILINEAR = 1
|
TEXTURE_FILTER_BILINEAR = 1
|
||||||
TEXTURE_FILTER_TRILINEAR = 2
|
TEXTURE_FILTER_TRILINEAR = 2
|
||||||
|
@ -286,12 +299,14 @@ class TextureFilter(IntEnum):
|
||||||
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
||||||
|
|
||||||
class TextureWrap(IntEnum):
|
class TextureWrap(IntEnum):
|
||||||
|
"""Texture parameters: wrap mode."""
|
||||||
TEXTURE_WRAP_REPEAT = 0
|
TEXTURE_WRAP_REPEAT = 0
|
||||||
TEXTURE_WRAP_CLAMP = 1
|
TEXTURE_WRAP_CLAMP = 1
|
||||||
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
||||||
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
||||||
|
|
||||||
class CubemapLayout(IntEnum):
|
class CubemapLayout(IntEnum):
|
||||||
|
"""Cubemap layouts."""
|
||||||
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
||||||
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
||||||
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
|
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
|
||||||
|
@ -299,11 +314,13 @@ class CubemapLayout(IntEnum):
|
||||||
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
|
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
|
||||||
|
|
||||||
class FontType(IntEnum):
|
class FontType(IntEnum):
|
||||||
|
"""Font type, defines generation method."""
|
||||||
FONT_DEFAULT = 0
|
FONT_DEFAULT = 0
|
||||||
FONT_BITMAP = 1
|
FONT_BITMAP = 1
|
||||||
FONT_SDF = 2
|
FONT_SDF = 2
|
||||||
|
|
||||||
class BlendMode(IntEnum):
|
class BlendMode(IntEnum):
|
||||||
|
"""Color blending modes (pre-defined)."""
|
||||||
BLEND_ALPHA = 0
|
BLEND_ALPHA = 0
|
||||||
BLEND_ADDITIVE = 1
|
BLEND_ADDITIVE = 1
|
||||||
BLEND_MULTIPLIED = 2
|
BLEND_MULTIPLIED = 2
|
||||||
|
@ -314,6 +331,7 @@ class BlendMode(IntEnum):
|
||||||
BLEND_CUSTOM_SEPARATE = 7
|
BLEND_CUSTOM_SEPARATE = 7
|
||||||
|
|
||||||
class Gesture(IntEnum):
|
class Gesture(IntEnum):
|
||||||
|
"""Gesture."""
|
||||||
GESTURE_NONE = 0
|
GESTURE_NONE = 0
|
||||||
GESTURE_TAP = 1
|
GESTURE_TAP = 1
|
||||||
GESTURE_DOUBLETAP = 2
|
GESTURE_DOUBLETAP = 2
|
||||||
|
@ -327,6 +345,7 @@ class Gesture(IntEnum):
|
||||||
GESTURE_PINCH_OUT = 512
|
GESTURE_PINCH_OUT = 512
|
||||||
|
|
||||||
class CameraMode(IntEnum):
|
class CameraMode(IntEnum):
|
||||||
|
"""Camera system modes."""
|
||||||
CAMERA_CUSTOM = 0
|
CAMERA_CUSTOM = 0
|
||||||
CAMERA_FREE = 1
|
CAMERA_FREE = 1
|
||||||
CAMERA_ORBITAL = 2
|
CAMERA_ORBITAL = 2
|
||||||
|
@ -334,36 +353,43 @@ class CameraMode(IntEnum):
|
||||||
CAMERA_THIRD_PERSON = 4
|
CAMERA_THIRD_PERSON = 4
|
||||||
|
|
||||||
class CameraProjection(IntEnum):
|
class CameraProjection(IntEnum):
|
||||||
|
"""Camera projection."""
|
||||||
CAMERA_PERSPECTIVE = 0
|
CAMERA_PERSPECTIVE = 0
|
||||||
CAMERA_ORTHOGRAPHIC = 1
|
CAMERA_ORTHOGRAPHIC = 1
|
||||||
|
|
||||||
class NPatchLayout(IntEnum):
|
class NPatchLayout(IntEnum):
|
||||||
|
"""N-patch layout."""
|
||||||
NPATCH_NINE_PATCH = 0
|
NPATCH_NINE_PATCH = 0
|
||||||
NPATCH_THREE_PATCH_VERTICAL = 1
|
NPATCH_THREE_PATCH_VERTICAL = 1
|
||||||
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
||||||
|
|
||||||
class GuiState(IntEnum):
|
class GuiState(IntEnum):
|
||||||
|
"""Gui control state."""
|
||||||
STATE_NORMAL = 0
|
STATE_NORMAL = 0
|
||||||
STATE_FOCUSED = 1
|
STATE_FOCUSED = 1
|
||||||
STATE_PRESSED = 2
|
STATE_PRESSED = 2
|
||||||
STATE_DISABLED = 3
|
STATE_DISABLED = 3
|
||||||
|
|
||||||
class GuiTextAlignment(IntEnum):
|
class GuiTextAlignment(IntEnum):
|
||||||
|
"""Gui control text alignment."""
|
||||||
TEXT_ALIGN_LEFT = 0
|
TEXT_ALIGN_LEFT = 0
|
||||||
TEXT_ALIGN_CENTER = 1
|
TEXT_ALIGN_CENTER = 1
|
||||||
TEXT_ALIGN_RIGHT = 2
|
TEXT_ALIGN_RIGHT = 2
|
||||||
|
|
||||||
class GuiTextAlignmentVertical(IntEnum):
|
class GuiTextAlignmentVertical(IntEnum):
|
||||||
|
"""Gui control text alignment vertical."""
|
||||||
TEXT_ALIGN_TOP = 0
|
TEXT_ALIGN_TOP = 0
|
||||||
TEXT_ALIGN_MIDDLE = 1
|
TEXT_ALIGN_MIDDLE = 1
|
||||||
TEXT_ALIGN_BOTTOM = 2
|
TEXT_ALIGN_BOTTOM = 2
|
||||||
|
|
||||||
class GuiTextWrapMode(IntEnum):
|
class GuiTextWrapMode(IntEnum):
|
||||||
|
"""Gui control text wrap mode."""
|
||||||
TEXT_WRAP_NONE = 0
|
TEXT_WRAP_NONE = 0
|
||||||
TEXT_WRAP_CHAR = 1
|
TEXT_WRAP_CHAR = 1
|
||||||
TEXT_WRAP_WORD = 2
|
TEXT_WRAP_WORD = 2
|
||||||
|
|
||||||
class GuiControl(IntEnum):
|
class GuiControl(IntEnum):
|
||||||
|
"""Gui controls."""
|
||||||
DEFAULT = 0
|
DEFAULT = 0
|
||||||
LABEL = 1
|
LABEL = 1
|
||||||
BUTTON = 2
|
BUTTON = 2
|
||||||
|
@ -382,6 +408,7 @@ class GuiControl(IntEnum):
|
||||||
STATUSBAR = 15
|
STATUSBAR = 15
|
||||||
|
|
||||||
class GuiControlProperty(IntEnum):
|
class GuiControlProperty(IntEnum):
|
||||||
|
"""Gui base properties for every control."""
|
||||||
BORDER_COLOR_NORMAL = 0
|
BORDER_COLOR_NORMAL = 0
|
||||||
BASE_COLOR_NORMAL = 1
|
BASE_COLOR_NORMAL = 1
|
||||||
TEXT_COLOR_NORMAL = 2
|
TEXT_COLOR_NORMAL = 2
|
||||||
|
@ -399,6 +426,7 @@ class GuiControlProperty(IntEnum):
|
||||||
TEXT_ALIGNMENT = 14
|
TEXT_ALIGNMENT = 14
|
||||||
|
|
||||||
class GuiDefaultProperty(IntEnum):
|
class GuiDefaultProperty(IntEnum):
|
||||||
|
"""DEFAULT extended properties."""
|
||||||
TEXT_SIZE = 16
|
TEXT_SIZE = 16
|
||||||
TEXT_SPACING = 17
|
TEXT_SPACING = 17
|
||||||
LINE_COLOR = 18
|
LINE_COLOR = 18
|
||||||
|
@ -408,16 +436,20 @@ class GuiDefaultProperty(IntEnum):
|
||||||
TEXT_WRAP_MODE = 22
|
TEXT_WRAP_MODE = 22
|
||||||
|
|
||||||
class GuiToggleProperty(IntEnum):
|
class GuiToggleProperty(IntEnum):
|
||||||
|
"""Toggle/ToggleGroup."""
|
||||||
GROUP_PADDING = 16
|
GROUP_PADDING = 16
|
||||||
|
|
||||||
class GuiSliderProperty(IntEnum):
|
class GuiSliderProperty(IntEnum):
|
||||||
|
"""Slider/SliderBar."""
|
||||||
SLIDER_WIDTH = 16
|
SLIDER_WIDTH = 16
|
||||||
SLIDER_PADDING = 17
|
SLIDER_PADDING = 17
|
||||||
|
|
||||||
class GuiProgressBarProperty(IntEnum):
|
class GuiProgressBarProperty(IntEnum):
|
||||||
|
"""ProgressBar."""
|
||||||
PROGRESS_PADDING = 16
|
PROGRESS_PADDING = 16
|
||||||
|
|
||||||
class GuiScrollBarProperty(IntEnum):
|
class GuiScrollBarProperty(IntEnum):
|
||||||
|
"""ScrollBar."""
|
||||||
ARROWS_SIZE = 16
|
ARROWS_SIZE = 16
|
||||||
ARROWS_VISIBLE = 17
|
ARROWS_VISIBLE = 17
|
||||||
SCROLL_SLIDER_PADDING = 18
|
SCROLL_SLIDER_PADDING = 18
|
||||||
|
@ -426,26 +458,32 @@ class GuiScrollBarProperty(IntEnum):
|
||||||
SCROLL_SPEED = 21
|
SCROLL_SPEED = 21
|
||||||
|
|
||||||
class GuiCheckBoxProperty(IntEnum):
|
class GuiCheckBoxProperty(IntEnum):
|
||||||
|
"""CheckBox."""
|
||||||
CHECK_PADDING = 16
|
CHECK_PADDING = 16
|
||||||
|
|
||||||
class GuiComboBoxProperty(IntEnum):
|
class GuiComboBoxProperty(IntEnum):
|
||||||
|
"""ComboBox."""
|
||||||
COMBO_BUTTON_WIDTH = 16
|
COMBO_BUTTON_WIDTH = 16
|
||||||
COMBO_BUTTON_SPACING = 17
|
COMBO_BUTTON_SPACING = 17
|
||||||
|
|
||||||
class GuiDropdownBoxProperty(IntEnum):
|
class GuiDropdownBoxProperty(IntEnum):
|
||||||
|
"""DropdownBox."""
|
||||||
ARROW_PADDING = 16
|
ARROW_PADDING = 16
|
||||||
DROPDOWN_ITEMS_SPACING = 17
|
DROPDOWN_ITEMS_SPACING = 17
|
||||||
DROPDOWN_ARROW_HIDDEN = 18
|
DROPDOWN_ARROW_HIDDEN = 18
|
||||||
DROPDOWN_ROLL_UP = 19
|
DROPDOWN_ROLL_UP = 19
|
||||||
|
|
||||||
class GuiTextBoxProperty(IntEnum):
|
class GuiTextBoxProperty(IntEnum):
|
||||||
|
"""TextBox/TextBoxMulti/ValueBox/Spinner."""
|
||||||
TEXT_READONLY = 16
|
TEXT_READONLY = 16
|
||||||
|
|
||||||
class GuiSpinnerProperty(IntEnum):
|
class GuiSpinnerProperty(IntEnum):
|
||||||
|
"""Spinner."""
|
||||||
SPIN_BUTTON_WIDTH = 16
|
SPIN_BUTTON_WIDTH = 16
|
||||||
SPIN_BUTTON_SPACING = 17
|
SPIN_BUTTON_SPACING = 17
|
||||||
|
|
||||||
class GuiListViewProperty(IntEnum):
|
class GuiListViewProperty(IntEnum):
|
||||||
|
"""ListView."""
|
||||||
LIST_ITEMS_HEIGHT = 16
|
LIST_ITEMS_HEIGHT = 16
|
||||||
LIST_ITEMS_SPACING = 17
|
LIST_ITEMS_SPACING = 17
|
||||||
SCROLLBAR_WIDTH = 18
|
SCROLLBAR_WIDTH = 18
|
||||||
|
@ -453,6 +491,7 @@ class GuiListViewProperty(IntEnum):
|
||||||
LIST_ITEMS_BORDER_WIDTH = 20
|
LIST_ITEMS_BORDER_WIDTH = 20
|
||||||
|
|
||||||
class GuiColorPickerProperty(IntEnum):
|
class GuiColorPickerProperty(IntEnum):
|
||||||
|
"""ColorPicker."""
|
||||||
COLOR_SELECTOR_SIZE = 16
|
COLOR_SELECTOR_SIZE = 16
|
||||||
HUEBAR_WIDTH = 17
|
HUEBAR_WIDTH = 17
|
||||||
HUEBAR_PADDING = 18
|
HUEBAR_PADDING = 18
|
||||||
|
@ -460,6 +499,7 @@ class GuiColorPickerProperty(IntEnum):
|
||||||
HUEBAR_SELECTOR_OVERFLOW = 20
|
HUEBAR_SELECTOR_OVERFLOW = 20
|
||||||
|
|
||||||
class GuiIconName(IntEnum):
|
class GuiIconName(IntEnum):
|
||||||
|
"""."""
|
||||||
ICON_NONE = 0
|
ICON_NONE = 0
|
||||||
ICON_FOLDER_FILE_OPEN = 1
|
ICON_FOLDER_FILE_OPEN = 1
|
||||||
ICON_FILE_SAVE_CLASSIC = 2
|
ICON_FILE_SAVE_CLASSIC = 2
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION:
|
||||||
*
|
*
|
||||||
* Physac is a small 2D physics engine written in pure C. The engine uses a fixed time-step thread loop
|
* Physac is a small 2D physics library written in pure C. The engine uses a fixed time-step thread loop
|
||||||
* to simulate physics. A physics step contains the following phases: get collision information,
|
* to simluate physics. A physics step contains the following phases: get collision information,
|
||||||
* apply dynamics, collision solving and position correction. It uses a very simple struct for physic
|
* apply dynamics, collision solving and position correction. It uses a very simple struct for physic
|
||||||
* bodies with a position vector to be used in any 3D rendering API.
|
* bodies with a position vector to be used in any 3D rendering API.
|
||||||
*
|
*
|
||||||
|
@ -16,41 +16,49 @@
|
||||||
* If not defined, the library is in header only mode and can be included in other headers
|
* If not defined, the library is in header only mode and can be included in other headers
|
||||||
* or source files without problems. But only ONE file should hold the implementation.
|
* or source files without problems. But only ONE file should hold the implementation.
|
||||||
*
|
*
|
||||||
* #define PHYSAC_DEBUG
|
* #define PHYSAC_STATIC (defined by default)
|
||||||
* Show debug traces log messages about physic bodies creation/destruction, physic system errors,
|
* The generated implementation will stay private inside implementation file and all
|
||||||
* some calculations results and NULL reference exceptions.
|
* internal symbols and functions will only be visible inside that file.
|
||||||
*
|
*
|
||||||
* #define PHYSAC_AVOID_TIMMING_SYSTEM
|
* #define PHYSAC_NO_THREADS
|
||||||
* Disables internal timming system, used by UpdatePhysics() to launch timmed physic steps,
|
* The generated implementation won't include pthread library and user must create a secondary thread to call PhysicsThread().
|
||||||
* it allows just running UpdatePhysics() automatically on a separate thread at a desired time step.
|
* It is so important that the thread where PhysicsThread() is called must not have v-sync or any other CPU limitation.
|
||||||
* In case physics steps update needs to be controlled by user with a custom timming mechanism,
|
*
|
||||||
* just define this flag and the internal timming mechanism will be avoided, in that case,
|
* #define PHYSAC_STANDALONE
|
||||||
* timming libraries are neither required by the module.
|
* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined
|
||||||
|
* internally in the library and input management and drawing functions must be provided by
|
||||||
|
* the user (check library implementation for further details).
|
||||||
|
*
|
||||||
|
* #define PHYSAC_DEBUG
|
||||||
|
* Traces log messages when creating and destroying physics bodies and detects errors in physics
|
||||||
|
* calculations and reference exceptions; it is useful for debug purposes
|
||||||
*
|
*
|
||||||
* #define PHYSAC_MALLOC()
|
* #define PHYSAC_MALLOC()
|
||||||
* #define PHYSAC_CALLOC()
|
|
||||||
* #define PHYSAC_FREE()
|
* #define PHYSAC_FREE()
|
||||||
* You can define your own malloc/free implementation replacing stdlib.h malloc()/free() functions.
|
* You can define your own malloc/free implementation replacing stdlib.h malloc()/free() functions.
|
||||||
* Otherwise it will include stdlib.h and use the C standard library malloc()/free() function.
|
* Otherwise it will include stdlib.h and use the C standard library malloc()/free() function.
|
||||||
*
|
*
|
||||||
* COMPILATION:
|
|
||||||
*
|
*
|
||||||
* Use the following code to compile with GCC:
|
* NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
|
||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static -lraylib -lopengl32 -lgdi32 -lwinmm -std=c99
|
* NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread)
|
||||||
*
|
*
|
||||||
* VERSIONS HISTORY:
|
* Use the following code to compile:
|
||||||
* 1.1 (20-Jan-2021) @raysan5: Library general revision
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static -lraylib -lpthread -lopengl32 -lgdi32 -lwinmm -std=c99
|
||||||
* Removed threading system (up to the user)
|
*
|
||||||
* Support MSVC C++ compilation using CLITERAL()
|
* VERY THANKS TO:
|
||||||
* Review DEBUG mechanism for TRACELOG() and all TRACELOG() messages
|
* - raysan5: helped with library design
|
||||||
* Review internal variables/functions naming for consistency
|
* - ficoos: added support for Linux
|
||||||
* Allow option to avoid internal timming system, to allow app manage the steps
|
* - R8D8: added support for Linux
|
||||||
* 1.0 (12-Jun-2017) First release of the library
|
* - jubalh: fixed implementation of time calculations
|
||||||
|
* - a3f: fixed implementation of time calculations
|
||||||
|
* - define-private-public: added support for OSX
|
||||||
|
* - pamarcos: fixed implementation of physics steps
|
||||||
|
* - noshbar: fixed some memory leaks
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* LICENSE: zlib/libpng
|
* LICENSE: zlib/libpng
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2022 Victor Fisac (@victorfisac) and Ramon Santamaria (@raysan5)
|
* Copyright (c) 2016-2025 Victor Fisac (github: @victorfisac)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
* will the authors be held liable for any damages arising from the use of this software.
|
* will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
@ -68,39 +76,41 @@
|
||||||
* 3. This notice may not be removed or altered from any source distribution.
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
*
|
*
|
||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
// Function specifiers in case library is build/used as a shared library (Windows)
|
// #define PHYSAC_STATIC
|
||||||
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
|
// #define PHYSAC_NO_THREADS
|
||||||
// Allow custom memory allocators
|
// #define PHYSAC_STANDALONE
|
||||||
|
// #define PHYSAC_DEBUG
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Defines and Macros
|
// Defines and Macros
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Data Types Structure Definition
|
// Types and Structures Definition
|
||||||
|
// NOTE: Below types are required for PHYSAC_STANDALONE usage
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
typedef enum PhysicsShapeType { PHYSICS_CIRCLE = 0, PHYSICS_POLYGON } PhysicsShapeType;
|
typedef enum PhysicsShapeType { PHYSICS_CIRCLE, PHYSICS_POLYGON } PhysicsShapeType;
|
||||||
// Previously defined to be used in PhysicsShape struct as circular dependencies
|
// Previously defined to be used in PhysicsShape struct as circular dependencies
|
||||||
typedef struct PhysicsBodyData *PhysicsBody;
|
typedef struct PhysicsBodyData *PhysicsBody;
|
||||||
// Matrix2x2 type (used for polygon shape rotation matrix)
|
// Mat2 type (used for polygon shape rotation matrix)
|
||||||
typedef struct Matrix2x2 {
|
typedef struct Mat2 {
|
||||||
float m00;
|
float m00;
|
||||||
float m01;
|
float m01;
|
||||||
float m10;
|
float m10;
|
||||||
float m11;
|
float m11;
|
||||||
} Matrix2x2;
|
} Mat2;
|
||||||
typedef struct PhysicsVertexData {
|
typedef struct PolygonData {
|
||||||
unsigned int vertexCount; // Vertex count (positions and normals)
|
unsigned int vertexCount; // Current used vertex and normals count
|
||||||
Vector2 positions[24 /* Maximum number of vertex for polygons shapes*/]; // Vertex positions vectors
|
Vector2 positions[24]; // Polygon vertex positions vectors
|
||||||
Vector2 normals[24 /* Maximum number of vertex for polygons shapes*/]; // Vertex normals vectors
|
Vector2 normals[24]; // Polygon vertex normals vectors
|
||||||
} PhysicsVertexData;
|
} PolygonData;
|
||||||
typedef struct PhysicsShape {
|
typedef struct PhysicsShape {
|
||||||
PhysicsShapeType type; // Shape type (circle or polygon)
|
PhysicsShapeType type; // Physics shape type (circle or polygon)
|
||||||
PhysicsBody body; // Shape physics body data pointer
|
PhysicsBody body; // Shape physics body reference
|
||||||
PhysicsVertexData vertexData; // Shape vertices data (used for polygon shapes)
|
float radius; // Circle shape radius (used for circle shapes)
|
||||||
float radius; // Shape radius (used for circle shapes)
|
Mat2 transform; // Vertices transform matrix 2x2
|
||||||
Matrix2x2 transform; // Vertices transform matrix 2x2
|
PolygonData vertexData; // Polygon shape vertices position and normals data (just used for polygon shapes)
|
||||||
} PhysicsShape;
|
} PhysicsShape;
|
||||||
typedef struct PhysicsBodyData {
|
typedef struct PhysicsBodyData {
|
||||||
unsigned int id; // Unique identifier
|
unsigned int id; // Reference unique identifier
|
||||||
bool enabled; // Enabled dynamics state (collisions are calculated anyway)
|
bool enabled; // Enabled dynamics state (collisions are calculated anyway)
|
||||||
Vector2 position; // Physics body shape pivot
|
Vector2 position; // Physics body shape pivot
|
||||||
Vector2 velocity; // Current linear velocity applied to position
|
Vector2 velocity; // Current linear velocity applied to position
|
||||||
|
@ -118,10 +128,10 @@ typedef struct PhysicsBodyData {
|
||||||
bool useGravity; // Apply gravity force to dynamics
|
bool useGravity; // Apply gravity force to dynamics
|
||||||
bool isGrounded; // Physics grounded on other body state
|
bool isGrounded; // Physics grounded on other body state
|
||||||
bool freezeOrient; // Physics rotation constraint
|
bool freezeOrient; // Physics rotation constraint
|
||||||
PhysicsShape shape; // Physics body shape information (type, radius, vertices, transform)
|
PhysicsShape shape; // Physics body shape information (type, radius, vertices, normals)
|
||||||
} PhysicsBodyData;
|
} PhysicsBodyData;
|
||||||
typedef struct PhysicsManifoldData {
|
typedef struct PhysicsManifoldData {
|
||||||
unsigned int id; // Unique identifier
|
unsigned int id; // Reference unique identifier
|
||||||
PhysicsBody bodyA; // Manifold first physics body reference
|
PhysicsBody bodyA; // Manifold first physics body reference
|
||||||
PhysicsBody bodyB; // Manifold second physics body reference
|
PhysicsBody bodyB; // Manifold second physics body reference
|
||||||
float penetration; // Depth of penetration from collision
|
float penetration; // Depth of penetration from collision
|
||||||
|
@ -135,29 +145,25 @@ typedef struct PhysicsManifoldData {
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Physics system management
|
extern /* Functions visible from other files*/ void InitPhysics(void); // Initializes physics values, pointers and creates physics loop thread
|
||||||
void InitPhysics(void); // Initializes physics system
|
extern /* Functions visible from other files*/ void RunPhysicsStep(void); // Run physics step, to be used if PHYSICS_NO_THREADS is set in your main loop
|
||||||
void UpdatePhysics(void); // Update physics system
|
extern /* Functions visible from other files*/ void SetPhysicsTimeStep(double delta); // Sets physics fixed time step in milliseconds. 1.666666 by default
|
||||||
void ResetPhysics(void); // Reset physics system (global variables)
|
extern /* Functions visible from other files*/ bool IsPhysicsEnabled(void); // Returns true if physics thread is currently enabled
|
||||||
void ClosePhysics(void); // Close physics system and unload used memory
|
extern /* Functions visible from other files*/ void SetPhysicsGravity(float x, float y); // Sets physics global gravity force
|
||||||
void SetPhysicsTimeStep(double delta); // Sets physics fixed time step in milliseconds. 1.666666 by default
|
extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyCircle(Vector2 pos, float radius, float density); // Creates a new circle physics body with generic parameters
|
||||||
void SetPhysicsGravity(float x, float y); // Sets physics global gravity force
|
extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density); // Creates a new rectangle physics body with generic parameters
|
||||||
// Physic body creation/destroy
|
extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density); // Creates a new polygon physics body with generic parameters
|
||||||
PhysicsBody CreatePhysicsBodyCircle(Vector2 pos, float radius, float density); // Creates a new circle physics body with generic parameters
|
extern /* Functions visible from other files*/ void PhysicsAddForce(PhysicsBody body, Vector2 force); // Adds a force to a physics body
|
||||||
PhysicsBody CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density); // Creates a new rectangle physics body with generic parameters
|
extern /* Functions visible from other files*/ void PhysicsAddTorque(PhysicsBody body, float amount); // Adds an angular force to a physics body
|
||||||
PhysicsBody CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density); // Creates a new polygon physics body with generic parameters
|
extern /* Functions visible from other files*/ void PhysicsShatter(PhysicsBody body, Vector2 position, float force); // Shatters a polygon shape physics body to little physics bodies with explosion force
|
||||||
void DestroyPhysicsBody(PhysicsBody body); // Destroy a physics body
|
extern /* Functions visible from other files*/ int GetPhysicsBodiesCount(void); // Returns the current amount of created physics bodies
|
||||||
// Physic body forces
|
extern /* Functions visible from other files*/ PhysicsBody GetPhysicsBody(int index); // Returns a physics body of the bodies pool at a specific index
|
||||||
void PhysicsAddForce(PhysicsBody body, Vector2 force); // Adds a force to a physics body
|
extern /* Functions visible from other files*/ int GetPhysicsShapeType(int index); // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
|
||||||
void PhysicsAddTorque(PhysicsBody body, float amount); // Adds an angular force to a physics body
|
extern /* Functions visible from other files*/ int GetPhysicsShapeVerticesCount(int index); // Returns the amount of vertices of a physics body shape
|
||||||
void PhysicsShatter(PhysicsBody body, Vector2 position, float force); // Shatters a polygon shape physics body to little physics bodies with explosion force
|
extern /* Functions visible from other files*/ Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex); // Returns transformed position of a body shape (body position + vertex transformed position)
|
||||||
void SetPhysicsBodyRotation(PhysicsBody body, float radians); // Sets physics body shape transform based on radians parameter
|
extern /* Functions visible from other files*/ void SetPhysicsBodyRotation(PhysicsBody body, float radians); // Sets physics body shape transform based on radians parameter
|
||||||
// Query physics info
|
extern /* Functions visible from other files*/ void DestroyPhysicsBody(PhysicsBody body); // Unitializes and destroy a physics body
|
||||||
PhysicsBody GetPhysicsBody(int index); // Returns a physics body of the bodies pool at a specific index
|
extern /* Functions visible from other files*/ void ClosePhysics(void); // Unitializes physics pointers and closes physics loop thread
|
||||||
int GetPhysicsBodiesCount(void); // Returns the current amount of created physics bodies
|
|
||||||
int GetPhysicsShapeType(int index); // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
|
|
||||||
int GetPhysicsShapeVerticesCount(int index); // Returns the amount of vertices of a physics body shape
|
|
||||||
Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex); // Returns transformed position of a body shape (body position + vertex transformed position)
|
|
||||||
/***********************************************************************************
|
/***********************************************************************************
|
||||||
*
|
*
|
||||||
* PHYSAC IMPLEMENTATION
|
* PHYSAC IMPLEMENTATION
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API
|
* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION:
|
||||||
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0, ES 3.0)
|
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
|
||||||
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
||||||
*
|
*
|
||||||
* ADDITIONAL NOTES:
|
* ADDITIONAL NOTES:
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -23,9 +23,9 @@ class BinaryDistribution(Distribution):
|
||||||
def has_ext_modules(foo):
|
def has_ext_modules(foo):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# should be name="raylib"+NAME but then Git doesn't track dependants
|
# should be name="raylib"+NAME but then Github doesn't track dependants
|
||||||
setup(
|
setup(
|
||||||
name="raylib"+NAME,
|
name="raylib",
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
description="Python CFFI bindings for Raylib",
|
description="Python CFFI bindings for Raylib",
|
||||||
long_description=README,
|
long_description=README,
|
||||||
|
|
30
shell.nix
Normal file
30
shell.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs> { },
|
||||||
|
}: pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
python3
|
||||||
|
cmake
|
||||||
|
clang-tools
|
||||||
|
pkg-config
|
||||||
|
wayland-scanner
|
||||||
|
wayland
|
||||||
|
libGL
|
||||||
|
libgbm
|
||||||
|
libdrm
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXrandr
|
||||||
|
xorg.libXinerama
|
||||||
|
xorg.libX11
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.xorg.libX11 pkgs.libGL ]}:$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
if [ ! -d ".venv" ]; then
|
||||||
|
python3 -m venv .venv
|
||||||
|
fi
|
||||||
|
|
||||||
|
source .venv/bin/activate
|
||||||
|
'';
|
||||||
|
}
|
|
@ -7,6 +7,8 @@ import pyray as pr
|
||||||
pr.init_window(800, 450, "Raylib texture test")
|
pr.init_window(800, 450, "Raylib texture test")
|
||||||
pr.set_target_fps(60)
|
pr.set_target_fps(60)
|
||||||
|
|
||||||
|
test_typedef_init = pr.Texture2D() # Texture2D is typedef for Texture
|
||||||
|
|
||||||
image = pr.gen_image_color(800, 400, (0,0,0,255) )
|
image = pr.gen_image_color(800, 400, (0,0,0,255) )
|
||||||
texture = pr.load_texture_from_image(image)
|
texture = pr.load_texture_from_image(image)
|
||||||
pr.update_texture(texture, image.data)
|
pr.update_texture(texture, image.data)
|
||||||
|
|
Reference in a new issue