- Dear_Bindings_Build
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.
DearBindings: dear_bindings_v0.17_ImGui_v1.92.4-docking
Dear ImGui: 1.92.4
-
Zig fetch
dear_bindings_buildmkdir myapp cd myapp zig init zig fetch --save git+https://github.com/dinau/dear_bindings_build -
Add dependencies to
build.zigconst dear_bindings_build = b.dependency("dear_bindings_build", .{}); const dependencies = .{ "appimgui", // Simple app framework "imspinner", // ImSpinner "imknobs", // ImKnobs "imtoggle", // ImToggle // "another_lib", }; inline for (dependencies) |dep_name| { const dep = dear_bindings_build.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 dear_bindings_build/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 ...
-
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 lang."); 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 # or zig build --release=fast
| Frontends | Backends |
|---|---|
| GLFW3 | OpenGL3, SDL3 |
| SDL3 | OpenGL3, SDL3GPU |
| Win32 | DirectX 11(D3D11) |
Library name / C lang. wrapper
- ImGui / Dear_Bindings
- ImGui-Knobs / CImGui-Knobs (2025/07)
- ImGuiFileDialog / CImGuiFileDialog (2025/07)
- ImGui_Toggle / CimGui_Toggle (2025/07)
- ImSpinner / CImSpinner (2025/07)
- ImGuiColorTextEdit / cimCTE (2025/08)
- ImGuizmo / CImGuizmo (2025/08)
- ImNodes / CImNodes (2025/08)
- ImPlot / CImPlot (2025/08)
- ImPlot3d / CImPlot3d (2025/08)
- ImGui_Markdown (2025/09 WIP)
Additional examples
- Raylib, raylib-zig, rlImGui (2025/11)
-
Install Zig Compiler
Windows: zig-x86_64-windows-0.15.2.zip
Linux: zig-x86_64-linux-0.15.2.tar.xz -
Windows11
-
Optional: MSys2/MinGW basic commands (make, rm, cp ...)
pacman -S make
-
-
Linux OS: Debian13 Trixie / Ubuntu families
sudo apt install make gcc lib{opengl-dev,gl1-mesa-dev,glfw3,glfw3-dev}-
SDL3
If you are using Debian13 Trixie, addsudo apt install libsdl3-dev
otherwise install SDL3 manually
-
-
Zig compiler
Example name Windows Linux zig_* Y Y -
Zig cc compiler
Using Zig module in C source code.
example Windows Linux glfw_* Y Y sdl3_* Y WIP win32_* Y -
git clone https://github.com/dinau/dear_bindings_build
cd dear_bindings_build/examples/glfw_opengl3 # for example
zig build run --release=fast # or make runraylib_cjk: Showing multi byte(CJK) fonts
- Work in progress
- Incremantal search
- Magnifing glass
zig_imPlotDemo written in Zig.
| Language | GLFW | Magnifing glass | Image load /save |
|---|---|---|---|
| C lang. | glfw_opengl3_image_load | - | Y |
| C lang. | glfw_opengl3_image_save | - | Y |
| Zig lang. | zig_glfw_opengl3_image_load | Y | Y |
| Zig lang. | zig_sdl3_sdlgup3 | - | load |
- Image file captured will be saved in current folder.
- Image format can be selected from
JPEG / PNG / BMP / TGA.
- Basic example
| Language | GLFW | SDL3 |
|---|---|---|
| C lang. | glfw_opengl3, glfw_opengl3_jp | sdl3_opengl3 |
| Zig lang. | zig_glfw_opengl3 | zig_sdl3_opengl3 |
-
Zig lang. examples
Openbuild.zigin each example folder and enable option line as follows,... snip ... exe.subsystem = .Windows; // Hide console window ... snip ...
and execute
make. -
C lang. examples
OpenMakefilein each example folder and change option as follows,... snip ... HIDE_CONSOLE_WINDOW = true ... snip ...and execute
make.
https://github.com/libsdl-org/SDL
https://github.com/libsdl-org/SDL/releases
- gcc.exe (Rev2, Built by MSYS2 project) 15.2.0
- make: GNU Make 4.4.1
- Python 3.12.10
| Language | Project | |
|---|---|---|
| Lua | Script | LuaJITImGui |
| NeLua | Compiler | NeLuaImGui |
| 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 | SDL3 / SDL2 | Zig-Platformer |

















