ktsu.ImGuiWidgets 1.1.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package ktsu.ImGuiWidgets --version 1.1.0                
NuGet\Install-Package ktsu.ImGuiWidgets -Version 1.1.0                
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.ImGuiWidgets" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ktsu.ImGuiWidgets --version 1.1.0                
#r "nuget: ktsu.ImGuiWidgets, 1.1.0"                
#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 ktsu.ImGuiWidgets as a Cake Addin
#addin nuget:?package=ktsu.ImGuiWidgets&version=1.1.0

// Install ktsu.ImGuiWidgets as a Cake Tool
#tool nuget:?package=ktsu.ImGuiWidgets&version=1.1.0                

ktsu.ImGuiWidgets

ImGuiWidgets is a library of custom widgets using ImGui.NET. This library provides a variety of widgets and utilities to enhance your ImGui-based applications.

Features

  • Knobs: Ported to .NET from imgui-works/imgui-knobs-dial-gauge-meter
  • Resizable Layout Dividers: Draggable layout dividers for resizable layouts
  • Icons: Customizable icons with various alignment options and event delegates
  • Grid: Flexible grid layout for displaying items
  • Color Indicator: An indicator that displays a color when enabled
  • Image: An image widget with alignment options
  • Text: A text widget with alignment options
  • Tree: A tree widget for displaying hierarchical data
  • Scoped Id: A utility class for creating scoped IDs

Installation

To install ImGuiWidgets, you can add the library to your .NET project using the following command:

dotnet add package ktsu.ImGuiWidgets

Usage

To use ImGuiWidgets, you need to include the ktsu.ImGuiWidgets namespace in your code:

using ktsu.ImGuiWidgets;

Then, you can start using the widgets provided by ImGuiWidgets in your ImGui-based applications.

Examples

Here are some examples of using ImGuiWidgets:

Knobs

Knobs are useful for creating dial-like controls:

float value = 0.5f;
float minValue = 0.0f;

ImGuiWidgets.Knob("Knob", ref value, minValue);

Icons

Icons can be used to display images with various alignment options and event delegates:

float iconWidthEms = 7.5f;
float iconWidthPx = ImGuiApp.EmsToPx(iconWidthEms);

uint textureId = ImGuiApp.GetOrLoadTexture("icon.png");

ImGuiWidgets.Icon("Click Me", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()
{
	OnClick = () => MessageOK.Open("Click", "You clicked")
});

ImGui.SameLine();
ImGuiWidgets.Icon("Double Click Me", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()
{
	OnDoubleClick = () => MessageOK.Open("Double Click", "You clicked twice")
});

ImGui.SameLine();
ImGuiWidgets.Icon("Right Click Me", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()
{
	OnContextMenu = () =>
	{
		ImGui.MenuItem("Context Menu Item 1");
		ImGui.MenuItem("Context Menu Item 2");
		ImGui.MenuItem("Context Menu Item 3");
	},
});

Grid

The grid layout allows you to display items in a flexible grid:

float iconSizeEms = 7.5f;
float iconSizePx = ImGuiApp.EmsToPx(iconSizeEms);

uint textureId = ImGuiApp.GetOrLoadTexture("icon.png");

ImGuiWidgets.Grid(items, i => ImGuiWidgets.CalcIconSize(i, iconSizePx), (item, cellSize, itemSize) =>
{
	ImGuiWidgets.Icon(item, textureId, iconSizePx, Color.White.Value);
});

Color Indicator

The color indicator widget displays a color when enabled:

bool enabled = true;
Color color = Color.Red;

ImGuiWidgets.ColorIndicator("Color Indicator", enabled, color);

Image

The image widget allows you to display images with alignment options:

uint textureId = ImGuiApp.GetOrLoadTexture("image.png");

ImGuiWidgets.Image(textureId, new Vector2(100, 100));

Text

The text widget allows you to display text with alignment options:

ImGuiWidgets.Text("Hello, ImGuiWidgets!");
ImGuiWidgets.TextCentered("Hello, ImGuiWidgets!");
ImGuiWidgets.TextCenteredWithin("Hello, ImGuiWidgets!", new Vector2(100, 100));

