Skip to content
/ imguinz Public

Using Dear Imgui (CImGui), ImPlot (CImPlot) with Zig language zig-0.14 or later

License

Notifications You must be signed in to change notification settings

dinau/imguinz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImGuinZ

alt alt
alt

This project aims to simply and easily build Dear ImGui (CImGui) / ImPlot (CImPlot) examples in Zig language with less external dependencies.

  • ImGui / CImGui version 1.91.6dock (2024/12)

  • OS: Windows and Linux

  • Frontends and Backends

    GLFW SDL2 SDL3
    OpenGL3
    backend
    v v v
  • Features

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

Prerequisites


  • Zig version confirmed

    1. Windows: zig-windows-x86_64-0.14.0-dev.2625
    2. Linux: zig-linux-x86_64-0.14.0-dev.2625
  • WindowsOS

    • Windows10 or later
    • MSys2/MinGW basic commands (make, rm, cp, strip ...)
  • Linux OS (Ubuntu / Debian families)

    $ sudo apt install xorg-dev libopengl-dev libgl1-mesa-dev

    and for glfw3 and sdl2,

    $ sudo apt install libglfw3 libglfw3-dev
    $ sudo apt install libsdl2-dev

Build and run


  1. Download this project.

    git clone --recurse-submodules https://github.com/dinau/imguinz
  2. Go to one of the examples folder,

    cd imguinz/examples/glfw_opengl3
  3. Build and Run

    make run   # or  zig build --release=fast run

Examples screen shots

Image load


Image load and magnifying glass

glfw_opengl3.zig
sdl2_opengl3.zig
sdl3_opengl3.zig

alt

Showing CJK multi byte fonts and input UTF-8 text


glfw_opengl3_jp.zig

alt

Icon font viewer


iconFontViewer.zig and magnifying glass

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.

glfw_opengl3_image_load.zig

alt

glfw_opengl3_implot


glfw_opengl3_implot.zig

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 (Dynamic)

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


My tools version


  • Windows11 (main)
    • Make: GNU Make 4.4.1
    • SDL2 ver.2.30.8
    • SDL3 3.1.3
    • Git version 2.46.0.windows.1
  • Linux Mint 22 (sub)
    • Make: GNU Make 4.3
    • SDL2 ver.2.30.0
    • Git version 2.43.0

Similar project ImGui / CImGui


Language Project
Nim Compiler ImGuin, Nimgl_test, Nim_implot
Lua Script LuaJITImGui
Zig, C lang. Compiler Dear_Bindings_Build
Zig Compiler ImGuinZ
NeLua Compiler NeLuaImGui
Python Script DearPyGui for 32bit WindowsOS Binary

SDL game tutorial Platfromer


ald

Language Project
Nim Compiler Nim-Platformer
LuaJIT Script LuaJIT-Platformer
Nelua Compiler NeLua-Platformer
Zig Compiler Zig-Platformer (WIP)