ImGui
Bindings for ImGui directly inside lua.
Last updated
Bindings for ImGui directly inside lua.
Last updated
ImGui.Begin(id)
id
- The id of the window
Begins a new ImGui Window with the given id.
Example:
ImGui.Begin(id, windowFlags)
id
- The id of the window
windowFlags
- The for the window
Begins a new ImGui Window with the given id and additional window flags. For a list of available windowflags, .
Example:
ImGui.End()
Ends a ImGui Window.
Example:
ImGui.PushStyleColor(colorIndex, color)
Example:
ImGui.PopStyleColor(count)
count
- How many style colors to pop of the color stack
Pops a number of style colors of the color stack.
Example:
ImGui.PushStyleVarFloat(varIndex, floatValue)
floatValue
- The value to set the var to
For each time you push a style variable, you WILL have to use ImGui.PopStyleVar after you're doing using the given style variable for elements.
Example:
ImGui.PushStyleVarVec2(varIndex, vec2Value)
For each time you push a style variable, you WILL have to use ImGui.PopStyleVar after you're doing using the given style variable for elements.
Example:
ImGui.PopStyleVar(count)
count
- How many style variables to pop of the style variable stack
Pops a number of style variable of the style variable stack.
Example:
ImGui.PushFont(name, size)
name
- The name of the font
size
- The size in pixels of the font
Available Fonts:
Verdana
VerdanaBold
Impact
Beyblade
Dameron
RobotoMono-Light
Available Font sizes:
12, 14, 16, 18, 24, 32, 36, 48, 60
Pushes a font. All following elements containing text will have this font applied until it is popped with ImGui.PopFont
Make sure to use ImGui.PopFont after you're done using the font. For one PushFont you want one PopFont.
Example:
ImGui.PopFont()
Pops a font.
Example:
ImGui.GetTexture(name)
name
- The name of the texture.
Returns a pointer to a IDirect3DTexture9. This can be directly used wherever the ImGui lua bindings expect a texture. For example ImGui.Image
Custom Textures can be loaded the following way:
Locate the directory C:\Users\your user
\Anvil
Create a new directory called texture_assets
You can store any images of format .png
, .jpg
or .jpeg
in this folder
The name of each file will be the key which you pass to ImGui.GetTexture
Custom Textures Example Scenario
Suppose you put a file called icon.png into the texture_assets directory. To get access to this image as a texture that you can pass to other ImGui functions, do the following:
Full Example:
ImGui.BeginMenuBar()
Begin a menu bar.
You will have to pass the ImGuiWindowFlags.MenuBar flag to the ImGui.Begin
in order to see the menubar!
ImGui.EndMenuBar()
Ends a menu bar.
ImGui.BeginMenu(menuName)
menuName
- The name of the menu.
Begin a menu.
ImGui.EndMenu()
End a menu bar.
ImGui.MenuItem(label, shortCut, selected)
label
- The label of the menu item
shortCut
- Shortcut.
selected
- If the menu item is selected.
Example:
ImGui.SameLine(offsetFromStart, spacing)
Use this to have the next ImGui Element on the same "line" meaning vertical position.
offsetFromStart
- align to specified x position
spacing
- horizontal spacing amount in pixels
Example:
ImGui.Image(texture, size)
Renders a texture with the given size.
Example:
ImGui.Text(text)
Renders the given text.
text
- The text to render
Example:
ImGui.calcTextSize(text)
Returns the size of the given text in the context of the currently used font as a Vec2.
text
- The text
Example:
ImGui.Checkbox(text, state)
Renders a checkbox with the given text as label. Returns a tuple of two boolean values.
The first boolean indicates if the checkbox was clicked this frame. The second boolean indicates the current state of the checkbox.
text
- The label
state
- The current state of the checkbox
Example:
ImGui.Button(text, [size])
Renders a checkbox with the given text as label. Returns a tuple of two boolean values.
The first boolean indicates if the checkbox was clicked this frame. The second boolean indicates the current state of the checkbox.
label
- The label
size
- The size of the button. Optional.
Example:
ImGui.GetRandomColor([alphaFloat])
Returns a random color.
alphaFloat
- The alpha value of the color, expects 0 - 1. Optional.
Example:
colorIndex
- The color index as a
color
- The color as a
Pushes a style color identified by the colorIndex. For available indices . All following rendered elements targeted by the index will have this color applied to them.
For each time you push a style color, you WILL have to use after you're doing using the given color for elements.
varIndex
- The variable index as a
Pushes a style var identified by the varIndex. For available indices . All following rendered elements targeted by the index will have this style variable applied to them.
varIndex
- The variable index as a
vec2Value
- The value to set the var to
Pushes a style var identified by the varIndex. For available indices . All following rendered elements targeted by the index will have this style variable applied to them.
texture
- The texture to use. Use to obtain a texture.
size
- The size of the image as a