Raylib is a minimal gamedev library for C and this repository has a script for automatically generating Jai bindings from raylib.h
, raymath.h
, rcamera.h
, rlgl.h
and raygui.h
.
Tested with Jai version: beta 0.2.010
Raylib version: 5.5
Raygui version: 4.5-dev
There are also examples--direct Jai ports of the raylib examples.
There are more than shown here ported in the examples/ folder.
Copy raylib directory into your libs directory. For example:
my_game/
.... libs/
.... .... raylib
.... main.jai
// main.jai
#import "raylib";
main :: () {
InitWindow(800, 450, "raylib example");
defer CloseWindow();
while !WindowShouldClose() {
BeginDrawing();
defer EndDrawing();
ClearBackground(RAYWHITE);
DrawText("raylib + jai", 190, 200, 20, LIGHTGRAY);
}
}
Compile using (on Windows): jai -import_dir .\libs .\main.jai
Run compile_examples.bat
with jai
on your PATH.
Run the example .exe
files from the examples/
directory.
-
Windows, linux and macos support
-
Raygui support
-
Some functions which take enum arguments (like
SetConfigFlags
for example) have their argument types changed from C'sint
(or Jai'ss32
) to the actual enum type. Consequently, you can call them likeSetConfigFlags(.FLAG_FULLSCREEN_MODE);
-
An additional set of macros lets you change any of the Begin/End function call pairs (like
BeginMode3D(camera)
andEndMode3D()
) into an equivalentPushMode3D(camera)
which will insert an automaticdefer EndXXX()
call into the scope for you.
Compile and run: generate.jai
For example (on Windows):
jai .\generate.jai
.\generate.exe