ktsu.ImGuiProvider
2.1.1
Prefix Reserved
See the version list below for details.
dotnet add package ktsu.ImGuiProvider --version 2.1.1
NuGet\Install-Package ktsu.ImGuiProvider -Version 2.1.1
<PackageReference Include="ktsu.ImGuiProvider" Version="2.1.1" />
<PackageVersion Include="ktsu.ImGuiProvider" Version="2.1.1" />
<PackageReference Include="ktsu.ImGuiProvider" />
paket add ktsu.ImGuiProvider --version 2.1.1
#r "nuget: ktsu.ImGuiProvider, 2.1.1"
#:package ktsu.ImGuiProvider@2.1.1
#addin nuget:?package=ktsu.ImGuiProvider&version=2.1.1
#tool nuget:?package=ktsu.ImGuiProvider&version=2.1.1
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 -
IImGuiProviderinterface wrapping 160+ ImGui methods allows swapping implementations - Backend Support - Separate
IPlatformBackendandIRendererBackendinterfaces for windowing and rendering - Context Management -
ImGuiContexthandles the full frame lifecycle (initialize, begin frame, end frame, dispose) - Built-in Implementation - Ships with
HexaNetImGuiProviderwrapping 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();
}
// Shuts down the backends and destroys the ImGui context. The provider and the backends
// belong to the container, which disposes them when it is disposed.
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 | Versions 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. |
-
net10.0
- Hexa.NET.ImGui (>= 2.2.9)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 11.0.0)
-
net8.0
- Hexa.NET.ImGui (>= 2.2.9)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 11.0.0)
-
net9.0
- Hexa.NET.ImGui (>= 2.2.9)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 11.0.0)
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 |
|---|---|---|
| 2.1.2-pre.3 | 53 | 11/23/2026 |
| 2.1.2-pre.2 | 66 | 11/16/2026 |
| 2.1.2-pre.1 | 57 | 11/11/2026 |
| 2.1.1 | 116 | 11/11/2026 |
| 2.1.0 | 91 | 11/11/2026 |
| 2.0.1 | 202 | 10/9/2026 |
| 2.0.1-pre.2 | 90 | 10/7/2026 |
| 2.0.1-pre.1 | 77 | 10/6/2026 |
| 2.0.0 | 115 | 9/30/2026 |
| 1.3.1 | 119 | 9/29/2026 |
| 1.3.1-pre.1 | 76 | 9/28/2026 |
| 1.3.0 | 113 | 9/28/2026 |
| 1.2.0 | 117 | 9/27/2026 |
| 1.1.36 | 113 | 9/26/2026 |
| 1.1.35 | 125 | 9/24/2026 |
| 1.1.34 | 115 | 9/23/2026 |
| 1.1.33 | 117 | 9/22/2026 |
| 1.1.32 | 120 | 9/21/2026 |
| 1.1.31 | 128 | 9/18/2026 |
| 1.1.30 | 134 | 9/16/2026 |
## v2.1.1 (patch)
Changes since v2.1.0:
- Build the font atlas in BuildFontAtlas, and report whether it was built [patch] (#97) (matt-edmondson)
- Shut a context's backends down with that context current on Dispose [patch] (#99) (matt-edmondson)