ImGui
The imgui object lets you build in game mod menus using Dear ImGui widgets. Windows are registered with RegisterWindow and rendered every frame
RegisterWindow
Registers a new ImGui window with a toggle key
Args
title- The window title shown in the title bardraw- The draw callback, called every frame while the window is opentogglekey- The virtual key code used to toggle the windowlockinput-1to lock mouse and keyboard input while the window is open,0to allow movement
local KEY_INSERT = 0x2D
RegisterWindow("My mod menu", function()
imgui:Text("Hello!!")
end, KEY_INSERT, 1)
Widgets
Text
Displays a line of text
Args
text - The text to display
ColoredText
Displays a line of text with a custom color
Args
text- The text to displayr,g,b,a- The color components, each between0.0and1.0
Button
Displays a button and returns true if it was clicked
Args
text - The button label
Checkbox
Displays a checkbox and returns the current boolean state
Args
text- The checkbox labelvalue- The current boolean state
SliderFloat
Displays a float slider and returns the current value
Args
text- The slider labelvalue- The current float valuemin- The minimum valuemax- The maximum value
SliderInt
Displays an integer slider and returns the current value
Args
text- The slider labelvalue- The current integer valuemin- The minimum valuemax- The maximum value
local credits = 0
credits = imgui:SliderInt("Money", credits, 0, 999999)
if imgui:Button("Apply Money") then
player.money = credits
end
InputText
Displays a text input field and returns the current string value
Args
text- The input labelvalue- The current string value
InputFloat
Displays a float input field and returns the current value
Args
text- The input labelvalue- The current float value
InputInt
Displays an integer input field and returns the current value
Args
text- The input labelvalue- The current integer value
Layout
Separator
Draws a horizontal separator line
SameLine
Places the next widget on the same line as the previous one
Spacing
Adds a blank line of vertical spacing
Frame
SetWindowOpen
Displays the ImGui window
Args
title- The window titleisopen- Visible state of the window
IsWindowOpen
Returns true if the ImGui window is open
Args
title- The window title