dumheter / zig-imgui-template

Use as a template when starting an imgui project in zig.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zig imgui template

Zig imgui template that uses opengl3 and glfw, where glfw already has zig bindings provided by mach-glfw. Imgui (v 1.89 WIP) is provided using zimgui, which has an incomplete set of imgui to zig bindings. A better font is included, cascadia code. And finally, a solarized light theme is included.

Preview

// YOUR CODE GOES HERE
{
    var open: bool = true;
    _ = zui.begin("Your code goes here", &open, zui.WindowFlags{});

    zui.text("It's this easy to draw text with (z)imgui.", .{});

    if (zui.button("Toggle imgui demo window.", .{}, null)) {
        show_demo_window = !show_demo_window;
    }

    // draw imgui's demo window
    if (show_demo_window) {
        zui.showDemoWindow(&show_demo_window);
    }

    zui.end();
}

preview image

About

Use as a template when starting an imgui project in zig.

License:MIT License


Languages

Language:Zig 100.0%