- raylib 5.0 master f62202198e35161a9fe394a14bbd1a7c655107ad
- raygui 4.0 master 12804826d01bfb636e36f816bda19eaa23b4ace7
- zig 0.12.0
- Windows 10 [Tested]
Simple raylib and raygui test build. After doing search engine.
The package manager is work in progress from Zig language Dev. Since the release of 0.11.0 This project use zig dependencies download to run application. By using the dependencies to handle build.zig script for easy compile and run application.
The Zig language will be subject to change in API. Which will break the build config. Since it not release to 1.0.0
const r = @cImport({
@cInclude("raylib.h");
@cInclude("raygui.h");
});
//...
r.InitWindow(960, 540, "My Window Name");Note it still use access but with name space. Check out on cheatsheet for more information from raylib site.
Note that Zig language use name space for easy access for C language. As well same with the raylab as they group together.
const r = @cImport({
@cInclude("raylib.h");
@cInclude("raygui.h");
});
//...
r.InitWindow(960, 540, "My Window Name");
//...It can be found in https://github.com/raysan5/raygui/blob/master/src/raygui.h
if (r.GuiButton(r.Rectangle{ .x = 20, .y = 100, .height = 16, .width = 100 }, "Print!") == 1) {
std.debug.print("Hello World!\n", .{});
}Note button return is int and not bool.
Note one file is add to handle raygui.h file for load correctly that is raygui_impl.c.
zig build
If nothing happen, it pass build.
zig build run
Window, text and gui checkbox test.
- https://github.com/lhk/raylib_zig_build_setup
- https://github.com/Angluca/raylib-zig-template
- https://ziggit.dev/t/zig-0-12-build-with-raylib-dependency-has-path-error/4058/6
- https://www.reddit.com/r/Zig/comments/16r0fj6/ysk_you_can_use_native_raylib_directly_in_zig_for/
- https://zig.news/perky/hot-reloading-with-raylib-4bf9
- https://github.com/lhk/raylib_zig_build_setup/blob/main/build.zig
- ziglang/zig#19423
- ziglang/zig#17302 (comment)