These are bindings of raylib 6.0 for the Jai programming language.
Download the latest version of the module:
๐ Download ZIP
Copy the folder into your Jai module/ directory (or wherever you keep your modules) and import it:
#import "raylib-jai";
// or
Raylib :: #import "raylib-jai";Here is a minimal example to get you started:
Raylib :: #import "raylib-jai";
main :: () {
WINDOW_WIDTH :: 1024;
WINDOW_HEIGHT :: 768;
Raylib.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "raylib [core] example - basic window");
Raylib.SetTargetFPS(Raylib.GetMonitorRefreshRate(0));
while !Raylib.WindowShouldClose() {
Raylib.BeginDrawing();
Raylib.ClearBackground(Raylib.RAYWHITE);
Raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, Raylib.LIGHTGRAY);
Raylib.EndDrawing();
}
Raylib.CloseWindow();
}Some of the official raylib examples have been ported to Jai in the examples/ folder.
If youโd like an example to be ported to Jai, feel free to open an Issue, it will be added!
Note
In the examples, raylib is imported as
Raylib :: #import,file "../../module.jai";
This is only to make them work with the current folder structure.
You should import the module as shown above.
If you want to regenerate the bindings (e.g., when upgrading raylib), follow these steps:
- Jai โ required to generate bindings
- CMake โ only needed if you want to compile raylib
Download the raylib source code (version 6.0):
๐ https://github.com/raysan5/raylib/archive/refs/tags/6.0.zip
Extract it into the module directory under the name raylib/.
jai generate.jaijai generate.jai - -compileNote
The compilation currently uses CMake, but other build systems could be supported in the future. Feel free to open an Issue or submit a PR to add more ways of building raylib. ๐