j
jaipkg.dev
packages / library / raylib-jai

raylib-jai

c375375library

No description provided.

No license ยท updated 2 months ago

raylib bindings for Jai ๐ŸŽฎ

These are bindings of raylib 6.0 for the Jai programming language.

๐Ÿš€ Getting started

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";

๐Ÿ“ Examples

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.

๐Ÿ”ง Generating the bindings

If you want to regenerate the bindings (e.g., when upgrading raylib), follow these steps:

Install:

  • 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/.

โ–ถ๏ธ Generate only

jai generate.jai

โ–ถ๏ธ Generate and compile raylib

jai generate.jai - -compile

Note

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. ๐Ÿ™Œ