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.
Frontends and Backends
| Frontends | Backends |
|---|---|
| GLFW3 | OpenGL3 / WASM(WebGL / WebGPU) |
| SDL3 | OpenGL3, SDL3GPU |
| Win32 | DirectX 11(D3D11) |
ImDrawIdx="unsigned int"IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONSUse zig-0.16.0 or later
Zig fetch imguinz
mkdir myapp
cd myapp
zig init
zig fetch --save git+https://github.com/dinau/imguinz
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 ...
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
}
Build and run
pwd
myapp
zig build run

Click link for live demo: Click here

See glfw_webgl_wasm / glfw_wgpu_wasm example
MSys2/MinGW basic commands (make, rm, cp, strip …)
pacman -S make
Linux OS (Ubuntu / Debian families)
sudo apt install lib{opengl-dev,gl1-mesa-dev,glfw3,glfw3-dev,xcursor-dev,xinerama-dev,xi-dev} git make
git clone https://github.com/dinau/imguinz
cd imguinz/examples/glfw_opengl3 # cd one of examples
make run # or zig build --release=fast run
Library name / C lang. wrapper
Additional examples



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

raylib_cjk: Showing multi byte(CJK) fonts

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


ImGuiFileDialog / CImGuiFileDialog




WIP
imgui_markdown / cImgui_markdown

Image load and magnifying glass
glfw_opengl3: main.zig / sdl3_opengl3: main.zig / sdl3_sdlgpu3: main.zig


main.zig, magnifying glass, incremental search
![]()
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.


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

Specify emsdk 6.0.62
emsdk install 6.0.6
emsdk activate 6.0.6
for WebGL
embuilder build contrib.glfw3 # Rerun after emsdk updated
examples/glfw_webgl_wasm folderemsdk_env.bat(Windows) or emsdk_env.sh(Linux) in your console
[!IMPORTANT]
emsdk_env.bat # Run this once in every new console
Build WebGL/Wsam example
make run
See ./Makefile
You can build native application too
make app
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.
Now work in progress.
pwd
examples/imPlotDemo
make run # or zig build --release=fast run










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.
https://github.com/libsdl-org/SDL/releases
| 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 |

| 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:
Developer_mode: Windows11
[Settings] - [Privacy & Security] - [For developers] - [Developer Mode]: [ON]