The goal of the C API is make usage as similar to the original C as CFFI will allow. So the example programs are very, very similar to the C originals.
Example program:
from raylib import *
InitWindow(800, 450, b"Hello Raylib")
SetTargetFPS(60)
camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
while not WindowShouldClose():
UpdateCamera(camera, CAMERA_ORBITAL)
BeginDrawing()
ClearBackground(RAYWHITE)
BeginMode3D(camera[0])
DrawGrid(20, 1.0)
EndMode3D()
DrawText(b"Hellow World", 190, 200, 20, VIOLET)
EndDrawing()
CloseWindow()
If you want to be more portable (i.e. same code will work with dynamic bindings) you can prefix the functions like this:
from raylib import ffi, rl, colors rl.InitWindow(800, 450, b"Hello Raylib") rl.SetTargetFPS(60) ...
Note
Whenever you need to convert stuff between C and Python see https://cffi.readthedocs.io
Important
Your primary reference should always be
However, here is a list of available functions:
.. autoapimodule:: raylib
:members:
:undoc-members: