UI
Create and manage user inferface elements, such as buttons, text, images, and menus.
Global Methods
All UI methods are part of the global UI
table. For example, to begin a new window, you would call UI.Begin("My Window")
.
Mouse Utilities
Functions related to mouse input and cursor.
UI.GetMousePos(): vec2
Returns the current mouse position in normalized screen coordinates (i.e., {x,y}
where x
and y
are typically between 0.0 and 1.0, relative to the game window).
UI.SetCursorVisible(visible: boolean)
Shows or hides the operating system's mouse cursor.
Window Management
Functions for creating and managing UI windows and child regions.
UI.Begin(name: string): boolean
Starts a new ImGui window. All subsequent UI elements are rendered within this window until UI.End()
is called.
Returns false
if the window is collapsed or clipped, true
otherwise. You should typically only call rendering functions if Begin
returns true
.
UI.Begin(name: string, flags: ImGuiWindowFlags): boolean
Starts a new ImGui window with the specified flags
.
Returns false
if the window is collapsed or clipped, true
otherwise.
UI.End()
Ends the current ImGui window definition. Must be called after a UI.Begin()
that returned true
.
UI.BeginChild(name: string, size: vec2, child_flags: ImGuiChildFlags, window_flags: ImGuiWindowFlags): boolean
Begins a child window area within the current window. Child windows have their own scrolling and layout.
name
: A unique identifier for the child window.
size
: The size of the child window. {x=0, y=0}
means use available content region.
child_flags
: Flags for the child region behavior.
window_flags
: ImGui window flags to apply to the child window.
Returns true
if the child window is visible and rendering should occur.
UI.EndChild()
Ends the current child window definition. Must be called after UI.BeginChild()
returns true
.
Text Display
Functions for rendering various styles of text.
UI.Text(text: string)
Renders simple text.
UI.TextColored(color: vec4, text: string)
Renders text in the specified color
(e.g., {x=1, y=0, z=0, w=1}
for red).
UI.TextDisabled(text: string)
Renders text with a disabled appearance.
UI.TextWrapped(text: string)
Renders text, automatically wrapping it within the current window or region width.
UI.LabelText(label: string, text: string)
Renders a label followed by text on the same line (e.g., "MyLabel: SomeValue").
UI.BulletText(text: string)
Renders text preceded by a bullet point.
UI.SeparatorText(text: string)
Renders text embedded within a horizontal separator.
UI.TextUnformatted(text: string)
Renders text without formatting. Faster than UI.Text
for long strings where no formatting is needed.
Buttons
Functions for creating interactive buttons.
UI.Button(label: string): boolean
Renders a standard button with the given label
.
Returns true
if the button was clicked in this frame.