/imguin

Dear Imgui / CImGui, ImPlot/CImPlot wrapper for Nim language

Primary LanguageC++MIT LicenseMIT

ImGuin

Updated to latest ImGui/CImGui version: : v1.91.1dock (2024/09)

This project is my experiment project to use Nim language, ImGui, ImPlot, futhark and etc.

Usage: Sample program and run


Prerequisites


  • Nim-2.0.2 or later (Windows10 or later / Debian Linux)

  • MSys/MinGW command line tools (Unix tools), make, cp, rm, git, ...etc

  • For Linux Debian 12 Bookworm, Linux Mint

    $ 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

Install


nimble uninstall imguin  # Remove old version if exists. 
nimble install https://github.com/dinau/imguin

Build examples


  1. First clone this project,

    git clone https://github.com/dinau/imguin
  2. Sample program is here, examples. For instance glfw_opengl3.nim,

    cd imguin/examples/glfw_opengl3
    make  # or make run

    After build, run ./glfw_opengl3(.exe)

  3. For selecting static link or dynamic link ,read this examples/README.md.

Screen shot (examples)


These screen shots are on Windows10.

alt

alt

alt

Showing UTF-8 label text and input text with my local country language.
alt

Showing ImGui demo with ImPlot demo.
alt
alt

alt

alt

My test app movie using imguin

Sample movie,Youtube

Update to latest Dear ImGui and CImGui

Prerequisite


  1. Git installed.

  2. MSys/MinGW command line tools (Unix tools), make, cp, rm, ...etc

  3. Windows10 or later Clang/LLVM refer to Futhark installation.

    nimble install futhark

    It must exist libclang.a file in the library path (e.g. in c:\llvm\lib).

  4. Linux Debian 12 Bookworm

    sudo apt install  clang-16
    nimble install --passL:"-L/usr/lib/llvm-16/lib" futhark

Important Notice: Confirm Futhark version is v0.13.6 at this time. (2024/09)

nimble dump futhark

name: "futhark"
version: "0.13.6"
author: "PMunch"
desc: "A package which uses libclang to parse C headers into Nim files for easy interop"
license: "MIT"
...

Update ImGui/CImGui


  1. Compose development folders
    First move to your working folder you like, then

    mkdir imguin_dev
    cd imguin_dev
    git clone https://github.com/dinau/imguin
    cd imguin
  2. Clone ImGui/CImGui etc. sources at once forever

    pwd
    imguin
    make clonelibs

    Cloned libraries are under ../libs/ folder.

  3. Checkout arbitrary version with git command at the each library folder,
    ../libs/cimgui
    ../libs/cimplot
    ../libs/cimnodes

  4. Specify your clang include path to ClangIncludePath in imguin/src/imguin/cimgui.nim.

  5. Generate the definition file uisng Futhark,

    pwd
    imguin
    make gen
  6. Install updated files
    Properly edit the version info etc in imguin.nimble file, then

    pwd
    imguin
    nimble uninstall imguin  # Remove old version if it exists. 
    nimble install 

    That's all.
    Repeat from 3. if you'd like to update or downgrade to other version.

  • Confirmed version

    ImGui/CImGui Ver. ImGuin Ver. Date WindowsOS Linux Mint Debian
    Bookworm (1)
    1.91.1dock 1.91.1.2 2024/09 ok OK (6) Not checked
    1.91.1dock 1.91.1.1 2024/09 ok - Not checked
    1.91.0dock 1.91.0.1 2024/08 ok - Not checked
    1.91.0.0 2024/08 ok - Not checked
    1.90.9dock 1.90.9.4 2024/07 ok - NG (5)
    1.90.9.3 2024/07 ok - NG (5)
    1.90.8dock 1.90.8.1 2024/06 ok - NG (5)
    1.90.8.0 2024/06 ok - NG (5)
    1.90.7dock 1.90.7.0 2024/05 ok - NG (5)
    1.90.6dock 1.90.6.1 2024/05 ok - NG (5)
    1.90.4dock 1.90.4.3 2024/04 ok - NG (5)
    - - - - - -
    1.90.4.2 2024/02 ok - OK (4)
    1.90.1dock 1.90.1.0 2024/01 ok - NG/OK(1)(3)(4)
    1.89.9dock 1.89.9.8 2023/12 ok - NG/OK(1)(3)(4)

    (1): Except imnodes and SDL2 example.
    (2): Doesn't work well.
    (3): Works well only if it is compiled debug mode.
    (4): Use nim-2.0.2
    (5): I don't know why can't be compiled on Linux.
    (6): OK: Except ImNodes example

Selection backend compiler


You might be able to use another C/C++ compiler,
Clang, vcc(Visual Studio C/C++) , zig cc
by changing variable TC in examples/config.nims.common.

TODO


  1. Whether can it use cimgui.dll ? (Now it can only be static link) Done. Only be static link.
  2. Easier compilation for SDL2 app. (2024/09) Done.
  3. Added: ImNodes/CImNodes (2023/10) Done
  4. Unfortunately ImGui 1.89.7 dosn't work well at this moment.(2023/07) Done. (2023/08)
  5. Whether can it do nimble install imguin ? Done (2023/09) (#Issue 13)
  6. Add Font Awesome (Icon Font) demo. Done (2023/04).
  7. Can it compile with MSVC (--cc:vcc) ? Done. Except SDL2 demo. (2023/03), TODO (2024/09)
  8. Can it compile with Clang (--cc:clang) ? Done. (2023/03)
  9. Add SDL2 example. Done. examples/sdl2_opengl3 (2023/03)
  • First step is done. (2023/03)

My tools version


Windows11 (main)

  • Nim Compiler Version 2.0.8
  • gcc (Rev1, Built by MSYS2 project) 14.2.0
  • gcc (MinGW-W64...) 11.1.0 (Nim offical)
  • Clang version 18.1.8
  • git version 2.46.0.windows.1
  • SDL2.dll: 2.30.7
  • make: GNU Make 4.4.1
  • MSys2/MinGW tools
  • Microsoft Visual Studio C/C++ 2022
  • Zig: 0.14.0-dev... (clang version 18.1.8)

Lnux Mint 22

  • Nim Compiler Version 2.0.8
  • gcc 13.2.0
  • SDL2: 2.30.0
  • make: GNU Make 4.3
  • git version 2.43.0

Other link


Similar project


  • Dear ImGui
Language Binding Project
Nim CImGui/CImPlot ImGuin, Nimgl_test, Nim_implot
Lua CImGui/CImPlot etc. LuaJITImGui
Zig, C lang. Dear bindings Dear_Bindings_Build
Zig CImGui/CImPlot ImGuinZ
Python ImGui direct DearPyGui for 32bit WindowsOS Binary

Star History

Star History Chart