This repo contains a python package pkpy_bindings
that can be used to generate bindings for C libraries for pocketpy.
It uses raylib's JSON format for describing the API, which is generated by raylib's parser.
Current raylib version: 5.1-dev
- Python 3.8 or higher
python build.py
This generates two files:
You can take these two files directly into your project. They are ready to use.
from pkpy_bindings import generate
pyi_path = 'output/typings/raylib.pyi'
cpp_path = 'output/raylibw.cpp'
generate(
'raylib/parser/output/raylib_api.json',
module_name='raylib',
headers=['raylib.h'],
ignored_functions=IGNORED_FUNCTIONS,
vector_pattern=r'\bVector(\d)\b',
opaque_structs=['rAudioBuffer', 'rAudioProcessor']
).save(pyi_path, cpp_path)
import raylib as rl
rl.InitWindow(800, 450, "raylib [core] example - basic window")
RAYWHITE = rl.Color(34, 34, 34, 255)
LIGHTGRAY = rl.Color(200, 200, 200, 255)
while not rl.WindowShouldClose():
rl.BeginDrawing()
rl.ClearBackground(RAYWHITE)
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
rl.EndDrawing()
rl.CloseWindow()
cd output
mkdir build
cd build
cmake ..
cmake --build .
Debug\raylibw_test.exe
- variadic functions are not supported
- callbacks are not supported
MIT License