fix warning on linux builds and update docs

This commit is contained in:
richard 2022-08-11 22:10:15 +01:00
parent 3e011b329a
commit 3ac76b8aaa
32 changed files with 27346 additions and 21511 deletions

View file

@ -9,9 +9,11 @@ This is useful if the binaries dont work on your system, or you want to use a
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-4.0.0
cd raylib-4.2.0
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
@ -113,7 +115,7 @@ Build and install Raylib from the raylib-c directory.
::
sudo apt install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
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
@ -135,7 +137,7 @@ Build and install Raylib from the raylib-c directory.
cd ../..
Build
Build the Python library:
::
@ -217,37 +219,3 @@ Build and install module.
python3 setup.py install
Raspberry Pi
~~~~~~~~~~~~
Latest info: https://github.com/electronstudio/raylib-python-cffi/issues/55#issuecomment-1012629701
Old possibly out of date info that was written for RPi3 and Raylib 3 follows.
The integrated GPU hardware in a Raspberry Pi (“VideoCore”) is rather
idiosyncratic, resulting in a complex set of software options. Probably
the most interesting two options for Raylib applications are:
1. Use the Broadcom proprietary Open GL ES 2.0 drivers, installed by
Raspbian into ``/opt/vc``. These are 32-bit only, and currently X11
doesnt use these for its acceleration, so this is most suitable for
driving the entire HDMI output from one application with minimal
overhead (no X11).
2. Use the more recent open-source ``vc4-fkms-v3d`` kernel driver. This
can run in either 32-bit or 64-bit, and X11 can use these, so using
X11 is probably the more common choice here.
With option 2, the regular linux install instructions above should
probably work as-is.
For option 1, then also follow the above instructions, but with these
modifications:
- With ``cmake``, use
``cmake -DWITH_PIC=on -DSTATIC=on -DSHARED=on -DPLATFORM='Raspberry Pi' ..``
(See
`here <https://github.com/electronstudio/raylib-python-cffi/issues/31#issuecomment-862078330>`__
for a Raspberry Pi wheel)

View file

@ -1,4 +1,4 @@
# Python Bindings for Raylib 4.0.0
# Python Bindings for Raylib 4.2
New CFFI API static bindings.
* Automatically generated to be as close as possible to
@ -6,7 +6,7 @@ original Raylib.
* Faster, fewer bugs and easier to maintain than ctypes.
* Commercial-friendly license.
* Docstrings and auto-completion.
* **Now includes extra libraries: raygui, rlgl and physac**
* **Now includes extra libraries: raymath, raygui, rlgl and physac**
[Full documentation](http://electronstudio.github.io/raylib-python-cffi)
@ -39,7 +39,9 @@ On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15
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.
[If it doesn't work, you can build manually.](BUILDING.rst)
## Raspberry Pi
[Using on Rasperry Pi](RPI.rst)
## Dynamic binding version
@ -47,13 +49,23 @@ There is now a separate dynamic version of this binding:
python3 -m pip install raylib_dynamic
[Read this before using raylib_dynamic](https://electronstudio.github.io/raylib-python-cffi/dynamic.html)
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
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:
python3 -m pip install raylib==4.0a6
python3 -m pip install raylib==4.2.0.0.dev4
## 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 it still doesn't work, [submit an issue](https://github.com/electronstudio/raylib-python-cffi/issues).
# How to use
@ -72,6 +84,8 @@ Use [the Python API](https://electronstudio.github.io/raylib-python-cffi/pyray.h
[Tanki](https://github.com/pkulev/tanki)
[Alloy Bloxel Editor](https://pebaz.itch.io/alloy-bloxel-editor)
Add your app here!
# RLZero

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

@ -0,0 +1,34 @@
Raspberry Pi
====================
Please use Raspberry Pi OS Bullseye. Older OSes are not tested.
We have published a binary wheel using Raylib in X11 mode. This *should* install and work on Bullseye
with
::
python3 -m pip install raylib==4.2.0.0.dev1
If it doesn't work, or we haven't published a binary wheel for the latest version,
or if you want to use Raylib in ``PLATFORM_DRM`` mode, you will need to compile your own raylib
and have pip compile the wheel.
::
git clone https://github.com/raysan5/raylib.git
cd raylib
mkdir build
cd build
cmake -DPLATFORM="DRM" -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install
pip3 install --no-binary raylib --upgrade --force-reinstall raylib==4.2.0.0.dev2
(or newer version)
.. attention::
The Broadcom proprietary Open GL ES 2.0 drivers (installed by Raspbian into ``/opt/vc`` and compiled in Raylib
with ``PLATFORM_RPI``) do 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 use ``PLATFORM_DRM`` instead.

View file

@ -13,7 +13,7 @@ CFFI ABI dynamic bindings avoid the need to compile a C extension module. They
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.
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::
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 *
@ -31,6 +31,9 @@ If you use the ``rl.`` prefix then code will work on both static and dynamic bin
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::

View file

@ -15,6 +15,7 @@ Raylib Python
raylib
dynamic
BUILDING
RPI
* :ref:`search`

View file

@ -1,18 +1,18 @@
Python API
==============
.. comment::
Link to API reference:
toctree::
:maxdepth: 1
autoapi/pyray/index
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 official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_, except:
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**.
@ -20,6 +20,9 @@ The API is *still the same as Raylib*, so you should still reply on `the officia
* There are some helper functions to create structures.
Examples
--------
Example program:
.. code-block::
@ -54,9 +57,10 @@ Example program:
init_window(800, 450, "Raylib texture test")
...
You don't need to use the PyRay() class anymore.
(You don't need to use the PyRay() class anymore.)
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/tests/test_pyray.py
API reference
-------------

View file

@ -1,7 +1,8 @@
C API
=============
The goal of the C API is make usage as similar to the original C as CFFI will allow. The `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
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:
@ -39,11 +40,16 @@ If you want to be more portable (i.e. same code will work with dynamic bindings)
...
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/tests/test_static.py
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
.. important:: Your **primary reference** should always be `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
.. 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: