All Projects → psydack → uimgui

psydack / uimgui

Licence: MIT, Unknown licenses found Licenses found MIT LICENSE Unknown LICENSE.meta
UImGui (Unity ImGui) is an UPM package for the immediate mode GUI library using ImGui.NET. This project is based on RG.ImGui project.

Programming Languages

C#
18002 projects
ShaderLab
938 projects
HLSL
714 projects

Labels

Projects that are alternatives of or similar to uimgui

microui-odin
A tiny immediate-mode UI library for The Odin Programming Language
Stars: ✭ 24 (-83.22%)
Mutual labels:  imgui
imgui entt entity editor
A drop-in entity editor for EnTT with Dear ImGui
Stars: ✭ 146 (+2.1%)
Mutual labels:  imgui
LiteGui
Immediate Mode GUI From Scratch
Stars: ✭ 15 (-89.51%)
Mutual labels:  imgui
Syndra
3D Game Engine/Renderer
Stars: ✭ 40 (-72.03%)
Mutual labels:  imgui
wave-gui
Yet another data-over-sound tool
Stars: ✭ 64 (-55.24%)
Mutual labels:  imgui
imgui-rs-vulkan-renderer
A Vulkan renderer for imgui-rs using Ash
Stars: ✭ 44 (-69.23%)
Mutual labels:  imgui
imgui-beef
Dear ImGui wrapper for the Beef Programming Language
Stars: ✭ 20 (-86.01%)
Mutual labels:  imgui
nuklear4j
Java binding for nuklear
Stars: ✭ 61 (-57.34%)
Mutual labels:  imgui
ButOSX
CSGO Cheat Base for MacOSX. Written in C++ & Objective C. Menu Powered by ImGui. Includes Apple TouchBar API.
Stars: ✭ 58 (-59.44%)
Mutual labels:  imgui
RCCpp-DearImGui-GLFW-example
Add Runtime Compiled C++ to the Dear ImGui example using the GLFW and OpenGL backend - with power saving
Stars: ✭ 61 (-57.34%)
Mutual labels:  imgui
ImStudio
Real-time GUI layout designer for Dear ImGui
Stars: ✭ 285 (+99.3%)
Mutual labels:  imgui
ParsecSoda
Parsec Soda is a custom open-source game streaming app that integrates with Parsec API and is focused in Host experience.
Stars: ✭ 135 (-5.59%)
Mutual labels:  imgui
Poptart.jl
🏂 GUI programming in Julia based on CImGui.jl
Stars: ✭ 44 (-69.23%)
Mutual labels:  imgui
binviz
Binary visualization tool primarily aimed at videogame reverse engineering & research.
Stars: ✭ 32 (-77.62%)
Mutual labels:  imgui
ImGui Widgets
my imgui widgets/skin including custom UI on openFrameworks
Stars: ✭ 24 (-83.22%)
Mutual labels:  imgui
panorama
Lightweight system monitor for Linux
Stars: ✭ 31 (-78.32%)
Mutual labels:  imgui
s7-imgui
Using s7 scheme alongside Dear ImGui to (interactively) build (cross platform) GUI apps.
Stars: ✭ 29 (-79.72%)
Mutual labels:  imgui
HalfPayne
No description or website provided.
Stars: ✭ 33 (-76.92%)
Mutual labels:  imgui
surface splatting
OpenGL demo of a point rendering and texture filtering technique called Surface Splatting.
Stars: ✭ 125 (-12.59%)
Mutual labels:  imgui
ebiten-imgui
Dear ImGui renderer for Ebitengine
Stars: ✭ 82 (-42.66%)
Mutual labels:  imgui

UImGui

GitHub tag (latest by date)
(ImGui library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)

UImGui (Unity ImGui) is an UPM package for the immediate mode GUI library using ImGui.NET. This project is based on RG.ImGui project. This project use FreeType as default renderer.

Using imgui 1.84 WIP


What is Dear ImGui?

Dear ImGui is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).

Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and lacks certain features normally found in more high-level libraries.

Motivation

To update (using ImGui.Net.dll) easier and often.

Features

Feature RG UImGui
IL2CPP ✔️
Windows ✔️ ✔️
Linux ✔️
MacOS ✔️
Custom Assert ✔️
Unity Input Manager ✔️ ✔️
Unity Input System ✔️ ✔️
Docking ✔️
RenderPipeline Built in ✔️ ✔️
RenderPipeline URP ✔️
RenderPipeline HDRP ✔️
Renderer Mesh ✔️ ✔️
Renderer Procedural ~ ✔️
FreeType ~ ✔️
Image / Texture ✔️
ImNodes ✔️
ImGuizmo ✔️
ImPlot ~

