UI Examples

This page contains examples for creating UI for your mod using the built-in ImGui library.

Everything you need to know about Dear ImGui can be found here and here.

Basic Window

ImGui.SetNextWindowPos(100, 500, ImGuiCond.FirstUseEver) -- set window position x, y
ImGui.SetNextWindowSize(300, 600, ImGuiCond.Appearing) -- set window size w, h

if ImGui.Begin("Unique Window Name") then
    ImGui.Text("Hello World")
    -- more window contents here
end
ImGui.End()
if ImGui.Button("Pop Button", 120, 0) then
      ImGui.OpenPopup("Delete?")
end

if ImGui.BeginPopupModal("Delete?", true, ImGuiWindowFlags.AlwaysAutoResize) then
    ImGui.Text("This is a popup")
    
    if ImGui.Button("Close") then ImGui.CloseCurrentPopup() end
    ImGui.EndPopup()
end

Combo Box with Selectables

Checkbox

Button

Tooltip

Default tooltip on a button.

To customize the tooltip window use BeginTooltip and EndTooltip.

Multi-column layout

Creating a multi-column layout is a pain in the ass, but you can go about it like this:

You can probably use dynamic dimensions somehow. If you find out, please update this guide.

Last updated