Tree

The tree widget allows you to display hierarchical data:

using (var tree = new ImGuiWidgets.Tree())
{
	for (int i = 0; i < 5; i++)
	{
		using (tree.Child)
		{
			ImGui.Button($"Hello, Child {i}!");
			using (var subtree = new ImGuiWidgets.Tree())
			{
				using (subtree.Child)
				{
					ImGui.Button($"Hello, Grandchild!");
				}
			}
		}
	}
}

Scoped Id

The scoped ID utility class helps in creating scoped IDs for ImGui elements and ensuring they get popped appropriatley:

using (new ImGuiWidgets.ScopedId())
{
    ImGui.Button("Hello, Scoped ID!");
}

Contributing

Contributions are welcome! For feature requests, bug reports, or questions, please open an issue on the GitHub repository. If you would like to contribute code, please open a pull request with your changes.

Acknowledgements

ImGuiWidgets is inspired by the following projects:

License

ImGuiWidgets is licensed under the MIT License. See LICENSE for more information.

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. 
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.1-pre.1 0 1/8/2025
1.1.0 58 1/5/2025
1.0.15 104 12/27/2024
1.0.15-pre.9 51 1/4/2025
1.0.15-pre.8 40 1/3/2025
1.0.15-pre.7 46 1/3/2025
1.0.15-pre.6 47 1/3/2025
1.0.15-pre.5 52 1/1/2025
1.0.15-pre.4 64 12/31/2024
1.0.15-pre.3 45 12/29/2024
1.0.15-pre.2 39 12/28/2024
1.0.15-pre.1 45 12/27/2024
1.0.14-pre.1 41 12/27/2024
1.0.13 84 12/26/2024
1.0.12 86 12/26/2024
1.0.11 83 12/25/2024
1.0.10 86 12/24/2024
1.0.10-pre.1 40 12/27/2024
1.0.9 85 12/23/2024
1.0.8 71 12/23/2024
1.0.7 87 12/22/2024
1.0.6 74 12/22/2024
1.0.5 83 12/22/2024
1.0.4 84 12/22/2024
1.0.3 90 12/19/2024
1.0.2 90 12/19/2024
1.0.1 76 12/19/2024
1.0.0 81 12/19/2024
1.0.0-alpha.116 54 12/18/2024
1.0.0-alpha.115 144 12/17/2024
1.0.0-alpha.114 69 12/14/2024
1.0.0-alpha.113 62 12/13/2024
1.0.0-alpha.112 60 12/12/2024
1.0.0-alpha.111 70 12/11/2024
1.0.0-alpha.110 68 12/10/2024
1.0.0-alpha.109 75 12/7/2024
1.0.0-alpha.108 54 12/6/2024
1.0.0-alpha.107 76 12/5/2024
1.0.0-alpha.106 72 12/2/2024
1.0.0-alpha.105 43 12/2/2024
1.0.0-alpha.104 46 12/2/2024
1.0.0-alpha.103 47 12/2/2024
1.0.0-alpha.102 52 12/2/2024
1.0.0-alpha.101 44 12/2/2024
1.0.0-alpha.100 68 12/1/2024
1.0.0-alpha.99 53 12/1/2024
1.0.0-alpha.98 53 12/1/2024
1.0.0-alpha.97 47 11/30/2024
1.0.0-alpha.96 46 11/30/2024
1.0.0-alpha.95 62 11/29/2024
1.0.0-alpha.94 70 11/28/2024
1.0.0-alpha.93 66 11/26/2024
1.0.0-alpha.92 57 11/26/2024
1.0.0-alpha.91 71 11/23/2024
1.0.0-alpha.90 70 11/22/2024
1.0.0-alpha.89 65 11/21/2024
1.0.0-alpha.88 73 11/20/2024
1.0.0-alpha.87 52 11/19/2024
1.0.0-alpha.86 52 11/16/2024
1.0.0-alpha.85 50 11/15/2024
1.0.0-alpha.84 54 11/14/2024
1.0.0-alpha.83 59 11/13/2024
1.0.0-alpha.82 56 11/12/2024
1.0.0-alpha.81 68 11/9/2024
1.0.0-alpha.80 51 11/8/2024
1.0.0-alpha.79 53 11/7/2024
1.0.0-alpha.78 47 11/6/2024
1.0.0-alpha.77 66 11/5/2024
1.0.0-alpha.76 215 11/2/2024
1.0.0-alpha.75 49 11/1/2024
1.0.0-alpha.74 122 10/30/2024
1.0.0-alpha.73 58 10/26/2024
1.0.0-alpha.72 60 10/23/2024
1.0.0-alpha.71 54 10/22/2024
1.0.0-alpha.70 80 10/19/2024
1.0.0-alpha.69 77 10/18/2024
1.0.0-alpha.68 78 10/17/2024
1.0.0-alpha.67 57 10/16/2024
1.0.0-alpha.66 59 10/15/2024
1.0.0-alpha.65 62 10/12/2024
1.0.0-alpha.64 51 10/11/2024
1.0.0-alpha.63 59 10/10/2024
1.0.0-alpha.62 67 10/8/2024
1.0.0-alpha.61 64 10/5/2024
1.0.0-alpha.60 50 10/4/2024
1.0.0-alpha.59 180 9/30/2024
1.0.0-alpha.58 117 9/30/2024
1.0.0-alpha.57 69 9/30/2024
1.0.0-alpha.56 52 9/30/2024
1.0.0-alpha.55 57 9/30/2024
1.0.0-alpha.54 57 9/28/2024
1.0.0-alpha.53 50 9/27/2024
1.0.0-alpha.52 64 9/26/2024
1.0.0-alpha.51 66 9/25/2024
1.0.0-alpha.50 68 9/24/2024
1.0.0-alpha.49 66 9/23/2024
1.0.0-alpha.48 68 9/21/2024
1.0.0-alpha.47 62 9/19/2024
1.0.0-alpha.46 55 9/19/2024
1.0.0-alpha.45 47 9/19/2024
1.0.0-alpha.44 64 9/19/2024
1.0.0-alpha.43 108 9/18/2024
1.0.0-alpha.42 57 9/18/2024
1.0.0-alpha.41 58 9/18/2024
1.0.0-alpha.40 53 9/18/2024
1.0.0-alpha.39 72 9/18/2024
1.0.0-alpha.38 91 9/14/2024
1.0.0-alpha.37 66 9/14/2024

