Skip to content

Class "ImGui"⚓︎

Info

You can get this class by using the global table "ImGui"

Example Code
1
local isblind = ImGui.GetVisible("braillemenu")

Reference⚓︎

For element types we use the same names as in ImGui itself. Check out the interactive ImGui example.

Icons⚓︎

All imgui text supports the usage of icons. Right now, we use "FontAwesome 6", which provides ~1400 icons. You can search for fitting icons here: https://fontawesome.com/search?o=r&m=free&s=solid

Icon usage in Lua:

If you want to add an Icon into your widget, just use the "Unicode" representation of the icon and put it in between a \u{ } string. You can find this, by selecting the icon on the fontawesome page, and looking in the top right corner of the popup-window. You can add it to your element like this:

"\u{f0f9} My Text"

This will add the "truck-medical" icon in front of the text "My text".

Result: " My Text"

Functions⚓︎

AddButton ()⚓︎

void AddButton ( string ParentId, string ElementId, string Label = "", function ClickCallback = nil, boolean IsSmall = false )⚓︎


AddCallback ()⚓︎

void AddCallback ( string ElementId, ImGuiCallback Type, Function func )⚓︎

Add a callback to an ImGui-element. An element can have one callback per type.


AddCheckbox ()⚓︎

void AddCheckbox ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, boolean IsActive = false )⚓︎


AddCombobox ()⚓︎

void AddCombobox ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, table Options, int SelectedIndex = 0, boolean IsSlider = false )⚓︎

Adds a Combobox element which represents a single line element that allows you to select a value from a dropdown menu. If isSlider is set to true, instead of a dropdown menu, the values can be selected by interacting with a slider element.

Example Code
1
ImGui.AddCombobox("catInput", "combobox1", "Combobox", function(index, val) print(index, val) end, { "Item 1", "Item 2", "Item 3" }, 1)

AddDragFloat ()⚓︎

void AddDragFloat ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, float DefaultVal = 0, float Speed = 1, float Min = INTEGER_MIN, float Min = INTEGER_MAX, string Formatting = "%.3f" )⚓︎


AddDragInteger ()⚓︎

void AddDragInteger ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, int DefaultVal = 0, float Speed = 1, int Min = INTEGER_MIN, int Min = INTEGER_MAX, string Formatting = "%d%" )⚓︎


AddElement ()⚓︎

void AddElement ( string ParentId, string ElementId = "", ImGuiElement type, string Label = "" )⚓︎

Adds a generic element to a given parent. Useful to add control elements like "SameLine", "Bullet" or "Text".


AddInputColor ()⚓︎

void AddInputColor ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, float r = 0, float g = 0, float b = 0)⚓︎

void AddInputColor ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, float r = 0, float g = 0, float b = 0, float a = 1 )⚓︎

Adds a color input element. If the parameter a is set, it acts as an RGBA input. Otherwise its just an RGB input. The float values are between 0 and 1.

The callback gets passed the r,g,b and a values as seperate parameters.

Example Code
1
2
3
ImGui.AddInputColor("catInput", "inputColorRGB", "RGB input", function(r, g, b) print(r, g, b) end, 1, 0.25, 0.45)
ImGui.AddInputColor("catInput", "inputColorRGBA", "RGBA input", function(r, g, b, a) print(r, g, b, a) end, 0.5, 0.5, 0.5,
    0.5)

AddInputController ()⚓︎

void AddInputController ( string ParentId, string ElementId, string ButtonLabel = "", function ChangeCallback = nil, float DefaultVal = 0 )⚓︎

Adds an input for Gamepad / controller buttons.

The callback gets passed the ButtonAction ID and the ImGuiKey name of the new button.


AddInputFloat ()⚓︎

void AddInputFloat ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, float DefaultVal = 0, float Step = 1, float StepFast = 100 )⚓︎


AddInputInteger ()⚓︎

void AddInputInteger ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, int DefaultVal = 0, int Step = 1, int StepFast = 100 )⚓︎


AddInputKeyboard ()⚓︎

void AddInputKeyboard ( string ParentId, string ElementId, string ButtonLabel = "", function ChangeCallback = nil, float DefaultVal = 0 )⚓︎

Adds an input for keyboard buttons.

The callback gets passed the Keyboard key ID and the ImGuiKey name of the new button.


AddInputText ()⚓︎

