imguinz2

ImGuinz2

This project aims to simply and easily build Dear ImGui examples with C and Zig using Dear_Bindings as first step
and one can use many other libaries and examples with less external dependencies (except Raylib library).

DearBindings: v1.92.9b-docking
Dear ImGui: 1.92.9b dock (2026/08)

Try Wasm demo in your browser


Click link for live demo: Click here
alt

See zig_webgl / zig_wgpu examples

Frontends and Backends


Frontends Backends
GLFW3 OpenGL3 / Wasm(WebGL / WebGPU)
SDL3 OpenGL3, SDL3GPU
Win32 DirectX 11(D3D11)

Prerequisites


Available libraries


  Library C Wrapper Date
YES Dear ImGui Dear_Bindings 2024/06
YES ImGui-Knobs CImGui-Knobs 2025/07
YES ImGuiFileDialog CImGuiFileDialog 2025/07
YES ImGui_Toggle CimGui_Toggle 2025/07
YES ImSpinner CImSpinner 2025/07
YES ImGuiColorTextEdit cimCTE 2025/08
YES ImGuizmo CImGuizmo 2025/08
YES ImNodes CImNodes 2025/08
YES ImPlot CImPlot 2025/08
YES ImPlot3d CImPlot3d 2025/08
YES imgui_zoomable_image cimgui_zoomable_image 2026/04
WIP ImGui_Markdown CImGui_MarkDown -
YES STB -  
YES Font-Awesome -  

Additional examples

Build and run


git clone https://github.com/dinau/imguinz2

cd imguinz2/examples/zig/glfw_opengl3       # for example
make run       # or zig build run --release=fast 

See Start your project

Examples screen shots


glfw_imknobs

glfw_imknobs

alt

glfw_imtoggle

glfw_imtoggle

alt

glfw_imspinner

glfw_imspinner

alt

Raylib example

Use zig-0.16.0

First fetch raylib,

zig fetch --save git+https://github.com/raysan5/raylib
raylib_basic

raylib_basic

alt

raylib_cjk

raylib_cjk: Showing multi byte(CJK) fonts

alt

rlImGui

Raylib + ImGui + rlImGui

alt

glfw_imfileopendialog

glfw_imfileopendialog

alt

glfw_imgui_markdown

glfw_iconfontviewer

glfw_iconfontviewer

alt

glfw_imcolortextedit

glfw_imcolortextedit

alt

glfw_imguizmo

glfw_imguizmo

alt

glfw_imnodes

glfw_imnodes

alt

glfw_implot / glfw_implot3d

glfw_implot / glfw_implot3d

glfw_imPlotDemo written in Zig.

alt
alt

Image load / save (OpenGL, SDL3, SDL3GPU)

Language GLFW Magnifing glass Image load /save Note
C glfw_opengl3 - Y  
C glfw_opengl3_image - Y  
Zig glfw_opengl3_image_load Y Y  
Zig sdl3_sdlgup3 - load Download SDL3.dll on Windows and copy to zig-out/bin folder
Zig sdl3_opengl3 - load Download SDL3.dll on Windows and copy to zig-out/bin folder
glfw_opengl3

glfw_imgui_zoomable_image

Try Wasm live demo in your browser
Click link for live demo: Click here

glfw_imgui_zoomable_image

alt

zig_webgl

  1. Go to examples/wasm/zig_webgl folder
  2. Run emsdk_env.bat(Windows) or emsdk_env.sh(Linux) in your console

    [!IMPORTANT]

    emsdk_env.bat     # Run this once in every new console
    
  3. Build WebGL/Wsam example

    make run
    

    See ./Makefile

  4. You can build native application too

     make app
    
zig_wgpu

WebGPU wasm example

Basically same as WebGL example

for WebGPU

embuilder build emdawnwebgpu   # Rerun after emsdk updated 

emsdk_env.bat  # Run this once in every new console
make run

This example can’t build native applicaton.

Start your project