## v1.1.0 (minor)

Changes since v1.0.0:

- Add API documentation ([@matt-edmondson](https://github.com/matt-edmondson))
- Add automation scripts for metadata management and versioning ([@matt-edmondson](https://github.com/matt-edmondson))
- Renamed metadata files ([@matt-edmondson](https://github.com/matt-edmondson))
- Replace LICENSE file with LICENSE.md and update copyright information ([@matt-edmondson](https://github.com/matt-edmondson))

## v1.0.14-pre.1 (patch)

Changes since v1.0.13:

- Renamed metadata files ([@matt-edmondson](https://github.com/matt-edmondson))

## v1.0.12 (patch)

Changes since v1.0.11:

- Replace LICENSE file with LICENSE.md and update copyright information ([@matt-edmondson](https://github.com/matt-edmondson))

## v1.0.0 (major)

Changes since 0.0.0.0:

- Add a comment explaining the new break case ([@Damon3000s](https://github.com/Damon3000s))
- Add a common interface to facilitate scaling of all widgets by a common scale value ([@matt-edmondson](https://github.com/matt-edmondson))
- Add a delegate to get the string to show in the list for each item ([@matt-edmondson](https://github.com/matt-edmondson))
- Add a more general Tile class ([@matt-edmondson](https://github.com/matt-edmondson))
- Add a ScopedId class for convenience ([@Damon3000s](https://github.com/Damon3000s))
- Add basic visual debug options ([@Damon3000s](https://github.com/Damon3000s))
- Add color tinting to images ([@matt-edmondson](https://github.com/matt-edmondson))
- Add ColorIndicator widget ([@matt-edmondson](https://github.com/matt-edmondson))
- Add colors ([@matt-edmondson](https://github.com/matt-edmondson))
- Add DividerContainers and zones from ImGuiApp ([@matt-edmondson](https://github.com/matt-edmondson))
- Add dividers to the demo ([@matt-edmondson](https://github.com/matt-edmondson))
- Add documentation ([@matt-edmondson](https://github.com/matt-edmondson))
- Add documentation comments ([@matt-edmondson](https://github.com/matt-edmondson))
- Add EnableWindowsTargeting to demo project ([@matt-edmondson](https://github.com/matt-edmondson))
- Add github package support ([@matt-edmondson](https://github.com/matt-edmondson))
- Add globbing support #11 ([@matt-edmondson](https://github.com/matt-edmondson))
- Add Grid layout and Icon widget to replace the Tile widget ([@matt-edmondson](https://github.com/matt-edmondson))
- Add GridOrder and fix ColumnMajor layout bug ([@Damon3000s](https://github.com/Damon3000s))
- Add IsPackable=false to the demo project ([@matt-edmondson](https://github.com/matt-edmondson))
- Add modal input popups for strings, ints, and floats ([@matt-edmondson](https://github.com/matt-edmondson))
- Add new Image and IconTile widgets ([@matt-edmondson](https://github.com/matt-edmondson))
- Add nicer knobs from https://github.com/imgui-works/imgui-knobs-dial-gauge-meter ([@matt-edmondson](https://github.com/matt-edmondson))
- Add PopupFilesystemBrowser ([@matt-edmondson](https://github.com/matt-edmondson))
- Add PopupMessageOK ([@matt-edmondson](https://github.com/matt-edmondson))
- Add PopupPrompt to display a simple prompt window with configurable buttons ([@matt-edmondson](https://github.com/matt-edmondson))
- Add searchable list popup ([@matt-edmondson](https://github.com/matt-edmondson))
- Add text input to specify a new filename when saving ([@matt-edmondson](https://github.com/matt-edmondson))
- Add trees ([@matt-edmondson](https://github.com/matt-edmondson))
- Add wrapping to knob titles and ability to put them below the knob ([@matt-edmondson](https://github.com/matt-edmondson))
- Addressing review feedback ([@Damon3000s](https://github.com/Damon3000s))
- Allow zones to be added in the constructor ([@matt-edmondson](https://github.com/matt-edmondson))
- Assign dependabot PRs to matt ([@matt-edmondson](https://github.com/matt-edmondson))
- Avoid double upload of symbols package ([@matt-edmondson](https://github.com/matt-edmondson))
- Bump ImGuiStyler ([@matt-edmondson](https://github.com/matt-edmondson))
- Change icon strings ([@Damon3000s](https://github.com/Damon3000s))
- Create dependabot-merge.yml ([@matt-edmondson](https://github.com/matt-edmondson))
- Create dependabot.yml ([@matt-edmondson](https://github.com/matt-edmondson))
- Create VERSION ([@matt-edmondson](https://github.com/matt-edmondson))
- Disable grid debugging by default ([@Damon3000s](https://github.com/Damon3000s))
- Dont try to push packages when building pull requests ([@matt-edmondson](https://github.com/matt-edmondson))
- dotnet 8 ([@matt-edmondson](https://github.com/matt-edmondson))
- Double clicking a zone handle resets it to its original size ([@matt-edmondson](https://github.com/matt-edmondson))
- Enable sourcelink ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix a crash in the line wrapping ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix a grid wrapping issue ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix a runtime cast failure when dragging divider zones ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix a type in a comment ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix broken formatting ([@Damon3000s](https://github.com/Damon3000s))
- Fix end cursor position in nested trees ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix grid layout ([@Damon3000s](https://github.com/Damon3000s))
- Fix ID stack issues in popups and add escape key to cancel popup ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix incorrect icon calculation for 1 item grid ([@Damon3000s](https://github.com/Damon3000s))
- Fix issue with not invoking the callback if you didnt pick from the list view ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix mismatched ImGui version, add a demo project, use multilevel directory props instead of project.props files ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix some knob title alignment issues ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix Tile alignment issues ([@matt-edmondson](https://github.com/matt-edmondson))
- Fix typos and renames for clarity ([@matt-edmondson](https://github.com/matt-edmondson))
- Hoist popup functionality out into its own base class so that it can be used by other projects wanting modal popups ([@matt-edmondson](https://github.com/matt-edmondson))
- Initial commit ([@matt-edmondson](https://github.com/matt-edmondson))
- Migrate ktsu.io to ktsu namespace ([@matt-edmondson](https://github.com/matt-edmondson))
- Missing changes from previous commit ([@Damon3000s](https://github.com/Damon3000s))
- Move popups into their own library ([@matt-edmondson](https://github.com/matt-edmondson))
- Provide the item dimensions to the draw delegate ([@matt-edmondson](https://github.com/matt-edmondson))
- Push id in tile render to differentiate contents ([@matt-edmondson](https://github.com/matt-edmondson))
- Read from AUTHORS file during build ([@matt-edmondson](https://github.com/matt-edmondson))
- Read from VERSION when building ([@matt-edmondson](https://github.com/matt-edmondson))
- Read PackageDescription from DESCRIPTION file ([@matt-edmondson](https://github.com/matt-edmondson))
- Refactor and enhance class constructors ([@matt-edmondson](https://github.com/matt-edmondson))
- Release v1.0.0 with extensive documentation updates ([@matt-edmondson](https://github.com/matt-edmondson))
- Remove a debug print ([@matt-edmondson](https://github.com/matt-edmondson))
- Remove intrusive scaling ([@matt-edmondson](https://github.com/matt-edmondson))
- Rollback to ImGui.NET 1.89.5 ([@matt-edmondson](https://github.com/matt-edmondson))
- Update build config ([@matt-edmondson](https://github.com/matt-edmondson))
- Update demo to include single item grid ([@Damon3000s](https://github.com/Damon3000s))
- Update Directory.Build.props ([@matt-edmondson](https://github.com/matt-edmondson))
- Update Directory.Build.targets ([@matt-edmondson](https://github.com/matt-edmondson))
- Update dotnet.yml ([@matt-edmondson](https://github.com/matt-edmondson))
- Update ImGui.NET ([@matt-edmondson](https://github.com/matt-edmondson))
- Update ImGuiStyler, ImGuiApp, and ImGuiPopups package references to latest alpha versions ([@matt-edmondson](https://github.com/matt-edmondson))
- Update LICENSE ([@matt-edmondson](https://github.com/matt-edmondson))
- Update nuget.config ([@matt-edmondson](https://github.com/matt-edmondson))
- Update package references for StrongPaths and ImGuiPopups to latest versions ([@matt-edmondson](https://github.com/matt-edmondson))
- Update package references to latest versions ([@matt-edmondson](https://github.com/matt-edmondson))
- Update README.md ([@matt-edmondson](https://github.com/matt-edmondson))
- Update SetSizesFromList to take an ICollection ([@matt-edmondson](https://github.com/matt-edmondson))
- Update to the latest ktsu.Styler version ([@Damon3000s](https://github.com/Damon3000s))
- Update url in gitignore ([@matt-edmondson](https://github.com/matt-edmondson))
- Update VERSION ([@matt-edmondson](https://github.com/matt-edmondson))
- Use the new ImGuiApp.Start signature ([@matt-edmondson](https://github.com/matt-edmondson))
- v1.0.0-alpha.8 ([@matt-edmondson](https://github.com/matt-edmondson))
- Vertically center the horizontal label correctly ([@matt-edmondson](https://github.com/matt-edmondson))
- WIP PopupInput ([@matt-edmondson](https://github.com/matt-edmondson))