Dear ImGui API: Difference between revisions

From GiderosMobile
Created page with "__TOC__ (copied from @'''rrraptor''''s GitHub '''https://github.com/MultiPain/Gideros_ImGui''') = Dear ImGui LUA binding for Gideros Mobile = == Constructor == <syntaxhighli..."
 
 
(61 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__
__TOC__
(copied from @'''rrraptor''''s GitHub '''https://github.com/MultiPain/Gideros_ImGui''')
'''Dear ImGui LUA binding for Gideros Mobile'''


= Dear ImGui LUA binding for Gideros Mobile =
GitHub '''https://github.com/MultiPain/Gideros_ImGui'''


== Constructor ==
== Constructor ==
Line 13: Line 13:
</syntaxhighlight>
</syntaxhighlight>


== EXPERIMENTAL ==
== IO Functions ==
'''GetIO'''() access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
p_open = ImGui:showLog(title, p_open [, ImGui.WindowFlags = 0]) -- draw log window
local IO = ImGui:getIO()
ImGui:writeLog(text)
</syntaxhighlight>
</syntaxhighlight>


Gestures (touch only, turned OFF by default) ''WIP'':
'''Functions''':
* tap gesture (Left Mouse Button)
Settings/.Ini Utilities
* hold gesture (Right Mouse Button)
* The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini").
<syntaxhighlight lang="lua">
* Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.
ImGui:setTouchGesturesEnabled(bool)
bool = ImGui:isTouchGesturesEnabled()
</syntaxhighlight>


== FONTS ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
IO = imgui:getIO()
IO:setFontDefault(font)
FontAtlas = IO:getFonts()
ImGuiConfigFlag = IO:getConfigFlags()
 
IO:setConfigFlags(ImGui.ConfigFlag)
Font = FontAtlas:addFont(ttf_font_path, font_size [, options])
IO:addConfigFlags(ImGui.ConfigFlag)
 
ImGuiBackendFlag = IO:getBackendFlags()
-- options (table): all parameters are optional
IO:setBackendFlags(ImGui.BackendFlag)
--     fontDataOwnedByAtlas - bool
number = IO:getIniSavingRate()
--     pixelSnapH - bool
IO:setIniSavingRate(number)
--     mergeMode - bool
string = IO:getIniFilename()
--     fontNo - number
IO:setIniFilename(string)
--     oversampleH - number
IO:saveIniSettings([path]) -- if path is not defined the it uses default path, which is set by IO:setIniFilename()
--     oversampleV - number
IO:loadIniSettings([path])
--     glyphExtraSpacingX - number
string = IO:getLogFilename()
--     glyphExtraSpacingY - number
IO:setLogFilename(string)
--     glyphOffsetX - number
number = IO:getMouseDoubleClickTime()
--     glyphOffsetY - number
IO:setMouseDoubleClickTime(number)
--     glyphMinAdvanceX - number
number = IO:getMouseDragThreshold()
--     glyphMaxAdvanceX - number
IO:setMouseDragThreshold(number)
--     rasterizerFlags - number
flag = IO:getMouseDrawCursor()
--     rasterizerMultiply - number
IO:setMouseDrawCursor(flag)
--
number = IO:getMouseDoubleClickMaxDist()
--     glyphs - table:
IO:setMouseDoubleClickMaxDist(number)
--     text(string): represents available chars
number = IO:getKeyRepeatDelay()
--     chars(table): list of specific char code (example: {0x7262, ...})
IO:setKeyRepeatDelay(number)
--     ranges(table): predefined glyph ranges (example: {ImGui.GlyphRanges_Default, ImGui.GlyphRanges_Japanese, ...})
number = IO:getKeyRepeatRate()
FontAtlas:addFonts(fontsDescription)
IO:setKeyRepeatRate(number)
-- fontsDescriptions(table):
number = IO:getFontGlobalScale()
--      description(table):
IO:setFontGlobalScale(number)
--          ttf_font_path(string): path to a font
bool = IO:getFontAllowUserScaling()
--          font_size(number): font size
IO:setFontAllowUserScaling(bool)
--          options(table): see description above
number, number = IO:getDisplayFramebufferScale()
-- example:
IO:setDisplayFramebufferScale(number, number)
-- FontAtlas:addFonts{ {"fonts/DroidSans.ttf", 16}, {"fonts/ProggyTiny.ttf", 16} }
bool = IO:getConfigMacOSXBehaviors()
 
IO:setConfigMacOSXBehaviors(bool)
Font = FontAtlas:getFont([index]) -- get font by index (if index is 0 or nil you will get default font instance)
bool = IO:getConfigInputTextCursorBlink()
FontAtlas:build() -- call after multiple FontAtlas:addFont(...) calls to update ImGui font atlas
IO:setConfigInputTextCursorBlink(bool)
FontAtlas:clearInputData()
bool = IO:getConfigWindowsResizeFromEdges()
FontAtlas:clearTexData()
IO:setConfigWindowsResizeFromEdges(bool)
FontAtlas:clearFonts()
bool = IO:getConfigWindowsMoveFromTitleBarOnly()
FontAtlas:clear()
IO:setConfigWindowsMoveFromTitleBarOnly(bool)
table = FontAtlas:getFonts() -- returns a table with all fonts (included default)
number = IO:getConfigWindowsMemoryCompactTimer()
flag = FontAtlas:isBuilt()
IO:setConfigWindowsMemoryCompactTimer(number)
number = FontAtlas:addCustomRectRegular(width, height)
string = IO:getBackendPlatformName()
number = FontAtlas:addCustomRectFontGlyph(font, id, width, height, advance_x [, offset_x, offset_y])
string = IO:getBackendRendererName()
w, h, x, y, glyph_id, offset_x, offset_y, font, is_packed_flag = FontAtlas:getCustomRectByIndex(index)
bool = IO:IsMouseDown(button)
 
number = IO:getMouseWheel()
ImGui:pushFont(font) -- font (table): object returned by FontAtlas:addFont(...) or FontAtlas:getFont([index])
number = IO:getMouseWheelH()
ImGui:popFont()
flag = IO:wantCaptureMouse()
</syntaxhighlight>
flag = IO:wantCaptureKeyboard()
flag = IO:wantTextInput()
flag = IO:wantSetMousePos()
flag = IO:wantSaveIniSettings()
number = IO:getFramerate()
number = IO:getMetricsRenderVertices()
number = IO:getMetricsRenderIndices()
number = IO:getMetricsRenderWindows()
number = IO:getMetricsActiveWindows()
number = IO:getMetricsActiveAllocations()
x, y = IO:getMouseDelta()
number = IO:getMouseDownSec(mouse_button)
IO:setDisplaySize(w, h)
w, h = IO:getDisplaySize()
number = IO:getDeltaTime()
-- reset mouse buttons state
IO:resetMouseDown()
-- reset key states (including ALT/SHIFT/CTRL/SUPER (META))
IO:resetKeysDown()
-- set ALT/SHIFT/CTRL/SUPER (META) key state
IO:setModKeyDown(key_code, bool) -- "key_code" is a gideros MOD key
-- set any key state
IO:setKeysDown(key_code, bool) -- "key_code" is a gideros regular "keyCode"
-- adds text to active text input widget
IO:addInputCharactersUTF8(text)
-- emulate wheel scrolling
IO:setMouseWheel(number)
-- sets mouse position (data only, no visual changes)
IO:setMousePos(x, y)
-- set mouse state, where index: 0 - left mouse, 1 - right, 2 - middle, 3 - unused, 4 - unused.
IO:setMouseDown(mouse_button, state) -- "mouse_button" is a gideros mouse button code


'''Minimal example''':
-- "key" is any ImGui KeyCode (check [here](#keyboard-keys))
-- "down" is a boolean
IO:addKeyEvent(key, down)
IO:addKeyAnalogEvent(key, down, number)
IO:AddMousePosEvent(x, y)
-- "button" is any ImGui button (check [here](#MouseButton))
IO:addMouseButtonEvent(button, down)
IO:addMouseWheelEvent(x, y)
 
IO:setAppAcceptingEvents([accepting_events = true])
</syntaxhighlight>
 
== Style setters/getters ==
'''GetStyle'''() instance access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame!
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local UI = ImGui.new()
local Style = ImGui:getStyle()
local IO = UI:getIO()
</syntaxhighlight>
local FontAtlas = IO:getFonts()
local VDS_font = FontAtlas:addFont("fonts/VDS.ttf", 16, {
    oversampleH = 2,
    oversampleV = 2,
glyphs = {
ranges = {ImGui.GlyphRanges_Cyrillic}
}
})
IO:setFontDefault(VDS_font)
FontAtlas:build()
stage:addChild(UI)


-- you can use multiple fonts at the same time
'''Setters/getters''':
function enterFrame(e)
<syntaxhighlight lang="lua">
UI:newFrame(e.deltaTime)
Style:setColor(ImGui.Col, color, alpha)
color, alpha = Style:getColor(ImGui.Col)
UI:pushFont(font1)
Style:setAlpha(value)
UI:text("Font1")
value = Style:getAlpha()
UI:popFont()
UI:pushFont(font2)
UI:text("Font2")
UI:popFont()
UI:render()
UI:endFrame()
end
</syntaxhighlight>


'''Glyphs example''':
Style:setWindowRounding(value)
<syntaxhighlight lang="lua">
value = Style:getWindowRounding()
local fonts = io:getFonts()
Style:setWindowBorderSize(value)
fonts:addFont(font_path, font_size, {
value = Style:getWindowBorderSize()
glyphs = {
Style:setChildRounding(value)
ranges = {
value = Style:getChildRounding()
{
Style:setChildBorderSize(value)
0x2590,0x2593, -- range1
value = Style:getChildBorderSize()
0x2660,0x266B  -- range2
Style:setPopupRounding(value)
-- ...
value = Style:getPopupRounding()
},
Style:setPopupBorderSize(value)
ImGui.GlyphRanges_Cyrillic,
value = Style:getPopupBorderSize()
{
Style:setFrameRounding(value)
0x01C0, 0x01C3 -- range3
value = Style:getFrameRounding()
},
Style:setFrameBorderSize(value)
ImGui.GlyphRanges_Korean
value = Style:getFrameBorderSize()
},
Style:setIndentSpacing(value)
value = Style:getIndentSpacing()
-- same structure:
Style:setColumnsMinSpacing(value)
ranges = {
value = Style:getColumnsMinSpacing()
{
Style:setScrollbarSize(value)
0x2590,0x2593, -- range1
value = Style:getScrollbarSize()
0x2660,0x266B, -- range2
Style:setScrollbarRounding(value)
0x01C0,0x01C3  -- range3
value = Style:getScrollbarRounding()
-- ...
Style:setGrabMinSize(value)
},
value = Style:getGrabMinSize()
ImGui.GlyphRanges_Cyrillic,
Style:setGrabRounding(value)
ImGui.GlyphRanges_Korean
value = Style:getGrabRounding()
}
Style:setLogSliderDeadzone(value)
},
value = Style:getLogSliderDeadzone()
mergeMode = true, -- merge into previous font
Style:setTabRounding(value)
})
value = Style:getTabRounding()
fonts:build()
Style:setTabBorderSize(value)
</syntaxhighlight>
value = Style:getTabBorderSize()
 
Style:setTabMinWidthForCloseButton(value)
'''Icons example''':
value = Style:getTabMinWidthForCloseButton()
<syntaxhighlight lang="lua">
Style:setMouseCursorScale(value)
local icon = utf8.char(0x2590)
value = Style:getMouseCursorScale()
ImGui:text("My icon >>" .. icon .. " << !!!")
Style:setCurveTessellationTol(value)
 
value = Style:getCurveTessellationTol()
-- or with new Luau support:
Style:setCircleSegmentMaxError(value)
ImGui:text("My icon >> \u{2590} << !!!")
value = Style:getCircleSegmentMaxError()
-- can be also stored in memory:
Style:setWindowPadding(x, y)
local icon = "\u{2590}"
x, y = Style:getWindowPadding()
</syntaxhighlight>
Style:setWindowMinSize(x, y)
 
x, y = Style:getWindowMinSize()
== Font ==
Style:setWindowTitleAlign(x, y)
<syntaxhighlight lang="lua">
x, y = Style:getWindowTitleAlign()
number = Font:getSize()
Style:setFramePadding(x, y)
FontAtlas = Font:getContainerAtlas()
x, y = Style:getFramePadding()
Font:setScale(number)
Style:setCellPadding(x, y)
number = Font:getScale()
x, y = Style:getCellPadding()
number = Font:getAscent()
Style:setItemSpacing(x, y)
number = Font:getDescent()
x, y = Style:getItemSpacing()
boo = Font:isLoaded()
Style:setItemInnerSpacing(x, y)
string = Font:getDebugName()
x, y = Style:getItemInnerSpacing()
w, h = Font:calcTextSizeA(size, max_width, wrap_width, string)
Style:setTouchExtraPadding(x, y)
Font:calcWordWrapPositionA(scale, string, wrap_width) -- not tested
x, y = Style:getTouchExtraPadding()
</syntaxhighlight>
Style:setButtonTextAlign(x, y)
 
x, y = Style:getButtonTextAlign()
== INPUTS ==
Style:setSelectableTextAlign(x, y)
<syntaxhighlight lang="lua">
x, y = Style:getSelectableTextAlign()
ImGui:onMouseHover(event)
Style:setDisplayWindowPadding(x, y)
ImGui:onMouseMove(event)
x, y = Style:getDisplayWindowPadding()
ImGui:onMouseDown(event)
Style:setDisplaySafeAreaPadding(x, y)
ImGui:onMouseUp(event)
x, y = Style:getDisplaySafeAreaPadding()
ImGui:onMouseWheel(event)
Style:setWindowMenuButtonPosition(ImGui.Dir)
dir = Style:getWindowMenuButtonPosition()
Style:setColorButtonPosition(ImGui.Dir)
dir = Style:getColorButtonPosition()
Style:setAntiAliasedLines(flag)
flag = Style:getAntiAliasedLines()
Style:setAntiAliasedLinesUseTex(flag)
flag = Style:getAntiAliasedLinesUseTex()
Style:setAntiAliasedFill(flag)
flag = Style:getAntiAliasedFill()
Style:setDisabledAlpha(number)
alpha = Style:getDisabledAlpha()
Style:setSeparatorTextBorderSize(number)
number = Style:getSeparatorTextBorderSize()
Style:setSeparatorTextAlign(x, y)
x, y = Style:getSeparatorTextAlign()
Style:setSeparatorTextPadding(x, y)
x, y = Style:getSeparatorTextPadding()
</syntaxhighlight>


ImGui:onTouchMove(event)
=== DEFAULT STYLES ===
ImGui:onTouchBegin(event)
<syntaxhighlight lang="lua">
ImGui:onTouchEnd(event)
ImGui:setDarkStyle()
ImGui:onTouchCancel(event)
ImGui:setLightStyle()
ImGui:setClassicStyle()
</syntaxhighlight>
 
== Render ==
'''NewFrame'''() start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame().


ImGui:onKeyUp(event)
'''EndFrame'''() ends the Dear ImGui frame. Automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all!
ImGui:onKeyDown(event)
ImGui:onKeyChar(event)
</syntaxhighlight>


'''Usage examples''':
'''Render'''() ends the Dear ImGui frame, finalize the draw data.
<syntaxhighlight lang="lua">
local UI = ImGui.new(nil, false, false, false)
</syntaxhighlight>


'''Mouse'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
stage:addEventListener("mouseHover", function(e) UI:onMouseHover(e) end)
ImGui:newFrame(deltaTime)
stage:addEventListener("mouseMove", function(e) UI:onMouseMove(e) end)
ImGui:render()
stage:addEventListener("mouseDown", function(e) UI:onMouseDown(e) end)
ImGui:endFrame()
stage:addEventListener("mouseUp", function(e) UI:onMouseUp(e) end)
stage:addEventListener("mouseWheel", function(e) UI:onMouseWheel(e) end)
</syntaxhighlight>
</syntaxhighlight>


'''Touch'''
=== Demos ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
stage:addEventListener("touchesCancel", function(e) ui:onTouchCancel(e) end)
is_openFlag = ImGui:showUserGuide()
stage:addEventListener("touchesMove", function(e) ui:onTouchMove(e) end)
is_openFlag = ImGui:showDemoWindow([p_open])
stage:addEventListener("touchesBegin", function(e) ui:onTouchBegin(e) end)
is_openFlag = ImGui:showAboutWindow([p_open])
stage:addEventListener("touchesEnd", function(e) ui:onTouchEnd(e) end)
is_openFlag = ImGui:showStyleEditor()
is_openFlag = ImGui:showFontSelector()
is_openFlag = ImGui:showMetricsWindow([p_open])
is_openFlag = ImGui:showStyleSelector(label)
is_openFlag = ImGui:ShowStackToolWindow([p_open])
ImGui:showLuaStyleEditor()
</syntaxhighlight>
</syntaxhighlight>


'''Keyboard'''
== Windows ==
* Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
* You may append multiple times to the same window during the same frame.
* Passing bool* p_open != NULL shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
* Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. Always call a matching End() for each Begin() call, regardless of its return value! [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu / EndMenu, BeginPopup / EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.]
* Note that the bottom of window stack always contains a window called "Debug".
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
stage:addEventListener("keyUp", function(e) UI:onKeyUp(e) end)
p_open, draw = ImGui:beginWindow(label, p_open [, ImGui.WindowFlags = 0])
stage:addEventListener("keyDown", function(e) UI:onKeyDown(e) end)
-- do not show "X" button
stage:addEventListener("keyChar", function(e) UI:onKeyChar(e) end)
draw = ImGui:beginWindow(label, nil [, ImGui.WindowFlags = 0])
-- start a window with no borders, no paddings, no rounding and ImGui.WindowFlags_Fullscreen flag
p_open, draw = ImGui:beginFullScreenWindow(label, p_open [, ImGui.WindowFlags = 0])  
-- do not show "X" button
draw = ImGui:beginFullScreenWindow(label, nil [, ImGui.WindowFlags = 0])  
ImGui:endWindow()
</syntaxhighlight>
</syntaxhighlight>


== Style setters/getters ==
=== Child Windows ===
Get style settings instance:
Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. For each independent axis of size:
* == 0.0f -> use remaining host window size
* > 0.0f -> fixed size
* < 0.0f -> use remaining window size minus abs(size) Each axis can use a different mode, e.g. ImVec2(0,400). BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
 
'''Tip'''
Always call a matching EndChild() for each BeginChild() call, regardless of its return value [as with Begin: this is due to legacy reason and inconsistent with most BeginXXX functions apart from the regular Begin() which behaves like BeginChild().]
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local Style = ImGui:getStyle()
ImGui:beginChild(id [, w = 0, h = 0, borderFlag = false, ImGui.WindowFlags = 0])
ImGui:endChild()
</syntaxhighlight>
</syntaxhighlight>


'''Setters/getters''':
=== Windows Utilities ===
* Current window = the window we are appending into while inside a Begin() / End() block.
* Next window = next window we will Begin() into.
 
* Prefer using SetNextXXX functions (before Begin) rather than SetXXX functions (after Begin()).
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Style:setColor(ImGui.Col, color, alpha)
flag = ImGui:isWindowAppearing()
color, alpha = Style:getColor(ImGui.Col)
flag = ImGui:isWindowCollapsed()
Style:setAlpha(value)
flag = ImGui:isWindowFocused([ImGui.FocusedFlags = 0])
value = Style:getAlpha()
flag = ImGui:isWindowHovered([ImGui.HoveredFlags = 0])
Style:setWindowRounding(value)
x, y = ImGui:getWindowPos()
value = Style:getWindowRounding()
w, h = ImGui:getWindowSize()
Style:setWindowBorderSize(value)
w = ImGui:getWindowWidth()
value = Style:getWindowBorderSize()
h = ImGui:getWindowHeight()
Style:setChildRounding(value)
x1,y1, x2,y2 = ImGui:getWindowBounds() -- returns window region rectangle in global coordinates
value = Style:getChildRounding()
 
Style:setChildBorderSize(value)
ImGui:setNextWindowPos(x, y [, ImGui.Cond = 0, pivotX = 0, pivotY = 0])
value = Style:getChildBorderSize()
ImGui:setNextWindowSize(w, h [, ImGui.Cond = 0])
Style:setPopupRounding(value)
ImGui:setNextWindowContentSize(w, h)
value = Style:getPopupRounding()
ImGui:setNextWindowCollapsed(flag [, ImGui.Cond = 0])
Style:setPopupBorderSize(value)
ImGui:setNextWindowFocus()
value = Style:getPopupBorderSize()
ImGui:setNextWindowBgAlpha(alpha)
Style:setFrameRounding(value)
ImGui:setNextWindowScroll(x, y)
value = Style:getFrameRounding()
ImGui:setWindowPos(name, x, y [, ImGui.Cond = 0]) OR ImGui:setWindowPos(x, y [, ImGui.Cond = 0])
Style:setFrameBorderSize(value)
ImGui:setWindowSize(name, w, h [, ImGui.Cond = 0]) OR ImGui:setWindowSize(w, h [, ImGui.Cond = 0])
value = Style:getFrameBorderSize()
ImGui:setWindowCollapsed(name, flag [, ImGui.Cond = 0]) OR ImGui:setWindowCollapsed(flag [, ImGui.Cond = 0])
Style:setIndentSpacing(value)
ImGui:setWindowFocus(name) OR ImGui:setWindowFocus()
value = Style:getIndentSpacing()
ImGui:setWindowFontScale(scale)
Style:setColumnsMinSpacing(value)
-- scroll window when touching void
value = Style:getColumnsMinSpacing()
ImGui:scrollWhenDragging(x, y)
Style:setScrollbarSize(value)
</syntaxhighlight>
value = Style:getScrollbarSize()
 
Style:setScrollbarRounding(value)
'''☠️Note: because Dear ImGui is an Immediate Mode GUI framework, functions that fetch window properties (like scrolling, window sizes, or content regions) internally query the "current window" pointer. If ImGui:begin() hasn't been called yet, or if ImGui:end() was already called, that pointer is NULL, causing a fatal segmentation fault/crash'''
value = Style:getScrollbarRounding()
 
Style:setGrabMinSize(value)
=== Window size constraints ===
value = Style:getGrabMinSize()
Can be used to set minimum and maximum window size, plus contraint the size if needed.
Style:setGrabRounding(value)
<syntaxhighlight lang="lua">
value = Style:getGrabRounding()
-- call this function before ImGui:beginWindow()
Style:setLogSliderDeadzone(value)
ImGui:setNextWindowSizeConstraints(min_w, min_h, max_w, max_h [, resize_callback, user_data]))
value = Style:getLogSliderDeadzone()
-- resizeCallback is a function:
Style:setTabRounding(value)
function (callbackData [, user_data])
value = Style:getTabRounding()
-- do some math, and return desired size
Style:setTabBorderSize(value)
-- ...
value = Style:getTabBorderSize()
return desired_width, desired_height
Style:setTabMinWidthForCloseButton(value)
end
value = Style:getTabMinWidthForCloseButton()
</syntaxhighlight>
Style:setMouseCursorScale(value)
 
value = Style:getMouseCursorScale()
'''Resize callback''':
Style:setCurveTessellationTol(value)
<syntaxhighlight lang="lua">
value = Style:getCurveTessellationTol()
-- get window position
Style:setCircleSegmentMaxError(value)
x, y = callbackData:getPos()
value = Style:getCircleSegmentMaxError()
x = callbackData:getX()
Style:setWindowPadding(x, y)
y = callbackData:getY()
x, y = Style:getWindowPadding()
 
Style:setWindowMinSize(x, y)
-- get currrent size
x, y = Style:getWindowMinSize()
current_width, current_height = callbackData:getCurrentSize()
Style:setWindowTitleAlign(x, y)
current_width = callbackData:getCurrentWidth()
x, y = Style:getWindowTitleAlign()
current_height = callbackData:getCurrentHeight()
Style:setFramePadding(x, y)
 
x, y = Style:getFramePadding()
-- get desired size
Style:setCellPadding(x, y)
desired_width, desired_height = callbackData:getDesiredSize()
x, y = Style:getCellPadding()
desired_width = callbackData:getDesiredWidth()
Style:setItemSpacing(x, y)
desired_height = callbackData:getDesiredHeight()
x, y = Style:getItemSpacing()
</syntaxhighlight>
Style:setItemInnerSpacing(x, y)
 
x, y = Style:getItemInnerSpacing()
'''Example''':
Style:setTouchExtraPadding(x, y)
<syntaxhighlight lang="lua">
x, y = Style:getTouchExtraPadding()
require "ImGui"
Style:setButtonTextAlign(x, y)
 
x, y = Style:getButtonTextAlign()
local function stepSize(callback_data, step)
Style:setSelectableTextAlign(x, y)
local w, h = callback_data:getDesiredSize()
x, y = Style:getSelectableTextAlign()
w = (w // step) * step
Style:setDisplayWindowPadding(x, y)
h = (h // step) * step
x, y = Style:getDisplayWindowPadding()
return w, h
Style:setDisplaySafeAreaPadding(x, y)
end
x, y = Style:getDisplaySafeAreaPadding()
 
Style:setWindowMenuButtonPosition(ImGui.Dir)
local ui = ImGui.new()
dir = Style:getWindowMenuButtonPosition()
stage:addChild(ui)
Style:setColorButtonPosition(ImGui.Dir)
 
dir = Style:getColorButtonPosition()
stage:addEventListener("enterFrame", function(e)
Style:setAntiAliasedLines(flag)
ui:newFrame(e.deltaTime)
flag = Style:getAntiAliasedLines()
Style:setAntiAliasedLinesUseTex(flag)
-- window size step is 32 (last argument, that is passed to the callback as second argument)
flag = Style:getAntiAliasedLinesUseTex()
ui:setNextWindowSizeConstraints(200, 200, 400, 400, stepSize, 32)
Style:setAntiAliasedFill(flag)
if (ui:beginWindow("My window")) then
flag = Style:getAntiAliasedFill()
Style:setDisabledAlpha(number)
ui:textWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
alpha = Style:getDisabledAlpha()
end
Style:setSeparatorTextBorderSize(number)
ui:endWindow()
number = Style:getSeparatorTextBorderSize()
Style:setSeparatorTextAlign(x, y)
ui:showDemoWindow()
x, y = Style:getSeparatorTextAlign()
Style:setSeparatorTextPadding(x, y)
ui:render()
x, y = Style:getSeparatorTextPadding()
ui:endFrame()
</syntaxhighlight>
end)
</syntaxhighlight>
 
=== Content region ===
* Those functions are bound to be redesigned soon (they are confusing, incomplete and return values in local window coordinates which increases confusion)


== DEFAULT STYLES ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui:setDarkStyle()
scaleX, scaleY = ImGui:getContentRegionMax()
ImGui:setLightStyle()
w, h = ImGui:getContentRegionAvail()
ImGui:setClassicStyle()
x, y = ImGui:getWindowContentRegionMin()
x, y = ImGui:getWindowContentRegionMax()
</syntaxhighlight>
</syntaxhighlight>


== Color convert ==
'''☠️Note: because Dear ImGui is an Immediate Mode GUI framework, functions that fetch window properties (like scrolling, window sizes, or content regions) internally query the "current window" pointer. If ImGui:begin() hasn't been called yet, or if ImGui:end() was already called, that pointer is NULL, causing a fatal segmentation fault/crash'''
'''Note''': use ''DOT'' instead of ''COLON'', so you can use it without creating an ImGui object
<syntaxhighlight lang="lua">
r, g, b, a = ImGui.colorConvertHEXtoRGB(color [, alpha = 1])
hex = ImGui.colorConvertRGBtoHEX(r, g, b)
h, s, v = ImGui.colorConvertRGBtoHSV(r, g, b)
r, g, b = ImGui.colorConvertHSVtoRGB(h, s, v)
h, s, v = ImGui.colorConvertHEXtoHSV(hex)
hex = ImGui.colorConvertHSVtoHEX(h, s, v)
</syntaxhighlight>


== IO Functions ==
=== Windows Scrolling ===
Get IO instance:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local IO = ImGui:getIO()
x = ImGui:getScrollX()
y = ImGui:getScrollY()
maxX = ImGui:getScrollMaxX()
maxY = ImGui:getScrollMaxY()
ImGui:setScrollX(value)
ImGui:setScrollY(value)
ImGui:setScrollHereX([ratio = 0.5])
ImGui:setScrollHereY([ratio = 0.5])
ImGui:setScrollFromPosX(x [, ratio = 0.5])
ImGui:setScrollFromPosY(y [, ratio = 0.5])
</syntaxhighlight>
</syntaxhighlight>


'''Functions''':
'''☠️Note: because Dear ImGui is an Immediate Mode GUI framework, functions that fetch window properties (like scrolling, window sizes, or content regions) internally query the "current window" pointer. If ImGui:begin() hasn't been called yet, or if ImGui:end() was already called, that pointer is NULL, causing a fatal segmentation fault/crash'''
 
'''Example'''
<syntaxhighlight lang="lua">
self.doresetscrollbar = false
...
self.doresetscrollbar = true
 
function Level1:onEnterFrame(e)
self.imgui:newFrame(e.deltaTime)
self.imgui:beginWindow("window") -- #1
if self.doresetscrollbar then
self.doresetscrollbar = false
self.imgui:setScrollY(0)
end
...
self.imgui:endWindow() -- #1
self.imgui:endFrame()
self.imgui:render()
end
</syntaxhighlight>
 
== Parameters stacks (shared) ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
IO:setFontDefault(font)
ImGui:pushStyleColor(ImGui.Col, color, alpha) -- https://wiki.gideros.rocks/index.php/Dear_ImGui_Flags#Col
ImGuiConfigFlag = IO:getConfigFlags()
ImGui:popStyleColor([count = 1])
IO:setConfigFlags(ImGui.ConfigFlag)
ImGui:pushStyleVar(ImGui.StyleVar, value) OR ImGui:pushStyleVar(ImGui.StyleVar, value1, value2)
IO:addConfigFlags(ImGui.ConfigFlag)
ImGui:popStyleVar([count = 1])
ImGuiBackendFlag = IO:getBackendFlags()
color, alpha = ImGui:getStyleColor(ImGui.Col)
IO:setBackendFlags(ImGui.BackendFlag)
fontSize = ImGui:getFontSize()
number = IO:getIniSavingRate()
</syntaxhighlight>
IO:setIniSavingRate(number)
 
string = IO:getIniFilename()
=== Parameters stacks (current window) ===
IO:setIniFilename(string)
<syntaxhighlight lang="lua">
IO:saveIniSettings([path]) -- if path is not defined the it uses default path, which is set by IO:setIniFilename()
ImGui:pushItemWidth(w)
IO:loadIniSettings([path])
ImGui:popItemWidth()
string = IO:getLogFilename()
ImGui:setNextItemWidth(w)
IO:setLogFilename(string)
w = ImGui:calcItemWidth()
number = IO:getMouseDoubleClickTime()
ImGui:pushTextWrapPos([localX = 0])
IO:setMouseDoubleClickTime(number)
ImGui:popTextWrapPos()
number = IO:getMouseDragThreshold()
ImGui:pushTabStop(flag)
IO:setMouseDragThreshold(number)
ImGui:popTabStop()
flag = IO:getMouseDrawCursor()
ImGui:pushButtonRepeat(flag)
IO:setMouseDrawCursor(flag)
ImGui:popButtonRepeat()
number = IO:getMouseDoubleClickMaxDist()
</syntaxhighlight>
IO:setMouseDoubleClickMaxDist(number)
 
number = IO:getKeyRepeatDelay()
== Cursor / Layout ==
IO:setKeyRepeatDelay(number)
* By "cursor" we mean the current output position.
number = IO:getKeyRepeatRate()
* The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.
IO:setKeyRepeatRate(number)
* You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceeding widget.
number = IO:getFontGlobalScale()
* '''Attention'''! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:
IO:setFontGlobalScale(number)
** '''Window-local coordinates''': ''SameLine''(), ''GetCursorPos''(), ''SetCursorPos''(), ''GetCursorStartPos''(), ''GetContentRegionMax''(), ''GetWindowContentRegion''*(), ''PushTextWrapPos''()
bool = IO:getFontAllowUserScaling()
** '''Absolute coordinate''': ''GetCursorScreenPos''(), ''SetCursorScreenPos''(), all ImDrawList:: functions
IO:setFontAllowUserScaling(bool)
 
number, number = IO:getDisplayFramebufferScale()
<syntaxhighlight lang="lua">
IO:setDisplayFramebufferScale(number, number)
ImGui:separator()
bool = IO:getConfigMacOSXBehaviors()
ImGui:sameLine([offset_x = 0, spacing = -1])
IO:setConfigMacOSXBehaviors(bool)
ImGui:newLine()
bool = IO:getConfigInputTextCursorBlink()
ImGui:spacing()
IO:setConfigInputTextCursorBlink(bool)
ImGui:dummy(w, h)
bool = IO:getConfigWindowsResizeFromEdges()
ImGui:indent([indent = 0])
IO:setConfigWindowsResizeFromEdges(bool)
ImGui:unindent([indent = 0])
bool = IO:getConfigWindowsMoveFromTitleBarOnly()
ImGui:beginGroup()
IO:setConfigWindowsMoveFromTitleBarOnly(bool)
ImGui:endGroup()
number = IO:getConfigWindowsMemoryCompactTimer()
IO:setConfigWindowsMemoryCompactTimer(number)
x, y = ImGui:getCursorPos()
string = IO:getBackendPlatformName()
x = ImGui:getCursorPosX()
string = IO:getBackendRendererName()
y = ImGui:getCursorPosY()
bool = IO:IsMouseDown(button)
ImGui:setCursorPos(local_x, local_y)
number = IO:getMouseWheel()
ImGui:setCursorPosX(local_x)
number = IO:getMouseWheelH()
ImGui:setCursorPosY(local_y)
flag = IO:wantCaptureMouse()
x, y = ImGui:getCursorStartPos()
flag = IO:wantCaptureKeyboard()
x, y = ImGui:getCursorScreenPos()
flag = IO:wantTextInput()
ImGui:setCursorScreenPos(x, y)
flag = IO:wantSetMousePos()
ImGui:alignTextToFramePadding()
flag = IO:wantSaveIniSettings()
lineH = ImGui:getTextLineHeight()
number = IO:getFramerate()
lineH = ImGui:getTextLineHeightWithSpacing()
number = IO:getMetricsRenderVertices()
frameH = ImGui:getFrameHeight()
number = IO:getMetricsRenderIndices()
frameH = ImGui:getFrameHeightWithSpacing()
number = IO:getMetricsRenderWindows()
</syntaxhighlight>
number = IO:getMetricsActiveWindows()
 
number = IO:getMetricsActiveAllocations()
== ID stack/scopes ==
x, y = IO:getMouseDelta()
* Read the FAQ for more details about how ID are handled in Dear Imgui. If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
number = IO:getMouseDownSec(mouse_button)
* The resulting ID are hashes of the entire stack.
IO:setDisplaySize(w, h)
* You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
w, h = IO:getDisplaySize()
* In this header file we use the "label"/"name" terminology to denote a string that will be displayed and used as an ID, whereas "str_id" denote a string that is only used as an ID and not normally displayed.
number = IO:getDeltaTime()
-- reset mouse buttons state
IO:resetMouseDown()
-- reset key states (including ALT/SHIFT/CTRL/SUPER (META))
IO:resetKeysDown()
-- set ALT/SHIFT/CTRL/SUPER (META) key state
IO:setModKeyDown(key_code, bool) -- "key_code" is a gideros MOD key
-- set any key state
IO:setKeysDown(key_code, bool) -- "key_code" is a gideros regular "keyCode"
-- adds text to active text input widget
IO:addInputCharactersUTF8(text)
-- emulate wheel scrolling
IO:setMouseWheel(number)
-- sets mouse position (data only, no visual changes)
IO:setMousePos(x, y)
-- set mouse state, where index: 0 - left mouse, 1 - right, 2 - middle, 3 - unused, 4 - unused.
IO:setMouseDown(mouse_button, state) -- "mouse_button" is a gideros mouse button code


-- "key" is any ImGui KeyCode (check [here](#keyboard-keys))
<syntaxhighlight lang="lua">
-- "down" is a boolean
ImGui:pushID(anyValue)  
IO:addKeyEvent(key, down)
ImGui:pushID(str)
IO:addKeyAnalogEvent(key, down, number)
ImGui:popID()
IO:AddMousePosEvent(x, y)
number = ImGui:getID(anyValue)
-- "button" is any ImGui button (check [here](#MouseButton))
number = ImGui:getID(str)
IO:addMouseButtonEvent(button, down)
number = ImGui:getItemID()
IO:addMouseWheelEvent(x, y)
</syntaxhighlight>


IO:setAppAcceptingEvents([accepting_events = true])
== WIDGETS ==
=== Widgets: Text ===
<syntaxhighlight lang="lua">
ImGui:textUnformatted(text [, textEnd])
ImGui:text(text)
ImGui:textColored(text, color, alpha)
ImGui:textDisabled(text)
ImGui:textWrapped(text)
ImGui:labelText(text, label)
ImGui:bulletText(text)
ImGui:separatorText(label)
</syntaxhighlight>
</syntaxhighlight>


== Context ==
=== Widgets: Main ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string OR nil = ImGui:getHoveredWindow()
flag = ImGui:button(text [, w = 0, h = 0])
string OR nil = ImGui:getHoveredWindowRoot()
flag = ImGui:smallButton(text)
string OR nil = ImGui:getHoveredWindowUnderMovingWindow()
flag = ImGui:invisibleButton(string_ID [, w = 0, h = 0])
string OR nil = ImGui:getMovingWindow()
flag = ImGui:arrowButton(string_ID [, ImGui.Dir = 0])
string OR nil = ImGui:getActiveIdWindow()
flag = ImGui:checkbox(text, flag)
id = ImGui:getActiveId()
flags, is_changed = ImGui:checkboxFlags(label [, flags = 0, flags_value = 0])
id = ImGui:getActiveIdPreviousFrame()
number, is_changed = ImGui:radioButton(text, number, number)
number = ImGui:getActiveIdTimer()
is_changed = ImGui:radioButton(text, flag)
id = ImGui:getActiveIdAllowOverlap()
ImGui:progressBar(fraction [, anchor_x = -1, anchor_y = 0, overlay_string = nil])
id = ImGui:getHoveredId()
ImGui:bullet()
id = ImGui:getHoveredIdPreviousFrame()
number = ImGui:getHoveredIdTimer()
id = ImGui:getHoveredIdAllowOverlap()
bool = ImGui:getDragDropActive()
id = ImGui:getDragDropPayloadSourceId()
string = ImGui:getDragDropPayloadDataType()
number = ImGui:getDragDropPayloadDataSize()
</syntaxhighlight>
</syntaxhighlight>


== WIDGETS & STUFF ==
=== Widgets: Images ===
=== Windows ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
p_open, draw = ImGui:beginWindow(label, p_open [, ImGui.WindowFlags = 0])
-- Images are streched (ImGui default functions)
-- do not show "X" button
ImGui:image(texture, w, h
draw = ImGui:beginWindow(label, nil [, ImGui.WindowFlags = 0])
[, tint_color = 0xffffff, tint_alpha = 1,
-- start a window with no borders, no paddings, no rounding and ImGui.WindowFlags_Fullscreen flag
border_color = 0xffffff, border_alpha = 0])
p_open, draw = ImGui:beginFullScreenWindow(label, p_open [, ImGui.WindowFlags = 0])
 
-- do not show "X" button
ImGui:imageUV(texture,
draw = ImGui:beginFullScreenWindow(label, nil [, ImGui.WindowFlags = 0])  
w, h,
ImGui:endWindow()
uv0x, uv0y,
</syntaxhighlight>
uv1x, uv1y,
[, tint_color = 0xffffff, tint_alpha = 1, border_color = 0xffffff, border_alpha = 0])


=== Disabled groups ===
pressFlag = ImGui:imageButton(str_id, texture, w, h
<syntaxhighlight lang="lua">
[, tint_color = 0xffffff, tint_alpha = 1,
ImGui:beginDisabled(disabledFlag)
border_color = 0xffffff, border_alpha = 0])
ImGui:endDisabled()
</syntaxhighlight>


=== Child Windows ===
pressFlag = ImGui:imageButtonUV(str_id, texture, w, h,
<syntaxhighlight lang="lua">
uv0x, uv0y, uv1x, uv1y
ImGui:beginChild(id [, w = 0, h = 0, borderFlag = false, ImGui.WindowFlags = 0])
[, tint_color = 0xffffff, tint_alpha = 1,
ImGui:endChild()
border_color = 0xffffff, border_alpha = 0])
</syntaxhighlight>


=== Windows Utilities ===
-- Images are scaled (extended by @MultiPain)
<syntaxhighlight lang="lua">
-- padding deprecated
flag = ImGui:isWindowAppearing()
-- (use "ImGui:pushStyleVar(ImGui.StyleVar_FramePadding, x, y)/ImGui:popStyleVar()")
flag = ImGui:isWindowCollapsed()
ImGui:scaledImage(str_id, texture, w, h
flag = ImGui:isWindowFocused([ImGui.FocusedFlags = 0])
[, fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
flag = ImGui:isWindowHovered([ImGui.HoveredFlags = 0])
anchor_x = 0.5, anchor_y = 0.5,
x, y = ImGui:getWindowPos()
tint_col = 0xffffff, tint_alpha = 1,
w, h = ImGui:getWindowSize()
border_col = 0, border_alpha = 0,
w = ImGui:getWindowWidth()
bg_col = 0, bg_alpha = 0])
h = ImGui:getWindowHeight()


x1,y1, x2,y2 = ImGui:getWindowBounds() -- returns window region rectangle in global coordinates
pressFlag = ImGui:scaledImageButton(str_id, texture, w, h
ImGui:setNextWindowPos(x, y [, ImGui.Cond = 0, pivotX = 0, pivotY = 0])
[, fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
ImGui:setNextWindowSize(w, h [, ImGui.Cond = 0])
ImGui.ButtonFlags = 0, anchor_x = 0.5, anchor_y = 0.5,
ImGui:setNextWindowContentSize(w, h)
clip_offset_x = 0, clip_offset_y = 0,
ImGui:setNextWindowCollapsed(flag [, ImGui.Cond = 0])
tint_col = 0xffffff, tint_alpha = 1,
ImGui:setNextWindowFocus()
border_col = 0, border_alpha = 0,
ImGui:setNextWindowBgAlpha(alpha)
bg_col = 0, bg_alpha = 0])
ImGui:setNextWindowScroll(x, y)
ImGui:setWindowPos(name, x, y [, ImGui.Cond = 0]) OR ImGui:setWindowPos(x, y [, ImGui.Cond = 0])
ImGui:setWindowSize(name, w, h [, ImGui.Cond = 0]) OR ImGui:setWindowSize(w, h [, ImGui.Cond = 0])
ImGui:setWindowCollapsed(name, flag [, ImGui.Cond = 0]) OR ImGui:setWindowCollapsed(flag [, ImGui.Cond = 0])
ImGui:setWindowFocus(name) OR ImGui:setWindowFocus()
ImGui:setWindowFontScale(scale)
-- scroll window when touching void
ImGui:scrollWhenDragging(x, y)
</syntaxhighlight>


=== Window size constraints ===
pressFlag = ImGui:scaledImageButtonWithText(texture, label, image_w, image_h
Can be used to set minimum and maximum window size, plus contraint the size if needed.
[, button_w = 0, button_h = 0, ImGui.ButtonFlags = 0,
fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
anchor_x = 0.5, anchor_y = 0.5, image_side = ImGui.Dir_Left,
clip_offset_x = 0, clip_offset_y = 0,
tint_col = 0xffffff, tint_alpha = 1,
border_col = 0, border_alpha = 0,
bg_col = 0, bg_alpha = 0])
</syntaxhighlight>
 
=== Widgets: Combo Box ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- call this function before ImGui:beginWindow()
openFlag = ImGui:beginCombo(text, preview_text [, ImGui.ComboFlags = 0])
ImGui:setNextWindowSizeConstraints(min_w, min_h, max_w, max_h [, resize_callback, user_data]))
ImGui:endCombo()
-- resizeCallback is a function:
current_item, is_open = ImGui:combo(label, current_item, items) -- items (table): {"item1", "item2", ...}
function (callbackData [, user_data])
-- do some math, and return desired size
-- ...
return desired_width, desired_height
end
</syntaxhighlight>
</syntaxhighlight>


'''Resize callback''':
=== Widgets: Drags ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- get window position
value, is_changed = ImGui:dragFloat(label, value
x, y = callbackData:getPos()
[, inc_step = 1, min = 0, max = 0,
x = callbackData:getX()
format_string = "%.3f", ImGui.SliderFlags = 0])
y = callbackData:getY()


-- get currrent size
value1, value2, is_changed = ImGui:dragFloat2(label, value1, value2
current_width, current_height = callbackData:getCurrentSize()
[, inc_step = 1, min = 0, max = 0,
current_width = callbackData:getCurrentWidth()
format_string = "%.3f", ImGui.SliderFlags = 0])
current_height = callbackData:getCurrentHeight()


-- get desired size
value1, value2, value3, is_changed = ImGui:dragFloat3(label, value1, value2, value3
deserid_width, deserid_height = callbackData:getDesiredSize()
[, inc_step = 1, min = 0, max = 0,
deserid_width = callbackData:getDesiredWidth()
format_string = "%.3f", ImGui.SliderFlags = 0])
deserid_height = callbackData:getDesiredHeight()
 
</syntaxhighlight>
value1, value2, value3, value4, is_changed = ImGui:dragFloat4(label, value1, value2, value3, value4
[, inc_step = 1, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value_min, value_max, is_changed = ImGui:dragFloatRange2(label, value_min, value_max
[, inc_step = 1, min = 0, max = 0,
format_min_string = "%.3f", ImGui.SliderFlags = 0])
-- table must be an array of any size > 0
is_changed = ImGui:dragFloatT(label, table
[, inc_step = 1, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value, is_changed = ImGui:dragInt(label, value
[, inc_step = 1, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])


'''Example''':
value1, value2, is_changed = ImGui:dragInt2(label, value1, value2
<syntaxhighlight lang="lua">
[, inc_step = 1, min = 0, max = 0,
require "ImGui"
format_string = "%d", ImGui.SliderFlags = 0])


local function stepSize(callback_data, step)
value1, value2, value3, is_changed = ImGui:dragInt3(label, value1, value2, value3
local w, h = callback_data:getDesiredSize()
[, inc_step = 1, min = 0, max = 0,
w = (w // step) * step
format_string = "%d", ImGui.SliderFlags = 0])
h = (h // step) * step
return w, h
end


local ui = ImGui.new()
value1, value2, value3, value4, is_changed = ImGui:dragInt4(label, value1, value2, value3, value4
stage:addChild(ui)
[, inc_step = 1, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])


stage:addEventListener("enterFrame", function(e)
v_current_min, v_current_max, flag = ImGui:dragIntRange2(label, v_current_min, v_current_max
ui:newFrame(e.deltaTime)
[, v_speed = 1, v_min = 0, v_max = 0,
format = "%d", format_max = nil, ImGui.SliderFlags = 0])
-- window size step is 32 (last argument, that is passed to the callback as second argument)
 
ui:setNextWindowSizeConstraints(200, 200, 400, 400, stepSize, 32)
-- table must be an array of any size > 0
if (ui:beginWindow("My window")) then
is_changed = ImGui:dragIntT(label, table
[, inc_step = 1, min = 0, max = 0,
ui:textWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
format_string = "%d", ImGui.SliderFlags = 0])
end
ui:endWindow()
ui:showDemoWindow()
ui:render()
ui:endFrame()
end)
</syntaxhighlight>
</syntaxhighlight>


=== Content region ===
=== Widgets: Sliders ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
scaleX, scaleY = ImGui:getContentRegionMax()
value, is_changed = ImGui:sliderFloat(label, value
w, h = ImGui:getContentRegionAvail()
[, min = 0, max = 0,
x, y = ImGui:getWindowContentRegionMin()
format_string = "%.3f", ImGui.SliderFlags = 0])
x, y = ImGui:getWindowContentRegionMax()
</syntaxhighlight>


=== Windows Scrolling ===
value1, value2, is_changed = ImGui:sliderFloat2(label, value1, value2
<syntaxhighlight lang="lua">
[, min = 0, max = 0,
x = ImGui:getScrollX()
format_string = "%.3f", ImGui.SliderFlags = 0])
y = ImGui:getScrollY()
 
maxX = ImGui:getScrollMaxX()
value1, value2, value3, is_changed = ImGui:sliderFloat3(label, value1, value2, value3
maxY = ImGui:getScrollMaxY()
[, min = 0, max = 0,
ImGui:setScrollX(value)
format_string = "%.3f", ImGui.SliderFlags = 0])
ImGui:setScrollY(value)
ImGui:setScrollHereX([ratio = 0.5])
ImGui:setScrollHereY([ratio = 0.5])
ImGui:setScrollFromPosX(x [, ratio = 0.5])
ImGui:setScrollFromPosY(y [, ratio = 0.5])
</syntaxhighlight>


=== Parameters stacks (shared) ===
value1, value2, value3, value4, is_changed = ImGui:sliderFloat4(label, value1, value2, value3, value4
<syntaxhighlight lang="lua">
[, min = 0, max = 0,
ImGui:pushStyleColor(ImGui.Col, color, alpha)
format_string = "%.3f", ImGui.SliderFlags = 0])
ImGui:popStyleColor([count = 1])
ImGui:pushStyleVar(ImGui.StyleVar, value) OR ImGui:pushStyleVar(ImGui.StyleVar, value1, value2)
ImGui:popStyleVar([count = 1])
color, alpha = ImGui:getStyleColor(ImGui.Col)
fontSize = ImGui:getFontSize()
</syntaxhighlight>


=== Parameters stacks (current window) ===
value_in_rad, is_changed = ImGui:sliderAngle(label, value_in_rad
<syntaxhighlight lang="lua">
[, min_degrees = -360, max_degrees = 360,
ImGui:pushItemWidth(w)
format_string = "%.0f deg", ImGui.SliderFlags = 0])
ImGui:popItemWidth()
 
ImGui:setNextItemWidth(w)
-- table must be an array of any size > 0
w = ImGui:calcItemWidth()
is_changed = ImGui:sliderFloatT(label, table
ImGui:pushTextWrapPos([localX = 0])
[, min = 0, max = 0,
ImGui:popTextWrapPos()
format_string = "%.3f", ImGui.SliderFlags = 0])
ImGui:pushTabStop(flag)
 
ImGui:popTabStop()
value, is_changed = ImGui:sliderInt(label, value
ImGui:pushButtonRepeat(flag)
[, min = 0, max = 0,
ImGui:popButtonRepeat()
format_string = "%d, ImGui.SliderFlags = 0"])
</syntaxhighlight>
 
value1, value2, is_changed = ImGui:sliderInt2(label, value1, value2
[, min = 0, max = 0,
format_string = "%d, ImGui.SliderFlags = 0"])


=== Cursor / Layout ===
value1, value2, value3, is_changed = ImGui:sliderInt3(label, value1, value2, value3
<syntaxhighlight lang="lua">
[, min = 0, max = 0,
ImGui:separator()
format_string = "%d, ImGui.SliderFlags = 0"])
ImGui:sameLine([offset_x = 0, spacing = -1])
ImGui:newLine()
ImGui:spacing()
ImGui:dummy(w, h)
ImGui:indent([indent = 0])
ImGui:unindent([indent = 0])
ImGui:beginGroup()
ImGui:endGroup()
x, y = ImGui:getCursorPos()
x = ImGui:getCursorPosX()
y = ImGui:getCursorPosY()
ImGui:setCursorPos(local_x, local_y)
ImGui:setCursorPosX(local_x)
ImGui:setCursorPosY(local_y)
x, y = ImGui:getCursorStartPos()
x, y = ImGui:getCursorScreenPos()
ImGui:setCursorScreenPos(x, y)
ImGui:alignTextToFramePadding()
lineH = ImGui:getTextLineHeight()
lineH = ImGui:getTextLineHeightWithSpacing()
frameH = ImGui:getFrameHeight()
frameH = ImGui:getFrameHeightWithSpacing()
</syntaxhighlight>


=== ID stack/scopes ===
value1, value2, value3, value4, is_changed = ImGui:sliderInt4(label, value1, value2, value3, value4
<syntaxhighlight lang="lua">
[, min = 0, max = 0,
ImGui:pushID(anyValue)
format_string = "%d, ImGui.SliderFlags = 0"])
ImGui:pushID(str)
ImGui:popID()
number = ImGui:getID(any_value)
number = ImGui:getID(string)
number = ImGui:getItemID()
</syntaxhighlight>


=== Widgets: Text ===
-- table must be an array of any size > 0
<syntaxhighlight lang="lua">
is_changed = ImGui:sliderIntT(label, table
ImGui:textUnformatted(text [, textEnd])
[, min = 0, max = 0,
ImGui:text(text)
format_string = "%d", ImGui.SliderFlags = 0])
ImGui:textColored(text, color, alpha)
ImGui:textDisabled(text)
ImGui:textWrapped(text)
ImGui:labelText(text, label)
ImGui:bulletText(text)
ImGui:separatorText(label)
</syntaxhighlight>


=== Widgets: Main ===
value, is_changed = ImGui:vSliderFloat(label, w, h, value, min, max
<syntaxhighlight lang="lua">
[, format_string = "%.3f", ImGui.SliderFlags = 0])
flag = ImGui:button(text [, w = 0, h = 0])
flag = ImGui:smallButton(text)
flag = ImGui:invisibleButton(string_ID [, w = 0, h = 0])
flag = ImGui:arrowButton(string_ID [, ImGui.Dir = 0])
flag = ImGui:checkbox(text, flag)
flags, is_changed = ImGui:checkboxFlags(label [, flags = 0, flags_value = 0])
number, is_changed = ImGui:radioButton(text, number, number)
is_changed = ImGui:radioButton(text, flag)
ImGui:progressBar(fraction [, anchor_x = -1, anchor_y = 0, overlay_string = nil])
ImGui:bullet()
</syntaxhighlight>


=== Widgets: Images ===
value, is_changed = ImGui:vSliderInt(label, w, h, value, min, max
<syntaxhighlight lang="lua">
[, format_string = "%d", ImGui.SliderFlags = 0])
-- Images are streched (ImGui default functions)
 
ImGui:image(texture, w, h
value, is_changed = ImGui:filledSliderFloat(label, mirror_flag, value
[, tint_color = 0xffffff, tint_alpha = 1,  
[, min = 0, max = 0,
border_color = 0xffffff, border_alpha = 0])
format_string = "%.3f", ImGui.SliderFlags = 0])


ImGui:imageUV(texture,
value1, value2, is_changed = ImGui:filledSliderFloat2(label, mirror_flag, value1, value2
w, h,
[, min = 0, max = 0,
uv0x, uv0y,
format_string = "%.3f", ImGui.SliderFlags = 0])
uv1x, uv1y,
[, tint_color = 0xffffff, tint_alpha = 1, border_color = 0xffffff, border_alpha = 0])


pressFlag = ImGui:imageButton(str_id, texture, w, h
value1, value2, value3, is_changed = ImGui:filledSliderFloat3(label, mirror_flag, value1, value2, value3
[, tint_color = 0xffffff, tint_alpha = 1,  
[, min = 0, max = 0,
border_color = 0xffffff, border_alpha = 0])
format_string = "%.3f", ImGui.SliderFlags = 0])


pressFlag = ImGui:imageButtonUV(str_id, texture, w, h,
value1, value2, value3, value4, is_changed = ImGui:filledSliderFloat4(label, mirror_flag, value1, value2, value3, value4
uv0x, uv0y, uv1x, uv1y
[, min = 0, max = 0,
[, tint_color = 0xffffff, tint_alpha = 1,  
format_string = "%.3f", ImGui.SliderFlags = 0])
border_color = 0xffffff, border_alpha = 0])


-- Images are scaled (extended by @MultiPain)
-- table must be an array of any size > 0
-- padding deprecated
is_changed = ImGui:filledSliderFloatT(label, mirror_flag, table
-- (use "ImGui:pushStyleVar(ImGui.StyleVar_FramePadding, x, y)/ImGui:popStyleVar()")
[, min = 0, max = 0,
ImGui:scaledImage(str_id, texture, w, h
[, fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
anchor_x = 0.5, anchor_y = 0.5,
tint_col = 0xffffff, tint_alpha = 1,
border_col = 0, border_alpha = 0,
bg_col = 0, bg_alpha = 0])
 
pressFlag = ImGui:scaledImageButton(str_id, texture, w, h
[, fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
ImGui.ButtonFlags = 0, anchor_x = 0.5, anchor_y = 0.5,
clip_offset_x = 0, clip_offset_y = 0,
tint_col = 0xffffff, tint_alpha = 1,
border_col = 0, border_alpha = 0,
bg_col = 0, bg_alpha = 0])
pressFlag = ImGui:scaledImageButtonWithText(texture, label, image_w, image_h
[, button_w = 0, button_h = 0, ImGui.ButtonFlags = 0,
fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
anchor_x = 0.5, anchor_y = 0.5, image_side = ImGui.Dir_Left,
clip_offset_x = 0, clip_offset_y = 0,
tint_col = 0xffffff, tint_alpha = 1,
border_col = 0, border_alpha = 0,
bg_col = 0, bg_alpha = 0])
</syntaxhighlight>
 
=== Widgets: Combo Box ===
<syntaxhighlight lang="lua">
openFlag = ImGui:beginCombo(text, preview_text [, ImGui.ComboFlags = 0])
ImGui:endCombo()
current_item, is_open = ImGui:combo(label, current_item, items) -- items (table): {"item1", "item2", ...}
</syntaxhighlight>
 
=== Widgets: Drags ===
<syntaxhighlight lang="lua">
value, is_changed = ImGui:dragFloat(label, value
[, inc_step = 1, min = 0, max = 0,  
format_string = "%.3f", ImGui.SliderFlags = 0])
format_string = "%.3f", ImGui.SliderFlags = 0])


value1, value2, is_changed = ImGui:dragFloat2(label, value1, value2
value_in_rad, is_changed = ImGui:filledSliderAngle(label, mirror_flag, value_in_rad
[, inc_step = 1, min = 0, max = 0,  
[, min_degrees = -360, max_degrees = 360,
format_string = "%.3f", ImGui.SliderFlags = 0])
format_string = "%.0f deg", ImGui.SliderFlags = 0])


value1, value2, value3, is_changed = ImGui:dragFloat3(label, value1, value2, value3
value, is_changed = ImGui:filledSliderInt(label, mirror_flag, value
[, inc_step = 1, min = 0, max = 0,
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value1, value2, value3, value4, is_changed = ImGui:dragFloat4(label, value1, value2, value3, value4
[, inc_step = 1, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value_min, value_max, is_changed = ImGui:dragFloatRange2(label, value_min, value_max
[, inc_step = 1, min = 0, max = 0,
format_min_string = "%.3f", ImGui.SliderFlags = 0])
-- table must be an array of any size > 0
is_changed = ImGui:dragFloatT(label, table
[, inc_step = 1, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value, is_changed = ImGui:dragInt(label, value  
[, inc_step = 1, min = 0, max = 0,  
format_string = "%d", ImGui.SliderFlags = 0])
format_string = "%d", ImGui.SliderFlags = 0])


value1, value2, is_changed = ImGui:dragInt2(label, value1, value2  
value1, value2, is_changed = ImGui:filledSliderInt2(label, mirror_flag, value1, value2
[, inc_step = 1, min = 0, max = 0,  
[, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])
format_string = "%d", ImGui.SliderFlags = 0])


value1, value2, value3, is_changed = ImGui:dragInt3(label, value1, value2, value3  
value1, value2, value3, is_changed = ImGui:filledSliderInt3(label, mirror_flag, value1, value2, value3
[, inc_step = 1, min = 0, max = 0,  
[, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])
format_string = "%d", ImGui.SliderFlags = 0])


value1, value2, value3, value4, is_changed = ImGui:dragInt4(label, value1, value2, value3, value4
value1, value2, value3, value4, is_changed = ImGui:filledSliderInt4(label, mirror_flag, value1, value2, value3, value4
[, inc_step = 1, min = 0, max = 0,  
[, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])
format_string = "%d", ImGui.SliderFlags = 0])
v_current_min, v_current_max, flag = ImGui:dragIntRange2(label, v_current_min, v_current_max
[, v_speed = 1, v_min = 0, v_max = 0,
format = "%d", format_max = nil, ImGui.SliderFlags = 0])


-- table must be an array of any size > 0
-- table must be an array of any size > 0
is_changed = ImGui:dragIntT(label, table  
is_changed = ImGui:filledSliderIntT(label, mirror_flag, table
[, inc_step = 1, min = 0, max = 0,  
[, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])
format_string = "%d", ImGui.SliderFlags = 0])
value, is_changed = ImGui:vFilledSliderFloat(label, mirror_flag, w, h, value, min, max
[, format_string = "%.3f", ImGui.SliderFlags = 0])
value, is_changed = ImGui:vFilledSliderInt(label, mirror_flag, w, h, value, min, max
[, format_string = "%d", ImGui.SliderFlags = 0])
</syntaxhighlight>
</syntaxhighlight>


=== Widgets: Sliders ===
=== Widgets: Input with Keyboard ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
value, is_changed = ImGui:sliderFloat(label, value
text, flag = ImGui:inputText(label, text, buffer_size [, ImGui.InputTextFlags = 0])
[, min = 0, max = 0,  
text, flag = ImGui:inputTextMultiline(label, text, buffer_size [, w = 0, h = 0, ImGui.InputTextFlags = 0])
format_string = "%.3f", ImGui.SliderFlags = 0])
text, flag = ImGui:inputTextWithHint(label, text, hint, buffer_size [, ImGui.InputTextFlags = 0])
 
value, flag = ImGui:inputFloat(label, value [, step = 0, step_fast = 0, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, is_changed = ImGui:sliderFloat2(label, value1, value2
value1, value2, flag = ImGui:inputFloat2(label, value1, value2 [, format = "%.3f", ImGui.InputTextFlags = 0])
[, min = 0, max = 0,  
value1, value2, value3, flag = ImGui:inputFloat3(label, value1, value2, value3 [, format = "%.3f", ImGui.InputTextFlags = 0])
format_string = "%.3f", ImGui.SliderFlags = 0])
value1, value2, value3, value4, flag = ImGui:inputFloat4(label, value1, value2, value3, value4 [, format = "%.3f", ImGui.InputTextFlags = 0])
 
value1, value2, value3, is_changed = ImGui:sliderFloat3(label, value1, value2, value3
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value1, value2, value3, value4, is_changed = ImGui:sliderFloat4(label, value1, value2, value3, value4
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])
 
value_in_rad, is_changed = ImGui:sliderAngle(label, value_in_rad
[, min_degrees = -360, max_degrees = 360,  
format_string = "%.0f deg", ImGui.SliderFlags = 0])
 
-- table must be an array of any size > 0
-- table must be an array of any size > 0
is_changed = ImGui:sliderFloatT(label, table  
flag = ImGui:inputFloatT(label, table [, format = "%.3f", ImGui.InputTextFlags = 0])
[, min = 0, max = 0,  
value,  flag = ImGui:inputInt(label, value [, step = 0, step_fast = 0, ImGui.InputTextFlags = 0])
format_string = "%.3f", ImGui.SliderFlags = 0])
value1, value2, flag = ImGui:inputInt2(label, value1, value2 [, ImGui.InputTextFlags = 0])
value1, value2, value3, flag = ImGui:inputInt3(label, value1, value2, value3 [, ImGui.InputTextFlags = 0])
value1, value2, value3, value4, flag = ImGui:inputInt4(label, value1, value2, value3, value4 [, ImGui.InputTextFlags = 0])
-- table must be an array of any size > 0
flag = ImGui:inputIntT(label, table [, format = "%d", ImGui.InputTextFlags = 0])
value, flag = ImGui:inputDouble(label, value [, step = 0, step_fast = 0, format = "%.6f", ImGui.InputTextFlags = 0])
</syntaxhighlight>


value, is_changed = ImGui:sliderInt(label, value
'''Input text callbacks''':
[, min = 0, max = 0,  
<syntaxhighlight lang="lua">
format_string = "%d, ImGui.SliderFlags = 0"])
ImGui:inputText(label, text, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])
ImGui:inputTextMultiline(label, text, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])
ImGui:inputTextWithHint(label, text, hint, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])


value1, value2, is_changed = ImGui:sliderInt2(label, value1, value2
callback_function = function(callback_data, user_data)
[, min = 0, max = 0,
-- do something with data
format_string = "%d, ImGui.SliderFlags = 0"])
-- see below
end
</syntaxhighlight>


value1, value2, value3, is_changed = ImGui:sliderInt3(label, value1, value2, value3
'''callback_data''':
[, min = 0, max = 0,
<syntaxhighlight lang="lua">
format_string = "%d, ImGui.SliderFlags = 0"])
ImGuiInputTextFlags = callback_data:getEventFlag()
ImGuiInputTextFlags = callback_data:getFlags()


value1, value2, value3, value4, is_changed = ImGui:sliderInt4(label, value1, value2, value3, value4
number = callback_data:getEventChar()
[, min = 0, max = 0,
format_string = "%d, ImGui.SliderFlags = 0"])


-- table must be an array of any size > 0
callback_data:setEventChar(number)
is_changed = ImGui:sliderIntT(label, table
[, min = 0, max = 0,
format_string = "%d", ImGui.SliderFlags = 0])


value, is_changed = ImGui:vSliderFloat(label, w, h, value, min, max
keyCode = callback_data:getEventKey()
[, format_string = "%.3f", ImGui.SliderFlags = 0])


value, is_changed = ImGui:vSliderInt(label, w, h, value, min, max
string = callback_data:getBuf()
[, format_string = "%d", ImGui.SliderFlags = 0])


value, is_changed = ImGui:filledSliderFloat(label, mirror_flag, value
callback_data:setBuf(string)
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])


value1, value2, is_changed = ImGui:filledSliderFloat2(label, mirror_flag, value1, value2
number = callback_data:getBufTextLen()
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])


value1, value2, value3, is_changed = ImGui:filledSliderFloat3(label, mirror_flag, value1, value2, value3
callback_data:setBufTextLen(number)
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])


value1, value2, value3, value4, is_changed = ImGui:filledSliderFloat4(label, mirror_flag, value1, value2, value3, value4
number = callback_data:getBufSize()
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])


-- table must be an array of any size > 0
callback_data:setBufDirty(bool)
is_changed = ImGui:filledSliderFloatT(label, mirror_flag, table
bool = callback_data:isBufDirty()
[, min = 0, max = 0,
format_string = "%.3f", ImGui.SliderFlags = 0])


value_in_rad, is_changed = ImGui:filledSliderAngle(label, mirror_flag, value_in_rad
callback_data:setCursorPos(number)
[, min_degrees = -360, max_degrees = 360,
number = callback_data:getCursorPos()
format_string = "%.0f deg", ImGui.SliderFlags = 0])


value, is_changed = ImGui:filledSliderInt(label, mirror_flag, value
callback_data:setSelectionStart(s_start)
[, min = 0, max = 0,
number = callback_data:getSelectionStart()
format_string = "%d", ImGui.SliderFlags = 0])


value1, value2, is_changed = ImGui:filledSliderInt2(label, mirror_flag, value1, value2
callback_data:setSelectionEnd(s_end)
[, min = 0, max = 0,
s_end = callback_data:getSelectionEnd()
format_string = "%d", ImGui.SliderFlags = 0])


value1, value2, value3, is_changed = ImGui:filledSliderInt3(label, mirror_flag, value1, value2, value3
callback_data:setSelection(s_start, s_end)
[, min = 0, max = 0,
s_start, s_end = callback_data:getSelection()
format_string = "%d", ImGui.SliderFlags = 0])


value1, value2, value3, value4, is_changed = ImGui:filledSliderInt4(label, mirror_flag, value1, value2, value3, value4
callback_data:selectAll()
[, min = 0, max = 0,
callback_data:clearSelection()
format_string = "%d", ImGui.SliderFlags = 0])
bool = callback_data:hasSelection()


-- table must be an array of any size > 0
callback_data:deleteChars(position, bytesCount)
is_changed = ImGui:filledSliderIntT(label, mirror_flag, table
callback_data:insertChars(position, text)
[, min = 0, max = 0,  
</syntaxhighlight>
format_string = "%d", ImGui.SliderFlags = 0])


value, is_changed = ImGui:vFilledSliderFloat(label, mirror_flag, w, h, value, min, max
'''Example''':
[, format_string = "%.3f", ImGui.SliderFlags = 0])
<syntaxhighlight lang="lua">
require "ImGui"


value, is_changed = ImGui:vFilledSliderInt(label, mirror_flag, w, h, value, min, max
ui = ImGui.new()
[, format_string = "%d", ImGui.SliderFlags = 0])
stage:addChild(ui)
</syntaxhighlight>


=== Widgets: Input with Keyboard ===
local testMessage1 = ""
<syntaxhighlight lang="lua">
local testMessage2 = ""
text, flag = ImGui:inputText(label, text, buffer_size [, ImGui.InputTextFlags = 0])
local testMessage3 = ""
text, flag = ImGui:inputTextMultiline(label, text, buffer_size [, w = 0, h = 0, ImGui.InputTextFlags = 0])
text, flag = ImGui:inputTextWithHint(label, text, hint, buffer_size [, ImGui.InputTextFlags = 0])
value,  flag = ImGui:inputFloat(label, value [, step = 0, step_fast = 0, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, flag = ImGui:inputFloat2(label, value1, value2 [, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, value3, flag = ImGui:inputFloat3(label, value1, value2, value3 [, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, value3, value4, flag = ImGui:inputFloat4(label, value1, value2, value3, value4 [, format = "%.3f", ImGui.InputTextFlags = 0])
-- table must be an array of any size > 0
flag = ImGui:inputFloatT(label, table [, format = "%.3f", ImGui.InputTextFlags = 0])
value,  flag = ImGui:inputInt(label, value [, step = 0, step_fast = 0, ImGui.InputTextFlags = 0])
value1, value2, flag = ImGui:inputInt2(label, value1, value2 [, ImGui.InputTextFlags = 0])
value1, value2, value3, flag = ImGui:inputInt3(label, value1, value2, value3 [, ImGui.InputTextFlags = 0])
value1, value2, value3, value4, flag = ImGui:inputInt4(label, value1, value2, value3, value4 [, ImGui.InputTextFlags = 0])
-- table must be an array of any size > 0
flag = ImGui:inputIntT(label, table [, format = "%d", ImGui.InputTextFlags = 0])
value, flag = ImGui:inputDouble(label, value [, step = 0, step_fast = 0, format = "%.6f", ImGui.InputTextFlags = 0])
</syntaxhighlight>


'''Input text callbacks''':
-- Add ".." at the end of current input string
<syntaxhighlight lang="lua">
function myCallback1(data)
ImGui:inputText(label, text, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])
data:insertChars(data:getCursorPos(), "..")
ImGui:inputTextMultiline(label, text, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])
end
ImGui:inputTextWithHint(label, text, hint, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])


callback_function = function(callback_data, user_data)
-- Replace all chars if UP/DOWN arrow is pressed
-- do something with data
function myCallback2(data)
-- see below
local key = data:getEventKey()
if (key == key_code.UP) then
data:deleteChars(0, data:getBufTextLen())
data:insertChars(0, "Pressed Up!")
data:selectAll()
elseif (key == key_code.DOWN) then
data:deleteChars(0, data:getBufTextLen())
data:insertChars(0, "Pressed Down!")
data:selectAll()
end
end
end
</syntaxhighlight>


'''callback_data''':
-- Switch case of the first char
<syntaxhighlight lang="lua">
function myCallback3(data)
ImGuiInputTextFlags = callback_data:getEventFlag()
local buf = data:getBuf()
ImGuiInputTextFlags = callback_data:getFlags()
local s = buf:sub(1,1)
if ((s >= 'a' and s <= 'z') or (s >= 'A' and s <= 'Z')) then
local first = string.char(string.byte(s) ~ 32)
data:setBuf(first .. buf:sub(2))
data:setBufDirty(true)
end
end


number = callback_data:getEventChar()
function enterFrame(e)
ui:newFrame(e.deltaTime)
testMessage1 = ui:inputText(
"Label1",
testMessage1,
64,
ImGui.InputTextFlags_CallbackCompletion,
myCallback1
)
testMessage2 = ui:inputText(
"Label2",
testMessage2,
64,
ImGui.InputTextFlags_CallbackHistory,
myCallback2
)
testMessage3 = ui:inputText(
"Label3",
testMessage3,
64,
ImGui.InputTextFlags_CallbackEdit,
myCallback3
)
ui:render()
ui:endFrame()
end


callback_data:setEventChar(number)
stage:addEventListener("enterFrame", enterFrame)
</syntaxhighlight>


keyCode = callback_data:getEventKey()
=== Widgets: Color Editor/Picker ===
<syntaxhighlight lang="lua">
hexColor, is_touching = ImGui:colorEdit3(label, color [, ImGui.ColorEditFlags = 0]) -- alpha ignored, no need to pass it!
hexColor, alpha, is_touching = ImGui:colorEdit4(label, color [, alpha = 1, ImGui.ColorEditFlags = 0])
hexColor, is_touching = ImGui:colorPicker3(label, color [, ImGui.ColorEditFlags = 0])
hexColor, alpha, originalColor, originalAlpha, is_touching = ImGui:colorPicker4(label, color
[, alpha = 1, original_color = 0xffffff, original_alpha = 1, ImGui.ColorEditFlags = 0])
isHoveringFlag = ImGui:colorButton(string_ID, color [, alpha = 1, ImGui.ColorEditFlags = 0, w = 0, h = 0])
ImGui:setColorEditOptions(ImGui.ColorEditFlags)
</syntaxhighlight>


string = callback_data:getBuf()
=== Widgets: Trees ===
<syntaxhighlight lang="lua">
is_openFlag = ImGui:treeNode(label [, format_string])
ImGui:treeNodeEx(label, ImGui.TreeNodeFlags [, format_string])
ImGui:treePush(str_id)
ImGui:treePop()
number = ImGui:getTreeNodeToLabelSpacing()
is_openFlag, p_open = ImGui:collapsingHeader(label, p_open [, ImGui.TreeNodeFlags = 0])
is_openFlag = ImGui:collapsingHeader(label [, ImGui.TreeNodeFlags = 0])
ImGui:setNextItemOpen(is_open, ImGui.Cond)
</syntaxhighlight>


callback_data:setBuf(string)
=== Widgets: Selectables ===
<syntaxhighlight lang="lua">
result?, selected = ImGui:selectable(label, selected [, ImGui.SelectableFlags = 0, w = 0, h = 0])
</syntaxhighlight>


number = callback_data:getBufTextLen()
=== Widgets: List Boxes ===
<syntaxhighlight lang="lua">
-- item_table: {"Item0", "Item1", ...}
current_item, is_openFlag = ImGui:listBox(label, current_item, item_table [, max_visible_items = -1])
result? = ImGui:listBoxHeader(label [, w = 0, h = 0])
result? = ImGui:listBoxHeader2(label, items_count)
ImGui:listBoxFooter()
</syntaxhighlight>


callback_data:setBufTextLen(number)
=== Widgets: Data Plotting ===
'''Caching''':


number = callback_data:getBufSize()
If you have big array of points it is better to cache it instead of translating lua table to C++ vector every time you call `ImGui:plotLines()`. But in this case you need to manage memory by yourself (free points pointer when you dont need it).
<syntaxhighlight lang="lua">
-- store points in memory
-- points_table: {0.01, 0.5, 10, -50, ...}
-- ptr: c++ pointer to a given vector
ptr = ImGui.cachePoints(points_table)


callback_data:setBufDirty(bool)
-- delete points from memory
bool = callback_data:isBufDirty()
ImGui.freePoints(ptr)
</syntaxhighlight>


callback_data:setCursorPos(number)
'''Plot functions''':
number = callback_data:getCursorPos()
<syntaxhighlight lang="lua">
-- len (number): points array length
ImGui:plotCachedLines(label, ptr, len,
[, values_offset = 0, overlay_text = nil,
scale_min = math.huge, scale_max = math.huge,
w = 0, h = 0])


callback_data:setSelectionStart(s_start)
ImGui:plotCachedHistogram(label, ptr, len,
number = callback_data:getSelectionStart()
[, values_offset = 0, overlay_text = nil,
scale_min = math.huge, scale_max = math.huge,
w = 0, h = 0])


callback_data:setSelectionEnd(s_end)
ImGui:plotLines(label, points_table
s_end = callback_data:getSelectionEnd()
[, values_offset = 0, overlay_text = nil,
scale_min = math.huge, scale_max = math.huge,
w = 0, h = 0])


callback_data:setSelection(s_start, s_end)
ImGui:plotHistogram(label, points_table
s_start, s_end = callback_data:getSelection()
[, values_offset = 0, overlay_text = nil,
 
scale_min = math.huge, scale_max = math.huge,
callback_data:selectAll()
w = 0, h = 0])
callback_data:clearSelection()
bool = callback_data:hasSelection()
 
callback_data:deleteChars(position, bytesCount)
callback_data:insertChars(position, text)
</syntaxhighlight>
</syntaxhighlight>


'''Example''':
'''Example''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
require "ImGui"
-- delete ptr if it exist
function deletePtr()
if pointsPtr then
ImGui.freePoints(pointsPtr)
end
end


ui = ImGui.new()
function onEnterFrame()
stage:addChild(ui)
ui:newFrame(e.deltaTime)
 
local testMessage1 = ""
if ui:button("Generate") then
local testMessage2 = ""
deletePtr()
local testMessage3 = ""
points = generatePoints() -- returns big array
pointsPtr = ImGui.cachePoints(points)
end
if pointsPtr then
ui:plotCachedLines("Big data", pointsPtr, #points)
end
ui:render()
ui:endFrame()
end


-- Add ".." at the end of current input string
-- do not forget to clear memory when app is closing
function myCallback1(data)
function onAppExit()
data:insertChars(data:getCursorPos(), "..")
deletePtr()
end
end
</syntaxhighlight>


-- Replace all chars if UP/DOWN arrow is pressed
=== Widgets: Value() Helpers ===
function myCallback2(data)
<syntaxhighlight lang="lua">
local key = data:getEventKey()
ImGui:value(prefix, bool)
if (key == key_code.UP) then
ImGui:value(prefix, number)
data:deleteChars(0, data:getBufTextLen())
ImGui:value(prefix, float, format_string)
data:insertChars(0, "Pressed Up!")
</syntaxhighlight>
data:selectAll()
elseif (key == key_code.DOWN) then
data:deleteChars(0, data:getBufTextLen())
data:insertChars(0, "Pressed Down!")
data:selectAll()
end
end


-- Switch case of the first char
=== Widgets: Menus ===
function myCallback3(data)
<syntaxhighlight lang="lua">
local buf = data:getBuf()
result? = ImGui:beginMenuBar()
local s = buf:sub(1,1)
ImGui:endMenuBar()
if ((s >= 'a' and s <= 'z') or (s >= 'A' and s <= 'Z')) then
result? = ImGui:beginMainMenuBar()
local first = string.char(string.byte(s) ~ 32)
ImGui:endMainMenuBar()
data:setBuf(first .. buf:sub(2))
result = ImGui:beginMenu(label [, enabled = true])
data:setBufDirty(true)
result = ImGui:beginMenuEx(label, [icon = "", enabled = true])
end
ImGui:endMenu()
end
result = ImGui:menuItem(label [, shortcut = "", selected = false, enabled = true])
result = ImGui:menuItemEx(label, [icon = "", shortcut = "", selected = false, enabled = true])
</syntaxhighlight>
 
=== Widgets: Tooltips ===
Tooltip are windows following the mouse which do not take focus away.
<syntaxhighlight lang="lua">
ImGui:beginTooltip()
ImGui:endTooltip()
ImGui:setTooltip(text)
</syntaxhighlight>
 
=== Disabled groups ===
<syntaxhighlight lang="lua">
ImGui:beginDisabled(disabledFlag)
ImGui:endDisabled()
</syntaxhighlight>


function enterFrame(e)
== Popups, Modals ==
ui:newFrame(e.deltaTime)
The properties of popups windows are: - They block normal mouse hovering detection outside them. (*1) - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE. Because hovering detection is disabled outside the popup, when clicking outside the click will not be seen by underlying widgets! (*'''1''')
testMessage1 = ui:inputText(
"Label1",  
testMessage1,
64,
ImGui.InputTextFlags_CallbackCompletion,
myCallback1
)
testMessage2 = ui:inputText(
"Label2",
testMessage2,
64,
ImGui.InputTextFlags_CallbackHistory,
myCallback2
)
testMessage3 = ui:inputText(
"Label3",  
testMessage3,  
64,
ImGui.InputTextFlags_CallbackEdit,  
myCallback3
)
ui:render()
ui:endFrame()
end


stage:addEventListener("enterFrame", enterFrame)
* Their visibility state (~bool) is held internally by Dear ImGui instead of being held by the programmer as we are used to with regular Begin() calls. User can manipulate the visibility state by calling OpenPopup(), CloseCurrentPopup() etc.
</syntaxhighlight>
* We default to use the right mouse (ImGuiMouseButton_Right=1) for the Popup Context functions.
* Those three properties are connected: we need to retain popup visibility state in the library because popups may be closed as any time.


=== Widgets: Color Editor/Picker ===
('''1'''.) You can bypass that restriction and detect hovering even when normally blocked by a popup. To do this use the ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered(). This is what BeginPopupContextItem() and BeginPopupContextWindow() are doing already, allowing a right-click to reopen another popups without losing the click.
<syntaxhighlight lang="lua">
hexColor, is_touching = ImGui:colorEdit3(label, color [, ImGui.ColorEditFlags = 0]) -- alpha ignored, no need to pass it!
hexColor, alpha, is_touching = ImGui:colorEdit4(label, color [, alpha = 1, ImGui.ColorEditFlags = 0])
hexColor, is_touching = ImGui:colorPicker3(label, color [, ImGui.ColorEditFlags = 0])
hexColor, alpha, originalColor, originalAlpha, is_touching = ImGui:colorPicker4(label, color
[, alpha = 1, original_color = 0xffffff, original_alpha = 1, ImGui.ColorEditFlags = 0])
isHoveringFlag = ImGui:colorButton(string_ID, color [, alpha = 1, ImGui.ColorEditFlags = 0, w = 0, h = 0])
ImGui:setColorEditOptions(ImGui.ColorEditFlags)
</syntaxhighlight>


=== Widgets: Trees ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
is_openFlag = ImGui:treeNode(label [, format_string])
result? = ImGui:beginPopup(str_id [, ImGui.WindowFlags = 0])
ImGui:treeNodeEx(label, ImGui.TreeNodeFlags [, format_string])
p_open, result? = ImGui:beginPopupModal(str_id, p_open [, ImGui.WindowFlags = 0])
ImGui:treePush(str_id)
ImGui:endPopup()
ImGui:treePop()
ImGui:openPopup(str_id [, ImGui.PopupFlags = 0])
number = ImGui:getTreeNodeToLabelSpacing()
ImGui:openPopupOnItemClick(str_id [, ImGui.PopupFlags = 0])
is_openFlag, p_open = ImGui:collapsingHeader(label, p_open [, ImGui.TreeNodeFlags = 0])
ImGui:closeCurrentPopup()
is_openFlag = ImGui:collapsingHeader(label [, ImGui.TreeNodeFlags = 0])
result? = ImGui:beginPopupContextItem(str_id [, ImGui.PopupFlags = 0])
ImGui:setNextItemOpen(is_open, ImGui.Cond)
result? = ImGui:beginPopupContextWindow(str_id [, ImGui.PopupFlags = 0])
result? = ImGui:beginPopupContextVoid(str_id [, ImGui.PopupFlags = 0])
result? = ImGui:isPopupOpen(str_id [, ImGui.PopupFlags = 0])
</syntaxhighlight>
</syntaxhighlight>


=== Widgets: Selectables ===
== Columns ==
* You can also use SameLine(pos_x) to mimic simplified columns.
* The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!)
* There is a maximum of 64 columns.
* Currently working on new 'Tables' api which will replace columns around Q2 2020 (see GitHub #2957).
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
result?, selected = ImGui:selectable(label, selected [, ImGui.SelectableFlags = 0, w = 0, h = 0])
ImGui:columns([count = 1, id = nil, border = true])
ImGui:nextColumn()
index = ImGui:getColumnIndex()
width = ImGui:getColumnWidth([column_index = -1])
ImGui:setColumnWidth(column_index, width)
offset = ImGui:getColumnOffset([column_index = -1])
ImGui:setColumnOffset(column_index, offset)
number = ImGui:getColumnsCount()
</syntaxhighlight>
</syntaxhighlight>


=== Widgets: List Boxes ===
== Tab Bars, Tabs ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- item_table: {"Item0", "Item1", ...}
bool = ImGui:beginTabBar(str_id [, ImGui.TabBarFlags = 0])
current_item, is_openFlag = ImGui:listBox(label, current_item, item_table [, max_visible_items = -1])
ImGui:endTabBar()
result? = ImGui:listBoxHeader(label [, w = 0, h = 0])
p_open, bool = ImGui:beginTabItem(label, p_open [, ImGui.TabItemFlags = 0])
result? = ImGui:listBoxHeader2(label, items_count)
ImGui:endTabItem()
ImGui:listBoxFooter()
ImGui:setTabItemClosed(tab_or_docked_window_label)
ImGui:tabItemButton(label [, ImGui.TabItemFlags = 0])
</syntaxhighlight>
</syntaxhighlight>


=== Widgets: Data Plotting ===
== Logging/Capture ==
'''Caching''':
All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging.
<syntaxhighlight lang="lua">
ImGui:logToTTY(auto_open_depth = -1)
ImGui:logToFile(auto_open_depth = -1, filename = nil)
ImGui:logToClipboard(auto_open_depth = -1)
ImGui:logFinish()
ImGui:logButtons()
ImGui:logText(text)
</syntaxhighlight>


If you have big array of points it is better to cache it instead of translating lua table to C++ vector every time you call `ImGui:plotLines()`. But in this case you need to manage memory by yourself (free points pointer when you dont need it).
== Drag and drop ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- store points in memory
flag = ImGui:beginDragDropSource([ImGui.DragDropFlags flags = 0])
-- points_table: {0.01, 0.5, 10, -50, ...}
flag = ImGui:setNumDragDropPayload(str_type, number [, ImGui.Cond cond = 0])
-- ptr: c++ pointer to a given vector
flag = ImGui:setStrDragDropPayload(str_type, string [, ImGui.Cond cond = 0])
ptr = ImGui.cachePoints(points_table)
ImGui:endDragDropSource()
flag = ImGui:beginDragDropTarget()
ImGuiPayload = ImGui:acceptDragDropPayload(type [, ImGui.DragDropFlags flags = 0])
ImGui:endDragDropTarget()
ImGuiPayload = ImGui:getDragDropPayload()
</syntaxhighlight>


-- delete points from memory
'''Payload''':
ImGui.freePoints(ptr)
<syntaxhighlight lang="lua">
number = ImGuiPayload:getNumData()
string = ImGuiPayload:getStrData()
ImGuiPayload:clear()
number = ImGuiPayload:getDataSize()
flag = ImGuiPayload:isDataType(type) -- type must be the same as in "ImGui:acceptDragDropPayload(type)"
flag = ImGuiPayload:isPreview()
flag = ImGuiPayload:isDelivery()
</syntaxhighlight>
</syntaxhighlight>


'''Plot functions''':
'''Usage example''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- len (number): points array lenght
require "ImGui"
ImGui:plotCachedLines(label, ptr, len,
[, values_offset = 0, overlay_text = nil,
scale_min = math.huge, scale_max = math.huge,
w = 0, h = 0])
ImGui:plotCachedHistogram(label, ptr, len,
[, values_offset = 0, overlay_text = nil,
scale_min = math.huge, scale_max = math.huge,
w = 0, h = 0])


ImGui:plotLines(label, points_table
local imgui = ImGui.new()
[, values_offset = 0, overlay_text = nil,
stage:addChild(imgui)
scale_min = math.huge, scale_max = math.huge,
w = 0, h = 0])


ImGui:plotHistogram(label, points_table
local names = {
[, values_offset = 0, overlay_text = nil,  
"Bobby", "Beatrice", "Betty",
scale_min = math.huge, scale_max = math.huge,  
"Brianna", "Barry", "Bernard",
w = 0, h = 0])
"Bibi", "Blaine", "Bryn"
</syntaxhighlight>
}
-- modes:
local Mode_Copy = 0
local Mode_Move = 1
local Mode_Swap = 2
local mode = 0 -- current mode


'''Example''':
function onEnterFrame(e)
<syntaxhighlight lang="lua">
imgui:newFrame(e.deltaTime)
-- delete ptr if it exist
function deletePtr()
if (imgui:radioButton("Copy", mode == Mode_Copy)) then mode = Mode_Copy end imgui:sameLine()
if pointsPtr then
if (imgui:radioButton("Move", mode == Mode_Move)) then mode = Mode_Move end imgui:sameLine()
ImGui.freePoints(pointsPtr)
if (imgui:radioButton("Swap", mode == Mode_Swap)) then mode = Mode_Swap end
end
end
for i,v in ipairs(names) do
imgui:pushID(i)
if (((i-1) % 3) ~= 0) then imgui:sameLine() end
imgui:button(v, 60, 60)
if (imgui:beginDragDropSource(ImGui.DragDropFlags_None)) then
--imgui:setStrDragDropPayload("DND_DEMO_CELL", "ID_"..i) -- used for strings
imgui:setNumDragDropPayload("DND_DEMO_CELL", i) -- used for numbers
if (mode == Mode_Copy) then imgui:text(("Copy %s"):format(v)) end
if (mode == Mode_Move) then imgui:text(("Move %s"):format(v)) end
if (mode == Mode_Swap) then imgui:text(("Swap %s"):format(v)) end
imgui:endDragDropSource()
end
if (imgui:beginDragDropTarget()) then
local payload = imgui:acceptDragDropPayload("DND_DEMO_CELL")
if (payload) then
--local payload_n = tonumber(payload:getStrData():sub(4))  -- if "setStrDragDropPayload" was used
local payload_n = payload:getNumData() -- if "setNumDragDropPayload" was used
if (mode == Mode_Copy) then
names[i] = names[payload_n];
end
if (mode == Mode_Move) then
names[i] = names[payload_n];
names[payload_n] = "";
end
if (mode == Mode_Swap) then
names[i], names[payload_n] = names[payload_n], names[i]
end
end
imgui:endDragDropTarget()
end
imgui:popID()
end
imgui:render()
imgui:endFrame()
end
 
stage:addEventListener("enterFrame", onEnterFrame)
</syntaxhighlight>


function onEnterFrame()
== Clipping ==
ui:newFrame(e.deltaTime)
<syntaxhighlight lang="lua">
ImGui:pushClipRect(min_x, min_y, max_x, max_y, intersect_with_current_clip_rect)
if ui:button("Generate") then
ImGui:popClipRect()
deletePtr()
</syntaxhighlight>
points = generatePoints() -- returns big array
pointsPtr = ImGui.cachePoints(points)
end
if pointsPtr then
ui:plotCachedLines("Big data", pointsPtr, #points)
end
ui:render()
ui:endFrame()
end


-- do not forget to clear memory when app is closing
== ImGuiListClipper ==
function onAppExit()
Try to avoid creating new instances in "enterFrame" event.
deletePtr()
end
</syntaxhighlight>


== Widgets: Value() Helpers ==
'''Constructor''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui:value(prefix, bool)
instance = ImGuiListClipper.new()
ImGui:value(prefix, number)
ImGui:value(prefix, float, format_string)
</syntaxhighlight>
</syntaxhighlight>


== Widgets: Menus ==
'''Methods''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
result? = ImGui:beginMenuBar()
ImGuiListClipper:beginClip(number_of_items [, item_height = -1]) -- if item_height <= 0 then it is calculated automatically
ImGui:endMenuBar()
ImGuiListClipper:endClip()
result? = ImGui:beginMainMenuBar()
bool = ImGuiListClipper:step()
ImGui:endMainMenuBar()
number = ImGuiListClipper:getDisplayStart()
result = ImGui:beginMenu(label [, enabled = true])
number = ImGuiListClipper:getDisplayEnd()
result = ImGui:beginMenuEx(label, [icon = "", enabled = true])
number = ImGuiListClipper:getStartPosY()
ImGui:endMenu()
number = ImGuiListClipper:getItemsCount()
result = ImGui:menuItem(label [, shortcut = "", selected = false, enabled = true])
ImGuiListClipper:forceDisplayRangeByIndices(number_min, number_max)
result = ImGui:menuItemEx(label, [icon = "", shortcut = "", selected = false, enabled = true])
ImGui:beginTooltip()
ImGui:endTooltip()
ImGui:setTooltip(text)
</syntaxhighlight>
</syntaxhighlight>


== Popups, Modals ==
'''Usage example''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
result? = ImGui:beginPopup(str_id [, ImGui.WindowFlags = 0])
require "ImGui"
p_open, result? = ImGui:beginPopupModal(str_id, p_open [, ImGui.WindowFlags = 0])
 
ImGui:endPopup()
local imgui = ImGui.new()
ImGui:openPopup(str_id [, ImGui.PopupFlags = 0])
stage:addChild(imgui)
ImGui:openPopupOnItemClick(str_id [, ImGui.PopupFlags = 0])
 
ImGui:closeCurrentPopup()
clipper = ImGuiListClipper.new()
result? = ImGui:beginPopupContextItem(str_id [, ImGui.PopupFlags = 0])
 
result? = ImGui:beginPopupContextWindow(str_id [, ImGui.PopupFlags = 0])
function onEnterFrame(e)
result? = ImGui:beginPopupContextVoid(str_id [, ImGui.PopupFlags = 0])
imgui:newFrame(e.deltaTime)
result? = ImGui:isPopupOpen(str_id [, ImGui.PopupFlags = 0])
 
if (imgui:beginWindow("Clipper demo")) then
if (imgui:beginTable("table", 3)) then
imgui:tableSetupScrollFreeze(0, 1) -- cols, rows
imgui:tableSetupColumn("One")
imgui:tableSetupColumn("Two")
imgui:tableSetupColumn("Three")
imgui:tableHeadersRow()
 
clipper:beginClip(100)
while (clipper:step()) do
for row = clipper:getDisplayStart(), clipper:getDisplayEnd() do
imgui:tableNextRow()
for column = 1, 3 do
imgui:tableSetColumnIndex(column - 1)
imgui:text(("col: %d; row: %d"):format(column, row))
end
end
end
clipper:endClip()
 
imgui:endTable()
end
end
imgui:endWindow()
 
imgui:endFrame()
imgui:render()
end
 
stage:addEventListener("enterFrame", onEnterFrame)
</syntaxhighlight>
</syntaxhighlight>


== Tables ==
== Context ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
flag = ImGui:beginTable(str_id, column [, ImGui.TableFlags = 0, outer_w = 0, outer_h = 0, inner_width = 0])
string OR nil = ImGui:getHoveredWindow()
ImGui:endTable()
string OR nil = ImGui:getHoveredWindowRoot()
ImGui:tableNextRow([ImGui.TableRowFlags = 0, min_row_height = 0])
string OR nil = ImGui:getHoveredWindowUnderMovingWindow()
flag = ImGui:tableNextColumn()
string OR nil = ImGui:getMovingWindow()
flag = ImGui:tableSetColumnIndex(column_n)
string OR nil = ImGui:getActiveIdWindow()
ImGui:tableSetupColumn(label [, ImGui.TableColumnFlags = 0, init_width_or_weight = 0, user_id = 0])
id = ImGui:getActiveId()
ImGui:tableSetupScrollFreeze(cols, rows)
id = ImGui:getActiveIdPreviousFrame()
ImGui:tableHeadersRow()
number = ImGui:getActiveIdTimer()
TableSortSpecs = ImGui:tableGetSortSpecs() -- see below
id = ImGui:getActiveIdAllowOverlap()
number = ImGui:tableGetColumnCount()
id = ImGui:getHoveredId()
number = ImGui:tableGetColumnIndex()
id = ImGui:getHoveredIdPreviousFrame()
number = ImGui:tableGetRowIndex()
number = ImGui:getHoveredIdTimer()
string = ImGui:tableGetColumnName([column_n = -1])
id = ImGui:getHoveredIdAllowOverlap()
ImGuiTableColumnFlags = ImGui:tableGetColumnFlags([column_n = -1])
bool = ImGui:getDragDropActive()
ImGui:tableSetBgColor(ImGui.TableBgTarget, color [, alpha = 1, column_n = -1])
id = ImGui:getDragDropPayloadSourceId()
string = ImGui:getDragDropPayloadDataType()
number = ImGui:getDragDropPayloadDataSize()
</syntaxhighlight>
</syntaxhighlight>


== Table sort specs ==
== Focus, Activation ==
<syntaxhighlight lang="lua">
* Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item"
-- TableSortSpecs = ImGui:tableGetSortSpecs()
* Most of the functions are referring to the last/previous item we submitted.
number = TableSortSpecs:getSpecsCount()
* See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions.
flag = TableSortSpecs:isSpecsDirty()
TableSortSpecs:setSpecsDirty(flag)
table = TableSortSpecs:getColumnSortSpecs() -- see below
</syntaxhighlight>


== Table column sort specs ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- table = TableSortSpecs:getColumnSortSpecs()
ImGui:setItemDefaultFocus()
-- each value of this table is an object that have this functions:
ImGui:setKeyboardFocusHere([offset = 0])
number = item:getColumnUserID()  
flag = ImGui:isItemHovered([ImGui.HoveredFlags = 0])
number = item:getColumnIndex() -- 0 based
flag = ImGui:isItemActive()
number = item:getSortOrder() -- used in multi sorted tables
flag = ImGui:isItemFocused()
number = item:getSortDirection() -- ImGui.SortDirection_Ascending OR ImGui.SortDirection_Descending
flag = ImGui:isItemClicked(mouse_button)
flag = ImGui:isItemVisible()
flag = ImGui:isItemEdited()
flag = ImGui:isItemActivated()
flag = ImGui:isItemDeactivated()
flag = ImGui:isItemDeactivatedAfterEdit()
flag = ImGui:isItemToggledOpen()
flag = ImGui:isAnyItemHovered()
flag = ImGui:isAnyItemActive()
flag = ImGui:isAnyItemFocused()
minX, minY, maxX, maxY = ImGui:getItemRect()
x, y = ImGui:getItemRectMin()
x, y = ImGui:getItemRectMax()
w, h = ImGui:getItemRectSize()
ImGui:setItemAllowOverlap()
</syntaxhighlight>
</syntaxhighlight>
Example: https://github.com/MultiPain/Gideros_examples/blob/master/ImGuiTablesDemo/assets/TablesDemo.lua</br>


== Columns ==
== INPUTS ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui:columns([count = 1, id = nil, border = true])
ImGui:onMouseHover(event)
ImGui:nextColumn()
ImGui:onMouseMove(event)
index = ImGui:getColumnIndex()
ImGui:onMouseDown(event)
width = ImGui:getColumnWidth([column_index = -1])
ImGui:onMouseUp(event)
ImGui:setColumnWidth(column_index, width)
ImGui:onMouseWheel(event)
offset = ImGui:getColumnOffset([column_index = -1])
 
ImGui:setColumnOffset(column_index, offset)
ImGui:onTouchMove(event)
number = ImGui:getColumnsCount()
ImGui:onTouchBegin(event)
ImGui:onTouchEnd(event)
ImGui:onTouchCancel(event)
 
ImGui:onKeyUp(event)
ImGui:onKeyDown(event)
ImGui:onKeyChar(event)
</syntaxhighlight>
</syntaxhighlight>


== Tab Bars, Tabs ==
'''Usage examples''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool = ImGui:beginTabBar(str_id [, ImGui.TabBarFlags = 0])
local UI = ImGui.new(nil, false, false, false)
ImGui:endTabBar()
p_open, bool = ImGui:beginTabItem(label, p_open [, ImGui.TabItemFlags = 0])
ImGui:endTabItem()
ImGui:setTabItemClosed(tab_or_docked_window_label)
ImGui:tabItemButton(label [, ImGui.TabItemFlags = 0])
</syntaxhighlight>
</syntaxhighlight>


== Logging/Capture ==
'''Mouse'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui:logToTTY(auto_open_depth = -1)  
stage:addEventListener("mouseHover", function(e) UI:onMouseHover(e) end)
ImGui:logToFile(auto_open_depth = -1, filename = nil)  
stage:addEventListener("mouseMove", function(e) UI:onMouseMove(e) end)
ImGui:logToClipboard(auto_open_depth = -1)  
stage:addEventListener("mouseDown", function(e) UI:onMouseDown(e) end)
ImGui:logFinish()  
stage:addEventListener("mouseUp", function(e) UI:onMouseUp(e) end)
ImGui:logButtons()  
stage:addEventListener("mouseWheel", function(e) UI:onMouseWheel(e) end)
ImGui:logText(text)  
</syntaxhighlight>
</syntaxhighlight>


== Drag and drop ==
'''Touch'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
flag = ImGui:beginDragDropSource([ImGui.DragDropFlags flags = 0])
stage:addEventListener("touchesCancel", function(e) ui:onTouchCancel(e) end)
flag = ImGui:setNumDragDropPayload(str_type, number [, ImGui.Cond cond = 0])
stage:addEventListener("touchesMove", function(e) ui:onTouchMove(e) end)
flag = ImGui:setStrDragDropPayload(str_type, string [, ImGui.Cond cond = 0])
stage:addEventListener("touchesBegin", function(e) ui:onTouchBegin(e) end)
ImGui:endDragDropSource()
stage:addEventListener("touchesEnd", function(e) ui:onTouchEnd(e) end)
flag = ImGui:beginDragDropTarget()
ImGuiPayload = ImGui:acceptDragDropPayload(type [, ImGui.DragDropFlags flags = 0])
ImGui:endDragDropTarget()
ImGuiPayload = ImGui:getDragDropPayload()
</syntaxhighlight>
</syntaxhighlight>


'''Payload''':
'''Keyboard'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
number = ImGuiPayload:getNumData()
stage:addEventListener("keyUp", function(e) UI:onKeyUp(e) end)
string = ImGuiPayload:getStrData()
stage:addEventListener("keyDown", function(e) UI:onKeyDown(e) end)
ImGuiPayload:clear()
stage:addEventListener("keyChar", function(e) UI:onKeyChar(e) end)
number = ImGuiPayload:getDataSize()
</syntaxhighlight>
flag = ImGuiPayload:isDataType(type) -- type must be the same as in "ImGui:acceptDragDropPayload(type)"
 
flag = ImGuiPayload:isPreview()
== Miscellaneous Utilities ==
flag = ImGuiPayload:isDelivery()
<syntaxhighlight lang="lua">
flag = ImGui:isRectVisible(w, h [, max_x, max_y])
number = ImGui:getTime()
number = ImGui:getFrameCount()
str = ImGui:getStyleColorName(idx)
flag = ImGui:beginChildFrame(id, w, h [, ImGui.WindowFlags = 0]) -- id (number)
ImGui:endChildFrame()
</syntaxhighlight>
</syntaxhighlight>


'''Usage example''':
=== Text Utilities ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local names = {
w, h = ImGui:calcTextSize(text [, hide_text_after_double_hash = false, wrap_width = -1])
"Bobby", "Beatrice", "Betty",
</syntaxhighlight>
"Brianna", "Barry", "Bernard",
 
"Bibi", "Blaine", "Bryn"
=== Color convert ===
}
'''Note''': use ''DOT'' instead of ''COLON'', so you can use it without creating an ImGui object
-- modes:
<syntaxhighlight lang="lua">
local Mode_Copy = 0
r, g, b, a = ImGui.colorConvertHEXtoRGB(color [, alpha = 1])
local Mode_Move = 1
hex = ImGui.colorConvertRGBtoHEX(r, g, b)
local Mode_Swap = 2
h, s, v = ImGui.colorConvertRGBtoHSV(r, g, b)
r, g, b = ImGui.colorConvertHSVtoRGB(h, s, v)
local mode = 0 -- current mode
h, s, v = ImGui.colorConvertHEXtoHSV(hex)
hex = ImGui.colorConvertHSVtoHEX(h, s, v)
</syntaxhighlight>
 
=== Inputs Utilities: Keyboard ===
* For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
* We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index.


function onEnterFrame(e)
<syntaxhighlight lang="lua">
UI:newFrame(e.deltaTime)
string = ImGui:getKeyName(keyCode)
flag = ImGui:isKeyDown(keyCode)
if (UI:radioButton("Copy", mode == Mode_Copy)) then mode = Mode_Copy end UI:sameLine()
flag = ImGui:isKeyPressed(keyCode [, repeat = true])
if (UI:radioButton("Move", mode == Mode_Move)) then mode = Mode_Move end UI:sameLine()
flag = ImGui:isKeyReleased(keyCode)
if (UI:radioButton("Swap", mode == Mode_Swap)) then mode = Mode_Swap end
number = ImGui:getKeyPressedAmount(keyCode, repeat_delay, rate)
ImGui:setNextFrameWantCaptureKeyboard([want_capture_keyboard_value = true])
for i,v in ipairs(names) do
UI:pushID(i)
if (((i-1) % 3) ~= 0) then UI:sameLine() end
UI:button(v, 60, 60)
if (UI:beginDragDropSource(ImGui.DragDropFlags_None)) then
--UI:setStrDragDropPayload("DND_DEMO_CELL", "ID_"..i) -- used for strings
UI:setNumDragDropPayload("DND_DEMO_CELL", i) -- used for numbers
if (mode == Mode_Copy) then UI:text(("Copy %s"):format(v)) end
if (mode == Mode_Move) then UI:text(("Move %s"):format(v)) end
if (mode == Mode_Swap) then UI:text(("Swap %s"):format(v)) end
UI:endDragDropSource()
end
if (UI:beginDragDropTarget()) then
local payload = UI:acceptDragDropPayload("DND_DEMO_CELL")
if (payload) then
--local payload_n = tonumber(payload:getStrData():sub(4))  -- if "setStrDragDropPayload" was used
local payload_n = payload:getNumData() -- if "setNumDragDropPayload" was used
if (mode == Mode_Copy) then
names[i] = names[payload_n];
end
if (mode == Mode_Move) then
names[i] = names[payload_n];
names[payload_n] = "";
end
if (mode == Mode_Swap) then
names[i], names[payload_n] = names[payload_n], names[i]
end
end
UI:endDragDropTarget()
end
UI:popID()
end
UI:render()
UI:endFrame()
end
 
stage:addEventListener("enterFrame", onEnterFrame)
</syntaxhighlight>
</syntaxhighlight>


== Clipping ==
=== Shortcut system ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui:pushClipRect(min_x, min_y, max_x, max_y, intersect_with_current_clip_rect)
-- (keyChord: an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values (ImGuiKey | ImGuiMod_XXX))
ImGui:popClipRect()
ImGui:shortcut(keyChord [, owner_id = 0, ImGui.InputFlags = 0])
</syntaxhighlight>


== ImGuiListClipper ==
-- (useful to disable CTRL + TAB combo: ImGui:setShortcutRouting(ImGui.Mod_Ctrl | ImGui.Key_Tab, ImGui.KeyOwner_None))
Try to avoid creating new instances in "enterFrame" event.
ImGui:setShortcutRouting(keyChord [, owner_id = 0, ImGui.InputFlags = 0])


'''Constructor''':
ImGui:setItemKeyOwner(keyCode [, ImGui.InputFlags = 0])
<syntaxhighlight lang="lua">
instance = ImGuiListClipper.new()
</syntaxhighlight>


'''Methods''':
ImGui:setKeyOwner(keyCode, owner_id, [, ImGui.InputFlags = 0])
<syntaxhighlight lang="lua">
ImGuiListClipper:beginClip(number_of_items [, item_height = -1]) -- if item_height <= 0 then it is calculated automatically
ImGuiListClipper:endClip()
bool = ImGuiListClipper:step()
number = ImGuiListClipper:getDisplayStart()
number = ImGuiListClipper:getDisplayEnd()
number = ImGuiListClipper:getStartPosY()
number = ImGuiListClipper:getItemsCount()
ImGuiListClipper:forceDisplayRangeByIndices(number_min, number_max)
</syntaxhighlight>
</syntaxhighlight>


'''Usage example''':
'''Focused window and global application ''button'' shortcut example'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ui = ImGui.new()
require "ImGui"
stage:addChild(ui)


clipper = ImGuiListClipper.new()
local imgui = ImGui.new()
stage:addChild(imgui)
imgui:setClassicStyle()


function onEnterFrame(e)
function onEnterFrame(e)
ui:newFrame(e.deltaTime)
imgui:newFrame(e.deltaTime)
 
if (ui:beginWindow("Clipper demo")) then
-- focused window button shortcut
if (ui:beginTable("table", 3)) then
if imgui:button("PLAY##01", 32*2, 32*0.6) or imgui:shortcut(ImGui.Key_P) then
ui:tableSetupScrollFreeze(0, 1)
print(ImGui:getItemID()) -- 2102678615
ui:tableSetupColumn("One")
end
ui:tableSetupColumn("Two")
imgui:sameLine(32*2.5)
ui:tableSetupColumn("Three")
-- focused window button shortcut (using item ID)
ui:tableHeadersRow()
if imgui:button("PLAY##02", 32*2, 32*0.6) or imgui:shortcut(ImGui.Key_Q, 8325, ImGui.FocusedFlags_AnyWindow) then
print(ImGui:getItemID()) -- 8325
clipper:beginClip(1000)
while (clipper:step()) do
for row = clipper:getDisplayStart(), clipper:getDisplayEnd() do
ui:tableNextRow()
for column = 1, 3 do
ui:tableSetColumnIndex(column - 1)
ui:text(("col: %d; row: %d"):format(column, row))
end
end
end
clipper:endClip()
ui:endTable()
end
end
end
ui:endWindow()
ui:endFrame()
ui:render()
end


stage:addEventListener("enterFrame", onEnterFrame)
-- global app button shortcut
</syntaxhighlight>
if imgui:button("PLAY##03", 32*2, 32*0.6) or imgui:isKeyPressed(KeyCode.C) then
print(ImGui:getItemID()) -- 1157645807
end


== ImGuiTextFilter ==
imgui:render()
Try to avoid creating new instaces in "enterFrame" event.
imgui:endFrame()
end


'''Constructor''':
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
<syntaxhighlight lang="lua">
filter = ImGuiTextFilter.new()
</syntaxhighlight>
</syntaxhighlight>


'''Methods''':
'''Global application ''checkbox'' shortcut example'''
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- draws the input field
require "ImGui"
isValueChanged = filter:draw(label [, width = 0])
-- draws the input field (using ImGui:inutTextWithHint())
isValueChanged = filter:drawWithHint(label, hint [, width = 0])


filter:setBuffer(text) -- set filter text
local imgui = ImGui.new()
filter:build() -- update filter internals (see example below)
stage:addChild(imgui)
bool = filter:passFilter(text) -- returns true if filter input matches with "text"
imgui:setClassicStyle()
</syntaxhighlight>


'''Usage example 1''':</br>
-- some vars
https://github.com/MultiPain/Gideros_ImGui/blob/28d2cdd4f393d6f2048792e51f695d56d7e0ae9a/imgui_src/imgui_demo.cpp#L5657
local islooping = false
<syntaxhighlight lang="lua">
ui = ImGui.new()
stage:addChild(ui)


filter = ImGuiTextFilter.new()
function onEnterFrame(e)
items = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }
imgui:newFrame(e.deltaTime)
local ischanged = false


function onEnterFrame(e)
islooping, ischanged = imgui:checkbox("looping(L)", islooping)
ui:newFrame(e.deltaTime)
if imgui:isKeyPressed(KeyCode.L) then
islooping = not islooping
if (ui:beginWindow("Filter demo")) then
ischanged = true
ui:text(
end
[[Filter usage:
if ischanged then
""        display all lines
print("islooping", islooping)
"xxx"      display lines containing "xxx"
"xxx,yyy"  display lines containing "xxx" or "yyy"
"-xxx"    hide lines containing "xxx"]])
filter:draw("Filter")
for i, text in ipairs(items) do
if filter:passFilter(text) then
ui:bulletText(text)
end
end
end
end
ui:endWindow()
 
imgui:render()
ui:endFrame()
imgui:endFrame()
ui:render()
end
end


stage:addEventListener("enterFrame", onEnterFrame)
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
</syntaxhighlight>
</syntaxhighlight>


'''Usage example 2''':
=== Inputs Utilities: Mouse ===
* To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
* You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
* Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ui = ImGui.new()
-- "mouse_button" is any gideros mouse button code
stage:addChild(ui)
flag = ImGui:isMouseDown(mouse_button)
filter = ImGuiTextFilter.new()
flag = ImGui:isMouseClicked(mouse_button [, repeat = false]) -- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseReleased(mouse_button) -- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseDoubleClicked(mouse_button) -- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseHoveringRect(min_x, min_y, max_x, max_y [, clip = true])
flag = ImGui:isMousePosValid([x = inf, y = inf])
flag = ImGui:isAnyMouseDown()
x, y = ImGui:getMousePos()
x, y = ImGui:getMousePosOnOpeningCurrentPopup()
flag = ImGui:isMouseDragging(mouse_button [, lock_threshold = -1]) -- "mouse_button" is any gideros mouse button code
x, y = ImGui:getMouseDragDelta(mouse_button [, lock_threshold = -1]) -- "mouse_button" is any gideros mouse button code
ImGui:resetMouseDragDelta(mouse_button) -- "mouse_button" is any gideros mouse button code
ImGuiMouseCursor = ImGui:getMouseCursor()
ImGui:setMouseCursor(ImGui.MouseCursor)
ImGui:setNextFrameWantCaptureMouse([want_capture_mouse_value = true])
ImGui:setNextFrameWantCaptureKeyboard([want_capture_keyboard_value = true])
ImGui:updateCursor()
</syntaxhighlight>
 
== FONTS ==
<syntaxhighlight lang="lua">
IO = imgui:getIO()
FontAtlas = IO:getFonts()
 
Font = FontAtlas:addFont(ttf_font_path, font_size [, options])


searchText = ""
-- options (table): all parameters are optional
items = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }
--     fontDataOwnedByAtlas - bool
function onEnterFrame(e)
--     pixelSnapH - bool
ui:newFrame(e.deltaTime)
--     mergeMode - bool
--     fontNo - number
-- Draw standart text input control
--     oversampleH - number
-- filter:drawWithHint("Filter", "Search")
--     oversampleV - number
--     glyphExtraSpacingX - number
-- Draw custom control
--     glyphExtraSpacingY - number
local valueChanged = false
--     glyphOffsetX - number
searchText, valueChanged = ui:inputText("Filter", searchText, 256, ImGui.InputTextFlags_EnterReturnsTrue)
--     glyphOffsetY - number
if valueChanged then
--     glyphMinAdvanceX - number
filter:setBuffer(searchText)
--     glyphMaxAdvanceX - number
-- try to avoid calling "build" function every frame
--     rasterizerFlags - number
filter:build()
--     rasterizerMultiply - number
end
--
--     glyphs - table:
for i, item in ipairs(items) do
--     text(string): represents available chars
if not filter:passFilter(item) then
--     chars(table): list of specific char code (example: {0x7262, ...})
continue
--     ranges(table): predefined glyph ranges (example: {ImGui.GlyphRanges_Default, ImGui.GlyphRanges_Japanese, ...})
end
FontAtlas:addFonts(fontsDescription)
-- fontsDescriptions(table):
ui:bulletText(item)
--      description(table):
end
--          ttf_font_path(string): path to a font
--          font_size(number): font size
ui:endFrame()
--          options(table): see description above
ui:render()
-- example:
end
-- FontAtlas:addFonts{ {"fonts/DroidSans.ttf", 16}, {"fonts/ProggyTiny.ttf", 16} }
</syntaxhighlight>


== Focus, Activation ==
Font = FontAtlas:getFont([index]) -- get font by index (if index is 0 or nil you will get default font instance)
<syntaxhighlight lang="lua">
FontAtlas:build() -- call after multiple FontAtlas:addFont(...) calls to update ImGui font atlas
ImGui:setItemDefaultFocus()
FontAtlas:clearInputData()
ImGui:setKeyboardFocusHere([offset = 0])
FontAtlas:clearTexData()
flag = ImGui:isItemHovered([ImGui.HoveredFlags = 0])
FontAtlas:clearFonts()
flag = ImGui:isItemActive()
FontAtlas:clear()
flag = ImGui:isItemFocused()
table = FontAtlas:getFonts() -- returns a table with all fonts (included default)
flag = ImGui:isItemClicked(mouse_button)
flag = FontAtlas:isBuilt()
flag = ImGui:isItemVisible()
number = FontAtlas:addCustomRectRegular(width, height)
flag = ImGui:isItemEdited()
number = FontAtlas:addCustomRectFontGlyph(font, id, width, height, advance_x [, offset_x, offset_y])
flag = ImGui:isItemActivated()
w, h, x, y, glyph_id, offset_x, offset_y, font, is_packed_flag = FontAtlas:getCustomRectByIndex(index)
flag = ImGui:isItemDeactivated()
flag = ImGui:isItemDeactivatedAfterEdit()
flag = ImGui:isItemToggledOpen()
flag = ImGui:isAnyItemHovered()
flag = ImGui:isAnyItemActive()
flag = ImGui:isAnyItemFocused()
minX, minY, maxX, maxY = ImGui:getItemRect()
x, y = ImGui:getItemRectMin()
x, y = ImGui:getItemRectMax()
w, h = ImGui:getItemRectSize()
ImGui:setItemAllowOverlap()
</syntaxhighlight>


== Miscellaneous Utilities ==
ImGui:pushFont(font) -- font (table): object returned by FontAtlas:addFont(...) or FontAtlas:getFont([index])
<syntaxhighlight lang="lua">
ImGui:popFont()
flag = ImGui:isRectVisible(w, h [, max_x, max_y])
number = ImGui:getTime()
number = ImGui:getFrameCount()
str = ImGui:getStyleColorName(idx)
flag = ImGui:beginChildFrame(id, w, h [, ImGui.WindowFlags = 0]) -- id (number)
ImGui:endChildFrame()
</syntaxhighlight>
</syntaxhighlight>


== Text Utilities ==
'''Minimal example''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
w, h = ImGui:calcTextSize(text [, hide_text_after_double_hash = false, wrap_width = -1])
local UI = ImGui.new()
</syntaxhighlight>
local IO = UI:getIO()
local FontAtlas = IO:getFonts()
local VDS_font = FontAtlas:addFont("fonts/VDS.ttf", 16, {
    oversampleH = 2,
    oversampleV = 2,
glyphs = {
ranges = {ImGui.GlyphRanges_Cyrillic}
}
})
IO:setFontDefault(VDS_font)
FontAtlas:build()
stage:addChild(UI)


== Inputs Utilities: Keyboard ==
-- you can use multiple fonts at the same time
<syntaxhighlight lang="lua">
function enterFrame(e)
string = ImGui:getKeyName(keyCode)
UI:newFrame(e.deltaTime)
flag = ImGui:isKeyDown(keyCode)
flag = ImGui:isKeyPressed(keyCode [, repeat = true])
UI:pushFont(font1)
flag = ImGui:isKeyReleased(keyCode)
UI:text("Font1")
number = ImGui:getKeyPressedAmount(keyCode, repeat_delay, rate)
UI:popFont()
ImGui:setNextFrameWantCaptureKeyboard([want_capture_keyboard_value = true])
UI:pushFont(font2)
UI:text("Font2")
UI:popFont()
UI:render()
UI:endFrame()
end
</syntaxhighlight>
</syntaxhighlight>


== Shortcut system ==
'''Glyphs example''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- (keyChord: an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values (ImGuiKey | ImGuiMod_XXX))
local fonts = io:getFonts()
ImGui:shortcut(keyChord [, owner_id = 0, ImGui.InputFlags = 0])
fonts:addFont(font_path, font_size, {
 
glyphs = {
-- (useful to disable CTRL + TAB combo: ImGui:setShortcutRouting(ImGui.Mod_Ctrl | ImGui.Key_Tab, ImGui.KeyOwner_None))
ranges = {
ImGui:setShortcutRouting(keyChord [, owner_id = 0, ImGui.InputFlags = 0])
{
 
0x2590,0x2593, -- range1
ImGui:setItemKeyOwner(keyCode [, ImGui.InputFlags = 0])
0x2660,0x266B  -- range2
 
-- ...
ImGui:setKeyOwner(keyCode, owner_id, [, ImGui.InputFlags = 0])
},
</syntaxhighlight>
ImGui.GlyphRanges_Cyrillic,
{
0x01C0, 0x01C3 -- range3
},
ImGui.GlyphRanges_Korean
},
-- same structure:
ranges = {
{
0x2590,0x2593, -- range1
0x2660,0x266B, -- range2
0x01C0,0x01C3  -- range3
-- ...
},
ImGui.GlyphRanges_Cyrillic,  
ImGui.GlyphRanges_Korean
}
},
mergeMode = true, -- merge into previous font
})
fonts:build()
</syntaxhighlight>


== Inputs Utilities: Mouse ==
'''Icons example''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- "mouse_button" is any gideros mouse button code
local icon = utf8.char(0x2590)
flag = ImGui:isMouseDown(mouse_button)
ImGui:text("My icon >>" .. icon .. " << !!!")
flag = ImGui:isMouseClicked(mouse_button [, repeat = false])
 
flag = ImGui:isMouseReleased(mouse_button)
-- or with new Luau support:
flag = ImGui:isMouseDoubleClicked(mouse_button)
ImGui:text("My icon >> \u{2590} << !!!")
flag = ImGui:isMouseHoveringRect(min_x, min_y, max_x, max_y [, clip = true])
-- can be also stored in memory:
flag = ImGui:isMousePosValid([x = inf, y = inf])
local icon = "\u{2590}"
flag = ImGui:isAnyMouseDown()
x, y = ImGui:getMousePos()
x, y = ImGui:getMousePosOnOpeningCurrentPopup()
flag = ImGui:isMouseDragging(mouse_button [, lock_threshold = -1])
x, y = ImGui:getMouseDragDelta(mouse_button [, lock_threshold = -1])
ImGui:resetMouseDragDelta(mouse_button)
ImGuiMouseCursor = ImGui:getMouseCursor()
ImGui:setMouseCursor(ImGui.MouseCursor)
ImGui:setNextFrameWantCaptureMouse([want_capture_mouse_value = true])
ImGui:setNextFrameWantCaptureKeyboard([want_capture_keyboard_value = true])
ImGui:updateCursor()
</syntaxhighlight>
</syntaxhighlight>


== Render ==
=== Font ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui:newFrame(deltaTime)
number = Font:getSize()
ImGui:render()
FontAtlas = Font:getContainerAtlas()
ImGui:endFrame()
Font:setScale(number)
number = Font:getScale()
number = Font:getAscent()
number = Font:getDescent()
bool = Font:isLoaded()
string = Font:getDebugName()
w, h = Font:calcTextSizeA(size, max_width, wrap_width, string)
Font:calcWordWrapPositionA(scale, string, wrap_width) -- not tested
</syntaxhighlight>
</syntaxhighlight>


== Demos ==
== Tables ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
is_openFlag = ImGui:showUserGuide()
flag = ImGui:beginTable(str_id, column [, ImGui.TableFlags = 0, outer_w = 0, outer_h = 0, inner_width = 0])
is_openFlag = ImGui:showDemoWindow([p_open])
ImGui:endTable()
is_openFlag = ImGui:showAboutWindow([p_open])
ImGui:tableNextRow([ImGui.TableRowFlags = 0, min_row_height = 0])
is_openFlag = ImGui:showStyleEditor()
flag = ImGui:tableNextColumn()
is_openFlag = ImGui:showFontSelector()
flag = ImGui:tableSetColumnIndex(column_n)
is_openFlag = ImGui:showMetricsWindow([p_open])
ImGui:tableSetupColumn(label [, ImGui.TableColumnFlags = 0, init_width_or_weight = 0, user_id = 0])
is_openFlag = ImGui:showStyleSelector(label)
ImGui:tableSetupScrollFreeze(cols, rows)
is_openFlag = ImGui:ShowStackToolWindow([p_open])
ImGui:tableHeadersRow()
ImGui:showLuaStyleEditor()
TableSortSpecs = ImGui:tableGetSortSpecs() -- see below
number = ImGui:tableGetColumnCount()
number = ImGui:tableGetColumnIndex()
number = ImGui:tableGetRowIndex()
string = ImGui:tableGetColumnName([column_n = -1])
ImGuiTableColumnFlags = ImGui:tableGetColumnFlags([column_n = -1])
ImGui:tableSetBgColor(ImGui.TableBgTarget, color [, alpha = 1, column_n = -1])
</syntaxhighlight>
</syntaxhighlight>


== TextEditor ==
=== Table sort specs ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- otherTextEditor: another "ImGuiTextEditor" instance to copy setting
number = TableSortSpecs:getSpecsCount() -- TableSortSpecs = ImGui:tableGetSortSpecs()
TextEditor = ImGuiTextEditor.new([other_text_editor])
flag = TableSortSpecs:isSpecsDirty() -- TableSortSpecs = ImGui:tableGetSortSpecs()
TableSortSpecs:setSpecsDirty(flag) -- TableSortSpecs = ImGui:tableGetSortSpecs()
table = TableSortSpecs:getColumnSortSpecs() -- TableSortSpecs = ImGui:tableGetSortSpecs(), see below
</syntaxhighlight>
</syntaxhighlight>


'''Functions''':
=== Table column sort specs ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
LanguageDefinition = TextEditor:getLanguageCPP()
-- table = TableSortSpecs:getColumnSortSpecs()
LanguageDefinition = TextEditor:getLanguageGLSL()
-- each value of this table is an object that have these functions:
LanguageDefinition = TextEditor:getLanguageHLSL()
number = item:getColumnUserID()  
LanguageDefinition = TextEditor:getLanguageC()
number = item:getColumnIndex() -- 0 based
LanguageDefinition = TextEditor:getLanguageSQL()
number = item:getSortOrder() -- used in multi sorted tables
LanguageDefinition = TextEditor:getLanguageAngelScript()
number = item:getSortDirection() -- ImGui.SortDirection_Ascending OR ImGui.SortDirection_Descending
LanguageDefinition = TextEditor:getLanguageLua()
</syntaxhighlight>
Example: https://github.com/MultiPain/Gideros_examples/blob/master/ImGuiTablesDemo/assets/TablesDemo.lua</br>


TextEditor:setLanguageDefinition(LanguageDefinition)
== ImGuiTextFilter ==
LanguageDefinition = TextEditor:getLanguageDefinition()
Try to avoid creating new instaces in "enterFrame" event.


Palette = TextEditor:getPaletteDark()
'''Constructor''':
Palette = TextEditor:getPaletteLight()
<syntaxhighlight lang="lua">
Palette = TextEditor:getPaletteRetro()
filter = ImGuiTextFilter.new()
</syntaxhighlight>


TextEditor:setPalette(Palette)
'''Methods''':
Palette = TextEditor:getPalette()
<syntaxhighlight lang="lua">
-- draws the input field
isValueChanged = filter:draw(label [, width = 0])
-- draws the input field (using ImGui:inutTextWithHint())
isValueChanged = filter:drawWithHint(label, hint [, width = 0])


TextEditor:setPaletteColor(TE_ColorIndex, color [, alpha = 1]) -- see TextEditor enums below
filter:setBuffer(text) -- set filter text
color, alpha = TextEditor:getPaletteColor(TE_ColorIndex)
filter:build() -- update filter internals (see example below)
bool = filter:passFilter(text) -- returns true if filter input matches with "text"
</syntaxhighlight>
 
'''Usage example 1''':
<syntaxhighlight lang="lua">
require "ImGui"
 
local imgui = ImGui.new()
stage:addChild(imgui)
 
local filter = ImGuiTextFilter.new()
local items = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }
 
function onEnterFrame(e)
imgui:newFrame(e.deltaTime)
 
if (imgui:beginWindow("Filter demo")) then
imgui:text([[
Filter usage:
""        display all lines
"xxx"      display lines containing "xxx"
"xxx,yyy"  display lines containing "xxx" or "yyy"
"-xxx"    hide lines containing "xxx"
]])


TextEditor:loadPalette(table) -- 42 elements table
filter:draw("Filter")
-- example:
 
--[[ dark palete:
for i, text in ipairs(items) do
TextEditor:loadPalette{
if filter:passFilter(text) then
0x7f7f7f, 1, -- Default
imgui:bulletText(text)
0xd69c56, 1, -- Keyword
end
0x00ff00, 1, -- Number
end
0x7070e0, 1, -- String
end
0x70a0e0, 1, -- Char literal
imgui:endWindow()
0xffffff, 1, -- Punctuation
0x408080, 1, -- Preprocessor
0xaaaaaa, 1, -- Identifier
0x9bc64d, 1, -- Known identifier
0xc040a0, 1, -- Preproc identifier
0x206020, 1, -- Comment (single line)
0x406020, 1, -- Comment (multi line)
0x101010, 1, -- Background
0xe0e0e0, 1, -- Cursor
0xa06020, 0.5, -- Selection
0x0020ff, 0.5, -- ErrorMarker
0xf08000, 0.25, -- Breakpoint
0x707000, 1, -- Line number
0x000000, 0.25, -- Current line fill
0x808080, 0.25, -- Current line fill (inactive)
0xa0a0a0, 0.25, -- Current line edge
}
]]


-- see below
imgui:endFrame()
TextEditor:setErrorMarkers(error_markers)
imgui:render()
TextEditor:setBreakpoints(breakpoints)
end


TextEditor:render(string_id [, w = 0, h = 0, border = 0])
stage:addEventListener("enterFrame", onEnterFrame)
</syntaxhighlight>


TextEditor:setText(string)
'''Usage example 2''':
TextEditor:getText()
<syntaxhighlight lang="lua">
TextEditor:setTextLines(table) -- set editor text using table. Structure: {"line 1", "line 2", "line 3", ...}
require "ImGui"
table = TextEditor:getTextLines()


string = TextEditor:getSelectedText()
local imgui = ImGui.new()
string = TextEditor:getCurrentLineText()
stage:addChild(imgui)


number = TextEditor:getTotalLines()
local filter = ImGuiTextFilter.new()
bool = TextEditor:isOverwrite()
local searchText = ""
local items = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }


bool = TextEditor:setReadOnly()
function onEnterFrame(e)
bool = TextEditor:isReadOnly()
imgui:newFrame(e.deltaTime)
bool = TextEditor:isTextChanged()
bool = TextEditor:isCursorPositionChanged()


TextEditor:setColorizerEnable()
-- draw standart text input control
bool = TextEditor:isColorizerEnabled()
-- filter:drawWithHint("Filter", "Search")
-- draw custom control
local ischanged = false
searchText, ischanged = imgui:inputText("Filter", searchText, 256, ImGui.InputTextFlags_EnterReturnsTrue)
if ischanged then
filter:setBuffer(searchText)
-- try to avoid calling "build" function every frame
filter:build()
end


line, column = TextEditor:getCursorPosition() -- 0 based line & column number
for i, item in ipairs(items) do
TextEditor:setCursorPosition(line, column)
if not filter:passFilter(item) then
continue
end
imgui:bulletText(item)
end


TextEditor:setHandleMouseInputs(bool)
imgui:endFrame()
bool = TextEditor:isHandleMouseInputsEnabled()
imgui:render()
end


TextEditor:setHandleKeyboardInputs(bool)
stage:addEventListener("enterFrame", onEnterFrame)
bool = TextEditor:isHandleKeyboardInputsEnabled()
</syntaxhighlight>


TextEditor:setTextEditorChildIgnored(bool)
== TextEditor ==
bool = TextEditor:isTextEditorChildIgnored()
<syntaxhighlight lang="lua">
-- otherTextEditor: another "ImGuiTextEditor" instance to copy setting
TextEditor = ImGuiTextEditor.new([other_text_editor])
</syntaxhighlight>


TextEditor:setShowWhitespaces(bool)
'''Functions''':
bool = TextEditor:isShowingWhitespaces()
<syntaxhighlight lang="lua">
LanguageDefinition = TextEditor:getLanguageCPP()
LanguageDefinition = TextEditor:getLanguageGLSL()
LanguageDefinition = TextEditor:getLanguageHLSL()
LanguageDefinition = TextEditor:getLanguageC()
LanguageDefinition = TextEditor:getLanguageSQL()
LanguageDefinition = TextEditor:getLanguageAngelScript()
LanguageDefinition = TextEditor:getLanguageLua()


TextEditor:setTabSize(size)
TextEditor:setLanguageDefinition(LanguageDefinition)
size = TextEditor:getTabSize()
LanguageDefinition = TextEditor:getLanguageDefinition()


TextEditor:insertText(string)
Palette = TextEditor:getPaletteDark()
Palette = TextEditor:getPaletteLight()
Palette = TextEditor:getPaletteRetro()


TextEditor:moveUp([amount = 1, select = false])
TextEditor:setPalette(Palette)
TextEditor:moveDown([amount = 1, select = false])
Palette = TextEditor:getPalette()
TextEditor:moveLeft([amount = 1, select = false])
TextEditor:moveRight([amount = 1, select = false])
TextEditor:moveTop([select = false])
TextEditor:moveBottom([select = false])
TextEditor:moveHome([select = false])
TextEditor:moveEnd([select = false])


TextEditor:setSelectionStart(line, column)
TextEditor:setPaletteColor(TE_ColorIndex, color [, alpha = 1]) -- see TextEditor enums below
TextEditor:setSelectionEnd(line, column)
color, alpha = TextEditor:getPaletteColor(TE_ColorIndex)
TextEditor:setSelection(start_line, start_column, end_line, end_column)
TextEditor:selectWordUnderCursor()
TextEditor:selectAll()
bool = TextEditor:hasSelection()


TextEditor:copy()
TextEditor:loadPalette(table) -- 42 elements table
TextEditor:cut()
-- example:
TextEditor:paste()
--[[ dark palete:
TextEditor:delete()
TextEditor:loadPalette{
 
0x7f7f7f, 1, -- Default
bool = TextEditor:canUndo()
0xd69c56, 1, -- Keyword
bool = TextEditor:canRedo()
0x00ff00, 1, -- Number
TextEditor:undo()
0x7070e0, 1, -- String
TextEditor:redo()
0x70a0e0, 1, -- Char literal
</syntaxhighlight>
0xffffff, 1, -- Punctuation
0x408080, 1, -- Preprocessor
0xaaaaaa, 1, -- Identifier
0x9bc64d, 1, -- Known identifier
0xc040a0, 1, -- Preproc identifier
0x206020, 1, -- Comment (single line)
0x406020, 1, -- Comment (multi line)
0x101010, 1, -- Background
0xe0e0e0, 1, -- Cursor
0xa06020, 0.5, -- Selection
0x0020ff, 0.5, -- ErrorMarker
0xf08000, 0.25, -- Breakpoint
0x707000, 1, -- Line number
0x000000, 0.25, -- Current line fill
0x808080, 0.25, -- Current line fill (inactive)
0xa0a0a0, 0.25, -- Current line edge
}
]]


=== LanguageDefinition ===
-- see below
<syntaxhighlight lang="lua">
TextEditor:setErrorMarkers(error_markers)
string = LanguageDefinition:getName()
TextEditor:setBreakpoints(breakpoints)
</syntaxhighlight>
 
TextEditor:render(string_id [, w = 0, h = 0, border = 0])


=== ErrorMarkers ===
TextEditor:setText(string)
<syntaxhighlight lang="lua">
TextEditor:getText()
ErrorMarkers = ImGuiErrorMarkers.new()
TextEditor:setTextLines(table) -- set editor text using table. Structure: {"line 1", "line 2", "line 3", ...}
table = TextEditor:getTextLines()


ErrorMarkers:add(line, message)
string = TextEditor:getSelectedText()
ErrorMarkers:remove(line)
string = TextEditor:getCurrentLineText()
message = ErrorMarkers:get(line)
number = ErrorMarkers:getSize()
</syntaxhighlight>


=== Breakpoints ===
number = TextEditor:getTotalLines()
<syntaxhighlight lang="lua">
bool = TextEditor:isOverwrite()
Breakpoints = ImGuiBreakpoints.new()


Breakpoints:add(line)
bool = TextEditor:setReadOnly()
Breakpoints:remove(line)
bool = TextEditor:isReadOnly()
bool = Breakpoints:get(line)
bool = TextEditor:isTextChanged()
number = Breakpoints:getSize()
bool = TextEditor:isCursorPositionChanged()
</syntaxhighlight>


== ENUMS ==
TextEditor:setColorizerEnable()
bool = TextEditor:isColorizerEnabled()


=== Keyboard keys ===
line, column = TextEditor:getCursorPosition() -- 0 based line & column number
==== Keys ====
TextEditor:setCursorPosition(line, column)
<syntaxhighlight lang="lua">
ImGui.Key_None
ImGui.Key_Tab
ImGui.Key_LeftArrow
ImGui.Key_RightArrow
ImGui.Key_UpArrow
ImGui.Key_DownArrow
ImGui.Key_PageUp
ImGui.Key_PageDown
ImGui.Key_Home
ImGui.Key_End
ImGui.Key_Insert
ImGui.Key_Delete
ImGui.Key_Backspace
ImGui.Key_Space
ImGui.Key_Enter
ImGui.Key_Escape
ImGui.Key_LeftCtrl
ImGui.Key_LeftShift
ImGui.Key_LeftAlt
ImGui.Key_LeftSuper
ImGui.Key_RightCtrl
ImGui.Key_RightShift
ImGui.Key_RightAlt
ImGui.Key_RightSuper
ImGui.Key_Menu
ImGui.Key_MouseLeft
ImGui.Key_MouseRight
ImGui.Key_MouseMiddle
ImGui.Key_MouseX1
ImGui.Key_MouseX2
ImGui.Key_MouseWheelX
ImGui.Key_MouseWheelY
ImGui.Key_0
ImGui.Key_1
ImGui.Key_2
ImGui.Key_3
ImGui.Key_4
ImGui.Key_5
ImGui.Key_6
ImGui.Key_7
ImGui.Key_8
ImGui.Key_9
ImGui.Key_A
ImGui.Key_B
ImGui.Key_C
ImGui.Key_D
ImGui.Key_E
ImGui.Key_F
ImGui.Key_G
ImGui.Key_H
ImGui.Key_I
ImGui.Key_J
ImGui.Key_K
ImGui.Key_L
ImGui.Key_M
ImGui.Key_N
ImGui.Key_O
ImGui.Key_P
ImGui.Key_Q
ImGui.Key_R
ImGui.Key_S
ImGui.Key_T
ImGui.Key_U
ImGui.Key_V
ImGui.Key_W
ImGui.Key_X
ImGui.Key_Y
ImGui.Key_Z
ImGui.Key_F1
ImGui.Key_F2
ImGui.Key_F3
ImGui.Key_F4
ImGui.Key_F5
ImGui.Key_F6
ImGui.Key_F7
ImGui.Key_F8
ImGui.Key_F9
ImGui.Key_F10
ImGui.Key_F11
ImGui.Key_F12
ImGui.Key_Apostrophe
ImGui.Key_Comma
ImGui.Key_Minus
ImGui.Key_Period
ImGui.Key_Slash
ImGui.Key_Semicolon
ImGui.Key_Equal
ImGui.Key_LeftBracket
ImGui.Key_Backslash
ImGui.Key_RightBracket
ImGui.Key_GraveAccent
ImGui.Key_CapsLock
ImGui.Key_ScrollLock
ImGui.Key_NumLock
ImGui.Key_PrintScreen
ImGui.Key_Pause
ImGui.Key_Keypad0
ImGui.Key_Keypad1
ImGui.Key_Keypad2
ImGui.Key_Keypad3
ImGui.Key_Keypad4
ImGui.Key_Keypad5
ImGui.Key_Keypad6
ImGui.Key_Keypad7
ImGui.Key_Keypad8
ImGui.Key_Keypad9
ImGui.Key_KeypadDecimal
ImGui.Key_KeypadDivide
ImGui.Key_KeypadMultiply
ImGui.Key_KeypadSubtract
ImGui.Key_KeypadAdd
ImGui.Key_KeypadEnter
ImGui.Key_KeypadEqual
</syntaxhighlight>


==== Gamepad ====
TextEditor:setHandleMouseInputs(bool)
<syntaxhighlight lang="lua">
bool = TextEditor:isHandleMouseInputsEnabled()
ImGui.Key_GamepadStart
ImGui.Key_GamepadBack
ImGui.Key_GamepadFaceUp
ImGui.Key_GamepadFaceDown
ImGui.Key_GamepadFaceLeft
ImGui.Key_GamepadFaceRight
ImGui.Key_GamepadDpadUp
ImGui.Key_GamepadDpadDown
ImGui.Key_GamepadDpadLeft
ImGui.Key_GamepadDpadRight
ImGui.Key_GamepadL1
ImGui.Key_GamepadR1
ImGui.Key_GamepadL2
ImGui.Key_GamepadR2
ImGui.Key_GamepadL3
ImGui.Key_GamepadR3
ImGui.Key_GamepadLStickUp
ImGui.Key_GamepadLStickDown
ImGui.Key_GamepadLStickLeft
ImGui.Key_GamepadLStickRight
ImGui.Key_GamepadRStickUp
ImGui.Key_GamepadRStickDown
ImGui.Key_GamepadRStickLeft
ImGui.Key_GamepadRStickRight
</syntaxhighlight>


==== Modifiers ====
TextEditor:setHandleKeyboardInputs(bool)
<syntaxhighlight lang="lua">
bool = TextEditor:isHandleKeyboardInputsEnabled()
ImGui.Key_ModCtrl
ImGui.Key_ModShift
ImGui.Key_ModAlt
ImGui.Key_ModSuper
</syntaxhighlight>


=== FocusedFlags ===
TextEditor:setTextEditorChildIgnored(bool)
<syntaxhighlight lang="lua">
bool = TextEditor:isTextEditorChildIgnored()
ImGui.FocusedFlags_ChildWindows
ImGui.FocusedFlags_AnyWindow
ImGui.FocusedFlags_RootWindow
ImGui.FocusedFlags_RootAndChildWindows
ImGui.FocusedFlags_None
ImGui.FocusedFlags_NoPopupHierarchy
</syntaxhighlight>


=== PopupFlags ===
TextEditor:setShowWhitespaces(bool)
<syntaxhighlight lang="lua">
bool = TextEditor:isShowingWhitespaces()
ImGui.PopupFlags_NoOpenOverExistingPopup
ImGui.PopupFlags_MouseButtonLeft
ImGui.PopupFlags_MouseButtonMask
ImGui.PopupFlags_MouseButtonRight
ImGui.PopupFlags_AnyPopupId
ImGui.PopupFlags_MouseButtonDefault
ImGui.PopupFlags_MouseButtonMiddle
ImGui.PopupFlags_None
ImGui.PopupFlags_AnyPopup
ImGui.PopupFlags_AnyPopupLevel
ImGui.PopupFlags_NoOpenOverItems
</syntaxhighlight>


=== HoveredFlags ===
TextEditor:setTabSize(size)
<syntaxhighlight lang="lua">
size = TextEditor:getTabSize()
ImGui.HoveredFlags_None
ImGui.HoveredFlags_RootAndChildWindows
ImGui.HoveredFlags_AllowWhenBlockedByPopup
ImGui.HoveredFlags_AllowWhenBlockedByActiveItem
ImGui.HoveredFlags_ChildWindows
ImGui.HoveredFlags_RectOnly
ImGui.HoveredFlags_AllowWhenDisabled
ImGui.HoveredFlags_AllowWhenOverlapped
ImGui.HoveredFlags_AnyWindow
ImGui.HoveredFlags_RootWindow
ImGui.HoveredFlags_NoNavOverride
ImGui.HoveredFlags_DelayNormal
ImGui.HoveredFlags_DelayShort
ImGui.HoveredFlags_NoSharedDelay
</syntaxhighlight>


=== InputTextFlags ===
TextEditor:insertText(string)
<syntaxhighlight lang="lua">
ImGui.InputTextFlags_None
ImGui.InputTextFlags_EnterReturnsTrue
ImGui.InputTextFlags_ReadOnly
ImGui.InputTextFlags_AutoSelectAll
ImGui.InputTextFlags_AllowTabInput
ImGui.InputTextFlags_CharsScientific
ImGui.InputTextFlags_CharsDecimal
ImGui.InputTextFlags_NoUndoRedo
ImGui.InputTextFlags_CtrlEnterForNewLine
ImGui.InputTextFlags_CharsHexadecimal
ImGui.InputTextFlags_CharsNoBlank
ImGui.InputTextFlags_Password
ImGui.InputTextFlags_NoHorizontalScroll
ImGui.InputTextFlags_AlwaysInsertMode
ImGui.InputTextFlags_CharsUppercase
ImGui.InputTextFlags_NoBackground -- custom constant, used to disable background
ImGui.InputTextFlags_EscapeClearsAll
ImGui.InputTextFlags_CallbackCompletion
ImGui.InputTextFlags_CallbackResize
ImGui.InputTextFlags_CallbackAlways
ImGui.InputTextFlags_CallbackHistory
ImGui.InputTextFlags_CallbackCharFilter
ImGui.InputTextFlags_CallbackEdit
</syntaxhighlight>


=== NavInput ===
TextEditor:moveUp([amount = 1, select = false])
<syntaxhighlight lang="lua">
TextEditor:moveDown([amount = 1, select = false])
ImGui.NavInput_FocusNext
TextEditor:moveLeft([amount = 1, select = false])
ImGui.NavInput_TweakFast
TextEditor:moveRight([amount = 1, select = false])
ImGui.NavInput_Input
TextEditor:moveTop([select = false])
ImGui.NavInput_DpadRight
TextEditor:moveBottom([select = false])
ImGui.NavInput_FocusPrev
TextEditor:moveHome([select = false])
ImGui.NavInput_LStickDown
TextEditor:moveEnd([select = false])
ImGui.NavInput_LStickUp
ImGui.NavInput_Activate
ImGui.NavInput_LStickLeft
ImGui.NavInput_LStickRight
ImGui.NavInput_DpadLeft
ImGui.NavInput_DpadDown
ImGui.NavInput_TweakSlow
ImGui.NavInput_DpadUp
ImGui.NavInput_Menu
ImGui.NavInput_Cancel
</syntaxhighlight>


=== TabBarFlags ===
TextEditor:setSelectionStart(line, column)
<syntaxhighlight lang="lua">
TextEditor:setSelectionEnd(line, column)
ImGui.TabBarFlags_AutoSelectNewTabs
TextEditor:setSelection(start_line, start_column, end_line, end_column)
ImGui.TabBarFlags_NoCloseWithMiddleMouseButton
TextEditor:selectWordUnderCursor()
ImGui.TabBarFlags_TabListPopupButton
TextEditor:selectAll()
ImGui.TabBarFlags_NoTooltip
bool = TextEditor:hasSelection()
ImGui.TabBarFlags_FittingPolicyMask
ImGui.TabBarFlags_Reorderable
ImGui.TabBarFlags_FittingPolicyDefault
ImGui.TabBarFlags_FittingPolicyScroll
ImGui.TabBarFlags_FittingPolicyResizeDown
ImGui.TabBarFlags_None
ImGui.TabBarFlags_NoTabListScrollingButtons
</syntaxhighlight>


=== TreeNodeFlags ===
TextEditor:copy()
<syntaxhighlight lang="lua">
TextEditor:cut()
ImGui.TreeNodeFlags_Bullet
TextEditor:paste()
ImGui.TreeNodeFlags_None
TextEditor:delete()
ImGui.TreeNodeFlags_CollapsingHeader
ImGui.TreeNodeFlags_NavLeftJumpsBackHere
ImGui.TreeNodeFlags_Framed
ImGui.TreeNodeFlags_FramePadding
ImGui.TreeNodeFlags_AllowItemOverlap
ImGui.TreeNodeFlags_OpenOnArrow
ImGui.TreeNodeFlags_SpanFullWidth
ImGui.TreeNodeFlags_NoAutoOpenOnLog
ImGui.TreeNodeFlags_Leaf
ImGui.TreeNodeFlags_NoTreePushOnOpen
ImGui.TreeNodeFlags_Selected
ImGui.TreeNodeFlags_SpanAvailWidth
ImGui.TreeNodeFlags_OpenOnDoubleClick
ImGui.TreeNodeFlags_DefaultOpen
</syntaxhighlight>


=== StyleVar ===
bool = TextEditor:canUndo()
<syntaxhighlight lang="lua">
bool = TextEditor:canRedo()
ImGui.StyleVar_GrabRounding
TextEditor:undo()
ImGui.StyleVar_Alpha
TextEditor:redo()
ImGui.StyleVar_WindowMinSize
ImGui.StyleVar_PopupBorderSize
ImGui.StyleVar_WindowBorderSize
ImGui.StyleVar_FrameBorderSize
ImGui.StyleVar_ItemSpacing
ImGui.StyleVar_IndentSpacing
ImGui.StyleVar_FramePadding
ImGui.StyleVar_WindowPadding
ImGui.StyleVar_ChildRounding
ImGui.StyleVar_ItemInnerSpacing
ImGui.StyleVar_WindowRounding
ImGui.StyleVar_FrameRounding
ImGui.StyleVar_TabRounding
ImGui.StyleVar_ChildBorderSize
ImGui.StyleVar_GrabMinSize
ImGui.StyleVar_ScrollbarRounding
ImGui.StyleVar_ScrollbarSize
ImGui.StyleVar_WindowTitleAlign
ImGui.StyleVar_SelectableTextAlign
ImGui.StyleVar_PopupRounding
ImGui.StyleVar_ButtonTextAlign
ImGui.StyleVar_CellPadding
ImGui.StyleVar_DisabledAlpha
ImGui.StyleVar_SeparatorTextBorderSize
ImGui.StyleVar_SeparatorTextAlign
ImGui.StyleVar_SeparatorTextPadding
</syntaxhighlight>
</syntaxhighlight>


=== Col ===
=== LanguageDefinition ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.Col_PlotHistogram
string = LanguageDefinition:getName()
ImGui.Col_TitleBg
ImGui.Col_Separator
ImGui.Col_HeaderActive
ImGui.Col_HeaderHovered
ImGui.Col_ButtonHovered
ImGui.Col_NavWindowingHighlight
ImGui.Col_ScrollbarGrab
ImGui.Col_FrameBg
ImGui.Col_TextSelectedBg
ImGui.Col_ScrollbarGrabActive
ImGui.Col_TitleBgCollapsed
ImGui.Col_ModalWindowDimBg
ImGui.Col_ResizeGripActive
ImGui.Col_SeparatorHovered
ImGui.Col_ScrollbarGrabHovered
ImGui.Col_TabUnfocused
ImGui.Col_ScrollbarBg
ImGui.Col_ChildBg
ImGui.Col_Header
ImGui.Col_NavWindowingDimBg
ImGui.Col_CheckMark
ImGui.Col_Button
ImGui.Col_BorderShadow
ImGui.Col_DragDropTarget
ImGui.Col_MenuBarBg
ImGui.Col_TitleBgActive
ImGui.Col_SeparatorActive
ImGui.Col_Text
ImGui.Col_PlotLinesHovered
ImGui.Col_Border
ImGui.Col_TabUnfocusedActive
ImGui.Col_PlotLines
ImGui.Col_PlotHistogramHovered
ImGui.Col_ResizeGripHovered
ImGui.Col_Tab
ImGui.Col_TabHovered
ImGui.Col_PopupBg
ImGui.Col_TabActive
ImGui.Col_FrameBgActive
ImGui.Col_ButtonActive
ImGui.Col_WindowBg
ImGui.Col_SliderGrabActive
ImGui.Col_SliderGrab
ImGui.Col_NavHighlight
ImGui.Col_FrameBgHovered
ImGui.Col_TextDisabled
ImGui.Col_ResizeGrip
ImGui.Col_TableHeaderBg
ImGui.Col_TableBorderStrong
ImGui.Col_TableBorderLight
ImGui.Col_TableRowBg
ImGui.Col_TableRowBgAlt
</syntaxhighlight>
</syntaxhighlight>


=== DataType ===
=== ErrorMarkers ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.DataType_U8
ErrorMarkers = ImGuiErrorMarkers.new()
ImGui.DataType_S64
 
ImGui.DataType_Float
ErrorMarkers:add(line, message)
ImGui.DataType_S16
ErrorMarkers:remove(line)
ImGui.DataType_U16
message = ErrorMarkers:get(line)
ImGui.DataType_Double
number = ErrorMarkers:getSize()
ImGui.DataType_S8
ImGui.DataType_U32
ImGui.DataType_S32
ImGui.DataType_U64
</syntaxhighlight>
</syntaxhighlight>


=== Dir ===
=== Breakpoints ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.Dir_None
Breakpoints = ImGuiBreakpoints.new()
ImGui.Dir_Left
 
ImGui.Dir_Up
Breakpoints:add(line)
ImGui.Dir_Down
Breakpoints:remove(line)
ImGui.Dir_Right
bool = Breakpoints:get(line)
number = Breakpoints:getSize()
</syntaxhighlight>
</syntaxhighlight>


=== WindowFlags ===
== DRAW LISTS ==
'''Window draw list''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.WindowFlags_NoScrollWithMouse
local list = ImGui:getWindowDrawList()
ImGui.WindowFlags_None
ImGui.WindowFlags_NoScrollbar
ImGui.WindowFlags_HorizontalScrollbar
ImGui.WindowFlags_NoFocusOnAppearing
ImGui.WindowFlags_NoBringToFrontOnFocus
ImGui.WindowFlags_NoDecoration
ImGui.WindowFlags_NoCollapse
ImGui.WindowFlags_NoTitleBar
ImGui.WindowFlags_NoMove
ImGui.WindowFlags_NoInputs
ImGui.WindowFlags_NoMouseInputs
ImGui.WindowFlags_NoSavedSettings
ImGui.WindowFlags_NoNav
ImGui.WindowFlags_UnsavedDocument
ImGui.WindowFlags_NoNavFocus
ImGui.WindowFlags_AlwaysHorizontalScrollbar
ImGui.WindowFlags_AlwaysUseWindowPadding
ImGui.WindowFlags_NoNavInputs
ImGui.WindowFlags_NoResize
ImGui.WindowFlags_AlwaysVerticalScrollbar
ImGui.WindowFlags_MenuBar
ImGui.WindowFlags_NoBackground
ImGui.WindowFlags_AlwaysAutoResize
ImGui.WindowFlags_FullScreen -- custom constant, used to create a fullscreen window
</syntaxhighlight>
</syntaxhighlight>


=== TabItemFlags ===
'''Background draw list''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.TabItemFlags_SetSelected
local list = ImGui:getBackgroundDrawList()
ImGui.TabItemFlags_NoCloseWithMiddleMouseButton
ImGui.TabItemFlags_NoTooltip
ImGui.TabItemFlags_None
ImGui.TabItemFlags_NoPushId
ImGui.TabItemFlags_UnsavedDocument
ImGui.TabItemFlags_Leading
ImGui.TabItemFlags_Trailing
ImGui.TabItemFlags_NoReorder
</syntaxhighlight>
</syntaxhighlight>


=== ComboFlags ===
'''Foreground draw list''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.ComboFlags_HeightSmall
local list = ImGui:getForegroundDrawList()
ImGui.ComboFlags_HeightLarge
ImGui.ComboFlags_PopupAlignLeft
ImGui.ComboFlags_None
ImGui.ComboFlags_NoPreview
ImGui.ComboFlags_HeightRegular
ImGui.ComboFlags_HeightMask
ImGui.ComboFlags_NoArrowButton
ImGui.ComboFlags_HeightLargest
</syntaxhighlight>
</syntaxhighlight>


=== Cond ===
'''Draw lists commands''':
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ImGui.Cond_Appearing
DrawList:pushClipRect(clip_rect_min_x, clip_rect_min_y, clip_rect_max_x, clip_rect_max_y [, intersect_with_current_clip_rect = false])
ImGui.Cond_None
DrawList:pushClipRectFullScreen()
ImGui.Cond_Always
DrawList:popClipRect()
ImGui.Cond_FirstUseEver
DrawList:pushTextureID(texture)
ImGui.Cond_Once
DrawList:popTextureID()
</syntaxhighlight>
x, y = DrawList:getClipRectMin()
 
x, y = DrawList:getClipRectMax()
=== SelectableFlags ===
DrawList:addLine(p1_x, p1_y, p2_x, p2_y, color [, alpha = 1, thickness = 1])
<syntaxhighlight lang="lua">
DrawList:addRect(
ImGui.SelectableFlags_None
p_min_x, p_min_y,
ImGui.SelectableFlags_SpanAllColumns
p_max_x, p_max_y,
ImGui.SelectableFlags_AllowItemOverlap
color
ImGui.SelectableFlags_DontClosePopups
[, alpha = 1,
ImGui.SelectableFlags_AllowDoubleClick
rounding = 0, rounding_corners = ImGui.DrawFlags_RoundCornersAll,
ImGui.SelectableFlags_Disabled
thickness = 1])
</syntaxhighlight>
DrawList:addRectFilled(p_min_x, p_min_y, p_max_x, p_max_y, color [, alpha = 1, rounding = 0, rounding_corners = ImGui.DrawFlags_RoundCornersAll])
 
DrawList:addRectFilledMultiColor(p_min_x, p_min_y, p_max_x, p_max_y, color_upr_left, color_upr_right, color_bot_right, color_bot_left)
=== MouseCursor ===
DrawList:addQuad(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, color [, alpha = 1, thickness = 1])
<syntaxhighlight lang="lua">
DrawList:addQuadFilled(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, color)
ImGui.MouseCursor_Hand
DrawList:addTriangle(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, color [, alpha = 1, thickness = 1])
ImGui.MouseCursor_ResizeAll
DrawList:addTriangleFilled(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, color)
ImGui.MouseCursor_ResizeEW
DrawList:addCircle(center_x, center_y, radius, color [, alpha = 1, num_segments = 12, thickness = 1])
ImGui.MouseCursor_Arrow
DrawList:addCircleFilled(center_x, center_y, radius, color [, alpha = 1, num_segments = 12])
ImGui.MouseCursor_ResizeNS
DrawList:addNgon(center_x, center_y, radius, color [, alpha = 1, num_segments = 12, thickness = 1])
ImGui.MouseCursor_None
DrawList:addNgonFilled(center_x, center_y, radius, color [, alpha = 1, num_segments = 12])
ImGui.MouseCursor_NotAllowed
DrawList:addText(x, y, color, alpha, text) -- x, y (number), text_begin (string), text_end (string)
ImGui.MouseCursor_ResizeNWSE
DrawList:addFontText(font, font_size,
ImGui.MouseCursor_ResizeNESW
pos_x, pos_y,
ImGui.MouseCursor_TextInput
color, alpha,
</syntaxhighlight>
text
 
[, wrap_with = 0,
=== MouseButton ===
cpu_fine_clip_rect_x, cpu_fine_clip_rect_y,
<syntaxhighlight lang="lua">
cpu_fine_clip_rect_w, cpu_fine_clip_rect_h])
ImGui.MouseButton_Right
DrawList:addPolyline(points_table, color, alpha, closed, thickness) -- points_table (table), color (number), closed (bool), thickness (number)
ImGui.MouseButton_Middle
DrawList:addConvexPolyFilled(points_table, color) -- points_table (table), color (number)
ImGui.MouseButton_Left
DrawList:addBezierCubic(
</syntaxhighlight>
p1_x, p1_y,
 
p2_x, p2_y,
=== ColorEditFlags ===
p3_x, p3_y,
<syntaxhighlight lang="lua">
p4_x, p4_y,
ImGui.ColorEditFlags_AlphaPreview
color, alpha, thickness [, num_segments = 0])
ImGui.ColorEditFlags_DisplayRGB
DrawList:addBezierQuadratic(
ImGui.ColorEditFlags_DisplayHex
p1_x, p1_y,  
ImGui.ColorEditFlags_InputHSV
p2_x, p2_y,  
ImGui.ColorEditFlags_NoSidePreview
p3_x, p3_y,  
ImGui.ColorEditFlags_Uint8
color, alpha, thickness [, num_segments = 0])
ImGui.ColorEditFlags_AlphaPreviewHalf
DrawList:addImage(texture,  
ImGui.ColorEditFlags_Float
x, y,  
ImGui.ColorEditFlags_PickerHueWheel
x + w, y + h
ImGui.ColorEditFlags_OptionsDefault
[, tint_color = 0xffffff, tint_alpha = 1])
ImGui.ColorEditFlags_InputRGB
DrawList:addImageUV(texture,
ImGui.ColorEditFlags_HDR
x, y,
ImGui.ColorEditFlags_NoPicker
x + w, y + h,
ImGui.ColorEditFlags_AlphaBar
uv0x, uv0y,
ImGui.ColorEditFlags_DisplayHSV
uv1x, uv1y
ImGui.ColorEditFlags_PickerHueBar
[, tint_color = 0xffffff, tint_alpha = 1])
ImGui.ColorEditFlags_NoAlpha
DrawList:addImageQuad(texture,
ImGui.ColorEditFlags_NoOptions
x, y,
ImGui.ColorEditFlags_NoDragDrop
x + w, y,
ImGui.ColorEditFlags_NoInputs
x + w, y + h,
ImGui.ColorEditFlags_None
x, y + h
ImGui.ColorEditFlags_NoSmallPreview
[, tint_color = 0xffffff, tint_alpha = 1,
ImGui.ColorEditFlags_NoBorder
uv0x = 0, uv0y = 0,
ImGui.ColorEditFlags_NoLabel
uv1x = 1, uv1y = 0,
ImGui.ColorEditFlags_NoTooltip
uv2x = 1, uv2y = 1,
</syntaxhighlight>
uv3x = 0, uv3y = 1])
 
DrawList:addImageRounded(texture,
=== DragDropFlags ===
x, y,
<syntaxhighlight lang="lua">
x + w,
ImGui.DragDropFlags_SourceNoPreviewTooltip
y + h,
ImGui.DragDropFlags_SourceAllowNullID
tint_color, tint_alpha, round_radius
ImGui.DragDropFlags_AcceptNoDrawDefaultRect
[, corner_flags = ImGui.CorenerFlags_All])
ImGui.DragDropFlags_AcceptPeekOnly
DrawList:addImageRoundedUV(texture,
ImGui.DragDropFlags_AcceptBeforeDelivery
x, y,
ImGui.DragDropFlags_SourceNoHoldToOpenOthers
x + w, y + h,
ImGui.DragDropFlags_AcceptNoPreviewTooltip
uv0x, uv0y,
ImGui.DragDropFlags_SourceAutoExpirePayload
uv1x, uv1y,
ImGui.DragDropFlags_SourceExtern
tint_color, tint_alpha, round_radius
ImGui.DragDropFlags_None
[, corner_flags = ImGui.CorenerFlags_All])
ImGui.DragDropFlags_SourceNoDisableHover
DrawList:pathClear()
</syntaxhighlight>
DrawList:pathLineTo(x, y)
 
DrawList:pathLineToMergeDuplicate(x, y)
=== corner_flags ===
DrawList:pathFillConvex(color)
<syntaxhighlight lang="lua">
DrawList:pathStroke(color, alpha, closed [, thickness = 1])
ImGui.DrawFlags_None
DrawList:pathArcTo(center_x, center_y, radius, a_min, a_max [, num_segments = 10])
ImGui.DrawFlags_Closed
DrawList:pathArcToFast(center_x, center_y, radius, a_min, a_max)
ImGui.DrawFlags_RoundCornersTopLeft
DrawList:pathBezierCubicCurveTo(p2x, p2y, p3x, p3y, p4x, p4y [, num_segments = 0])
ImGui.DrawFlags_RoundCornersTopRight
DrawList:pathBezierQuadraticCurveTo(p2x, p2y, p3x, p3y [, num_segments = 0])
ImGui.DrawFlags_RoundCornersBottomLeft
DrawList:pathRect(min_x, min_y, max_x, max_y [, rounding = 0, ImGui.DrawFlags = 0])
ImGui.DrawFlags_RoundCornersBottomRight
-- CUSTOM
ImGui.DrawFlags_RoundCornersTop
-- rotate any draw list item around its center point
ImGui.DrawFlags_RoundCornersBottom
DrawList:rotateBegin()
ImGui.DrawFlags_RoundCornersLeft
DrawList:rotateEnd(radians)
ImGui.DrawFlags_RoundCornersRight
-- example:
ImGui.DrawFlags_RoundCornersAll
...
</syntaxhighlight>
local list = ImGui:getWindowDrawList()
 
list:rotateBegin()
=== ConfigFlags ===
list:addLine(100, 100, 100, 250, 0xff0000, 1, 10)
<syntaxhighlight lang="lua">
list:rotateEnd(math.pi/2.2)
ImGui.ConfigFlags_None                 
...
ImGui.ConfigFlags_NavEnableKeyboard     
</syntaxhighlight>
ImGui.ConfigFlags_NavEnableGamepad     
ImGui.ConfigFlags_NavEnableSetMousePos 
ImGui.ConfigFlags_NavNoCaptureKeyboard 
ImGui.ConfigFlags_NoMouse               
ImGui.ConfigFlags_NoMouseCursorChange
ImGui.ConfigFlags_IsSRGB               
ImGui.ConfigFlags_IsTouchScreen
</syntaxhighlight>
 
=== BackendFlags ===
<syntaxhighlight lang="lua">
ImGui.BackendFlags_None
ImGui.BackendFlags_HasGamepad
ImGui.BackendFlags_HasMouseCursors
ImGui.BackendFlags_HasSetMousePos
ImGui.BackendFlags_RendererHasVtxOffset
</syntaxhighlight>
 
=== SliderFlags ===
<syntaxhighlight lang="lua">
ImGui.SliderFlags_None         
ImGui.SliderFlags_ClampOnInput -- renamed in 1.79 to "SliderFlags_AlwaysClamp" (can be still used until 1.80)
ImGui.SliderFlags_AlwaysClamp
ImGui.SliderFlags_Logarithmic 
ImGui.SliderFlags_NoRoundToFormat
ImGui.SliderFlags_NoInput
</syntaxhighlight>
 
=== GlyphRanges ===
<syntaxhighlight lang="lua">
ImGui.GlyphRanges_Default,
ImGui.GlyphRanges_Korean,
ImGui.GlyphRanges_ChineseFull,
ImGui.GlyphRanges_ChineseSimplifiedCommon,
ImGui.GlyphRanges_Japanese,
ImGui.GlyphRanges_Cyrillic,
ImGui.GlyphRanges_Thai,
ImGui.GlyphRanges_Vietnamese
</syntaxhighlight>
 
=== ItemFlags ===
<syntaxhighlight lang="lua">
ImGui.ItemFlags_Disabled
ImGui.ItemFlags_ButtonRepeat
ImGui.ItemFlags_NoTabStop
</syntaxhighlight>
 
=== TableBgTarget ===
<syntaxhighlight lang="lua">
ImGui.TableBgTarget_None
ImGui.TableBgTarget_RowBg0
ImGui.TableBgTarget_RowBg1
ImGui.TableBgTarget_CellBg
</syntaxhighlight>
 
 
=== TableColumnFlags ===
<syntaxhighlight lang="lua">
ImGui.TableColumnFlags_None
ImGui.TableColumnFlags_DefaultHide
ImGui.TableColumnFlags_DefaultSort
ImGui.TableColumnFlags_WidthStretch
ImGui.TableColumnFlags_WidthFixed
ImGui.TableColumnFlags_NoResize
ImGui.TableColumnFlags_NoReorder
ImGui.TableColumnFlags_NoHide
ImGui.TableColumnFlags_NoClip
ImGui.TableColumnFlags_NoSort
ImGui.TableColumnFlags_NoSortAscending
ImGui.TableColumnFlags_NoSortDescending
ImGui.TableColumnFlags_NoHeaderWidth
ImGui.TableColumnFlags_PreferSortAscending
ImGui.TableColumnFlags_PreferSortDescending
ImGui.TableColumnFlags_IndentEnable
ImGui.TableColumnFlags_IndentDisable
ImGui.TableColumnFlags_IsEnabled
ImGui.TableColumnFlags_IsVisible
ImGui.TableColumnFlags_IsSorted
ImGui.TableColumnFlags_IsHovered
ImGui.TableColumnFlags_Disabled
ImGui.TableColumnFlags_NoHeaderLabel
</syntaxhighlight>
 
=== TableFlags ===
<syntaxhighlight lang="lua">
ImGui.TableFlags_None
ImGui.TableFlags_Resizable
ImGui.TableFlags_Reorderable
ImGui.TableFlags_Hideable
ImGui.TableFlags_Sortable
ImGui.TableFlags_NoSavedSettings
ImGui.TableFlags_ContextMenuInBody
ImGui.TableFlags_RowBg
ImGui.TableFlags_BordersInnerH
ImGui.TableFlags_BordersOuterH
ImGui.TableFlags_BordersInnerV
ImGui.TableFlags_BordersOuterV
ImGui.TableFlags_BordersH
ImGui.TableFlags_BordersV
ImGui.TableFlags_BordersInner
ImGui.TableFlags_BordersOuter
ImGui.TableFlags_Borders
ImGui.TableFlags_NoBordersInBody
ImGui.TableFlags_NoBordersInBodyUntilResize
ImGui.TableFlags_SizingFixedFit
ImGui.TableFlags_SizingFixedSame
ImGui.TableFlags_SizingStretchProp
ImGui.TableFlags_SizingStretchSame
ImGui.TableFlags_NoHostExtendX
ImGui.TableFlags_NoHostExtendY
ImGui.TableFlags_NoKeepColumnsVisible
ImGui.TableFlags_PreciseWidths
ImGui.TableFlags_NoClip
ImGui.TableFlags_PadOuterX
ImGui.TableFlags_NoPadOuterX
ImGui.TableFlags_NoPadInnerX
ImGui.TableFlags_ScrollX
ImGui.TableFlags_ScrollY
ImGui.TableFlags_SortMulti
ImGui.TableFlags_SortTristate
</syntaxhighlight>
 
=== TableColumnFlags ===
<syntaxhighlight lang="lua">
ImGui.TableColumnFlags_None
ImGui.TableColumnFlags_DefaultHide
ImGui.TableColumnFlags_DefaultSort
ImGui.TableColumnFlags_WidthStretch
ImGui.TableColumnFlags_WidthFixed
ImGui.TableColumnFlags_NoResize
ImGui.TableColumnFlags_NoReorder
ImGui.TableColumnFlags_NoHide
ImGui.TableColumnFlags_NoClip
ImGui.TableColumnFlags_NoSort
ImGui.TableColumnFlags_NoSortAscending
ImGui.TableColumnFlags_NoSortDescending
ImGui.TableColumnFlags_NoHeaderWidth
ImGui.TableColumnFlags_PreferSortAscending
ImGui.TableColumnFlags_PreferSortDescending
ImGui.TableColumnFlags_IndentEnable
ImGui.TableColumnFlags_IndentDisable
ImGui.TableColumnFlags_IsEnabled
ImGui.TableColumnFlags_IsVisible
ImGui.TableColumnFlags_IsSorted
ImGui.TableColumnFlags_IsHovered
</syntaxhighlight>
 
=== TableRowFlags ===
<syntaxhighlight lang="lua">
ImGui.TableRowFlags_None
ImGui.TableRowFlags_Headers
</syntaxhighlight>
 
=== SortDirection ===
<syntaxhighlight lang="lua">
ImGui.SortDirection_None
ImGui.SortDirection_Ascending
ImGui.SortDirection_Descending
</syntaxhighlight>
 
=== TE_ColorIndex ===
<syntaxhighlight lang="lua">
ImGui.TE_Default
ImGui.TE_Keyword
ImGui.TE_Number
ImGui.TE_String
ImGui.TE_CharLiteral
ImGui.TE_Punctuation
ImGui.TE_Preprocessor
ImGui.TE_Identifier
ImGui.TE_KnownIdentifier
ImGui.TE_PreprocIdentifier
ImGui.TE_Comment
ImGui.TE_MultiLineComment
ImGui.TE_Background
ImGui.TE_Cursor
ImGui.TE_Selection
ImGui.TE_ErrorMarker
ImGui.TE_Breakpoint
ImGui.TE_LineNumber
ImGui.TE_CurrentLineFill
ImGui.TE_CurrentLineFillInactive
ImGui.TE_CurrentLineEdge
</syntaxhighlight>
 
== ImageScaleMode ==
<syntaxhighlight lang="lua">
ImGui.ImageScaleMode_LetterBox
ImGui.ImageScaleMode_FitWidth
ImGui.ImageScaleMode_FitHeight
ImGui.ImageScaleMode_Stretch
</syntaxhighlight>
 
== DRAW LISTS ==
 
=== Window draw list ===
<syntaxhighlight lang="lua">
local list = ImGui:getWindowDrawList()
</syntaxhighlight>
 
'''Background draw list''':
<syntaxhighlight lang="lua">
local list = ImGui:getBackgroundDrawList()
</syntaxhighlight>


'''Foreground draw list''':
'''Usage example''':
 
[[File:Dear_Imgui_DrawList_capture_1.png]]
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local list = ImGui:getForegroundDrawList()
-- reference: https://github.com/ocornut/imgui/issues/3606#issuecomment-731726406
require "ImGui"
 
local imgui = ImGui.new()
local IO = imgui:getIO()
local w = 320
local h = 180
IO:setDisplaySize(w*2, h*2)
stage:addChild(imgui)
 
local cos,sin,sqrt = math.cos, math.sin, math.sqrt
local HSV2RGB = ImGui.colorConvertHSVtoRGB
local RGB2HEX = ImGui.colorConvertRGBtoHEX
local p = { -1,-1, 1,-1, 1,1, -1,1 }
local function conv(z, szx, szy, ox, oy, vx, vy) return ((vx/z)*szx*5+szx*0.5)+ox, ((vy/z)*szy*5+szy*0.5)+oy end
local function R(vx, vy, ng) ng*=0.1 local cosn = cos(ng) local sinn = sin(ng) return vx*cosn-vy*sinn, vx*sinn+vy*cosn end
local function FX(d, ax, ay, bx, by, sw, sh, t)
d:addRectFilled(ax,ay,bx,by,0,1,0)
t *= 4
for i = 0, 19 do
local z = 21-i-(t-(t//1))*2
local ng, ot0, ot1 = -t*2.1+z, -t+z*0.2, -t+(z+1)*0.2
local s, of, pts =
{ cos((t+z)*0.1)*0.2+1, sin((t+z)*0.1)*0.2+1, cos((t+z+1)*0.1)*0.2+1, sin((t+z+1)*0.1)*0.2+1 },
{ cos(ot0)*0.3, sin(ot0)*0.3, cos(ot1)*0.3, sin(ot1)*0.3 },
{ }
for j = 0, 7 do
local m, n = ((j%4)+1)*2, j//4
pts[j*2+1], pts[j*2+2] =
conv( (z+n)*2, sw, sh, ax, ay, R(p[m-1]*s[n*2+1]+of[n*2+1], p[m-0]*s[n*2+2]+of[n*2+2], ng+n) )
end
for j = 0, 3 do
local it = ( (((i&1) ~= 0) and 0.5 or 0.6) + j*0.05 ) * ( (21-z)/21 )
d:addConvexPolyFilled(
{
pts[j*2+1], pts[j*2+2], pts[((j+1)%4)*2+1], pts[((j+1)%4)*2+2],
pts[(((j+1)%4)+4)*2+1], pts[(((j+1)%4)+4)*2+2], pts[(j+4)*2+1],
pts[(j+4)*2+2]
},
RGB2HEX(HSV2RGB(0.6+sin(t*0.03)*0.5, 1, sqrt(it)))
)
end
end
end
 
function onEnterFrame(e)
imgui:newFrame(e.deltaTime)
if imgui:beginWindow("FX", nil, ImGui.WindowFlags_AlwaysAutoResize) then
imgui:invisibleButton("canvas", w, h)
local min_x, min_y = imgui:getItemRectMin()
local max_x, max_y = imgui:getItemRectMax()
local draw_list = imgui:getWindowDrawList()
draw_list:pushClipRect(min_x, min_y, max_x, max_y)
FX(draw_list, min_x, min_y, max_x, max_y, w, h, imgui:getTime())
draw_list:popClipRect()
end
imgui:endWindow()
imgui:render()
imgui:endFrame()
end
 
stage:addEventListener("enterFrame", onEnterFrame)
</syntaxhighlight>
</syntaxhighlight>


'''Draw lists commands''':
== EXPERIMENTAL ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DrawList:pushClipRect(clip_rect_min_x, clip_rect_min_y, clip_rect_max_x, clip_rect_max_y [, intersect_with_current_clip_rect = false])
p_open = ImGui:showLog(title, p_open [, ImGui.WindowFlags = 0]) -- draw log window
DrawList:pushClipRectFullScreen()
ImGui:writeLog(text)
DrawList:popClipRect()
DrawList:pushTextureID(texture)
DrawList:popTextureID()
x, y = DrawList:getClipRectMin()
x, y = DrawList:getClipRectMax()
DrawList:addLine(p1_x, p1_y, p2_x, p2_y, color [, alpha = 1, thickness = 1])
DrawList:addRect(
p_min_x, p_min_y,
p_max_x, p_max_y,
color
[, alpha = 1,
rounding = 0, rounding_corners = ImGui.DrawFlags_RoundCornersAll,
thickness = 1])
DrawList:addRectFilled(p_min_x, p_min_y, p_max_x, p_max_y, color [, alpha = 1, rounding = 0, rounding_corners = ImGui.DrawFlags_RoundCornersAll])
DrawList:addRectFilledMultiColor(p_min_x, p_min_y, p_max_x, p_max_y, color_upr_left, color_upr_right, color_bot_right, color_bot_left)
DrawList:addQuad(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, color [, alpha = 1, thickness = 1])
DrawList:addQuadFilled(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, color)
DrawList:addTriangle(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, color [, alpha = 1, thickness = 1])
DrawList:addTriangleFilled(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, color)
DrawList:addCircle(center_x, center_y, radius, color [, alpha = 1, num_segments = 12, thickness = 1])
DrawList:addCircleFilled(center_x, center_y, radius, color [, alpha = 1, num_segments = 12])
DrawList:addNgon(center_x, center_y, radius, color [, alpha = 1, num_segments = 12, thickness = 1])
DrawList:addNgonFilled(center_x, center_y, radius, color [, alpha = 1, num_segments = 12])
DrawList:addText(x, y, color, alpha, text) -- x, y (number), text_begin (string), text_end (string)
DrawList:addFontText(font, font_size,
pos_x, pos_y,
color, alpha,
text
[, wrap_with = 0,
cpu_fine_clip_rect_x, cpu_fine_clip_rect_y,
cpu_fine_clip_rect_w, cpu_fine_clip_rect_h])
DrawList:addPolyline(points_table, color, alpha, closed, thickness) -- points_table (table), color (number), closed (bool), thickness (number)
DrawList:addConvexPolyFilled(points_table, color) -- points_table (table), color (number)
DrawList:addBezierCubic(
p1_x, p1_y,
p2_x, p2_y,
p3_x, p3_y,
p4_x, p4_y,
color, alpha, thickness [, num_segments = 0])
DrawList:addBezierQuadratic(
p1_x, p1_y,
p2_x, p2_y,
p3_x, p3_y,
color, alpha, thickness [, num_segments = 0])
DrawList:addImage(texture,
x, y,
x + w, y + h
[, tint_color = 0xffffff, tint_alpha = 1])
DrawList:addImageUV(texture,
x, y,
x + w, y + h,
uv0x, uv0y,
uv1x, uv1y
[, tint_color = 0xffffff, tint_alpha = 1])
DrawList:addImageQuad(texture,
x, y,
x + w, y,
x + w, y + h,
x, y + h
[, tint_color = 0xffffff, tint_alpha = 1,
uv0x = 0, uv0y = 0,
uv1x = 1, uv1y = 0,
uv2x = 1, uv2y = 1,
uv3x = 0, uv3y = 1])
DrawList:addImageRounded(texture,
x, y,
x + w,
y + h,
tint_color, tint_alpha, round_radius
[, corner_flags = ImGui.CorenerFlags_All])
DrawList:addImageRoundedUV(texture,
x, y,
x + w, y + h,
uv0x, uv0y,
uv1x, uv1y,
tint_color, tint_alpha, round_radius
[, corner_flags = ImGui.CorenerFlags_All])
DrawList:pathClear()
DrawList:pathLineTo(x, y)
DrawList:pathLineToMergeDuplicate(x, y)
DrawList:pathFillConvex(color)
DrawList:pathStroke(color, alpha, closed [, thickness = 1])
DrawList:pathArcTo(center_x, center_y, radius, a_min, a_max [, num_segments = 10])
DrawList:pathArcToFast(center_x, center_y, radius, a_min, a_max)
DrawList:pathBezierCubicCurveTo(p2x, p2y, p3x, p3y, p4x, p4y [, num_segments = 0])
DrawList:pathBezierQuadraticCurveTo(p2x, p2y, p3x, p3y [, num_segments = 0])
DrawList:pathRect(min_x, min_y, max_x, max_y [, rounding = 0, ImGui.DrawFlags = 0])
-- CUSTOM
-- rotate any draw list item around its center point
DrawList:rotateBegin()
DrawList:rotateEnd(radians)
-- example:
...
local list = ImGui:getWindowDrawList()
list:rotateBegin()
list:addLine(100, 100, 100, 250, 0xff0000, 1, 10)
list:rotateEnd(math.pi/2.2)
...
</syntaxhighlight>
</syntaxhighlight>


'''Usage example''':
Gestures (touch only, turned OFF by default) ''WIP'':
<img src="https://user-images.githubusercontent.com/1312968/99901217-4697fa80-2cb5-11eb-9e80-c469cc69b848.gif">
* tap gesture (Left Mouse Button)
* hold gesture (Right Mouse Button)
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- reference: https://github.com/ocornut/imgui/issues/3606#issuecomment-731726406
ImGui:setTouchGesturesEnabled(bool)
require "ImGui"
bool = ImGui:isTouchGesturesEnabled()
UI = ImGui.new()
IO = UI:getIO()
local w = 320
local h = 180
IO:setDisplaySize(w*2,h*2)
 
local cos,sin,sqrt=math.cos,math.sin,math.sqrt
local HSV2RGB=ImGui.colorConvertHSVtoRGB
local RGB2HEX=ImGui.colorConvertRGBtoHEX
local p = {-1,-1, 1,-1, 1,1, -1,1}
local function conv(z,szx,szy,ox,oy,vx,vy) return ((vx/z)*szx*5+szx*0.5)+ox,((vy/z)*szy*5+szy*0.5)+oy end
local function R(vx, vy, ng) ng*=0.1 local cosn = cos(ng) local sinn = sin(ng) return vx*cosn-vy*sinn, vx*sinn+vy*cosn end
local function FX(d,ax,ay,bx,by,sw,sh,t)
d:addRectFilled(ax,ay,bx,by,0,1,0)
t *= 4
for i = 0, 19 do
local z=21-i-(t-(t//1))*2
local ng,ot0,ot1=-t*2.1+z,-t+z*0.2,-t+(z+1)*0.2
local s,of,pts={cos((t+z)*0.1)*0.2+1,sin((t+z)*0.1)*0.2+1,cos((t+z+1)*0.1)*0.2+1,sin((t+z+1)*0.1)*0.2+1},{cos(ot0)*0.3,sin(ot0)*0.3,cos(ot1)*0.3,sin(ot1)*0.3},{}
for j=0,7 do
local i,n = ((j%4)+1)*2,j//4
pts[j*2+1],pts[j*2+2]=conv((z+n)*2,sw,sh,ax,ay,R(p[i-1]*s[n*2+1]+of[n*2+1],p[i-0]*s[n*2+2]+of[n*2+2],ng+n))
end
for j=0,3 do
local it=((((i&1) ~= 0) and 0.5 or 0.6)+j*0.05)*((21-z)/21)
d:addConvexPolyFilled(
{pts[j*2+1],pts[j*2+2],pts[((j+1)%4)*2+1],pts[((j+1)%4)*2+2],pts[(((j+1)%4)+4)*2+1],pts[(((j+1)%4)+4)*2+2],pts[(j+4)*2+1],pts[(j+4)*2+2]},
RGB2HEX(HSV2RGB(0.6+sin(t*0.03)*0.5,1,sqrt(it)))
)
end
end
end
 
function onEnterFrame(e)
UI:newFrame(e.deltaTime)
if (UI:beginWindow("FX", nil, ImGui.WindowFlags_AlwaysAutoResize)) then
UI:invisibleButton("canvas", w, h)
local min_x, min_y = UI:getItemRectMin()
local max_x, max_y = UI:getItemRectMax()
local draw_list = UI:getWindowDrawList()
draw_list:pushClipRect(min_x, min_y, max_x, max_y)
FX(draw_list,min_x,min_y,max_x,max_y,w,h,UI:getTime())
draw_list:popClipRect()
end
UI:endWindow()
UI:render()
UI:endFrame()
end
 
stage:addChild(UI)
stage:addEventListener("enterFrame", onEnterFrame)
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 03:19, 27 October 2026

Dear ImGui LUA binding for Gideros Mobile

GitHub https://github.com/MultiPain/Gideros_ImGui

Constructor

-- font_atlas: copy fonts
-- mouse_listeners: adds internal mouse event listeners
-- keyboard_listeners: adds internal keyboard event listeners
-- touch_listeners: adds internal touch event listeners
ImGui.new([font_atlas = nil, mouse_listeners = true, keyboard_listeners = true, touch_listeners = false])

IO Functions

GetIO() access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)

local IO = ImGui:getIO()

Functions:

Settings/.Ini Utilities
* The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini").
* Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.
IO:setFontDefault(font)
ImGuiConfigFlag = IO:getConfigFlags()
IO:setConfigFlags(ImGui.ConfigFlag)
IO:addConfigFlags(ImGui.ConfigFlag)
ImGuiBackendFlag = IO:getBackendFlags()
IO:setBackendFlags(ImGui.BackendFlag)
number = IO:getIniSavingRate()
IO:setIniSavingRate(number)
string = IO:getIniFilename()
IO:setIniFilename(string)
IO:saveIniSettings([path]) -- if path is not defined the it uses default path, which is set by IO:setIniFilename()
IO:loadIniSettings([path])
string = IO:getLogFilename()
IO:setLogFilename(string)
number = IO:getMouseDoubleClickTime()
IO:setMouseDoubleClickTime(number)
number = IO:getMouseDragThreshold()
IO:setMouseDragThreshold(number)
flag = IO:getMouseDrawCursor()
IO:setMouseDrawCursor(flag)
number = IO:getMouseDoubleClickMaxDist()
IO:setMouseDoubleClickMaxDist(number)
number = IO:getKeyRepeatDelay()
IO:setKeyRepeatDelay(number)
number = IO:getKeyRepeatRate()
IO:setKeyRepeatRate(number)
number = IO:getFontGlobalScale()
IO:setFontGlobalScale(number)
bool = IO:getFontAllowUserScaling()
IO:setFontAllowUserScaling(bool)
number, number = IO:getDisplayFramebufferScale()
IO:setDisplayFramebufferScale(number, number)
bool = IO:getConfigMacOSXBehaviors()
IO:setConfigMacOSXBehaviors(bool)
bool = IO:getConfigInputTextCursorBlink()
IO:setConfigInputTextCursorBlink(bool)
bool = IO:getConfigWindowsResizeFromEdges()
IO:setConfigWindowsResizeFromEdges(bool)
bool = IO:getConfigWindowsMoveFromTitleBarOnly()
IO:setConfigWindowsMoveFromTitleBarOnly(bool)
number = IO:getConfigWindowsMemoryCompactTimer()
IO:setConfigWindowsMemoryCompactTimer(number)
string = IO:getBackendPlatformName()
string = IO:getBackendRendererName()
bool = IO:IsMouseDown(button)
number = IO:getMouseWheel()
number = IO:getMouseWheelH()
flag = IO:wantCaptureMouse()
flag = IO:wantCaptureKeyboard()
flag = IO:wantTextInput()
flag = IO:wantSetMousePos()
flag = IO:wantSaveIniSettings()
number = IO:getFramerate()
number = IO:getMetricsRenderVertices()
number = IO:getMetricsRenderIndices()
number = IO:getMetricsRenderWindows()
number = IO:getMetricsActiveWindows()
number = IO:getMetricsActiveAllocations()
x, y = IO:getMouseDelta()
number = IO:getMouseDownSec(mouse_button)
IO:setDisplaySize(w, h)
w, h = IO:getDisplaySize()
number = IO:getDeltaTime()
-- reset mouse buttons state
IO:resetMouseDown()
-- reset key states (including ALT/SHIFT/CTRL/SUPER (META))
IO:resetKeysDown()
-- set ALT/SHIFT/CTRL/SUPER (META) key state
IO:setModKeyDown(key_code, bool) -- "key_code" is a gideros MOD key
-- set any key state
IO:setKeysDown(key_code, bool) -- "key_code" is a gideros regular "keyCode"
-- adds text to active text input widget
IO:addInputCharactersUTF8(text)
-- emulate wheel scrolling
IO:setMouseWheel(number)
-- sets mouse position (data only, no visual changes)
IO:setMousePos(x, y)
-- set mouse state, where index: 0 - left mouse, 1 - right, 2 - middle, 3 - unused, 4 - unused.
IO:setMouseDown(mouse_button, state) -- "mouse_button" is a gideros mouse button code

-- "key" is any ImGui KeyCode (check [here](#keyboard-keys))
-- "down" is a boolean
IO:addKeyEvent(key, down)
IO:addKeyAnalogEvent(key, down, number)
IO:AddMousePosEvent(x, y)
-- "button" is any ImGui button (check [here](#MouseButton))
IO:addMouseButtonEvent(button, down)
IO:addMouseWheelEvent(x, y)

IO:setAppAcceptingEvents([accepting_events = true])

Style setters/getters

GetStyle() instance access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame!

local Style = ImGui:getStyle()

Setters/getters:

Style:setColor(ImGui.Col, color, alpha)
color, alpha = Style:getColor(ImGui.Col)
Style:setAlpha(value)
value = Style:getAlpha()

Style:setWindowRounding(value)
value = Style:getWindowRounding()
Style:setWindowBorderSize(value)
value = Style:getWindowBorderSize()
Style:setChildRounding(value)
value = Style:getChildRounding()
Style:setChildBorderSize(value)
value = Style:getChildBorderSize()
Style:setPopupRounding(value)
value = Style:getPopupRounding()
Style:setPopupBorderSize(value)
value = Style:getPopupBorderSize()
Style:setFrameRounding(value)
value = Style:getFrameRounding()
Style:setFrameBorderSize(value)
value = Style:getFrameBorderSize()
Style:setIndentSpacing(value)
value = Style:getIndentSpacing()
Style:setColumnsMinSpacing(value)
value = Style:getColumnsMinSpacing()
Style:setScrollbarSize(value)
value = Style:getScrollbarSize()
Style:setScrollbarRounding(value)
value = Style:getScrollbarRounding()
Style:setGrabMinSize(value)
value = Style:getGrabMinSize()
Style:setGrabRounding(value)
value = Style:getGrabRounding()
Style:setLogSliderDeadzone(value)
value = Style:getLogSliderDeadzone()
Style:setTabRounding(value)
value = Style:getTabRounding()
Style:setTabBorderSize(value)
value = Style:getTabBorderSize()
Style:setTabMinWidthForCloseButton(value)
value = Style:getTabMinWidthForCloseButton()
Style:setMouseCursorScale(value)
value = Style:getMouseCursorScale()
Style:setCurveTessellationTol(value)
value = Style:getCurveTessellationTol()
Style:setCircleSegmentMaxError(value)
value = Style:getCircleSegmentMaxError()
Style:setWindowPadding(x, y)
x, y = Style:getWindowPadding()
Style:setWindowMinSize(x, y)
x, y = Style:getWindowMinSize()
Style:setWindowTitleAlign(x, y)
x, y = Style:getWindowTitleAlign()
Style:setFramePadding(x, y)
x, y = Style:getFramePadding()
Style:setCellPadding(x, y)
x, y = Style:getCellPadding()
Style:setItemSpacing(x, y)
x, y = Style:getItemSpacing()
Style:setItemInnerSpacing(x, y)
x, y = Style:getItemInnerSpacing()
Style:setTouchExtraPadding(x, y)
x, y = Style:getTouchExtraPadding()
Style:setButtonTextAlign(x, y)
x, y = Style:getButtonTextAlign()
Style:setSelectableTextAlign(x, y)
x, y = Style:getSelectableTextAlign()
Style:setDisplayWindowPadding(x, y)
x, y = Style:getDisplayWindowPadding()
Style:setDisplaySafeAreaPadding(x, y)
x, y = Style:getDisplaySafeAreaPadding()
Style:setWindowMenuButtonPosition(ImGui.Dir)
dir = Style:getWindowMenuButtonPosition()
Style:setColorButtonPosition(ImGui.Dir)
dir = Style:getColorButtonPosition()
Style:setAntiAliasedLines(flag)
flag = Style:getAntiAliasedLines()
Style:setAntiAliasedLinesUseTex(flag)
flag = Style:getAntiAliasedLinesUseTex()
Style:setAntiAliasedFill(flag)
flag = Style:getAntiAliasedFill()
Style:setDisabledAlpha(number)
alpha = Style:getDisabledAlpha()
Style:setSeparatorTextBorderSize(number)
number = Style:getSeparatorTextBorderSize()
Style:setSeparatorTextAlign(x, y)
x, y = Style:getSeparatorTextAlign()
Style:setSeparatorTextPadding(x, y)
x, y = Style:getSeparatorTextPadding()

DEFAULT STYLES

ImGui:setDarkStyle()
ImGui:setLightStyle()
ImGui:setClassicStyle()

Render

NewFrame() start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame().

EndFrame() ends the Dear ImGui frame. Automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all!

Render() ends the Dear ImGui frame, finalize the draw data.

ImGui:newFrame(deltaTime)
ImGui:render()
ImGui:endFrame()

Demos

is_openFlag = ImGui:showUserGuide()
is_openFlag = ImGui:showDemoWindow([p_open])
is_openFlag = ImGui:showAboutWindow([p_open])
is_openFlag = ImGui:showStyleEditor()
is_openFlag = ImGui:showFontSelector()
is_openFlag = ImGui:showMetricsWindow([p_open])
is_openFlag = ImGui:showStyleSelector(label)
is_openFlag = ImGui:ShowStackToolWindow([p_open])
ImGui:showLuaStyleEditor()

Windows

  • Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
  • You may append multiple times to the same window during the same frame.
  • Passing bool* p_open != NULL shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
  • Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. Always call a matching End() for each Begin() call, regardless of its return value! [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu / EndMenu, BeginPopup / EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.]
  • Note that the bottom of window stack always contains a window called "Debug".
p_open, draw = ImGui:beginWindow(label, p_open [, ImGui.WindowFlags = 0])
-- do not show "X" button
draw = ImGui:beginWindow(label, nil [, ImGui.WindowFlags = 0])
-- start a window with no borders, no paddings, no rounding and ImGui.WindowFlags_Fullscreen flag
p_open, draw = ImGui:beginFullScreenWindow(label, p_open [, ImGui.WindowFlags = 0]) 
-- do not show "X" button
draw = ImGui:beginFullScreenWindow(label, nil [, ImGui.WindowFlags = 0]) 
ImGui:endWindow()

Child Windows

Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. For each independent axis of size:

  • == 0.0f -> use remaining host window size
  • > 0.0f -> fixed size
  • < 0.0f -> use remaining window size minus abs(size) Each axis can use a different mode, e.g. ImVec2(0,400). BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
Tip
Always call a matching EndChild() for each BeginChild() call, regardless of its return value [as with Begin: this is due to legacy reason and inconsistent with most BeginXXX functions apart from the regular Begin() which behaves like BeginChild().]
ImGui:beginChild(id [, w = 0, h = 0, borderFlag = false, ImGui.WindowFlags = 0])
ImGui:endChild()

Windows Utilities

  • Current window = the window we are appending into while inside a Begin() / End() block.
  • Next window = next window we will Begin() into.
  • Prefer using SetNextXXX functions (before Begin) rather than SetXXX functions (after Begin()).
flag = ImGui:isWindowAppearing()
flag = ImGui:isWindowCollapsed()
flag = ImGui:isWindowFocused([ImGui.FocusedFlags = 0])
flag = ImGui:isWindowHovered([ImGui.HoveredFlags = 0])
x, y = ImGui:getWindowPos()
w, h = ImGui:getWindowSize()
w = ImGui:getWindowWidth()
h = ImGui:getWindowHeight()
x1,y1, x2,y2 = ImGui:getWindowBounds() -- returns window region rectangle in global coordinates

ImGui:setNextWindowPos(x, y [, ImGui.Cond = 0, pivotX = 0, pivotY = 0])
ImGui:setNextWindowSize(w, h [, ImGui.Cond = 0])
ImGui:setNextWindowContentSize(w, h)
ImGui:setNextWindowCollapsed(flag [, ImGui.Cond = 0])
ImGui:setNextWindowFocus()
ImGui:setNextWindowBgAlpha(alpha)
ImGui:setNextWindowScroll(x, y)
ImGui:setWindowPos(name, x, y [, ImGui.Cond = 0]) OR ImGui:setWindowPos(x, y [, ImGui.Cond = 0])
ImGui:setWindowSize(name, w, h [, ImGui.Cond = 0]) OR ImGui:setWindowSize(w, h [, ImGui.Cond = 0])
ImGui:setWindowCollapsed(name, flag [, ImGui.Cond = 0]) OR ImGui:setWindowCollapsed(flag [, ImGui.Cond = 0])
ImGui:setWindowFocus(name) OR ImGui:setWindowFocus()
ImGui:setWindowFontScale(scale)
-- scroll window when touching void
ImGui:scrollWhenDragging(x, y)
☠️Note: because Dear ImGui is an Immediate Mode GUI framework, functions that fetch window properties (like scrolling, window sizes, or content regions) internally query the "current window" pointer. If ImGui:begin() hasn't been called yet, or if ImGui:end() was already called, that pointer is NULL, causing a fatal segmentation fault/crash

Window size constraints

Can be used to set minimum and maximum window size, plus contraint the size if needed.

-- call this function before ImGui:beginWindow()
ImGui:setNextWindowSizeConstraints(min_w, min_h, max_w, max_h [, resize_callback, user_data]))
-- resizeCallback is a function:
function (callbackData [, user_data])
	-- do some math, and return desired size
	-- ...
	return desired_width, desired_height
end

Resize callback:

-- get window position
x, y = callbackData:getPos()
x = callbackData:getX()
y = callbackData:getY()

-- get currrent size
current_width, current_height = callbackData:getCurrentSize()
current_width = callbackData:getCurrentWidth()
current_height = callbackData:getCurrentHeight()

-- get desired size
desired_width, desired_height = callbackData:getDesiredSize()
desired_width = callbackData:getDesiredWidth()
desired_height = callbackData:getDesiredHeight()

Example:

require "ImGui"

local function stepSize(callback_data, step)
	local w, h = callback_data:getDesiredSize()
	w = (w // step) * step
	h = (h // step) * step
	return w, h
end

local ui = ImGui.new()
stage:addChild(ui)

stage:addEventListener("enterFrame", function(e)
	ui:newFrame(e.deltaTime)
	
	-- window size step is 32 (last argument, that is passed to the callback as second argument)
	ui:setNextWindowSizeConstraints(200, 200, 400, 400, stepSize, 32)
	if (ui:beginWindow("My window")) then 
		
		ui:textWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
	end
	ui:endWindow()
	
	ui:showDemoWindow()
	
	ui:render()
	ui:endFrame()
end)

Content region

  • Those functions are bound to be redesigned soon (they are confusing, incomplete and return values in local window coordinates which increases confusion)
scaleX, scaleY = ImGui:getContentRegionMax()
w, h = ImGui:getContentRegionAvail()
x, y = ImGui:getWindowContentRegionMin()
x, y = ImGui:getWindowContentRegionMax()
☠️Note: because Dear ImGui is an Immediate Mode GUI framework, functions that fetch window properties (like scrolling, window sizes, or content regions) internally query the "current window" pointer. If ImGui:begin() hasn't been called yet, or if ImGui:end() was already called, that pointer is NULL, causing a fatal segmentation fault/crash

Windows Scrolling

x = ImGui:getScrollX()
y = ImGui:getScrollY()
maxX = ImGui:getScrollMaxX()
maxY = ImGui:getScrollMaxY()
ImGui:setScrollX(value)
ImGui:setScrollY(value)
ImGui:setScrollHereX([ratio = 0.5])
ImGui:setScrollHereY([ratio = 0.5])
ImGui:setScrollFromPosX(x [, ratio = 0.5])
ImGui:setScrollFromPosY(y [, ratio = 0.5])
☠️Note: because Dear ImGui is an Immediate Mode GUI framework, functions that fetch window properties (like scrolling, window sizes, or content regions) internally query the "current window" pointer. If ImGui:begin() hasn't been called yet, or if ImGui:end() was already called, that pointer is NULL, causing a fatal segmentation fault/crash

Example

self.doresetscrollbar = false
...
self.doresetscrollbar = true

function Level1:onEnterFrame(e)
	self.imgui:newFrame(e.deltaTime)
	self.imgui:beginWindow("window") -- #1
	if self.doresetscrollbar then
		self.doresetscrollbar = false
		self.imgui:setScrollY(0)
	end
...
	self.imgui:endWindow() -- #1
	self.imgui:endFrame()
	self.imgui:render()
end

Parameters stacks (shared)

ImGui:pushStyleColor(ImGui.Col, color, alpha) -- https://wiki.gideros.rocks/index.php/Dear_ImGui_Flags#Col
ImGui:popStyleColor([count = 1])
ImGui:pushStyleVar(ImGui.StyleVar, value) OR ImGui:pushStyleVar(ImGui.StyleVar, value1, value2)
ImGui:popStyleVar([count = 1])
color, alpha = ImGui:getStyleColor(ImGui.Col)
fontSize = ImGui:getFontSize()

Parameters stacks (current window)

ImGui:pushItemWidth(w)
ImGui:popItemWidth()
ImGui:setNextItemWidth(w)
w = ImGui:calcItemWidth()
ImGui:pushTextWrapPos([localX = 0])
ImGui:popTextWrapPos()
ImGui:pushTabStop(flag)
ImGui:popTabStop()
ImGui:pushButtonRepeat(flag)
ImGui:popButtonRepeat()

Cursor / Layout

  • By "cursor" we mean the current output position.
  • The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.
  • You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceeding widget.
  • Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:
    • Window-local coordinates: SameLine(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos()
    • Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions
ImGui:separator()
ImGui:sameLine([offset_x = 0, spacing = -1])
ImGui:newLine()
ImGui:spacing()
ImGui:dummy(w, h)
ImGui:indent([indent = 0])
ImGui:unindent([indent = 0])
ImGui:beginGroup()
ImGui:endGroup()
 
x, y = ImGui:getCursorPos()
x = ImGui:getCursorPosX()
y = ImGui:getCursorPosY()
ImGui:setCursorPos(local_x, local_y)
ImGui:setCursorPosX(local_x)
ImGui:setCursorPosY(local_y)
x, y = ImGui:getCursorStartPos()
x, y = ImGui:getCursorScreenPos()
ImGui:setCursorScreenPos(x, y)
ImGui:alignTextToFramePadding()
lineH = ImGui:getTextLineHeight()
lineH = ImGui:getTextLineHeightWithSpacing()
frameH = ImGui:getFrameHeight()
frameH = ImGui:getFrameHeightWithSpacing()

ID stack/scopes

  • Read the FAQ for more details about how ID are handled in Dear Imgui. If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
  • The resulting ID are hashes of the entire stack.
  • You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
  • In this header file we use the "label"/"name" terminology to denote a string that will be displayed and used as an ID, whereas "str_id" denote a string that is only used as an ID and not normally displayed.
ImGui:pushID(anyValue) 
ImGui:pushID(str)
ImGui:popID()
number = ImGui:getID(anyValue)
number = ImGui:getID(str)
number = ImGui:getItemID()

WIDGETS

Widgets: Text

ImGui:textUnformatted(text [, textEnd])
ImGui:text(text)
ImGui:textColored(text, color, alpha)
ImGui:textDisabled(text)
ImGui:textWrapped(text)
ImGui:labelText(text, label)
ImGui:bulletText(text)
ImGui:separatorText(label)

Widgets: Main

flag = ImGui:button(text [, w = 0, h = 0])
flag = ImGui:smallButton(text)
flag = ImGui:invisibleButton(string_ID [, w = 0, h = 0])
flag = ImGui:arrowButton(string_ID [, ImGui.Dir = 0])
flag = ImGui:checkbox(text, flag)
flags, is_changed = ImGui:checkboxFlags(label [, flags = 0, flags_value = 0])
number, is_changed = ImGui:radioButton(text, number, number)
is_changed = ImGui:radioButton(text, flag)
ImGui:progressBar(fraction [, anchor_x = -1, anchor_y = 0, overlay_string = nil])
ImGui:bullet()

Widgets: Images

-- Images are streched (ImGui default functions)
ImGui:image(texture, w, h
	[, tint_color = 0xffffff, tint_alpha = 1,
	border_color = 0xffffff, border_alpha = 0])

ImGui:imageUV(texture,
	w, h,
	uv0x, uv0y,
	uv1x, uv1y,
	[, tint_color = 0xffffff, tint_alpha = 1, border_color = 0xffffff, border_alpha = 0])

pressFlag = ImGui:imageButton(str_id, texture, w, h
	[, tint_color = 0xffffff, tint_alpha = 1,
	border_color = 0xffffff, border_alpha = 0])

pressFlag = ImGui:imageButtonUV(str_id, texture, w, h,
	uv0x, uv0y, uv1x, uv1y
	[, tint_color = 0xffffff, tint_alpha = 1,
	border_color = 0xffffff, border_alpha = 0])

-- Images are scaled (extended by @MultiPain)
-- padding deprecated
-- (use "ImGui:pushStyleVar(ImGui.StyleVar_FramePadding, x, y)/ImGui:popStyleVar()")
ImGui:scaledImage(str_id, texture, w, h
	[, fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
	anchor_x = 0.5, anchor_y = 0.5,
	tint_col = 0xffffff, tint_alpha = 1,
	border_col = 0, border_alpha = 0,
	bg_col = 0, bg_alpha = 0])

pressFlag = ImGui:scaledImageButton(str_id, texture, w, h
	[, fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
	ImGui.ButtonFlags = 0, anchor_x = 0.5, anchor_y = 0.5,
	clip_offset_x = 0, clip_offset_y = 0,
	tint_col = 0xffffff, tint_alpha = 1,
	border_col = 0, border_alpha = 0,
	bg_col = 0, bg_alpha = 0])

pressFlag = ImGui:scaledImageButtonWithText(texture, label, image_w, image_h
	[, button_w = 0, button_h = 0, ImGui.ButtonFlags = 0,
	fit_mode = ImGui.ImageScaleMode_LetterBox, keep_size = false,
	anchor_x = 0.5, anchor_y = 0.5, image_side = ImGui.Dir_Left,
	clip_offset_x = 0, clip_offset_y = 0,
	tint_col = 0xffffff, tint_alpha = 1,
	border_col = 0, border_alpha = 0,
	bg_col = 0, bg_alpha = 0])

Widgets: Combo Box

openFlag = ImGui:beginCombo(text, preview_text [, ImGui.ComboFlags = 0])
ImGui:endCombo()
current_item, is_open = ImGui:combo(label, current_item, items) -- items (table): {"item1", "item2", ...}

Widgets: Drags

value, is_changed = ImGui:dragFloat(label, value
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, is_changed = ImGui:dragFloat2(label, value1, value2
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, value3, is_changed = ImGui:dragFloat3(label, value1, value2, value3
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, value3, value4, is_changed = ImGui:dragFloat4(label, value1, value2, value3, value4
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value_min, value_max, is_changed = ImGui:dragFloatRange2(label, value_min, value_max
	[, inc_step = 1, min = 0, max = 0,
	format_min_string = "%.3f", ImGui.SliderFlags = 0])
-- table must be an array of any size > 0
is_changed = ImGui:dragFloatT(label, table
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value, is_changed = ImGui:dragInt(label, value
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value1, value2, is_changed = ImGui:dragInt2(label, value1, value2
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value1, value2, value3, is_changed = ImGui:dragInt3(label, value1, value2, value3
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value1, value2, value3, value4, is_changed = ImGui:dragInt4(label, value1, value2, value3, value4
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

v_current_min, v_current_max, flag = ImGui:dragIntRange2(label, v_current_min, v_current_max
	[, v_speed = 1, v_min = 0, v_max = 0,
	format = "%d", format_max = nil, ImGui.SliderFlags = 0])

-- table must be an array of any size > 0
is_changed = ImGui:dragIntT(label, table
	[, inc_step = 1, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

Widgets: Sliders

value, is_changed = ImGui:sliderFloat(label, value
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, is_changed = ImGui:sliderFloat2(label, value1, value2
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, value3, is_changed = ImGui:sliderFloat3(label, value1, value2, value3
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, value3, value4, is_changed = ImGui:sliderFloat4(label, value1, value2, value3, value4
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value_in_rad, is_changed = ImGui:sliderAngle(label, value_in_rad
	[, min_degrees = -360, max_degrees = 360,
	format_string = "%.0f deg", ImGui.SliderFlags = 0])

-- table must be an array of any size > 0
is_changed = ImGui:sliderFloatT(label, table
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value, is_changed = ImGui:sliderInt(label, value
	[, min = 0, max = 0,
	format_string = "%d, ImGui.SliderFlags = 0"])

value1, value2, is_changed = ImGui:sliderInt2(label, value1, value2
	[, min = 0, max = 0,
	format_string = "%d, ImGui.SliderFlags = 0"])

value1, value2, value3, is_changed = ImGui:sliderInt3(label, value1, value2, value3
	[, min = 0, max = 0,
	format_string = "%d, ImGui.SliderFlags = 0"])

value1, value2, value3, value4, is_changed = ImGui:sliderInt4(label, value1, value2, value3, value4
	[, min = 0, max = 0,
	format_string = "%d, ImGui.SliderFlags = 0"])

-- table must be an array of any size > 0
is_changed = ImGui:sliderIntT(label, table
	[, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value, is_changed = ImGui:vSliderFloat(label, w, h, value, min, max
	[, format_string = "%.3f", ImGui.SliderFlags = 0])

value, is_changed = ImGui:vSliderInt(label, w, h, value, min, max
	[, format_string = "%d", ImGui.SliderFlags = 0])

value, is_changed = ImGui:filledSliderFloat(label, mirror_flag, value
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, is_changed = ImGui:filledSliderFloat2(label, mirror_flag, value1, value2
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, value3, is_changed = ImGui:filledSliderFloat3(label, mirror_flag, value1, value2, value3
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value1, value2, value3, value4, is_changed = ImGui:filledSliderFloat4(label, mirror_flag, value1, value2, value3, value4
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

-- table must be an array of any size > 0
is_changed = ImGui:filledSliderFloatT(label, mirror_flag, table
	[, min = 0, max = 0,
	format_string = "%.3f", ImGui.SliderFlags = 0])

value_in_rad, is_changed = ImGui:filledSliderAngle(label, mirror_flag, value_in_rad
	[, min_degrees = -360, max_degrees = 360,
	format_string = "%.0f deg", ImGui.SliderFlags = 0])

value, is_changed = ImGui:filledSliderInt(label, mirror_flag, value
	[, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value1, value2, is_changed = ImGui:filledSliderInt2(label, mirror_flag, value1, value2
	[, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value1, value2, value3, is_changed = ImGui:filledSliderInt3(label, mirror_flag, value1, value2, value3
	[, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value1, value2, value3, value4, is_changed = ImGui:filledSliderInt4(label, mirror_flag, value1, value2, value3, value4
	[, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

-- table must be an array of any size > 0
is_changed = ImGui:filledSliderIntT(label, mirror_flag, table
	[, min = 0, max = 0,
	format_string = "%d", ImGui.SliderFlags = 0])

value, is_changed = ImGui:vFilledSliderFloat(label, mirror_flag, w, h, value, min, max
	[, format_string = "%.3f", ImGui.SliderFlags = 0])

value, is_changed = ImGui:vFilledSliderInt(label, mirror_flag, w, h, value, min, max
	[, format_string = "%d", ImGui.SliderFlags = 0])

Widgets: Input with Keyboard

text, flag = ImGui:inputText(label, text, buffer_size [, ImGui.InputTextFlags = 0])
text, flag = ImGui:inputTextMultiline(label, text, buffer_size [, w = 0, h = 0, ImGui.InputTextFlags = 0])
text, flag = ImGui:inputTextWithHint(label, text, hint, buffer_size [, ImGui.InputTextFlags = 0])
value,  flag = ImGui:inputFloat(label, value [, step = 0, step_fast = 0, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, flag = ImGui:inputFloat2(label, value1, value2 [, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, value3, flag = ImGui:inputFloat3(label, value1, value2, value3 [, format = "%.3f", ImGui.InputTextFlags = 0])
value1, value2, value3, value4, flag = ImGui:inputFloat4(label, value1, value2, value3, value4 [, format = "%.3f", ImGui.InputTextFlags = 0])
-- table must be an array of any size > 0
flag = ImGui:inputFloatT(label, table [, format = "%.3f", ImGui.InputTextFlags = 0])
value,  flag = ImGui:inputInt(label, value [, step = 0, step_fast = 0, ImGui.InputTextFlags = 0])
value1, value2, flag = ImGui:inputInt2(label, value1, value2 [, ImGui.InputTextFlags = 0])
value1, value2, value3, flag = ImGui:inputInt3(label, value1, value2, value3 [, ImGui.InputTextFlags = 0])
value1, value2, value3, value4, flag = ImGui:inputInt4(label, value1, value2, value3, value4 [, ImGui.InputTextFlags = 0])
-- table must be an array of any size > 0
flag = ImGui:inputIntT(label, table [, format = "%d", ImGui.InputTextFlags = 0])
value, flag = ImGui:inputDouble(label, value [, step = 0, step_fast = 0, format = "%.6f", ImGui.InputTextFlags = 0])

Input text callbacks:

ImGui:inputText(label, text, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])
ImGui:inputTextMultiline(label, text, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])
ImGui:inputTextWithHint(label, text, hint, buffer_size [, ImGui.InputTextFlags = 0, callback_function, user_data])

callback_function = function(callback_data, user_data)
	-- do something with data
	-- see below
end

callback_data:

ImGuiInputTextFlags = callback_data:getEventFlag()
ImGuiInputTextFlags = callback_data:getFlags()

number = callback_data:getEventChar()

callback_data:setEventChar(number)

keyCode = callback_data:getEventKey()

string = callback_data:getBuf()

callback_data:setBuf(string)

number = callback_data:getBufTextLen()

callback_data:setBufTextLen(number)

number = callback_data:getBufSize()

callback_data:setBufDirty(bool)
bool = callback_data:isBufDirty()

callback_data:setCursorPos(number)
number = callback_data:getCursorPos()

callback_data:setSelectionStart(s_start)
number = callback_data:getSelectionStart()

callback_data:setSelectionEnd(s_end)
s_end = callback_data:getSelectionEnd()

callback_data:setSelection(s_start, s_end)
s_start, s_end = callback_data:getSelection()

callback_data:selectAll()
callback_data:clearSelection()
bool = callback_data:hasSelection()

callback_data:deleteChars(position, bytesCount)
callback_data:insertChars(position, text)

Example:

require "ImGui"

ui = ImGui.new()
stage:addChild(ui)

local testMessage1 = ""
local testMessage2 = ""
local testMessage3 = ""

-- Add ".." at the end of current input string
function myCallback1(data)
	data:insertChars(data:getCursorPos(), "..")
end

-- Replace all chars if UP/DOWN arrow is pressed
function myCallback2(data)
	local key = data:getEventKey()
	if (key == key_code.UP) then
		data:deleteChars(0, data:getBufTextLen())
		data:insertChars(0, "Pressed Up!")
		data:selectAll()
	elseif (key == key_code.DOWN) then
		data:deleteChars(0, data:getBufTextLen())
		data:insertChars(0, "Pressed Down!")
		data:selectAll()
	end
end

-- Switch case of the first char
function myCallback3(data)
	local buf = data:getBuf()
	local s = buf:sub(1,1)
	if ((s >= 'a' and s <= 'z') or (s >= 'A' and s <= 'Z')) then 
		local first = string.char(string.byte(s) ~ 32)
		data:setBuf(first .. buf:sub(2))
		data:setBufDirty(true)
	end
end

function enterFrame(e)
	ui:newFrame(e.deltaTime)
	
	testMessage1 = ui:inputText(
		"Label1", 
		testMessage1, 
		64, 
		ImGui.InputTextFlags_CallbackCompletion, 
		myCallback1
	)
	testMessage2 = ui:inputText(
		"Label2", 
		testMessage2, 
		64, 
		ImGui.InputTextFlags_CallbackHistory, 
		myCallback2
	)
	testMessage3 = ui:inputText(
		"Label3", 
		testMessage3, 
		64, 
		ImGui.InputTextFlags_CallbackEdit, 
		myCallback3
	)
	
	ui:render()
	ui:endFrame()
end

stage:addEventListener("enterFrame", enterFrame)

Widgets: Color Editor/Picker

hexColor, is_touching = ImGui:colorEdit3(label, color [, ImGui.ColorEditFlags = 0]) -- alpha ignored, no need to pass it!
hexColor, alpha, is_touching = ImGui:colorEdit4(label, color [, alpha = 1, ImGui.ColorEditFlags = 0])
hexColor, is_touching = ImGui:colorPicker3(label, color [, ImGui.ColorEditFlags = 0])
hexColor, alpha, originalColor, originalAlpha, is_touching = ImGui:colorPicker4(label, color
	[, alpha = 1, original_color = 0xffffff, original_alpha = 1, ImGui.ColorEditFlags = 0])
isHoveringFlag = ImGui:colorButton(string_ID, color [, alpha = 1, ImGui.ColorEditFlags = 0, w = 0, h = 0])
ImGui:setColorEditOptions(ImGui.ColorEditFlags)

Widgets: Trees

is_openFlag = ImGui:treeNode(label [, format_string])
ImGui:treeNodeEx(label, ImGui.TreeNodeFlags [, format_string])
ImGui:treePush(str_id)
ImGui:treePop()
number = ImGui:getTreeNodeToLabelSpacing()
is_openFlag, p_open = ImGui:collapsingHeader(label, p_open [, ImGui.TreeNodeFlags = 0])
is_openFlag = ImGui:collapsingHeader(label [, ImGui.TreeNodeFlags = 0])
ImGui:setNextItemOpen(is_open, ImGui.Cond)

Widgets: Selectables

result?, selected = ImGui:selectable(label, selected [, ImGui.SelectableFlags = 0, w = 0, h = 0])

Widgets: List Boxes

-- item_table: {"Item0", "Item1", ...}
current_item, is_openFlag = ImGui:listBox(label, current_item, item_table [, max_visible_items = -1])
result? = ImGui:listBoxHeader(label [, w = 0, h = 0])
result? = ImGui:listBoxHeader2(label, items_count)
ImGui:listBoxFooter()

Widgets: Data Plotting

Caching:

If you have big array of points it is better to cache it instead of translating lua table to C++ vector every time you call `ImGui:plotLines()`. But in this case you need to manage memory by yourself (free points pointer when you dont need it).

-- store points in memory
-- points_table: {0.01, 0.5, 10, -50, ...}
-- ptr: c++ pointer to a given vector
ptr = ImGui.cachePoints(points_table)

-- delete points from memory
ImGui.freePoints(ptr)

Plot functions:

-- len (number): points array length
ImGui:plotCachedLines(label, ptr, len,
	[, values_offset = 0, overlay_text = nil,
	scale_min = math.huge, scale_max = math.huge,
	w = 0, h = 0])

ImGui:plotCachedHistogram(label, ptr, len,
	[, values_offset = 0, overlay_text = nil,
	scale_min = math.huge, scale_max = math.huge,
	w = 0, h = 0])

ImGui:plotLines(label, points_table
	[, values_offset = 0, overlay_text = nil,
	scale_min = math.huge, scale_max = math.huge,
	w = 0, h = 0])

ImGui:plotHistogram(label, points_table
	[, values_offset = 0, overlay_text = nil,
	scale_min = math.huge, scale_max = math.huge,
	w = 0, h = 0])

Example:

-- delete ptr if it exist
function deletePtr()
	if pointsPtr then
		ImGui.freePoints(pointsPtr)
	end
end

function onEnterFrame()
	ui:newFrame(e.deltaTime)
	
	if ui:button("Generate") then
		deletePtr()
		points = generatePoints() -- returns big array
		pointsPtr = ImGui.cachePoints(points)
	end
	
	if pointsPtr then
		ui:plotCachedLines("Big data", pointsPtr, #points)
	end
	
	ui:render()
	ui:endFrame()
end

-- do not forget to clear memory when app is closing
function onAppExit()
	deletePtr()
end

Widgets: Value() Helpers

ImGui:value(prefix, bool)
ImGui:value(prefix, number)
ImGui:value(prefix, float, format_string)

Widgets: Menus

result? = ImGui:beginMenuBar()
ImGui:endMenuBar()
result? = ImGui:beginMainMenuBar()
ImGui:endMainMenuBar()
result = ImGui:beginMenu(label [, enabled = true])
result = ImGui:beginMenuEx(label, [icon = "", enabled = true])
ImGui:endMenu()
result = ImGui:menuItem(label [, shortcut = "", selected = false, enabled = true])
result = ImGui:menuItemEx(label, [icon = "", shortcut = "", selected = false, enabled = true])

Widgets: Tooltips

Tooltip are windows following the mouse which do not take focus away.

ImGui:beginTooltip()
ImGui:endTooltip()
ImGui:setTooltip(text)

Disabled groups

ImGui:beginDisabled(disabledFlag)
ImGui:endDisabled()

Popups, Modals

The properties of popups windows are: - They block normal mouse hovering detection outside them. (*1) - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE. Because hovering detection is disabled outside the popup, when clicking outside the click will not be seen by underlying widgets! (*1)

  • Their visibility state (~bool) is held internally by Dear ImGui instead of being held by the programmer as we are used to with regular Begin() calls. User can manipulate the visibility state by calling OpenPopup(), CloseCurrentPopup() etc.
  • We default to use the right mouse (ImGuiMouseButton_Right=1) for the Popup Context functions.
  • Those three properties are connected: we need to retain popup visibility state in the library because popups may be closed as any time.

(1.) You can bypass that restriction and detect hovering even when normally blocked by a popup. To do this use the ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered(). This is what BeginPopupContextItem() and BeginPopupContextWindow() are doing already, allowing a right-click to reopen another popups without losing the click.

result? = ImGui:beginPopup(str_id [, ImGui.WindowFlags = 0])
p_open, result? = ImGui:beginPopupModal(str_id, p_open [, ImGui.WindowFlags = 0])
ImGui:endPopup()
ImGui:openPopup(str_id [, ImGui.PopupFlags = 0])
ImGui:openPopupOnItemClick(str_id [, ImGui.PopupFlags = 0])
ImGui:closeCurrentPopup()
result? = ImGui:beginPopupContextItem(str_id [, ImGui.PopupFlags = 0])
result? = ImGui:beginPopupContextWindow(str_id [, ImGui.PopupFlags = 0])
result? = ImGui:beginPopupContextVoid(str_id [, ImGui.PopupFlags = 0])
result? = ImGui:isPopupOpen(str_id [, ImGui.PopupFlags = 0])

Columns

  • You can also use SameLine(pos_x) to mimic simplified columns.
  • The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!)
  • There is a maximum of 64 columns.
  • Currently working on new 'Tables' api which will replace columns around Q2 2020 (see GitHub #2957).
ImGui:columns([count = 1, id = nil, border = true])
ImGui:nextColumn()
index = ImGui:getColumnIndex()
width = ImGui:getColumnWidth([column_index = -1])
ImGui:setColumnWidth(column_index, width)
offset = ImGui:getColumnOffset([column_index = -1])
ImGui:setColumnOffset(column_index, offset)
number = ImGui:getColumnsCount()

Tab Bars, Tabs

bool = ImGui:beginTabBar(str_id [, ImGui.TabBarFlags = 0])
ImGui:endTabBar()
p_open, bool = ImGui:beginTabItem(label, p_open [, ImGui.TabItemFlags = 0])
ImGui:endTabItem()
ImGui:setTabItemClosed(tab_or_docked_window_label)
ImGui:tabItemButton(label [, ImGui.TabItemFlags = 0])

Logging/Capture

All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging.

ImGui:logToTTY(auto_open_depth = -1) 
ImGui:logToFile(auto_open_depth = -1, filename = nil) 
ImGui:logToClipboard(auto_open_depth = -1) 
ImGui:logFinish() 
ImGui:logButtons() 
ImGui:logText(text)

Drag and drop

flag = ImGui:beginDragDropSource([ImGui.DragDropFlags flags = 0])
flag = ImGui:setNumDragDropPayload(str_type, number [, ImGui.Cond cond = 0])
flag = ImGui:setStrDragDropPayload(str_type, string [, ImGui.Cond cond = 0])
ImGui:endDragDropSource()
flag = ImGui:beginDragDropTarget()
ImGuiPayload = ImGui:acceptDragDropPayload(type [, ImGui.DragDropFlags flags = 0])
ImGui:endDragDropTarget()
ImGuiPayload = ImGui:getDragDropPayload()

Payload:

number = ImGuiPayload:getNumData()
string = ImGuiPayload:getStrData()
ImGuiPayload:clear()
number = ImGuiPayload:getDataSize()
flag = ImGuiPayload:isDataType(type) -- type must be the same as in "ImGui:acceptDragDropPayload(type)"
flag = ImGuiPayload:isPreview()
flag = ImGuiPayload:isDelivery()

Usage example:

require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)

local names = {
	"Bobby", "Beatrice", "Betty",
	"Brianna", "Barry", "Bernard",
	"Bibi", "Blaine", "Bryn"
}
-- modes:
local Mode_Copy = 0
local Mode_Move = 1
local Mode_Swap = 2
 
local mode = 0 -- current mode

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)
 
	if (imgui:radioButton("Copy", mode == Mode_Copy)) then mode = Mode_Copy end imgui:sameLine()
	if (imgui:radioButton("Move", mode == Mode_Move)) then mode = Mode_Move end imgui:sameLine()
	if (imgui:radioButton("Swap", mode == Mode_Swap)) then mode = Mode_Swap end
 
	for i,v in ipairs(names) do
		imgui:pushID(i)
		if (((i-1) % 3) ~= 0) then imgui:sameLine() end
 
		imgui:button(v, 60, 60)
 
		if (imgui:beginDragDropSource(ImGui.DragDropFlags_None)) then
			--imgui:setStrDragDropPayload("DND_DEMO_CELL", "ID_"..i) -- used for strings
			imgui:setNumDragDropPayload("DND_DEMO_CELL", i) -- used for numbers
 
			if (mode == Mode_Copy) then imgui:text(("Copy %s"):format(v)) end
			if (mode == Mode_Move) then imgui:text(("Move %s"):format(v)) end
			if (mode == Mode_Swap) then imgui:text(("Swap %s"):format(v)) end
			imgui:endDragDropSource()
		end
 
		if (imgui:beginDragDropTarget()) then
			local payload = imgui:acceptDragDropPayload("DND_DEMO_CELL")
			if (payload) then
				--local payload_n = tonumber(payload:getStrData():sub(4))  -- if "setStrDragDropPayload" was used
				local payload_n = payload:getNumData() -- if "setNumDragDropPayload" was used
 
				if (mode == Mode_Copy) then
					names[i] = names[payload_n];
				end
				if (mode == Mode_Move) then
					names[i] = names[payload_n];
					names[payload_n] = "";
				end
 
				if (mode == Mode_Swap) then
					names[i], names[payload_n] = names[payload_n], names[i]
				end
			end
			imgui:endDragDropTarget()
		end
		imgui:popID()
	end
	imgui:render()
	imgui:endFrame()
end

stage:addEventListener("enterFrame", onEnterFrame)

Clipping

ImGui:pushClipRect(min_x, min_y, max_x, max_y, intersect_with_current_clip_rect)
ImGui:popClipRect()

ImGuiListClipper

Try to avoid creating new instances in "enterFrame" event.

Constructor:

instance = ImGuiListClipper.new()

Methods:

ImGuiListClipper:beginClip(number_of_items [, item_height = -1]) -- if item_height <= 0 then it is calculated automatically
ImGuiListClipper:endClip()
bool = ImGuiListClipper:step()
number = ImGuiListClipper:getDisplayStart()
number = ImGuiListClipper:getDisplayEnd()
number = ImGuiListClipper:getStartPosY()
number = ImGuiListClipper:getItemsCount()
ImGuiListClipper:forceDisplayRangeByIndices(number_min, number_max)

Usage example:

require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)

clipper = ImGuiListClipper.new()

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)

	if (imgui:beginWindow("Clipper demo")) then
		if (imgui:beginTable("table", 3)) then
			imgui:tableSetupScrollFreeze(0, 1) -- cols, rows
			imgui:tableSetupColumn("One")
			imgui:tableSetupColumn("Two")
			imgui:tableSetupColumn("Three")
			imgui:tableHeadersRow()

			clipper:beginClip(100)
			while (clipper:step()) do
				for row = clipper:getDisplayStart(), clipper:getDisplayEnd() do
					imgui:tableNextRow()
					for column = 1, 3 do
						imgui:tableSetColumnIndex(column - 1)
						imgui:text(("col: %d; row: %d"):format(column, row))
					end
				end
			end
			clipper:endClip()

			imgui:endTable()
		end
	end
	imgui:endWindow()

	imgui:endFrame()
	imgui:render()
end

stage:addEventListener("enterFrame", onEnterFrame)

Context

string OR nil = ImGui:getHoveredWindow()
string OR nil = ImGui:getHoveredWindowRoot()
string OR nil = ImGui:getHoveredWindowUnderMovingWindow()
string OR nil = ImGui:getMovingWindow()
string OR nil = ImGui:getActiveIdWindow()
id = ImGui:getActiveId()
id = ImGui:getActiveIdPreviousFrame()
number = ImGui:getActiveIdTimer()
id = ImGui:getActiveIdAllowOverlap()
id = ImGui:getHoveredId()
id = ImGui:getHoveredIdPreviousFrame()
number = ImGui:getHoveredIdTimer()
id = ImGui:getHoveredIdAllowOverlap()
bool = ImGui:getDragDropActive()
id = ImGui:getDragDropPayloadSourceId()
string = ImGui:getDragDropPayloadDataType()
number = ImGui:getDragDropPayloadDataSize()

Focus, Activation

  • Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item"
  • Most of the functions are referring to the last/previous item we submitted.
  • See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions.
ImGui:setItemDefaultFocus()
ImGui:setKeyboardFocusHere([offset = 0])
flag = ImGui:isItemHovered([ImGui.HoveredFlags = 0])
flag = ImGui:isItemActive()
flag = ImGui:isItemFocused()
flag = ImGui:isItemClicked(mouse_button)
flag = ImGui:isItemVisible()
flag = ImGui:isItemEdited()
flag = ImGui:isItemActivated()
flag = ImGui:isItemDeactivated()
flag = ImGui:isItemDeactivatedAfterEdit()
flag = ImGui:isItemToggledOpen()
flag = ImGui:isAnyItemHovered()
flag = ImGui:isAnyItemActive()
flag = ImGui:isAnyItemFocused()
minX, minY, maxX, maxY = ImGui:getItemRect()
x, y = ImGui:getItemRectMin()
x, y = ImGui:getItemRectMax()
w, h = ImGui:getItemRectSize()
ImGui:setItemAllowOverlap()

INPUTS

ImGui:onMouseHover(event)
ImGui:onMouseMove(event)
ImGui:onMouseDown(event)
ImGui:onMouseUp(event)
ImGui:onMouseWheel(event)

ImGui:onTouchMove(event)
ImGui:onTouchBegin(event)
ImGui:onTouchEnd(event)
ImGui:onTouchCancel(event)

ImGui:onKeyUp(event)
ImGui:onKeyDown(event)
ImGui:onKeyChar(event)

Usage examples:

local UI = ImGui.new(nil, false, false, false)

Mouse

stage:addEventListener("mouseHover", function(e) UI:onMouseHover(e) end)
stage:addEventListener("mouseMove", function(e) UI:onMouseMove(e) end)
stage:addEventListener("mouseDown", function(e) UI:onMouseDown(e) end)
stage:addEventListener("mouseUp", function(e) UI:onMouseUp(e) end)
stage:addEventListener("mouseWheel", function(e) UI:onMouseWheel(e) end)

Touch

stage:addEventListener("touchesCancel", function(e) ui:onTouchCancel(e) end)
stage:addEventListener("touchesMove", function(e) ui:onTouchMove(e) end)
stage:addEventListener("touchesBegin", function(e) ui:onTouchBegin(e) end)
stage:addEventListener("touchesEnd", function(e) ui:onTouchEnd(e) end)

Keyboard

stage:addEventListener("keyUp", function(e) UI:onKeyUp(e) end)
stage:addEventListener("keyDown", function(e) UI:onKeyDown(e) end)
stage:addEventListener("keyChar", function(e) UI:onKeyChar(e) end)

Miscellaneous Utilities

flag = ImGui:isRectVisible(w, h [, max_x, max_y])
number = ImGui:getTime()
number = ImGui:getFrameCount()
str = ImGui:getStyleColorName(idx)
flag = ImGui:beginChildFrame(id, w, h [, ImGui.WindowFlags = 0]) -- id (number)
ImGui:endChildFrame()

Text Utilities

w, h = ImGui:calcTextSize(text [, hide_text_after_double_hash = false, wrap_width = -1])

Color convert

Note: use DOT instead of COLON, so you can use it without creating an ImGui object

r, g, b, a = ImGui.colorConvertHEXtoRGB(color [, alpha = 1])
hex = ImGui.colorConvertRGBtoHEX(r, g, b)
h, s, v = ImGui.colorConvertRGBtoHSV(r, g, b)
r, g, b = ImGui.colorConvertHSVtoRGB(h, s, v)
h, s, v = ImGui.colorConvertHEXtoHSV(hex)
hex = ImGui.colorConvertHSVtoHEX(h, s, v)

Inputs Utilities: Keyboard

  • For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[].
  • We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index.
string = ImGui:getKeyName(keyCode)
flag = ImGui:isKeyDown(keyCode)
flag = ImGui:isKeyPressed(keyCode [, repeat = true])
flag = ImGui:isKeyReleased(keyCode)
number = ImGui:getKeyPressedAmount(keyCode, repeat_delay, rate)
ImGui:setNextFrameWantCaptureKeyboard([want_capture_keyboard_value = true])

Shortcut system

-- (keyChord: an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values (ImGuiKey | ImGuiMod_XXX))
ImGui:shortcut(keyChord [, owner_id = 0, ImGui.InputFlags = 0])

-- (useful to disable CTRL + TAB combo: ImGui:setShortcutRouting(ImGui.Mod_Ctrl | ImGui.Key_Tab, ImGui.KeyOwner_None))
ImGui:setShortcutRouting(keyChord [, owner_id = 0, ImGui.InputFlags = 0])

ImGui:setItemKeyOwner(keyCode [, ImGui.InputFlags = 0])

ImGui:setKeyOwner(keyCode, owner_id, [, ImGui.InputFlags = 0])

Focused window and global application button shortcut example

require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)
imgui:setClassicStyle()

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)

	-- focused window button shortcut
	if imgui:button("PLAY##01", 32*2, 32*0.6) or imgui:shortcut(ImGui.Key_P) then
		print(ImGui:getItemID()) -- 2102678615
	end
	imgui:sameLine(32*2.5)
	-- focused window button shortcut (using item ID)
	if imgui:button("PLAY##02", 32*2, 32*0.6) or imgui:shortcut(ImGui.Key_Q, 8325, ImGui.FocusedFlags_AnyWindow) then
		print(ImGui:getItemID()) -- 8325
	end

	-- global app button shortcut
	if imgui:button("PLAY##03", 32*2, 32*0.6) or imgui:isKeyPressed(KeyCode.C) then
		print(ImGui:getItemID()) -- 1157645807
	end

	imgui:render()
	imgui:endFrame()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)

Global application checkbox shortcut example

require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)
imgui:setClassicStyle()

-- some vars
local islooping = false

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)
	local ischanged = false

	islooping, ischanged = imgui:checkbox("looping(L)", islooping)
	if imgui:isKeyPressed(KeyCode.L) then
		islooping = not islooping
		ischanged = true
	end
	if ischanged then
		print("islooping", islooping)
	end

	imgui:render()
	imgui:endFrame()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)

Inputs Utilities: Mouse

  • To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
  • You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
  • Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
-- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseDown(mouse_button)
flag = ImGui:isMouseClicked(mouse_button [, repeat = false]) -- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseReleased(mouse_button) -- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseDoubleClicked(mouse_button) -- "mouse_button" is any gideros mouse button code
flag = ImGui:isMouseHoveringRect(min_x, min_y, max_x, max_y [, clip = true])
flag = ImGui:isMousePosValid([x = inf, y = inf])
flag = ImGui:isAnyMouseDown()
x, y = ImGui:getMousePos()
x, y = ImGui:getMousePosOnOpeningCurrentPopup()
flag = ImGui:isMouseDragging(mouse_button [, lock_threshold = -1]) -- "mouse_button" is any gideros mouse button code
x, y = ImGui:getMouseDragDelta(mouse_button [, lock_threshold = -1]) -- "mouse_button" is any gideros mouse button code
ImGui:resetMouseDragDelta(mouse_button) -- "mouse_button" is any gideros mouse button code
ImGuiMouseCursor = ImGui:getMouseCursor()
ImGui:setMouseCursor(ImGui.MouseCursor)
ImGui:setNextFrameWantCaptureMouse([want_capture_mouse_value = true])
ImGui:setNextFrameWantCaptureKeyboard([want_capture_keyboard_value = true])
ImGui:updateCursor()

FONTS

IO = imgui:getIO()
FontAtlas = IO:getFonts()

Font = FontAtlas:addFont(ttf_font_path, font_size [, options])

-- options (table): all parameters are optional
--	    fontDataOwnedByAtlas - bool
--	    pixelSnapH - bool
--	    mergeMode - bool
--	    fontNo - number
--	    oversampleH - number
--	    oversampleV - number
--	    glyphExtraSpacingX - number
--	    glyphExtraSpacingY - number
--	    glyphOffsetX - number
--	    glyphOffsetY - number
--	    glyphMinAdvanceX - number
--	    glyphMaxAdvanceX - number
--	    rasterizerFlags - number
--	    rasterizerMultiply - number
--	
--	    glyphs - table:
--		    text(string): represents available chars
--		    chars(table): list of specific char code (example: {0x7262, ...})
--		    ranges(table): predefined glyph ranges (example: {ImGui.GlyphRanges_Default, ImGui.GlyphRanges_Japanese, ...})
FontAtlas:addFonts(fontsDescription)
-- fontsDescriptions(table):
--      description(table):
--          ttf_font_path(string): path to a font
--          font_size(number): font size
--          options(table): see description above
-- example:
-- FontAtlas:addFonts{ {"fonts/DroidSans.ttf", 16}, {"fonts/ProggyTiny.ttf", 16} }

Font = FontAtlas:getFont([index]) -- get font by index (if index is 0 or nil you will get default font instance)
FontAtlas:build() -- call after multiple FontAtlas:addFont(...) calls to update ImGui font atlas 
FontAtlas:clearInputData()
FontAtlas:clearTexData()
FontAtlas:clearFonts()
FontAtlas:clear()
table = FontAtlas:getFonts() -- returns a table with all fonts (included default)
flag = FontAtlas:isBuilt()
number = FontAtlas:addCustomRectRegular(width, height)
number = FontAtlas:addCustomRectFontGlyph(font, id, width, height, advance_x [, offset_x, offset_y])
w, h, x, y, glyph_id, offset_x, offset_y, font, is_packed_flag = FontAtlas:getCustomRectByIndex(index)

ImGui:pushFont(font) -- font (table): object returned by FontAtlas:addFont(...) or FontAtlas:getFont([index])
ImGui:popFont()

Minimal example:

local UI = ImGui.new()
local IO = UI:getIO()
local FontAtlas = IO:getFonts()
local VDS_font = FontAtlas:addFont("fonts/VDS.ttf", 16, {
    oversampleH = 2,
    oversampleV = 2,
	glyphs = {
		ranges = {ImGui.GlyphRanges_Cyrillic}
	}
})
IO:setFontDefault(VDS_font)
FontAtlas:build()
stage:addChild(UI)

-- you can use multiple fonts at the same time
function enterFrame(e)
	UI:newFrame(e.deltaTime)
	
	UI:pushFont(font1)
	UI:text("Font1")
	UI:popFont()
	
	UI:pushFont(font2)
	UI:text("Font2")
	UI:popFont()
	
	UI:render()
	UI:endFrame()
end

Glyphs example:

local fonts = io:getFonts()
fonts:addFont(font_path, font_size, {
	glyphs = {
		ranges = {
			{
				0x2590,0x2593, -- range1
				0x2660,0x266B  -- range2
				-- ...
			},
			ImGui.GlyphRanges_Cyrillic,
			{
				0x01C0, 0x01C3 -- range3
			},
			ImGui.GlyphRanges_Korean
		},
 
		-- same structure:
		ranges = {
			{
				0x2590,0x2593, -- range1
				0x2660,0x266B, -- range2
				0x01C0,0x01C3  -- range3
				-- ...
			}, 
			ImGui.GlyphRanges_Cyrillic, 
			ImGui.GlyphRanges_Korean
		}
	},
	mergeMode = true, -- merge into previous font
})
fonts:build()

Icons example:

local icon = utf8.char(0x2590)
ImGui:text("My icon >>" .. icon .. " << !!!")

-- or with new Luau support:
ImGui:text("My icon >> \u{2590} << !!!")
-- can be also stored in memory:
local icon = "\u{2590}"

Font

number = Font:getSize()
FontAtlas = Font:getContainerAtlas()
Font:setScale(number)
number = Font:getScale()
number = Font:getAscent()
number = Font:getDescent()
bool = Font:isLoaded()
string = Font:getDebugName()
w, h = Font:calcTextSizeA(size, max_width, wrap_width, string)
Font:calcWordWrapPositionA(scale, string, wrap_width) -- not tested

Tables

flag = ImGui:beginTable(str_id, column [, ImGui.TableFlags = 0, outer_w = 0, outer_h = 0, inner_width = 0])
ImGui:endTable()
ImGui:tableNextRow([ImGui.TableRowFlags = 0, min_row_height = 0])
flag = ImGui:tableNextColumn()
flag = ImGui:tableSetColumnIndex(column_n)
ImGui:tableSetupColumn(label [, ImGui.TableColumnFlags = 0, init_width_or_weight = 0, user_id = 0])
ImGui:tableSetupScrollFreeze(cols, rows)
ImGui:tableHeadersRow()
TableSortSpecs = ImGui:tableGetSortSpecs() -- see below
number = ImGui:tableGetColumnCount()
number = ImGui:tableGetColumnIndex()
number = ImGui:tableGetRowIndex()
string = ImGui:tableGetColumnName([column_n = -1])
ImGuiTableColumnFlags = ImGui:tableGetColumnFlags([column_n = -1])
ImGui:tableSetBgColor(ImGui.TableBgTarget, color [, alpha = 1, column_n = -1])

Table sort specs

number = TableSortSpecs:getSpecsCount() -- TableSortSpecs = ImGui:tableGetSortSpecs()
flag = TableSortSpecs:isSpecsDirty() -- TableSortSpecs = ImGui:tableGetSortSpecs()
TableSortSpecs:setSpecsDirty(flag) -- TableSortSpecs = ImGui:tableGetSortSpecs()
table = TableSortSpecs:getColumnSortSpecs() -- TableSortSpecs = ImGui:tableGetSortSpecs(), see below

Table column sort specs

-- table = TableSortSpecs:getColumnSortSpecs()
-- each value of this table is an object that have these functions:
number = item:getColumnUserID() 
number = item:getColumnIndex() -- 0 based
number = item:getSortOrder() -- used in multi sorted tables
number = item:getSortDirection() -- ImGui.SortDirection_Ascending OR ImGui.SortDirection_Descending

Example: https://github.com/MultiPain/Gideros_examples/blob/master/ImGuiTablesDemo/assets/TablesDemo.lua

ImGuiTextFilter

Try to avoid creating new instaces in "enterFrame" event.

Constructor:

filter = ImGuiTextFilter.new()

Methods:

-- draws the input field
isValueChanged = filter:draw(label [, width = 0])
-- draws the input field (using ImGui:inutTextWithHint())
isValueChanged = filter:drawWithHint(label, hint [, width = 0])

filter:setBuffer(text) -- set filter text
filter:build() -- update filter internals (see example below)
bool = filter:passFilter(text) -- returns true if filter input matches with "text"

Usage example 1:

require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)

local filter = ImGuiTextFilter.new()
local items = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)

	if (imgui:beginWindow("Filter demo")) then
		imgui:text([[
Filter usage:
	""         display all lines
	"xxx"      display lines containing "xxx"
	"xxx,yyy"  display lines containing "xxx" or "yyy"
	"-xxx"     hide lines containing "xxx"
		]])

		filter:draw("Filter")

		for i, text in ipairs(items) do
			if filter:passFilter(text) then
				imgui:bulletText(text)
			end
		end
	end
	imgui:endWindow()

	imgui:endFrame()
	imgui:render()
end

stage:addEventListener("enterFrame", onEnterFrame)

Usage example 2:

require "ImGui"

local imgui = ImGui.new()
stage:addChild(imgui)

local filter = ImGuiTextFilter.new()
local searchText = ""
local items = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)

	-- draw standart text input control
--	filter:drawWithHint("Filter", "Search")
	-- draw custom control
	local ischanged = false
	searchText, ischanged = imgui:inputText("Filter", searchText, 256, ImGui.InputTextFlags_EnterReturnsTrue)
	if ischanged then
		filter:setBuffer(searchText)
		-- try to avoid calling "build" function every frame
		filter:build()
	end

	for i, item in ipairs(items) do
		if not filter:passFilter(item) then
			continue
		end
		imgui:bulletText(item)
	end

	imgui:endFrame()
	imgui:render()
end

stage:addEventListener("enterFrame", onEnterFrame)

TextEditor

-- otherTextEditor: another "ImGuiTextEditor" instance to copy setting
TextEditor = ImGuiTextEditor.new([other_text_editor])

Functions:

LanguageDefinition = TextEditor:getLanguageCPP()
LanguageDefinition = TextEditor:getLanguageGLSL()
LanguageDefinition = TextEditor:getLanguageHLSL()
LanguageDefinition = TextEditor:getLanguageC()
LanguageDefinition = TextEditor:getLanguageSQL()
LanguageDefinition = TextEditor:getLanguageAngelScript()
LanguageDefinition = TextEditor:getLanguageLua()

TextEditor:setLanguageDefinition(LanguageDefinition)
LanguageDefinition = TextEditor:getLanguageDefinition()

Palette = TextEditor:getPaletteDark()
Palette = TextEditor:getPaletteLight()
Palette = TextEditor:getPaletteRetro()

TextEditor:setPalette(Palette)
Palette = TextEditor:getPalette()

TextEditor:setPaletteColor(TE_ColorIndex, color [, alpha = 1]) -- see TextEditor enums below
color, alpha = TextEditor:getPaletteColor(TE_ColorIndex)

TextEditor:loadPalette(table) -- 42 elements table
-- example:
--[[ dark palete:
TextEditor:loadPalette{
	0x7f7f7f, 1,	-- Default
	0xd69c56, 1,	-- Keyword
	0x00ff00, 1,	-- Number
	0x7070e0, 1,	-- String
	0x70a0e0, 1,	-- Char literal
	0xffffff, 1,	-- Punctuation
	0x408080, 1,	-- Preprocessor
	0xaaaaaa, 1,	-- Identifier
	0x9bc64d, 1,	-- Known identifier
	0xc040a0, 1,	-- Preproc identifier
	0x206020, 1,	-- Comment (single line)
	0x406020, 1,	-- Comment (multi line)
	0x101010, 1,	-- Background
	0xe0e0e0, 1,	-- Cursor
	0xa06020, 0.5,	-- Selection
	0x0020ff, 0.5,	-- ErrorMarker
	0xf08000, 0.25, -- Breakpoint
	0x707000, 1,	-- Line number
	0x000000, 0.25, -- Current line fill
	0x808080, 0.25, -- Current line fill (inactive)
	0xa0a0a0, 0.25, -- Current line edge
}
]]

-- see below
TextEditor:setErrorMarkers(error_markers)
TextEditor:setBreakpoints(breakpoints)

TextEditor:render(string_id [, w = 0, h = 0, border = 0])

TextEditor:setText(string)
TextEditor:getText()
TextEditor:setTextLines(table) -- set editor text using table. Structure: {"line 1", "line 2", "line 3", ...}
table = TextEditor:getTextLines()

string = TextEditor:getSelectedText()
string = TextEditor:getCurrentLineText()

number = TextEditor:getTotalLines()
bool = TextEditor:isOverwrite()

bool = TextEditor:setReadOnly()
bool = TextEditor:isReadOnly()
bool = TextEditor:isTextChanged()
bool = TextEditor:isCursorPositionChanged()

TextEditor:setColorizerEnable()
bool = TextEditor:isColorizerEnabled()

line, column = TextEditor:getCursorPosition() -- 0 based line & column number 
TextEditor:setCursorPosition(line, column)

TextEditor:setHandleMouseInputs(bool)
bool = TextEditor:isHandleMouseInputsEnabled()

TextEditor:setHandleKeyboardInputs(bool)
bool = TextEditor:isHandleKeyboardInputsEnabled()

TextEditor:setTextEditorChildIgnored(bool)
bool = TextEditor:isTextEditorChildIgnored()

TextEditor:setShowWhitespaces(bool)
bool = TextEditor:isShowingWhitespaces()

TextEditor:setTabSize(size)
size = TextEditor:getTabSize()

TextEditor:insertText(string)

TextEditor:moveUp([amount = 1, select = false])
TextEditor:moveDown([amount = 1, select = false])
TextEditor:moveLeft([amount = 1, select = false])
TextEditor:moveRight([amount = 1, select = false])
TextEditor:moveTop([select = false])
TextEditor:moveBottom([select = false])
TextEditor:moveHome([select = false])
TextEditor:moveEnd([select = false])

TextEditor:setSelectionStart(line, column)
TextEditor:setSelectionEnd(line, column)
TextEditor:setSelection(start_line, start_column, end_line, end_column)
TextEditor:selectWordUnderCursor()
TextEditor:selectAll()
bool = TextEditor:hasSelection()

TextEditor:copy()
TextEditor:cut()
TextEditor:paste()
TextEditor:delete()

bool = TextEditor:canUndo()
bool = TextEditor:canRedo()
TextEditor:undo()
TextEditor:redo()

LanguageDefinition

string = LanguageDefinition:getName()

ErrorMarkers

ErrorMarkers = ImGuiErrorMarkers.new()

ErrorMarkers:add(line, message)
ErrorMarkers:remove(line)
message = ErrorMarkers:get(line)
number = ErrorMarkers:getSize()

Breakpoints

Breakpoints = ImGuiBreakpoints.new()

Breakpoints:add(line)
Breakpoints:remove(line)
bool = Breakpoints:get(line)
number = Breakpoints:getSize()

DRAW LISTS

Window draw list:

local list = ImGui:getWindowDrawList()

Background draw list:

local list = ImGui:getBackgroundDrawList()

Foreground draw list:

local list = ImGui:getForegroundDrawList()

Draw lists commands:

DrawList:pushClipRect(clip_rect_min_x, clip_rect_min_y, clip_rect_max_x, clip_rect_max_y [, intersect_with_current_clip_rect = false])
DrawList:pushClipRectFullScreen()
DrawList:popClipRect()
DrawList:pushTextureID(texture)
DrawList:popTextureID()
x, y = DrawList:getClipRectMin()
x, y = DrawList:getClipRectMax()
DrawList:addLine(p1_x, p1_y, p2_x, p2_y, color [, alpha = 1, thickness = 1])
DrawList:addRect(
	p_min_x, p_min_y, 
	p_max_x, p_max_y, 
	color 
	[, alpha = 1, 
	rounding = 0, rounding_corners = ImGui.DrawFlags_RoundCornersAll, 
	thickness = 1])
DrawList:addRectFilled(p_min_x, p_min_y, p_max_x, p_max_y, color [, alpha = 1, rounding = 0, rounding_corners = ImGui.DrawFlags_RoundCornersAll])
DrawList:addRectFilledMultiColor(p_min_x, p_min_y, p_max_x, p_max_y, color_upr_left, color_upr_right, color_bot_right, color_bot_left)
DrawList:addQuad(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, color [, alpha = 1, thickness = 1])
DrawList:addQuadFilled(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, color)
DrawList:addTriangle(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, color [, alpha = 1, thickness = 1])
DrawList:addTriangleFilled(p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, color)
DrawList:addCircle(center_x, center_y, radius, color [, alpha = 1, num_segments = 12, thickness = 1])
DrawList:addCircleFilled(center_x, center_y, radius, color [, alpha = 1, num_segments = 12])
DrawList:addNgon(center_x, center_y, radius, color [, alpha = 1, num_segments = 12, thickness = 1])
DrawList:addNgonFilled(center_x, center_y, radius, color [, alpha = 1, num_segments = 12])
DrawList:addText(x, y, color, alpha, text) -- x, y (number), text_begin (string), text_end (string)
DrawList:addFontText(font, font_size, 
	pos_x, pos_y, 
	color, alpha, 
	text 
	[, wrap_with = 0, 
	cpu_fine_clip_rect_x, cpu_fine_clip_rect_y, 
	cpu_fine_clip_rect_w, cpu_fine_clip_rect_h])
DrawList:addPolyline(points_table, color, alpha, closed, thickness) -- points_table (table), color (number), closed (bool), thickness (number)
DrawList:addConvexPolyFilled(points_table, color) -- points_table (table), color (number)
DrawList:addBezierCubic(
	p1_x, p1_y, 
	p2_x, p2_y, 
	p3_x, p3_y, 
	p4_x, p4_y, 
	color, alpha, thickness [, num_segments = 0])
DrawList:addBezierQuadratic(
	p1_x, p1_y, 
	p2_x, p2_y, 
	p3_x, p3_y, 
	color, alpha, thickness [, num_segments = 0])
DrawList:addImage(texture, 
	x, y, 
	x + w, y + h 
	[, tint_color = 0xffffff, tint_alpha = 1]) 
DrawList:addImageUV(texture, 
	x, y, 
	x + w, y + h, 
	uv0x, uv0y, 
	uv1x, uv1y 
	[, tint_color = 0xffffff, tint_alpha = 1]) 
DrawList:addImageQuad(texture, 
	x, y, 
	x + w, y, 
	x + w, y + h, 
	x, y + h 
	[, tint_color = 0xffffff, tint_alpha = 1, 
	uv0x = 0, uv0y = 0, 
	uv1x = 1, uv1y = 0, 
	uv2x = 1, uv2y = 1, 
	uv3x = 0, uv3y = 1])
DrawList:addImageRounded(texture, 
	x, y, 
	x + w, 
	y + h, 
	tint_color, tint_alpha, round_radius 
	[, corner_flags = ImGui.CorenerFlags_All])
DrawList:addImageRoundedUV(texture, 
	x, y, 
	x + w, y + h, 
	uv0x, uv0y, 
	uv1x, uv1y, 
	tint_color, tint_alpha, round_radius 
	[, corner_flags = ImGui.CorenerFlags_All])
DrawList:pathClear()
DrawList:pathLineTo(x, y)
DrawList:pathLineToMergeDuplicate(x, y)
DrawList:pathFillConvex(color)
DrawList:pathStroke(color, alpha, closed [, thickness = 1])
DrawList:pathArcTo(center_x, center_y, radius, a_min, a_max [, num_segments = 10])
DrawList:pathArcToFast(center_x, center_y, radius, a_min, a_max)
DrawList:pathBezierCubicCurveTo(p2x, p2y, p3x, p3y, p4x, p4y [, num_segments = 0])
DrawList:pathBezierQuadraticCurveTo(p2x, p2y, p3x, p3y [, num_segments = 0])
DrawList:pathRect(min_x, min_y, max_x, max_y [, rounding = 0, ImGui.DrawFlags = 0])
-- CUSTOM
-- rotate any draw list item around its center point
DrawList:rotateBegin()
DrawList:rotateEnd(radians)
-- example:
...
local list = ImGui:getWindowDrawList()
list:rotateBegin()
list:addLine(100, 100, 100, 250, 0xff0000, 1, 10)
list:rotateEnd(math.pi/2.2)
...

Usage example:

-- reference: https://github.com/ocornut/imgui/issues/3606#issuecomment-731726406
require "ImGui"

local imgui = ImGui.new()
local IO = imgui:getIO()
local w = 320
local h = 180
IO:setDisplaySize(w*2, h*2)
stage:addChild(imgui)

local cos,sin,sqrt = math.cos, math.sin, math.sqrt
local HSV2RGB = ImGui.colorConvertHSVtoRGB
local RGB2HEX = ImGui.colorConvertRGBtoHEX
local p = { -1,-1, 1,-1, 1,1, -1,1 }
local function conv(z, szx, szy, ox, oy, vx, vy) return ((vx/z)*szx*5+szx*0.5)+ox, ((vy/z)*szy*5+szy*0.5)+oy end
local function R(vx, vy, ng) ng*=0.1 local cosn = cos(ng) local sinn = sin(ng) return vx*cosn-vy*sinn, vx*sinn+vy*cosn end
local function FX(d, ax, ay, bx, by, sw, sh, t)
	d:addRectFilled(ax,ay,bx,by,0,1,0)
	t *= 4
	for i = 0, 19 do
		local z = 21-i-(t-(t//1))*2
		local ng, ot0, ot1 = -t*2.1+z, -t+z*0.2, -t+(z+1)*0.2
		local s, of, pts =
			{ cos((t+z)*0.1)*0.2+1, sin((t+z)*0.1)*0.2+1, cos((t+z+1)*0.1)*0.2+1, sin((t+z+1)*0.1)*0.2+1 },
			{ cos(ot0)*0.3, sin(ot0)*0.3, cos(ot1)*0.3, sin(ot1)*0.3 },
			{ }
		for j = 0, 7 do
			local m, n = ((j%4)+1)*2, j//4
			pts[j*2+1], pts[j*2+2] =
				conv( (z+n)*2, sw, sh, ax, ay, R(p[m-1]*s[n*2+1]+of[n*2+1], p[m-0]*s[n*2+2]+of[n*2+2], ng+n) )
		end
		for j = 0, 3 do
			local it = ( (((i&1) ~= 0) and 0.5 or 0.6) + j*0.05 ) * ( (21-z)/21 )
			d:addConvexPolyFilled(
				{
					pts[j*2+1], pts[j*2+2], pts[((j+1)%4)*2+1], pts[((j+1)%4)*2+2],
					pts[(((j+1)%4)+4)*2+1], pts[(((j+1)%4)+4)*2+2], pts[(j+4)*2+1],
					pts[(j+4)*2+2]
				},
				RGB2HEX(HSV2RGB(0.6+sin(t*0.03)*0.5, 1, sqrt(it)))
			)
		end
	end
end

function onEnterFrame(e)
	imgui:newFrame(e.deltaTime)
	if imgui:beginWindow("FX", nil, ImGui.WindowFlags_AlwaysAutoResize) then
		imgui:invisibleButton("canvas", w, h)
		local min_x, min_y = imgui:getItemRectMin()
		local max_x, max_y = imgui:getItemRectMax()
		local draw_list = imgui:getWindowDrawList()
		draw_list:pushClipRect(min_x, min_y, max_x, max_y)
		FX(draw_list, min_x, min_y, max_x, max_y, w, h, imgui:getTime())
		draw_list:popClipRect()
	end
	imgui:endWindow()
	imgui:render()
	imgui:endFrame()
end

stage:addEventListener("enterFrame", onEnterFrame)

EXPERIMENTAL

p_open = ImGui:showLog(title, p_open [, ImGui.WindowFlags = 0]) -- draw log window
ImGui:writeLog(text)

Gestures (touch only, turned OFF by default) WIP:

  • tap gesture (Left Mouse Button)
  • hold gesture (Right Mouse Button)
ImGui:setTouchGesturesEnabled(bool)
bool = ImGui:isTouchGesturesEnabled()


Dear ImGui