Use zig-0.17.0

  1. Zig fetch imguinz2

    mkdir myapp
    cd myapp
    zig init
       
    zig fetch --save git+https://github.com/dinau/imguinz2
    
  2. Add dependencies to build.zig
    Please insert the following lines above b.installArtifact(exe);.

    const imguinz2 = b.dependency("imguinz2", .{});
    const dependencies = .{
        "appimgui",      // Simple app framework
        "imspinner",     // ImSpinner
        "imknobs",       // ImKnobs
        "imtoggle",      // ImToggle
     // "another_lib",
    };
    inline for (dependencies) |dep_name| {
        const dep = imguinz2.builder.dependency(dep_name, .{
            .target = target, 
            .optimize = optimize, 
        });
        exe.root_module.addImport(dep_name, dep.module(dep_name));
    }
    //exe.subsystem = .windows; // Hide console window
    

    You can set dependencies (additional libraries), see imguinz2/build.zig.zon

    "appimgui"     <- Simple app framework for GLFW and OpenGL backend
    "imspinner"    <- ImSpinner
    "imguizmo"     <- ImGuizmo
    "imknobs"      <- ImKnobs 
    "imnodes"      <- ImNodes
    "implot"       <- ImPlots
    "implot3d"     <- ImPlot3D
    "imtoggle"     <- ImToggle
    "rlimgui"      <- rlImgui
    ... snip  ...
    
  3. Edit src/main.zig

    const app = @import("appimgui");
    const ig = app.ig;
    const spinner = @import("imspinner"); // ImSpinner
    const knobs = @import("imknobs"); // ImKnobs
    const tgl = @import("imtoggle"); // ImToggle
       
    // gui_main()
    pub fn gui_main(window: *app.Window) void {
        var col: f32 = 1.0;
        var fspd: bool = false;
        var speed: f32 = 2.0;
        var spn_col: spinner.ImColor = .{ .Value = .{ .x = col, .y = 1.0, .z = 1.0, .w = 1.0 } };
        while (!window.shouldClose()) { // main loop
            window.pollEvents();
            window.frame(); // Start ImGui frame
       
            ig.ImGui_ShowDemoWindow(null); // Show ImGui demo window
       
            ig.ImGui_SetNextWindowSize(.{ .x = 0.0, .y = 0.0 }, 0); // Fit window size depending on the size of the widgets
            _ = ig.ImGui_Begin("Demo", null, 0); // Show demo window
            spinner.SpinnerAtomEx("atom", 16, 2, spn_col, speed, 3);
            ig.ImGui_SameLine();
            _ = tgl.Toggle("Speed", &fspd, .{ .x = 0.0, .y = 0.0 });
            if (fspd) speed = 6.0 else speed = 2.0;
            if (knobs.IgKnobFloat("Color", &col, 0.0, 1.0, 0.05, "%.2f", knobs.IgKnobVariant_Stepped, 0, 0, 10, -1, -1)) {
                spn_col.Value.x = col;
            }
            ig.ImGui_End();
       
            window.render(); // render
        } // end while loop
    }
       
    pub fn main() !void {
        var window = try app.Window.createImGui(1024, 900, "ImGui window in Zig", .{});
        defer window.destroyImGui();
       
        _ = app.setTheme(.dark); // Theme: dark, classic, light, microsoft
       
        gui_main(&window); // GUI main proc
    }
    
  4. Build and run

    pwd
    myapp
    
    zig build run     # or zig build --release=fast
    
    

    myapp.png

Hiding console window


SDL libraries


https://github.com/libsdl-org/SDL
https://github.com/libsdl-org/SDL/releases

My tools version


Similar project ImGui / CImGui


Language   Project
Lua Script LuaJITImGui
NeLua Compiler NeLuaImGui / NeLuaImGui2
Nim Compiler ImGuin, Nimgl_test, Nim_implot
Python Script DearPyGui for 32bit WindowsOS Binary
Ruby Script igRuby_Examples
Zig Compiler ImGuinz with CImGui
Zig, C Compiler ImGuinz2 with Dear Binindings

SDL game tutorial Platfromer


ald

Language   SDL Project
LuaJIT Script SDL2 LuaJIT-Platformer
Nelua Compiler SDL2 NeLua-Platformer
Nim Compiler SDL3 / SDL2 Nim-Platformer-sdl2/ Nim-Platformer-sdl3
Ruby Script SDL3 Ruby-Platformer
Zig Compiler SDL3 / SDL2 Zig-Platformer
  1. Except Raylib examples ↩

  2. $ emsdk list # Show version list ↩