DearImGui 1.89.3

dotnet add package DearImGui --version 1.89.3                
NuGet\Install-Package DearImGui -Version 1.89.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DearImGui" Version="1.89.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DearImGui --version 1.89.3                
#r "nuget: DearImGui, 1.89.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DearImGui as a Cake Addin
#addin nuget:?package=DearImGui&version=1.89.3

// Install DearImGui as a Cake Tool
#tool nuget:?package=DearImGui&version=1.89.3                

DearImGui

This is imgui and implot bindings for .NET, including a controller for OpenTK.

Features

  • Original documentation, when present, is available through IntelliSense
  • Friendly types when possible: Span<T>, vectors from System.Numerics
  • Close to zero allocations, the garbage collector will be your best friend!

Getting started

Windows, AnyCPU, .NET 6.0, OpenGL 4.5:

Nuget Nuget Nuget

You will also need Microsoft Visual C++ Redistributable latest supported downloads:

Should you need debug builds of native DLLs, you will find them in the Releases tab.

Getting started (development)

General notes

Unlike similar projects, this one is generated directly against sources.

The pros of this approach are, for instance:

  • documentation (when there is) for pretty much every member out there
  • default values for optional parameters, i.e. 'vanilla' imgui interface

In short, we can closely mimic the interfaces of the original projects.

But there are cons as well, for instance:

  • the generated code is better but the generators are more complex
  • DLL exports with decorated names as these differ in 32-bit VS 64-bit

The former was solved by spending quite some time polishing the generators.

The latter was solved using Roslyn, rewriting the entire output to be AnyCPU.

Cloning

The repository has submodules, don't forget to clone them in the process:

git clone --recurse-submodules https://github.com/aybe/DearImGui.git

Building

In order for the projects in Managed folder to build, there are implicit dependencies:

  • projects in Generated folder shall be started at least once
  • projects in Native folder shall be batch built at least once

These dependencies can be pre-built by invoking dearimgui-build.cmd $(Configuration).

Extending

It should be possible to support other libraries such as imguizmo and imnodes.

Take a look at how implot is generated and the shared code used by generators.

However, few things may prove to be challenging due to how CppSharp works.

When bindings are generated, there is a version history for easily diff'ing them.

Known issues

Generator can't write output file:

Occasionally, you may encounter a similiar exception while generating:

4>Unhandled exception. System.IO.IOException: The process cannot access the file 'C:\...\DearImGui\DearImGui.Generator\bin\Release\net6.0\imgui.cs' because it is being used by another process.

Something has outstanding handles on that file, try to generate again.

Tips

Building with dearimgui-build.cmd within Visual Studio Code is the best approach.

You can add an equivalent terminal profile to get the Developer Command Prompt:

"terminal.integrated.profiles.windows": {
    "Developer Command Prompt": {
        "path": [
            "${env:windir}\\System32\\cmd.exe"
        ],
        "args": [
            "/K",
            "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\Tools\\VsDevCmd.bat",
        ],
        "icon": "terminal-cmd"
    }
}

Credits

https://github.com/ocornut/imgui

https://github.com/epezent/implot

https://github.com/mono/CppSharp

https://github.com/opentk/opentk

https://github.com/dotnet/pinvoke

https://github.com/dotnet/roslyn

https://github.com/dotnet/sourcelink

https://fonts.google.com/specimen/Roboto

https://www.jetbrains.com/resharper/

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DearImGui:

Package Downloads
DearImGui.OpenTK

imgui for .NET OpenTK controller

DearImPlot

implot for .NET

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.89.3 746 3/8/2023
1.88.0.1 808 1/14/2023
1.88.0 466 1/4/2023