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). This repository contains a plugin project for Flax Engine games with ImGui.
Minimum supported Flax version: 1.5.
-
Ensure to have proper system setup for C++ Scripting - see Flax Docs
-
Clone repo into
<game-project>\Plugins\ImGui -
Add reference to ImGui project in your game by modyfying your game
<game-project>.flaxprojas follows:
...
"References": [
{
"Name": "$(EnginePath)/Flax.flaxproj"
},
{
"Name": "$(ProjectPath)/Plugins/ImGui/ImGui.flaxproj"
}
]
- Add reference to ImGui module in your game build script (eg.
Game.Build.cs) as follows:
/// <inheritdoc />
public override void Setup(BuildOptions options)
{
base.Setup(options);
BuildNativeCode = false;
options.ScriptingAPI.IgnoreMissingDocumentationWarnings = true;
// Add reference to ImGui
options.PrivateDependencies.Add("ImGui");
}- Test it out!
Now you can use ImGui API directly in your game code within Update (scripts, plugins, anywhere within game logic update) as follows:
// C++
#include "ImGui/imgui.h"
void MyScript::OnUpdate()
{
ImGui::Text("Hello, world %d", 123);
ImGui::Button("Click");
}// C#
public override void OnUpdate()
{
ImGui.Text("Hello!");
ImGui.Button("Click");
}Both this plugin and ImGui are released under MIT License.
