Skip to content

kujukuju/raylib-jai

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raylib-jai bindings

Raylib is a minimal gamedev library for C and this repository has a script for automatically generating Jai bindings from raylib.h.

There are also examples--direct Jai ports of the raylib examples.

There are more than shown here ported in the examples/ folder.

Minimal example

#load "path/to/raylib.jai";

main :: () {
    InitWindow(800, 450, "raylib example");
    defer CloseWindow();
    while !WindowShouldClose() {
        BeginDrawing();
        defer EndDrawing();
        ClearBackground(RAYWHITE);
        DrawText("raylib + jai", 190, 200, 20, LIGHTGRAY);
    }
}

Building the examples

Run compile_examples.bat with jai on your PATH.

Run the example .exe files from the examples/ directory.

Differences from C raylib

  • Some functions which take enum arguments (like SetConfigFlags for example) have their argument types changed from C's int (or Jai's s32) to the actual enum type. Consequently, you can call them like SetConfigFlags(.FLAG_FULLSCREEN_MODE);
  • An additional set of macros lets you change any of the Begin/End function call pairs (like BeginMode3D(camera) and EndMode3D()) into an equivalent PushMode3D(camera) which will insert an automatic defer EndXXX() call into the scope for you.

Regenerating the bindings

A python script generator.py reads raylib.h and generates raylib.jai.

About

Jai bindings for Raylib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 88.8%
  • Python 11.1%
  • Batchfile 0.1%