Skip to content

Latest commit

 

History

History
71 lines (52 loc) · 1.82 KB

README.md

File metadata and controls

71 lines (52 loc) · 1.82 KB

Dear ImGui for Flax Engine

Dear ImGui for Flax Engine

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.

Installation

  1. Ensure to have proper system setup for C++ Scripting - see Flax Docs

  2. Clone repo into <game-project>\Plugins\ImGui

  3. Add reference to ImGui project in your game by modyfying your game <game-project>.flaxproj as follows:

...
"References": [
    {
        "Name": "$(EnginePath)/Flax.flaxproj"
    },
    {
        "Name": "$(ProjectPath)/Plugins/ImGui/ImGui.flaxproj"
    }
]
  1. 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");
}
  1. 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");
}

License

Both this plugin and ImGui are released under MIT License.