A solo example (original from nanovg-zig/examples/example_blur.zig) using nanovg-zig.
Demo build.zig (zig 0.14.0-dev.2218) on how to use dependency and its resouces:
- nanovg module
const nanovg = b.dependency("nanovg.zig", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("nanovg", nanovg.module("nanovg"));
- examples/perf.zig
const perf = b.addModule("perf.zig", .{
.root_source_file = nanovg.path("examples/perf.zig"),
});
perf.addImport("nanovg", nanovg.module("nanovg"));
exe.root_module.addImport("perf.zig", perf);
- font or other assets of examples/
const assets_mapping = [_][]const u8{
"examples/Roboto-Regular.ttf", "assets/fonts/Roboto-Regular.ttf",
};
const imax = assets_mapping.len - 1;
var i: usize = 0;
while (i < imax) : (i += 2) {
exe.root_module.addAnonymousImport(assets_mapping[i + 1], .{
.root_source_file = nanovg.path(assets_mapping[i]),
});
}
- lib/gl2
exe.addIncludePath(nanovg.path("lib/gl2/include"));
exe.addCSourceFile(.{ .file = nanovg.path("lib/gl2/src/glad.c"), .flags = &.{} });