void AddInputText ( string ParentId, string ElementId, string Description = "", function ChangeCallback = nil, string DefaultVal = "", string HintText = "" )⚓︎

Adds a text input element. The text from HintText will get displayed as a "placeholder" inside the input element, if the input of the element is empty.


AddInputTextMultiline ()⚓︎

void AddInputTextMultiline ( string ParentId, string ElementId, string Description = "", function ChangeCallback = nil, string DefaultVal = "", float DisplayedLines = 6 )⚓︎

Adds a text input element that allows to input multiple lines of text. The attribute displayedLines can be used to change the height of the element.


AddPlotHistogram ()⚓︎

void AddPlotHistogram ( string ParentId, string ElementId, string Label = "", table Values, string OverlayText = "", float Minimum = FLT_MIN, float Maximum = FLT_MAX, float Height = 40 )⚓︎

Adds a bar-diagram displaying the given data as vertical bars. On default, minimum and maximum are set "dynamicaly", making the diagram fit its content perfectly.


AddPlotLines ()⚓︎

void AddPlotLines ( string ParentId, string ElementId, string Label = "", table Values, string OverlayText = "", float Minimum = FLT_MIN, float Maximum = FLT_MAX, float Height = 40 )⚓︎

Adds a line-diagram connecting the given values using lines. On default, minimum and maximum are set "dynamicaly", making the diagram fit its content perfectly.


AddProgressBar ()⚓︎

void AddProgressBar ( string ParentId, string ElementId, string Label = "", float Progress = 0, string OverlayText = "DEFAULT" )⚓︎

Adds a progressbar element. The progress value defines the fill percentage (0 to 1).

If the overlayText was not defined, the progressbar will display the current fill state in percent inside the progressbar (for example 50% when progress is set to 0.5).

If the label is empty, the progressbar will render over the full width of the parent element.


AddRadioButtons ()⚓︎

void AddRadioButtons ( string ParentId, string ElementId, function ChangeCallback = nil, table options, int SelectedIndex = 0, boolean renderSameLine = true )⚓︎

Example Code
1
ImGui.AddRadioButtons("catInput", "radioButtons", function(index) print(index) end, { "Radio 1", "Radio 2", "Radio 3" }, 1)

AddSliderFloat ()⚓︎

void AddSliderFloat ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, float DefaultVal = 0, float Min = INTEGER_MIN, float Max = INTEGER_MAX, string Formatting = "%.3f" )⚓︎


AddSliderInteger ()⚓︎

void AddSliderInteger ( string ParentId, string ElementId, string Label = "", function ChangeCallback = nil, int DefaultVal = 0, int Min = INTEGER_MIN, int Max = INTEGER_MAX, string Formatting = "%d%" )⚓︎


AddTab ()⚓︎

void AddTab ( string ParentId, string ElementId, string Label )⚓︎

A tab is a clickable area that shows another page or area.

The parent object needs to be a TabBar.


AddTabBar ()⚓︎

void AddTabBar ( string ParentId, string ElementId )⚓︎

A TabBar is a container which is used to store Tab elements.


AddText ()⚓︎

void AddText ( string ParentId, string Text, boolean WrapText = false, string ElementId = "" )⚓︎

Creates a text element. If wrapText is set to true, the text will wrap on the window borders. If set to false it will expand the window content till it fits.

The ElementId can be set as well, if the text should be able to be edited by later code.


CreateMenu ()⚓︎

void CreateMenu ( string ElementId, string Label = "" )⚓︎

Creates an entry to the main menu bar of Repentogon.


CreateWindow ()⚓︎

void CreateWindow ( string ElementId, string Title = "" )⚓︎

Creates a window object. You need to use LinkWindowToElement() or SetVisible() to toggle the visibility of the window.


ElementExists ()⚓︎

boolean ElementExists ( string ElementId )⚓︎

Returns true if an element with the given ID exists already.


GetMousePosition ()⚓︎

void GetMousePosition ( )⚓︎

Returns the mouse position in Screen coordinates.

Use this instead of Input.GetMousePosition() when working with imgui!


GetVisible ()⚓︎

boolean GetVisible ( string ElementId )⚓︎

Get if a window element is visible or not.


GetWindowPinned ()⚓︎

boolean GetWindowPinned ( string WindowId )⚓︎

Get the pinned state of a window.


Hide ()⚓︎

void Hide ( )⚓︎

Closes ImGui.


ImGuiToWorld ()⚓︎

