If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API

If you prefer a slightly more Pythonistic API and don’t mind it might be slightly slower

If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower

CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE (raylib.pyray.PyRay attribute)

CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR (raylib.pyray.PyRay attribute)

PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA (raylib.pyray.PyRay attribute)

PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA (raylib.pyray.PyRay attribute)

PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_GRAYSCALE (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_R32G32B32 (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 (raylib.pyray.PyRay attribute)

PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 (raylib.pyray.PyRay attribute)

set_audio_stream_buffer_size_default() (raylib.pyray.PyRay method)

Separate the instructions for preparing the dynamic module
from the instructions for building the static module!

pip3 install --no-binary raylib --upgrade --force-reinstall raylib

Useful if the Pip build doesn’t work and you want to debug it, or you want to contribute to the
project.

If the Pip build doesn’t work, please submit a bug. (And if you have
fixed it, a PR.)

Manual instructions follow, but see also how we actually build the wheels
at https://github.com/electronstudio/raylib-python-cffi/blob/master/.github/workflows/build.yml

at 

Clone this repo including submodules so you get correct version of
Raylib.

git clone --recurse-submodules https://github.com/electronstudio/raylib-python-cffi

cd raylib-python-cffi
copy raylib-c\src\raylib.h raylib\raylib.h

cd raylib-python-cffi/raylib-c
mkdir build
cd build
cmake -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..

To update the dynamic libs, download the official release,
e.g. https://github.com/raysan5/raylib/releases/download/3.7.0/raylib-3.7.0_win64_msvc16.zip
and extract ``raylib.dll`` into ``dynamic/raylib``.

e.g. 

rmdir /Q /S build
pip3 install cffi
pip3 install wheel
python setup.py bdist_wheel

Alternatively, if you don’t want the static binaries and just want to
use DLLs with raylib.dynamic:

(Note: your wheel’s filename will probably be different than the one
here.)

cd raylib-python-cffi/raylib-c/src
make
sudo cp libraylib.a  /usr/local/lib/libraylib.a
cd ../..

rm -rf build raylib/_raylib_cffi.*
python3 raylib/build.py
python3 setup.py install

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:

Use the Broadcom proprietary Open GL ES 2.0 drivers, installed by
Raspbian into ``/opt/vc``. These are 32-bit only, and currently X11
doesn’t use these for its acceleration, so this is most suitable for
driving the entire HDMI output from one application with minimal
overhead (no X11).

Raspbian into 

. These are 32-bit only, and currently X11

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.

 kernel driver. This

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' ..``

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)

sudo apt install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
cd build
sudo make install

Optional: Build the Raylib shared libs, if you plan to use
``raylib_dynamic`` binding.

::

   rm -rf *
   cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
   make
   sudo make install

rm -rf *
cmake -DWITH_PIC=on -DBUILD_SHARED_LIBS=on -DCMAKE_BUILD_TYPE=Release ..
make

Optional: Make a patched version of raylib header. (**Not necessary** if
you’ve already got raylib_modifed.h from repo and haven’t changed
anything.)

::

   cd raylib
   cp raylib.h raylib_modified.h
   patch  -p0 <raylib_modified.h.patch
   cd ..

 if

cd raylib
cp raylib.h raylib_modified.h
patch  -p0 <raylib_modified.h.patch
cd ..

(Optional) To update the Linux dynamic libs (names will be different on other platfroms):

::

   rm dynamic/raylib/*.so*
   cp -P /usr/local/lib/libraylib.so* dynamic/raylib/

rm dynamic/raylib/*.so*
cp -P /usr/local/lib/libraylib.so* dynamic/raylib/

To build a complete set of libs for Python 3.6, 3.7, 3.8 and 3.9:

pypi wont accept Linux packages unless they are built
``--plat-name manylinux2014_x86_64`` so on linux please run
``./raylib/build_multi_linux.sh`` )

Begin blending mode (alpha, additive, multiplied, subtract, custom)

Check the collision between two lines defined by two points each, returns collision point by reference

_Bool CheckCollisionRayBox(struct Ray, struct BoundingBox);

CFFI C function from raylib._raylib_cffi.lib

_Bool CheckCollisionRaySphere(struct Ray, struct Vector3, float);

_Bool CheckCollisionRaySphereEx(struct Ray, struct Vector3, float, struct Vector3 *);

void CloseAudioStream(struct AudioStream);

Encode codepoint into utf8 text (char array length returned as parameter)

Get a Color from HSV values, hue [0..360], saturation/value [0..1]

Get HSV values for a Color, hue [0..360], saturation/value [0..1]

Draw multiple mesh instances with material and different transforms

Draw a model wires (with texture if set) with extended parameters

Draw text using font inside rectangle limits with support for text selection

Draws a texture (or part of it) that stretches or shrinks nicely

Draw a part of a texture defined by a rectangle with 'pro' parameters

Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.

Draw a color-filled triangle (vertex in counter-clockwise order!)

Draw a triangle fan defined by points (first vertex is the center)

Export image as code file defining an array of bytes, returns true on success

Generate image: cellular algorithm. Bigger tileSize means bigger cells

Get char pressed (unicode), call it multiple times for chars queued

Get all codepoints in a string, codepoints count returned by parameters

Get total number of characters (codepoints) in a UTF8 encoded string

struct RayHitInfo GetCollisionRayGround(struct Ray, float);

struct RayHitInfo GetCollisionRayMesh(struct Ray, struct Mesh, struct Matrix);

struct RayHitInfo GetCollisionRayModel(struct Ray, struct Model);

struct RayHitInfo GetCollisionRayTriangle(struct Ray, struct Vector3, struct Vector3, struct Vector3);

Get full path for a given fileName with path (uses static string)

Get pointer to extension for a filename string (includes dot: '.png')

Get key pressed (keycode), call it multiple times for keys queued

Get the human-readable, UTF-8 encoded name of the primary monitor

Get next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure

Get previous directory path for a given path (uses static string)

Get pixel data from screen buffer and return an Image (screenshot)

Get the world space position for a 2d camera screen space position

Get touch position XY for a touch point index (relative to screen size)

Get touch position X for touch point 0 (relative to screen size)

Get touch position Y for touch point 0 (relative to screen size)

Get the screen space position for a 2d camera world space position

Dither image data to 16bpp or lower (Floyd-Steinberg dithering)

Draw a source image within a destination image (tint applied to source)

struct AudioStream InitAudioStream(unsigned int, unsigned int, unsigned int);

_Bool IsMusicPlaying(struct Music);

Load text data from file (read), returns a ' 0' terminated string

Load font from memory buffer, fileType refers to extension: i.e. '.ttf'

Load image from memory buffer, fileType refers to extension: i.e. '.png'

Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)

Load cubemap from image, multiple image cubemap layouts supported

Load wave from memory buffer, fileType refers to extension: i.e. '.wav'

Set window state: maximized, if resizable (only PLATFORM_DESKTOP)

struct BoundingBox MeshBoundingBox(struct Mesh);

Set window state: minimized, if resizable (only PLATFORM_DESKTOP)

Set window state: not minimized/maximized (only PLATFORM_DESKTOP)

Save data to file from byte array (write), returns true on success

Save text data to file (write), string must be ' 0' terminated, returns true on success

Save integer value to storage file (to defined position), returns true on success

Set camera alt key to combine with mouse movement (free camera)

Set camera pan key to combine with mouse movement (free camera)

Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)

Takes a screenshot of current screen (filename extension defines format)

Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)

center1: Vector2, radius1: float, center2: Vector2, radius2: float

startPos1: Vector2, endPos1: Vector2, startPos2: Vector2, endPos2: Vector2, collisionPoint: Any

Ray_0: Ray, Vector3_1: Vector3, float_2: float, Vector3_pointer_3: Any

center1: Vector3, radius1: float, center2: Vector3, radius2: float

camera: Camera3D, texture: Texture, position: Vector3, size: float, tint: Color

camera: Camera3D, texture: Texture, source: Rectangle, position: Vector3, size: float, tint: Color

center: Vector3, radius: float, rotationAxis: Vector3, rotationAngle: float, color: Color

centerX: int, centerY: int, radius: float, color1: Color, color2: Color

center: Vector2, radius: float, startAngle: float, endAngle: float, segments: int, color: Color

position: Vector3, width: float, height: float, length: float, color: Color

texture: Texture, position: Vector3, width: float, height: float, length: float, color: Color

position: Vector3, radiusTop: float, radiusBottom: float, height: float, slices: int, color: Color

centerX: int, centerY: int, radiusH: float, radiusV: float, color: Color

startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color

startPos: Vector2, endPos: Vector2, controlPos: Vector2, thick: float, color: Color

model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: float, scale: Vector3, tint: Color

center: Vector2, sides: int, radius: float, rotation: float, color: Color

rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color

posX: int, posY: int, width: int, height: int, color1: Color, color2: Color

rec: Rectangle, roundness: float, segments: int, lineThick: int, color: Color

center: Vector2, innerRadius: float, outerRadius: float, startAngle: float, endAngle: float, segments: int, color: Color

centerPos: Vector3, radius: float, rings: int, slices: int, color: Color

font: Font, codepoint: int, position: Vector2, fontSize: float, tint: Color

font: Font, text: str, position: Vector2, fontSize: float, spacing: float, tint: Color

font: Font, text: str, rec: Rectangle, fontSize: float, spacing: float, wordWrap: bool, tint: Color

font: Font, text: str, rec: Rectangle, fontSize: float, spacing: float, wordWrap: bool, tint: Color, selectStart: int, selectLength: int, selectTint: Color, selectBackTint: Color

texture: Texture, position: Vector2, rotation: float, scale: float, tint: Color

texture: Texture, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: float, tint: Color

texture: Texture, center: Vector2, points: Any, texcoords: Any, pointsCount: int, tint: Color

texture: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, tint: Color

texture: Texture, tiling: Vector2, offset: Vector2, quad: Rectangle, tint: Color

texture: Texture, source: Rectangle, position: Vector2, tint: Color

texture: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, scale: float, tint: Color

width: int, height: int, checksX: int, checksY: int, col1: Color, col2: Color

chars: Any, recs: Any, charsCount: int, fontSize: int, padding: int, packMethod: int

width: int, height: int, density: float, inner: Color, outer: Color

width: int, height: int, offsetX: int, offsetY: int, scale: float

Ray_0: Ray, Vector3_1: Vector3, Vector3_2: Vector3, Vector3_3: Vector3

dst: Any, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color

dst: Any, startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color

dst: Any, posX: int, posY: int, width: int, height: int, color: Color

dst: Any, text: str, posX: int, posY: int, fontSize: int, color: Color

dst: Any, font: Font, text: str, position: Vector2, fontSize: float, spacing: float, tint: Color

image: Any, newWidth: int, newHeight: int, offsetX: int, offsetY: int, fill: Color

font: Font, text: str, fontSize: float, spacing: float, tint: Color

fileData: str, dataSize: int, fontSize: int, fontChars: Any, charsCount: int, type: int

fileType: str, fileData: str, dataSize: int, fontSize: int, fontChars: Any, charsCount: int

fileName: str, width: int, height: int, format: int, headerSize: int

keyFront: int, keyBack: int, keyRight: int, keyLeft: int, keyUp: int, keyDown: int

shader: Shader, locIndex: int, value: Any, uniformType: int, count: int

self, center1: Vector2, radius1: float, center2: Vector2, radius2: float

self, startPos1: Vector2, endPos1: Vector2, startPos2: Vector2, endPos2: Vector2, collisionPoint: Any

self, Ray_0: Ray, Vector3_1: Vector3, float_2: float, Vector3_pointer_3: Any

self, center1: Vector3, radius1: float, center2: Vector3, radius2: float

self, camera: Camera3D, texture: Texture, position: Vector3, size: float, tint: Color

self, camera: Camera3D, texture: Texture, source: Rectangle, position: Vector3, size: float, tint: Color

self, center: Vector3, radius: float, rotationAxis: Vector3, rotationAngle: float, color: Color

self, centerX: int, centerY: int, radius: float, color1: Color, color2: Color

self, center: Vector2, radius: float, startAngle: float, endAngle: float, segments: int, color: Color

self, position: Vector3, width: float, height: float, length: float, color: Color

self, texture: Texture, position: Vector3, width: float, height: float, length: float, color: Color

self, position: Vector3, radiusTop: float, radiusBottom: float, height: float, slices: int, color: Color

self, centerX: int, centerY: int, radiusH: float, radiusV: float, color: Color

self, startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color

self, startPos: Vector2, endPos: Vector2, thick: float, color: Color

self, startPos: Vector2, endPos: Vector2, controlPos: Vector2, thick: float, color: Color

self, mesh: Mesh, material: Material, transforms: Any, instances: int

self, model: Model, position: Vector3, scale: float, tint: Color

self, model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: float, scale: Vector3, tint: Color

self, center: Vector2, sides: int, radius: float, rotation: float, color: Color

self, posX: int, posY: int, width: int, height: int, color: Color

self, rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color

self, posX: int, posY: int, width: int, height: int, color1: Color, color2: Color

self, rec: Rectangle, origin: Vector2, rotation: float, color: Color

self, rec: Rectangle, roundness: float, segments: int, color: Color

self, rec: Rectangle, roundness: float, segments: int, lineThick: int, color: Color

self, center: Vector2, innerRadius: float, outerRadius: float, startAngle: float, endAngle: float, segments: int, color: Color

self, centerPos: Vector3, radius: float, rings: int, slices: int, color: Color

self, text: str, posX: int, posY: int, fontSize: int, color: Color

self, font: Font, codepoint: int, position: Vector2, fontSize: float, tint: Color

self, font: Font, text: str, position: Vector2, fontSize: float, spacing: float, tint: Color

self, font: Font, text: str, rec: Rectangle, fontSize: float, spacing: float, wordWrap: bool, tint: Color

self, font: Font, text: str, rec: Rectangle, fontSize: float, spacing: float, wordWrap: bool, tint: Color, selectStart: int, selectLength: int, selectTint: Color, selectBackTint: Color

self, texture: Texture, position: Vector2, rotation: float, scale: float, tint: Color

self, texture: Texture, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: float, tint: Color

self, texture: Texture, center: Vector2, points: Any, texcoords: Any, pointsCount: int, tint: Color

self, texture: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, tint: Color

self, texture: Texture, tiling: Vector2, offset: Vector2, quad: Rectangle, tint: Color

self, texture: Texture, source: Rectangle, position: Vector2, tint: Color

self, texture: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, scale: float, tint: Color

self, width: int, height: int, checksX: int, checksY: int, col1: Color, col2: Color

self, chars: Any, recs: Any, charsCount: int, fontSize: int, padding: int, packMethod: int

self, width: int, height: int, density: float, inner: Color, outer: Color

self, width: int, height: int, offsetX: int, offsetY: int, scale: float

self, Ray_0: Ray, Vector3_1: Vector3, Vector3_2: Vector3, Vector3_3: Vector3

self, position: Vector3, camera: Camera3D, width: int, height: int

self, dst: Any, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color

self, dst: Any, centerX: int, centerY: int, radius: int, color: Color

self, dst: Any, startPosX: int, startPosY: int, endPosX: int, endPosY: int, color: Color

self, dst: Any, posX: int, posY: int, width: int, height: int, color: Color

self, dst: Any, text: str, posX: int, posY: int, fontSize: int, color: Color

self, dst: Any, font: Font, text: str, position: Vector2, fontSize: float, spacing: float, tint: Color

self, image: Any, newWidth: int, newHeight: int, offsetX: int, offsetY: int, fill: Color

self, font: Font, text: str, fontSize: float, spacing: float, tint: Color

self, unsignedint_0: int, unsignedint_1: int, unsignedint_2: int

self, fileData: str, dataSize: int, fontSize: int, fontChars: Any, charsCount: int, type: int

self, fileName: str, fontSize: int, fontChars: Any, charsCount: int

self, fileType: str, fileData: str, dataSize: int, fontSize: int, fontChars: Any, charsCount: int

self, fileName: str, width: int, height: int, format: int, headerSize: int

self, keyFront: int, keyBack: int, keyRight: int, keyLeft: int, keyUp: int, keyDown: int

self, shader: Shader, locIndex: int, value: Any, uniformType: int

self, shader: Shader, locIndex: int, value: Any, uniformType: int, count: int

self, mesh: Mesh, index: int, data: Any, dataSize: int, offset: int

self, wave: Any, sampleRate: int, sampleSize: int, channels: int

self, m0, m4, m8, m12, m1, m5, m9, m13, m2, m6, m10, m14, m3, m7, m11, m15

self, vertexCount, triangleCount, vertices, texcoords, texcoords2, normals, tangents, colors, indices, animVertices, animNormals, boneIds, boneWeights, vaoId, vboId

self, transform, meshCount, materialCount, meshes, materials, meshMaterial, boneCount, bones, bindPose

self, hResolution, vResolution, hScreenSize, vScreenSize, vScreenCenter, eyeToScreenDistance, lensSeparationDistance, interpupillaryDistance, lensDistortionValues, chromaAbCorrection

self, projection, viewOffset, leftLensCenter, rightLensCenter, leftScreenCenter, rightScreenCenter, scale, scaleIn