Compare commits

...

403 commits

Author SHA1 Message Date
249b5b7c35
chore: Switch git submodule path
Some checks failed
Build / build-linux (3.13, SDL) (push) Has been cancelled
Build / build-linux (3.9, DRM) (push) Has been cancelled
Build / build-linux (3.9, Desktop) (push) Has been cancelled
Build / build-linux (3.9, SDL) (push) Has been cancelled
Build / build-linux (pypy-3.10, DRM) (push) Has been cancelled
Build / build-linux (pypy-3.10, Desktop) (push) Has been cancelled
Build / build-linux (pypy-3.10, SDL) (push) Has been cancelled
Build / build-linux (pypy-3.11, DRM) (push) Has been cancelled
Build / build-linux (pypy-3.11, Desktop) (push) Has been cancelled
Build / build-linux (pypy-3.11, SDL) (push) Has been cancelled
Build / build-linux (pypy-3.9, DRM) (push) Has been cancelled
Build / build-linux (pypy-3.9, Desktop) (push) Has been cancelled
Build / build-linux (pypy-3.9, SDL) (push) Has been cancelled
Build / build-windows (3.10, Desktop) (push) Has been cancelled
Build / build-windows (3.10, SDL) (push) Has been cancelled
Build / build-windows (3.11, Desktop) (push) Has been cancelled
Build / build-windows (3.11, SDL) (push) Has been cancelled
Build / build-windows (3.12, Desktop) (push) Has been cancelled
Build / build-windows (3.12, SDL) (push) Has been cancelled
Build / build-windows (3.13, Desktop) (push) Has been cancelled
Build / build-windows (3.13, SDL) (push) Has been cancelled
Build / build-windows (3.9, Desktop) (push) Has been cancelled
Build / build-windows (3.9, SDL) (push) Has been cancelled
Build / build-windows (pypy-3.10, Desktop) (push) Has been cancelled
Build / build-windows (pypy-3.10, SDL) (push) Has been cancelled
Build / build-windows (pypy-3.11, Desktop) (push) Has been cancelled
Build / build-windows (pypy-3.11, SDL) (push) Has been cancelled
Build / build-windows (pypy-3.9, Desktop) (push) Has been cancelled
Build / build-windows (pypy-3.9, SDL) (push) Has been cancelled
Build / merge (push) Has been cancelled
2025-06-08 11:39:27 -04:00
1e195e4ac9
fix: Fix DRM leasing support
Some checks failed
Build / build-windows (pypy-3.10, Desktop) (push) Waiting to run
Build / build-windows (pypy-3.10, SDL) (push) Waiting to run
Build / build-windows (pypy-3.11, Desktop) (push) Waiting to run
Build / build-windows (pypy-3.11, SDL) (push) Waiting to run
Build / build-windows (pypy-3.9, Desktop) (push) Waiting to run
Build / build-windows (pypy-3.9, SDL) (push) Waiting to run
Build / source-distro (push) Waiting to run
Build / dynamic-distro (push) Waiting to run
Build / merge (push) Blocked by required conditions
Build / build-mac-intel (3.10, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.10, SDL) (push) Has been cancelled
Build / build-mac-intel (3.11, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.11, SDL) (push) Has been cancelled
Build / build-mac-intel (3.12, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.12, SDL) (push) Has been cancelled
Build / build-mac-intel (3.13, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.13, SDL) (push) Has been cancelled
Build / build-mac-intel (3.9, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.9, SDL) (push) Has been cancelled
Build / build-mac-intel (pypy-3.10, Desktop) (push) Has been cancelled
Build / build-mac-intel (pypy-3.10, SDL) (push) Has been cancelled
Build / build-mac-intel (pypy-3.11, Desktop) (push) Has been cancelled
Build / build-mac-intel (pypy-3.11, SDL) (push) Has been cancelled
Build / build-mac-intel (pypy-3.9, Desktop) (push) Has been cancelled
Build / build-mac-intel (pypy-3.9, SDL) (push) Has been cancelled
Build / build-linux (3.10, DRM) (push) Has been cancelled
Build / build-linux (3.10, Desktop) (push) Has been cancelled
Build / build-linux (3.10, SDL) (push) Has been cancelled
Build / build-linux (3.11, DRM) (push) Has been cancelled
Build / build-linux (3.11, Desktop) (push) Has been cancelled
2025-06-08 08:31:27 -04:00
51e50d4cb9
chore: Switch out submodules and add a nix shell
Some checks failed
Build / build-windows (pypy-3.10, Desktop) (push) Waiting to run
Build / build-windows (pypy-3.10, SDL) (push) Waiting to run
Build / build-windows (pypy-3.11, Desktop) (push) Waiting to run
Build / build-windows (pypy-3.11, SDL) (push) Waiting to run
Build / build-windows (pypy-3.9, Desktop) (push) Waiting to run
Build / build-windows (pypy-3.9, SDL) (push) Waiting to run
Build / source-distro (push) Waiting to run
Build / dynamic-distro (push) Waiting to run
Build / build-mac-intel (3.10, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.10, SDL) (push) Has been cancelled
Build / build-mac-intel (3.11, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.11, SDL) (push) Has been cancelled
Build / build-mac-intel (3.12, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.12, SDL) (push) Has been cancelled
Build / build-mac-intel (3.13, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.13, SDL) (push) Has been cancelled
Build / build-mac-intel (3.9, Desktop) (push) Has been cancelled
Build / build-mac-intel (3.9, SDL) (push) Has been cancelled
Build / build-mac-intel (pypy-3.10, Desktop) (push) Has been cancelled
Build / build-mac-intel (pypy-3.10, SDL) (push) Has been cancelled
Build / build-mac-intel (pypy-3.11, Desktop) (push) Has been cancelled
Build / build-mac-intel (pypy-3.11, SDL) (push) Has been cancelled
Build / build-mac-intel (pypy-3.9, Desktop) (push) Has been cancelled
Build / build-mac-intel (pypy-3.9, SDL) (push) Has been cancelled
Build / build-linux (3.10, DRM) (push) Has been cancelled
Build / build-linux (3.10, Desktop) (push) Has been cancelled
Build / build-linux (3.10, SDL) (push) Has been cancelled
Build / build-linux (3.11, DRM) (push) Has been cancelled
Build / build-linux (3.11, Desktop) (push) Has been cancelled
Build / build-linux (3.11, SDL) (push) Has been cancelled
2025-06-07 20:19:23 -04:00
Richard Smith
8e85d28ca8 add audio examples 2025-06-04 17:00:08 +01:00
Cameron Clough
8d5d810925
Switch to logging in __init__.py, set load message to debug (#171)
* Switch to logging in `__init__.py`, set load message to debug

- Replace print statements with logger.error() and logger.warning() calls.
- Follow best practices by using a module-specific logger via
  getLogger(__name__).
- Use parameterized log messages to avoid unnecessary string formatting.
- Change the "RAYLIB STATIC x.x.x LOADED" message from direct stderr
  output to logger warning level.

Motivation:
In [commaai/openpilot#35076][openpilot-issue], we experienced noisy test
outputs because the RAYLIB STATIC message is printed unnecessarily,
cluttering stderr. This change allows library consumers to control the
visibility of this message.

[openpilot-issue]: https://github.com/commaai/openpilot/issues/35076

* use warning rather than debug logging

---------

Co-authored-by: Richard Smith <github@electronstudio.co.uk>
2025-06-04 15:55:41 +01:00
Richard Smith
c58d89fd86 add example 2025-05-27 19:57:35 +01:00
Richard Smith
f551fca1f3 hack stub files because enum from Physac isn't recognised by raylib header parser 2025-05-27 19:54:53 +01:00
Richard Smith
11c5b1a728 use typedefs when constructing structs 2025-05-27 14:53:20 +01:00
Baptiste Lepilleur
d3fcb40408
* fix hard-coded path in Windows build. (#174) 2025-05-21 12:30:20 +01:00
Richard Smith
d8e4385990 try to fix cirrus build by using system pip 2025-05-03 20:38:31 +01:00
Richard Smith
7971275111 try to fix windows build by disabling threads in Physac 2025-05-03 19:53:01 +01:00
Max Golubev
2df1ac470b
Update physac example (#168) 2025-05-03 19:41:59 +01:00
Richard Smith
67e6bf2405 add @victorfisac version of Physac 2025-05-03 19:40:15 +01:00
Richard Smith
5575f6b7b0 remove raylib Physac repo 2025-05-03 19:33:23 +01:00
Richard Smith
171177618b deprecate Physac, see #165 2025-05-03 19:03:36 +01:00
Richard Smith
5593f2e392 add docstrings for structs and enums, fixes issue #159 2025-05-03 18:06:27 +01:00
Richard Smith
002e4ca4d9 update github actions to oldest supported ubuntu version 2025-05-03 17:12:42 +01:00
Richard Smith
56d06bdf32
github dependents 2025-04-07 11:02:38 +01:00
Richard Smith
22af40317d stupid github forcing changes 2025-02-12 03:57:40 +00:00
Richard Smith
8a45dfad6d pypy 3.11 build 2025-02-12 02:43:56 +00:00
Richard Smith
32061daadb update docs 2025-02-12 02:43:35 +00:00
Richard Smith
4bdd922417
Update setup.py for stupid github depedancy tracking 2025-01-28 18:18:36 +00:00
Richard Smith
bf1622c5c2 add example by @Lightnet 2025-01-12 13:59:32 +00:00
Richard Smith
d6ba624c6e fix missing mac builds 2025-01-04 20:09:34 +00:00
Richard Smith
2c79346ae2
try macos 13 build since 12 deprecated 2024-12-09 17:23:25 +00:00
Richard Smith
94958bbdc2
make github track dependents 2024-12-09 17:11:45 +00:00
Richard Smith
89d56a730f increase version 2024-11-24 13:24:47 +00:00
Richard Smith
6483b53cf3 fix dynamic raylib header being different from static header by making it a link 2024-11-24 13:18:36 +00:00
Richard Smith
8af441f49f please github track our dependants again 2024-11-24 12:38:14 +00:00
Richard Smith
ef15347c17 increase version 2024-11-23 10:45:40 +00:00
Richard Smith
3c5dcca431 try to fool github into tracking our dependents again 2024-11-21 11:44:43 +00:00
Richard Smith
f9ccd9b58e update bundled dynamic libs to 5.5 2024-11-19 15:43:06 +00:00
Richard Smith
a826414a74 update docs 2024-11-19 15:35:54 +00:00
Richard Smith
bf6d5d421c
fix how regex inserts underscore in function names with '2d' and '3d' (#149) 2024-11-19 12:24:58 +00:00
Richard Smith
9e5c9b7f9f
Sdl backend (#140)
* latest raylib version

* add libwayland-dev

* update headers

* add libxkbcommon-dev

* sdl

* sdl dl

* sdl dl

* sdl2 link flags

* remove glfw header

* try static sdl build

* try to set fpic

* install alsa etc before building sdl

* windows

* fix

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try mac

* try mac

* try mac

* try mac

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* update raylib

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* try

* update to 5.5

* dont link x11 if using DRM

* update to fixed raylib version
2024-11-19 12:05:28 +00:00
Richard Smith
d28fa38e9f fix missing defines 2024-11-17 03:32:02 +00:00
Richard Smith
697029fc6a include py.typed in MANIFEST rather than setup 2024-11-17 01:24:57 +00:00
Martin Kuntz Jacobsen
623b9c12cc
Adds py.typed for typing support according to pep 561 (#135) 2024-11-17 01:19:19 +00:00
Richard Smith
ada4b1ca63 update docs and stubs 2024-11-17 01:17:05 +00:00
Richard Smith
e6f2c188db generate type stubs which are sufficiently self-consistent to run mypy on all the examples 2024-11-17 01:17:05 +00:00
Richard Smith
a33f4fcc9a update examples 2024-11-17 01:17:05 +00:00
Richard Smith
4071263a59 add shaders_write_depth example 2024-10-07 18:06:39 +01:00
Richard Smith
fde8354a8a Example OO wrapper around the Vector2 struct, by @Emtyloc 2024-10-07 17:25:53 +01:00
Richard Smith
c9a5ec09e3 give useful error when native DLL isnt found 2024-10-01 00:48:58 +01:00
Richard Smith
15ea1dc79b add the modified header files to the source distro to make building on windows easier 2024-09-20 16:27:11 +01:00
Richard Smith
035830b567 update github actions/upload-artifact since old version no longer works 2024-09-20 15:27:15 +01:00
Richard Smith
d6dc9e7d5c fix pip failing to do binary build from source 2024-09-20 15:23:58 +01:00
Richard Smith
05955b5ef1 cffi 1.17.1 2024-09-05 10:00:34 +01:00
Richard Smith
df2bbccb1f update RPI instructions to build shared lib for DRM because we dont currently add required flags to for static lib to find EGL library 2024-08-03 13:20:30 +01:00
Richard Smith
252fc29c18 Disable use of Py_LIMITED_API. Py_LIMITED_API already didn't work reliably - we had to do builds for every Python version to ensure they would all work. So removing it shouldn't cause problems, and it may increase performance and may allow running on free-threading Python. 2024-07-10 00:48:10 +01:00
Richard Smith
7af2922eb3 update docs 2024-07-02 15:43:33 +01:00
Richard Smith
57da96d576 github macos 13 doesnt work either 2024-07-02 14:26:00 +01:00
Richard Smith
c80cc59166 cirrus doesnt support macos 13 any more, so try it on github 2024-07-02 14:19:14 +01:00
Richard Smith
d6d0b50e80 allow building without glfw headers 2024-07-02 13:54:18 +01:00
Richard Smith
43630d8b5a docs update 2024-07-02 09:58:07 +01:00
Richard Smith
812f0f7527 macos 11 runner doesnt work, upgrade to 12 2024-07-02 09:57:49 +01:00
Richard Smith
599c74af0b version bump 2024-07-01 14:31:58 +01:00
Richard Smith
147e9f882a fix some typehints for lists (not sure why wasnt updated when pyray/__init__.pyi was?) 2024-07-01 14:31:42 +01:00
Richard Smith
0ea3f1b3f6 pyray return more useful errors when types are wrong 2024-07-01 14:20:57 +01:00
Richard Smith
1799c58ca5 update examples 2024-07-01 14:18:55 +01:00
Richard Smith
ea29d96ff9 fix building low quality raylib code on linux gcc 2024-07-01 14:17:13 +01:00
Richard Smith
3260a18e7d
Typehints for colours (#131) 2024-07-01 11:11:35 +01:00
Richard Smith
edfd75af8d
Optimisation (#127) 2024-07-01 11:06:56 +01:00
Richard Smith
22884df99f RPI doc update 2024-06-10 17:28:47 +01:00
Richard Smith
bdc49267e2
update CI with python 3.13 and raspberry pi builds (#130) 2024-06-09 13:11:45 +01:00
Richard Smith
e08d9d4d1d
Update README.md 2024-05-10 17:55:50 +01:00
Richard Smith
46ef151cd7 update readme benchmarks 2024-04-24 15:28:19 +01:00
Richard Smith
9583498150 update readme 2024-04-05 17:22:27 +01:00
Richard Smith
724fa2594f update readme 2024-04-05 17:21:39 +01:00
Richard Smith
c67fffba48 remove macos 12 monterey build, cirrus doesnt seem to support anymore. 2024-04-05 15:34:15 +01:00
Richard Smith
1232b700a5 fix clang 16 on mac building 2024-04-05 14:47:10 +01:00
Richard Smith
43e0492e7d version 5.0.0.2 2024-04-05 14:23:14 +01:00
Richard Smith
c954a4ff1b update docs 2024-04-05 12:49:27 +01:00
Richard Smith
0a677fe31d fix float pointer test 2024-04-05 12:47:38 +01:00
Richard Smith
15469b03ae fix list of string types in .pyi 2024-04-05 12:46:54 +01:00
Richard Smith
2875e28322 remove dependency on inflection per @sDos280 suggestion to speed up pygbag WASM loading, https://github.com/electronstudio/raylib-python-cffi/issues/58 2024-03-03 12:48:29 +00:00
Richard Smith
3744686f7b
throw helpful errors when params supplied are not ctype pointers (#122) 2024-03-03 11:48:09 +00:00
Richard Smith
33dce4ecfd
Improve struct creation helper methods by auto converting arguments: (#119)
* None to ffi.NULL
 * array and ndarray to buffer, and keep weakref so it doesn't get GCed

This makes it possible to create Mesh structs without too much faffing.
2024-03-03 11:45:09 +00:00
Richard Smith
ef3681fc5b update readme 2024-02-21 12:58:01 +00:00
Richard Smith
70b8d7c143 tidy examples 2024-02-21 12:21:32 +00:00
Richard Smith
eb68dec2ad update core examples 2024-02-21 11:23:55 +00:00
Richard Smith
83b810b1eb version bump 2024-01-22 15:16:49 +00:00
Ashley Sommer
87e534e142
RLGL standalone example (using new defines.py and GLFW) (#113)
* Bump raylib to 5.0, Bump RayGUI to 4.0
Generate bindings for raylib's embedded GLFW, to enable lower-level examples (see examples/others/rlgl_standalone.py)
Dynamically generate defines at library build-time, they are known by the raylib parser.
Bug fix, allow raylib parser to see RayGUI, Physac, and RayMath exported functions, get proper argument names from functions, provide real argument names on interface definitions.

* Fix finding glfw3.h include file on Windows build

* Fix building for macos on cirrus CI.

* Update version.py

* Update create_enums.py

* Update build.py

* Update make_docs.sh

---------

Co-authored-by: Richard Smith <electronstudio@users.noreply.github.com>
Co-authored-by: Richard Smith <github@electronstudio.co.uk>
2024-01-22 15:12:04 +00:00
Richard Smith
a49439135e automatically export defines, by @ashleysommer 2024-01-22 15:05:29 +00:00
Richard Smith
be45bef9f1 add support for GLFW3 2024-01-22 14:48:31 +00:00
Richard Smith
d9acf89784 improve stub generator by @ashleysommer 2023-12-22 04:46:46 +00:00
Richard Smith
594fe4d41a update rpi instructions 2023-12-22 03:54:55 +00:00
Richard Smith
e7f522c6e4 fix jpg support issue #89 2023-12-22 03:10:41 +00:00
Richard Smith
599e5254c6 add audio example from @ashleysommer 2023-12-21 08:51:08 +00:00
Richard Smith
15a4ee2beb
Merge pull request #114 from ashleysommer/v_5_0
Bump Raylib to v5.0.0, RayGUI 4.0, rebuild Docs
2023-12-21 08:23:36 +00:00
Richard Smith
ac9a681670 update dynamic libs to 5.0 2023-12-21 07:34:46 +00:00
Richard Smith
0cd3515b74 restore missing pyi files 2023-12-21 07:11:31 +00:00
Richard Smith
3a97288732 rebuild of docs 2023-12-21 07:11:03 +00:00
Richard Smith
07fa448117 improve the make_docs.sh script 2023-12-21 07:09:40 +00:00
Ashley Sommer
9b48e57bb1 Bump Raylib to v5.0.0, RayGUI 4.0 is designed to be used with RayLib 5, so bump RayGUI too to 4.0.
Updated some core examples to match the changes in Raylib-c v5.0.0
2023-12-19 10:49:31 +10:00
Richard Smith
3b01e59338 add python 3.12 and pypy 3.10 to builds 2023-10-27 04:40:04 +01:00
Tim Fong 2
ef20eaf7c9 added models waving cubes example 2023-08-11 23:41:31 +07:00
Timothy Fong
6c9e42301d
Merge pull request #110 from Timfon/master
Added core_window_flags example
2023-08-11 23:28:53 +07:00
Tim Fong 2
9df3448f1c added core_window_flags 2023-08-09 19:16:32 +07:00
Timothy Fong
f8c7039948
Merge branch 'electronstudio:master' into master 2023-07-30 04:56:02 -04:00
Timothy Fong
4893cfb905
added core 3d camera free (#108)
* added core_split_screen example

* added core_vr_simulator example

* Delete launch.json

* added core 3d camera free

* added core_smooth pixel-perfect camera

---------

Co-authored-by: “Timfon” <“timothy_fong@brown.edu”>
Co-authored-by: Richard Smith <electronstudio@users.noreply.github.com>
2023-07-26 20:17:30 +01:00
“Timfon”
ad37407929 added core example smooth pixel perfect camera 2023-07-26 20:16:28 +01:00
“Timfon”
109c8c5f17 added core example smooth pixel perfect camera 2023-07-25 21:38:27 +07:00
Timothy Fong
866f47c72b
added the core_vr_simulator to examples (#107) 2023-07-10 00:48:55 +01:00
Timfon
903747b122
added core_split_screen example (#106)
Co-authored-by: “Timfon” <“timothy_fong@brown.edu”>
2023-07-07 17:06:51 +01:00
pranavganesh
b23957d2f0
Converting shapes_basic_shapes.c to python and adding it to examples (#104)
* Converting shapes_basic_shapes.c to python and adding it to examples

* Add shapes_bouncing_ball.py to examples in shapes

---------

Co-authored-by: pranavganesh <50474789+Pranv11Ganesh@users.noreply.github.com>
2023-07-07 17:06:11 +01:00
Richard Smith
f735bd54f2 use cirrus CI to do macos ARM64 builds 2023-05-23 14:46:00 +01:00
Richard Smith
877fe35414 update docs 2023-05-23 11:01:49 +01:00
Richard Smith
616fb2c1bc fix example in docs 2023-05-22 18:24:44 +01:00
Richard Smith
c7a53692a4 update github actions to macos-11 2023-05-22 18:02:02 +01:00
Richard Smith
02a5f4bc7a upgrade github actions 2023-05-22 17:59:17 +01:00
Richard Smith
2ee15fa7e5 add fields to static pyi stub 2023-05-22 17:58:58 +01:00
electronstudio
42d6762fbe update raylib to 4.5 2023-05-22 17:01:19 +01:00
Richard Smith
cbcb0719a6
Update RPI.rst 2023-05-17 07:40:17 +01:00
Dor Shapira
7bfd7d2ea6
added texures srcrec dstrec example (#93)
added scarfy.png file
made texures_srcrec_dstrec.py stand to the Python API conventions(https://github.com/sDos280/raylib-python-cffi/blob/Conventions/PYTHON_API_CONVENTIONS.md)
2022-10-25 23:48:50 +01:00
Richard Smith
2061585311 try removing the boolean/int replacement from windows build 2022-10-18 19:52:00 +01:00
richard
81590eb815 automate conversion of lists of strings https://github.com/electronstudio/raylib-python-cffi/discussions/98 2022-10-18 10:33:37 +01:00
richard
2c233d47fa reformat fix https://github.com/electronstudio/raylib-python-cffi/issues/90 2022-09-23 20:11:59 +01:00
richard
84c7eff4d7 fix PyCharm not finding Color types in .pyi files, fixes https://github.com/electronstudio/raylib-python-cffi/issues/88 2022-09-23 20:06:40 +01:00
Richard Smith
d4278968b5
Merge pull request #86 from sDos280/master
adding example and making examples look neater
2022-09-23 19:47:21 +01:00
richard
ef088e91f2 add test for jpg support https://github.com/electronstudio/raylib-python-cffi/issues/89 2022-09-23 19:44:37 +01:00
דור שפירא
8eb8a386fd fixing the issue in the image_loading.py Fixed #89 2022-09-23 16:46:07 +03:00
Dor Shapira
9f11c90e29
Update shapes_lines_bezier.py 2022-09-21 18:00:23 +03:00
Dor Shapira
c0b36508dc
Merge branch 'electronstudio:master' into master 2022-09-20 21:21:20 +03:00
דור שפירא
3836c7ed93 adding shapes lines bezier example 2022-09-20 21:19:30 +03:00
דור שפירא
91aa5ae4f9 making the shaders_basic_lighting.py and the shaders_fog.py file more python"y" style 2022-09-19 22:54:14 +03:00
Richard Smith
32f1d34c82
Merge pull request #82 from sDos280/master
adding following eyes example
2022-09-19 19:44:08 +01:00
Richard Smith
ac5ba94f87
Merge pull request #83 from romariops/examples/core_3d_camera_first_person
add example core 3d camera first person
2022-09-19 13:06:13 +01:00
romariops
36afd6057c add example core 3d camera first person 2022-09-18 20:41:10 -03:00
דור שפירא
1c889888fe fix typo 2022-09-16 13:23:54 +03:00
דור שפירא
54d8dd96bf adding shapes_following_eyes example 2022-09-16 13:23:30 +03:00
Richard Smith
9ad06e6f3f
Merge pull request #80 from romariops/Examples/core_3d_camera_mode
Adding the core 3d camera mode example
2022-09-12 01:38:15 +01:00
romariops
982089f272 Adding the core 3d camera mode example 2022-09-11 14:28:51 -03:00
Richard Smith
1910c11e5f
Merge pull request #79 from romariops/Examples/core_2d_camera_mouse_zoom 2022-09-11 14:00:33 +01:00
romariops
52adefe506 Examples/core_2d_camera_mouse_zoom 2022-09-10 19:54:50 -03:00
richard
6113328f8f remove macos arm64 builds 2022-08-24 20:10:38 +01:00
richard
baf12dd756 change macos 12 arm64 build to fat binary 2022-08-21 01:28:41 +01:00
richard
c850e70f5f forgot one limited-api 2022-08-21 01:01:10 +01:00
richard
f4612dc204 update raylib 2022-08-21 00:49:20 +01:00
richard
fd0b54302a update to second release of Raylib 4.2, i.e 4.2.1 2022-08-21 00:48:09 +01:00
richard
db77dc1210 py-limited-api was NOT working, most builds were broken. Why did no-one report this? 2022-08-21 00:44:01 +01:00
richard
3ac76b8aaa fix warning on linux builds and update docs 2022-08-11 22:10:15 +01:00
richard
3e011b329a update to raylib 4.2 2022-08-11 21:58:54 +01:00
Richard Smith
3a6deb2c04
Merge pull request #78 from archie2x/77-pkg-config-flags
#77 use all link flags from pkg-config
2022-08-11 21:25:32 +01:00
Roger Standridge
3a79196a95 #77 use all link flags from pkg-config 2022-08-06 00:33:09 +00:00
Richard Smith
1caab39fe5
Merge pull request #76 from sDos280/master
one more example added
2022-08-01 13:14:16 +01:00
sDos280
d7eb090c99
Merge branch 'electronstudio:master' into master 2022-07-31 15:49:41 +03:00
דור שפירא
ba61381d24 adding the textures_to_image example 2022-07-31 15:37:37 +03:00
Richard Smith
c437d62907
Merge pull request #75 from sDos280/master
adding more examples
2022-07-31 12:39:26 +01:00
דור שפירא
ad21fe7b8e adding the textures_mouse_painting example 2022-07-31 10:08:31 +03:00
דור שפירא
a278a38069 adding the core_window_should_close example 2022-07-30 23:02:10 +03:00
דור שפירא
603d4888a8 adding the core_scissor_test example 2022-07-30 22:44:49 +03:00
Richard Smith
a115b9bffd
Merge pull request #74 from sDos280/master
adding the shapes_logo_raylib example and adding the missing press checks in the core_input_mouse example
2022-07-30 11:46:17 +01:00
דור שפירא
bd3ba4bcab Merge remote-tracking branch 'origin/master' 2022-07-30 09:22:24 +03:00
דור שפירא
4941bc88ef adding the shapes_logo_raylib example and adding the missing press checks in the core_input_mouse example
I added the shapes_logo_raylib example.
I added the missing MOUSE_BUTTON_SIDE,MOUSE_BUTTON_EXTRA,MOUSE_BUTTON_FORWARD,MOUSE_BUTTON_BACK press checks.

note: my mouse doesn't have the "forward" and "back" buttons, so I couldn't test if they work
2022-07-30 09:22:06 +03:00
דור שפירא
dead4cfcb5 adding the shapes_logo_raylib example.
adding the missing press checks in the core_input_mouse example:
I added the missing MOUSE_BUTTON_SIDE,MOUSE_BUTTON_EXTRA,MOUSE_BUTTON_FORWARD,MOUSE_BUTTON_BACK press checks.

note: my mouse doesn't have the "forward" and "back" buttons, so I couldn't test if they work
2022-07-30 09:20:26 +03:00
Richard Smith
495b9c3d95
Merge pull request #70 from sDos280/master
adding core_random_values example
2022-07-28 11:07:58 +01:00
דור שפירא
50e74a7e26 adding core_random_values example 2022-07-28 12:57:59 +03:00
richard
6aaf3bb391 autoconvert None to ffi.NULL 2022-07-23 02:22:49 +01:00
richard
5badf348c7 improve rpi build 2022-07-10 12:21:38 +01:00
richard
76bcd04248 improve rpi build 2022-07-10 12:18:31 +01:00
richard
53ca2fb40c update docs 2022-06-30 09:52:27 +01:00
richard
6e37934266 try lowing min python version for macos wheels. try build for 10.14. 2022-06-29 03:07:38 +01:00
richard
b85552a606 try lowing min python version for macos wheels. try build for 10.14. 2022-06-29 03:01:52 +01:00
richard
0e0c9a00b8 try macos 11 arm64 build 2022-06-28 15:26:03 +01:00
richard
fceb9bb875 try macos 11 arm64 build 2022-06-28 15:17:42 +01:00
richard
192e322738 try macos 11 arm64 build 2022-06-28 15:12:47 +01:00
richard
0e4b3adc8e try macos 11 arm64 build 2022-06-28 15:05:37 +01:00
richard
ad986e9fdd try macos 11 arm64 build 2022-06-28 14:55:08 +01:00
richard
9348371545 dont build raylib examples 2022-06-27 04:15:09 +01:00
richard
8cd77f5d03 attempt arm64 mac build 2022-06-27 00:57:28 +01:00
richard
da874b5c37 attempt arm64 mac build 2022-06-27 00:34:39 +01:00
richard
51f02fd5a7 attempt arm64 mac build 2022-06-27 00:04:08 +01:00
richard
b29c3c57e9 attempt arm64 mac build 2022-06-27 00:02:22 +01:00
richard
abe165507f attempt arm64 mac build 2022-06-26 23:59:57 +01:00
richard
b817fe3ad6 build wheels compatible with multiple python versions by using limited binary api. 2022-06-26 07:06:06 +01:00
richard
79eabff719 try rpi build 2022-06-26 03:06:10 +01:00
richard
492544ede7 try rpi build 2022-06-26 03:04:05 +01:00
Richard Smith
79cc8bb544
Merge pull request #69 from TyroneSlothrop/master
Create shapes_draw_rounded_rectangle.py
2022-06-26 02:04:53 +01:00
Tyrone Slothrop
cc55fa7836 Create shapes_draw_rounded_rectangle.py
Port shapes_draw_rounded_reactangle example.
2022-06-25 16:22:39 +01:00
richard
c602d4891d rpi docs 2022-06-24 12:52:21 +01:00
richard
4d81687dcf rpi docs 2022-06-24 12:51:48 +01:00
richard
ab5d1a2703 latest raylib 2022-06-24 12:15:24 +01:00
richard
346e64d2f1 add atomic lib for linux/pi builds 2022-06-24 12:13:42 +01:00
richard
42c112d821 remove raylib extras folder 2022-06-23 17:33:12 +01:00
richard
f321d4fc89 version bump 2022-06-23 17:29:41 +01:00
richard
b4ed450872 version bump 2022-06-23 17:29:15 +01:00
richard
7394f79da5 add some legacy #defines 2022-06-23 17:18:22 +01:00
richard
3ffa4cc549 add raymath 2022-06-23 17:03:06 +01:00
richard
c876a41e11 fix windows build 2022-06-12 02:15:46 +01:00
richard
623c2a6c10 update to raylib 4.2-dev and re-add physac and raygui from their own repos. 2022-06-12 02:08:36 +01:00
richard
3e729eca0f drop files alt example 2022-06-02 19:57:21 +01:00
richard
0703645afb drop files example comments 2022-06-02 19:04:21 +01:00
richard
08cafd55df drop files example 2022-06-02 15:23:22 +01:00
Richard Smith
17f033cf29
Merge pull request #67 from GregChan/master
Add physics demo
2022-05-27 11:34:56 +01:00
GregChan
6ae0e73c9a Add physics demo 2022-05-26 02:51:32 -07:00
richard
7476e7b379 version bump 2022-05-20 07:06:09 +01:00
richard
10d983008f fix for pypy 2022-05-20 07:05:38 +01:00
richard
e624ad2824 version bump 2022-05-17 09:21:19 +01:00
richard
f6c25ff5c3 change min mac build from 10.14 to 10.15 2022-05-13 20:01:05 +01:00
richard
c5438d71a6 attempt fix for issue #63 2022-05-13 19:59:21 +01:00
richard
7ecb969baf update headers for windows build 2022-05-13 19:48:05 +01:00
richard
3f876e9bcf update raylib master 2022-05-13 19:40:56 +01:00
richard
7b4742dd6f update mac build on github actions 2022-05-13 19:38:03 +01:00
richard
106975b37b Merge remote-tracking branch 'origin/master' 2022-04-28 19:43:23 +01:00
richard
8c7af63076 update version 2022-04-28 19:43:08 +01:00
richard
4fed27cd6c update readme 2022-04-28 19:42:45 +01:00
Richard Smith
4cdb414602
Merge pull request #61 from pushingice/master
Add basic screen manager example
2022-04-05 10:52:27 +01:00
Chris Retford
7782dddc02 Add basic screen manager example 2022-04-03 16:06:51 -06:00
richard
f9e96bbd9d latest raylib snapshot 2022-03-10 00:15:12 +00:00
richard
4b000fecaa latest raylib snapshot 2022-03-10 00:10:24 +00:00
Richard Smith
ff40b0a35e
try some additional python versions in build 2022-03-06 22:02:29 +00:00
richard
f73c57c89c update raylib to 4.1-dev 2022-02-08 09:32:46 +00:00
richard
10d945ed28 add enums for raygui, issue #52 2022-02-07 13:58:07 +00:00
richard
2c752b5ad0 remove all the ints from the pyray hints and docs. (leave them in pyray itself for backwards compability) add proper enums to pyray and to pyray hints/docs (generated from raylib.json). TODO: raygui, rlgl, maybe something for the C API. See issue #52 2022-02-04 12:14:03 +00:00
richard
d05890344d update docs 2022-02-04 11:11:14 +00:00
richard
ef91af804b fixes to examples 2022-02-04 10:42:07 +00:00
richard
7ca36d1285 animation example from https://github.com/electronstudio/raylib-python-cffi/pull/53 https://github.com/Lcbx 2022-02-03 00:47:30 +00:00
richard
ed018b2b77 pyray: if function arg requires pointer and is given a pointer, don't try to create a pointer. if given a python primitive(float/int/bool), create an FFI float/int/bool and use pointer to it. https://github.com/electronstudio/raylib-python-cffi/issues/57 2022-02-02 20:32:12 +00:00
richard
7b889a2350 separate tests for dynamic 2022-02-02 20:29:45 +00:00
richard
82d310ea76 fix more examples https://github.com/electronstudio/raylib-python-cffi/issues/47 2022-02-02 20:28:08 +00:00
richard
218d9a18f7 test, review and fix the shader examples. https://github.com/electronstudio/raylib-python-cffi/issues/47 2022-02-02 18:21:34 +00:00
richard
ff84bdf2dd version bump 2022-01-13 23:43:23 +00:00
richard
2d78db0f32 Remove RPI native build because it doesn't work on current Raspbian. Use standard Linux X11 when on RPI. Issue #55 2022-01-13 23:38:15 +00:00
richard
4f907251fb opencv image example 2021-12-28 00:34:33 +00:00
richard
0803946f40 pyray raygui example 2021-11-16 17:18:51 +00:00
richard
c784857527 return empty string for null pointers https://github.com/electronstudio/raylib-python-cffi/issues/51 2021-11-12 00:34:43 +00:00
richard
183cdd52c6 new version number scheme 2021-11-09 15:18:02 +00:00
richard
f9d52edd50 attempt fix booleans on windows build 2021-11-09 15:10:27 +00:00
richard
1b8598fa55 automatically convert char* function return type to string https://github.com/electronstudio/raylib-python-cffi/issues/51 2021-11-06 17:59:47 +00:00
richard
e0201a29f8 update docs 2021-11-06 16:06:04 +00:00
richard
e8de1d3b60 fixes for dynamic 2021-11-06 15:54:02 +00:00
richard
ceae17fc40 forgot to update raygui for windows 2021-11-06 15:40:22 +00:00
richard
a44b33b561 update dynamic and raylib-c to 4.0.0 2021-11-06 15:30:08 +00:00
richard
3d675c66ae update to 4.0 2021-11-06 15:18:42 +00:00
Pavel Kulyov
77239a0e96
Fix dynamic raylib loading on Windows (#50) 2021-10-29 15:29:40 +01:00
richard
0e225958e2 fix missing pyi file 2021-10-28 15:14:02 +01:00
richard
f9584fdab4 update build instructions 2021-10-26 16:38:26 +01:00
richard
fb93d5f330 update raylib and docs 2021-10-26 15:54:10 +01:00
richard
dbddc940e8 version bump 2021-10-19 19:48:23 +01:00
richard
f51f746ee8 re-add other headers to windows build 2021-10-19 19:43:08 +01:00
richard
a4af57984e escape windows back slashes 2021-10-19 19:36:10 +01:00
richard
ea8c7cc685 lets try hardcoding include paths on windows 2021-10-19 19:31:36 +01:00
richard
2d6c706541 try to fix windows includes 2021-10-19 19:22:44 +01:00
richard
a1bb101045 Merge remote-tracking branch 'origin/master' 2021-10-19 19:14:22 +01:00
richard
144e69ad31 try to fix windows includes 2021-10-19 19:14:11 +01:00
electronstudio
485300e6b9 fix mac build, probably breaks windows build 2021-10-19 18:29:11 +01:00
richard
53853065d5 update readme 2021-10-16 21:16:52 +01:00
richard
86eecec6b3 build fixes 2021-10-16 20:58:24 +01:00
richard
ab38148125 fix windows build 2021-10-16 20:53:00 +01:00
richard
ef2d56308a generate h files on linux and then use them on windows 2021-10-16 20:46:52 +01:00
richard
10545a2f37 return to old file mangling for windows build only 2021-10-16 17:50:31 +01:00
richard
9e0a28d5f6 separate win build from all unix platforms 2021-10-16 17:44:12 +01:00
richard
cc9ba3e219 separate win build from all unix platforms 2021-10-16 17:43:51 +01:00
richard
7893aba276 drop python 3.6 support 2021-10-16 17:18:01 +01:00
richard
2ef7aba8a8 use gcc to process header files instead of doing it ourselves 2021-10-16 17:14:30 +01:00
richard
f6d0c6a912 use pkg-config to get paths 2021-10-15 20:07:32 +01:00
richard
4a8b773ddd typo 2021-10-15 18:23:06 +01:00
richard
497ebcf05b update to latest raylib 2021-10-15 01:52:03 +01:00
richard
c23546dd8f update to latest raylib 2021-10-13 19:02:38 +01:00
richard
6cd3e05e01 try to fix windows and source builds 2021-10-13 16:46:41 +01:00
richard
775d2da32d remove depreciated stuff, tidy build a bit for 4.0 2021-10-13 16:35:35 +01:00
richard
c818fae902 get rid of modified raylib.h, do modifications in code 2021-10-13 13:50:56 +01:00
richard
1051cd09e8 try add extra libs to win build 2021-10-08 18:06:30 +01:00
richard
142eb2e46d try windows build change 2021-10-08 18:03:02 +01:00
richard
11f399b603 try some build changes 2021-10-08 17:57:00 +01:00
richard
5f28d0101a update to raylib 4.0-dev and add physac and raygui 2021-10-08 17:36:08 +01:00
richard
8c4d2af2dc re-add docs, maybe that will get github pages to work. 2021-10-08 05:49:54 +01:00
richard
0bea7ef334 remove docs, maybe that will get github pages to work. 2021-10-08 05:48:48 +01:00
richard
5535d7d641 docs arent made by jekyll. 2021-10-08 05:36:20 +01:00
richard
04dd13a3f3 small fix 2021-10-08 05:26:54 +01:00
richard
80d568a469 fix docs 2021-10-08 05:23:06 +01:00
richard
e04d61f60b re-add submodule 2021-10-08 05:20:39 +01:00
richard
bf4afca33a Removed submodule that intellij messed up 2021-10-08 05:17:26 +01:00
richard
0a52bc37d3 intellij doesnt want to commit this 2021-10-08 05:07:54 +01:00
richard
8435094cb2 actually fix 2021-10-08 05:03:41 +01:00
richard
c1d95eba71 fix 2021-10-08 05:03:01 +01:00
richard
ec752bdab7 refactor pyray into separate module 2021-10-08 04:47:58 +01:00
richard
8666f0cff8 test jpeg image loading 2021-10-08 03:19:04 +01:00
richard
7b246103d8 change build options to include 'all' formats 2021-10-07 23:15:29 +01:00
richard
316f0bb1e4 fix dynamic to import exactly the same as static 2021-10-04 16:20:18 +01:00
richard
192fca8622 fix docs 2021-10-04 16:04:56 +01:00
richard
50c2fb12e2 QOL docs, colors, version number, example imports 2021-10-04 15:56:29 +01:00
electronstudio
9e17046408 improve docs, make clear different APIs and static/dynamic 2021-10-03 23:34:09 +01:00
electronstudio
47c4d0d1b4 fix docs/name 2021-10-03 21:42:57 +01:00
electronstudio
693657593b fix docs/name 2021-10-03 21:42:22 +01:00
electronstudio
16f7278c9d build fix2 2021-10-03 21:29:55 +01:00
electronstudio
dc511438c9 build fix 2021-10-03 21:25:50 +01:00
electronstudio
81819a133a separate static and dynamic libraries completely 2021-10-03 21:21:59 +01:00
electronstudio
d9ae6515a5 typo in README 2021-10-03 19:07:04 +01:00
electronstudio
5128d185e9 version bump 2021-10-03 19:00:41 +01:00
electronstudio
5afd9b0ee5 change mac build to expect raylib installed in /usr/local/lib 2021-10-03 18:54:23 +01:00
richard
bb4be12724 update docs 2021-10-03 18:29:46 +01:00
richard
e50b3b2826 update docs 2021-10-03 17:55:12 +01:00
electronstudio
906a4f1449 mac build instructions 2021-10-03 17:49:49 +01:00
richard
0a2ed8e1a4 update building docs 2021-10-03 17:09:46 +01:00
richard
4f7c17de05 try macos 11 2021-10-03 16:30:11 +01:00
richard
4845ce0002 try python 3.10.0-rc.2 2021-10-03 16:28:35 +01:00
richard
54adbf4ee8 try python 3.10 2021-10-03 16:25:17 +01:00
richard
cb7a574555 change how PyRay detects pointers 2021-09-23 11:15:51 +01:00
richard
9a3ffb525e update docstrings using raylib_api.json 2021-09-23 09:44:08 +01:00
richard
a98e0bef65 docs update 2021-08-30 09:30:15 +01:00
richard
4b3f4433a3 new license 2021-08-30 09:18:29 +01:00
richard
22e773ca6c pyi files not included in packages 2021-08-28 14:10:23 +01:00
richard
c69db47a26 try python 3.10.0-rc.1 2021-08-28 13:48:53 +01:00
richard
1a31dc276e quote python version numbers 2021-08-28 13:45:49 +01:00
richard
eda5e1449c try build on python 3.10 2021-08-28 13:39:41 +01:00
richard
b0a8448573 type hints for raylib.static 2021-08-28 13:35:55 +01:00
richard
aa5659f272 update examples 2021-08-28 13:07:02 +01:00
richard
64e5995633 update docs 2021-08-28 12:24:29 +01:00
richard
d167b1fee3 add source build docs 2021-08-27 04:03:12 +01:00
richard
c59f68b75f update readme 2021-08-27 03:58:49 +01:00
richard
bbcfa14159 update docs 2021-08-27 03:57:39 +01:00
richard
b75f690e2d seems to still be ignoring underscored folders in docs 2021-08-27 03:49:17 +01:00
richard
b9115ae1bb dont use jekyll for docs 2021-08-27 03:44:28 +01:00
Richard Smith
473fe33bdf Set theme jekyll-theme-cayman 2021-08-27 03:39:25 +01:00
richard
b3b7688963 update docs 2021-08-27 03:38:11 +01:00
richard
13ca8d2ae8 add doc strings and fake classes to the type hints 2021-08-27 00:28:19 +01:00
richard
3044797382 autogenerate type hints for pyray 2021-08-26 18:57:32 +01:00
richard
84fd32b44e hack to work on pypy by https://github.com/Guilherme32 from https://github.com/electronstudio/raylib-python-cffi/pull/39 2021-08-26 11:58:57 +01:00
richard
0e02f9d1bd readme 2021-07-12 12:59:15 +01:00
electronstudio
b9758ec5ac try mac again 2021-06-29 15:56:21 +01:00
electronstudio
144b02e83f try to build for older macs 2021-06-29 15:47:10 +01:00
electronstudio
0b80a5365a Update build.yml 2021-06-29 15:32:14 +01:00
electronstudio
e0522ef9d5 Update build.yml 2021-06-29 15:24:50 +01:00
electronstudio
fd6233e0d1 mac build 2021-06-29 15:21:19 +01:00
electronstudio
939c26be6f Update README.md 2021-06-29 14:25:42 +01:00
richard
fa58caa26d CI 2021-06-28 14:06:42 +01:00
richard
89335a416d version bump 2021-06-28 14:02:59 +01:00
richard
a75ed06e29 CI 2021-06-28 13:53:15 +01:00
richard
fe877021a9 CI 2021-06-28 13:45:52 +01:00
richard
c6971af376 CI 2021-06-28 13:40:21 +01:00
richard
1725351ff2 CI 2021-06-28 13:30:52 +01:00
richard
0a6db6ceaa CI 2021-06-28 13:27:44 +01:00
richard
739aa38a18 CI 2021-06-28 13:17:12 +01:00
richard
a4c20830fc CI 2021-06-28 12:37:17 +01:00
richard
e35afd573b CI 2021-06-28 12:34:07 +01:00
richard
cbf632ea0e CI 2021-06-28 12:26:25 +01:00
richard
62ec2d1029 CI 2021-06-28 12:20:55 +01:00
richard
6e4003db29 CI 2021-06-28 12:16:42 +01:00
richard
f57e88238d CI 2021-06-28 12:15:05 +01:00
richard
f629084bc2 CI 2021-06-28 12:01:13 +01:00
richard
3c243b10d4 CI 2021-06-28 11:56:35 +01:00
Richard Smith
a381488059
Update main.yml 2021-06-28 11:53:16 +01:00
Richard Smith
45ea4c6f4a
Update main.yml 2021-06-28 11:41:15 +01:00
Richard Smith
35e8654826
Update main.yml 2021-06-28 11:34:19 +01:00
Richard Smith
42be782d36
Update main.yml 2021-06-28 11:25:01 +01:00
Richard Smith
7e80c8f0c7
Update main.yml 2021-06-28 11:19:27 +01:00
Richard Smith
574a4b808d
Create main.yml 2021-06-28 11:17:56 +01:00
richard
a15d6e2d2e remove some old DLLs 2021-06-22 18:34:15 +01:00
richard
d1dc703292 update DLLs 2021-06-22 13:40:34 +01:00
Richard Smith
f6f5b0836e
Update README.md 2021-06-22 13:08:53 +01:00
Adam Griffiths
c26da5407a
Support searching for the raylib library on multiple paths. (#34)
Add a new environment variable "USE_EXTERNAL_RAYLIB" which will
alter the load behaviour to not include a directory prefix. This
lets us fallback onto the system library loading mechanism.
Remove specific raylib library filenames.
This ability is important for operating systems like Nix.
2021-06-22 13:03:05 +01:00
Richard Smith
aac3a506a2
Update README.md 2021-06-22 12:44:54 +01:00
Richard Smith
823b46f292
issue #33 2021-06-22 11:33:13 +01:00
Richard Smith
4b9bbdd5f0
Update README.md 2021-06-18 18:41:23 +01:00
Richard Smith
21b5ccfffc
Update README.md 2021-06-18 00:31:17 +01:00
richard
d52d83a55e patch is a weird program 2021-06-17 23:05:54 +01:00
richard
df71321d56 update README.md 2021-06-16 07:47:32 +01:00
richard
48966849c8 increment version on pypi 2021-06-16 07:37:53 +01:00
richard
9bf7544ad9 fix linux/pi building 2021-06-16 06:42:23 +01:00
richard
1548a40ede patch file was missing, restored 2021-06-16 05:32:28 +01:00
richard
72c222fc1f benchmark 2021-06-13 16:31:08 +01:00
richard
92a9d87108 Merge remote-tracking branch 'origin/master' 2021-06-13 00:37:27 +01:00
richard
1e47049822 update readme 2021-06-13 00:36:12 +01:00
unknown
ede24d4729 windows build 2021-06-12 16:27:08 -07:00
Richard Smith
af798db364
Update README.md 2021-06-12 21:55:25 +01:00
richard
846bb90e30 oops 2021-06-12 21:54:09 +01:00
richard
124f0c77a9 update to raylib 3.7 2021-06-12 21:51:27 +01:00
richard
677dfc0de0 rpi build separate 2021-06-12 20:03:28 +01:00
richard
0ceae3c986 pypi fix 2021-06-12 19:55:01 +01:00
richard
1c2ca0b3a5 build fixes 2021-06-12 19:15:08 +01:00
richard
9eddc4e528 rewrite build system to build separate binary wheels for each platform. only tested on Linux so far. should fix #25. 2021-06-12 18:42:39 +01:00
Simon
76121e34a9
Raspberry Pi builds (#30)
Instructions, plus build option for running full-screen applications (without
X11) on vanilla 32-bit Raspbian installations.

This doesn't commit the actual .so binaries, since there are at least two
possible variants (as described in the README).
2021-06-05 12:03:40 +01:00
Richard Smith
8dfee10e60 update pyray example in since pointer deref is now automatic, fixes issue #27 2021-03-14 00:14:42 +00:00
Richard Smith
39b52c5989 build Ubuntu 16.04 binaries 2021-01-16 21:02:10 +00:00
Richard Smith
bd84e41a5f
Update README.md 2021-01-16 18:50:10 +00:00
Richard Smith
66723110cd Merge branch 'master' of github.com:electronstudio/raylib-python-cffi 2021-01-16 18:32:56 +00:00
Richard Smith
78cf5cc344 update linux binaries to 3.5 (note using new glibc so may not work on old linuxes) 2021-01-16 18:32:38 +00:00
Richard Smith
daf8d55282
Update README.md 2021-01-16 18:30:23 +00:00
Richard Smith
70de7123f3
Update README.md 2021-01-16 18:24:41 +00:00
Richard Smith
657a63e335
Update README.md 2021-01-16 18:00:45 +00:00
Richard Smith
e59885c98a update linux multi build script 2021-01-16 17:15:13 +00:00
Richard Smith
9933633e4f update build instructions for raylib 3.5 2021-01-16 16:34:47 +00:00
Richard Smith
8c53dd53e7 add raylib source as submodule so we know which version we are compatible with 2021-01-16 15:39:15 +00:00
Richard Smith
676a29d7db fix issue #16 2020-11-16 08:45:37 +00:00
Richard Smith
9e8d6d3dd6 update readme 2020-11-16 06:52:12 +00:00
osboxes.org
5d5c38a154 update linux binaries to raylib 3.1-dev master and include python 3.9 2020-11-16 01:47:44 -05:00
Richard Smith
23f3cd92e7 update to raylib master in preparation for 3.5 release 2020-11-16 05:15:42 +00:00
Richard Smith
8824449bc1
New examples from @chriscamacho (#23)
* complete fog example
as both fog and basic lighting need the light system it made sense
to seperate it out, there are a few functions from raymath
int rlmath.py

* added shaders custom uniform

* added shaders_texture_waves.py

* added shaders_texture_drawing.py

* bug fix - unwanted transparent effect!

* complete fog example
as both fog and basic lighting need the light system it made sense
to seperate it out, there are a few functions from raymath
int rlmath.py

* added shaders custom uniform

* added shaders_texture_waves.py

* initial commit still WIP

* updated raylib

* undo all changes in this branch except for the example updates

* remove local raylib-c

Co-authored-by: codifies <nospam@antispam.com>
2020-11-15 20:07:05 +00:00
Richard Smith
16aec6a0e3 Merge branch 'master' of https://github.com/electronstudio/raylib-python-cffi 2020-09-19 10:12:35 +01:00
Richard Smith
26e9f9cbf2 automatically deref pointers in pyray 2020-09-19 10:12:30 +01:00
chriscamacho
e49e2b4d65
completed fog example (#18)
* complete fog example
as both fog and basic lighting need the light system it made sense
to seperate it out, there are a few functions from raymath
int rlmath.py

* added shaders custom uniform

* added shaders_texture_waves.py

* added shaders_texture_drawing.py

* bug fix - unwanted transparent effect!

Co-authored-by: codifies <nospam@antispam.com>
2020-09-19 09:07:39 +01:00
Matt Lebrun
6a3be55fe2
More core examples (#13)
* Added core_input_keys example

* Added core_basic_window example

* Added core_input_mouse example

* Added core_input_mouse_wheel example

* Added Rectangle struct

* Added core_input_gestures example to utilize the Rectangle struct

* Removed unused imports

* Used the right draw function for the example

* PEP8 fixes

* Added core 2d camera examples

* Added core 2d camera examples
2020-09-19 09:02:17 +01:00
Matt Lebrun
6854ec4a3e
Added Rectangle struct and core_input_gestures example (#12)
* Added Rectangle struct

* Added core_input_gestures example to utilize the Rectangle struct

* Removed unused imports
2020-07-30 13:52:12 +01:00
Matt Lebrun
76e945e1c9
Core examples (#11)
* Added core_input_keys example

* Added core_basic_window example

* Added core_input_mouse example

* Added core_input_mouse_wheel example
2020-07-30 13:43:39 +01:00
Electron Studio
8a30502288 update linux to 3.0 2020-04-07 04:20:05 +01:00
electronstudio
eeaaf69044 update mac builds to 3.0 2020-04-01 15:04:32 +01:00
electronstudio
98639e03eb Merge branch 'Pebaz-master' 2020-02-21 23:15:11 +00:00
electronstudio
81a1440267 combine blank.py and camera.py examples 2020-02-21 23:14:51 +00:00
electronstudio
1146ce7189 Merge branch 'master' of https://github.com/Pebaz/raylib-python-cffi into Pebaz-master 2020-02-21 23:00:28 +00:00
Pebaz
40387cefed added rendertexture example 2020-02-18 16:53:12 -05:00
Pebaz
822d85c78c Add camera example 2020-02-18 16:40:52 -05:00
307 changed files with 82585 additions and 27573 deletions

157
.cirrus.yml Normal file
View file

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

440
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,440 @@
name: Build
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-mac-intel:
runs-on: macos-13
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
raylib-platform: ['Desktop', 'SDL']
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
tar xvfz release-2.30.7.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.30.7 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
# Runs a set of commands using the runners shell
- name: Build raylib without SDL because SDL version has incorrect pkg-config
run: |
cd raylib-c
mkdir build
cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
- name: Build raylib with SDL if selected
run: |
cd raylib-c
mkdir build2
cd build2
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1"
pip3 install wheel
pip3 install setuptools
python setup.py bdist_wheel --plat-name macosx_10_13_x86_64
- name: Test
run: |
pip3 install dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-mac-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
# build-mac-universal:
# runs-on: macos-14
# strategy:
# matrix:
# python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ]
# raylib-platform: ['Desktop', 'SDL']
# env:
# MACOSX_DEPLOYMENT_TARGET: 11.0
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - name: Build SDL
# run: |
# wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
# tar xvfz release-2.30.7.tar.gz
# mkdir build
# cd build
# cmake ../SDL-release-2.30.7 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
# cmake --build . --config Release
# sudo cmake --install .
#
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# # Version range or exact version of a Python version to use, using SemVer's version range syntax.
# python-version: ${{ matrix.python-version }}
# architecture: arm64
#
# # Runs a set of commands using the runners shell
# - name: Build raylib without SDL because SDL version has incorrect pkg-config
# run: |
# cd raylib-c
# mkdir build
# cd build
# cmake -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
# make -j2
# sudo make install
#
# - name: Build raylib with SDL if selected
# run: |
# cd raylib-c
# mkdir build2
# cd build2
# cmake -DPLATFORM=${{ matrix.raylib-platform }} -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DPLATFORM=SDL -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
# make -j2
# sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
#
# - name: Copy extras
# run: |
# sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
# sudo cp physac/src/physac.h /usr/local/include/
# sudo cp raygui/src/raygui.h /usr/local/include/
#
# - name: Build raylib-python-cffi
# run: |
# python -m pip install --upgrade pip
# pip3 install "cffi>=1.17.1"
# pip3 install wheel
# pip3 install setuptools
# RAYLIB_PLATFORM=${{ matrix.raylib-platform }} python setup.py bdist_wheel
#
# - name: Upload build Artifact wheel
# uses: actions/upload-artifact@v3.2.1
# with:
# name: wheel
# path: dist/*
#
# # Name defaults to universal2 and it technically is, but we override name to arm64. Why don't we make a working universal2 wheel? Because
# # I'd rather have a separate x86_64 that I can test, and I want it to work on 10_15 but I'm not sure a 'macosx_10_15_universal2' is valid
# # given that there is no SDK for universal until macosx_11_0
# - name: Build raylib-python-cffi
# run: |
# python -m pip install --upgrade pip
# pip3 install cffi
# pip3 install wheel
# python setup.py bdist_wheel --plat-name macosx_12_0_arm64
build-linux:
runs-on: ubuntu-22.04
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
raylib-platform: ['Desktop', 'SDL', 'DRM']
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: install prereqs
run: |
sudo apt update
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
tar xvfz release-2.30.7.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.30.7 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
# Runs a set of commands using the runners shell
- name: Build raylib
run: |
cd raylib-c
mkdir build
cd build
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release -DOpenGL_GL_PREFERENCE=GLVND ..
make -j2
sudo make install
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1"
pip3 install wheel
pip3 install setuptools
python setup.py bdist_wheel --plat-name manylinux2014_x86_64
- name: Test
run: |
pip3 install dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-linux-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
build-windows:
# The type of runner that the job will run on
runs-on: windows-2019
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10', 'pypy-3.11' ]
raylib-platform: ['Desktop', 'SDL']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download SDL2
run: curl -L -o SDL2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.30.8/SDL2-devel-2.30.8-VC.zip
- name: Create extraction directory
run: mkdir ${{ runner.temp }}\SDL2
- name: Unzip SDL2
run: tar -xf SDL2.zip -C ${{ runner.temp }}\SDL2 --strip-components=1
- name: Set SDL2_DIR environment variable
run: echo SDL2_DIR=${{ runner.temp }}\SDL2\cmake >> $env:GITHUB_ENV
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build raylib
run: |
cd raylib-c
mkdir build
cd build
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..
shell: cmd
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.lib .
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.dll raylib\
python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1"
pip3 install wheel
pip3 install setuptools
del raylib\dynamic\*.so* >nul 2>&1
del raylib\dynamic\*.dll >nul 2>&1
del raylib\dynamic\*.dylib >nul 2>&1
del raylib\dynamic\32bit\* >nul 2>&1
python setup.py bdist_wheel
shell: cmd
- name: Test
shell: bash
run: |
pip3 install --no-deps dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-windows-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
source-distro:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: '3.12'
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: Build raylib
run: |
sudo apt update
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
cd raylib-c
mkdir build
cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
run: |
python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1"
pip3 install wheel
pip3 install setuptools
python setup.py sdist
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-source
path: dist/*
dynamic-distro:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: '3.12'
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: Build raylib-python-cffi-dynamic
run: |
python -m pip install --upgrade pip
pip3 install "cffi>=1.17.1"
pip3 install wheel
pip3 install setuptools
cd dynamic
python setup.py sdist
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-dynamic
path: dynamic/dist/*
merge:
needs: [build-mac-intel, build-windows, build-linux, source-distro, dynamic-distro]
runs-on: ubuntu-latest
steps:
- name: Merge All Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: wheel
pattern: wheel-*

2
.gitignore vendored
View file

@ -4,6 +4,8 @@ __pycache__/
# Distribution / packaging
docs-src/_build
.idea/
.Python
build/
develop-eggs/

9
.gitmodules vendored Normal file
View file

@ -0,0 +1,9 @@
[submodule "raylib-c"]
path = raylib-c
url = https://git.terah.dev/UnrealXR/raylib.git
[submodule "raygui"]
path = raygui
url = https://github.com/raysan5/raygui.git
[submodule "physac"]
path = physac
url = https://github.com/victorfisac/Physac.git

216
BUILDING.rst Normal file
View file

@ -0,0 +1,216 @@
Building from source
====================
Have Pip build from source
--------------------------
This is useful if the binaries dont work on your system, or you want to use a newer version of Raylib.
First make sure Raylib is installed. On Linux/Mac it must include the pkg-config files. Best way to ensure this
is to compile and install Raylib using CMake: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake
Requirements for build: cmake, pkg-config.
::
cd raylib-5.0
mkdir build
cd build
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
Then ask Pip to build from source:
::
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
Or, Build from source manually
------------------------------
Useful if the Pip build doesnt work and you want to debug it, or you want to contribute to the
project.
.. attention::
If the Pip build doesnt work, please submit a bug. (And if you have
fixed it, a PR.)
Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml
Windows manual build
~~~~~~~~~~~~~~~~~~~~
Clone this repo including submodules so you get correct version of
Raylib.
::
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Open Visual C++ command shell.
Fix the symlink that doesnt work on Windows
::
cd raylib-python-cffi
copy raylib-c\src\raylib.h raylib\raylib.h
Build and install Raylib from the raylib-c directory.
::
cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..
To build a binary wheel distribution:
::
rmdir /Q /S build
pip3 install cffi
pip3 install wheel
python setup.py bdist_wheel
Then install it:
::
pip3 install dist\raylib-3.7.0-cp37-cp37m-win_amd64.whl
(Note: your wheels filename will probably be different than the one
here.)
Linux manual build
~~~~~~~~~~~~~~~~~~~~~~
Clone this repo including submodules so you get correct version of
Raylib.
::
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Build and install Raylib from the raylib-c directory.
.. note::
You can instead use a different version of Raylib you installed from elsewhere, and it should still
work!
::
sudo apt install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config cmake
cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
sudo make install
.. note:: Optional: Build the Raylib shared libs, if you plan to use
``raylib_dynamic`` binding.
::
rm -rf *
cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
::
cd ../..
Build the Python library:
::
pip3 install cffi
rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
.. note:: (Optional) To update the Linux dynamic libs (names will be different on other platforms):
::
rm dynamic/raylib/*.so*
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/
To build a binary wheel distribution:
::
pip3 install wheel
python3 setup.py bdist_wheel
Then install it:
::
pip3 install dist/raylib*.whl
To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
::
./raylib/build_multi.sh
.. warning::
pypi wont accept Linux packages unless they are built
``--plat-name manylinux2014_x86_64`` so on linux please run
``./raylib/build_multi_linux.sh`` )
.. TODO::
Separate the instructions for preparing the dynamic module
from the instructions for building the static module!
Macos manual build
~~~~~~~~~~~~~~~~~~~~~~
These instructions have been tested on Macos 10.14.
Clone this repo including submodules so you get correct version of
Raylib.
::
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Build and install Raylib from the raylib-c directory.
::
cd raylib-python-cffi/raylib-c/
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
cd ../..
Build and install module.
::
pip3 install cffi
rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
pip3 install wheel
python3 setup.py install

368
LICENSE
View file

@ -1,165 +1,277 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Eclipse Public License - v 2.0
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
"Contribution" means:
0. Additional Definitions.
a) in the case of the initial Contributor, the initial content
Distributed under this Agreement, and
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from
and are Distributed by that particular Contributor. A Contribution
"originates" from a Contributor if it was added to the Program by
such Contributor itself or anyone acting on such Contributor's behalf.
Contributions do not include changes or additions to the Program that
are not Modified Works.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
"Contributor" means any person or entity that Distributes the Program.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
"Licensed Patents" mean patent claims licensable by a Contributor which
are necessarily infringed by the use or sale of its Contribution alone
or when combined with the Program.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
"Program" means the Contributions Distributed in accordance with this
Agreement.
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
"Recipient" means anyone who receives the Program under this Agreement
or any Secondary License (as applicable), including Contributors.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
"Derivative Works" shall mean any work, whether in Source Code or other
form, that is based on (or derived from) the Program and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship.
1. Exception to Section 3 of the GNU GPL.
"Modified Works" shall mean any work in Source Code or other form that
results from an addition to, deletion from, or modification of the
contents of the Program, including, for purposes of clarity any new file
in Source Code form that contains any contents of the Program. Modified
Works shall not include works that contain only declarations,
interfaces, types, classes, structures, or files of the Program solely
in each case in order to link to, bind by name, or subclass the Program
or Modified Works thereof.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
"Distribute" means the acts of a) distributing or b) making available
in any manner that enables the transfer of a copy.
2. Conveying Modified Versions.
"Source Code" means the form of a Program preferred for making
modifications, including but not limited to software source code,
documentation source, and configuration files.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
"Secondary License" means either the GNU General Public License,
Version 2.0, or any later versions of that license, including any
exceptions or additional permissions as identified by the initial
Contributor.
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
2. GRANT OF RIGHTS
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
a) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free copyright
license to reproduce, prepare Derivative Works of, publicly display,
publicly perform, Distribute and sublicense the Contribution of such
Contributor, if any, and such Derivative Works.
3. Object Code Incorporating Material from Library Header Files.
b) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free patent
license under Licensed Patents to make, use, sell, offer to sell,
import and otherwise transfer the Contribution of such Contributor,
if any, in Source Code or other form. This patent license shall
apply to the combination of the Contribution and the Program if, at
the time the Contribution is added by the Contributor, such addition
of the Contribution causes such combination to be covered by the
Licensed Patents. The patent license shall not apply to any other
combinations which include the Contribution. No hardware per se is
licensed hereunder.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are
provided by any Contributor that the Program does not infringe the
patent or other intellectual property rights of any other entity.
Each Contributor disclaims any liability to Recipient for claims
brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the
rights and licenses granted hereunder, each Recipient hereby
assumes sole responsibility to secure any other intellectual
property rights needed, if any. For example, if a third party
patent license is required to allow Recipient to Distribute the
Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
d) Each Contributor represents that to its knowledge it has
sufficient copyright rights in its Contribution, if any, to grant
the copyright license set forth in this Agreement.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
e) Notwithstanding the terms of any Secondary License, no
Contributor makes additional grants to any Recipient (other than
those set forth in this Agreement) as a result of such Recipient's
receipt of the Program under the terms of a Secondary License
(if permitted under the terms of Section 3).
4. Combined Works.
3. REQUIREMENTS
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
3.1 If a Contributor Distributes the Program in any form, then:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
a) the Program must also be made available as Source Code, in
accordance with section 3.2, and the Contributor must accompany
the Program with a statement that the Source Code for the Program
is available under this Agreement, and informs Recipients how to
obtain it in a reasonable manner on or through a medium customarily
used for software exchange; and
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
b) the Contributor may Distribute the Program under a license
different than this Agreement, provided that such license:
i) effectively disclaims on behalf of all other Contributors all
warranties and conditions, express and implied, including
warranties or conditions of title and non-infringement, and
implied warranties or conditions of merchantability and fitness
for a particular purpose;
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
ii) effectively excludes on behalf of all other Contributors all
liability for damages, including direct, indirect, special,
incidental and consequential damages, such as lost profits;
d) Do one of the following:
iii) does not attempt to limit or alter the recipients' rights
in the Source Code under section 3.2; and
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
iv) requires any subsequent distribution of the Program by any
party to be under a license that satisfies the requirements
of this section 3.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
3.2 When the Program is Distributed as Source Code:
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
a) it must be made available under this Agreement, or if the
Program (i) is combined with other material in a separate file or
files made available under a Secondary License, and (ii) the initial
Contributor attached to the Source Code the notice described in
Exhibit A of this Agreement, then the Program may be made available
under the terms of such Secondary Licenses, and
5. Combined Libraries.
b) a copy of this Agreement must be included with each copy of
the Program.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
3.3 Contributors may not remove or alter any copyright, patent,
trademark, attribution notices, disclaimers of warranty, or limitations
of liability ("notices") contained within the Program from any copy of
the Program which they Distribute, provided that Contributors may add
their own appropriate notices.
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
4. COMMERCIAL DISTRIBUTION
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
Commercial distributors of software may accept certain responsibilities
with respect to end users, business partners and the like. While this
license is intended to facilitate the commercial use of the Program,
the Contributor who includes the Program in a commercial product
offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes
the Program in a commercial product offering, such Contributor
("Commercial Contributor") hereby agrees to defend and indemnify every
other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits
and other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the Program
in a commercial product offering. The obligations in this section do not
apply to any claims or Losses relating to any actual or alleged
intellectual property infringement. In order to qualify, an Indemnified
Contributor must: a) promptly notify the Commercial Contributor in
writing of such claim, and b) allow the Commercial Contributor to control,
and cooperate with the Commercial Contributor in, the defense and any
related settlement negotiations. The Indemnified Contributor may
participate in any such claim at its own expense.
6. Revised Versions of the GNU Lesser General Public License.
For example, a Contributor might include the Program in a commercial
product offering, Product X. That Contributor is then a Commercial
Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance
claims and warranties are such Commercial Contributor's responsibility
alone. Under this section, the Commercial Contributor would have to
defend claims against the other Contributors related to those performance
claims and warranties, and if a court requires any other Contributor to
pay any damages as a result, the Commercial Contributor must pay
those damages.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
5. NO WARRANTY
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all
risks associated with its exercise of rights under this Agreement,
including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs
or equipment, and unavailability or interruption of operations.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this Agreement, and without further
action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that the
Program itself (excluding combinations of the Program with other software
or hardware) infringes such Recipient's patent(s), then such Recipient's
rights granted under Section 2(b) shall terminate as of the date such
litigation is filed.
All Recipient's rights under this Agreement shall terminate if it
fails to comply with any of the material terms or conditions of this
Agreement and does not cure such failure in a reasonable period of
time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use
and distribution of the Program as soon as reasonably practicable.
However, Recipient's obligations under this Agreement and any licenses
granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement,
but in order to avoid inconsistency the Agreement is copyrighted and
may only be modified in the following manner. The Agreement Steward
reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement
Steward has the right to modify this Agreement. The Eclipse Foundation
is the initial Agreement Steward. The Eclipse Foundation may assign the
responsibility to serve as the Agreement Steward to a suitable separate
entity. Each new version of the Agreement will be given a distinguishing
version number. The Program (including Contributions) may always be
Distributed subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is published,
Contributor may elect to Distribute the Program (including its
Contributions) under the new version.
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
receives no rights or licenses to the intellectual property of any
Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted
under this Agreement are reserved. Nothing in this Agreement is intended
to be enforceable by any entity that is not a Contributor or Recipient.
No third-party beneficiary rights are created under this Agreement.
Exhibit A - Form of Secondary Licenses Notice
"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
version(s), and exceptions or additional permissions here}."
Simply including a copy of this Agreement, including this Exhibit A
is not sufficient to license the Source Code under Secondary Licenses.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to
look for such a notice.
You may add additional accurate notices of copyright ownership.

View file

@ -1,9 +1,16 @@
include raylib/static/*.so
include raylib/static/*.pyd
exclude raylib/static/*.a
include raylib/*.so
include raylib/*.pyi
include pyray/*.pyi
include raylib/*.pyd
include raylib/*.dll
exclude raylib/*.a
include raylib/*.h
exclude raylib/static/*.c
exclude raylib/static/*.o
include raylib/dynamic/*.dylib
include raylib/dynamic/*.dll
include raylib/dynamic/*.so
include raylib/*.h.modified
exclude raylib/*.c
exclude raylib/*.o
include version.py
exclude tests/*
include raylib/py.typed
include pyray/py.typed

383
README.md
View file

@ -1,115 +1,278 @@
# Python Bindings for Raylib 2.6
# Python Bindings for Raylib 5.5
## Libraries: raymath, raygui, rlgl, physac and GLFW
## Backends: Desktop, SDL, DRM, Web
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
New CFFI API static bindings. Faster, fewer bugs and easier to maintain than ctypes.
![PyPI - Downloads](https://img.shields.io/pypi/dm/raylib)
### Advert
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
HELP WANTED: [writing examples](https://github.com/electronstudio/raylib-python-cffi/issues/155)
Features:
* CFFI API static bindings.
* Automatically generated to be as close as possible to
original Raylib.
* Faster, fewer bugs and easier to maintain than ctypes.
* Commercial-friendly license.
* Docstrings and auto-completion.
* Type checking with Mypy
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
# Quickstart
`pip3 install raylib==5.5.0.2 --break-system-packages`
```python
from pyray import *
init_window(800, 450, "Hello")
while not window_should_close():
begin_drawing()
clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing()
close_window()
```
# Installation
If you are on a modern Linux you will probably want to create a venv:
python3 -m venv venv
source venv/bin/activate
Then make sure you have the latest pip installed:
python3 -m pip install --upgrade pip
Then install
python3 -m pip install setuptools
python3 -m pip install raylib==5.5.0.2
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
source, in which case you will need to have Raylib development libs installed, e.g.
using homebrew, apt, etc.
## Windows
Binaries require x64 Windows 10 or newer. (For x86 or older Windows you will have to build from source.)
Use an [official Windows Python release](https://www.python.org/downloads/windows/) rather than WSL, MSYS, etc.
## MacOS
Binaries require:
* arm64 MacOS 14
* x64 MacOS 10.13, or newer.
Older MacOS requires building from source but this is usually simple:
brew install pkg-config
brew install raylib
python3 -m pip install raylib==5.5.0.2
(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
if you want to test them.)
## Linux
Binaries require OS newer than Ubuntu 2020, x64 or arm64. Otherwise build from source.
(Pip should attempt automatically but will need Raylib itself installed and also pkg-config.)
The arm64 binaries are built on Raspberry Pi arm64 Bullseye with OpenGL 2.0
so may not work on other boards.
## Raspberry Pi
[Using on Rasperry Pi](RPI.rst)
# Backends
## Dynamic binding version
There is now a separate dynamic version of this binding:
python3 -m pip uninstall raylib
python3 -m pip install raylib_dynamic
It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
You can't have multiple raylib packages installed at once.
## SDL backend
This is not well tested but has better support for controllers:
python3 -m pip uninstall raylib
python3 -m pip install raylib_sdl
You can't have multiple raylib packages installed at once.
## DRM backend
This uses the Linux framebuffer for devices that don't run X11/Wayland:
python3 -m pip uninstall raylib
python3 -m pip install raylib_drm
You can't have multiple raylib packages installed at once.
## Problems?
If it doesn't work, [try to build manually.](BUILDING.rst). If that works then [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues)
to let us know what you did.
If you need help you can try asking on [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
for issues that are not Python-specific.
If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
# How to use
There are *two* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
pyray. Do *not* `pip install pyray`). You can use either or both:
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
### If you prefer a more Pythonistic API
Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
# Running in a web browser
[Pygbag](https://pypi.org/project/pygbag/) >=0.8.7 supports running in a web browser. Usually the latest git version
is recommended.
Make a folder `my_project` with a file `main.py`:
```python
# /// script
# dependencies = [
# "cffi",
# "raylib"
# ]
# ///
import asyncio
import platform
from pyray import *
async def main(): # You MUST have an async main function
init_window(500, 500, "Hello")
platform.window.window_resize() # You MAY want to add this line
while not window_should_close():
begin_drawing()
clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing()
await asyncio.sleep(0) # You MUST call this in your main loop
close_window()
asyncio.run(main())
```
Then to create the web files and launch a web server:
python3.12 -m pip install --user --upgrade pygbag
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my_project
Point your browser to http://localhost:8000
Some features may not work, so you can disable them like this:
```python
if platform.system() != "Emscripten": # audio may not work on current version of emscripten
init_audio_device()
```
This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
Carefully read all their [documentation](https://pygame-web.github.io/).
It does work for most of [these examples](https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/)
# App showcase
[Tempest-raylib](https://github.com/Emtyloc/tempest-raylib)
[KarabinerKeyboard](https://github.com/bilbofroggins/KarabinerKeyboard)
[PyTaiko](https://github.com/Yonokid/PyTaiko)
[DOOM-Clone](https://github.com/StanislavPetrovV/DOOM-Clone)
[Tanki](https://github.com/pkulev/tanki)
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
[Eidolon](https://github.com/Miou-zora/Eidolon)
Add your app here!
# RLZero
A related library (that is a work in progress!):
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/rlzero)
# Help wanted
* Converting more examples from C to Python
* Testing on more platforms
# License
Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects!
# Performance
If you need more performance, do in this order:
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
2. Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
in your update loop
and then only convert them to C data structures when you have to call the C functions for drawing.
3. The raylib.* functions are potentially *slightly* faster than the pyray.* equivalents, so if you need a tiny bit more performance
you can switch your inner loop functions to these.
4. There is a version of Python that is faster than Pypy: GraalPy. However it's not fully compatible with all Python
packages. It doesn't work with CFFI and so doesn't work with this binding. But it *is* compatible with the
*Java* binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib
## Bunnymark
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|--------------------------------|-------------------|------------------|------------|
| Raylib 5.0 | C | 180000 | 100% |
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
| Raylib 3.7 | C | 168100 | 100% |
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
See also https://github.com/electronstudio/megabunny/
# Packaging your app
You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:
pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
# Advert
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
# Install
**Windows 10 (64 bit): Python 3.6 - 3.8**
**MacOS: Python 3.6 - 3.8**
**Linux (Ubuntu 16.04+): Python 3.6 - 3.8**
We distribute a statically linked Raylib library, install from Pypi.
pip3 install raylib
If you're a different version of Python, or a Linux with incompatible libraries
then you can either *use the dynamic binding only* or else you will have to build from source. Download, compile
and install Raylib 2.6 then
cd raylib/static
python3 build_linux.py
# Use
## raylib.static
Goal is make usage as similar to the original C as CFFI will allow. There are a few differences
you can see in the examples. See test_static.py and examples/*.py for how to use.
```
from raylib.static import *
InitWindow(800, 450, b"Hello Raylib")
SetTargetFPS(60)
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
SetCameraMode(camera[0], CAMERA_ORBITAL)
while not WindowShouldClose():
UpdateCamera(camera)
BeginDrawing()
ClearBackground(RAYWHITE)
BeginMode3D(camera[0])
DrawGrid(20, 1.0)
EndMode3D()
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
EndDrawing()
CloseWindow()
```
## raylib.pyray
Wrapper around the static bindings. Makes the names snakecase and converts strings to bytes automatically. See test_pyray.py.
```
from raylib.pyray import PyRay
from raylib.colors import *
pyray = PyRay()
pyray.init_window(800, 450, "Hello Pyray")
pyray.set_target_fps(60)
camera = pyray.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
pyray.set_camera_mode(camera, pyray.CAMERA_ORBITAL)
while not pyray.window_should_close():
pyray.update_camera(pyray.pointer(camera))
pyray.begin_drawing()
pyray.clear_background(RAYWHITE)
pyray.begin_mode_3d(camera)
pyray.draw_grid(20, 1.0)
pyray.end_mode_3d()
pyray.draw_text("Hello world", 190, 200, 20, VIOLET)
pyray.end_drawing()
pyray.close_window()
```
## raylib.dynamic
In addition to the API static bindings we have CFFI ABI dynamic bindings in order to avoid the need to compile a C extension module.
There have been some weird failures with dynamic bindings and ctypes bindings before and often the failures are silent
so you dont even know. Also the static bindings should be faster. Therefore I recommend the static ones...
BUT the dynamic bindings have the big advantage that you don't need to compile anything to install. You just need a Raylib DLL,
which we supply for Windows/Mac/Linux.
See test_dynamic.py for how to use.
## richlib
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/richlib)
# Platforms tested
* (MacOS 10.12.6 - Python 3.7)
* (Ubuntu 18.04 LTS - Python 3.6)
* Debian 10 - Python 3.7
* Windows 10 (64 bit) - Python 3.8
# HELP WANTED
* converting more examples from C to python
* testing and building on more platforms
* sorting out binary wheel distribution for Mac/Win and compile-from-source distributtion for Linux
* dealing with conversions to pointers in PyRay automatically
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
a book for Python beginners.

97
RPI.rst Normal file
View file

@ -0,0 +1,97 @@
Raspberry Pi
====================
Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.
Option 1: Binary wheel
----------------------
We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.
::
python -m pip install --break-system-packages raylib
Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
installed at once.
If it doesn't work, or you're not on Bullseye, or you're 32 bit, you will need to compile your own raylib. See below.
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
Option 2: Compile Raylib from source X11 mode
---------------------------------------------
This should work for everyone.
::
sudo apt update
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev libglfw3-dev
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
cd raylib
mkdir build
rm -rf build/*
cd build
cmake -DPLATFORM="Desktop" -DOPENGL_VERSION=2.1 -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
sudo cp -r ../src/external/glfw/include/GLFW /usr/local/include/
Then have pip compile and install the wheel:
::
python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.5.0.0
Option 3: Compile Raylib from source DRM mode
---------------------------------------------
This seems to work on Raspberry Pi 4. Note you must not be running X11 when you run your programs.
If you have ever installed Raylib or raylib-python-cffi before, remove all traces of it:
::
sudo apt remove raylib raylib-dev libraylib libraylib-dev
sudo rm /usr/local/lib/pkgconfig/raylib.pc
sudo rm -rf /usr/local/lib/libraylib.* /usr/lib/libraylib.*
Remove all GLFW:
::
sudo apt remove libglfw3-dev libglfw3
sudo rm -rf /usr/local/include/GLFW
Build a shared lib version of Raylib in DRM mode and install to /usr:
::
sudo apt update
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
cd raylib
mkdir build
rm rf build/*
cd build
cmake -DPLATFORM="DRM" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
sudo make install
Then have pip compile and install the wheel:
::
python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.5.0.0
.. attention::
If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into ``/opt/vc`` and compiled in Raylib
with ``PLATFORM_RPI``) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
require additional linker arguments to be added to ``build.py``. Suggest you try ``PLATFORM_DRM`` instead.

View file

@ -1,76 +0,0 @@
from raylib.richlib import *
WIDTH=1200
HEIGHT=800
CAMERA=pyray.CAMERA_FIRST_PERSON
player = Box((-5, 0, -5), (1, 1, 1), 'green', True)
o = Vector([-5,-0,-5])
td = False
def init():
camera.position = (0.0, 4, 7)
camera.target = (100,100,-100)
camera.up = (0, 1, 0)
camera.fovy = 60
#rl.UpdateCamera(camera)
pyray.set_camera_mode(camera[0], pyray.CAMERA_FIRST_PERSON)
#rl.UpdateCamera(camera)
def update():
if keyboard.right:
player.pos.x += 0.1
elif keyboard.left:
player.pos.x -= 0.1
elif keyboard.up:
player.pos.y += 0.1
elif keyboard.down:
player.pos.y -= 0.1
elif keyboard.l:
player.pos.z += 0.1
elif keyboard.p:
player.pos.z-= 0.1
if pyray.is_key_pressed(pyray.KEY_Z):
global td
td = not td
def draw3d():
if td:
#pyray.draw_plane((0, 0, 0), (300,300), DARKRED)
pyray.draw_grid(10, 1)
pyray.draw_plane((player.x, 0, player.z), (1,1), GRAY)
pyray.draw_ray([o,[0,0,1]],BLUE)
pyray.draw_ray([o,[0,1,0]],GREEN)
pyray.draw_ray([o,[1,0,0]],RED)
player.draw()
def draw2dbackground():
clear('white')
origin = rl.GetWorldToScreen(o, camera[0])
rl.DrawText(b"0", int(origin.x), int(origin.y), 20, BLACK)
for i in range (0,11):
xa = rl.GetWorldToScreen((o.x+i,o.y,o.z), camera[0])
ya = rl.GetWorldToScreen((o.x,o.y+i,o.z), camera[0])
za = rl.GetWorldToScreen((o.x,o.y,o.z+i), camera[0])
pyray.draw_text(str(i), int(xa.x), int(xa.y), 20, RED)
pyray.draw_text(str(i), int(ya.x), int(ya.y), 20, GREEN)
if td:
pyray.draw_text(str(i), int(za.x), int(za.y), 20, BLUE)
pyray.draw_text(f"X: {int(player.x+5)}", 10, 10, 30, RED)
pyray.draw_text(f"Y: {int(player.y)}", 10, 50, 30, GREEN)
if td:
pyray.draw_text(f"Z: {int(player.z+5)}", 10, 110, 30, BLUE)
run()

105
create_define_consts.py Normal file
View file

@ -0,0 +1,105 @@
# Copyright (c) 2021 Richard Smith and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# licenses when the conditions for such availability set forth in the Eclipse
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
# with the GNU Classpath Exception which is
# available at https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
from raylib import rl, ffi
from inspect import ismethod, getmembers, isbuiltin
import inflection, sys, json, re
two_or = re.compile(r'''\(\s*([^\s]*)\s*\|\s*([^\s]*)\s*\)''')
three_or = re.compile(r'''\(\s*([^\s]*)\s*\|\s*([^\s]*)\s*\|\s*(^\s*)\s*\)''')
two_mult = re.compile(r'''\(\s*([^\s]*)\s*\*\s*([^\s]*)\s*\)''')
two_div = re.compile(r'''\(\s*([^\s]*)\s*/\s*([^\s]*)\s*\)''')
def process(filename):
f = open(filename, "r")
js = json.load(f)
known_define = []
known_enum = []
for e in js['enums']:
if e['name'] and e['values']:
for v in e['values']:
if v['name']:
known_enum.append(str(v['name']).strip())
for e in js['defines']:
if e['type'] in ('INT', 'FLOAT', 'STRING'):
if e['type'] == 'INT':
print(e['name'] + ": int = " + str(e['value']).strip())
elif e['type'] == 'FLOAT':
print(e['name'] + ": float = " + str(e['value']).strip())
else:
print(e['name'] + ": str = \"" + str(e['value']).strip() + '"')
known_define.append(str(e['name']).strip())
elif e['type'] == "UNKNOWN":
strval = str(e['value']).strip()
if strval.startswith("__"):
continue
if strval in known_enum:
print(e['name'] + " = raylib." + strval)
elif strval in known_define:
print(e['name'] + " = " + strval)
else:
matches = two_or.match(strval)
if not matches:
matches = three_or.match(strval)
if matches:
match_defs = [str(m).strip() for m in matches.groups()]
if all(d in known_enum for d in match_defs):
print(e['name'] + " = " + " | ".join(("raylib."+m) for m in match_defs))
elif all(d in known_define for d in match_defs):
print(e['name'] + " = " + " | ".join(match_defs))
else:
continue
known_define.append(str(e['name']).strip())
elif e['type'] == "FLOAT_MATH":
strval = str(e['value']).strip()
matches = two_mult.match(strval)
if matches:
match_defs = [str(m).strip() for m in matches.groups()]
match_parts = []
for m in match_defs:
if "." in m:
match_parts.append(m.rstrip("f"))
else:
match_parts.append(m)
if all(d in known_enum for d in match_parts):
print(e['name'] + " = " + " * ".join(("raylib." + m) for m in match_parts))
elif all(d in known_define for d in match_parts):
print(e['name'] + " = " + " * ".join(match_parts))
else:
matches = two_div.match(strval)
if matches:
match_defs = [str(m).strip() for m in matches.groups()]
match_parts = []
for m in match_defs:
if "." in m:
match_parts.append(m.rstrip("f"))
else:
match_parts.append(m)
if any(d in known_enum for d in match_parts):
print(e['name'] + " = " + " / ".join(("raylib." + m) for m in match_parts))
elif any(d in known_define for d in match_parts):
print(e['name'] + " = " + " / ".join(match_parts))
else:
continue
print("import raylib\n")
process("raylib.json")
process("raymath.json")
process("rlgl.json")
process("raygui.json")
process("physac.json")
process("glfw3.json")

38
create_enums.py Normal file
View file

@ -0,0 +1,38 @@
# Copyright (c) 2021 Richard Smith and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# licenses when the conditions for such availability set forth in the Eclipse
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
# with the GNU Classpath Exception which is
# available at https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
from raylib import rl, ffi
from inspect import ismethod, getmembers, isbuiltin
import inflection, sys, json
def process(filename):
f = open(filename, "r")
js = json.load(f)
for e in js['enums']:
if e['name'] and e['values']:
print ("class "+e['name']+"("+"IntEnum):")
print(f' """{e['description']}."""')
for value in e['values']:
print(" "+value['name']+" = "+str(value['value']))
print("")
print("""from enum import IntEnum
""")
process("raylib.json")
process("raygui.json")
process("glfw3.json")
process("physac.json")

196
create_stub_pyray.py Normal file
View file

@ -0,0 +1,196 @@
# Copyright (c) 2021 Richard Smith and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# licenses when the conditions for such availability set forth in the Eclipse
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
# with the GNU Classpath Exception which is
# available at https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
from pathlib import Path
from raylib import rl, ffi
from pyray import _underscore
from inspect import ismethod, getmembers, isbuiltin
import inflection, sys, json
known_functions = {}
known_structs = {}
for filename in (Path("raylib.json"), Path("raymath.json"), Path("rlgl.json"), Path("raygui.json"), Path("physac.json"),
Path("glfw3.json")):
f = open(filename, "r")
js = json.load(f)
for fn in js["functions"]:
if fn["name"] not in known_functions:
known_functions[fn["name"]] = fn
for st in js["structs"]:
if st["name"] not in known_structs:
known_structs[st["name"]] = st
for e in js['enums']:
if e['name'] and e['values']:
print("class "+e['name']+"(int):")
print(f' """{e['description']}."""')
for value in e['values']:
print(" "+value['name']+" = "+str(value['value']))
print("")
def ctype_to_python_type(t):
if t == '_Bool':
return "bool"
elif t == 'void':
return 'None'
elif t == "long":
return "int"
elif t == "unsigned long long":
return "int"
elif t == "uint64_t":
return "int"
elif t == "short":
return "int"
elif t == "unsigned short":
return "int"
elif t == "double":
return "float"
elif "char * *" in t:
return "list[str]"
elif "char *" in t:
return "str"
elif t == "char":
return "str" # not sure about this one
elif t == "unsigned char":
return "int"
elif "*" in t:
return "Any"
elif "[" in t:
return "list" # TODO FIXME type of items in the list
elif t.startswith("struct"):
return t.replace("struct ", "")
elif t.startswith("unsigned"):
return t.replace("unsigned ", "")
elif t.startswith("enum"):
return t.replace("enum ", "")
else:
return t
print("""from typing import Any
from warnings import deprecated
import _cffi_backend # type: ignore
ffi: _cffi_backend.FFI
PhysicsShapeType = int
""")
# These words can be used for c arg names, but not in python
reserved_words = ("in", "list", "tuple", "set", "dict", "from", "range", "min", "max", "any", "all", "len")
for name, attr in getmembers(rl):
uname = _underscore(name)
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
json_object = known_functions.get(name, None)
if json_object is None:
# this is _not_ an exported function from raylib, raymath, rlgl raygui or physac
# so we don't want it in the pyray API
continue
sig = ""
for i, arg in enumerate(ffi.typeof(attr).args):
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
"_pointer").replace(
" ", "") + "_" + str(i)
if 'params' in json_object:
p = json_object['params']
param_name = list(p)[i]['name']
# don't use a python reserved word:
if param_name in reserved_words:
param_name = param_name + "_" + str(i)
param_type = ctype_to_python_type(arg.cname)
if "struct" in arg.cname:
param_type += "|list|tuple"
sig += f"{param_name}: {param_type},"
return_type = ffi.typeof(attr).result.cname
description = attr.__doc__
if 'description' in json_object:
description = json_object['description']
if 'physics' in uname:
print('@deprecated("Raylib no longer recommends the use of Physac library")')
print(f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:')
print(f' """{description}."""')
print(f' ...')
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
return_type = ffi.typeof(attr).result.cname
print(
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
else:
# print("*****", str(type(attr)))
t = str(type(attr))[8:-2] # this isolates the type
if t != "int":
print(f"{name}: {t}")
for struct in ffi.list_types()[0]:
print("processing", struct, file=sys.stderr)
if ffi.typeof(struct).kind == "struct":
json_object = known_structs.get(struct, None)
if json_object is None:
# this is _not_ an exported struct from raylib, raymath, rlgl raygui or physac
# so we don't want it in the pyray API
continue
if ffi.typeof(struct).fields is None:
print("weird empty struct, skipping " + struct, file=sys.stderr)
continue
print(f"class {struct}:")
print(f' """{known_structs[struct]['description']}."""')
sig = ""
for arg in ffi.typeof(struct).fields:
ptype = ctype_to_python_type(arg[1].type.cname)
if arg[1].type.kind == "struct":
ptype += "|list|tuple"
sig += f", {arg[0]}: {ptype}|None = None"
print(f" def __init__(self{sig}):")
for arg in ffi.typeof(struct).fields:
print(f" self.{arg[0]}:{ctype_to_python_type(arg[1].type.cname)} = {arg[0]} # type: ignore")
# elif ffi.typeof(struct).kind == "enum":
# print(f"{struct}: int")
else:
print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
print("""
LIGHTGRAY : Color
GRAY : Color
DARKGRAY : Color
YELLOW : Color
GOLD : Color
ORANGE : Color
PINK : Color
RED : Color
MAROON : Color
GREEN : Color
LIME : Color
DARKGREEN : Color
SKYBLUE : Color
BLUE : Color
DARKBLUE : Color
PURPLE : Color
VIOLET : Color
DARKPURPLE : Color
BEIGE : Color
BROWN : Color
DARKBROWN : Color
WHITE : Color
BLACK : Color
BLANK : Color
MAGENTA : Color
RAYWHITE : Color
""")

186
create_stub_static.py Normal file
View file

@ -0,0 +1,186 @@
# Copyright (c) 2021 Richard Smith and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# licenses when the conditions for such availability set forth in the Eclipse
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
# with the GNU Classpath Exception which is
# available at https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
from pathlib import Path
from raylib import rl, ffi
from inspect import ismethod, getmembers, isbuiltin
import inflection, sys, json
known_functions = {}
known_structs = {}
for filename in (Path("raylib.json"), Path("raymath.json"), Path("rlgl.json"), Path("raygui.json"), Path("physac.json"),
Path("glfw3.json")):
f = open(filename, "r")
js = json.load(f)
for fn in js["functions"]:
if fn["name"] not in known_functions:
known_functions[fn["name"]] = fn
for st in js["structs"]:
if st["name"] not in known_structs:
known_structs[st["name"]] = st
def ctype_to_python_type(t):
if t == '_Bool':
return "bool"
elif t == 'void':
return 'None'
elif t == "long":
return "int"
elif t == "unsigned long long":
return "int"
elif t == "uint64_t":
return "int"
elif t == "short":
return "int"
elif t == "unsigned short":
return "int"
elif t == "double":
return "float"
elif "char * *" in t:
return "list[bytes]"
elif "char *" in t:
return "bytes"
elif "char" in t:
return "bytes" # not sure about this one
elif "*" in t:
return "Any"
elif "[" in t:
return "list" # TODO FIXME type of items in the list
elif t.startswith("struct"):
return t.replace("struct ", "")
elif t.startswith("unsigned"):
return t.replace("unsigned ", "")
elif t.startswith("enum"):
return t.replace("enum ", "")
else:
return t
print("""from typing import Any
from warnings import deprecated
import _cffi_backend # type: ignore
ffi: _cffi_backend.FFI
rl: _cffi_backend.Lib
PhysicsShapeType = int
class struct: ...
""")
# These words can be used for c arg names, but not in python
reserved_words = ("in", "list", "tuple", "set", "dict", "from", "range", "min", "max", "any", "all", "len")
for name, attr in getmembers(rl):
uname = name
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>":
json_object = known_functions.get(name, {})
sig = ""
for i, arg in enumerate(ffi.typeof(attr).args):
if ")(" in arg.cname:
# fn signature in arg types
param_name = str(arg.cname).split("(", 1)[0] + "_callback_" + str(i)
else:
param_name = arg.cname.replace("struct", "").replace("char *", "str").replace("*",
"_pointer").replace(" ",
"") + "_" + str(
i)
if 'params' in json_object:
p = json_object['params']
# print("param_name: ", param_name, "i", i, "params: ",p,file=sys.stderr)
param_name = list(p)[i]['name']
# don't use a python reserved word:
if param_name in reserved_words:
param_name = param_name + "_" + str(i)
param_type = ctype_to_python_type(arg.cname)
if "struct" in arg.cname:
param_type += "|list|tuple"
sig += f"{param_name}: {param_type},"
return_type = ffi.typeof(attr).result.cname
description = attr.__doc__
if 'description' in json_object:
description = json_object['description']
if 'Physics' in uname:
print('@deprecated("Raylib no longer recommends the use of Physac library")')
print(f'def {uname}({sig}) -> {ctype_to_python_type(return_type)}:')
print(f' """{description}."""')
print(f' ...')
elif str(type(attr)) == "<class '_cffi_backend._CDataBase'>":
return_type = ffi.typeof(attr).result.cname
print(
f'def {uname}(*args) -> {ctype_to_python_type(return_type)}:\n """VARARG FUNCTION - MAY NOT BE SUPPORTED BY CFFI"""\n ...')
else:
# print("*****", str(type(attr)))
print(f"{name}: {str(type(attr))[8:-2]}") # this isolates the type
for struct in ffi.list_types()[0]:
print("processing", struct, file=sys.stderr)
if ffi.typeof(struct).kind == "struct":
# if ffi.typeof(struct).fields is None:
# print("weird empty struct, skipping", file=sys.stderr)
# continue
print(f"class {struct}:")
# sig = ""
fields = ffi.typeof(struct).fields
if fields is not None:
#print(ffi.typeof(struct).fields)
#print(f" {arg}: {arg}")
# print(f" def __init__(self{sig}):")
#
for arg in ffi.typeof(struct).fields:
print(f" {arg[0]}: {ctype_to_python_type(arg[1].type.cname)}")
else:
print(" ...")
# print(f" self.{arg[0]}={arg[0]}")
elif ffi.typeof(struct).kind == "enum":
print(f"{struct} = int")
else:
print("WARNING: SKIPPING UNKNOWN TYPE", ffi.typeof(struct), file=sys.stderr)
print("""
LIGHTGRAY : Color
GRAY : Color
DARKGRAY : Color
YELLOW : Color
GOLD : Color
ORANGE : Color
PINK : Color
RED : Color
MAROON : Color
GREEN : Color
LIME : Color
DARKGREEN : Color
SKYBLUE : Color
BLUE : Color
DARKBLUE : Color
PURPLE : Color
VIOLET : Color
DARKPURPLE : Color
BEIGE : Color
BROWN : Color
DARKBROWN : Color
WHITE : Color
BLACK : Color
BLANK : Color
MAGENTA : Color
RAYWHITE : Color
""")

1
docs-src/BUILDING.rst Symbolic link
View file

@ -0,0 +1 @@
../BUILDING.rst

20
docs-src/Makefile Normal file
View file

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

1
docs-src/README.md Symbolic link
View file

@ -0,0 +1 @@
../README.md

1
docs-src/RPI.rst Symbolic link
View file

@ -0,0 +1 @@
../RPI.rst

1
docs-src/_config.yml Normal file
View file

@ -0,0 +1 @@
theme: jekyll-theme-cayman

65
docs-src/conf.py Normal file
View file

@ -0,0 +1,65 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('../'))
# -- Project information -----------------------------------------------------
project = 'Raylib Python'
copyright = '2021, Richard Smith'
author = 'Richard Smith'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'myst_parser', 'autoapi.extension', "sphinx_rtd_theme", 'sphinx.ext.todo']
autoapi_dirs = ['../raylib', '../pyray']
autoapi_file_patterns = ['*.pyi', '*.py']
autoapi_generate_api_docs = False
autosummary_generate = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
pygments_style = 'sphinx'
todo_include_todos = True

1
docs-src/dynamic.rst Symbolic link
View file

@ -0,0 +1 @@
../dynamic/README.rst

25
docs-src/index.rst Normal file
View file

@ -0,0 +1,25 @@
.. RL Zero documentation master file, created by
sphinx-quickstart on Mon Jul 12 14:03:57 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Raylib Python
===================================
.. toctree::
:maxdepth: 1
:caption: Contents:
README
pyray
raylib
dynamic
BUILDING
RPI
* :ref:`search`

35
docs-src/make.bat Normal file
View file

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

68
docs-src/pyray.rst Normal file
View file

@ -0,0 +1,68 @@
Python API
==============
This is a wrapper around the C API with some syntactic sugar.
The API is *still the same as Raylib*, so you should still reply on:
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
The *differences* are:
* the function names are in **snake_case**.
* Some string and pointer conversions are handled automatically.
* There are some helper functions to create structures.
Examples
--------
Example program:
.. code-block::
import pyray as pr
pr.init_window(800, 450, "Hello Pyray")
pr.set_target_fps(60)
camera = pr.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
while not pr.window_should_close():
pr.update_camera(camera, pr.CAMERA_ORBITAL)
pr.begin_drawing()
pr.clear_background(pr.RAYWHITE)
pr.begin_mode_3d(camera)
pr.draw_grid(20, 1.0)
pr.end_mode_3d()
pr.draw_text("Hello world", 190, 200, 20, pr.VIOLET)
pr.end_drawing()
pr.close_window()
.. tip:: New in 3.7.0.post9:
You can also now import the functions with no prefix:
.. code-block::
from pyray import *
init_window(800, 450, "Raylib texture test")
...
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
API reference
-------------
.. autoapimodule:: pyray
:members:
:undoc-members:

63
docs-src/raylib.rst Normal file
View file

@ -0,0 +1,63 @@
C API
=============
The goal of the C API is make usage as similar to the original C as CFFI will allow.
So the `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
are very, very similar to the C originals.
Example program:
.. code-block::
from raylib import *
InitWindow(800, 450, b"Hello Raylib")
SetTargetFPS(60)
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
while not WindowShouldClose():
UpdateCamera(camera, CAMERA_ORBITAL)
BeginDrawing()
ClearBackground(RAYWHITE)
BeginMode3D(camera[0])
DrawGrid(20, 1.0)
EndMode3D()
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
EndDrawing()
CloseWindow()
If you want to be more portable (i.e. same code will work with dynamic bindings) you can prefix the functions like this:
.. code-block::
from raylib import ffi, rl, colors
rl.InitWindow(800, 450, b"Hello Raylib")
rl.SetTargetFPS(60)
...
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
.. important:: Your **primary reference** should always be
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
However, here is a list of available functions:
Functions API reference
-----------------------
.. autoapimodule:: raylib
:members:
:undoc-members:

View file

@ -0,0 +1 @@
myst_parser

4
docs/.buildinfo Normal file
View file

@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f2032a6434b52f7c68551d0ad70d555b
tags: 645f666f9bcd5a90fca523b33c5a78b7

0
docs/.nojekyll Normal file
View file

310
docs/BUILDING.html Normal file
View file

@ -0,0 +1,310 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Building from source &mdash; Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Raspberry Pi" href="RPI.html" />
<link rel="prev" title="Dynamic Bindings" href="dynamic.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Raylib Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#backends">Backends</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Building from source</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#have-pip-build-from-source">Have Pip build from source</a></li>
<li class="toctree-l2"><a class="reference internal" href="#or-build-from-source-manually">Or, Build from source manually</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#windows-manual-build">Windows manual build</a></li>
<li class="toctree-l3"><a class="reference internal" href="#linux-manual-build">Linux manual build</a></li>
<li class="toctree-l3"><a class="reference internal" href="#macos-manual-build">Macos manual build</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Raylib Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Building from source</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/BUILDING.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="building-from-source">
<h1>Building from source<a class="headerlink" href="#building-from-source" title="Link to this heading"></a></h1>
<section id="have-pip-build-from-source">
<h2>Have Pip build from source<a class="headerlink" href="#have-pip-build-from-source" title="Link to this heading"></a></h2>
<p>This is useful if the binaries dont work on your system, or you want to use a newer version of Raylib.</p>
<p>First make sure Raylib is installed. On Linux/Mac it must include the pkg-config files. Best way to ensure this
is to compile and install Raylib using CMake: <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake">https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake</a></p>
<p>Requirements for build: cmake, pkg-config.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="mf">5.0</span>
<span class="n">mkdir</span> <span class="n">build</span>
<span class="n">cd</span> <span class="n">build</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
<span class="n">make</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
</pre></div>
</div>
<p>Then ask Pip to build from source:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="n">raylib</span>
</pre></div>
</div>
</section>
<section id="or-build-from-source-manually">
<h2>Or, Build from source manually<a class="headerlink" href="#or-build-from-source-manually" title="Link to this heading"></a></h2>
<p>Useful if the Pip build doesnt work and you want to debug it, or you want to contribute to the
project.</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>If the Pip build doesnt work, please submit a bug. (And if you have
fixed it, a PR.)</p>
</div>
<p>Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
at <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml">https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml</a></p>
<section id="windows-manual-build">
<h3>Windows manual build<a class="headerlink" href="#windows-manual-build" title="Link to this heading"></a></h3>
<p>Clone this repo including submodules so you get correct version of
Raylib.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
</pre></div>
</div>
<p>Open Visual C++ command shell.</p>
<p>Fix the symlink that doesnt work on Windows</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
<span class="n">copy</span> <span class="n">raylib</span><span class="o">-</span><span class="n">c</span>\<span class="n">src</span>\<span class="n">raylib</span><span class="o">.</span><span class="n">h</span> <span class="n">raylib</span>\<span class="n">raylib</span><span class="o">.</span><span class="n">h</span>
</pre></div>
</div>
<p>Build and install Raylib from the raylib-c directory.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">c</span>
<span class="n">mkdir</span> <span class="n">build</span>
<span class="n">cd</span> <span class="n">build</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
<span class="n">msbuild</span> <span class="n">raylib</span><span class="o">.</span><span class="n">sln</span> <span class="o">/</span><span class="n">target</span><span class="p">:</span><span class="n">raylib</span> <span class="o">/</span><span class="nb">property</span><span class="p">:</span><span class="n">Configuration</span><span class="o">=</span><span class="n">Release</span>
<span class="n">copy</span> <span class="n">raylib</span>\<span class="n">Release</span>\<span class="n">raylib</span><span class="o">.</span><span class="n">lib</span> <span class="o">..</span>\<span class="o">..</span>
<span class="n">cd</span> <span class="o">..</span>\<span class="o">..</span>
</pre></div>
</div>
<p>To build a binary wheel distribution:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rmdir</span> <span class="o">/</span><span class="n">Q</span> <span class="o">/</span><span class="n">S</span> <span class="n">build</span>
<span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
<span class="n">pip3</span> <span class="n">install</span> <span class="n">wheel</span>
<span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
</pre></div>
</div>
<div class="admonition-todo admonition" id="id1">
<p class="admonition-title">Todo</p>
<p>Theres a hardcoded path (to the raylib header files) in <cite>raylib/build.py</cite> you will probably need to edit.
Would be useful if some Windows user could figure out how to auto detect this.</p>
</div>
<p>Then install it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span>\<span class="n">raylib</span><span class="o">-</span><span class="mf">3.7.0</span><span class="o">-</span><span class="n">cp37</span><span class="o">-</span><span class="n">cp37m</span><span class="o">-</span><span class="n">win_amd64</span><span class="o">.</span><span class="n">whl</span>
</pre></div>
</div>
<p>(Note: your wheels filename will probably be different than the one
here.)</p>
</section>
<section id="linux-manual-build">
<h3>Linux manual build<a class="headerlink" href="#linux-manual-build" title="Link to this heading"></a></h3>
<p>Clone this repo including submodules so you get correct version of
Raylib.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
</pre></div>
</div>
<p>Build and install Raylib from the raylib-c directory.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>You can instead use a different version of Raylib you installed from elsewhere, and it should still
work!</p>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">install</span> <span class="n">cmake</span> <span class="n">libasound2</span><span class="o">-</span><span class="n">dev</span> <span class="n">mesa</span><span class="o">-</span><span class="n">common</span><span class="o">-</span><span class="n">dev</span> <span class="n">libx11</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxrandr</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxi</span><span class="o">-</span><span class="n">dev</span> <span class="n">xorg</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgl1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglu1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">pkg</span><span class="o">-</span><span class="n">config</span> <span class="n">cmake</span>
<span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">c</span>
<span class="n">mkdir</span> <span class="n">build</span>
<span class="n">cd</span> <span class="n">build</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Optional: Build the Raylib shared libs, if you plan to use
<code class="docutils literal notranslate"><span class="pre">raylib_dynamic</span></code> binding.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="o">*</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DBUILD_SHARED_LIBS</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
<span class="n">make</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
</pre></div>
</div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">../..</span>
</pre></div>
</div>
<p>Build the Python library:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
<span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="n">build</span> <span class="n">raylib</span><span class="o">/</span><span class="n">_raylib_cffi</span><span class="o">.*</span>
<span class="n">python3</span> <span class="n">raylib</span><span class="o">/</span><span class="n">build</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>(Optional) To update the Linux dynamic libs (names will be different on other platforms):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rm</span> <span class="n">dynamic</span><span class="o">/</span><span class="n">raylib</span><span class="o">/*.</span><span class="n">so</span><span class="o">*</span>
<span class="n">cp</span> <span class="o">-</span><span class="n">P</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.</span><span class="n">so</span><span class="o">*</span> <span class="n">dynamic</span><span class="o">/</span><span class="n">raylib</span><span class="o">/</span>
</pre></div>
</div>
</div>
<p>To build a binary wheel distribution:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">wheel</span>
<span class="n">python3</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">bdist_wheel</span>
</pre></div>
</div>
<p>Then install it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">dist</span><span class="o">/</span><span class="n">raylib</span><span class="o">*.</span><span class="n">whl</span>
</pre></div>
</div>
<p>To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">./</span><span class="n">raylib</span><span class="o">/</span><span class="n">build_multi</span><span class="o">.</span><span class="n">sh</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>pypi wont accept Linux packages unless they are built
<code class="docutils literal notranslate"><span class="pre">--plat-name</span> <span class="pre">manylinux2014_x86_64</span></code> so on linux please run
<code class="docutils literal notranslate"><span class="pre">./raylib/build_multi_linux.sh</span></code> )</p>
</div>
<div class="admonition-todo admonition" id="id2">
<p class="admonition-title">Todo</p>
<p>Separate the instructions for preparing the dynamic module
from the instructions for building the static module!</p>
</div>
</section>
<section id="macos-manual-build">
<h3>Macos manual build<a class="headerlink" href="#macos-manual-build" title="Link to this heading"></a></h3>
<p>These instructions have been tested on Macos 10.14.</p>
<p>Clone this repo including submodules so you get correct version of
Raylib.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="o">--</span><span class="n">recurse</span><span class="o">-</span><span class="n">submodules</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">electronstudio</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span>
</pre></div>
</div>
<p>Build and install Raylib from the raylib-c directory.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="n">raylib</span><span class="o">-</span><span class="n">python</span><span class="o">-</span><span class="n">cffi</span><span class="o">/</span><span class="n">raylib</span><span class="o">-</span><span class="n">c</span><span class="o">/</span>
<span class="n">mkdir</span> <span class="n">build</span>
<span class="n">cd</span> <span class="n">build</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">on</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
<span class="n">make</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
<span class="n">cd</span> <span class="o">../..</span>
</pre></div>
</div>
<p>Build and install module.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip3</span> <span class="n">install</span> <span class="n">cffi</span>
<span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="n">build</span> <span class="n">raylib</span><span class="o">/</span><span class="n">_raylib_cffi</span><span class="o">.*</span>
<span class="n">python3</span> <span class="n">raylib</span><span class="o">/</span><span class="n">build</span><span class="o">.</span><span class="n">py</span>
<span class="n">pip3</span> <span class="n">install</span> <span class="n">wheel</span>
<span class="n">python3</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">install</span>
</pre></div>
</div>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="dynamic.html" class="btn btn-neutral float-left" title="Dynamic Bindings" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="RPI.html" class="btn btn-neutral float-right" title="Raspberry Pi" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, Richard Smith.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

449
docs/README.html Normal file
View file

@ -0,0 +1,449 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Bindings for Raylib 5.5 &mdash; Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Python API" href="pyray.html" />
<link rel="prev" title="Raylib Python" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Raylib Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Python Bindings for Raylib 5.5</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#libraries-raymath-raygui-rlgl-physac-and-glfw">Libraries: raymath, raygui, rlgl, physac and GLFW</a></li>
<li class="toctree-l2"><a class="reference internal" href="#backends-desktop-sdl-drm-web">Backends: Desktop, SDL, DRM, Web</a></li>
<li class="toctree-l2"><a class="reference internal" href="#platforms-windows-mac-linux-raspberry-pi-web">Platforms: Windows, Mac, Linux, Raspberry Pi, Web</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#macos">MacOS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#linux">Linux</a></li>
<li class="toctree-l2"><a class="reference internal" href="#raspberry-pi">Raspberry Pi</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#backends">Backends</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#dynamic-binding-version">Dynamic binding version</a></li>
<li class="toctree-l2"><a class="reference internal" href="#sdl-backend">SDL backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="#drm-backend">DRM backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="#problems">Problems?</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#how-to-use">How to use</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API</a></li>
<li class="toctree-l2"><a class="reference internal" href="#if-you-prefer-a-more-pythonistic-api">If you prefer a more Pythonistic API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="#performance">Performance</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#bunnymark">Bunnymark</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="#advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Raylib Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Python Bindings for Raylib 5.5</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/README.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="python-bindings-for-raylib-5-5">
<h1>Python Bindings for Raylib 5.5<a class="headerlink" href="#python-bindings-for-raylib-5-5" title="Link to this heading"></a></h1>
<section id="libraries-raymath-raygui-rlgl-physac-and-glfw">
<h2>Libraries: raymath, raygui, rlgl, physac and GLFW<a class="headerlink" href="#libraries-raymath-raygui-rlgl-physac-and-glfw" title="Link to this heading"></a></h2>
</section>
<section id="backends-desktop-sdl-drm-web">
<h2>Backends: Desktop, SDL, DRM, Web<a class="headerlink" href="#backends-desktop-sdl-drm-web" title="Link to this heading"></a></h2>
</section>
<section id="platforms-windows-mac-linux-raspberry-pi-web">
<h2>Platforms: Windows, Mac, Linux, Raspberry Pi, Web<a class="headerlink" href="#platforms-windows-mac-linux-raspberry-pi-web" title="Link to this heading"></a></h2>
<p><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/raylib" /></p>
<p>Chatroom: <a class="reference external" href="https://discord.gg/fKDwt85aX6">Discord</a></p>
<p>HELP WANTED: <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues/155">writing examples</a></p>
<p>Features:</p>
<ul class="simple">
<li><p>CFFI API static bindings.</p></li>
<li><p>Automatically generated to be as close as possible to
original Raylib.</p></li>
<li><p>Faster, fewer bugs and easier to maintain than ctypes.</p></li>
<li><p>Commercial-friendly license.</p></li>
<li><p>Docstrings and auto-completion.</p></li>
<li><p>Type checking with Mypy</p></li>
</ul>
<p><a class="reference external" href="http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p>
</section>
</section>
<section id="quickstart">
<h1>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib==5.5.0.2</span> <span class="pre">--break-system-packages</span></code></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">pyray</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
<span class="n">init_window</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">450</span><span class="p">,</span> <span class="s2">&quot;Hello&quot;</span><span class="p">)</span>
<span class="k">while</span> <span class="ow">not</span> <span class="n">window_should_close</span><span class="p">():</span>
<span class="n">begin_drawing</span><span class="p">()</span>
<span class="n">clear_background</span><span class="p">(</span><span class="n">WHITE</span><span class="p">)</span>
<span class="n">draw_text</span><span class="p">(</span><span class="s2">&quot;Hello world&quot;</span><span class="p">,</span> <span class="mi">190</span><span class="p">,</span> <span class="mi">200</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="n">VIOLET</span><span class="p">)</span>
<span class="n">end_drawing</span><span class="p">()</span>
<span class="n">close_window</span><span class="p">()</span>
</pre></div>
</div>
</section>
<section id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
<p>If you are on a modern Linux you will probably want to create a venv:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m venv venv
source venv/bin/activate
</pre></div>
</div>
<p>Then make sure you have the latest pip installed:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --upgrade pip
</pre></div>
</div>
<p>Then install</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install setuptools
python3 -m pip install raylib==5.5.0.2
</pre></div>
</div>
<p>On most platforms it should install a binary wheel. If yours isnt available then pip will attempt to build from
source, in which case you will need to have Raylib development libs installed, e.g.
using homebrew, apt, etc.</p>
<section id="windows">
<h2>Windows<a class="headerlink" href="#windows" title="Link to this heading"></a></h2>
<p>Binaries require x64 Windows 10 or newer. (For x86 or older Windows you will have to build from source.)</p>
<p>Use an <a class="reference external" href="https://www.python.org/downloads/windows/">official Windows Python release</a> rather than WSL, MSYS, etc.</p>
</section>
<section id="macos">
<h2>MacOS<a class="headerlink" href="#macos" title="Link to this heading"></a></h2>
<p>Binaries require:</p>
<ul class="simple">
<li><p>arm64 MacOS 14</p></li>
<li><p>x64 MacOS 10.13, or newer.</p></li>
</ul>
<p>Older MacOS requires building from source but this is usually simple:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>brew install pkg-config
brew install raylib
python3 -m pip install raylib==5.5.0.2
</pre></div>
</div>
<p>(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
if you want to test them.)</p>
</section>
<section id="linux">
<h2>Linux<a class="headerlink" href="#linux" title="Link to this heading"></a></h2>
<p>Binaries require OS newer than Ubuntu 2020, x64 or arm64. Otherwise build from source.
(Pip should attempt automatically but will need Raylib itself installed and also pkg-config.)</p>
<p>The arm64 binaries are built on Raspberry Pi arm64 Bullseye with OpenGL 2.0
so may not work on other boards.</p>
</section>
<section id="raspberry-pi">
<h2>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h2>
<p><span class="xref myst">Using on Rasperry Pi</span></p>
</section>
</section>
<section id="backends">
<h1>Backends<a class="headerlink" href="#backends" title="Link to this heading"></a></h1>
<section id="dynamic-binding-version">
<h2>Dynamic binding version<a class="headerlink" href="#dynamic-binding-version" title="Link to this heading"></a></h2>
<p>There is now a separate dynamic version of this binding:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
python3 -m pip install raylib_dynamic
</pre></div>
</div>
<p>It works on some systems where the static version doesnt, <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/dynamic.html">but be sure to read these caveats before using it</a></p>
<p>You cant have multiple raylib packages installed at once.</p>
</section>
<section id="sdl-backend">
<h2>SDL backend<a class="headerlink" href="#sdl-backend" title="Link to this heading"></a></h2>
<p>This is not well tested but has better support for controllers:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
python3 -m pip install raylib_sdl
</pre></div>
</div>
<p>You cant have multiple raylib packages installed at once.</p>
</section>
<section id="drm-backend">
<h2>DRM backend<a class="headerlink" href="#drm-backend" title="Link to this heading"></a></h2>
<p>This uses the Linux framebuffer for devices that dont run X11/Wayland:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip uninstall raylib
python3 -m pip install raylib_drm
</pre></div>
</div>
<p>You cant have multiple raylib packages installed at once.</p>
</section>
<section id="problems">
<h2>Problems?<a class="headerlink" href="#problems" title="Link to this heading"></a></h2>
<p>If it doesnt work, <span class="xref myst">try to build manually.</span>. If that works then <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>
to let us know what you did.</p>
<p>If you need help you can try asking on <a class="reference external" href="https://discord.gg/fKDwt85aX6">our discord</a>. There is also a large <a class="reference external" href="https://discord.gg/raylib">Raylib discord</a>
for issues that are not Python-specific.</p>
<p>If it still doesnt work, <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>.</p>
</section>
</section>
<section id="how-to-use">
<h1>How to use<a class="headerlink" href="#how-to-use" title="Link to this heading"></a></h1>
<p>There are <em>two</em> modules in the raylib package, <code class="docutils literal notranslate"><span class="pre">raylib</span></code> and <code class="docutils literal notranslate"><span class="pre">pyray</span></code>. (There is no separate package for
pyray. Do <em>not</em> <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">pyray</span></code>). You can use either or both:</p>
<section id="if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">
<h2>If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API<a class="headerlink" href="#if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api" title="Link to this heading"></a></h2>
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/raylib.html">the raylib module</a>.</p>
</section>
<section id="if-you-prefer-a-more-pythonistic-api">
<h2>If you prefer a more Pythonistic API<a class="headerlink" href="#if-you-prefer-a-more-pythonistic-api" title="Link to this heading"></a></h2>
<p>Use <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi/pyray.html">the pyray module</a>.</p>
</section>
</section>
<section id="running-in-a-web-browser">
<h1>Running in a web browser<a class="headerlink" href="#running-in-a-web-browser" title="Link to this heading"></a></h1>
<p><a class="reference external" href="https://pypi.org/project/pygbag/">Pygbag</a> &gt;=0.8.7 supports running in a web browser. Usually the latest git version
is recommended.</p>
<p>Make a folder <code class="docutils literal notranslate"><span class="pre">my_project</span></code> with a file <code class="docutils literal notranslate"><span class="pre">main.py</span></code>:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># /// script</span>
<span class="c1"># dependencies = [</span>
<span class="c1"># &quot;cffi&quot;,</span>
<span class="c1"># &quot;raylib&quot;</span>
<span class="c1"># ]</span>
<span class="c1"># ///</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">asyncio</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">platform</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">pyray</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">main</span><span class="p">():</span> <span class="c1"># You MUST have an async main function</span>
<span class="n">init_window</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">500</span><span class="p">,</span> <span class="s2">&quot;Hello&quot;</span><span class="p">)</span>
<span class="n">platform</span><span class="o">.</span><span class="n">window</span><span class="o">.</span><span class="n">window_resize</span><span class="p">()</span> <span class="c1"># You MAY want to add this line</span>
<span class="k">while</span> <span class="ow">not</span> <span class="n">window_should_close</span><span class="p">():</span>
<span class="n">begin_drawing</span><span class="p">()</span>
<span class="n">clear_background</span><span class="p">(</span><span class="n">WHITE</span><span class="p">)</span>
<span class="n">draw_text</span><span class="p">(</span><span class="s2">&quot;Hello world&quot;</span><span class="p">,</span> <span class="mi">190</span><span class="p">,</span> <span class="mi">200</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="n">VIOLET</span><span class="p">)</span>
<span class="n">end_drawing</span><span class="p">()</span>
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># You MUST call this in your main loop</span>
<span class="n">close_window</span><span class="p">()</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">main</span><span class="p">())</span>
</pre></div>
</div>
<p>Then to create the web files and launch a web server:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3.12 -m pip install --user --upgrade pygbag
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my_project
</pre></div>
</div>
<p>Point your browser to http://localhost:8000</p>
<p>Some features may not work, so you can disable them like this:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">platform</span><span class="o">.</span><span class="n">system</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">&quot;Emscripten&quot;</span><span class="p">:</span> <span class="c1"># audio may not work on current version of emscripten</span>
<span class="n">init_audio_device</span><span class="p">()</span>
</pre></div>
</div>
<p>This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
Carefully read all their <a class="reference external" href="https://pygame-web.github.io/">documentation</a>.</p>
<p>It does work for most of <a class="reference external" href="https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/">these examples</a></p>
</section>
<section id="app-showcase">
<h1>App showcase<a class="headerlink" href="#app-showcase" title="Link to this heading"></a></h1>
<p><a class="reference external" href="https://github.com/Emtyloc/tempest-raylib">Tempest-raylib</a></p>
<p><a class="reference external" href="https://github.com/bilbofroggins/KarabinerKeyboard">KarabinerKeyboard</a></p>
<p><a class="reference external" href="https://github.com/Yonokid/PyTaiko">PyTaiko</a></p>
<p><a class="reference external" href="https://github.com/StanislavPetrovV/DOOM-Clone">DOOM-Clone</a></p>
<p><a class="reference external" href="https://github.com/pkulev/tanki">Tanki</a></p>
<p><a class="reference external" href="https://pebaz.itch.io/alloy-bloxel-editor">Alloy Bloxel Editor</a></p>
<p><a class="reference external" href="https://github.com/Miou-zora/Eidolon">Eidolon</a></p>
<p>Add your app here!</p>
</section>
<section id="rlzero">
<h1>RLZero<a class="headerlink" href="#rlzero" title="Link to this heading"></a></h1>
<p>A related library (that is a work in progress!):</p>
<p><a class="reference external" href="https://github.com/electronstudio/rlzero">A simplified API for Raylib for use in education and to enable beginners to create 3d games</a></p>
</section>
<section id="help-wanted">
<h1>Help wanted<a class="headerlink" href="#help-wanted" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p>Converting more examples from C to Python</p></li>
<li><p>Testing on more platforms</p></li>
</ul>
</section>
<section id="license">
<h1>License<a class="headerlink" href="#license" title="Link to this heading"></a></h1>
<p>Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects!</p>
</section>
<section id="performance">
<h1>Performance<a class="headerlink" href="#performance" title="Link to this heading"></a></h1>
<p>If you need more performance, do in this order:</p>
<ol class="arabic simple">
<li><p>Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.</p></li>
<li><p>Every call to C is costly, so its slightly faster if you use Python data structures and functions when calculating
in your update loop
and then only convert them to C data structures when you have to call the C functions for drawing.</p></li>
<li><p>The raylib.* functions are potentially <em>slightly</em> faster than the pyray.* equivalents, so if you need a tiny bit more performance
you can switch your inner loop functions to these.</p></li>
<li><p>There is a version of Python that is faster than Pypy: GraalPy. However its not fully compatible with all Python
packages. It doesnt work with CFFI and so doesnt work with this binding. But it <em>is</em> compatible with the
<em>Java</em> binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib</p></li>
</ol>
<section id="bunnymark">
<h2>Bunnymark<a class="headerlink" href="#bunnymark" title="Link to this heading"></a></h2>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Library</p></th>
<th class="head"><p>Implementation</p></th>
<th class="head"><p>Bunnies (60 FPS)</p></th>
<th class="head"><p>Percentage</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Raylib 5.0</p></td>
<td><p>C</p></td>
<td><p>180000</p></td>
<td><p>100%</p></td>
</tr>
<tr class="row-odd"><td><p>Raylib Python CFFI 5.0.0.2</p></td>
<td><p>Python 3.12</p></td>
<td><p>10500</p></td>
<td><p>5.8%</p></td>
</tr>
<tr class="row-even"><td><p>Raylib Python CFFI 5.0.0.2</p></td>
<td><p>Pypy 3.10</p></td>
<td><p>95000</p></td>
<td><p>53%</p></td>
</tr>
<tr class="row-odd"><td><p>Raylib 3.7</p></td>
<td><p>C</p></td>
<td><p>168100</p></td>
<td><p>100%</p></td>
</tr>
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
<td><p>Pypy 3.7</p></td>
<td><p>33800</p></td>
<td><p>20%</p></td>
</tr>
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
<td><p>Python 3.9</p></td>
<td><p>7700</p></td>
<td><p>4.5%</p></td>
</tr>
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
<td><p>Python 3.9 Nuitka</p></td>
<td><p>8600</p></td>
<td><p>5.1%</p></td>
</tr>
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7 Dynamic</p></td>
<td><p>Python 3.9</p></td>
<td><p>6300</p></td>
<td><p>3.7%</p></td>
</tr>
</tbody>
</table>
<p>See also https://github.com/electronstudio/megabunny/</p>
</section>
</section>
<section id="packaging-your-app">
<h1>Packaging your app<a class="headerlink" href="#packaging-your-app" title="Link to this heading"></a></h1>
<p>You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
</pre></div>
</div>
</section>
<section id="advert">
<h1>Advert<a class="headerlink" href="#advert" title="Link to this heading"></a></h1>
<p><a class="reference external" href="https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git">RetroWar: 8-bit Party Battle</a> is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.</p>
<p><a class="reference external" href="https://github.com/electronstudio/pygame-zero-book">Coding Games With Pygame Zero &amp; Python</a> is
a book for Python beginners.</p>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="index.html" class="btn btn-neutral float-left" title="Raylib Python" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="pyray.html" class="btn btn-neutral float-right" title="Python API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, Richard Smith.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

203
docs/RPI.html Normal file
View file

@ -0,0 +1,203 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Raspberry Pi &mdash; Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Building from source" href="BUILDING.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Raylib Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#backends">Backends</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Raspberry Pi</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#option-1-binary-wheel">Option 1: Binary wheel</a></li>
<li class="toctree-l2"><a class="reference internal" href="#option-2-compile-raylib-from-source-x11-mode">Option 2: Compile Raylib from source X11 mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="#option-3-compile-raylib-from-source-drm-mode">Option 3: Compile Raylib from source DRM mode</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Raylib Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Raspberry Pi</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/RPI.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="raspberry-pi">
<h1>Raspberry Pi<a class="headerlink" href="#raspberry-pi" title="Link to this heading"></a></h1>
<p>Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.</p>
<section id="option-1-binary-wheel">
<h2>Option 1: Binary wheel<a class="headerlink" href="#option-1-binary-wheel" title="Link to this heading"></a></h2>
<p>We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span>
</pre></div>
</div>
<p>Alternatively there is a DRM wheel called <code class="docutils literal notranslate"><span class="pre">raylib_drm</span></code> to use the framebuffer without X11. You cant have both wheels
installed at once.</p>
<p>If it doesnt work, or youre not on Bullseye, or youre 32 bit, you will need to compile your own raylib. See below.
For full instructions on this, see <a class="reference external" href="https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi">https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi</a> . If you need help with this ask Raylib.</p>
</section>
<section id="option-2-compile-raylib-from-source-x11-mode">
<h2>Option 2: Compile Raylib from source X11 mode<a class="headerlink" href="#option-2-compile-raylib-from-source-x11-mode" title="Link to this heading"></a></h2>
<p>This should work for everyone.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">update</span>
<span class="n">sudo</span> <span class="n">apt</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">pip</span> <span class="n">cmake</span> <span class="n">libegl1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgbm</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgles2</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libdrm</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglfw3</span><span class="o">-</span><span class="n">dev</span>
<span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">raysan5</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">git</span> <span class="o">--</span><span class="n">branch</span> <span class="mf">5.0</span> <span class="o">--</span><span class="n">single</span><span class="o">-</span><span class="n">branch</span>
<span class="n">cd</span> <span class="n">raylib</span>
<span class="n">mkdir</span> <span class="n">build</span>
<span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="n">build</span><span class="o">/*</span>
<span class="n">cd</span> <span class="n">build</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DPLATFORM</span><span class="o">=</span><span class="s2">&quot;Desktop&quot;</span> <span class="o">-</span><span class="n">DOPENGL_VERSION</span><span class="o">=</span><span class="mf">2.1</span> <span class="o">-</span><span class="n">DBUILD_EXAMPLES</span><span class="o">=</span><span class="n">OFF</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DWITH_PIC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">..</span>
<span class="n">make</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
<span class="n">sudo</span> <span class="n">cp</span> <span class="o">-</span><span class="n">r</span> <span class="o">../</span><span class="n">src</span><span class="o">/</span><span class="n">external</span><span class="o">/</span><span class="n">glfw</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">GLFW</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">include</span><span class="o">/</span>
</pre></div>
</div>
<p>Then have pip compile and install the wheel:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">setuptools</span>
<span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">5.5.0.0</span>
</pre></div>
</div>
</section>
<section id="option-3-compile-raylib-from-source-drm-mode">
<h2>Option 3: Compile Raylib from source DRM mode<a class="headerlink" href="#option-3-compile-raylib-from-source-drm-mode" title="Link to this heading"></a></h2>
<p>This seems to work on Raspberry Pi 4. Note you must not be running X11 when you run your programs.</p>
<p>If you have ever installed Raylib or raylib-python-cffi before, remove all traces of it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">remove</span> <span class="n">raylib</span> <span class="n">raylib</span><span class="o">-</span><span class="n">dev</span> <span class="n">libraylib</span> <span class="n">libraylib</span><span class="o">-</span><span class="n">dev</span>
<span class="n">sudo</span> <span class="n">rm</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">pkgconfig</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">pc</span>
<span class="n">sudo</span> <span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.*</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">libraylib</span><span class="o">.*</span>
</pre></div>
</div>
<p>Remove all GLFW:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">remove</span> <span class="n">libglfw3</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglfw3</span>
<span class="n">sudo</span> <span class="n">rm</span> <span class="o">-</span><span class="n">rf</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">GLFW</span>
</pre></div>
</div>
<p>Build a shared lib version of Raylib in DRM mode and install to /usr:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span> <span class="n">update</span>
<span class="n">sudo</span> <span class="n">apt</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">pip</span> <span class="n">cmake</span> <span class="n">libegl1</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgbm</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgles2</span><span class="o">-</span><span class="n">mesa</span><span class="o">-</span><span class="n">dev</span> <span class="n">libdrm</span><span class="o">-</span><span class="n">dev</span>
<span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">raysan5</span><span class="o">/</span><span class="n">raylib</span><span class="o">.</span><span class="n">git</span> <span class="o">--</span><span class="n">branch</span> <span class="mf">5.0</span> <span class="o">--</span><span class="n">single</span><span class="o">-</span><span class="n">branch</span>
<span class="n">cd</span> <span class="n">raylib</span>
<span class="n">mkdir</span> <span class="n">build</span>
<span class="n">rm</span> <span class="n">rf</span> <span class="n">build</span><span class="o">/*</span>
<span class="n">cd</span> <span class="n">build</span>
<span class="n">cmake</span> <span class="o">-</span><span class="n">DPLATFORM</span><span class="o">=</span><span class="s2">&quot;DRM&quot;</span> <span class="o">-</span><span class="n">DBUILD_EXAMPLES</span><span class="o">=</span><span class="n">OFF</span> <span class="o">-</span><span class="n">DCUSTOMIZE_BUILD</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_JPG</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DSUPPORT_FILEFORMAT_FLAC</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_BUILD_TYPE</span><span class="o">=</span><span class="n">Release</span> <span class="o">-</span><span class="n">DBUILD_SHARED_LIBS</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DCMAKE_INSTALL_PREFIX</span><span class="p">:</span><span class="n">PATH</span><span class="o">=/</span><span class="n">usr</span> <span class="o">..</span>
<span class="n">make</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
</pre></div>
</div>
<p>Then have pip compile and install the wheel:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">setuptools</span>
<span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">cache</span><span class="o">-</span><span class="nb">dir</span> <span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">binary</span> <span class="n">raylib</span> <span class="o">--</span><span class="n">upgrade</span> <span class="o">--</span><span class="n">force</span><span class="o">-</span><span class="n">reinstall</span> <span class="o">--</span><span class="k">break</span><span class="o">-</span><span class="n">system</span><span class="o">-</span><span class="n">packages</span> <span class="n">raylib</span><span class="o">==</span><span class="mf">5.5.0.0</span>
</pre></div>
</div>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into <code class="docutils literal notranslate"><span class="pre">/opt/vc</span></code> and compiled in Raylib
with <code class="docutils literal notranslate"><span class="pre">PLATFORM_RPI</span></code>) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
require additional linker arguments to be added to <code class="docutils literal notranslate"><span class="pre">build.py</span></code>. Suggest you try <code class="docutils literal notranslate"><span class="pre">PLATFORM_DRM</span></code> instead.</p>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="BUILDING.html" class="btn btn-neutral float-left" title="Building from source" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, Richard Smith.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View file

@ -0,0 +1,221 @@
Building from source
====================
Have Pip build from source
--------------------------
This is useful if the binaries dont work on your system, or you want to use a newer version of Raylib.
First make sure Raylib is installed. On Linux/Mac it must include the pkg-config files. Best way to ensure this
is to compile and install Raylib using CMake: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake
Requirements for build: cmake, pkg-config.
::
cd raylib-5.0
mkdir build
cd build
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
Then ask Pip to build from source:
::
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib
Or, Build from source manually
------------------------------
Useful if the Pip build doesnt work and you want to debug it, or you want to contribute to the
project.
.. attention::
If the Pip build doesnt work, please submit a bug. (And if you have
fixed it, a PR.)
Manual instructions follow, but are probably outdated, so see instead how we actually build the wheels
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml
Windows manual build
~~~~~~~~~~~~~~~~~~~~
Clone this repo including submodules so you get correct version of
Raylib.
::
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Open Visual C++ command shell.
Fix the symlink that doesnt work on Windows
::
cd raylib-python-cffi
copy raylib-c\src\raylib.h raylib\raylib.h
Build and install Raylib from the raylib-c directory.
::
cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..
To build a binary wheel distribution:
::
rmdir /Q /S build
pip3 install cffi
pip3 install wheel
python setup.py bdist_wheel
.. TODO::
There's a hardcoded path (to the raylib header files) in `raylib/build.py` you will probably need to edit.
Would be useful if some Windows user could figure out how to auto detect this.
Then install it:
::
pip3 install dist\raylib-3.7.0-cp37-cp37m-win_amd64.whl
(Note: your wheels filename will probably be different than the one
here.)
Linux manual build
~~~~~~~~~~~~~~~~~~~~~~
Clone this repo including submodules so you get correct version of
Raylib.
::
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Build and install Raylib from the raylib-c directory.
.. note::
You can instead use a different version of Raylib you installed from elsewhere, and it should still
work!
::
sudo apt install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config cmake
cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
sudo make install
.. note:: Optional: Build the Raylib shared libs, if you plan to use
``raylib_dynamic`` binding.
::
rm -rf *
cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
::
cd ../..
Build the Python library:
::
pip3 install cffi
rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
.. note:: (Optional) To update the Linux dynamic libs (names will be different on other platforms):
::
rm dynamic/raylib/*.so*
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/
To build a binary wheel distribution:
::
pip3 install wheel
python3 setup.py bdist_wheel
Then install it:
::
pip3 install dist/raylib*.whl
To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
::
./raylib/build_multi.sh
.. warning::
pypi wont accept Linux packages unless they are built
``--plat-name manylinux2014_x86_64`` so on linux please run
``./raylib/build_multi_linux.sh`` )
.. TODO::
Separate the instructions for preparing the dynamic module
from the instructions for building the static module!
Macos manual build
~~~~~~~~~~~~~~~~~~~~~~
These instructions have been tested on Macos 10.14.
Clone this repo including submodules so you get correct version of
Raylib.
::
git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi
Build and install Raylib from the raylib-c directory.
::
cd raylib-python-cffi/raylib-c/
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
cd ../..
Build and install module.
::
pip3 install cffi
rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
pip3 install wheel
python3 setup.py install

278
docs/_sources/README.md.txt Normal file
View file

@ -0,0 +1,278 @@
# Python Bindings for Raylib 5.5
## Libraries: raymath, raygui, rlgl, physac and GLFW
## Backends: Desktop, SDL, DRM, Web
## Platforms: Windows, Mac, Linux, Raspberry Pi, Web
![PyPI - Downloads](https://img.shields.io/pypi/dm/raylib)
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
HELP WANTED: [writing examples](https://github.com/electronstudio/raylib-python-cffi/issues/155)
Features:
* CFFI API static bindings.
* Automatically generated to be as close as possible to
original Raylib.
* Faster, fewer bugs and easier to maintain than ctypes.
* Commercial-friendly license.
* Docstrings and auto-completion.
* Type checking with Mypy
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
# Quickstart
`pip3 install raylib==5.5.0.2 --break-system-packages`
```python
from pyray import *
init_window(800, 450, "Hello")
while not window_should_close():
begin_drawing()
clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing()
close_window()
```
# Installation
If you are on a modern Linux you will probably want to create a venv:
python3 -m venv venv
source venv/bin/activate
Then make sure you have the latest pip installed:
python3 -m pip install --upgrade pip
Then install
python3 -m pip install setuptools
python3 -m pip install raylib==5.5.0.2
On most platforms it should install a binary wheel. If yours isn't available then pip will attempt to build from
source, in which case you will need to have Raylib development libs installed, e.g.
using homebrew, apt, etc.
## Windows
Binaries require x64 Windows 10 or newer. (For x86 or older Windows you will have to build from source.)
Use an [official Windows Python release](https://www.python.org/downloads/windows/) rather than WSL, MSYS, etc.
## MacOS
Binaries require:
* arm64 MacOS 14
* x64 MacOS 10.13, or newer.
Older MacOS requires building from source but this is usually simple:
brew install pkg-config
brew install raylib
python3 -m pip install raylib==5.5.0.2
(I do have binaries for arm64 MacOS 11, 12 and 13 but I have no way of testing they work, so post an issue
if you want to test them.)
## Linux
Binaries require OS newer than Ubuntu 2020, x64 or arm64. Otherwise build from source.
(Pip should attempt automatically but will need Raylib itself installed and also pkg-config.)
The arm64 binaries are built on Raspberry Pi arm64 Bullseye with OpenGL 2.0
so may not work on other boards.
## Raspberry Pi
[Using on Rasperry Pi](RPI.rst)
# Backends
## Dynamic binding version
There is now a separate dynamic version of this binding:
python3 -m pip uninstall raylib
python3 -m pip install raylib_dynamic
It works on some systems where the static version doesn't, [but be sure to read these caveats before using it](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
You can't have multiple raylib packages installed at once.
## SDL backend
This is not well tested but has better support for controllers:
python3 -m pip uninstall raylib
python3 -m pip install raylib_sdl
You can't have multiple raylib packages installed at once.
## DRM backend
This uses the Linux framebuffer for devices that don't run X11/Wayland:
python3 -m pip uninstall raylib
python3 -m pip install raylib_drm
You can't have multiple raylib packages installed at once.
## Problems?
If it doesn't work, [try to build manually.](BUILDING.rst). If that works then [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues)
to let us know what you did.
If you need help you can try asking on [our discord](https://discord.gg/fKDwt85aX6). There is also a large [Raylib discord](https://discord.gg/raylib)
for issues that are not Python-specific.
If it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
# How to use
There are *two* modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
pyray. Do *not* `pip install pyray`). You can use either or both:
### If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
### If you prefer a more Pythonistic API
Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
# Running in a web browser
[Pygbag](https://pypi.org/project/pygbag/) >=0.8.7 supports running in a web browser. Usually the latest git version
is recommended.
Make a folder `my_project` with a file `main.py`:
```python
# /// script
# dependencies = [
# "cffi",
# "raylib"
# ]
# ///
import asyncio
import platform
from pyray import *
async def main(): # You MUST have an async main function
init_window(500, 500, "Hello")
platform.window.window_resize() # You MAY want to add this line
while not window_should_close():
begin_drawing()
clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing()
await asyncio.sleep(0) # You MUST call this in your main loop
close_window()
asyncio.run(main())
```
Then to create the web files and launch a web server:
python3.12 -m pip install --user --upgrade pygbag
python3.12 -m pygbag --PYBUILD 3.12 --ume_block 0 --template noctx.tmpl --git my_project
Point your browser to http://localhost:8000
Some features may not work, so you can disable them like this:
```python
if platform.system() != "Emscripten": # audio may not work on current version of emscripten
init_audio_device()
```
This is all done by Pygbag rather than by me, so you should probably contact them with any issues.
Carefully read all their [documentation](https://pygame-web.github.io/).
It does work for most of [these examples](https://electronstudio.github.io/raylib-python-cffi-pygbag-examples/)
# App showcase
[Tempest-raylib](https://github.com/Emtyloc/tempest-raylib)
[KarabinerKeyboard](https://github.com/bilbofroggins/KarabinerKeyboard)
[PyTaiko](https://github.com/Yonokid/PyTaiko)
[DOOM-Clone](https://github.com/StanislavPetrovV/DOOM-Clone)
[Tanki](https://github.com/pkulev/tanki)
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
[Eidolon](https://github.com/Miou-zora/Eidolon)
Add your app here!
# RLZero
A related library (that is a work in progress!):
[A simplified API for Raylib for use in education and to enable beginners to create 3d games](https://github.com/electronstudio/rlzero)
# Help wanted
* Converting more examples from C to Python
* Testing on more platforms
# License
Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects!
# Performance
If you need more performance, do in this order:
1. Use Pypy rather than standard CPython. It is much, much faster and will make more difference than any other optimisations you might do.
2. Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating
in your update loop
and then only convert them to C data structures when you have to call the C functions for drawing.
3. The raylib.* functions are potentially *slightly* faster than the pyray.* equivalents, so if you need a tiny bit more performance
you can switch your inner loop functions to these.
4. There is a version of Python that is faster than Pypy: GraalPy. However it's not fully compatible with all Python
packages. It doesn't work with CFFI and so doesn't work with this binding. But it *is* compatible with the
*Java* binding, Jaylib! There is an example of this here: https://github.com/electronstudio/megabunny/tree/master/raylib-python-jaylib
## Bunnymark
| Library | Implementation | Bunnies (60 FPS) | Percentage |
|--------------------------------|-------------------|------------------|------------|
| Raylib 5.0 | C | 180000 | 100% |
| Raylib Python CFFI 5.0.0.2 | Python 3.12 | 10500 | 5.8% |
| Raylib Python CFFI 5.0.0.2 | Pypy 3.10 | 95000 | 53% |
| Raylib 3.7 | C | 168100 | 100% |
| Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
| Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
| Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
| Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
See also https://github.com/electronstudio/megabunny/
# Packaging your app
You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:
pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
# Advert
[RetroWar: 8-bit Party Battle](https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git) is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
[Coding Games With Pygame Zero & Python](https://github.com/electronstudio/pygame-zero-book) is
a book for Python beginners.

97
docs/_sources/RPI.rst.txt Normal file
View file

@ -0,0 +1,97 @@
Raspberry Pi
====================
Please use Raspberry Pi OS Bookworm. Bullseye should also work. Older OSes are not tested.
Option 1: Binary wheel
----------------------
We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11 mode.
::
python -m pip install --break-system-packages raylib
Alternatively there is a DRM wheel called ``raylib_drm`` to use the framebuffer without X11. You can't have both wheels
installed at once.
If it doesn't work, or you're not on Bullseye, or you're 32 bit, you will need to compile your own raylib. See below.
For full instructions on this, see https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi . If you need help with this ask Raylib.
Option 2: Compile Raylib from source X11 mode
---------------------------------------------
This should work for everyone.
::
sudo apt update
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev libglfw3-dev
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
cd raylib
mkdir build
rm -rf build/*
cd build
cmake -DPLATFORM="Desktop" -DOPENGL_VERSION=2.1 -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
sudo cp -r ../src/external/glfw/include/GLFW /usr/local/include/
Then have pip compile and install the wheel:
::
python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.5.0.0
Option 3: Compile Raylib from source DRM mode
---------------------------------------------
This seems to work on Raspberry Pi 4. Note you must not be running X11 when you run your programs.
If you have ever installed Raylib or raylib-python-cffi before, remove all traces of it:
::
sudo apt remove raylib raylib-dev libraylib libraylib-dev
sudo rm /usr/local/lib/pkgconfig/raylib.pc
sudo rm -rf /usr/local/lib/libraylib.* /usr/lib/libraylib.*
Remove all GLFW:
::
sudo apt remove libglfw3-dev libglfw3
sudo rm -rf /usr/local/include/GLFW
Build a shared lib version of Raylib in DRM mode and install to /usr:
::
sudo apt update
sudo apt install python3-pip cmake libegl1-mesa-dev libgbm-dev libgles2-mesa-dev libdrm-dev
git clone https://github.com/raysan5/raylib.git --branch 5.0 --single-branch
cd raylib
mkdir build
rm rf build/*
cd build
cmake -DPLATFORM="DRM" -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
sudo make install
Then have pip compile and install the wheel:
::
python3 -m pip install --break-system-packages setuptools
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.5.0.0
.. attention::
If you intend to use the Broadcom proprietary Open GL ES 2.0 drivers (the ones installed by Raspbian into ``/opt/vc`` and compiled in Raylib
with ``PLATFORM_RPI``) be aware they not work with Bullseye and have not been tested with the bindings. They will probably
require additional linker arguments to be added to ``build.py``. Suggest you try ``PLATFORM_DRM`` instead.

View file

@ -0,0 +1,41 @@
Dynamic Bindings
================
CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module::
python3 -m pip install raylib_dynamic
.. warning::
There have been some weird failures with dynamic bindings and ctypes bindings before and often the
failures are silent
so you don't even know something has gone wrong and you don't get proper stacktraces. Also the static bindings are faster.
Therefore I personally recommend the static ones.
But the dynamic bindings have the advantage that you don't need to compile anything to install. You just need a Raylib DLL.
The API is exactly the same as the static one documented here. (Therefore you can't have both modules installed at once.) The only difference is you can't do::
from raylib import *
Instead you have to do::
from raylib import rl
Then you access the functions with ``rl.`` prefix.
See https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py for an example.
If you use the ``rl.`` prefix then code will work on both static and dynamic bindings.
.. tip::
If you access functions via ``import pyray`` then there is no difference at all, but be warned this hasn't been tested much.
.. note::
Standard Raylib DLLs do not include additional libraries like Raygui, Physac, etc. So these functions won't work.
.. important::
If your system already has the Raylib library installed, you can set the environment variable ``USE_EXTERNAL_RAYLIB`` and it will
always be used instead of the bundled DLLs.

View file

@ -0,0 +1,25 @@
.. RL Zero documentation master file, created by
sphinx-quickstart on Mon Jul 12 14:03:57 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Raylib Python
===================================
.. toctree::
:maxdepth: 1
:caption: Contents:
README
pyray
raylib
dynamic
BUILDING
RPI
* :ref:`search`

View file

@ -0,0 +1,68 @@
Python API
==============
This is a wrapper around the C API with some syntactic sugar.
The API is *still the same as Raylib*, so you should still reply on:
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
The *differences* are:
* the function names are in **snake_case**.
* Some string and pointer conversions are handled automatically.
* There are some helper functions to create structures.
Examples
--------
Example program:
.. code-block::
import pyray as pr
pr.init_window(800, 450, "Hello Pyray")
pr.set_target_fps(60)
camera = pr.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
while not pr.window_should_close():
pr.update_camera(camera, pr.CAMERA_ORBITAL)
pr.begin_drawing()
pr.clear_background(pr.RAYWHITE)
pr.begin_mode_3d(camera)
pr.draw_grid(20, 1.0)
pr.end_mode_3d()
pr.draw_text("Hello world", 190, 200, 20, pr.VIOLET)
pr.end_drawing()
pr.close_window()
.. tip:: New in 3.7.0.post9:
You can also now import the functions with no prefix:
.. code-block::
from pyray import *
init_window(800, 450, "Raylib texture test")
...
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
API reference
-------------
.. autoapimodule:: pyray
:members:
:undoc-members:

View file

@ -0,0 +1,63 @@
C API
=============
The goal of the C API is make usage as similar to the original C as CFFI will allow.
So the `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
are very, very similar to the C originals.
Example program:
.. code-block::
from raylib import *
InitWindow(800, 450, b"Hello Raylib")
SetTargetFPS(60)
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
while not WindowShouldClose():
UpdateCamera(camera, CAMERA_ORBITAL)
BeginDrawing()
ClearBackground(RAYWHITE)
BeginMode3D(camera[0])
DrawGrid(20, 1.0)
EndMode3D()
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
EndDrawing()
CloseWindow()
If you want to be more portable (i.e. same code will work with dynamic bindings) you can prefix the functions like this:
.. code-block::
from raylib import ffi, rl, colors
rl.InitWindow(800, 450, b"Hello Raylib")
rl.SetTargetFPS(60)
...
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
.. important:: Your **primary reference** should always be
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
However, here is a list of available functions:
Functions API reference
-----------------------
.. autoapimodule:: raylib
:members:
:undoc-members:

View file

@ -0,0 +1,123 @@
/* Compatability shim for jQuery and underscores.js.
*
* Copyright Sphinx contributors
* Released under the two clause BSD licence
*/
/**
* small helper function to urldecode strings
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
*/
jQuery.urldecode = function(x) {
if (!x) {
return x
}
return decodeURIComponent(x.replace(/\+/g, ' '));
};
/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;
/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};
/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var bbox = node.parentElement.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this, addItems);
});
}
}
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};
/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}

906
docs/_static/basic.css vendored Normal file
View file

@ -0,0 +1,906 @@
/*
* Sphinx stylesheet -- basic theme.
*/
/* -- main layout ----------------------------------------------------------- */
div.clearer {
clear: both;
}
div.section::after {
display: block;
content: '';
clear: left;
}
/* -- relbar ---------------------------------------------------------------- */
div.related {
width: 100%;
font-size: 90%;
}
div.related h3 {
display: none;
}
div.related ul {
margin: 0;
padding: 0 0 0 10px;
list-style: none;
}
div.related li {
display: inline;
}
div.related li.right {
float: right;
margin-right: 5px;
}
/* -- sidebar --------------------------------------------------------------- */
div.sphinxsidebarwrapper {
padding: 10px 5px 0 10px;
}
div.sphinxsidebar {
float: left;
width: 230px;
margin-left: -100%;
font-size: 90%;
word-wrap: break-word;
overflow-wrap : break-word;
}
div.sphinxsidebar ul {
list-style: none;
}
div.sphinxsidebar ul ul,
div.sphinxsidebar ul.want-points {
margin-left: 20px;
list-style: square;
}
div.sphinxsidebar ul ul {
margin-top: 0;
margin-bottom: 0;
}
div.sphinxsidebar form {
margin-top: 10px;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
div.sphinxsidebar #searchbox form.search {
overflow: hidden;
}
div.sphinxsidebar #searchbox input[type="text"] {
float: left;
width: 80%;
padding: 0.25em;
box-sizing: border-box;
}
div.sphinxsidebar #searchbox input[type="submit"] {
float: left;
width: 20%;
border-left: none;
padding: 0.25em;
box-sizing: border-box;
}
img {
border: 0;
max-width: 100%;
}
/* -- search page ----------------------------------------------------------- */
ul.search {
margin-top: 10px;
}
ul.search li {
padding: 5px 0;
}
ul.search li a {
font-weight: bold;
}
ul.search li p.context {
color: #888;
margin: 2px 0 0 30px;
text-align: left;
}
ul.keywordmatches li.goodmatch a {
font-weight: bold;
}
/* -- index page ------------------------------------------------------------ */
table.contentstable {
width: 90%;
margin-left: auto;
margin-right: auto;
}
table.contentstable p.biglink {
line-height: 150%;
}
a.biglink {
font-size: 1.3em;
}
span.linkdescr {
font-style: italic;
padding-top: 5px;
font-size: 90%;
}
/* -- general index --------------------------------------------------------- */
table.indextable {
width: 100%;
}
table.indextable td {
text-align: left;
vertical-align: top;
}
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {
height: 10px;
}
table.indextable tr.cap {
margin-top: 10px;
background-color: #f2f2f2;
}
img.toggler {
margin-right: 3px;
margin-top: 3px;
cursor: pointer;
}
div.modindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
div.genindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */
div.body {
min-width: 360px;
max-width: 800px;
}
div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
a.headerlink {
visibility: hidden;
}
a:visited {
color: #551A8B;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
div.body p.caption {
text-align: inherit;
}
div.body td {
text-align: left;
}
.first {
margin-top: 0 !important;
}
p.rubric {
margin-top: 30px;
font-weight: bold;
}
img.align-left, figure.align-left, .figure.align-left, object.align-left {
clear: left;
float: left;
margin-right: 1em;
}
img.align-right, figure.align-right, .figure.align-right, object.align-right {
clear: right;
float: right;
margin-left: 1em;
}
img.align-center, figure.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
img.align-default, figure.align-default, .figure.align-default {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-default {
text-align: center;
}
.align-right {
text-align: right;
}
/* -- sidebars -------------------------------------------------------------- */
div.sidebar,
aside.sidebar {
margin: 0 0 0.5em 1em;
border: 1px solid #ddb;
padding: 7px;
background-color: #ffe;
width: 40%;
float: right;
clear: right;
overflow-x: auto;
}
p.sidebar-title {
font-weight: bold;
}
nav.contents,
aside.topic,
div.admonition, div.topic, blockquote {
clear: left;
}
/* -- topics ---------------------------------------------------------------- */
nav.contents,
aside.topic,
div.topic {
border: 1px solid #ccc;
padding: 7px;
margin: 10px 0 10px 0;
}
p.topic-title {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
}
/* -- admonitions ----------------------------------------------------------- */
div.admonition {
margin-top: 10px;
margin-bottom: 10px;
padding: 7px;
}
div.admonition dt {
font-weight: bold;
}
p.admonition-title {
margin: 0px 10px 5px 0px;
font-weight: bold;
}
div.body p.centered {
text-align: center;
margin-top: 25px;
}
/* -- content of sidebars/topics/admonitions -------------------------------- */
div.sidebar > :last-child,
aside.sidebar > :last-child,
nav.contents > :last-child,
aside.topic > :last-child,
div.topic > :last-child,
div.admonition > :last-child {
margin-bottom: 0;
}
div.sidebar::after,
aside.sidebar::after,
nav.contents::after,
aside.topic::after,
div.topic::after,
div.admonition::after,
blockquote::after {
display: block;
content: '';
clear: both;
}
/* -- tables ---------------------------------------------------------------- */
table.docutils {
margin-top: 10px;
margin-bottom: 10px;
border: 0;
border-collapse: collapse;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
table.align-default {
margin-left: auto;
margin-right: auto;
}
table caption span.caption-number {
font-style: italic;
}
table caption span.caption-text {
}
table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px solid #aaa;
}
th {
text-align: left;
padding-right: 5px;
}
table.citation {
border-left: solid 1px gray;
margin-left: 1px;
}
table.citation td {
border-bottom: none;
}
th > :first-child,
td > :first-child {
margin-top: 0px;
}
th > :last-child,
td > :last-child {
margin-bottom: 0px;
}
/* -- figures --------------------------------------------------------------- */
div.figure, figure {
margin: 0.5em;
padding: 0.5em;
}
div.figure p.caption, figcaption {
padding: 0.3em;
}
div.figure p.caption span.caption-number,
figcaption span.caption-number {
font-style: italic;
}
div.figure p.caption span.caption-text,
figcaption span.caption-text {
}
/* -- field list styles ----------------------------------------------------- */
table.field-list td, table.field-list th {
border: 0 !important;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.field-name {
-moz-hyphens: manual;
-ms-hyphens: manual;
-webkit-hyphens: manual;
hyphens: manual;
}
/* -- hlist styles ---------------------------------------------------------- */
table.hlist {
margin: 1em 0;
}
table.hlist td {
vertical-align: top;
}
/* -- object description styles --------------------------------------------- */
.sig {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
}
.sig-name, code.descname {
background-color: transparent;
font-weight: bold;
}
.sig-name {
font-size: 1.1em;
}
code.descname {
font-size: 1.2em;
}
.sig-prename, code.descclassname {
background-color: transparent;
}
.optional {
font-size: 1.3em;
}
.sig-paren {
font-size: larger;
}
.sig-param.n {
font-style: italic;
}
/* C++ specific styling */
.sig-inline.c-texpr,
.sig-inline.cpp-texpr {
font-family: unset;
}
.sig.c .k, .sig.c .kt,
.sig.cpp .k, .sig.cpp .kt {
color: #0033B3;
}
.sig.c .m,
.sig.cpp .m {
color: #1750EB;
}
.sig.c .s, .sig.c .sc,
.sig.cpp .s, .sig.cpp .sc {
color: #067D17;
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
list-style: decimal;
}
ol.loweralpha {
list-style: lower-alpha;
}
ol.upperalpha {
list-style: upper-alpha;
}
ol.lowerroman {
list-style: lower-roman;
}
ol.upperroman {
list-style: upper-roman;
}
:not(li) > ol > li:first-child > :first-child,
:not(li) > ul > li:first-child > :first-child {
margin-top: 0px;
}
:not(li) > ol > li:last-child > :last-child,
:not(li) > ul > li:last-child > :last-child {
margin-bottom: 0px;
}
ol.simple ol p,
ol.simple ul p,
ul.simple ol p,
ul.simple ul p {
margin-top: 0;
}
ol.simple > li:not(:first-child) > p,
ul.simple > li:not(:first-child) > p {
margin-top: 0;
}
ol.simple p,
ul.simple p {
margin-bottom: 0;
}
aside.footnote > span,
div.citation > span {
float: left;
}
aside.footnote > span:last-of-type,
div.citation > span:last-of-type {
padding-right: 0.5em;
}
aside.footnote > p {
margin-left: 2em;
}
div.citation > p {
margin-left: 4em;
}
aside.footnote > p:last-of-type,
div.citation > p:last-of-type {
margin-bottom: 0em;
}
aside.footnote > p:last-of-type:after,
div.citation > p:last-of-type:after {
content: "";
clear: both;
}
dl.field-list {
display: grid;
grid-template-columns: fit-content(30%) auto;
}
dl.field-list > dt {
font-weight: bold;
word-break: break-word;
padding-left: 0.5em;
padding-right: 5px;
}
dl.field-list > dd {
padding-left: 0.5em;
margin-top: 0em;
margin-left: 0em;
margin-bottom: 0em;
}
dl {
margin-bottom: 15px;
}
dd > :first-child {
margin-top: 0px;
}
dd ul, dd table {
margin-bottom: 10px;
}
dd {
margin-top: 3px;
margin-bottom: 10px;
margin-left: 30px;
}
.sig dd {
margin-top: 0px;
margin-bottom: 0px;
}
.sig dl {
margin-top: 0px;
margin-bottom: 0px;
}
dl > dd:last-child,
dl > dd:last-child > :last-child {
margin-bottom: 0;
}
dt:target, span.highlighted {
background-color: #fbe54e;
}
rect.highlighted {
fill: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
}
.versionmodified {
font-style: italic;
}
.system-message {
background-color: #fda;
padding: 5px;
border: 3px solid red;
}
.footnote:target {
background-color: #ffa;
}
.line-block {
display: block;
margin-top: 1em;
margin-bottom: 1em;
}
.line-block .line-block {
margin-top: 0;
margin-bottom: 0;
margin-left: 1.5em;
}
.guilabel, .menuselection {
font-family: sans-serif;
}
.accelerator {
text-decoration: underline;
}
.classifier {
font-style: oblique;
}
.classifier:before {
font-style: normal;
margin: 0 0.5em;
content: ":";
display: inline-block;
}
abbr, acronym {
border-bottom: dotted 1px;
cursor: help;
}
/* -- code displays --------------------------------------------------------- */
pre {
overflow: auto;
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
pre, div[class*="highlight-"] {
clear: both;
}
span.pre {
-moz-hyphens: none;
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
white-space: nowrap;
}
div[class*="highlight-"] {
margin: 1em 0;
}
td.linenos pre {
border: 0;
background-color: transparent;
color: #aaa;
}
table.highlighttable {
display: block;
}
table.highlighttable tbody {
display: block;
}
table.highlighttable tr {
display: flex;
}
table.highlighttable td {
margin: 0;
padding: 0;
}
table.highlighttable td.linenos {
padding-right: 0.5em;
}
table.highlighttable td.code {
flex: 1;
overflow: hidden;
}
.highlight .hll {
display: block;
}
div.highlight pre,
table.highlighttable pre {
margin: 0;
}
div.code-block-caption + div {
margin-top: 0;
}
div.code-block-caption {
margin-top: 1em;
padding: 2px 5px;
font-size: small;
}
div.code-block-caption code {
background-color: transparent;
}
table.highlighttable td.linenos,
span.linenos,
div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
}
div.code-block-caption span.caption-text {
}
div.literal-block-wrapper {
margin: 1em 0;
}
code.xref, a code {
background-color: transparent;
font-weight: bold;
}
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent;
}
.viewcode-link {
float: right;
}
.viewcode-back {
float: right;
font-family: sans-serif;
}
div.viewcode-block:target {
margin: -1px -10px;
padding: 0 10px;
}
/* -- math display ---------------------------------------------------------- */
img.math {
vertical-align: middle;
}
div.body div.math p {
text-align: center;
}
span.eqno {
float: right;
}
span.eqno a.headerlink {
position: absolute;
z-index: 1;
}
div.math:hover a.headerlink {
visibility: visible;
}
/* -- printout stylesheet --------------------------------------------------- */
@media print {
div.document,
div.documentwrapper,
div.bodywrapper {
margin: 0 !important;
width: 100%;
}
div.sphinxsidebar,
div.related,
div.footer,
#top-link {
display: none;
}
}

1
docs/_static/css/badge_only.css vendored Normal file
View file

@ -0,0 +1 @@
.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/_static/css/fonts/lato-bold.woff vendored Normal file

Binary file not shown.

BIN
docs/_static/css/fonts/lato-bold.woff2 vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/_static/css/fonts/lato-normal.woff vendored Normal file

Binary file not shown.

BIN
docs/_static/css/fonts/lato-normal.woff2 vendored Normal file

Binary file not shown.

4
docs/_static/css/theme.css vendored Normal file

File diff suppressed because one or more lines are too long

149
docs/_static/doctools.js vendored Normal file
View file

@ -0,0 +1,149 @@
/*
* Base JavaScript utilities for all Sphinx HTML documentation.
*/
"use strict";
const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([
"TEXTAREA",
"INPUT",
"SELECT",
"BUTTON",
]);
const _ready = (callback) => {
if (document.readyState !== "loading") {
callback();
} else {
document.addEventListener("DOMContentLoaded", callback);
}
};
/**
* Small JavaScript module for the documentation.
*/
const Documentation = {
init: () => {
Documentation.initDomainIndexTable();
Documentation.initOnKeyListeners();
},
/**
* i18n support
*/
TRANSLATIONS: {},
PLURAL_EXPR: (n) => (n === 1 ? 0 : 1),
LOCALE: "unknown",
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext: (string) => {
const translated = Documentation.TRANSLATIONS[string];
switch (typeof translated) {
case "undefined":
return string; // no translation
case "string":
return translated; // translation exists
default:
return translated[0]; // (singular, plural) translation tuple exists
}
},
ngettext: (singular, plural, n) => {
const translated = Documentation.TRANSLATIONS[singular];
if (typeof translated !== "undefined")
return translated[Documentation.PLURAL_EXPR(n)];
return n === 1 ? singular : plural;
},
addTranslations: (catalog) => {
Object.assign(Documentation.TRANSLATIONS, catalog.messages);
Documentation.PLURAL_EXPR = new Function(
"n",
`return (${catalog.plural_expr})`
);
Documentation.LOCALE = catalog.locale;
},
/**
* helper function to focus on search bar
*/
focusSearchBar: () => {
document.querySelectorAll("input[name=q]")[0]?.focus();
},
/**
* Initialise the domain index toggle buttons
*/
initDomainIndexTable: () => {
const toggler = (el) => {
const idNumber = el.id.substr(7);
const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`);
if (el.src.substr(-9) === "minus.png") {
el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`;
toggledRows.forEach((el) => (el.style.display = "none"));
} else {
el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`;
toggledRows.forEach((el) => (el.style.display = ""));
}
};
const togglerElements = document.querySelectorAll("img.toggler");
togglerElements.forEach((el) =>
el.addEventListener("click", (event) => toggler(event.currentTarget))
);
togglerElements.forEach((el) => (el.style.display = ""));
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler);
},
initOnKeyListeners: () => {
// only install a listener if it is really needed
if (
!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
)
return;
document.addEventListener("keydown", (event) => {
// bail for input elements
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
// bail with special keys
if (event.altKey || event.ctrlKey || event.metaKey) return;
if (!event.shiftKey) {
switch (event.key) {
case "ArrowLeft":
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
const prevLink = document.querySelector('link[rel="prev"]');
if (prevLink && prevLink.href) {
window.location.href = prevLink.href;
event.preventDefault();
}
break;
case "ArrowRight":
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
const nextLink = document.querySelector('link[rel="next"]');
if (nextLink && nextLink.href) {
window.location.href = nextLink.href;
event.preventDefault();
}
break;
}
}
// some keyboard layouts may need Shift to get /
switch (event.key) {
case "/":
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
Documentation.focusSearchBar();
event.preventDefault();
}
});
},
};
// quick alias for translations
const _ = Documentation.gettext;
_ready(Documentation.init);

13
docs/_static/documentation_options.js vendored Normal file
View file

@ -0,0 +1,13 @@
const DOCUMENTATION_OPTIONS = {
VERSION: '',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
LINK_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false,
SHOW_SEARCH_SUMMARY: true,
ENABLE_SEARCH_SHORTCUTS: true,
};

BIN
docs/_static/file.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

BIN
docs/_static/fonts/Lato/lato-bold.eot vendored Normal file

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-bold.ttf vendored Normal file

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-bold.woff vendored Normal file

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-bold.woff2 vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-italic.eot vendored Normal file

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-italic.ttf vendored Normal file

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-italic.woff vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-regular.eot vendored Normal file

Binary file not shown.

BIN
docs/_static/fonts/Lato/lato-regular.ttf vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

12
docs/_static/graphviz.css vendored Normal file
View file

@ -0,0 +1,12 @@
/*
* Sphinx stylesheet -- graphviz extension.
*/
img.graphviz {
border: 0;
max-width: 100%;
}
object.graphviz {
max-width: 100%;
}

2
docs/_static/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

1
docs/_static/js/badge_only.js vendored Normal file
View file

@ -0,0 +1 @@
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}});

1
docs/_static/js/theme.js vendored Normal file

File diff suppressed because one or more lines are too long

228
docs/_static/js/versions.js vendored Normal file
View file

@ -0,0 +1,228 @@
const themeFlyoutDisplay = "hidden";
const themeVersionSelector = true;
const themeLanguageSelector = true;
if (themeFlyoutDisplay === "attached") {
function renderLanguages(config) {
if (!config.projects.translations.length) {
return "";
}
// Insert the current language to the options on the selector
let languages = config.projects.translations.concat(config.projects.current);
languages = languages.sort((a, b) => a.language.name.localeCompare(b.language.name));
const languagesHTML = `
<dl>
<dt>Languages</dt>
${languages
.map(
(translation) => `
<dd ${translation.slug == config.projects.current.slug ? 'class="rtd-current-item"' : ""}>
<a href="${translation.urls.documentation}">${translation.language.code}</a>
</dd>
`,
)
.join("\n")}
</dl>
`;
return languagesHTML;
}
function renderVersions(config) {
if (!config.versions.active.length) {
return "";
}
const versionsHTML = `
<dl>
<dt>Versions</dt>
${config.versions.active
.map(
(version) => `
<dd ${version.slug === config.versions.current.slug ? 'class="rtd-current-item"' : ""}>
<a href="${version.urls.documentation}">${version.slug}</a>
</dd>
`,
)
.join("\n")}
</dl>
`;
return versionsHTML;
}
function renderDownloads(config) {
if (!Object.keys(config.versions.current.downloads).length) {
return "";
}
const downloadsNameDisplay = {
pdf: "PDF",
epub: "Epub",
htmlzip: "HTML",
};
const downloadsHTML = `
<dl>
<dt>Downloads</dt>
${Object.entries(config.versions.current.downloads)
.map(
([name, url]) => `
<dd>
<a href="${url}">${downloadsNameDisplay[name]}</a>
</dd>
`,
)
.join("\n")}
</dl>
`;
return downloadsHTML;
}
document.addEventListener("readthedocs-addons-data-ready", function (event) {
const config = event.detail.data();
const flyout = `
<div class="rst-versions" data-toggle="rst-versions" role="note">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: ${config.versions.current.slug}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<div class="injected">
${renderLanguages(config)}
${renderVersions(config)}
${renderDownloads(config)}
<dl>
<dt>On Read the Docs</dt>
<dd>
<a href="${config.projects.current.urls.home}">Project Home</a>
</dd>
<dd>
<a href="${config.projects.current.urls.builds}">Builds</a>
</dd>
<dd>
<a href="${config.projects.current.urls.downloads}">Downloads</a>
</dd>
</dl>
<dl>
<dt>Search</dt>
<dd>
<form id="flyout-search-form">
<input
class="wy-form"
type="text"
name="q"
aria-label="Search docs"
placeholder="Search docs"
/>
</form>
</dd>
</dl>
<hr />
<small>
<span>Hosted by <a href="https://about.readthedocs.org/?utm_source=&utm_content=flyout">Read the Docs</a></span>
</small>
</div>
</div>
`;
// Inject the generated flyout into the body HTML element.
document.body.insertAdjacentHTML("beforeend", flyout);
// Trigger the Read the Docs Addons Search modal when clicking on the "Search docs" input from inside the flyout.
document
.querySelector("#flyout-search-form")
.addEventListener("focusin", () => {
const event = new CustomEvent("readthedocs-search-show");
document.dispatchEvent(event);
});
})
}
if (themeLanguageSelector || themeVersionSelector) {
function onSelectorSwitch(event) {
const option = event.target.selectedIndex;
const item = event.target.options[option];
window.location.href = item.dataset.url;
}
document.addEventListener("readthedocs-addons-data-ready", function (event) {
const config = event.detail.data();
const versionSwitch = document.querySelector(
"div.switch-menus > div.version-switch",
);
if (themeVersionSelector) {
let versions = config.versions.active;
if (config.versions.current.hidden || config.versions.current.type === "external") {
versions.unshift(config.versions.current);
}
const versionSelect = `
<select>
${versions
.map(
(version) => `
<option
value="${version.slug}"
${config.versions.current.slug === version.slug ? 'selected="selected"' : ""}
data-url="${version.urls.documentation}">
${version.slug}
</option>`,
)
.join("\n")}
</select>
`;
versionSwitch.innerHTML = versionSelect;
versionSwitch.firstElementChild.addEventListener("change", onSelectorSwitch);
}
const languageSwitch = document.querySelector(
"div.switch-menus > div.language-switch",
);
if (themeLanguageSelector) {
if (config.projects.translations.length) {
// Add the current language to the options on the selector
let languages = config.projects.translations.concat(
config.projects.current,
);
languages = languages.sort((a, b) =>
a.language.name.localeCompare(b.language.name),
);
const languageSelect = `
<select>
${languages
.map(
(language) => `
<option
value="${language.language.code}"
${config.projects.current.slug === language.slug ? 'selected="selected"' : ""}
data-url="${language.urls.documentation}">
${language.language.name}
</option>`,
)
.join("\n")}
</select>
`;
languageSwitch.innerHTML = languageSelect;
languageSwitch.firstElementChild.addEventListener("change", onSelectorSwitch);
}
else {
languageSwitch.remove();
}
}
});
}
document.addEventListener("readthedocs-addons-data-ready", function (event) {
// Trigger the Read the Docs Addons Search modal when clicking on "Search docs" input from the topnav.
document
.querySelector("[role='search'] input")
.addEventListener("focusin", () => {
const event = new CustomEvent("readthedocs-search-show");
document.dispatchEvent(event);
});
});

192
docs/_static/language_data.js vendored Normal file
View file

@ -0,0 +1,192 @@
/*
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*/
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
/* Non-minified version is copied as a separate JS file, if available */
/**
* Porter Stemmer
*/
var Stemmer = function() {
var step2list = {
ational: 'ate',
tional: 'tion',
enci: 'ence',
anci: 'ance',
izer: 'ize',
bli: 'ble',
alli: 'al',
entli: 'ent',
eli: 'e',
ousli: 'ous',
ization: 'ize',
ation: 'ate',
ator: 'ate',
alism: 'al',
iveness: 'ive',
fulness: 'ful',
ousness: 'ous',
aliti: 'al',
iviti: 'ive',
biliti: 'ble',
logi: 'log'
};
var step3list = {
icate: 'ic',
ative: '',
alize: 'al',
iciti: 'ic',
ical: 'ic',
ful: '',
ness: ''
};
var c = "[^aeiou]"; // consonant
var v = "[aeiouy]"; // vowel
var C = c + "[^aeiouy]*"; // consonant sequence
var V = v + "[aeiou]*"; // vowel sequence
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
var s_v = "^(" + C + ")?" + v; // vowel in stem
this.stemWord = function (w) {
var stem;
var suffix;
var firstch;
var origword = w;
if (w.length < 3)
return w;
var re;
var re2;
var re3;
var re4;
firstch = w.substr(0,1);
if (firstch == "y")
w = firstch.toUpperCase() + w.substr(1);
// Step 1a
re = /^(.+?)(ss|i)es$/;
re2 = /^(.+?)([^s])s$/;
if (re.test(w))
w = w.replace(re,"$1$2");
else if (re2.test(w))
w = w.replace(re2,"$1$2");
// Step 1b
re = /^(.+?)eed$/;
re2 = /^(.+?)(ed|ing)$/;
if (re.test(w)) {
var fp = re.exec(w);
re = new RegExp(mgr0);
if (re.test(fp[1])) {
re = /.$/;
w = w.replace(re,"");
}
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = new RegExp(s_v);
if (re2.test(stem)) {
w = stem;
re2 = /(at|bl|iz)$/;
re3 = new RegExp("([^aeiouylsz])\\1$");
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re2.test(w))
w = w + "e";
else if (re3.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
else if (re4.test(w))
w = w + "e";
}
}
// Step 1c
re = /^(.+?)y$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(s_v);
if (re.test(stem))
w = stem + "i";
}
// Step 2
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step2list[suffix];
}
// Step 3
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step3list[suffix];
}
// Step 4
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
re2 = /^(.+?)(s|t)(ion)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
if (re.test(stem))
w = stem;
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = new RegExp(mgr1);
if (re2.test(stem))
w = stem;
}
// Step 5
re = /^(.+?)e$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
re2 = new RegExp(meq1);
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
w = stem;
}
re = /ll$/;
re2 = new RegExp(mgr1);
if (re.test(w) && re2.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y")
w = firstch.toLowerCase() + w.substr(1);
return w;
}
}

BIN
docs/_static/minus.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

BIN
docs/_static/plus.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

75
docs/_static/pygments.css vendored Normal file
View file

@ -0,0 +1,75 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #eeffcc; }
.highlight .c { color: #408090; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #F00 } /* Error */
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
.highlight .o { color: #666 } /* Operator */
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #007020 } /* Comment.Preproc */
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
.highlight .cs { color: #408090; background-color: #FFF0F0 } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #F00 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #333 } /* Generic.Output */
.highlight .gp { color: #C65D09; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #04D } /* Generic.Traceback */
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #007020 } /* Keyword.Pseudo */
.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #902000 } /* Keyword.Type */
.highlight .m { color: #208050 } /* Literal.Number */
.highlight .s { color: #4070A0 } /* Literal.String */
.highlight .na { color: #4070A0 } /* Name.Attribute */
.highlight .nb { color: #007020 } /* Name.Builtin */
.highlight .nc { color: #0E84B5; font-weight: bold } /* Name.Class */
.highlight .no { color: #60ADD5 } /* Name.Constant */
.highlight .nd { color: #555; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #D55537; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #007020 } /* Name.Exception */
.highlight .nf { color: #06287E } /* Name.Function */
.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
.highlight .nn { color: #0E84B5; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #BB60D5 } /* Name.Variable */
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
.highlight .w { color: #BBB } /* Text.Whitespace */
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
.highlight .mf { color: #208050 } /* Literal.Number.Float */
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
.highlight .mo { color: #208050 } /* Literal.Number.Oct */
.highlight .sa { color: #4070A0 } /* Literal.String.Affix */
.highlight .sb { color: #4070A0 } /* Literal.String.Backtick */
.highlight .sc { color: #4070A0 } /* Literal.String.Char */
.highlight .dl { color: #4070A0 } /* Literal.String.Delimiter */
.highlight .sd { color: #4070A0; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #4070A0 } /* Literal.String.Double */
.highlight .se { color: #4070A0; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #4070A0 } /* Literal.String.Heredoc */
.highlight .si { color: #70A0D0; font-style: italic } /* Literal.String.Interpol */
.highlight .sx { color: #C65D09 } /* Literal.String.Other */
.highlight .sr { color: #235388 } /* Literal.String.Regex */
.highlight .s1 { color: #4070A0 } /* Literal.String.Single */
.highlight .ss { color: #517918 } /* Literal.String.Symbol */
.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #06287E } /* Name.Function.Magic */
.highlight .vc { color: #BB60D5 } /* Name.Variable.Class */
.highlight .vg { color: #BB60D5 } /* Name.Variable.Global */
.highlight .vi { color: #BB60D5 } /* Name.Variable.Instance */
.highlight .vm { color: #BB60D5 } /* Name.Variable.Magic */
.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */

635
docs/_static/searchtools.js vendored Normal file
View file

@ -0,0 +1,635 @@
/*
* Sphinx JavaScript utilities for the full-text search.
*/
"use strict";
/**
* Simple result scoring code.
*/
if (typeof Scorer === "undefined") {
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [docname, title, anchor, descr, score, filename]
// and returns the new score.
/*
score: result => {
const [docname, title, anchor, descr, score, filename, kind] = result
return score
},
*/
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {
0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5, // used to be unimportantResults
},
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
partialTitle: 7,
// query found in terms
term: 5,
partialTerm: 2,
};
}
// Global search result kind enum, used by themes to style search results.
class SearchResultKind {
static get index() { return "index"; }
static get object() { return "object"; }
static get text() { return "text"; }
static get title() { return "title"; }
}
const _removeChildren = (element) => {
while (element && element.lastChild) element.removeChild(element.lastChild);
};
/**
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
*/
const _escapeRegExp = (string) =>
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
const _displayItem = (item, searchTerms, highlightTerms) => {
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
const contentRoot = document.documentElement.dataset.content_root;
const [docName, title, anchor, descr, score, _filename, kind] = item;
let listItem = document.createElement("li");
// Add a class representing the item's type:
// can be used by a theme's CSS selector for styling
// See SearchResultKind for the class names.
listItem.classList.add(`kind-${kind}`);
let requestUrl;
let linkUrl;
if (docBuilder === "dirhtml") {
// dirhtml builder
let dirname = docName + "/";
if (dirname.match(/\/index\/$/))
dirname = dirname.substring(0, dirname.length - 6);
else if (dirname === "index/") dirname = "";
requestUrl = contentRoot + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
requestUrl = contentRoot + docName + docFileSuffix;
linkUrl = docName + docLinkSuffix;
}
let linkEl = listItem.appendChild(document.createElement("a"));
linkEl.href = linkUrl + anchor;
linkEl.dataset.score = score;
linkEl.innerHTML = title;
if (descr) {
listItem.appendChild(document.createElement("span")).innerHTML =
" (" + descr + ")";
// highlight search terms in the description
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
}
else if (showSearchSummary)
fetch(requestUrl)
.then((responseData) => responseData.text())
.then((data) => {
if (data)
listItem.appendChild(
Search.makeSearchSummary(data, searchTerms, anchor)
);
// highlight search terms in the summary
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
});
Search.output.appendChild(listItem);
};
const _finishSearch = (resultCount) => {
Search.stopPulse();
Search.title.innerText = _("Search Results");
if (!resultCount)
Search.status.innerText = Documentation.gettext(
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
);
else
Search.status.innerText = Documentation.ngettext(
"Search finished, found one page matching the search query.",
"Search finished, found ${resultCount} pages matching the search query.",
resultCount,
).replace('${resultCount}', resultCount);
};
const _displayNextItem = (
results,
resultCount,
searchTerms,
highlightTerms,
) => {
// results left, load the summary and display it
// this is intended to be dynamic (don't sub resultsCount)
if (results.length) {
_displayItem(results.pop(), searchTerms, highlightTerms);
setTimeout(
() => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
5
);
}
// search finished, update title and status message
else _finishSearch(resultCount);
};
// Helper function used by query() to order search results.
// Each input is an array of [docname, title, anchor, descr, score, filename, kind].
// Order the results by score (in opposite order of appearance, since the
// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
const _orderResultsByScoreThenName = (a, b) => {
const leftScore = a[4];
const rightScore = b[4];
if (leftScore === rightScore) {
// same score: sort alphabetically
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
};
/**
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
* custom function per language.
*
* The regular expression works by splitting the string on consecutive characters
* that are not Unicode letters, numbers, underscores, or emoji characters.
* This is the same as ``\W+`` in Python, preserving the surrogate pair area.
*/
if (typeof splitQuery === "undefined") {
var splitQuery = (query) => query
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu)
.filter(term => term) // remove remaining empty strings
}
/**
* Search Module
*/
const Search = {
_index: null,
_queued_query: null,
_pulse_status: -1,
htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
for (const removalQuery of [".headerlink", "script", "style"]) {
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
}
if (anchor) {
const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
if (anchorContent) return anchorContent.textContent;
console.warn(
`Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
);
}
// if anchor not specified or not found, fall back to main content
const docContent = htmlElement.querySelector('[role="main"]');
if (docContent) return docContent.textContent;
console.warn(
"Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
);
return "";
},
init: () => {
const query = new URLSearchParams(window.location.search).get("q");
document
.querySelectorAll('input[name="q"]')
.forEach((el) => (el.value = query));
if (query) Search.performSearch(query);
},
loadIndex: (url) =>
(document.body.appendChild(document.createElement("script")).src = url),
setIndex: (index) => {
Search._index = index;
if (Search._queued_query !== null) {
const query = Search._queued_query;
Search._queued_query = null;
Search.query(query);
}
},
hasIndex: () => Search._index !== null,
deferQuery: (query) => (Search._queued_query = query),
stopPulse: () => (Search._pulse_status = -1),
startPulse: () => {
if (Search._pulse_status >= 0) return;
const pulse = () => {
Search._pulse_status = (Search._pulse_status + 1) % 4;
Search.dots.innerText = ".".repeat(Search._pulse_status);
if (Search._pulse_status >= 0) window.setTimeout(pulse, 500);
};
pulse();
},
/**
* perform a search for something (or wait until index is loaded)
*/
performSearch: (query) => {
// create the required interface elements
const searchText = document.createElement("h2");
searchText.textContent = _("Searching");
const searchSummary = document.createElement("p");
searchSummary.classList.add("search-summary");
searchSummary.innerText = "";
const searchList = document.createElement("ul");
searchList.setAttribute("role", "list");
searchList.classList.add("search");
const out = document.getElementById("search-results");
Search.title = out.appendChild(searchText);
Search.dots = Search.title.appendChild(document.createElement("span"));
Search.status = out.appendChild(searchSummary);
Search.output = out.appendChild(searchList);
const searchProgress = document.getElementById("search-progress");
// Some themes don't use the search progress node
if (searchProgress) {
searchProgress.innerText = _("Preparing search...");
}
Search.startPulse();
// index already loaded, the browser was quick!
if (Search.hasIndex()) Search.query(query);
else Search.deferQuery(query);
},
_parseQuery: (query) => {
// stem the search terms and add them to the correct list
const stemmer = new Stemmer();
const searchTerms = new Set();
const excludedTerms = new Set();
const highlightTerms = new Set();
const objectTerms = new Set(splitQuery(query.toLowerCase().trim()));
splitQuery(query.trim()).forEach((queryTerm) => {
const queryTermLower = queryTerm.toLowerCase();
// maybe skip this "word"
// stopwords array is from language_data.js
if (
stopwords.indexOf(queryTermLower) !== -1 ||
queryTerm.match(/^\d+$/)
)
return;
// stem the word
let word = stemmer.stemWord(queryTermLower);
// select the correct list
if (word[0] === "-") excludedTerms.add(word.substr(1));
else {
searchTerms.add(word);
highlightTerms.add(queryTermLower);
}
});
if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js
localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" "))
}
// console.debug("SEARCH: searching for:");
// console.info("required: ", [...searchTerms]);
// console.info("excluded: ", [...excludedTerms]);
return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
},
/**
* execute search (requires search index to be loaded)
*/
_performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const allTitles = Search._index.alltitles;
const indexEntries = Search._index.indexentries;
// Collect multiple result groups to be sorted separately and then ordered.
// Each is an array of [docname, title, anchor, descr, score, filename, kind].
const normalResults = [];
const nonMainIndexResults = [];
_removeChildren(document.getElementById("search-progress"));
const queryLower = query.toLowerCase().trim();
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
const score = Math.round(Scorer.title * queryLower.length / title.length);
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
normalResults.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
null,
score + boost,
filenames[file],
SearchResultKind.title,
]);
}
}
}
// search for explicit entries in index directives
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
for (const [file, id, isMain] of foundEntries) {
const score = Math.round(100 * queryLower.length / entry.length);
const result = [
docNames[file],
titles[file],
id ? "#" + id : "",
null,
score,
filenames[file],
SearchResultKind.index,
];
if (isMain) {
normalResults.push(result);
} else {
nonMainIndexResults.push(result);
}
}
}
}
// lookup as object
objectTerms.forEach((term) =>
normalResults.push(...Search.performObjectSearch(term, objectTerms))
);
// lookup as search terms in fulltext
normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
// let the scorer override scores with a custom scoring function
if (Scorer.score) {
normalResults.forEach((item) => (item[4] = Scorer.score(item)));
nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
}
// Sort each group of results by score and then alphabetically by name.
normalResults.sort(_orderResultsByScoreThenName);
nonMainIndexResults.sort(_orderResultsByScoreThenName);
// Combine the result groups in (reverse) order.
// Non-main index entries are typically arbitrary cross-references,
// so display them after other results.
let results = [...nonMainIndexResults, ...normalResults];
// remove duplicate search results
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
let seen = new Set();
results = results.reverse().reduce((acc, result) => {
let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(',');
if (!seen.has(resultStr)) {
acc.push(result);
seen.add(resultStr);
}
return acc;
}, []);
return results.reverse();
},
query: (query) => {
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
// for debugging
//Search.lastresults = results.slice(); // a copy
// console.info("search results:", Search.lastresults);
// print the results
_displayNextItem(results, results.length, searchTerms, highlightTerms);
},
/**
* search for object names
*/
performObjectSearch: (object, objectTerms) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const objects = Search._index.objects;
const objNames = Search._index.objnames;
const titles = Search._index.titles;
const results = [];
const objectSearchCallback = (prefix, match) => {
const name = match[4]
const fullname = (prefix ? prefix + "." : "") + name;
const fullnameLower = fullname.toLowerCase();
if (fullnameLower.indexOf(object) < 0) return;
let score = 0;
const parts = fullnameLower.split(".");
// check for different match types: exact matches of full name or
// "last name" (i.e. last dotted part)
if (fullnameLower === object || parts.slice(-1)[0] === object)
score += Scorer.objNameMatch;
else if (parts.slice(-1)[0].indexOf(object) > -1)
score += Scorer.objPartialMatch; // matches in last name
const objName = objNames[match[1]][2];
const title = titles[match[0]];
// If more than one term searched for, we require other words to be
// found in the name/title/description
const otherTerms = new Set(objectTerms);
otherTerms.delete(object);
if (otherTerms.size > 0) {
const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase();
if (
[...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0)
)
return;
}
let anchor = match[3];
if (anchor === "") anchor = fullname;
else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname;
const descr = objName + _(", in ") + title;
// add custom score for some objects according to scorer
if (Scorer.objPrio.hasOwnProperty(match[2]))
score += Scorer.objPrio[match[2]];
else score += Scorer.objPrioDefault;
results.push([
docNames[match[0]],
fullname,
"#" + anchor,
descr,
score,
filenames[match[0]],
SearchResultKind.object,
]);
};
Object.keys(objects).forEach((prefix) =>
objects[prefix].forEach((array) =>
objectSearchCallback(prefix, array)
)
);
return results;
},
/**
* search for full-text terms in the index
*/
performTermsSearch: (searchTerms, excludedTerms) => {
// prepare search
const terms = Search._index.terms;
const titleTerms = Search._index.titleterms;
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const scoreMap = new Map();
const fileMap = new Map();
// perform the search on the required terms
searchTerms.forEach((word) => {
const files = [];
// find documents, if any, containing the query word in their text/title term indices
// use Object.hasOwnProperty to avoid mismatching against prototype properties
const arr = [
{ files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term },
{ files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title },
];
// add support for partial matches
if (word.length > 2) {
const escapedWord = _escapeRegExp(word);
if (!terms.hasOwnProperty(word)) {
Object.keys(terms).forEach((term) => {
if (term.match(escapedWord))
arr.push({ files: terms[term], score: Scorer.partialTerm });
});
}
if (!titleTerms.hasOwnProperty(word)) {
Object.keys(titleTerms).forEach((term) => {
if (term.match(escapedWord))
arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
});
}
}
// no match but word was a required one
if (arr.every((record) => record.files === undefined)) return;
// found search word in contents
arr.forEach((record) => {
if (record.files === undefined) return;
let recordFiles = record.files;
if (recordFiles.length === undefined) recordFiles = [recordFiles];
files.push(...recordFiles);
// set score for the word in each file
recordFiles.forEach((file) => {
if (!scoreMap.has(file)) scoreMap.set(file, new Map());
const fileScores = scoreMap.get(file);
fileScores.set(word, record.score);
});
});
// create the mapping
files.forEach((file) => {
if (!fileMap.has(file)) fileMap.set(file, [word]);
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
});
});
// now check if the files don't contain excluded terms
const results = [];
for (const [file, wordList] of fileMap) {
// check if all requirements are matched
// as search terms with length < 3 are discarded
const filteredTermCount = [...searchTerms].filter(
(term) => term.length > 2
).length;
if (
wordList.length !== searchTerms.size &&
wordList.length !== filteredTermCount
)
continue;
// ensure that none of the excluded terms is in the search result
if (
[...excludedTerms].some(
(term) =>
terms[term] === file ||
titleTerms[term] === file ||
(terms[term] || []).includes(file) ||
(titleTerms[term] || []).includes(file)
)
)
break;
// select one (max) score for the file.
const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w)));
// add result to the result list
results.push([
docNames[file],
titles[file],
"",
null,
score,
filenames[file],
SearchResultKind.text,
]);
}
return results;
},
/**
* helper function to return a node containing the
* search summary for a given text. keywords is a list
* of stemmed words.
*/
makeSearchSummary: (htmlText, keywords, anchor) => {
const text = Search.htmlToText(htmlText, anchor);
if (text === "") return null;
const textLower = text.toLowerCase();
const actualStartPosition = [...keywords]
.map((k) => textLower.indexOf(k.toLowerCase()))
.filter((i) => i > -1)
.slice(-1)[0];
const startWithContext = Math.max(actualStartPosition - 120, 0);
const top = startWithContext === 0 ? "" : "...";
const tail = startWithContext + 240 < text.length ? "..." : "";
let summary = document.createElement("p");
summary.classList.add("context");
summary.textContent = top + text.substr(startWithContext, 240).trim() + tail;
return summary;
},
};
_ready(Search.init);

154
docs/_static/sphinx_highlight.js vendored Normal file
View file

@ -0,0 +1,154 @@
/* Highlighting utilities for Sphinx HTML documentation. */
"use strict";
const SPHINX_HIGHLIGHT_ENABLED = true
/**
* highlight a given string on a node by wrapping it in
* span elements with the given class name.
*/
const _highlight = (node, addItems, text, className) => {
if (node.nodeType === Node.TEXT_NODE) {
const val = node.nodeValue;
const parent = node.parentNode;
const pos = val.toLowerCase().indexOf(text);
if (
pos >= 0 &&
!parent.classList.contains(className) &&
!parent.classList.contains("nohighlight")
) {
let span;
const closestNode = parent.closest("body, svg, foreignObject");
const isInSVG = closestNode && closestNode.matches("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.classList.add(className);
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
const rest = document.createTextNode(val.substr(pos + text.length));
parent.insertBefore(
span,
parent.insertBefore(
rest,
node.nextSibling
)
);
node.nodeValue = val.substr(0, pos);
/* There may be more occurrences of search term in this node. So call this
* function recursively on the remaining fragment.
*/
_highlight(rest, addItems, text, className);
if (isInSVG) {
const rect = document.createElementNS(
"http://www.w3.org/2000/svg",
"rect"
);
const bbox = parent.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute("class", className);
addItems.push({ parent: parent, target: rect });
}
}
} else if (node.matches && !node.matches("button, select, textarea")) {
node.childNodes.forEach((el) => _highlight(el, addItems, text, className));
}
};
const _highlightText = (thisNode, text, className) => {
let addItems = [];
_highlight(thisNode, addItems, text, className);
addItems.forEach((obj) =>
obj.parent.insertAdjacentElement("beforebegin", obj.target)
);
};
/**
* Small JavaScript module for the documentation.
*/
const SphinxHighlight = {
/**
* highlight the search words provided in localstorage in the text
*/
highlightSearchWords: () => {
if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight
// get and clear terms from localstorage
const url = new URL(window.location);
const highlight =
localStorage.getItem("sphinx_highlight_terms")
|| url.searchParams.get("highlight")
|| "";
localStorage.removeItem("sphinx_highlight_terms")
url.searchParams.delete("highlight");
window.history.replaceState({}, "", url);
// get individual terms from highlight string
const terms = highlight.toLowerCase().split(/\s+/).filter(x => x);
if (terms.length === 0) return; // nothing to do
// There should never be more than one element matching "div.body"
const divBody = document.querySelectorAll("div.body");
const body = divBody.length ? divBody[0] : document.querySelector("body");
window.setTimeout(() => {
terms.forEach((term) => _highlightText(body, term, "highlighted"));
}, 10);
const searchBox = document.getElementById("searchbox");
if (searchBox === null) return;
searchBox.appendChild(
document
.createRange()
.createContextualFragment(
'<p class="highlight-link">' +
'<a href="javascript:SphinxHighlight.hideSearchWords()">' +
_("Hide Search Matches") +
"</a></p>"
)
);
},
/**
* helper function to hide the search marks again
*/
hideSearchWords: () => {
document
.querySelectorAll("#searchbox .highlight-link")
.forEach((el) => el.remove());
document
.querySelectorAll("span.highlighted")
.forEach((el) => el.classList.remove("highlighted"));
localStorage.removeItem("sphinx_highlight_terms")
},
initEscapeListener: () => {
// only install a listener if it is really needed
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return;
document.addEventListener("keydown", (event) => {
// bail for input elements
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
// bail with special keys
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;
if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) {
SphinxHighlight.hideSearchWords();
event.preventDefault();
}
});
},
};
_ready(() => {
/* Do not call highlightSearchWords() when we are on the search page.
* It will highlight words from the *previous* search query.
*/
if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords();
SphinxHighlight.initEscapeListener();
});

163
docs/dynamic.html Normal file
View file

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dynamic Bindings &mdash; Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Building from source" href="BUILDING.html" />
<link rel="prev" title="C API" href="raylib.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Raylib Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#backends">Backends</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Dynamic Bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Raylib Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Dynamic Bindings</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/dynamic.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="dynamic-bindings">
<h1>Dynamic Bindings<a class="headerlink" href="#dynamic-bindings" title="Link to this heading"></a></h1>
<p>CFFI ABI dynamic bindings avoid the need to compile a C extension module. They now been moved to a separate module:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">raylib_dynamic</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>There have been some weird failures with dynamic bindings and ctypes bindings before and often the
failures are silent
so you dont even know something has gone wrong and you dont get proper stacktraces. Also the static bindings are faster.
Therefore I personally recommend the static ones.
But the dynamic bindings have the advantage that you dont need to compile anything to install. You just need a Raylib DLL.</p>
</div>
<p>The API is exactly the same as the static one documented here. (Therefore you cant have both modules installed at once.) The only difference is you cant do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">raylib</span><span class="w"> </span><span class="kn">import</span> <span class="o">*</span>
</pre></div>
</div>
<p>Instead you have to do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">raylib</span><span class="w"> </span><span class="kn">import</span> <span class="n">rl</span>
</pre></div>
</div>
<p>Then you access the functions with <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix.</p>
<p>See <a class="reference external" href="https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py">https://github.com/electronstudio/raylib-python-cffi/blob/master/dynamic/test_dynamic.py</a> for an example.</p>
<p>If you use the <code class="docutils literal notranslate"><span class="pre">rl.</span></code> prefix then code will work on both static and dynamic bindings.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>If you access functions via <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">pyray</span></code> then there is no difference at all, but be warned this hasnt been tested much.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Standard Raylib DLLs do not include additional libraries like Raygui, Physac, etc. So these functions wont work.</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>If your system already has the Raylib library installed, you can set the environment variable <code class="docutils literal notranslate"><span class="pre">USE_EXTERNAL_RAYLIB</span></code> and it will
always be used instead of the bundled DLLs.</p>
</div>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="raylib.html" class="btn btn-neutral float-left" title="C API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="BUILDING.html" class="btn btn-neutral float-right" title="Building from source" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, Richard Smith.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

11317
docs/genindex.html Normal file

File diff suppressed because it is too large Load diff

151
docs/index.html Normal file
View file

@ -0,0 +1,151 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Raylib Python &mdash; Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=4ae1632d" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Python Bindings for Raylib 5.5" href="README.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="#" class="icon icon-home">
Raylib Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#backends">Backends</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="#">Raylib Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="#" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Raylib Python</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="raylib-python">
<h1>Raylib Python<a class="headerlink" href="#raylib-python" title="Link to this heading"></a></h1>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Python Bindings for Raylib 5.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#backends">Backends</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#how-to-use">How to use</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#running-in-a-web-browser">Running in a web browser</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#performance">Performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="README.html#advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="raylib.html">C API</a></li>
<li class="toctree-l1"><a class="reference internal" href="dynamic.html">Dynamic Bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="BUILDING.html">Building from source</a></li>
<li class="toctree-l1"><a class="reference internal" href="RPI.html">Raspberry Pi</a></li>
</ul>
</div>
<ul class="simple">
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="README.html" class="btn btn-neutral float-right" title="Python Bindings for Raylib 5.5" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, Richard Smith.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

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