https://github.com/dinau/imguinz
Calling Dear Imgui (CImGui), ImPlot (CImPlot) from Zig language zig-0.14 or later
https://github.com/dinau/imguinz
cimgui cimplot font-awesome glfw gui imgui implot linux opengl sdl2 sdl3 ui windows zig zig-lang ziglang
Last synced: 5 months ago
JSON representation
Calling Dear Imgui (CImGui), ImPlot (CImPlot) from Zig language zig-0.14 or later
- Host: GitHub
- URL: https://github.com/dinau/imguinz
- Owner: dinau
- License: mit
- Created: 2024-06-26T01:03:07.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-11T13:31:00.000Z (over 1 year ago)
- Last Synced: 2024-10-16T19:21:10.609Z (over 1 year ago)
- Topics: cimgui, cimplot, font-awesome, glfw, gui, imgui, implot, linux, opengl, sdl2, sdl3, ui, windows, zig, zig-lang, ziglang
- Language: C
- Homepage:
- Size: 41.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
- [ImGuinZ](#imguinz)
- [Zig fetch](#zig-fetch)
- [Prerequisites](#prerequisites)
- [Build and run](#build-and-run)
- [Available libraries list at this moment](#available-libraries-list-at-this-moment)
- [Examples screenshots](#examples-screenshots)
- [ImGui-Toggle / CImGui-Toggle](#imgui-toggle--cimgui-toggle)
- [ImGui-Knobs / CImGui-Knobs](#imgui-knobs--cimgui-knobs)
- [ImSpinner / CImSpinner](#imspinner--cimspinner)
- [Raylib example](#raylib-example)
- [Raylib + ImGui + rlImGui](#raylib--imgui--rlimgui)
- [ImPlot3D / CImPlot3D](#implot3d--cimplot3d)
- [ImGuiFileDialog / CImGuiFileDialog](#imguifiledialog--cimguifiledialog)
- [ImGuiColorTextEdit / cimCTE](#imguicolortextedit--cimcte)
- [ImNodes / CImNodes](#imnodes--cimnodes)
- [ImGuizmo / CImGuizmo](#imguizmo--cimguizmo)
- [imgui_markdown / cimgui_markdown](#imgui_markdown--cimgui_markdown)
- [Image load](#image-load)
- [Showing CJK multi byte fonts and input UTF-8 text](#showing-cjk-multi-byte-fonts-and-input-utf-8-text)
- [Icon font viewer](#icon-font-viewer)
- [Image load / save](#image-load--save)
- [glfw_opengl3_implot](#glfw_opengl3_implot)
- [ImPlot Demo written in Zig lang.](#implot-demo-written-in-zig-lang)
- [Build and run](#build-and-run-1)
- [ImPlot demo source in Zig lang.](#implot-demo-source-in-zig-lang)
- [Plots Tab](#plots-tab)
- [LinePlots (Dynamic)](#lineplots-dynamic)
- [BarGroups](#bargroups)
- [BarStacks](#barstacks)
- [PieCharts](#piecharts)
- [Heatmaps](#heatmaps)
- [Histogram2D](#histogram2d)
- [Images](#images)
- [Axes Tab / LogScale](#axes-tab--logscale)
- [Subplots Tab / Tables](#subplots-tab--tables)
- [Tools Tab / DragRects](#tools-tab--dragrects)
- [Show / Hide console window](#show--hide-console-window)
- [SDL libraries](#sdl-libraries)
- [Similar project ImGui / CImGui](#similar-project-imgui--cimgui)
- [SDL game tutorial Platfromer](#sdl-game-tutorial-platfromer)
## ImGuinZ
This project aims to simply and easily build [Dear ImGui](https://github.com/ocornut/imgui)
[(CImGui)](https://github.com/cimgui/cimgui) / [ImPlot](https://github.com/epezent/implot) [(CImPlot)](https://github.com/cimgui/cimplot),
Raylib, rlImGui and many other libaries and examples in Zig with less external dependencies.
- ImGui / CImGui version **1.92.4 dock** (2025/11)
- OS: Windows11 and Linux
- Frontends and Backends
| | GLFW | SDL3 | Win32 |
| --- | :----: | :----: | :----:
| OpenGL3
backend | YES | YES | -
| SDLGPU3
backend | - | [YES](https://github.com/dinau/imguinz/blob/main/examples/sdl3_sdlgpu3/src/main.zig) | -
| DirectX 11
backend | - | - | YES
- Features
- Included [Font Awesome](https://fontawesome.com/search?m=free&o=r) Icon fonts.

- Included GLFW 3.4.0 static library (for Windows)
- Included SDL3 libraries (for Windows)
- Included STB libraries (only stb_image) for Load / Save images
- Available [ImPlot](https://github.com/epezent/implot) [(CImPlot)](https://github.com/cimgui/cimplot) with `ImDrawIdx="unsigned int"`
- Enabled Input method \(IME\) flag with `IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS`
### Zig fetch
---
1. Zig fetch `imguinz`
```sh
mkdir myapp
cd myapp
zig init
zig fetch --save git+https://github.com/dinau/imguinz
```
1. Add dependencies to `build.zig`
```zig
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 = .Windows; // Hide console window
```
You can set `dependencies` (additional libraries), see [imguinz/build.zig.zon](https://github.com/dinau/imguinz/blob/main/build.zig.zon)
```zig
"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 ...
```
1. Edit src/main.zig
```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("Spinner", 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("Mix", &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 lang.");
defer window.destroyImGui();
_ = app.setTheme(.dark); // Theme: dark, classic, light, microsoft
gui_main(&window); // GUI main proc
}
```
1. Build and run
```sh
pwd
myapp
zig build run
```

### Prerequisites
---
- Zig compiler version confirmed
- Windows: [zig-x86_64-windows-0.15.2.zip](https://ziglang.org/download/0.15.2/zig-x86_64-windows-0.15.2.zip)
- Linux: [zig-x86_64-linux-0.15.2.tar.xz](https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz)
- WindowsOS
- Windows11
- MSys2/MinGW basic commands (make, rm, cp, strip ...)
```sh
pacman -S make
```
- Linux OS (Ubuntu / Debian families)
```sh
sudo apt install lib{opengl-dev,gl1-mesa-dev,glfw3,glfw3-dev,xcursor-dev,xinerama-dev,xi-dev} git make
```
- SDL3
If you are using Debian13 Trixie, add sdl3 library,
```sh
sudo apt install libsdl3-dev
```
otherwise [install SDL3 manually](https://github.com/dinau/sdl3_nim#for-linux-os)
### Build and run
---
```sh
git clone https://github.com/dinau/imguinz
cd imguinz/examples/glfw_opengl3 # cd one of examples
make run # or zig build --release=fast run
```
### Available libraries list at this moment
---
Library name / C lang. wrapper
- [x] [ImGui](https://github.com/ocornut/imgui) / [CImGui](https://github.com/cimgui/cimgui) (2024/11)
- [x] [ImPlot](https://github.com/epezent/implot) / [CImPlot](https://github.com/cimgui/cimplot) (2025)
- [x] [ImPlot3d](https://github.com/brenocq/implot3d) / [CImPlot3d](https://github.com/cimgui/cimplot3d) (2025/07)
- [x] [ImNodes](https://github.com/Nelarius/imnodes) / [CImNodes](https://github.com/cimgui/cimnodes) (2025/06)
- [x] [ImGuizmo](https://github.com/CedricGuillemet/ImGuizmo) / [CImGuizmo](https://github.com/cimgui/cimguizmo) (2025/07)
- [x] [ImGui-Knobs](https://github.com/altschuler/imgui-knobs) / [CImGui-Knobs](https://github.com/dinau/imguin/tree/main/src/imguin/private/cimgui-knobs) (2025/05)
- [x] [ImGuiFileDialog](https://github.com/aiekick/ImGuiFileDialog) / [CImGuiFileDialog](https://github.com/dinau/CImGuiFileDialog) (2025/07)
- [x] [ImGui_Toggle](https://github.com/cmdwtf/imgui_toggle) / [CimGui_Toggle](https://github.com/dinau/cimgui_toggle) (2025/05)
- [x] [ImSpinner](https://github.com/dalerank/imspinner) / [CImSpinner](https://github.com/dinau/cimspinner) (2025/05)
- [x] [ImGuiColorTextEdit](https://github.com/santaclose/ImGuiColorTextEdit) / [cimCTE](https://github.com/cimgui/cimCTE) (2025/07)
- [ ] [ImGui_Markdown](https://github.com/enkisoftware/imgui_markdown) (2025/09) WIP
Additional examples
- [x] [Raylib](https://github.com/raysan5/raylib), [rlImGui](https://github.com/raylib-extras/rlImGui) (2025/11)
### Examples screenshots
#### ImGui-Toggle / CImGui-Toggle
---
[ImGui-Toggle](https://github.com/cmdwtf/imgui_toggle) / [CImGui-Toggle](https://github.com/dinau/cimgui_toggle)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imgui_toggle/src/main.zig)

#### ImGui-Knobs / CImGui-Knobs
---
[ImGui-Knobs](https://github.com/altschuler/imgui-knobs) / [CImGui-Knobs](https://github.com/dinau/cimgui-knobs)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imknobs/src/main.zig)

#### ImSpinner / CImSpinner
---
[ImSpinner](https://github.com/dalerank/imspinner) / [CImSpinner](https://github.com/dinau/cimspinner)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imspinner/src/main.zig)

#### Raylib example
---
[raylib_basic](examples/raylib_basic/src/main.zig)

[raylib_cjk](examples/raylib_cjk/src/main.zig): Showing multi byte(CJK) fonts

#### Raylib + ImGui + rlImGui
---
[main.zig](examples/rlimgui_basic/src/main.zig)

#### ImPlot3D / CImPlot3D
---
[ImPlot3d](https://github.com/brenocq/implot3d) / [CImPlot3d](https://github.com/cimgui/cimplot3d)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_implot3d/src/main.zig)

#### ImGuiFileDialog / CImGuiFileDialog
---
[ImGuiFileDialog](https://github.com/aiekick/ImGuiFileDialog) / [CImGuiFileDialog](https://github.com/dinau/CImGuiFileDialog)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imfiledialog/src/main.zig)

#### ImGuiColorTextEdit / cimCTE
---
[ImGuiColorTextEdit](https://github.com/santaclose/ImGuiColorTextEdit) / [cimCTE](https://github.com/cimgui/cimCTE)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imguicolortextedit/src/main.zig)

#### ImNodes / CImNodes
---
[ImNodes](https://github.com/Nelarius/imnodes) / [CImNodes](https://github.com/cimgui/cimnodes)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imnodes/src/main.zig)

#### ImGuizmo / CImGuizmo
---
[ImGuizmo](https://github.com/CedricGuillemet/ImGuizmo) / [CImGuizmo](https://github.com/cimgui/cimguizmo)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imguizmo/src/main.zig)

#### imgui_markdown / cimgui_markdown
---
WIP
[imgui_markdown](https://github.com/enkisoftware/imgui_markdown) / [cImgui_markdown](https://github.com/dinau/cimgui_markdown)
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_imgui_markdown/src/main.zig)

#### Image load
---
Image load and magnifying glass
[glfw_opengl3: main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3/src/main.zig) /
[sdl3_opengl3: main.zig](https://github.com/dinau/imguinz/blob/main/examples/sdl3_opengl3/src/main.zig) /
[sdl3_sdlgpu3: main.zig](https://github.com/dinau/imguinz/blob/main/examples/sdl3_sdlgpu3/src/main.zig)

#### Showing CJK multi byte fonts and input UTF-8 text
---
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_jp/src/main.zig)

#### Icon font viewer
---
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/iconFontViewer/src/main.zig), magnifying glass, incremental search

#### 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](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_image_load/src/main.zig)

#### glfw_opengl3_implot
---
[main.zig](https://github.com/dinau/imguinz/blob/main/examples/glfw_opengl3_implot/src/main.zig)

### ImPlot Demo written in Zig lang.
---
Now work in progress.
#### Build and run
```sh
pwd
examples/imPlotDemo
make run # or zig build --release=fast run
```
#### ImPlot demo source in Zig lang.
---
[demoAll.zig](https://github.com/dinau/imguinz/blob/main/examples/imPlotDemo/src/demoAll.zig)
#### Plots Tab
---
##### LinePlots (Dynamic)

##### BarGroups

##### BarStacks

##### PieCharts

##### Heatmaps

##### Histogram2D

##### Images

#### Axes Tab / LogScale
---

#### Subplots Tab / Tables
---

#### Tools Tab / DragRects
---

### 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,
```zig
... 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](https://github.com/dinau/luajitImGui) |
| **NeLua** | Compiler | [NeLuaImGui](https://github.com/dinau/neluaImGui) / [NeLuaImGui2](https://github.com/dinau/neluaImGui2) |
| **Nim** | Compiler | [ImGuin](https://github.com/dinau/imguin), [Nimgl_test](https://github.com/dinau/nimgl_test), [Nim_implot](https://github.com/dinau/nim_implot) |
| **Python** | Script | [DearPyGui for 32bit WindowsOS Binary](https://github.com/dinau/DearPyGui32/tree/win32) |
| **Ruby** | Script | [igRuby_Examples](https://github.com/dinau/igruby_examples) |
| **Zig**, C lang. | Compiler | [Dear_Bindings_Build](https://github.com/dinau/dear_bindings_build) |
| **Zig** | Compiler | [ImGuinZ](https://github.com/dinau/imguinz) |
#### SDL game tutorial Platfromer
---

| Language | | SDL | Project |
| -------------------: | :---: | :---: | :----------------------------------------------------------------: |
| **LuaJIT** | Script | SDL2 | [LuaJIT-Platformer](https://github.com/dinau/luajit-platformer)
| **Nelua** | Compiler | SDL2 | [NeLua-Platformer](https://github.com/dinau/nelua-platformer)
| **Nim** | Compiler | SDL3 / SDL2 | [Nim-Platformer-sdl2](https://github.com/def-/nim-platformer)/ [Nim-Platformer-sdl3](https://github.com/dinau/sdl3_nim/tree/main/examples/platformer) |
| **Ruby** | Script | SDL3 | [Ruby-Platformer](https://github.com/dinau/ruby-platformer) |
| **Zig** | Compiler | SDL2 | [Zig-Platformer](https://github.com/dinau/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]
[^developer_mode]: Windows11
[Settings] - [Privacy & Security] - [For developers] - [Developer Mode]: [ON]