Skip to content

mindon/an-example-nanovg.zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  1. nanovg module
const nanovg = b.dependency("nanovg.zig", .{
    .target = target,
    .optimize = optimize,
});
exe.root_module.addImport("nanovg", nanovg.module("nanovg"));
  1. 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);
  1. 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]),
    });
}
  1. lib/gl2
exe.addIncludePath(nanovg.path("lib/gl2/include"));
exe.addCSourceFile(.{ .file = nanovg.path("lib/gl2/src/glad.c"), .flags = &.{} });

About

A solo example on using nanvg.zig

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages