ImKit.MonoGame 0.0.1

dotnet add package ImKit.MonoGame --version 0.0.1
                    
NuGet\Install-Package ImKit.MonoGame -Version 0.0.1
                    
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="ImKit.MonoGame" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ImKit.MonoGame" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ImKit.MonoGame" />
                    
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 ImKit.MonoGame --version 0.0.1
                    
#r "nuget: ImKit.MonoGame, 0.0.1"
                    
#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 ImKit.MonoGame@0.0.1
                    
#: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=ImKit.MonoGame&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ImKit.MonoGame&version=0.0.1
                    
Install as a Cake Tool

ImKit.MonoGame

MonoGame backend for ImKit: a Dear ImGui renderer for MonoGame/FNA, texture binding, and dependency-injection wiring.

Install

dotnet add package ImKit.MonoGame

Targets net10.0. Brings in ImKit, ImGui.NET and MonoGame.Framework.DesktopGL.

Wiring it up

services.AddImKit(
    graphicsDeviceFactory: sp => sp.GetRequiredService<MyGame>().GraphicsDevice,
    gameWindowFactory:     sp => sp.GetRequiredService<MyGame>().Window);

services.AddDockSpace<EditorDockSpace>();
services.AddGuiWidget<MainMenuWidget>();
services.AddGuiWidget<InspectorWidget>();

The graphics device and window are passed as factories because neither exists until Game.Initialize has run — usually after the container is built. They are resolved lazily, on first use of the renderer.

AddGuiWidget<T> registers one instance under both T and IGuiWidget, so a widget can also be injected by its concrete type (or resolved as an event subscriber) without a second instance being constructed.

Then drive it from Game:

protected override void Initialize()
{
    base.Initialize();
    _gui.Initialize();          // uploads the font atlas
}

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);
    _gui.Draw(gameTime.ToFrameTime());
}

ToFrameTime() converts MonoGame's GameTime to ImKit's backend-agnostic FrameTime.

Renderer

ImGuiRenderer implements IImGuiRenderer, which is ImKit's IGuiBackend plus texture binding:

IntPtr id = renderer.BindTexture(texture);
ImGui.Image(id, new Vector2(texture.Width, texture.Height));
// ...
renderer.UnbindTexture(id);   // does not dispose the texture

Every bound handle must be released, otherwise the renderer keeps the texture alive.

The constructor creates the ImGui context and enables docking, so construct exactly one per application. Manual construction without a container:

var renderer = new ImGuiRenderer(
    new GraphicsDeviceWrapper(GraphicsDevice),
    new GameWindowWrapper(Window));

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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
0.0.1 102 9/26/2026