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
This commit is contained in:
parent
d28fa38e9f
commit
9e5c9b7f9f
46 changed files with 4069 additions and 1472 deletions
|
@ -38,7 +38,7 @@ project.
|
|||
If the Pip build doesn’t work, please submit a bug. (And if you have
|
||||
fixed it, a PR.)
|
||||
|
||||
Manual instructions follow, but may be outdated, so see also how we actually build the wheels
|
||||
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
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Python Bindings for Raylib 5.0
|
||||
# Python Bindings for Raylib 5.5
|
||||
## Libraries: raymath, raygui, rlgl, physac and GLFW
|
||||
## Backends: Desktop, SDL, DRM, Web
|
||||
|
||||
Chatroom: [Discord](https://discord.gg/fKDwt85aX6) or [Matrix](https://matrix.to/#/#raylib-python-cffi:matrix.org)
|
||||
Chatroom: [Discord](https://discord.gg/fKDwt85aX6)
|
||||
|
||||
New CFFI API static bindings.
|
||||
* Automatically generated to be as close as possible to
|
||||
|
@ -8,23 +10,23 @@ original Raylib.
|
|||
* Faster, fewer bugs and easier to maintain than ctypes.
|
||||
* Commercial-friendly license.
|
||||
* Docstrings and auto-completion.
|
||||
* **Now includes extra libraries: raymath, raygui, rlgl, physac and GLFW**
|
||||
|
||||
|
||||
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
|
||||
|
||||
# Quickstart
|
||||
|
||||
`pip3 install raylib`
|
||||
|
||||
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()
|
||||
|
||||
`pip3 install raylib==5.0.0.4`
|
||||
```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
|
||||
|
||||
|
@ -35,13 +37,41 @@ First make sure you have the latest pip installed:
|
|||
Then install
|
||||
|
||||
python3 -m pip install setuptools
|
||||
python3 -m pip install raylib
|
||||
python3 -m pip install raylib==5.0.0.4
|
||||
|
||||
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 12 x64/arm64, Linux Ubuntu2004 x64/arm64).
|
||||
|
||||
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.
|
||||
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.0.0.4
|
||||
|
||||
(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)
|
||||
|
@ -50,38 +80,52 @@ using homebrew, apt, etc.
|
|||
|
||||
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)
|
||||
|
||||
## Beta testing
|
||||
## SDL backend
|
||||
|
||||
If you find a bug, it may be fixed in the [latest dev release](https://github.com/electronstudio/raylib-python-cffi/releases).
|
||||
You can install an alpha or beta version by specifying the exact version number like this:
|
||||
This is not well tested but has better support for controllers:
|
||||
|
||||
python3 -m pip install raylib==4.2.0.0.dev4
|
||||
python3 -m pip uninstall raylib
|
||||
python3 -m pip install raylib_sdl
|
||||
|
||||
You can't have multiple raylib packages installed at once.
|
||||
|
||||
## DRM backend
|
||||
|
||||
This uses the Linux framebuffer for devices that don't run X11/Wayland:
|
||||
|
||||
python3 -m pip uninstall raylib
|
||||
python3 -m pip install raylib_drm
|
||||
|
||||
You can't have multiple raylib packages installed at once.
|
||||
|
||||
## Problems?
|
||||
|
||||
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 Discord](https://discord.gg/raylib).
|
||||
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 APIs, you can use either or both:
|
||||
There are two modules in the raylib package, `raylib` and `pyray`. (There is no separate package for
|
||||
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 C API](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||
Use [the raylib module](https://electronstudio.github.io/raylib-python-cffi/raylib.html).
|
||||
|
||||
### If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower
|
||||
### If you prefer a more Pythonistic API
|
||||
|
||||
Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||
Use [the pyray module](https://electronstudio.github.io/raylib-python-cffi/pyray.html).
|
||||
|
||||
# Running in a web browser
|
||||
|
||||
|
@ -143,9 +187,9 @@ A related library (that is a work in progress!):
|
|||
* Converting more examples from C to Python
|
||||
* Testing on more platforms
|
||||
|
||||
# License (updated)
|
||||
# License
|
||||
|
||||
The bindings are now under the Eclipse Public License, so you are free to
|
||||
Eclipse Public License, so you are free to
|
||||
statically link and use in non-free / proprietary / commercial projects!
|
||||
|
||||
# Performance
|
||||
|
|
|
@ -12,7 +12,10 @@ We have published binary wheels compiled for 64-bit Raspberry OS Bullseye in X11
|
|||
|
||||
python -m pip install --break-system-packages raylib
|
||||
|
||||
If it doesn't work, or you're not on Bullseye, or you're 32 bit, or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib. See below.
|
||||
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
|
||||
|
@ -39,7 +42,7 @@ 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.0.0.3
|
||||
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.4
|
||||
|
||||
Option 3: Compile Raylib from source DRM mode
|
||||
---------------------------------------------
|
||||
|
@ -82,7 +85,7 @@ 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.0.0.3
|
||||
python3 -m pip install --no-cache-dir --no-binary raylib --upgrade --force-reinstall --break-system-packages raylib==5.0.0.4
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ Example program:
|
|||
init_window(800, 450, "Raylib texture test")
|
||||
...
|
||||
|
||||
(You don't need to use the PyRay() class anymore.)
|
||||
|
||||
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
|
||||
|
||||
|
|
Reference in a new issue