void ImGuiToWorld ( Vector Position )⚓︎

Converts ImGui coordinates into World coordinates.

Bug

This function does not work correctly when the game's scale factor exceeds MaxRenderScale.


IsVisible ()⚓︎

boolean IsVisible ( )⚓︎

Called when the player is actively in ImGui. This isn't triggered by "pinned" windows.


LinkWindowToElement ()⚓︎

void LinkWindowToElement ( string WindowId, string ElementId )⚓︎

Connects a Window or Popup element to another element, making said element act as a "toggle" for that window.

Example Code

this code creates a new menu entry with one menuitem, which on click toggles a window

1
2
3
4
ImGui.CreateMenu("myMenu", "Test Menu")
ImGui.AddElement("myMenu", "myButton", ImGuiElement.MenuItem, "Some Text")
ImGui.CreateWindow("myWindow", "Some Window title")
ImGui.LinkWindowToElement("myWindow", "myButton")


PushNotification ()⚓︎

void PushNotification ( const Text, ImGuiNotificationType notificationType = 0, int lifetime = 5000 )⚓︎

Displays a pop-up message window in the style of a notification.


RemoveCallback ()⚓︎

void RemoveCallback ( string ElementId, ImGuiCallback type )⚓︎

Remove the callback of the given type from the element.


RemoveColor ()⚓︎

void RemoveColor ( string ElementId, ImGuiColor colorType )⚓︎

Remove a color modifier of the given type from the element.


RemoveElement ()⚓︎

void RemoveElement ( string ElementId )⚓︎

General function to remove any kind of element.


RemoveMenu ()⚓︎

void RemoveMenu ( string ElementId )⚓︎


RemoveWindow ()⚓︎

void RemoveWindow ( string ElementId )⚓︎


Reset ()⚓︎

void Reset ( )⚓︎

Removes all custom defined Imgui elements and resets imgui back to its original state.


SetColor ()⚓︎

void SetColor ( string ElementId, ImGuiColor ColorType, float r, float g, float b, float a = 1.0 )⚓︎

Adds a color modifier to a given element.


SetHelpmarker ()⚓︎

void SetHelpmarker ( string ElementId, string Text )⚓︎

Adds a helpmarker to a given element. A Helpmarker is a (?) element rendered on the right of an element, which when hovered displays a tooltip.


SetTextColor ()⚓︎

void SetTextColor ( string ElementId, float r, float g, float b, float a = 1.0 )⚓︎

Shortcut function to add a color modifier to text of a given element.


SetTooltip ()⚓︎

void SetTooltip ( string ElementId, string Text )⚓︎

Adds a tooltip to a given element. The tooltip is visible when the user hovers over the element.


SetVisible ()⚓︎

void SetVisible ( string ElementId, boolean Visible )⚓︎


SetWindowPinned ()⚓︎

void SetWindowPinned ( string WindowId, boolean Pinned )⚓︎

Set the pinned state of a window, making it visible when the ImGui interface is not active.


SetWindowPosition ()⚓︎

void SetWindowPosition ( string WindowId, float x, float y )⚓︎

Set the position of a window in screen coordinates.


SetWindowSize ()⚓︎

void SetWindowSize ( string WindowId, float width, float Height )⚓︎

Set the width and height of a window, in pixels.


Show ()⚓︎

void Show ( )⚓︎

Opens ImGui.


UpdateData ()⚓︎

void UpdateData ( string ElementId, ImGuiData DataType, int NewDataValue )⚓︎

void UpdateData ( string ElementId, ImGuiData DataType, float NewDataValue )⚓︎

void UpdateData ( string ElementId, ImGuiData DataType, boolean NewDataValue )⚓︎

void UpdateData ( string ElementId, ImGuiData DataType, string NewDataValue )⚓︎

void UpdateData ( string ElementId, ImGuiData DataType, table NewDataValues )⚓︎

Update arbitrary data of a given element. See ImGuiData for possible data to update.

The dataTypes and the expected NewDataValue are evaluated per element. Therefore, if you try to update data of an element where this data is not used, this function will throw an error for you.


UpdateText ()⚓︎

void UpdateText ( string ElementId, string Text )⚓︎

Shortcut function to update an element text or label.


WorldToImGui ()⚓︎

void WorldToImGui ( Vector Position )⚓︎

Converts world coordinates into ImGui coordinates.

Bug

This function does not work correctly when the game's scale factor exceeds MaxRenderScale.