Files
wiki/se-launcher/development/plugin-ui.md
2025-07-09 08:19:50 +00:00

3.7 KiB

title, description, published, date, tags, editor, dateCreated
title description published date tags editor dateCreated
Plugin UI This article explains all available options to create user interfaces for your own plugins and how to use preffered Dear ImGui inside launcher environment true 2025-07-07T15:20:41.232Z markdown 2025-07-07T15:20:39.406Z

Creating UIs

The SE Launcher supports multiple approaches to creating user interfaces. Depending on your needs and the context in which the UI is displayed, you may choose from a variety of supported frameworks:


Supported UI Frameworks

  • VRage Sandbox GUI (MyGuiScreenBase)
    The native game GUI system used by the base game for menus and dialogs.

  • EmptyKeys MVVM-XAML (MyGuiScreenMvvmBase)
    A more modern approach using MVVM and XAML, as used by some newer parts of the Space Engineers UI.

  • Windows Forms / WPF
    Standard UI toolkits in the .NET ecosystem. These are generally used for external or child windows, since they cannot be rendered on the main game window.

These options are available and usable, but may require more complex setup and are outside the scope of this article.


The preferred UI system in SE Launcher is Dear ImGui, a powerful and immediate-mode GUI library.

It is used for all SE Launcher native UI and is tightly integrated into the plugin system, making it the best choice for creating custom plugin UIs.

This article focuses exclusively on using ImGui, as other frameworks are either documented elsewhere or can be studied via existing plugin implementations.


Getting Started with ImGui

To create a UI with ImGui, define a class that implements the IRenderComponent interface.

All ImGui rendering must be done inside the OnFrame() method, which is called every frame when the renderer is active.

Example: Simple UI Component

using CringePlugins.Abstractions;
using ImGuiNET;

namespace TestPlugin;

public class TestRenderComponent : IRenderComponent
{
    public void OnFrame()
    {
        if (ImGui.Begin("Test Window"))
        {
            ImGui.Button("Test");

            ImGui.End();
        }
        
        ImGui.ShowDemoWindow();
    }
}

In this example:

  • A basic ImGui window titled “Test Window” is shown.
  • A button labeled “Test” is rendered.
  • ImGui.ShowDemoWindow() displays an interactive reference window with a showcase of all ImGui features and controls.

This is an excellent way to explore the capabilities of ImGui while developing your UI.


Registering the Render Component

To make your ImGui UI render in-game, you must register the component using the RenderHandler during plugin initialization:

public void Init(object gameInstance)
{
    RenderHandler.Current.RegisterComponent(new TestRenderComponent());
}

Once registered, your OnFrame() method will be called every frame, and your ImGui-based UI will be drawn automatically.


Further Learning

ImGui is a complex and versatile UI framework, and covering all of its features is beyond the scope of this article.

To learn more, you can:

  • Explore the ImGui Demo Window via ImGui.ShowDemoWindow()

  • Look at how the SE Launcher uses ImGui in its own UI components:

These examples demonstrate real-world usage patterns for building complex UI with ImGui in the launcher environment.