Usage

Samples

It has a demo script called ShowDemoWindow inside UImGui/Sample folder.

You can subscribe to global layout or for a specific UImGui context: If choose to use global, don't to forget to set Do Global Events to true on UImGui instance.

using UImGui;
using UnityEngine;

public class StaticSample : MonoBehaviour
{
	private void Awake()
	{
		UImGuiUtility.Layout += OnLayout;
		UImGuiUtility.OnInitialize += OnInitialize;
		UImGuiUtility.OnDeinitialize += OnDeinitialize;
	}

	private void OnLayout(UImGui.UImGui obj)
	{
		// Unity Update method. 
		// Your code belongs here! Like ImGui.Begin... etc.
	}

	private void OnInitialize(UImGui.UImGui obj)
	{
		// runs after UImGui.OnEnable();
	}

	private void OnDeinitialize(UImGui.UImGui obj)
	{
		// runs after UImGui.OnDisable();
	}

	private void OnDisable()
	{
		UImGuiUtility.Layout -= OnLayout;
		UImGuiUtility.OnInitialize -= OnInitialize;
		UImGuiUtility.OnDeinitialize -= OnDeinitialize;
	}
}

To use instance instead a global UImGui, use like this.

using UnityEngine;

public class InstanceSample : MonoBehaviour
{
	[SerializeField]
	private UImGui.UImGui _uimGuiInstance;

	private void Awake()
	{
		if (_uimGuiInstance == null)
		{
			Debug.LogError("Must assign a UImGuiInstance or use UImGuiUtility with Do Global Events on UImGui component.");
		}

		_uimGuiInstance.Layout += OnLayout;
		_uimGuiInstance.OnInitialize += OnInitialize;
		_uimGuiInstance.OnDeinitialize += OnDeinitialize;
	}

	private void OnLayout(UImGui.UImGui obj)
	{
		// Unity Update method. 
		// Your code belongs here! Like ImGui.Begin... etc.
	}

	private void OnInitialize(UImGui.UImGui obj)
	{
		// runs after UImGui.OnEnable();
	}

	private void OnDeinitialize(UImGui.UImGui obj)
	{
		// runs after UImGui.OnDisable();
	}

	private void OnDisable()
	{
		_uimGuiInstance.Layout -= OnLayout;
		_uimGuiInstance.OnInitialize -= OnInitialize;
		_uimGuiInstance.OnDeinitialize -= OnDeinitialize;
	}
}

Sample code

[SerializeField]
private float _sliderFloatValue = 1;

[SerializeField]
private string _inputText;

// Add listeners, etc ...

private void OnLayout(UImGui.UImGui obj)
{
	ImGui.Text($"Hello, world {123}");
	if (ImGui.Button("Save"))
	{
		Debug.Log("Save");
	}

	ImGui.InputText("string", ref _inputText, 100);
	ImGui.SliderFloat("float", ref _sliderFloatValue, 0.0f, 1.0f);
}

image

[SerializeField]
private Vector4 _myColor;
private bool _isOpen;

private void OnLayout(UImGui.UImGui obj)
{
	// Create a window called "My First Tool", with a menu bar.
	ImGui.Begin("My First Tool", ref _isOpen, ImGuiWindowFlags.MenuBar);
	if (ImGui.BeginMenuBar())
	{
		if (ImGui.BeginMenu("File"))
		{
			if (ImGui.MenuItem("Open..", "Ctrl+O")) { /* Do stuff */ }
			if (ImGui.MenuItem("Save", "Ctrl+S")) { /* Do stuff */ }
			if (ImGui.MenuItem("Close", "Ctrl+W")) { _isOpen = false; }
			ImGui.EndMenu();
		}
		ImGui.EndMenuBar();
	}

	// Edit a color (stored as ~4 floats)
	ImGui.ColorEdit4("Color", ref _myColor);

	// Plot some values
	float[] my_values = new float[] { 0.2f, 0.1f, 1.0f, 0.5f, 0.9f, 2.2f };
	ImGui.PlotLines("Frame Times", ref my_values[0], my_values.Length);


	// Display contents in a scrolling region
	ImGui.TextColored(new Vector4(1, 1, 0, 1), "Important Stuff");
	ImGui.BeginChild("Scrolling");
	for (int n = 0; n < 50; n++)
		ImGui.Text($"{n}: Some text");
	ImGui.EndChild();
	ImGui.End();
}

image

Image Sample

[SerializeField]
private Texture _sampleTexture;

