No description
This repository has been archived on 2025-06-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Find a file
Electron Studio c019d59298 linux build
2019-05-21 20:57:50 +01:00
examples/models heightmap example 2019-05-21 12:12:03 +01:00
raylib linux build 2019-05-21 20:57:50 +01:00
.gitignore put binary in git 2019-05-21 12:04:11 +01:00
LICENSE Initial commit 2019-05-21 10:53:59 +01:00
MANIFEST.in initial 2019-05-21 10:56:31 +01:00
README.md oops 2019-05-21 17:53:45 +01:00
setup.py initial 2019-05-21 10:56:31 +01:00
test_dynamic.py nonworking dynamic bindings 2019-05-21 17:51:54 +01:00
test_static.py nonworking dynamic bindings 2019-05-21 17:51:54 +01:00

Python Bindings for Raylib

This uses CFFI API static bindins rather than ctypes. Hopefully this will be faster, the static type knowledge from the C headers will result in fewer bugs, and using the original headers will make it easier to maintain.

Currently the 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. Making a 'Pythonic' library would be an additional layer on top which hasn't been done yet.

See test.py and examples/*.py for how to use.

Platforms tested

  • MacOS 10.12.6

HELP WANTED

  • converting more examples from C to python
  • testing and building on more platforms

Dynamic bindings

I have attempted to do CFFI ABI dynamic bindings too in order to avoid the need to compile a C extension module, but they don't work properly. They fail in the same place the ctypes binding fails, accessing materials of a model, because Python can't dynamically tell the difference between a pointer and an array. There's probably some way to specify this (e.g. in raylib_modified.h) but it's difficult to be sure we fixed them all because the errors are often completely silent.

See test_static.py for the non-working example.