ktsu.ImGuiProvider 1.1.21

Prefix Reserved
dotnet add package ktsu.ImGuiProvider --version 1.1.21
                    
NuGet\Install-Package ktsu.ImGuiProvider -Version 1.1.21
                    
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="ktsu.ImGuiProvider" Version="1.1.21" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.ImGuiProvider" Version="1.1.21" />
                    
Directory.Packages.props
<PackageReference Include="ktsu.ImGuiProvider" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ktsu.ImGuiProvider --version 1.1.21
                    
#r "nuget: ktsu.ImGuiProvider, 1.1.21"
                    
#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.
#:package ktsu.ImGuiProvider@1.1.21
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ktsu.ImGuiProvider&version=1.1.21
                    
Install as a Cake Addin
#tool nuget:?package=ktsu.ImGuiProvider&version=1.1.21
                    
Install as a Cake Tool

ImGuiProvider

A dependency injection abstraction layer over ImGui implementations for .NET, providing clean interfaces and swappable backends.

Features

  • Dependency Injection - Clean integration with Microsoft.Extensions.DependencyInjection
  • Provider Abstraction - IImGuiProvider interface wrapping 160+ ImGui methods allows swapping implementations
  • Backend Support - Separate IPlatformBackend and IRendererBackend interfaces for windowing and rendering
  • Context Management - ImGuiContext handles the full frame lifecycle (initialize, begin frame, end frame, dispose)
  • Built-in Implementation - Ships with HexaNetImGuiProvider wrapping Hexa.NET.ImGui

Installation

dotnet add package ktsu.ImGuiProvider

Quick Start

using ImGuiProvider.Extensions;
using ImGuiProvider.Services;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddImGui(); // Registers HexaNetImGuiProvider as singleton

var serviceProvider = services.BuildServiceProvider();
var context = serviceProvider.GetRequiredService<ImGuiContext>();

Usage with Backends

var services = new ServiceCollection();
services.AddImGui();
services.AddImGuiBackend<MyPlatformBackend>();
services.AddImGuiBackend<MyRendererBackend>();

var serviceProvider = services.BuildServiceProvider();
var context = serviceProvider.GetRequiredService<ImGuiContext>();

// Resolve and attach backends
var platformBackend = serviceProvider.GetRequiredService<IPlatformBackend>();
var rendererBackend = serviceProvider.GetRequiredService<IRendererBackend>();

context.Initialize();
context.AddBackend(platformBackend);
context.AddBackend(rendererBackend);
context.InitializeBackends();

// Render loop
while (running)
{
    context.BeginFrame();

    // Your ImGui code here
    var provider = serviceProvider.GetRequiredService<IImGuiProvider>();
    provider.ShowDemoWindow();

    context.EndFrame();
}

context.Dispose();

Core Interfaces

IImGuiProvider

The main abstraction over ImGui functionality:

public interface IImGuiProvider : IDisposable
{
    nint CreateContext();
    void SetCurrentContext(nint context);
    nint GetCurrentContext();
    void DestroyContext(nint context);
    void NewFrame();
    void EndFrame();
    void Render();
    nint GetDrawData();
    bool Begin(string name);
    void End();
    void Text(string text);
    bool Button(string label);
    void ShowDemoWindow();
    // ... 160+ methods covering the full ImGui API
}

IImGuiBackend

Base interface for all backends:

public interface IImGuiBackend : IDisposable
{
    string Name { get; }
    bool Initialize();
    void Shutdown();
    void NewFrame();
    void RenderDrawData(nint drawData);
    void SetCurrentContext(nint context);
}

IPlatformBackend and IRendererBackend

Specialized backend interfaces:

public interface IPlatformBackend : IImGuiBackend
{
    void ProcessEvents();
}

public interface IRendererBackend : IImGuiBackend
{
    bool CreateDeviceObjects();
    void InvalidateDeviceObjects();
}

Custom Implementations

Custom Provider

public class MyProvider : IImGuiProvider
{
    // Implement all IImGuiProvider methods
}

services.AddImGui<MyProvider>();
// Or with a factory:
services.AddImGui(sp => new MyProvider());

Custom Backend

public class MyBackend : IRendererBackend
{
    public string Name => "My Backend";
    public bool Initialize() => true;
    public void Shutdown() { }
    public void NewFrame() { }
    public void RenderDrawData(nint drawData) { }
    public void SetCurrentContext(nint context) { }
    public bool CreateDeviceObjects() => true;
    public void InvalidateDeviceObjects() { }
    public void Dispose() { }
}

services.AddImGuiBackend<MyBackend>();

Requirements

  • .NET 8.0, 9.0, or 10.0
  • Hexa.NET.ImGui 2.2.8.4
  • Microsoft.Extensions.DependencyInjection.Abstractions 9.0.7

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.21 44 8/21/2026
1.1.20 47 8/20/2026
1.1.19 48 8/19/2026
1.1.18 56 8/19/2026
1.1.17 77 8/18/2026
1.1.16 96 8/17/2026
1.1.15 93 8/11/2026
1.1.14 89 8/11/2026
1.1.13 84 8/6/2026
1.1.12 91 8/6/2026
1.1.11 89 8/5/2026
1.1.10 106 7/28/2026
1.1.9 102 7/21/2026
1.1.8 108 7/15/2026
1.1.7 103 7/14/2026
1.1.6 110 7/13/2026
1.1.5 134 7/9/2026
1.1.4 106 7/1/2026
1.1.3 106 6/30/2026
1.1.2 106 6/29/2026
Loading failed

## v1.1.21 (patch)

Changes since v1.1.20:

- Bump the ktsu group with 9 updates ([@dependabot[bot]](https://github.com/dependabot[bot]))