|
|
|
|
|
by stratts
1010 days ago
|
|
This is what works for me, assuming an clean project created using 'zig init-exe': At the top of your build.zig, import the raylib build.zig inside raylib's /src folder (exact path will depend where you've cloned raylib) const raySdk = @import("raylib/src/build.zig");
Use the imported addRaylib() function to build raylib, then link to the exe and add include path var raylib = raySdk.addRaylib(b, target, optimize, .{});
exe.addIncludePath(.{ .path = "raylib/src" });
exe.linkLibrary(raylib);
After that, you should be fine to just use @cImport to use raylib within your project const ray = @cImport({
@cInclude("raylib.h");
});
pub fn main() void {
ray.InitWindow(800, 450, "raylib [core] example - basic window");
...
|
|