Skip to content
dinauPublic

About

Simply and easily build Dear ImGui (CImGui) / ImPlot/ ImPlot3D, Raylib, Wasm, WebGL, WebGPU and many other libaries and examples with less external dependencies in Zig.

Topics

Resources

Stars

21 stars

Watchers

0 watching

Forks

Latest commit

 

History

191 Commits

Folders and files

Repository files navigation

ImGuinz

This project aims to simply and easily build Dear ImGui (CImGui) / ImPlot (CImPlot), Raylib, rlImGui and many other libaries and examples with less external dependencies in Zig.

  • ImGui / CImGui version 1.92.9b dock (2026/08)

  • OS: Windows11 and Linux

  • Frontends and Backends

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

    • Included Font Awesome Icon fonts.
      alt
    • Included GLFW 3.5.1 static library (for Windows)
    • Included SDL3.4.xx libraries (for Windows)
    • Included STB libraries (only stb_image) for Load / Save images
    • Available ImPlot (CImPlot) / ImPlot3D with ImDrawIdx="unsigned int"
    • Enabled Input method (IME) flag for CJK fotns with IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS

Try Wasm demo in your browser


Click link for live demo: Click here
alt

See glfw_webgl_wasm / glfw_wgpu_wasm example

Prerequisites


Build and run


git clone https://github.com/dinau/imguinz
cd imguinz/examples/glfw_opengl3              # cd one of examples
make run                                      # or  zig build --release=fast run

See Star your project

Available libraries list at this moment


Library name / C lang. wrapper

Additional examples

Examples screenshots

ImGui-Toggle / CImGui-Toggle


ImGui-Toggle / CImGui-Toggle

main.zig

alt

ImGui-Knobs / CImGui-Knobs


ImGui-Knobs / CImGui-Knobs

main.zig

alt

ImSpinner / CImSpinner


ImSpinner / CImSpinner

main.zig

alt

Raylib example


First fetch raylib,

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

raylib_basic

alt

raylib_cjk: Showing multi byte(CJK) fonts

alt

Raylib + ImGui + rlImGui


First fetch raylib,

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

main.zig

alt

ImPlot3D / CImPlot3D


ImPlot3d / CImPlot3d

main.zig

alt

ImGuiFileDialog / CImGuiFileDialog


ImGuiFileDialog / CImGuiFileDialog

main.zig

alt

ImGuiColorTextEdit / cimCTE


ImGuiColorTextEdit / cimCTE

main.zig

alt

ImNodes / CImNodes


ImNodes / CImNodes

main.zig

alt

ImGuizmo / CImGuizmo


ImGuizmo / CImGuizmo

main.zig

alt

imgui_markdown / cimgui_markdown


WIP

imgui_markdown / cImgui_markdown

main.zig

alt

Image load


Image load and magnifying glass

glfw_opengl3: main.zig / sdl3_opengl3: main.zig / sdl3_sdlgpu3: main.zig

alt

Showing CJK multi byte fonts and input UTF-8 text


main.zig

alt

Icon font viewer


main.zig, magnifying glass, incremental search

alt

Image load / save


Image load / save and magnifying glass.
Image file captured would be saved in .the folder ./zig-out/bin.
Image can be saved as JPEG / PNG / BMP / TGA file.

main.zig

alt

ImPlot


main.zig

alt

imgui_zoomable_image


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

alt

glfw_webgl_wasm


  • Install emscripten
    • Specify emsdk 6.0.92

      emsdk install  6.0.9 
      emsdk activate 6.0.9

      for WebGL

      embuilder build contrib.glfw3    # Rerun after emsdk updated 
  1. Go to examples/glfw_webgl_wasm 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 also build native application

    make app

glfw_wgpu_wasm


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.16.0 or later

  1. Zig fetch imguinz

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

    const imguinz = b.dependency("imguinz", .{});
    const dependencies = .{
        "appimgui",      // Simple app framework
        "imspinner",     // ImSpinner
        "imknobs",       // ImKnobs
        "imtoggle",      // ImToggle
     // "another_lib",
    };
    inline for (dependencies) |dep_name| {
        const dep = imguinz.builder.dependency(dep_name, .{
            .target = target, 
            .optimize = optimize, 
        });
        exe.root_module.addImport(dep_name, dep.module(dep_name));
    }
    //exe.subsystem = if (builtin.zig_version.minor >= 17) .windows else .windows;

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

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

    const app = @import("appimgui");
    const ig = app.ig;
    const spinner = @import("imspinner");
    const knobs = @import("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.igShowDemoWindow(null); // Show demo window
                                       //
            ig.igSetNextWindowSize(.{ .x = 0.0, .y = 0.0 }, 0); // Fit window size depending on the size of the widgets
            _ = ig.igBegin("imguinz", null, 0); // Show Spinner window
            spinner.SpinnerAtomEx("atom", 16, 2, spn_col, speed, 3);
            ig.igSameLine(0.0, -1.0);
            _ = tgl.Toggle("Speed", &fspd, .{ .x = 0.0, .y = 0.0 });
            if (fspd) speed = 6.0 else speed = 2.0;
            if (knobs.IgKnobFloat("Color", &col, -1.0, 1.0, 0.1, "%.1f", knobs.IgKnobVariant_Stepped, 0, 0, 10, -1, -1)) {
                spn_col.Value.x = col;
            }
            ig.igEnd();
    
            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

    alt

ImPlot Demo written in Zig lang.


Now work in progress.

Build and run

pwd
examples/imPlotDemo
make run   # or zig build --release=fast run

ImPlot demo source in Zig lang.


demoAll.zig

Plots Tab


LinePlots (Dynamic)

alt

BarGroups

alt

BarStacks

alt

PieCharts

alt

Heatmaps

alt

Histogram2D

alt

Images

alt

Axes Tab / LogScale


alt

Subplots Tab / Tables


alt

Tools Tab / DragRects


alt

Show / Hide console window


Open build.zig in each example folder and
Hide console window: Default,
Show console window: Comment out this line as follows,

... snip ...
//exe.subsystem = .Windows;  // Hide console window
... snip ...

and rebuild example.

SDL libraries


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

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, C lang. Compiler Dear_Bindings_Build
Zig Compiler ImGuinZ

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 SDL2 Zig-Platformer

Notes:

  • Using ImPlot3D / ImPlot with Zig
  • Zig + ImGui + ImPlot3D / ImPlot demo
  • Build with ImPlot3D / ImPlot / Raylib / rlImGui
  • ImPlot3D integration example
  • This project builds and runs Dear ImGui + ImPlot3D / ImPlot / Raylib / rlImGui using Zig.
  • ImPlot3D is compiled from source (implot3d.h / implot3d.cpp)
  • ImPlot is compiled from source (implot.h / implot.cpp)

Developer_mode: Windows11

[Settings] - [Privacy & Security] - [For developers] - [Developer Mode]: [ON]

Footnotes

  1. Except Raylib examples ↩

  2. $ emsdk list ↩

About

Simply and easily build Dear ImGui (CImGui) / ImPlot/ ImPlot3D, Raylib, Wasm, WebGL, WebGPU and many other libaries and examples with less external dependencies in Zig.

Topics

Resources

Stars

21 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages