This commit is contained in:
richard 2021-10-04 16:04:56 +01:00
parent 50c2fb12e2
commit 192fca8622
36 changed files with 16053 additions and 3581 deletions

View file

@ -15,9 +15,8 @@ Make sure Raylib is installed and then:
Build from source manually
--------------------------
Useful if the Pip build doesnt work, or you want to contribute to the
project, or you want to skip building the static lib and just *use the
dynamic binding with your own dll*.
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
@ -140,8 +139,8 @@ Build
::
pip3 install cffi
rm -rf build raylib/static/_raylib_cffi.*
python3 raylib/static/build.py
rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
.. note:: (Optional) To update the Linux dynamic libs (names will be different on other platfroms):
@ -168,12 +167,12 @@ To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:
::
./raylib/static/build_multi.sh
./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/static/build_multi_linux.sh`` )
``./raylib/build_multi_linux.sh`` )
.. TODO::
Separate the instructions for preparing the dynamic module
@ -208,8 +207,8 @@ Build and install module.
::
pip3 install cffi
rm -rf build raylib/static/_raylib_cffi.*
python3 raylib/static/build.py
rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
pip3 install wheel
python3 setup.py install

View file

@ -12,20 +12,20 @@ statically link and use in non-free / proprietary / commercial projects!
# Installation
We distribute a statically linked binary Raylib wheel:
python3 -m pip install raylib
Problems may be caused by out of date pip:
If it doesn't work, first make sure you have latest pip installed:
python3 -m pip install --upgrade pip
Some platforms that _should_ be available: Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64.
On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64).
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, build from source](BUILDING.md)
[If it doesn't work, you can build manually.](BUILDING.md)
## Dynamic binding version
There is now a separate dynamic version of this binding:
@ -36,8 +36,7 @@ There is now a separate dynamic version of this binding:
# How to use
There are two different ways of using this binding. You only need to pick one method, but you
can combine two methods in one program if you want to.
There are two APIs, 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
@ -63,7 +62,7 @@ Work in progress:
# Performance
For fastest permformance use Pypy rather than standard python.
For fastest performance use Pypy rather than standard python.
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

View file

@ -21,7 +21,7 @@ Instead you have to do::
from raylib import rl
Then you access the functions with ``rl.`` prefix. See
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.

View file

@ -22,29 +22,28 @@ The API is *still the same as Raylib*, so you should still reply on `the officia
Example program:
.. code-block::
.. code-block::
from raylib.pyray import PyRay
from raylib.colors import *
import raylib
pyray = PyRay()
pr = raylib.PyRay()
pyray.init_window(800, 450, "Hello Pyray")
pyray.set_target_fps(60)
pr.init_window(800, 450, "Hello Pyray")
pr.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)
camera = pr.Camera3D([18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
pr.set_camera_mode(camera, pr.CAMERA_ORBITAL)
while not pyray.window_should_close():
pyray.update_camera(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()
while not pr.window_should_close():
pr.update_camera(camera)
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()
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/test_pyray.py