private void OnLayout(UImGui.UImGui obj)
{
	if (ImGui.Begin("Image Sample"))
	{
		System.IntPtr id = UImGuiUtility.GetTextureId(_sampleTexture);
		Vector2 size = new Vector2(_sampleTexture.width, _sampleTexture.height)
		ImGui.Image(id, size);

		ImGui.End();
	}
}

image

Custom UserData

[Serializable]
private struct UserData
{
	public int SomeCoolValue;
}

[SerializeField]
private UserData _userData;
private string _input = "";

// Add Listeners... etc.

private unsafe void OnInitialize(UImGui.UImGui uimgui)
{
	fixed (UserData* ptr = &_userData)
	{
		uimgui.SetUserData((IntPtr)ptr);
	}
}

private unsafe void OnLayout(UImGui.UImGui obj)
{
	if (ImGui.Begin("Custom UserData"))
	{
		fixed (UserData* ptr = &_userData)
		{
			ImGuiInputTextCallback customCallback = CustomCallback;
			ImGui.InputText("label", ref _input, 100, ~(ImGuiInputTextFlags)0, customCallback, (IntPtr)ptr);
		}

		ImGui.End();
	}
}

private unsafe int CustomCallback(ImGuiInputTextCallbackData* data)
{
	IntPtr userDataPtr = (IntPtr)data->UserData;
	if (userDataPtr != IntPtr.Zero)
	{
		UserData userData = Marshal.PtrToStructure<UserData>(userDataPtr);
		Debug.Log(userData.SomeCoolValue);
	}

	// You must to overwrite how you handle with new inputs.
	// ...

	return 1;
}

image

Custom font

Thanks
Check here for more information

  • First create a method with ImGuiIOPtr like this
public void AddJapaneseFont(ImGuiIOPtr io)
{
	// you can put on StreamingAssetsFolder and call from there like:
	//string fontPath = $"{Application.streamingAssetsPath}/NotoSansCJKjp - Medium.otf";
	string fontPath = "D:\\Users\\rofli.souza\\Desktop\\NotoSansCJKjp-Medium.otf";
	io.Fonts.AddFontFromFileTTF(fontPath, 18, null, io.Fonts.GetGlyphRangesJapanese());

	// you can create a configs and do a lot of stuffs
	//ImFontConfig fontConfig = default;
	//ImFontConfigPtr fontConfigPtr = new ImFontConfigPtr(&fontConfig);
	//fontConfigPtr.MergeMode = true;
	//io.Fonts.AddFontDefault(fontConfigPtr);
	//int[] icons = { 0xf000, 0xf3ff, 0 };
	//fixed (void* iconsPtr = icons)
	//{
	//	io.Fonts.AddFontFromFileTTF("fontawesome-webfont.ttf", 18.0f, fontConfigPtr, (System.IntPtr)iconsPtr);
	//}
}
  • Assign the object that contain these method in UImGui script image
  • Create an awesome text:
if (ImGui.Begin("ウィンドウテスト"))
{
	ImGui.Text("こんにちは!テスト");

	ImGui.End();
}

image
Yay!

You can see more samples here.

Using URP

  • Add a Render Im Gui Feature render feature to the renderer asset.
  • Assign it to the render feature field of the DearImGui component.
  • Check this issue which I describe how to make it work step by step.

Using HDRP

  • When using the High Definition Render Pipeline;
  • Add a script called Custom Pass Volume anywhere on your scene;
  • Add "DearImGuiPass"
  • Update Injection Point to before or after post processing.
  • Good to go. Any doubts see this link

Using Built in

No special sets.

Directives

  • UIMGUI_REMOVE_IMPLOT: don't load implot lib and sources.
  • UIMGUI_REMOVE_IMNODES: don't load imnodes lib and sources.
  • UIMGUI_REMOVE_IMGUIZMO: don't load imguizmo lib and sources.

Known issues

Issue: Already using System.Runtime.CompilerServices.Unsafe.dll will cause the following error: Multiple precompiled assemblies with the same name System.Runtime.CompilerServices.Unsafe.dll included or the current platform Only one assembly with the same name is allowed per platform. Resolution: add UIMGUI_REMOVE_UNSAFE_DLL`` on Project Settings > Player > Other Settings > Script define symbols > Apply > Restart Unity Editor.

Issue: ImPlot isn't work right.

Issue: Font atlas crash. There's no fix. Use callback for custom font instead

Credits

Original repo https://github.com/realgamessoftware/dear-imgui-unity
Thanks to @lacrc and @airtonmotoki for encouraging me.
https://www.conventionalcommits.org/en/v1.0.0/
https://semver.org/
https://github.com/yeyushengfan258/Lyra-Cursors
https://github.com/lob/generate-changelog

License

Dear ImGui is licensed under the MIT License, see LICENSE.txt for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].