Skip to content

Commit 3e011b3

Browse files
update to raylib 4.2
1 parent 3a6deb2 commit 3e011b3

19 files changed

+78
-49
lines changed

docs-src/RPI.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../RPI.rst

docs-src/pyray.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,26 @@ Python API
33

44
This is a wrapper around the C API with some syntactic sugar.
55

6-
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:
6+
The API is *still the same as Raylib*, so you should still reply on:
7+
8+
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
9+
10+
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
11+
12+
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
13+
14+
15+
The *differences* are:
716

817
* the function names are in **snake_case**.
918

1019
* Some string and pointer conversions are handled automatically.
1120

1221
* There are some helper functions to create structures.
1322

23+
Examples
24+
--------
25+
1426
Example program:
1527

1628
.. code-block::
@@ -45,9 +57,10 @@ Example program:
4557
init_window(800, 450, "Raylib texture test")
4658
...
4759
48-
You don't need to use the PyRay() class anymore.
60+
(You don't need to use the PyRay() class anymore.)
61+
62+
`See all examples here <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
4963

50-
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/tests/test_pyray.py
5164

5265
API reference
5366
-------------

docs-src/raylib.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
C API
22
=============
33

4-
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>`_
4+
The goal of the C API is make usage as similar to the original C as CFFI will allow.
5+
So the `example programs <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
56
are very, very similar to the C originals.
67

78
Example program:
@@ -39,11 +40,16 @@ If you want to be more portable (i.e. same code will work with dynamic bindings)
3940
...
4041
4142
42-
See also https://github.com/electronstudio/raylib-python-cffi/blob/master/tests/test_static.py
4343
4444
.. note:: Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
4545

46-
.. important:: Your **primary reference** should always be `the official Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
46+
.. important:: Your **primary reference** should always be
47+
48+
* `the C Raylib docs <https://www.raylib.com/cheatsheet/cheatsheet.html>`_
49+
50+
* `the C Raylib examples <https://github.com/electronstudio/raylib-python-cffi/tree/master/examples>`_
51+
52+
* `the C Raylib header file <https://github.com/raysan5/raylib/blob/master/src/raylib.h>`_
4753

4854
However, here is a list of available functions:
4955

dynamic/raylib/defines.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import raylib
2+
3+
MOUSE_LEFT_BUTTON = raylib.MOUSE_BUTTON_LEFT
4+
MOUSE_RIGHT_BUTTON = raylib.MOUSE_BUTTON_RIGHT
5+
MOUSE_MIDDLE_BUTTON = raylib.MOUSE_BUTTON_MIDDLE
6+
MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
7+
MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
8+
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
9+
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS

dynamic/raylib/libraylib.dylib

1.31 MB
Binary file not shown.

dynamic/raylib/libraylib.so

270 KB
Binary file not shown.

dynamic/raylib/raylib.dll

109 KB
Binary file not shown.

pyray/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414

1515
from raylib import rl, ffi
1616
from raylib.colors import *
17-
from raylib.defines import *
17+
try:
18+
from raylib.defines import *
19+
except AttributeError:
20+
print("sorry deprecated enums dont work on dynamic version")
1821

1922

2023
from inspect import ismethod,getmembers,isbuiltin

pyray/__init__.pyi

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def pointer(struct):
55
...
66

77
def attach_audio_stream_processor(stream: AudioStream,processor: Any,) -> None:
8-
""""""
8+
"""Attach audio stream processor to stream"""
99
...
1010
def begin_blend_mode(mode: int,) -> None:
1111
"""Begin blending mode (alpha, additive, multiplied, subtract, custom)"""
@@ -143,7 +143,7 @@ def destroy_physics_body(PhysicsBodyData_pointer_0: Any,) -> None:
143143
CFFI C function from raylib._raylib_cffi.lib"""
144144
...
145145
def detach_audio_stream_processor(stream: AudioStream,processor: Any,) -> None:
146-
""""""
146+
"""Detach audio stream processor from stream"""
147147
...
148148
def directory_exists(dirPath: str,) -> bool:
149149
"""Check if a directory path exists"""
@@ -492,9 +492,6 @@ def gen_image_gradient_v(width: int,height: int,top: Color,bottom: Color,) -> Im
492492
def gen_image_white_noise(width: int,height: int,factor: float,) -> Image:
493493
"""Generate image: white noise"""
494494
...
495-
def gen_mesh_binormals(mesh: Any,) -> None:
496-
"""Compute mesh binormals"""
497-
...
498495
def gen_mesh_cone(radius: float,height: float,slices: int,) -> Mesh:
499496
"""Generate cone/pyramid mesh"""
500497
...
@@ -1415,9 +1412,6 @@ def load_sound(fileName: str,) -> Sound:
14151412
def load_sound_from_wave(wave: Wave,) -> Sound:
14161413
"""Load sound from wave data"""
14171414
...
1418-
def load_storage_value(position: int,) -> int:
1419-
"""Load integer value from storage file (from defined position)"""
1420-
...
14211415
def load_texture(fileName: str,) -> Texture:
14221416
"""Load texture from file into GPU memory (VRAM)"""
14231417
...
@@ -1755,9 +1749,6 @@ def save_file_data(fileName: str,data: Any,bytesToWrite: int,) -> bool:
17551749
def save_file_text(fileName: str,text: str,) -> bool:
17561750
"""Save text data to file (write), string must be '\0' terminated, returns true on success"""
17571751
...
1758-
def save_storage_value(position: int,value: int,) -> bool:
1759-
"""Save integer value to storage file (to defined position), returns true on success"""
1760-
...
17611752
def seek_music_stream(music: Music,position: float,) -> None:
17621753
"""Seek music to a position (in seconds)"""
17631754
...
@@ -2372,6 +2363,11 @@ CFFI C function from raylib._raylib_cffi.lib"""
23722363
def vector3_refract(Vector3_0: Vector3,Vector3_1: Vector3,float_2: float,) -> Vector3:
23732364
"""struct Vector3 Vector3Refract(struct Vector3, struct Vector3, float);
23742365
2366+
CFFI C function from raylib._raylib_cffi.lib"""
2367+
...
2368+
def vector3_rotate_by_axis_angle(Vector3_0: Vector3,Vector3_1: Vector3,float_2: float,) -> Vector3:
2369+
"""struct Vector3 Vector3RotateByAxisAngle(struct Vector3, struct Vector3, float);
2370+
23752371
CFFI C function from raylib._raylib_cffi.lib"""
23762372
...
23772373
def vector3_rotate_by_quaternion(Vector3_0: Vector3,Vector4_1: Vector4,) -> Vector3:

0 commit comments

Comments
 (0)