diff --git a/docs/lua/classes/raw_imgui_callback.md b/docs/lua/classes/raw_imgui_callback.md new file mode 100644 index 00000000..92dba91f --- /dev/null +++ b/docs/lua/classes/raw_imgui_callback.md @@ -0,0 +1,6 @@ +# Class: raw_imgui_callback + +## Inherit from 1 class: gui_element + +Class for representing a raw imgui callback. + diff --git a/docs/lua/classes/script_util.md b/docs/lua/classes/script_util.md index 841e2d24..9d9d47e1 100644 --- a/docs/lua/classes/script_util.md +++ b/docs/lua/classes/script_util.md @@ -8,7 +8,7 @@ Class for gta script utils, the instance is usually given to you. Yield execution. -**Exemple Usage:** +**Example Usage:** ```lua script_util:yield() ``` @@ -20,7 +20,7 @@ Sleep for the given amount of time, time is in milliseconds. - **Parameters:** - `ms` (integer): The amount of time in milliseconds that we will sleep for. -**Exemple Usage:** +**Example Usage:** ```lua script_util:sleep(ms) ``` diff --git a/docs/lua/classes/tab.md b/docs/lua/classes/tab.md index d0142a4c..be2af18f 100644 --- a/docs/lua/classes/tab.md +++ b/docs/lua/classes/tab.md @@ -2,7 +2,7 @@ Class for representing a tab within the GUI. -## Functions (10) +## Functions (11) ### `clear()` @@ -134,4 +134,30 @@ Add a ImGui::InputText. input_string = tab:add_input_string(name) ``` +### `add_imgui(imgui_rendering)` + +Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. +**Example Usage:** +```lua +tab:add_imgui(function() + if ImGui.Begin("My Custom Window") then + if ImGui.Button("Label") then + script.run_in_fiber(function(script) + -- call natives in there + end) + end + + ImGui.End() + end +end) +``` + +- **Parameters:** + - `imgui_rendering` (function): Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. + +**Example Usage:** +```lua +tab:add_imgui(imgui_rendering) +``` + diff --git a/docs/lua/commands.md b/docs/lua/commands.md index 3792e383..fa5ef8d0 100644 --- a/docs/lua/commands.md +++ b/docs/lua/commands.md @@ -766,7 +766,7 @@ Arg Count: 0 Arg Count: 0 ### alwaysfullammo - Refills your ammo every tick + Refills your ammo every tick Arg Count: 0 ### incrdamage diff --git a/docs/lua/tables/ImGui.md b/docs/lua/tables/ImGui.md new file mode 100644 index 00000000..82a1c58b --- /dev/null +++ b/docs/lua/tables/ImGui.md @@ -0,0 +1,1464 @@ +# Table: ImGui + +# Documentation +You can find all the supported functions and overloads below. + +## Windows +```lua + -- ImGui.Begin(...) + -- Parameters: text (name), bool (open) [O], ImGuiWindowFlags (flags) [O] + -- Returns A: bool (shouldDraw) + -- Returns B & C: bool (open), bool (shouldDraw) + -- Overloads + shouldDraw = ImGui.Begin("Name") + shouldDraw = ImGui.Begin("Name", ImGuiWindowFlags.NoMove) + open, shouldDraw = ImGui.Begin("Name", open) + open, shouldDraw = ImGui.Begin("Name", open, ImGuiWindowFlags.NoMove) + + -- ImGui.End() + ImGui.End() +``` + +## Child Windows +```lua + -- ImGui.BeginChild(...) + -- Parameters: text (name), float (size_x) [O], float (size_y) [O], bool (border) [O], ImGuiWindowFlags (flags) [O] + -- Returns: bool (shouldDraw) + -- Overloads + shouldDraw = ImGui.BeginChild("Name") + shouldDraw = ImGui.BeginChild("Name", 100) + shouldDraw = ImGui.BeginChild("Name", 100, 200) + shouldDraw = ImGui.BeginChild("Name", 100, 200, true) + shouldDraw = ImGui.BeginChild("Name", 100, 200, true, ImGuiWindowFlags.NoMove) + + -- ImGui.EndChild() + ImGui.EndChild() +``` + +## Windows Utilities +```lua + -- ImGui.IsWindowAppearing() + -- Returns: bool (appearing) + appearing = ImGui.IsWindowAppearing() + + -- ImGui.IsWindowCollapsed() + -- Returns: bool (collapsed) + collapsed = ImGui.IsWindowCollapsed() + + -- ImGui.IsWindowFocused(...) + -- Parameters: ImGuiFocusedFlags (flags) [O] + -- Returns: bool (focused) + -- Overloads + focused = ImGui.IsWindowFocused() + focused = ImGui.IsWindowFocused(ImGuiFocusedFlags.ChildWindows) + + -- ImGui.IsWindowHovered(...) + -- Parameters: ImGuiHoveredFlags (flags) [O] + -- Returns: bool (hovered) + -- Overloads + hovered = ImGui.IswindowHovered() + hovered = ImGui.IsWindowHovered(ImGuiHoveredFlags.ChildWindows) + + -- ImGui.GetWindowDpiScale() + -- Returns: float (dpiScale) + dpiScale = ImGui.GetWindowDpiScale() + + -- ImGui.GetWindowPos() + -- Returns: float (pos_x), float (pos_y) + pos_x, pos_y = ImGui.GetWindowPos() + + -- ImGui.GetWindowSize() + -- Returns: float (size_x), float (size_y) + size_x, size_y = ImGui.GetWindowSize() + + -- ImGui.GetWindowWidth() + -- Returns: float (width) + width = ImGui.GetWindowWidth() + + -- ImGui.GetWindowHeight() + -- Returns: float (height) + height = ImGui.GetWindowHeight() + + -- ImGui.SetNextWindowPos(...) + -- Parameters: float (pos_x), float (pos_y), ImGuiCond (cond) [O], float (pivot_x) [O], float (pivot_y) [O] + -- Overloads + ImGui.SetNextWindowPos(100, 100) + ImGui.SetNextWindowPos(100, 100, ImGuiCond.Always) + ImGui.SetNextWindowPos(100, 100, ImGuiCond.Always, 0, 0.5) + + -- ImGui.SetNextWindowSize(...) + -- Parameters: float (size_x), float (size_y), ImGuiCond (cond) [O] + -- Overloads + ImGui.SetNextWindowSize(500, 500) + ImGui.SetNextWindowSize(500, 500, ImGuiCond.Appearing) + + -- ImGui.SetNextWindowSizeConstraints(...) + -- Parameters: float (min_x), float (min_y), float (max_x), float (max_y) + ImGui.SetNextWindowSizeConstraints(100, 100, 500, 600) + + -- ImGui.SetNextWindowContentSize(...) + -- Parameters: float (size_x), float (size_y) + ImGui.SetNextWindowContentSize(200, 100) + + -- ImGui.SetNextWindowCollapsed(...) + -- Parameters: bool (collapsed), ImGuiCond (cond) [O] + -- Overloads + ImGui.SetNextWindowCollapsed(true) + ImGui.SetNextWindowCollapsed(true, ImGuiCond.Appearing) + + -- ImGui.SetNextWindowFocus() + ImGui.SetNextWindowFocus() + + -- ImGui.SetNextWindowBgAlpha(...) + -- Parameters: float (alpha) + ImGui.SetNextWindowBgAlpha(0.5) + + -- ImGui.SetWindowPos(...) + -- Parameters: float (pos_x), float (pos_y), ImguiCond (cond) [O] + -- Overloads + ImGui.SetWindowPos(100, 100) + ImGui.SetWindowPos(100, 100, ImGuiCond.Appearing) + + -- ImGui.SetWindowSize(...) + -- Parameters: float (size_x), float (size_y), ImguiCond (cond) [O] + -- Overloads + ImGui.SetWindowSize(100, 300) + ImGui.SetWindowSize(100, 300, ImGuiCond.Appearing) + + -- ImGui.SetWindowCollapsed(...) + -- Parameters: bool (collapsed), ImguiCond (cond) [O] + -- Overloads + ImGui.SetWindowCollapsed(false) + ImGui.SetWindowCollapsed(true, ImGuiCond.Appearing) + + -- ImGui.SetWindowFocus() + ImGui.SetWindowFocus() + + -- ImGui.SetWindowFontScale(...) + -- Parameters: float (scale) + ImGui.SetWindowFontScale(1.2) + + -- ImGui.SetWindowPos(...) + -- Parameters: text (name), float (pos_x), float (pos_y), ImGuiCond (cond) [O] + -- Overloads + ImGui.SetWindowPos("WindowName", 100, 100) + ImGui.SetWindowPos("WindowName", 100, 100, ImGuiCond.Always) + + -- ImGui.SetWindowSize(...) + -- Parameters: text (name), float (size_x), float (size_y), ImGuiCond (cond) [O] + -- Overloads + ImGui.SetWindowSize("WindowName", 300, 400) + ImGui.SetWindowSize("WindowName", 300, 400, ImGuiCond.Always) + + -- ImGui.SetWindowCollapsed(...) + -- Parameters: text (name), bool (collapsed), ImGuiCond (cond) [O] + -- Overloads + ImGui.SetWindowCollapsed("WindowName", true) + ImGui.SetWindowCollapsed("WindowName", false, ImGuiCond.Always) + + -- ImGui.SetWindowFocus(...) + -- Parameters: text (name) + ImGui.SetWindowFocus("WindowName") +``` + +## Content Region +```lua + -- ImGui.GetContentRegionMax() + -- Returns: float (x), float (y) + x, y = ImGui.GetContentRegionMax() + + -- ImGui.GetContentRegionAvail() + -- Returns: float (x), float (y) + x, y = ImGui.GetContentRegionAvail() + + -- ImGui.GetWindowContentRegionMin() + -- Returns: float (x), float (y) + x, y = ImGui.GetWindowContentRegionMin() + + -- ImGui.GetWindowContentRegionMax() + -- Returns: float (x), float (y) + x, y = ImGui.GetWindowContentRegionMax() + + -- ImGui.GetWindowContentRegionWidth() + -- Returns: float (width) + width = ImGui.GetWindowContentRegionWidth() +``` + +## Windows Scrolling +```lua + -- ImGui.GetScrollX() + -- Returns: float (x) + x = ImGui.GetScrollX() + + -- ImGui.GetScrollY() + -- Returns: float (y) + y = ImGui.GetScrollY() + + -- ImGui.GetScrollMaxX() + -- Returns: float (x) + x = ImGui.GetScrollMaxX() + + -- ImGui.GetScrollMaxY() + -- Returns: float (y) + y = ImGui.GetScrollMaxY() + + -- ImGui.SetScrollX(...) + -- Parameters: float (scroll_x) + ImGui.SetScrollX(0.7) + + -- ImGui.SetScrollY(...) + -- Parameters: float (scroll_y) + ImGui.SetScrollY(0.7) + + -- ImGui.SetScrollHereX(...) + -- Parameters: float (center_x_ratio) [O] + -- Overloads + ImGui.SetScrollHereX() + ImGui.SetScrollHereX(0.5) + + -- ImGui.SetScrollHereY(...) + -- Parameters: float (center_y_ratio) [O] + -- Overloads + ImGui.SetScrollHereY() + ImGui.SetScrollHereY(0.5) + + -- ImGui.SetScrollFromPosX(...) + -- Parameters: float (local_x), float (center_x_ratio) [O] + -- Overloads + ImGui.SetScrollFromPosX(10) + ImGui.SetScrollFromPosX(10, 0.5) + + -- ImGui.SetScrollFromPosY(...) + -- Parameters: float (local_y), float (center_y_ratio) [O] + -- Overloads + ImGui.SetScrollFromPosY(10) + ImGui.SetScrollFromPosY(10, 0.5) +``` + +## Parameters Stacks (Shared) +```lua + -- ImGui.PushStyleColor(...) + -- Parameters A: ImGuiCol (idx), int (color_u32) + -- Parameters B: ImGuiCol (idx), float (color_r), float (color_g), float (color_b), float (color_a) + -- Overloads + ImGui.PushStyleColor(ImGuiCol.Tab, 0xF42069FF) + ImGui.PushStyleColor(ImGuiCol.Border, 1, 0, 0, 1) + + -- ImGui.PopStyleColor(...) + -- Parameters: int (count) [O] + -- Overloads + ImGui.PopStyleColor() + ImGui.PopStyleColor(5) + + -- ImGui.PushStyleVar(...) + -- Parameters A: ImGuiStyleVar (idx), float (value) + -- Parameters B: ImGuiStyleVar (idx), float (value_x), float (value_y) + -- Overloads + ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.5) + ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, 0.2, 0.1) + + -- ImGui.PopStyleVar(...) + -- Parameters: int (count) [O] + ImGui.PopStyleVar() + ImGui.PopStyleVar(2) + + -- ImGui.GetStyleColorVec4(...) + -- Parameters: ImGuiCol (idx) + -- Returns: float (color_r), float (color_g), float (color_b), float (color_a) + color_r, color_g, color_b, color_a = ImGui.GetStyleColorVec4(ImGuiCol.Text) + + -- ImGui.GetFontSize() + -- Returns: float (fontSize) + fontSize = ImGui.GetFontSize() + + -- ImGui.GetFontTexUvWhitePixel() + -- Returns: float (x), float (y) + x, y = ImGui.GetFontTexUvWhitePixel() + + -- ImGui.GetColorU32(...) + -- Parameters A: ImGuiCol (idx), float (alphaMultiplier, usually stays at 1) + -- Parameters B: float (color_r), float (color_g), float (color_b), float (color_a) + -- Returns: int (color_u32) + -- Overloads + color_u32 = ImGui.GetColorU32(ImGuiCol.Text, 1) + color_u32 = ImGui.GetColorU32(0, 1, 0, 1) + +``` + +## Parameter Stacks (Current Window) +```lua + -- ImGui.PushItemWidth(...) + -- Parameters: float (width) + ImGui.PushItemWidth(100) + + -- ImGui.PopItemWidth() + ImGui.PopItemWidth() + + -- ImGui.SetNextItemWidth(...) + -- Parameters: float (width) + ImGui.SetNextItemWidth(100) + + -- ImGui.CalcItemWidth() + -- Returns: float (width) + width = ImGui.CalcItemWidth() + + -- ImGui.PushTextWrapPos(...) + -- Parameters: float (wrap_local_pos_x) [O] + -- Overloads + ImGui.PushTextWrapPos() + ImGui.PushTextWrapPos(50) + + -- ImGui.PopTextWrapPos() + ImGui.PopTextWrapPos() + + -- ImGui.PushAllowKeyboardFocus(...) + -- Parameters: bool (allow_keyboard_focus) + ImGui.PushAllowKeyboardFocus(true) + + -- ImGui.PopAllowKeyboardFocus() + ImGui.PopAllowKeyboardFocus() + + -- ImGui.PushButtonRepeat(...) + -- Parameters: bool (repeat) + ImGui.PushButtonRepeat(true) + + -- ImGui.PopButtonRepeat() + ImGui.PopButtonRepeat() +``` + +## Cursor / Layout +```lua + -- ImGui.Separator() + ImGui.Separator + + -- ImGui.SameLine(...) + -- Parameters: float (offset_from_start_x) [O], float (spacing) [O] + -- Overloads + ImGui.SameLine() + ImGui.SameLine(100) + ImGui.SameLine(100, 5) + + -- ImGui.NewLine() + ImGui.NewLine() + + -- ImGui.Spacing() + ImGui.Spacing() + + -- ImGui.Dummy(...) + -- Parameters: float (size_x), float (size_y) + ImGui.Dummy(100, 200) + + -- ImGui.Indent(...) + -- Parameters: float (indent_w) [O] + ImGui.Indent() + ImGui.Indent(10) + + -- ImGui.Unindent(...) + -- Parameters: float (indent_w) [O] + ImGui.Unindent() + ImGui.Unindent(-10) + + -- ImGui.BeginGroup() + ImGui.BeginGroup() + + -- ImGui.EndGroup() + ImGui.EndGroup() + + -- ImGui.GetCursorPos() + -- Returns: float (x), float(y) + x, y = ImGui.GetCursorPos() + + -- ImGui.GetCursorPosX() + -- Returns: float (x) + x = ImGui.GetCursorPosX() + + -- ImGui.GetCursorPosY() + -- Returns: float (y) + y = ImGui.GetCursorPosY() + + -- ImGui.SetCursorPos(...) + -- Parameters: float (x), float (y) + ImGui.SetCursorPos(10, 10) + + -- ImGui.SetCursorPosX(...) + -- Parameters: float (x) + ImGui.SetCursorPosX(10) + + -- ImGui.SetCursorPosY(...) + -- Parameters: float (y) + ImGui.SetCursorPosY(10) + + -- ImGui.GetCursorStartPos() + -- Returns: float (x), float(y) + x, y = ImGui.GetCursorStartPos() + + -- ImGui.GetCursorScreenPos() + -- Returns: float (x), float(y) + x, y = ImGui.GetCursorScreenPos() + + -- ImGui.SetCursorScreenPos(...) + -- Parameters: float (x), float (y) + ImGui.SetCursorScreenPos(10, 10) + + -- ImGui.AlignTextToFramePadding() + ImGui.AlignTextToFramePadding() + + -- ImGui.GetTextLineHeight() + -- Returns: float (height) + height = ImGui.GetTextLineHeight() + + -- ImGui.GetTextLineHeightWithSpacing() + -- Returns: float (height) + height = ImGui.GetTextLineHeightWithSpacing() + + -- ImGui.GetFrameHeight() + -- Returns: float (height) + height = ImGui.GetFrameHeight() + + -- ImGui.GetFrameHeightWithSpacing() + -- Returns: float (height) + height = ImGui.GetFrameHeightWithSpacing() +``` + +## ID Stack / Scopes +```lua + -- ImGui.PushID(...) + -- Parameters A: text (str_id) + -- Parameters B: int (int_id) + -- Overloads + ImGui.PushID("MyID") + ImGui.PushID(1) + + -- ImGui.PopID() + ImGui.PopID() + + -- ImGui.GetID(...) + -- Parameters A: text (str_id) + -- Returns: int (id) + -- Overloads + id = ImGui.GetID("MyID") +``` + +## Widgets: Text +```lua + -- ImGui.TextUnformatted(...) + -- Parameters: text (text) + -- Overloads + ImGui.TextUnformatted("I am Unformatted") + + -- ImGui.Text(...) + -- Parameters: text (text) + ImGui.Text("Well hello there, General Kenobi") + + -- ImGui.TextColored(...) + -- Parameters: float (color_r), float (color_g), float (color_b), float (color_a), text (text) + ImGui.TextColored(1, 0, 0, 1, "Well hello there, General Kenobi") + + -- ImGui.TextDisabled(...) + -- Parameters: text (text) + ImGui.TextDisabled("Well hello there, General Kenobi") + + -- ImGui.TextWrapped(...) + -- Parameters: text (text) + ImGui.TextWrapped("Well hello there, General Kenobi") + + -- ImGui.LabelText(...) + -- Parameters: text (label), text (text) + ImGui.LabelText("Well hello there", "General Kenobi") + + -- ImGui.BulletText(...) + -- Parameters: text (text) + ImGui.BulletText("Well hello there, General Kenobi") +``` + +## Widgets: Main +```lua + -- ImGui.Button(...) + -- Parameters: text (label), float (size_x) [O], float (size_y) [O] + -- Returns: bool (clicked) + -- Overloads + clicked = ImGui.Button("Label") + clicked = ImGui.Button("Label", 100, 50) + + -- ImGui.SmallButton(...) + -- Parameters: text (label) + -- Returns: bool (clicked) + clicked = ImGui.SmallButton("Label") + + -- ImGui.InvisibleButton(...) + -- Parameters: text (label), float (size_x), float (size_y) + -- Returns: bool (clicked) + clicked = ImGui.InvisibleButton("Label", 100, 50) + + -- ImGui.ArrowButton(...) + -- Parameters: text (str_id), ImGuiDir (dir) + -- Returns: bool (clicked) + clicked = ImGui.ArrowButton("I have an arrow", ImGuiDir.Down) + + -- ImGui.Checkbox(...) + -- Parameters: text (label), bool (value) + -- Returns: bool (value), bool (pressed) + value, pressed = ImGui.Checkbox("My Checkbox", value) + + -- ImGui.RadioButton(...) + -- Parameters A: text (label), bool (active) + -- Parameters B: text (label), int (value), int (v_button) + -- Returns A: bool (pressed) + -- Returns B: int (value), bool (pressed) + -- Overloads + pressed = ImGui.RadioButton("Click me", pressed == true) + value, pressed = ImGui.RadioButton("Click me too", value, 2) + + -- ImGui.ProgressBar(...) + -- Parameters: float (fraction), float (size_x) [O], float (size_y) [O], text (overlay) [O] + -- Overloads + ImGui.ProgressBar(0.5) + ImGui.ProgressBar(0.5, 100, 25) + ImGui.ProgressBar(0.5, 100, 25, "Loading Failed. Sike. - 50%") + + -- ImGui.Bullet() + ImGui.Bullet() +``` + +## Widgets: Combo Box +```lua + -- ImGui.BeginCombo(...) + -- Parameters: text (label), text (previewValue), ImGuiComboFlags (flags) [O] + -- Returns: bool (shouldDraw) + -- Overloads + shouldDraw = ImGui.BeginCombo("My Combo", "Preview") + shouldDraw = ImGui.BeginCombo("My Combo", "Preview", ImGuiComboFlags.PopupAlignLeft) + + -- ImGui.EndCombo() + ImGui.EndCombo() + + -- ImGui.Combo(...) + -- Parameters A: text (label), int (current_item), table (items), int (items_count), int (popup_max_height_in_items) [O] + -- Parameters B: text (label), int (current_item), text (items_separated_by_zeros), int (popup_max_height_in_items) [O] + -- Returns: int (current_item), bool (clicked) + -- Overloads + current_item, clicked = ImGui.Combo("Label", current_item, { "Option 1 ", "Option 2" }, 2) + current_item, clicked = ImGui.Combo("Label", current_item, { "Option 1 ", "Option 2" }, 2, 5) + current_item, clicked = ImGui.Combo("Label", current_item, "Option1\0Option2\0") + current_item, clicked = ImGui.Combo("Label", current_item, "Option1\0Option2\0", 5) +``` + +## Widgets: Drags +```lua + -- ImGui.DragFloat(...) + -- Parameters: text (label), float (value), float (value_speed) [O], float (value_min) [O], float (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: float (value), bool (used) + -- Overloads + value, used = ImGui.DragFloat("Label", value) + value, used = ImGui.DragFloat("Label", value, 0.01) + value, used = ImGui.DragFloat("Label", value, 0.01, -10) + value, used = ImGui.DragFloat("Label", value, 0.01, -10, 10) + value, used = ImGui.DragFloat("Label", value, 0.01, -10, 10, "%.1f") + value, used = ImGui.DragFloat("Label", value, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragFloat2(...) + -- Parameters: text (label), table (values), float (value_speed) [O], float (value_min) [O], float (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.DragFloat2("Label", values) + values, used = ImGui.DragFloat2("Label", values, 0.01) + values, used = ImGui.DragFloat2("Label", values, 0.01, -10) + values, used = ImGui.DragFloat2("Label", values, 0.01, -10, 10) + values, used = ImGui.DragFloat2("Label", values, 0.01, -10, 10, "%.1f") + values, used = ImGui.DragFloat2("Label", values, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragFloat3(...) + -- Parameters: text (label), table (values), float (value_speed) [O], float (value_min) [O], float (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.DragFloat3("Label", values) + values, used = ImGui.DragFloat3("Label", values, 0.01) + values, used = ImGui.DragFloat3("Label", values, 0.01, -10) + values, used = ImGui.DragFloat3("Label", values, 0.01, -10, 10) + values, used = ImGui.DragFloat3("Label", values, 0.01, -10, 10, "%.1f") + values, used = ImGui.DragFloat3("Label", values, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragFloat4(...) + -- Parameters: text (label), table (values), float (value_speed) [O], float (value_min) [O], float (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.DragFloat4("Label", values) + values, used = ImGui.DragFloat4("Label", values, 0.01) + values, used = ImGui.DragFloat4("Label", values, 0.01, -10) + values, used = ImGui.DragFloat4("Label", values, 0.01, -10, 10) + values, used = ImGui.DragFloat4("Label", values, 0.01, -10, 10, "%.1f") + values, used = ImGui.DragFloat4("Label", values, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragInt(...) + -- Parameters: text (label), int (value), float (value_speed) [O], int (value_min) [O], int (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: int (value), bool (used) + -- Overloads + value, used = ImGui.DragInt("Label", value) + value, used = ImGui.DragInt("Label", value, 0.01) + value, used = ImGui.DragInt("Label", value, 0.01, -10) + value, used = ImGui.DragInt("Label", value, 0.01, -10, 10) + value, used = ImGui.DragInt("Label", value, 0.01, -10, 10, "%d") + value, used = ImGui.DragInt("Label", value, 0.01, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragInt2(...) + -- Parameters: text (label), table (values), float (value_speed) [O], int (value_min) [O], int (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.DragInt2("Label", values) + values, used = ImGui.DragInt2("Label", values, 0.01) + values, used = ImGui.DragInt2("Label", values, 0.01, -10) + values, used = ImGui.DragInt2("Label", values, 0.01, -10, 10) + values, used = ImGui.DragInt2("Label", values, 0.01, -10, 10, "%d") + values, used = ImGui.DragInt2("Label", values, 0.01, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragInt3(...) + -- Parameters: text (label), table (values), float (value_speed) [O], int (value_min) [O], int (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.DragInt3("Label", values) + values, used = ImGui.DragInt3("Label", values, 0.01) + values, used = ImGui.DragInt3("Label", values, 0.01, -10) + values, used = ImGui.DragInt3("Label", values, 0.01, -10, 10) + values, used = ImGui.DragInt3("Label", values, 0.01, -10, 10, "%d") + values, used = ImGui.DragInt3("Label", values, 0.01, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.DragInt4(...) + -- Parameters: text (label), table (values), float (value_speed) [O], int (value_min) [O], int (value_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.DragInt4("Label", values) + values, used = ImGui.DragInt4("Label", values, 0.01) + values, used = ImGui.DragInt4("Label", values, 0.01, -10) + values, used = ImGui.DragInt4("Label", values, 0.01, -10, 10) + values, used = ImGui.DragInt4("Label", values, 0.01, -10, 10, "%d") + values, used = ImGui.DragInt4("Label", values, 0.01, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) +``` + +## Widgets: Sliders +```lua + -- ImGui.SliderFloat(...) + -- Parameters: text (label), float (value), float (value_min), float (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: float (value), bool (used) + -- Overloads + value, used = ImGui.SliderFloat("Label", value, -10, 10) + value, used = ImGui.SliderFloat("Label", value, -10, 10, "%.1f") + value, used = ImGui.SliderFloat("Label", value, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderFloat2(...) + -- Parameters: text (label), table (values), float (value_min), float (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.SliderFloat2("Label", values, 0.01, -10, 10) + values, used = ImGui.SliderFloat2("Label", values, 0.01, -10, 10, "%.1f") + values, used = ImGui.SliderFloat2("Label", values, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderFloat3(...) + -- Parameters: text (label), table (values), float (value_min), float (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.SliderFloat3("Label", values, 0.01, -10, 10) + values, used = ImGui.SliderFloat3("Label", values, 0.01, -10, 10, "%.1f") + values, used = ImGui.SliderFloat3("Label", values, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderFloat4(...) + -- Parameters: text (label), table (values), float (value_min), float (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.SliderFloat4("Label", values, 0.01, -10, 10) + values, used = ImGui.SliderFloat4("Label", values, 0.01, -10, 10, "%.1f") + values, used = ImGui.SliderFloat4("Label", values, 0.01, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderAngle(...) + -- Parameters: text (label), float (v_rad), float (v_degrees_min) [O], float (v_degrees_max) [O], text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: float (v_rad), bool (used) + -- Overloads + v_rad, used = ImGui.SliderAngle("Label", v_rad) + v_rad, used = ImGui.SliderAngle("Label", v_rad, -255) + v_rad, used = ImGui.SliderAngle("Label", v_rad, -255, 360) + v_rad, used = ImGui.SliderAngle("Label", v_rad, -255, 360, "%.0f deg") + v_rad, used = ImGui.SliderAngle("Label", v_rad, -255, 360, "%.0f deg", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderInt(...) + -- Parameters: text (label), int (value), int (value_min), int (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: int (value), bool (used) + -- Overloads + value, used = ImGui.SliderInt("Label", value, -10, 10) + value, used = ImGui.SliderInt("Label", value, -10, 10, "%d") + value, used = ImGui.SliderInt("Label", value, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderInt2(...) + -- Parameters: text (label), table (values), int (value_min), int (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.SliderInt2("Label", values, -10, 10) + values, used = ImGui.SliderInt2("Label", values, -10, 10, "%d") + values, used = ImGui.SliderInt2("Label", values, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderInt3(...) + -- Parameters: text (label), table (values), int (value_min), int (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.SliderInt3("Label", values, -10, 10) + values, used = ImGui.SliderInt3("Label", values, -10, 10, "%d") + values, used = ImGui.SliderInt3("Label", values, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.SliderInt4(...) + -- Parameters: text (label), table (values), int (value_min), int (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.SliderInt4("Label", values, -10, 10) + values, used = ImGui.SliderInt4("Label", values, -10, 10, "%d") + values, used = ImGui.SliderInt4("Label", values, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) + + -- ImGui.VSliderFloat(...) + -- Parameters: text (label), float (size_x), float (size_y), float (value), float (value_min), float (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: float (value), bool (used) + -- Overloads + value, used = ImGui.VSliderFloat("Label", 100, 25, value, -10, 10) + value, used = ImGui.VSliderFloat("Label", 100, 25, value, -10, 10, "%.1f") + value, used = ImGui.VSliderFloat("Label", 100, 25, value, -10, 10, "%.1f", ImGuiSliderFlags.Logarithmic) + + -- ImGui.VSliderInt(...) + -- Parameters: text (label), float (size_x), float (size_y), int (value), int (value_min), int (value_max), text (format) [O], ImGuiSliderFlags (flags) [O] + -- Returns: int (value), bool (used) + -- Overloads + value, used = ImGui.VSliderInt("Label", 100, 25, value, -10, 10) + value, used = ImGui.VSliderInt("Label", 100, 25, value, -10, 10, "%d") + value, used = ImGui.VSliderInt("Label", 100, 25, value, -10, 10, "%d", ImGuiSliderFlags.Logarithmic) +``` + +## Widgets: Input with Keyboard +```lua + -- ImGui.InputText(...) + -- Parameters: text (label), text (text), int (buf_size), ImGuiInputTextFlags (flags) [O] + -- Returns: text (text), bool (selected) + -- Overloads + text, selected = ImGui.InputText("Label", text, 100) + text, selected = ImGui.InputText("Label", text, 100, ImGuiInputTextFlags.ReadOnly) + + -- ImGui.InputTextMultiline(...) + -- Parameters: text (label), text (text), int (buf_size), float (size_x) [O], float (size_y) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: text (text), bool (selected) + -- Overloads + text, selected = ImGui.InputTextMultiline("Label", text, 100) + text, selected = ImGui.InputTextMultiline("Label", text, 100, 200, 35) + text, selected = ImGui.InputTextMultiline("Label", text, 100, 200, 35, ImGuiInputTextFlags.ReadOnly) + + -- ImGui.InputTextWithHint(...) + -- Parameters: text (label), text (hint), text (text), int (buf_size), ImGuiInputTextFlags (flags) [O] + -- Returns: text (text), bool (selected) + -- Overloads + text, selected = ImGui.InputTextWithHint("Label", "Hint", text, 100) + text, selected = ImGui.InputTextWithHint("Label", "Hint", text, 100, ImGuiInputTextFlags.ReadOnly) + + -- ImGui.InputFloat(...) + -- Parameters: text (label), float (value), float (step) [O], float (step_fast) [O], text (format) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: float (value), bool (used) + -- Overloads + value, used = ImGui.InputFloat("Label", value) + value, used = ImGui.InputFloat("Label", value, 1) + value, used = ImGui.InputFloat("Label", value, 1, 10) + value, used = ImGui.InputFloat("Label", value, 1, 10, "%.1f") + value, used = ImGui.InputFloat("Label", value, 1, 10, "%.1f", ImGuiInputTextFlags.None) + + -- ImGui.InputFloat2(...) + -- Parameters: text (label), table (values), text (format) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.InputFloat2("Label", values) + values, used = ImGui.InputFloat2("Label", values, "%.1f") + values, used = ImGui.InputFloat2("Label", values, "%.1f", ImGuiInputTextFlags.None) + + -- ImGui.InputFloat3(...) + -- Parameters: text (label), table (values), text (format) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.InputFloat3("Label", values) + values, used = ImGui.InputFloat3("Label", values, "%.1f") + values, used = ImGui.InputFloat3("Label", values, "%.1f", ImGuiInputTextFlags.None) + + -- ImGui.InputFloat4(...) + -- Parameters: text (label), table (values), text (format) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.InputFloat4("Label", values) + values, used = ImGui.InputFloat4("Label", values, "%.1f") + values, used = ImGui.InputFloat4("Label", values, "%.1f", ImGuiInputTextFlags.None) + + -- ImGui.InputInt(...) + -- Parameters: text (label), int (value), int (step) [O], int (step_fast) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: int (value), bool (used) + -- Overloads + value, used = ImGui.InputInt("Label", value) + value, used = ImGui.InputInt("Label", value, 1) + value, used = ImGui.InputInt("Label", value, 1, 10) + value, used = ImGui.InputInt("Label", value, 1, 10, ImGuiInputTextFlags.None) + + -- ImGui.InputInt2(...) + -- Parameters: text (label), table (values), ImGuiInputTextFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.InputInt2("Label", values) + values, used = ImGui.InputInt2("Label", values, ImGuiInputTextFlags.None) + + -- ImGui.InputInt3(...) + -- Parameters: text (label), table (values), ImGuiInputTextFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.InputInt3("Label", values) + values, used = ImGui.InputInt3("Label", values, ImGuiInputTextFlags.None) + + -- ImGui.InputInt4(...) + -- Parameters: text (label), table (values), ImGuiInputTextFlags (flags) [O] + -- Returns: table (values), bool (used) + -- Overloads + values, used = ImGui.InputInt4("Label", values) + values, used = ImGui.InputInt4("Label", values, ImGuiInputTextFlags.None) + + -- ImGui.InputDouble(...) + -- Parameters: text (label), double (value), double (step) [O], double (step_fast) [O], text (format) [O], ImGuiInputTextFlags (flags) [O] + -- Returns: double (value), bool (used) + -- Overloads + value, used = ImGui.InputDouble("Label", value) + value, used = ImGui.InputDouble("Label", value, 1) + value, used = ImGui.InputDouble("Label", value, 1, 10) + value, used = ImGui.InputDouble("Label", value, 1, 10, "%.4f") + value, used = ImGui.InputDouble("Label", value, 1, 10, "%.4f", ImGuiInputTextFlags.None) +``` + +## Widgets: Color Editor / Picker +```lua + -- ImGui.ColorEdit3(...) + -- Parameters: text (label), table (col), ImGuiColorEditFlags (flags) [O] + -- Returns: table (col), bool (used) + -- Overloads + col, used = ImGui.ColorEdit3("Label", col) + col, used = ImGui.ColorEdit3("Label", col, ImGuiColorEditFlags.NoTooltip) + + -- ImGui.ColorEdit4(...) + -- Parameters: text (label), table (col), ImGuiColorEditFlags (flags) [O] + -- Returns: table (col), bool (used) + -- Overloads + col, used = ImGui.ColorEdit4("Label", col) + col, used = ImGui.ColorEdit4("Label", col, ImGuiColorEditFlags.NoTooltip) + + -- ImGui.ColorPicker3(...) + -- Parameters: text (label), table (col), ImGuiColorEditFlags (flags) [O] + -- Returns: table (col), bool (used) + -- Overloads + col, used = ImGui.ColorPicker3("Label", col) + col, used = ImGui.ColorPicker3("Label", col, ImGuiColorEditFlags.NoTooltip) + + -- ImGui.ColorPicker4(...) + -- Parameters: text (label), table (col), ImGuiColorEditFlags (flags) [O] + -- Returns: table (col), bool (used) + -- Overloads + col, used = ImGui.ColorPicker4("Label", col) + col, used = ImGui.ColorPicker4("Label", col, ImGuiColorEditFlags.NoTooltip) + + -- ImGui.ColorButton(...) + -- Parameters: text (desc_id), table (col), ImGuiColorEditFlags (flags) [O], float (size_x) [O], float (size_y) [O] + -- Returns: bool (pressed) + -- Overloads + pressed = ImGui.ColorButton("Desc ID", { 1, 0, 0, 1 }) + pressed = ImGui.ColorButton("Desc ID", { 1, 0, 0, 1 }, ImGuiColorEditFlags.None) + pressed = ImGui.ColorButton("Desc ID", { 1, 0, 0, 1 }, ImGuiColorEditFlags.None, 100, 100) + + -- ImGui.SetColorEditOptions(...) + -- Parameters: ImGuiColorEditFlags (flags) + ImGui.SetColorEditOptions(ImGuiColorEditFlags.NoTooltip | ImGuiColorEditFlags.NoInputs) +``` + +## Widgets: Trees +```lua + -- ImGui.TreeNode(...) + -- Parameters: text (label), text (fmt) [O] + -- Returns: bool (open) + -- Overloads + open = ImGui.TreeNode("Label") + open = ImGui.TreeNode("Label", "Some Text") + + -- ImGui.TreeNodeEx(...) + -- Parameters: text (label), ImGuiTreeNodeFlags (flags) [O], text (fmt) [O] + -- Returns: bool (open) + -- Overloads + open = ImGui.TreeNodeEx("Label") + open = ImGui.TreeNodeEx("Label", ImGuiTreeNodeFlags.Selected) + open = ImGui.TreeNodeEx("Label", ImGuiTreeNodeFlags.Selected, "Some Text") + + -- ImGui.TreePush(...) + -- Parameters: text (str_id) + ImGui.TreePush("String ID") + + -- ImGui.TreePop() + ImGui.TreePop() + + -- ImGui.GetTreeNodeToLabelSpacing() + -- Returns: float (spacing) + spacing = ImGui.GetTreeNodeToLabelSpacing() + + -- ImGui.CollapsingHeader(...) + -- Parameters A: text (label), ImGuiTreeNodeFlags (flags) [O] + -- Parameters B: text (label), bool (open), ImGuiTreeNodeFlags (flags) [O] + -- Returns A: bool (notCollapsed) + -- Returns B: bool (open), bool (notCollapsed) + -- Overloads + notCollapsed = ImGui.CollapsingHeader("Label") + notCollapsed = ImGui.CollapsingHeader("Label", ImGuiTreeNodeFlags.Selected) + open, notCollapsed = ImGui.CollapsingHeader("Label", open) + open, notCollapsed = ImGui.CollapsingHeader("Label", open, ImGuiTreeNodeFlags.Selected) + + -- ImGui.SetNextItemOpen(...) + -- Parameters: bool (open), ImGuiCond (cond) [O] + -- Overloads + ImGui.SetNextItemOpen(true) + ImGui.SetNextItemOpen(true, ImGuiCond.Always) +``` + +## Widgets: Selectables +```lua + -- ImGui.Selectable(...) + -- Parameters: text (label), bool (selected) [O], ImGuiSelectableFlags (flags) [O], float (size_x) [O], float (size_y) [O] + -- Returns: bool (selected) + -- Overloads + selected = ImGui.Selectable("Label") + selected = ImGui.Selectable("Label", selected) + selected = ImGui.Selectable("Label", selected, ImGuiSelectableFlags.AllowDoubleClick) + selected = ImGui.Selectable("Label", selected, ImGuiSelectableFlags.AllowDoubleClick, 100, 100) +``` + +## Widgets: List Boxes +```lua + -- ImGui.ListBox(...) + -- Parameters: text (label), int (current_item), table (items), int (items_count), int (height_in_items) [O] + -- Returns: int (current_item), bool (clicked) + -- Overloads + current_item, clicked = ImGui.ListBox("Label", current_item, { "Item 1", "Item 2", 2 }) + current_item, clicked = ImGui.ListBox("Label", current_item, { "Item 1", "Item 2", 2 }, 5) + + -- ImGui.BeginListBox(...) + -- Parameters A: text (label), float (size_x) [O], float (size_y) [O] + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginListBox("Label") + open = ImGui.BeginListBox("Label", 100.0, 100.0) + + -- ImGui.EndListBox() + ImGui.EndListBox() +``` + +## Widgets: Value() Helpers +```lua + -- ImGui.Value(...) + -- Parameters: text (prefix) bool/int/unsigned int/float (value), text (float_format) [O] -- format only available with float + -- Overloads + ImGui.Value("Prefix", true) + ImGui.Value("Prefix", -5) + ImGui.Value("Prefix", 5) + ImGui.Value("Prefix", 5.0) + ImGui.Value("Prefix", 5.0, "%.2f") +``` + +## Widgets: Menus +```lua +-- ImGui.BeginMenuBar() +-- Returns: bool (shouldDraw) +shouldDraw = ImGui.BeginMenuBar() + +-- ImGui.EndMenuBar() +ImGui.EndMenuBar() + +-- ImGui.BeginMainMenuBar() +-- Returns: bool (shouldDraw) +shouldDraw = ImGui.BeginMainMenuBar() + +-- ImGui.EndMainMenuBar() +ImGui.EndMainMenuBar() + +-- ImGui.BeginMenu(...) +-- Parameters: text (label), bool (enabled) [O] +-- Returns: bool (shouldDraw) +-- Overloads +shouldDraw = ImGui.BeginMenu("Label") +shouldDraw = ImGui.BeginMenu("Label", true) + +-- ImGui.EndMenu() +ImGui.EndMenu() + +-- ImGui.MenuItem(...) +-- Parameters A: text (label), text (shortcut) [0] +-- Parameters B: text (label), text (shortcut), bool (selected) +-- Returns A: bool (activated) +-- returns B: bool (selected), bool (activated) +-- Overloads +activated = ImGui.MenuItem("Label") +activated = ImGui.MenuItem("Label", "ALT+F4") +selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected) +selected, activated = ImGui.MenuItem("Label", "ALT+F4", selected, true) +``` + +## Tooltips +```lua + -- ImGui.BeginTooltip() + ImGui.BeginTooltip() + + -- ImGui.EndTooltip() + ImGui.EndTooltip() + + -- ImGui.SetTooltip(...) + -- Parameters: text (fmt) + ImGui.SetTooltip("Did you know that I have the high ground?") +``` + +## Popups, Modals +```lua + -- ImGui.BeginPopup(...) + -- Parameters: text (str_id), ImGuiWindowFlags (flags) [O] + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginPopup("String ID") + open = ImGui.BeginPopup("String ID", ImGuiWindowFlags.NoCollapse) + + -- ImGui.BeginPopupModal(...) + -- Parameters: text (name), bool (open) [O], ImGuiWindowFlags (flags) [O] + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginPopupModal("Name") + open = ImGui.BeginPopupModal("Name", ImGuiWindowFlags.NoCollapse) + open = ImGui.BeginPopupModal("Name", open) + open = ImGui.BeginPopupModal("Name", open, ImGuiWindowFlags.NoCollapse) + + -- ImGui.EndPopup() + ImGui.EndPopup() + + -- ImGui.OpenPopup(...) + -- Parameters: text (str_id), ImGuiPopupFlags (popup_flags) + -- Overloads + ImGui.OpenPopup("String ID") + ImGui.OpenPopup("String ID", ImGuiPopupFlags.NoOpenOverExistingPopup) + + -- ImGui.OpenPopupContextItem(...) + -- Parameters: text (str_id), ImGuiPopupFlags (popup_flags) + -- Returns: bool (open) + -- Overloads + open = ImGui.OpenPopupContextItem() + open = ImGui.OpenPopupContextItem("String ID") + open = ImGui.OpenPopupContextItem("String ID", ImGuiPopupFlags.NoOpenOverExistingPopup) + + -- ImGui.CloseCurrentPopup() + ImGui.CloseCurrentPopup() + + -- ImGui.BeginPopupContextItem(...) + -- Parameters: text (str_id), ImGuiPopupFlags (popup_flags) + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginPopupContextItem() + open = ImGui.BeginPopupContextItem("String ID") + open = ImGui.BeginPopupContextItem("String ID", ImGuiPopupFlags.NoOpenOverExistingPopup) + + -- ImGui.BeginPopupContextWindow(...) + -- Parameters: text (str_id), ImGuiPopupFlags (popup_flags) + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginPopupContextWindow() + open = ImGui.BeginPopupContextWindow("String ID") + open = ImGui.BeginPopupContextWindow("String ID", ImGuiPopupFlags.NoOpenOverExistingPopup) + + -- ImGui.BeginPopupContextVoid(...) + -- Parameters: text (str_id), ImGuiPopupFlags (popup_flags) + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginPopupContextVoid() + open = ImGui.BeginPopupContextVoid("String ID") + open = ImGui.BeginPopupContextVoid("String ID", ImGuiPopupFlags.NoOpenOverExistingPopup) + + -- ImGui.IsPopupOpen(...) + -- Parameters: text (str_id), ImGuiPopupFlags (popup_flags) + -- Overloads + ImGui.IsPopupOpen("String ID") + ImGui.IsPopupOpen("String ID", ImGuiPopupFlags.NoOpenOverExistingPopup) +``` + +## Tables +```lua + -- ImGui.BeginTable(...) + -- Parameters: string (str_id), int (column), ImGuiTableFlags (flags) [O], float (outer_size_x) [O], float (outer_size_y) [O], float (inner_width) [O] + -- Returns: bool + ImGui.BeginTable("Table1", 3) + ImGui.BeginTable("Table1", 3, ImGuiTableFlags.Resizable) + ImGui.BeginTable("Table1", 3, ImGuiTableFlags.Resizable, 200, 150) + ImGui.BeginTable("Table1", 3, ImGuiTableFlags.Resizable, 200, 150, 10) + + -- ImGui.EndTable() // only call EndTable() if BeginTable() returns true! + ImGui.EndTable() + + -- ImGui.TableNextRow(...) // append into the first cell of a new row. + -- Parameters: ImGuiTableRowFlags (flags) [O], float (min_row_height) [O] + ImGui.TableNextRow() + ImGui.TableNextRow(ImGuiTableRowFlags.Headers) + ImGui.TableNextRow(ImGuiTableRowFlags.Headers, 25) + + -- ImGui.TableNextColumn() // append into the next column (or first column of next row if currently in last column). Return true when column is visible. + -- Returns: bool (visible) + visible = ImGui.TableNextColumn() + + -- ImGui.TableSetColumnIndex(...) // append into the specified column. Return true when column is visible. + -- Parameter: int (column_n) + -- Returns: bool (visible) + visible = ImGui.TableSetColumnIndex(2) + + -- ImGui.TableSetupColumn(...) + -- Parameters: string (label), ImGuiTableColumnFlags (flags) [O], float (init_width_or_weight) [O], ImU32 (user_id) [O] + ImGui.TableSetupColumn("Column1") + ImGui.TableSetupColumn("Column1", ImGuiTableColumnFlags.WidthFixed) + ImGui.TableSetupColumn("Column1", ImGuiTableColumnFlags.WidthFixed, 60) + + -- ImGui.TableSetupScrollFreeze(...) // lock columns/rows so they stay visible when scrolled. + -- Parameters: int (cols), int(rows) + ImGui.TableSetupScrollFreeze(3, 1) + + -- ImGuui.TableHeadersRow() // submit all headers cells based on data provided to TableSetupColumn() + submit context menu + ImGui.TableHeadersRow() + + -- ImGui.TableHeader(...) // submit one header cell manually (rarely used) + -- Parameter: string (label) + ImGui.TableHeader("Header") + + -- ImGui.TableGetSortSpecs() // get latest sort specs for the table (NULL if not sorting). + -- Returns: ImGuiTableSortSpecs* + ImGui.TableGetSortSpecs() + + -- ImGui.TableGetColumnCount() // return number of columns (value passed to BeginTable) + -- Returns: int (cols) + cols = ImGui.TableGetColumnCount() + + -- ImGui.TableGetColumnIndex() // return current column index. + -- Returns: int (col_index) + col_index = ImGui.TableGetColumnIndex() + + -- ImGui.TableGetRowIndex() // return current row index. + -- Returns: int (row_index) + row_index = ImGui.TableGetRowIndex() + + -- ImGui.TableGetColumnName(...) // return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column. + -- Parameter: int (column_n) [O] + -- Returns: string(col_name) + col_name = ImGui.TableGetColumnName() + col_name = ImGui.TableGetColumnName(2) + + -- ImGui.TableGetColumnFlags(...) // return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column. + -- Parameter: int (column_n) [O] + -- Returns: ImGuiTableColumnFlags + col_flags = ImGui.TableGetColumnFlags() + col_flags = ImGui.TableGetColumnFlags(2) + + -- ImGui.TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n = -1) // change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details. + -- Parameters1: ImGuiTableBgTarget (target), ImU32 (color), int (column_n) [O] + -- Parameters2: ImGuiTableBgTarget (target), float (col_R), float (col_G), float (col_B), float (col_A), int (column_n) [O] + ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, 0xF42069FF) + ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, 0xF42069FF, 2) + ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, 1, 0, 0, 1) + ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, 1, 0, 0, 1, 2) +``` + + +## Columns (Legacy API, prefer using Tables!) +```lua + -- ImGui.Columns(...) + -- Parameters: int (count) [O], text (id) [O], bool (border) [O] + -- Overloads + ImGui.Columns() + ImGui.Columns(2) + ImGui.Columns(2, "MyOtherColumn") + ImGui.Columns(3, "MyColumnWithBorder", true) + + -- ImGui.NextColumn() + ImGui.NextColumn() + + -- ImGui.GetColumnIndex() + -- Returns: int (index) + index = ImGui.GetColumnIndex() + + -- ImGui.GetColumnWidth(...) + -- Parameters: int (column_index) [O] + -- Returns: float (width) + -- Overloads + width = ImGui.GetColumnWidth() + width = ImGui.getColumnWidth(2) + + -- ImGui.SetColumnWidth(...) + -- Parameters: int (column_index), float (width) + ImGui.SetColumnWidth(2, 100) + + -- ImGui.GetColumnOffset(...) + -- Parameters: int (column_index) [O] + -- Returns: float (offset) + -- Overloads + offset = ImGui.GetColumnOffset() + offset = ImGui.GetColumnOffset(2) + + -- ImGui.SetColumnOffset(...) + -- Parameters: int (column_index), float (offset) + ImGui.SetColumnOffset(2, 10) + + -- ImGui.GetColumnsCount() + -- Returns: int (count) + count = ImGui.GetColumnsCount() +``` + +## Tab Bars, Tabs +```lua + -- ImGui.BeginTabBar(...) + -- Parameters: text (str_id), ImGuiTabBarFlags (flags) + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginTabBar("String ID") + open = ImGui.BeginTabBar("String ID", ImGuiTabBarFlags.Reorderable) + + -- ImGui.EndTabBar() + ImGui.EndTabBar() + + -- ImGui.BeginTabItem() + -- Parameters A: text (label) + -- Parameters B: text (label), bool (open), ImGuiTabItemFlags (flags) [O] + -- Returns A: bool (selected) + -- Returns B: bool (open), bool (selected) + -- Overloads + selected = ImGui.BeginTabItem("Label") + selected = ImGui.BeginTabItem("Label", ImGuiTabItemFlags.NoTooltip) + open, selected = ImGui.BeginTabItem("Label", open) + open, selected = ImGui.BeginTabItem("Label", open, ImGuiTabItemFlags.NoTooltip) + + -- ImGui.EndTabItem() + ImGui.EndTabItem() + + -- ImGui.SetTabItemClosed(...) + -- Parameters: text (tab_or_docked_window_label) + ImGui.SetTabItemClosed("MyDockedWindow") +``` + +## Disabling +```lua + -- ImGui.BeginDisabled() + -- ImGui.BeginDisabled(disabled) -- bool: disabled + -- ImGui.EndDisabled() + ImGui.BeginDisabled() + ImGui.BeginDisabled(false) + ImGui.EndDisabled() +``` + +## Clipping +```lua + -- ImGui.PushClipRect(...) + -- Parameters: float (min_x), float (min_y), float (max_x), float (max_y), bool (intersect_current) + ImGui.PushClipRect(0, 0, 100, 100, false) + + -- ImGui.PopClipRect() + ImGui.PopClipRect() +``` + +## Focus, Activation +```lua + -- ImGui.SetItemDefaultFocus() + ImGui.SetItemDefaultFocus() + + -- ImGui.SetKeyboardFocusHere(...) + -- Parameters: int (offset) [O] + -- Overloads + ImGui.SetItemDefaultFocus() + ImGui.SetItemDefaultFocus(5) +``` + +## Item / Widgets Utilities +```lua + -- ImGui.IsItemHovered(...) + -- Parameters: ImGuiHoveredFlags (flags) [O] + -- Returns: bool (hovered) + -- Overloads + hovered = ImGui.IsItemHovered() + hovered = ImGui.IsItemHovered(ImGuiHoveredFlags.ChildWindows) + + -- ImGui.IsItemActive() + -- Returns: bool (active) + active = ImGui.IsItemActive() + + -- ImGui.IsItemFocused() + -- Returns: bool (focused) + focused = ImGui.IsItemFocused() + + -- ImGui.IsItemClicked(...) + -- Parameters: ImGuiMouseButton (mouse_button) [O] + -- Returns: bool (clicked) + -- Overloads + clicked = ImGui.IsItemClicked() + clicked = ImGui.IsItemClicked(ImGuiMouseButton.Middle) + + -- ImGui.IsItemVisible() + -- Returns: bool (visible) + visible = ImGui.IsItemVisible() + + -- ImGui.IsItemEdited() + -- Returns: bool (edited) + edited = ImGui.IsItemEdited() + + -- ImGui.IsItemActivated() + -- Returns: bool (activated) + activated = ImGui.IsItemActivated() + + -- ImGui.IsItemDeactivated() + -- Returns: bool (deactivated) + deactivated = ImGui.IsItemDeactivated() + + -- ImGui.IsItemDeactivatedAfterEdit() + -- Returns: bool (deactivated_after_edit) + deactivated_after_edit = ImGui.IsItemDeactivatedAfterEdit() + + -- ImGui.IsItemToggledOpen() + -- Returns: bool (toggled_open) + toggled_open = ImGui.IsItemToggledOpen() + + -- ImGui.IsAnyItemHovered() + -- Returns: bool (any_item_hovered) + any_item_hovered = ImGui.IsAnyItemHovered() + + -- ImGui.IsAnyItemActive() + -- Returns: bool (any_item_active) + any_item_active = ImGui.IsAnyItemActive() + + -- ImGui.IsAnyItemFocused() + -- Returns: bool (any_item_focused) + any_item_focused = ImGui.IsAnyItemFocused() + + -- ImGui.GetItemRectMin() + -- Returns: float (x), float (y) + x, y = ImGui.GetItemRectMin() + + -- ImGui.GetItemRectMax() + -- Returns: float (x), float (y) + x, y = ImGui.GetItemRectMax() + + -- ImGui.GetItemRectSize() + -- Returns: float (x), float (y) + x, y = ImGui.GetItemRectSize() + + -- ImGui.SetItemAllowOverlap() + ImGui.SetItemAllowOverlap() +``` + +## Miscellaneous Utilities +```lua + -- ImGui.IsRectVisible(...) + -- Parameters A: float (size_x), float (size_y) + -- Parameters B: float(min_x), float (min_y), float (max_x), float (max_y) + -- Returns: bool (visible) + -- Overloads + visible = ImGui.IsRectVisible(100, 100) + visible = ImGui.IsRectVisible(50, 50, 200, 200) + + -- ImGui.GetTime() + -- Returns double (time) + time = ImGui.GetTime() + + -- ImGui.GetFrameCount() + -- Returns int (frame_count) + frame_count = ImGui.GetFrameCount() + + -- ImGui.GetStyleColorName(...) + -- Parameters: ImGuiCol (idx) + -- Returns: text (style_color_name) + style_color_name = ImGui.GetStyleColorName(ImGuiCol.Text) + + -- ImGui.BeginChildFrame(...) + -- Parameters: unsigned int (id), float (size_x), float (size_y), ImGuiWindowFlags (flags) [O] + -- Returns: bool (open) + -- Overloads + open = ImGui.BeginChildFrame(0, 100, 100) + open = ImGui.BeginChildFrame(0, 100, 100, ImGuiWindowFlags.NoBackground) + + -- ImGui.EndChildFrame() + ImGui.EndChildFrame() +``` + +## Text Utilities +```lua + -- ImGui.CalcTextSize(...) + -- Parameters: text (text), bool (hide_text_after_double_hash) [O], float (wrap_width) [O] + -- Returns: float (x), float (y) + -- Overloads + x, y = ImGui.CalcTextSize("Calculate me") + x, y = ImGui.CalcTextSize("Calculate me", true) + x, y = ImGui.CalcTextSize("Calculate me", true, 100) +``` + +## Color Utilities +```lua + -- ImGui.ColorConvertRGBtoHSV(...) + -- Parameters: float (r), float (g), float (b) + -- Returns: float (h), float (s), float (v) + h, s, v = ImGui.ColorConvertRGBtoHSV(1, 0, 0.5) + + -- ImGui.ColorConvertHSVtoRGB(...) + -- Parameters: float (h), float (s), float (v) + -- Returns: float (r), float (g), float (b) + r, g, b = ImGui.ColorConvertHSVtoRGB(1, 0, 0.5) + + -- ImGui.ColorConvertU32ToFloat4(...) + -- Parameters: int (color_u32) + -- Returns: float array (color_f4={r,g,b,a}) + color_f4 = ImGui.ColorConvertU32ToFloat4(0xF69420FF) + + -- ImGui.ColorConvertFloat4ToU32(...) + -- Parameters: float array (color_f4={r,g,b,a}) + -- Returns: int (color_u32) + -- NOTE: this function is fundamentally + color_u32 = ImGui.ColorConvertFloat4ToU32({0.4, 0.2, 0, 1}) +``` + +## Inputs Utilities: Mouse +```lua + -- ImGui.IsMouseHoveringRect(...) + -- Parameters: float (min_x), float (min_y), float(max_x), float(max_y), bool (clip) [O] + -- Returns: bool (hovered) + hovered = ImGui.IsMouseHoveringRect(0, 0, 100, 100) + hovered = ImGui.IsMouseHoveringRect(0, 0, 100, 100, true) + + -- ImGui.GetMousePos() + -- Returns: float (x), float (y) + x, y = ImGui.GetMousePos() + + -- ImGui.GetMousePosOnOpeningCurrentPopup() + -- Returns: float (x), float (y) + x, y = ImGui.GetMousePosOnOpeningCurrentPopup() + + -- ImGui.IsMouseDragging(...) + -- Parameters: ImGuiMouseButton (button), float (lock_threshold) [O] + -- Returns: bool (dragging) + -- Overloads + dragging = ImGui.IsMouseDragging(ImGuiMouseButton.Middle) + dragging = ImGui.IsMouseDragging(ImGuiMouseButton.Middle, 0.5) + + -- ImGui.GetMouseDragDelta(...) + -- Parameters: ImGuiMouseButton (button) [O], float (lock_threshold) [O] + -- Returns: float (x), float (y) + -- Overloads + x, y = ImGui.GetMouseDragDelta() + x, y = ImGui.GetMouseDragDelta(ImGuiMouseButton.Middle) + x, y = ImGui.GetMouseDragDelta(ImGuiMouseButton.Middle, 0.5) + + -- ImGui.ResetMouseDragDelta(...) + -- Parameters: ImGuiMouseButton (button) [O] + -- Overloads + ImGui.ResetMouseDragDelta() + ImGui.ResetMouseDragDelta(ImGuiMouseButton.Middle) +``` + +## Clipboard Utilities +```lua + -- ImGui.GetClipboardText() + -- Returns: text (text) + text = ImGui.GetClipboardText() + + -- ImGui.SetClipboardText(...) + -- Parameters: text (text) + ImGui.SetClipboardText("I made it to the clipboard!") +``` \ No newline at end of file diff --git a/docs/lua/tables/gui.md b/docs/lua/tables/gui.md index ef0300af..fba9a7f7 100644 --- a/docs/lua/tables/gui.md +++ b/docs/lua/tables/gui.md @@ -2,7 +2,7 @@ Table containing functions for modifying the menu GUI. -## Functions (6) +## Functions (7) ### `get_tab(tab_name)` @@ -79,4 +79,30 @@ gui.show_error(title, message) bool = gui.is_open() ``` +### `add_imgui(imgui_rendering)` + +Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. +**Example Usage:** +```lua +gui.add_imgui(function() + if ImGui.Begin("My Custom Window") then + if ImGui.Button("Label") then + script.run_in_fiber(function(script) + -- call natives in there + end) + end + + ImGui.End() + end +end) +``` + +- **Parameters:** + - `imgui_rendering` (function): Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. + +**Example Usage:** +```lua +gui.add_imgui(imgui_rendering) +``` + diff --git a/docs/lua/tables/script.md b/docs/lua/tables/script.md index 63c1e939..e43b2697 100644 --- a/docs/lua/tables/script.md +++ b/docs/lua/tables/script.md @@ -75,3 +75,4 @@ end) script.run_in_fiber(func) ``` + diff --git a/docs/lua/tabs.md b/docs/lua/tabs.md index 0f091a77..2e8c56af 100644 --- a/docs/lua/tabs.md +++ b/docs/lua/tabs.md @@ -13,11 +13,12 @@ end) For a complete list of available gui functions, please refer to the tab class documentation and the gui table documentation. -## Tab Count: 42 +## Tab Count: 43 ### `GUI_TAB_SELF` ### `GUI_TAB_WEAPONS` ### `GUI_TAB_TELEPORT` +### `GUI_TAB_CUSTOM_TELEPORT` ### `GUI_TAB_MOBILE` ### `GUI_TAB_OUTFIT_EDITOR` ### `GUI_TAB_OUTFIT_SLOTS` diff --git a/src/lua/bindings/gui.hpp b/src/lua/bindings/gui.hpp index 800738bd..2af344d2 100644 --- a/src/lua/bindings/gui.hpp +++ b/src/lua/bindings/gui.hpp @@ -5,6 +5,7 @@ #include "gui/input_float.hpp" #include "gui/input_int.hpp" #include "gui/input_string.hpp" +#include "gui/raw_imgui_callback.hpp" #include "gui/sameline.hpp" #include "gui/separator.hpp" #include "gui/text.hpp" @@ -13,6 +14,13 @@ namespace lua::gui { + static void add_independent_element(lua_State* state, std::shared_ptr element) + { + auto module = sol::state_view(state)["!this"].get(); + + module->m_independent_gui.push_back(std::move(element)); + } + static void add_element(lua_State* state, std::uint32_t hash, std::shared_ptr element) { auto module = sol::state_view(state)["!this"].get(); @@ -51,7 +59,7 @@ namespace lua::gui m_id = nav_item.first; return true; } - + if (check_if_existing_tab_and_fill_id(nav_item.second.sub_nav)) { return true; @@ -81,7 +89,7 @@ namespace lua::gui std::pair make_tab_nav(const std::string& name, const rage::joaat_t tab_hash, const sol::this_state& state) { static size_t custom_tab_count = size_t(big::tabs::RUNTIME_CUSTOM); - m_id = big::tabs(custom_tab_count); + m_id = big::tabs(custom_tab_count); custom_tab_count++; @@ -261,6 +269,32 @@ namespace lua::gui add_element(state, m_tab_hash, element); return element; } + + // Lua API: Function + // Class: tab + // Name: add_imgui + // Param: imgui_rendering: function: Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. + // Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. + // **Example Usage:** + // ```lua + // tab:add_imgui(function() + // if ImGui.Begin("My Custom Window") then + // if ImGui.Button("Label") then + // script.run_in_fiber(function(script) + // -- call natives in there + // end) + // end + // + // ImGui.End() + // end + // end) + // ``` + std::shared_ptr add_imgui(sol::protected_function imgui_rendering, sol::this_state state) + { + auto element = std::make_shared(imgui_rendering); + add_element(state, m_tab_hash, element); + return element; + } }; // Lua API: Table @@ -328,6 +362,32 @@ namespace lua::gui // Returns: bool: Returns true if the GUI is open. bool is_open(); + // Lua API: Function + // Table: gui + // Name: add_imgui + // Param: imgui_rendering: function: Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. + // Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. + // **Example Usage:** + // ```lua + // gui.add_imgui(function() + // if ImGui.Begin("My Custom Window") then + // if ImGui.Button("Label") then + // script.run_in_fiber(function(script) + // -- call natives in there + // end) + // end + // + // ImGui.End() + // end + // end) + // ``` + static std::shared_ptr add_imgui(sol::protected_function imgui_rendering, sol::this_state state) + { + auto element = std::make_shared(imgui_rendering); + add_independent_element(state, element); + return element; + } + static void bind(sol::state& state) { auto ns = state["gui"].get_or_create(); @@ -337,6 +397,7 @@ namespace lua::gui ns["show_warning"] = show_warning; ns["show_error"] = show_error; ns["is_open"] = is_open; + ns["add_imgui"] = add_imgui; // clang-format off ns.new_usertype("button", @@ -391,7 +452,8 @@ namespace lua::gui "add_separator", &tab::add_separator, "add_input_int", &tab::add_input_int, "add_input_float", &tab::add_input_float, - "add_input_string", &tab::add_input_string + "add_input_string", &tab::add_input_string, + "add_imgui", &tab::add_imgui ); // clang-format on } diff --git a/src/lua/bindings/gui/raw_imgui_callback.cpp b/src/lua/bindings/gui/raw_imgui_callback.cpp new file mode 100644 index 00000000..09480c48 --- /dev/null +++ b/src/lua/bindings/gui/raw_imgui_callback.cpp @@ -0,0 +1,15 @@ +#include "raw_imgui_callback.hpp" + +namespace lua::gui +{ + raw_imgui_callback::raw_imgui_callback(sol::protected_function callback) : + m_callback(callback) + { + + } + + void raw_imgui_callback::draw() + { + m_callback(); + } +} \ No newline at end of file diff --git a/src/lua/bindings/gui/raw_imgui_callback.hpp b/src/lua/bindings/gui/raw_imgui_callback.hpp new file mode 100644 index 00000000..e49842ec --- /dev/null +++ b/src/lua/bindings/gui/raw_imgui_callback.hpp @@ -0,0 +1,20 @@ +#pragma once +#include "gui_element.hpp" +#include "lua/sol.hpp" + +namespace lua::gui +{ + // Lua API: Class + // Name: raw_imgui_callback + // Inherit: gui_element + // Class for representing a raw imgui callback. + class raw_imgui_callback : public gui_element + { + sol::protected_function m_callback; + + public: + raw_imgui_callback(sol::protected_function callback); + + void draw() override; + }; +} \ No newline at end of file diff --git a/src/lua/bindings/imgui.hpp b/src/lua/bindings/imgui.hpp new file mode 100644 index 00000000..6f39ea5f --- /dev/null +++ b/src/lua/bindings/imgui.hpp @@ -0,0 +1,3641 @@ +#pragma once +#include "lua/sol.hpp" + +namespace lua::imgui +{ + // Windows + inline bool Begin(const std::string& name) + { + return ImGui::Begin(name.c_str()); + } + inline bool Begin(const std::string& name, int flags) + { + return ImGui::Begin(name.c_str(), nullptr, flags); + } + inline std::tuple Begin(const std::string& name, bool open) + { + if (!open) + return std::make_tuple(false, false); + const bool shouldDraw = ImGui::Begin(name.c_str(), &open); + return std::make_tuple(open, open && shouldDraw); + } + inline std::tuple Begin(const std::string& name, bool open, int flags) + { + if (!open) + return std::make_tuple(false, false); + const bool shouldDraw = ImGui::Begin(name.c_str(), &open, flags); + return std::make_tuple(open, open && shouldDraw); + } + inline void End() + { + ImGui::End(); + } + + // Child Windows + inline bool BeginChild(const std::string& name) + { + return ImGui::BeginChild(name.c_str()); + } + inline bool BeginChild(const std::string& name, float sizeX) + { + return ImGui::BeginChild(name.c_str(), {sizeX, 0}); + } + inline bool BeginChild(const std::string& name, float sizeX, float sizeY) + { + return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}); + } + inline bool BeginChild(const std::string& name, float sizeX, float sizeY, bool border) + { + return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, border); + } + inline bool BeginChild(const std::string& name, float sizeX, float sizeY, bool border, int flags) + { + return ImGui::BeginChild(name.c_str(), {sizeX, sizeY}, border, flags); + } + inline void EndChild() + { + ImGui::EndChild(); + } + + // Windows Utilities + inline bool IsWindowAppearing() + { + return ImGui::IsWindowAppearing(); + } + inline bool IsWindowCollapsed() + { + return ImGui::IsWindowCollapsed(); + } + inline bool IsWindowFocused() + { + return ImGui::IsWindowFocused(); + } + inline bool IsWindowFocused(int flags) + { + return ImGui::IsWindowFocused(flags); + } + inline bool IsWindowHovered() + { + return ImGui::IsWindowHovered(); + } + inline bool IsWindowHovered(int flags) + { + return ImGui::IsWindowHovered(flags); + } + inline ImDrawList* GetWindowDrawList() + { + return ImGui::GetWindowDrawList(); + } + inline std::tuple GetWindowPos() + { + const auto vec2{ImGui::GetWindowPos()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetWindowSize() + { + const auto vec2{ImGui::GetWindowSize()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline float GetWindowWidth() + { + return ImGui::GetWindowWidth(); + } + inline float GetWindowHeight() + { + return ImGui::GetWindowHeight(); + } + + // Prefer using SetNext... + inline void SetNextWindowPos(float posX, float posY) + { + ImGui::SetNextWindowPos({posX, posY}); + } + inline void SetNextWindowPos(float posX, float posY, int cond) + { + ImGui::SetNextWindowPos({posX, posY}, cond); + } + inline void SetNextWindowPos(float posX, float posY, int cond, float pivotX, float pivotY) + { + ImGui::SetNextWindowPos({posX, posY}, cond, {pivotX, pivotY}); + } + inline void SetNextWindowSize(float sizeX, float sizeY) + { + ImGui::SetNextWindowSize({sizeX, sizeY}); + } + inline void SetNextWindowSize(float sizeX, float sizeY, int cond) + { + ImGui::SetNextWindowSize({sizeX, sizeY}, cond); + } + inline void SetNextWindowSizeConstraints(float minX, float minY, float maxX, float maxY) + { + ImGui::SetNextWindowSizeConstraints({minX, minY}, {maxX, maxY}); + } + inline void SetNextWindowContentSize(float sizeX, float sizeY) + { + ImGui::SetNextWindowContentSize({sizeX, sizeY}); + } + inline void SetNextWindowCollapsed(bool collapsed) + { + ImGui::SetNextWindowCollapsed(collapsed); + } + inline void SetNextWindowCollapsed(bool collapsed, int cond) + { + ImGui::SetNextWindowCollapsed(collapsed, cond); + } + inline void SetNextWindowFocus() + { + ImGui::SetNextWindowFocus(); + } + inline void SetNextWindowBgAlpha(float alpha) + { + ImGui::SetNextWindowBgAlpha(alpha); + } + inline void SetWindowPos(float posX, float posY) + { + ImGui::SetWindowPos({posX, posY}); + } + inline void SetWindowPos(float posX, float posY, int cond) + { + ImGui::SetWindowPos({posX, posY}, cond); + } + inline void SetWindowSize(float sizeX, float sizeY) + { + ImGui::SetWindowSize({sizeX, sizeY}); + } + inline void SetWindowSize(float sizeX, float sizeY, int cond) + { + ImGui::SetWindowSize({sizeX, sizeY}, cond); + } + inline void SetWindowCollapsed(bool collapsed) + { + ImGui::SetWindowCollapsed(collapsed); + } + inline void SetWindowCollapsed(bool collapsed, int cond) + { + ImGui::SetWindowCollapsed(collapsed, cond); + } + inline void SetWindowFocus() + { + ImGui::SetWindowFocus(); + } + inline void SetWindowFontScale(float scale) + { + ImGui::SetWindowFontScale(scale); + } + inline void SetWindowPos(const std::string& name, float posX, float posY) + { + ImGui::SetWindowPos(name.c_str(), {posX, posY}); + } + inline void SetWindowPos(const std::string& name, float posX, float posY, int cond) + { + ImGui::SetWindowPos(name.c_str(), {posX, posY}, cond); + } + inline void SetWindowSize(const std::string& name, float sizeX, float sizeY) + { + ImGui::SetWindowSize(name.c_str(), {sizeX, sizeY}); + } + inline void SetWindowSize(const std::string& name, float sizeX, float sizeY, int cond) + { + ImGui::SetWindowSize(name.c_str(), {sizeX, sizeY}, cond); + } + inline void SetWindowCollapsed(const std::string& name, bool collapsed) + { + ImGui::SetWindowCollapsed(name.c_str(), collapsed); + } + inline void SetWindowCollapsed(const std::string& name, bool collapsed, int cond) + { + ImGui::SetWindowCollapsed(name.c_str(), collapsed, cond); + } + inline void SetWindowFocus(const std::string& name) + { + ImGui::SetWindowFocus(name.c_str()); + } + + // Content Region + inline std::tuple GetContentRegionMax() + { + const auto vec2{ImGui::GetContentRegionMax()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetContentRegionAvail() + { + const auto vec2{ImGui::GetContentRegionAvail()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetWindowContentRegionMin() + { + const auto vec2{ImGui::GetWindowContentRegionMin()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetWindowContentRegionMax() + { + const auto vec2{ImGui::GetWindowContentRegionMax()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline float GetWindowContentRegionWidth() + { + return ImGui::GetWindowContentRegionWidth(); + } + + // Windows Scrolling + inline float GetScrollX() + { + return ImGui::GetScrollX(); + } + inline float GetScrollY() + { + return ImGui::GetScrollY(); + } + inline float GetScrollMaxX() + { + return ImGui::GetScrollMaxX(); + } + inline float GetScrollMaxY() + { + return ImGui::GetScrollMaxY(); + } + inline void SetScrollX(float scrollX) + { + ImGui::SetScrollX(scrollX); + } + inline void SetScrollY(float scrollY) + { + ImGui::SetScrollY(scrollY); + } + inline void SetScrollHereX() + { + ImGui::SetScrollHereX(); + } + inline void SetScrollHereX(float centerXRatio) + { + ImGui::SetScrollHereX(centerXRatio); + } + inline void SetScrollHereY() + { + ImGui::SetScrollHereY(); + } + inline void SetScrollHereY(float centerYRatio) + { + ImGui::SetScrollHereY(centerYRatio); + } + inline void SetScrollFromPosX(float localX) + { + ImGui::SetScrollFromPosX(localX); + } + inline void SetScrollFromPosX(float localX, float centerXRatio) + { + ImGui::SetScrollFromPosX(localX, centerXRatio); + } + inline void SetScrollFromPosY(float localY) + { + ImGui::SetScrollFromPosY(localY); + } + inline void SetScrollFromPosY(float localY, float centerYRatio) + { + ImGui::SetScrollFromPosY(localY, centerYRatio); + } + +// Parameters stacks (shared) +#ifdef SOL_IMGUI_ENABLE_FONT_MANIPULATORS + inline void PushFont(ImFont* pFont) + { + ImGui::PushFont(pFont); + } + inline void PopFont() + { + ImGui::PopFont(); + } +#endif // SOL_IMGUI_ENABLE_FONT_MANIPULATORS + inline void PushStyleColor(int idx, int col) + { + ImGui::PushStyleColor(idx, static_cast(col)); + } + inline void PushStyleColor(int idx, float colR, float colG, float colB, float colA) + { + ImGui::PushStyleColor(idx, {colR, colG, colB, colA}); + } + inline void PopStyleColor() + { + ImGui::PopStyleColor(); + } + inline void PopStyleColor(int count) + { + ImGui::PopStyleColor(count); + } + inline void PushStyleVar(int idx, float val) + { + ImGui::PushStyleVar(idx, val); + } + inline void PushStyleVar(int idx, float valX, float valY) + { + ImGui::PushStyleVar(idx, {valX, valY}); + } + inline void PopStyleVar() + { + ImGui::PopStyleVar(); + } + inline void PopStyleVar(int count) + { + ImGui::PopStyleVar(count); + } + inline std::tuple GetStyleColorVec4(int idx) + { + const auto col{ImGui::GetStyleColorVec4(idx)}; + return std::make_tuple(col.x, col.y, col.z, col.w); + } +#ifdef SOL_IMGUI_ENABLE_FONT_MANIPULATORS + inline ImFont* GetFont() + { + return ImGui::GetFont(); + } +#endif // SOL_IMGUI_ENABLE_FONT_MANIPULATORS + inline float GetFontSize() + { + return ImGui::GetFontSize(); + } + inline std::tuple GetFontTexUvWhitePixel() + { + const auto vec2{ImGui::GetFontTexUvWhitePixel()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline int GetColorU32(int idx, float alphaMul) + { + return ImGui::GetColorU32(idx, alphaMul); + } + inline int GetColorU32(float colR, float colG, float colB, float colA) + { + return ImGui::GetColorU32({colR, colG, colB, colA}); + } + inline int GetColorU32(int col) + { + return ImGui::GetColorU32(static_cast(col)); + } + + // Parameters stacks (current window) + inline void PushItemWidth(float itemWidth) + { + ImGui::PushItemWidth(itemWidth); + } + inline void PopItemWidth() + { + ImGui::PopItemWidth(); + } + inline void SetNextItemWidth(float itemWidth) + { + ImGui::SetNextItemWidth(itemWidth); + } + inline float CalcItemWidth() + { + return ImGui::CalcItemWidth(); + } + inline void PushTextWrapPos() + { + ImGui::PushTextWrapPos(); + } + inline void PushTextWrapPos(float wrapLocalPosX) + { + ImGui::PushTextWrapPos(wrapLocalPosX); + } + inline void PopTextWrapPos() + { + ImGui::PopTextWrapPos(); + } + inline void PushAllowKeyboardFocus(bool allowKeyboardFocus) + { + ImGui::PushAllowKeyboardFocus(allowKeyboardFocus); + } + inline void PopAllowKeyboardFocus() + { + ImGui::PopAllowKeyboardFocus(); + } + inline void PushButtonRepeat(bool repeat) + { + ImGui::PushButtonRepeat(repeat); + } + inline void PopButtonRepeat() + { + ImGui::PopButtonRepeat(); + } + + // Cursor / Layout + inline void Separator() + { + ImGui::Separator(); + } + inline void SameLine() + { + ImGui::SameLine(); + } + inline void SameLine(float offsetFromStartX) + { + ImGui::SameLine(offsetFromStartX); + } + inline void SameLine(float offsetFromStartX, float spacing) + { + ImGui::SameLine(offsetFromStartX, spacing); + } + inline void NewLine() + { + ImGui::NewLine(); + } + inline void Spacing() + { + ImGui::Spacing(); + } + inline void Dummy(float sizeX, float sizeY) + { + ImGui::Dummy({sizeX, sizeY}); + } + inline void Indent() + { + ImGui::Indent(); + } + inline void Indent(float indentW) + { + ImGui::Indent(indentW); + } + inline void Unindent() + { + ImGui::Unindent(); + } + inline void Unindent(float indentW) + { + ImGui::Unindent(indentW); + } + inline void BeginGroup() + { + ImGui::BeginGroup(); + } + inline void EndGroup() + { + ImGui::EndGroup(); + } + inline std::tuple GetCursorPos() + { + const auto vec2{ImGui::GetCursorPos()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline float GetCursorPosX() + { + return ImGui::GetCursorPosX(); + } + inline float GetCursorPosY() + { + return ImGui::GetCursorPosY(); + } + inline void SetCursorPos(float localX, float localY) + { + ImGui::SetCursorPos({localX, localY}); + } + inline void SetCursorPosX(float localX) + { + ImGui::SetCursorPosX(localX); + } + inline void SetCursorPosY(float localY) + { + ImGui::SetCursorPosY(localY); + } + inline std::tuple GetCursorStartPos() + { + const auto vec2{ImGui::GetCursorStartPos()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetCursorScreenPos() + { + const auto vec2{ImGui::GetCursorScreenPos()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline void SetCursorScreenPos(float posX, float posY) + { + ImGui::SetCursorScreenPos({posX, posY}); + } + inline void AlignTextToFramePadding() + { + ImGui::AlignTextToFramePadding(); + } + inline float GetTextLineHeight() + { + return ImGui::GetTextLineHeight(); + } + inline float GetTextLineHeightWithSpacing() + { + return ImGui::GetTextLineHeightWithSpacing(); + } + inline float GetFrameHeight() + { + return ImGui::GetFrameHeight(); + } + inline float GetFrameHeightWithSpacing() + { + return ImGui::GetFrameHeightWithSpacing(); + } + + // ID stack / scopes + inline void PushID(const std::string& stringID) + { + ImGui::PushID(stringID.c_str()); + } + inline void PushID(int intID) + { + ImGui::PushID(intID); + } + inline void PopID() + { + ImGui::PopID(); + } + inline int GetID(const std::string& stringID) + { + return ImGui::GetID(stringID.c_str()); + } + + // Widgets: Text + inline void TextUnformatted(const std::string& text) + { + ImGui::TextUnformatted(text.c_str()); + } + inline void Text(const std::string& text) + { + ImGui::TextUnformatted(text.c_str()); + } // TODO - make this proper call to ImGui::Text, allowing real formatting! + inline void TextColored(float colR, float colG, float colB, float colA, const std::string& text) + { + ImGui::TextColored({colR, colG, colB, colA}, "%s", text.c_str()); + } + inline void TextDisabled(const std::string& text) + { + ImGui::TextDisabled("%s", text.c_str()); + } + inline void TextWrapped(const std::string& text) + { + ImGui::TextWrapped("%s", text.c_str()); + } + inline void LabelText(const std::string& label, const std::string& text) + { + ImGui::LabelText(label.c_str(), "%s", text.c_str()); + } + inline void BulletText(const std::string& text) + { + ImGui::BulletText("%s", text.c_str()); + } + + // Widgets: Main + inline bool Button(const std::string& label) + { + return ImGui::Button(label.c_str()); + } + inline bool Button(const std::string& label, float sizeX, float sizeY) + { + return ImGui::Button(label.c_str(), {sizeX, sizeY}); + } + inline bool SmallButton(const std::string& label) + { + return ImGui::SmallButton(label.c_str()); + } + inline bool InvisibleButton(const std::string& stringID, float sizeX, float sizeY) + { + return ImGui::InvisibleButton(stringID.c_str(), {sizeX, sizeY}); + } + inline bool ArrowButton(const std::string& stringID, int dir) + { + return ImGui::ArrowButton(stringID.c_str(), static_cast(dir)); + } + inline void Image() + { /* TODO: Image(...) ==> UNSUPPORTED */ + } + inline void ImageButton() + { /* TODO: ImageButton(...) ==> UNSUPPORTED */ + } + inline std::tuple Checkbox(const std::string& label, bool v) + { + bool value{v}; + bool pressed = ImGui::Checkbox(label.c_str(), &value); + + return std::make_tuple(value, pressed); + } + inline bool CheckboxFlags() + { + return false; /* TODO: CheckboxFlags(...) ==> UNSUPPORTED */ + } + inline bool RadioButton(const std::string& label, bool active) + { + return ImGui::RadioButton(label.c_str(), active); + } + inline std::tuple RadioButton(const std::string& label, int v, int vButton) + { + bool ret{ImGui::RadioButton(label.c_str(), &v, vButton)}; + return std::make_tuple(v, ret); + } + inline void ProgressBar(float fraction) + { + ImGui::ProgressBar(fraction); + } + inline void ProgressBar(float fraction, float sizeX, float sizeY) + { + ImGui::ProgressBar(fraction, {sizeX, sizeY}); + } + inline void ProgressBar(float fraction, float sizeX, float sizeY, const std::string& overlay) + { + ImGui::ProgressBar(fraction, {sizeX, sizeY}, overlay.c_str()); + } + inline void Bullet() + { + ImGui::Bullet(); + } + + // Widgets: Combo Box + inline bool BeginCombo(const std::string& label, const std::string& previewValue) + { + return ImGui::BeginCombo(label.c_str(), previewValue.c_str()); + } + inline bool BeginCombo(const std::string& label, const std::string& previewValue, int flags) + { + return ImGui::BeginCombo(label.c_str(), previewValue.c_str(), flags); + } + inline void EndCombo() + { + ImGui::EndCombo(); + } + inline std::tuple Combo(const std::string& label, int currentItem, const sol::table& items, int itemsCount) + { + std::vector strings; + strings.reserve(itemsCount); + std::vector cstrings; + cstrings.reserve(itemsCount); + for (int i{1}; i <= itemsCount; i++) + { + const auto& stringItem = items.get>(i); + cstrings.emplace_back(strings.emplace_back(std::move(stringItem.value_or("Missing"))).c_str()); + } + + bool clicked = ImGui::Combo(label.c_str(), ¤tItem, cstrings.data(), itemsCount); + return std::make_tuple(currentItem, clicked); + } + inline std::tuple Combo(const std::string& label, int currentItem, const sol::table& items, int itemsCount, int popupMaxHeightInItems) + { + std::vector strings; + strings.reserve(itemsCount); + std::vector cstrings; + cstrings.reserve(itemsCount); + for (int i{1}; i <= itemsCount; i++) + { + const auto& stringItem = items.get>(i); + cstrings.emplace_back(strings.emplace_back(std::move(stringItem.value_or("Missing"))).c_str()); + } + + bool clicked = ImGui::Combo(label.c_str(), ¤tItem, cstrings.data(), itemsCount, popupMaxHeightInItems); + return std::make_tuple(currentItem, clicked); + } + inline std::tuple Combo(const std::string& label, int currentItem, const std::string& itemsSeparatedByZeros) + { + bool clicked = ImGui::Combo(label.c_str(), ¤tItem, itemsSeparatedByZeros.c_str()); + return std::make_tuple(currentItem, clicked); + } + inline std::tuple Combo(const std::string& label, int currentItem, const std::string& itemsSeparatedByZeros, int popupMaxHeightInItems) + { + bool clicked = ImGui::Combo(label.c_str(), ¤tItem, itemsSeparatedByZeros.c_str(), popupMaxHeightInItems); + return std::make_tuple(currentItem, clicked); + } + // TODO: 3rd Combo from ImGui not Supported + + // Widgets: Drags + inline std::tuple DragFloat(const std::string& label, float v) + { + bool used = ImGui::DragFloat(label.c_str(), &v); + return std::make_tuple(v, used); + } + inline std::tuple DragFloat(const std::string& label, float v, float v_speed) + { + bool used = ImGui::DragFloat(label.c_str(), &v, v_speed); + return std::make_tuple(v, used); + } + inline std::tuple DragFloat(const std::string& label, float v, float v_speed, float v_min) + { + bool used = ImGui::DragFloat(label.c_str(), &v, v_speed, v_min); + return std::make_tuple(v, used); + } + inline std::tuple DragFloat(const std::string& label, float v, float v_speed, float v_min, float v_max) + { + bool used = ImGui::DragFloat(label.c_str(), &v, v_speed, v_min, v_max); + return std::make_tuple(v, used); + } + inline std::tuple DragFloat(const std::string& label, float v, float v_speed, float v_min, float v_max, const std::string& format) + { + bool used = ImGui::DragFloat(label.c_str(), &v, v_speed, v_min, v_max, format.c_str()); + return std::make_tuple(v, used); + } + inline std::tuple DragFloat(const std::string& label, float v, float v_speed, float v_min, float v_max, const std::string& format, int flags) + { + bool used = ImGui::DragFloat(label.c_str(), &v, v_speed, v_min, v_max, format.c_str(), flags); + return std::make_tuple(v, used); + } + inline std::tuple>, bool> DragFloat2(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragFloat2(label.c_str(), value); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> DragFloat2(const std::string& label, const sol::table& v, float v_speed) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragFloat2(label.c_str(), value, v_speed); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> DragFloat2(const std::string& label, const sol::table& v, float v_speed, float v_min) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragFloat2(label.c_str(), value, v_speed, v_min); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> DragFloat2(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragFloat2(label.c_str(), value, v_speed, v_min, v_max); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> DragFloat2(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragFloat2(label.c_str(), value, v_speed, v_min, v_max, format.c_str()); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> DragFloat2(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragFloat2(label.c_str(), value, v_speed, v_min, v_max, format.c_str(), flags); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> DragFloat3(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragFloat3(label.c_str(), value); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> DragFloat3(const std::string& label, const sol::table& v, float v_speed) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragFloat3(label.c_str(), value, v_speed); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> DragFloat3(const std::string& label, const sol::table& v, float v_speed, float v_min) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragFloat3(label.c_str(), value, v_speed, v_min); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> DragFloat3(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragFloat3(label.c_str(), value, v_speed, v_min, v_max); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> DragFloat3(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragFloat3(label.c_str(), value, v_speed, v_min, v_max, format.c_str()); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> DragFloat3(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragFloat3(label.c_str(), value, v_speed, v_min, v_max, format.c_str(), flags); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> DragFloat4(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragFloat4(label.c_str(), value); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> DragFloat4(const std::string& label, const sol::table& v, float v_speed) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragFloat4(label.c_str(), value, v_speed); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> DragFloat4(const std::string& label, const sol::table& v, float v_speed, float v_min) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragFloat4(label.c_str(), value, v_speed, v_min); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> DragFloat4(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragFloat4(label.c_str(), value, v_speed, v_min, v_max); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> DragFloat4(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragFloat4(label.c_str(), value, v_speed, v_min, v_max, format.c_str()); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> DragFloat4(const std::string& label, const sol::table& v, float v_speed, float v_min, float v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragFloat4(label.c_str(), value, v_speed, v_min, v_max, format.c_str(), flags); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline void DragFloatRange2() + { /* TODO: DragFloatRange2(...) ==> UNSUPPORTED */ + } + inline std::tuple DragInt(const std::string& label, int v) + { + bool used = ImGui::DragInt(label.c_str(), &v); + return std::make_tuple(v, used); + } + inline std::tuple DragInt(const std::string& label, int v, float v_speed) + { + bool used = ImGui::DragInt(label.c_str(), &v, v_speed); + return std::make_tuple(v, used); + } + inline std::tuple DragInt(const std::string& label, int v, float v_speed, int v_min) + { + bool used = ImGui::DragInt(label.c_str(), &v, v_speed, v_min); + return std::make_tuple(v, used); + } + inline std::tuple DragInt(const std::string& label, int v, float v_speed, int v_min, int v_max) + { + bool used = ImGui::DragInt(label.c_str(), &v, v_speed, v_min, v_max); + return std::make_tuple(v, used); + } + inline std::tuple DragInt(const std::string& label, int v, float v_speed, int v_min, int v_max, const std::string& format) + { + bool used = ImGui::DragInt(label.c_str(), &v, v_speed, v_min, v_max, format.c_str()); + return std::make_tuple(v, used); + } + inline std::tuple DragInt(const std::string& label, int v, float v_speed, int v_min, int v_max, const std::string& format, int flags) + { + bool used = ImGui::DragInt(label.c_str(), &v, v_speed, v_min, v_max, format.c_str(), flags); + return std::make_tuple(v, used); + } + inline std::tuple>, bool> DragInt2(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragInt2(label.c_str(), value); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> DragInt2(const std::string& label, const sol::table& v, float v_speed) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragInt2(label.c_str(), value, v_speed); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> DragInt2(const std::string& label, const sol::table& v, float v_speed, int v_min) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragInt2(label.c_str(), value, v_speed, v_min); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> DragInt2(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragInt2(label.c_str(), value, v_speed, v_min, v_max); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> DragInt2(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragInt2(label.c_str(), value, v_speed, v_min, v_max, format.c_str()); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> DragInt2(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::DragInt2(label.c_str(), value, v_speed, v_min, v_max, format.c_str(), flags); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> DragInt3(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragInt3(label.c_str(), value); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> DragInt3(const std::string& label, const sol::table& v, float v_speed) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragInt3(label.c_str(), value, v_speed); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> DragInt3(const std::string& label, const sol::table& v, float v_speed, int v_min) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragInt3(label.c_str(), value, v_speed, v_min); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> DragInt3(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragInt3(label.c_str(), value, v_speed, v_min, v_max); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> DragInt3(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragInt3(label.c_str(), value, v_speed, v_min, v_max, format.c_str()); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> DragInt3(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::DragInt3(label.c_str(), value, v_speed, v_min, v_max, format.c_str(), flags); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> DragInt4(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragInt4(label.c_str(), value); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> DragInt4(const std::string& label, const sol::table& v, float v_speed) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragInt4(label.c_str(), value, v_speed); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> DragInt4(const std::string& label, const sol::table& v, float v_speed, int v_min) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragInt4(label.c_str(), value, v_speed, v_min); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> DragInt4(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragInt4(label.c_str(), value, v_speed, v_min, v_max); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> DragInt4(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragInt4(label.c_str(), value, v_speed, v_min, v_max, format.c_str()); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> DragInt4(const std::string& label, const sol::table& v, float v_speed, int v_min, int v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::DragInt4(label.c_str(), value, v_speed, v_min, v_max, format.c_str(), flags); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline void DragIntRange2() + { /* TODO: DragIntRange2(...) ==> UNSUPPORTED */ + } + inline void DragScalar() + { /* TODO: DragScalar(...) ==> UNSUPPORTED */ + } + inline void DragScalarN() + { /* TODO: DragScalarN(...) ==> UNSUPPORTED */ + } + + // Widgets: Sliders + inline std::tuple SliderFloat(const std::string& label, float v, float v_min, float v_max) + { + bool used = ImGui::SliderFloat(label.c_str(), &v, v_min, v_max); + return std::make_tuple(v, used); + } + inline std::tuple SliderFloat(const std::string& label, float v, float v_min, float v_max, const std::string& format) + { + bool used = ImGui::SliderFloat(label.c_str(), &v, v_min, v_max, format.c_str()); + return std::make_tuple(v, used); + } + inline std::tuple SliderFloat(const std::string& label, float v, float v_min, float v_max, const std::string& format, int flags) + { + bool used = ImGui::SliderFloat(label.c_str(), &v, v_min, v_max, format.c_str(), flags); + return std::make_tuple(v, used); + } + inline std::tuple>, bool> SliderFloat2(const std::string& label, const sol::table& v, float v_min, float v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::SliderFloat2(label.c_str(), value, v_min, v_max); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> SliderFloat2(const std::string& label, const sol::table& v, float v_min, float v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::SliderFloat2(label.c_str(), value, v_min, v_max, format.c_str()); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> SliderFloat2(const std::string& label, const sol::table& v, float v_min, float v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::SliderFloat2(label.c_str(), value, v_min, v_max, format.c_str(), flags); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> SliderFloat3(const std::string& label, const sol::table& v, float v_min, float v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[3]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> SliderFloat3(const std::string& label, const sol::table& v, float v_min, float v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max, format.c_str()); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[3]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> SliderFloat3(const std::string& label, const sol::table& v, float v_min, float v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max, format.c_str(), flags); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[3]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> SliderFloat4(const std::string& label, const sol::table& v, float v_min, float v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::SliderFloat4(label.c_str(), value, v_min, v_max); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> SliderFloat4(const std::string& label, const sol::table& v, float v_min, float v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::SliderFloat4(label.c_str(), value, v_min, v_max, format.c_str()); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> SliderFloat4(const std::string& label, const sol::table& v, float v_min, float v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::SliderFloat4(label.c_str(), value, v_min, v_max, format.c_str(), flags); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple SliderAngle(const std::string& label, float v_rad) + { + bool used = ImGui::SliderAngle(label.c_str(), &v_rad); + return std::make_tuple(v_rad, used); + } + inline std::tuple SliderAngle(const std::string& label, float v_rad, float v_degrees_min) + { + bool used = ImGui::SliderAngle(label.c_str(), &v_rad, v_degrees_min); + return std::make_tuple(v_rad, used); + } + inline std::tuple SliderAngle(const std::string& label, float v_rad, float v_degrees_min, float v_degrees_max) + { + bool used = ImGui::SliderAngle(label.c_str(), &v_rad, v_degrees_min, v_degrees_max); + return std::make_tuple(v_rad, used); + } + inline std::tuple SliderAngle(const std::string& label, float v_rad, float v_degrees_min, float v_degrees_max, const std::string& format) + { + bool used = ImGui::SliderAngle(label.c_str(), &v_rad, v_degrees_min, v_degrees_max, format.c_str()); + return std::make_tuple(v_rad, used); + } + inline std::tuple SliderAngle(const std::string& label, float v_rad, float v_degrees_min, float v_degrees_max, const std::string& format, int flags) + { + bool used = ImGui::SliderAngle(label.c_str(), &v_rad, v_degrees_min, v_degrees_max, format.c_str(), flags); + return std::make_tuple(v_rad, used); + } + inline std::tuple SliderInt(const std::string& label, int v, int v_min, int v_max) + { + bool used = ImGui::SliderInt(label.c_str(), &v, v_min, v_max); + return std::make_tuple(v, used); + } + inline std::tuple SliderInt(const std::string& label, int v, int v_min, int v_max, const std::string& format) + { + bool used = ImGui::SliderInt(label.c_str(), &v, v_min, v_max, format.c_str()); + return std::make_tuple(v, used); + } + inline std::tuple SliderInt(const std::string& label, int v, int v_min, int v_max, const std::string& format, int flags) + { + bool used = ImGui::SliderInt(label.c_str(), &v, v_min, v_max, format.c_str(), flags); + return std::make_tuple(v, used); + } + inline std::tuple>, bool> SliderInt2(const std::string& label, const sol::table& v, int v_min, int v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::SliderInt2(label.c_str(), value, v_min, v_max); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> SliderInt2(const std::string& label, const sol::table& v, int v_min, int v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::SliderInt2(label.c_str(), value, v_min, v_max, format.c_str()); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> SliderInt2(const std::string& label, const sol::table& v, int v_min, int v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::SliderInt2(label.c_str(), value, v_min, v_max, format.c_str(), flags); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> SliderInt3(const std::string& label, const sol::table& v, int v_min, int v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::SliderInt3(label.c_str(), value, v_min, v_max); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> SliderInt3(const std::string& label, const sol::table& v, int v_min, int v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::SliderInt3(label.c_str(), value, v_min, v_max, format.c_str()); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> SliderInt3(const std::string& label, const sol::table& v, int v_min, int v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::SliderInt3(label.c_str(), value, v_min, v_max, format.c_str(), flags); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> SliderInt4(const std::string& label, const sol::table& v, int v_min, int v_max) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::SliderInt4(label.c_str(), value, v_min, v_max); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> SliderInt4(const std::string& label, const sol::table& v, int v_min, int v_max, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::SliderInt4(label.c_str(), value, v_min, v_max, format.c_str()); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> SliderInt4(const std::string& label, const sol::table& v, int v_min, int v_max, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::SliderInt4(label.c_str(), value, v_min, v_max, format.c_str(), flags); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline void SliderScalar() + { /* TODO: SliderScalar(...) ==> UNSUPPORTED */ + } + inline void SliderScalarN() + { /* TODO: SliderScalarN(...) ==> UNSUPPORTED */ + } + inline std::tuple VSliderFloat(const std::string& label, float sizeX, float sizeY, float v, float v_min, float v_max) + { + bool used = ImGui::VSliderFloat(label.c_str(), {sizeX, sizeY}, &v, v_min, v_max); + return std::make_tuple(v, used); + } + inline std::tuple VSliderFloat(const std::string& label, float sizeX, float sizeY, float v, float v_min, float v_max, const std::string& format) + { + bool used = ImGui::VSliderFloat(label.c_str(), {sizeX, sizeY}, &v, v_min, v_max, format.c_str()); + return std::make_tuple(v, used); + } + inline std::tuple VSliderFloat(const std::string& label, float sizeX, float sizeY, float v, float v_min, float v_max, const std::string& format, int flags) + { + bool used = ImGui::VSliderFloat(label.c_str(), {sizeX, sizeY}, &v, v_min, v_max, format.c_str(), flags); + return std::make_tuple(v, used); + } + inline std::tuple VSliderInt(const std::string& label, float sizeX, float sizeY, int v, int v_min, int v_max) + { + bool used = ImGui::VSliderInt(label.c_str(), {sizeX, sizeY}, &v, v_min, v_max); + return std::make_tuple(v, used); + } + inline std::tuple VSliderInt(const std::string& label, float sizeX, float sizeY, int v, int v_min, int v_max, const std::string& format) + { + bool used = ImGui::VSliderInt(label.c_str(), {sizeX, sizeY}, &v, v_min, v_max, format.c_str()); + return std::make_tuple(v, used); + } + inline std::tuple VSliderInt(const std::string& label, float sizeX, float sizeY, int v, int v_min, int v_max, const std::string& format, int flags) + { + bool used = ImGui::VSliderInt(label.c_str(), {sizeX, sizeY}, &v, v_min, v_max, format.c_str(), flags); + return std::make_tuple(v, used); + } + inline void VSliderScalar() + { /* TODO: VSliderScalar(...) ==> UNSUPPORTED */ + } + + // Widgets: Input with Keyboard + inline std::tuple InputText(const std::string& label, std::string text, unsigned int buf_size) + { + text.resize(buf_size); + bool selected = ImGui::InputText(label.c_str(), text.data(), buf_size); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputText(const std::string& label, std::string text, unsigned int buf_size, int flags) + { + text.resize(buf_size); + bool selected = ImGui::InputText(label.c_str(), text.data(), buf_size, flags); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputTextMultiline(const std::string& label, std::string text, unsigned int buf_size) + { + text.resize(buf_size); + bool selected = ImGui::InputTextMultiline(label.c_str(), text.data(), buf_size); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputTextMultiline(const std::string& label, std::string text, unsigned int buf_size, float sizeX, float sizeY) + { + text.resize(buf_size); + bool selected = ImGui::InputTextMultiline(label.c_str(), text.data(), buf_size, {sizeX, sizeY}); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputTextMultiline(const std::string& label, std::string text, unsigned int buf_size, float sizeX, float sizeY, int flags) + { + text.resize(buf_size); + bool selected = ImGui::InputTextMultiline(label.c_str(), text.data(), buf_size, {sizeX, sizeY}, flags); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputTextWithHint(const std::string& label, const std::string& hint, std::string text, unsigned int buf_size) + { + text.resize(buf_size); + bool selected = ImGui::InputTextWithHint(label.c_str(), hint.c_str(), text.data(), buf_size); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputTextWithHint(const std::string& label, const std::string& hint, std::string text, unsigned int buf_size, int flags) + { + text.resize(buf_size); + bool selected = ImGui::InputTextWithHint(label.c_str(), hint.c_str(), text.data(), buf_size, flags); + return std::make_tuple(text.c_str(), selected); + } + inline std::tuple InputFloat(const std::string& label, float v) + { + bool selected = ImGui::InputFloat(label.c_str(), &v); + return std::make_tuple(v, selected); + } + inline std::tuple InputFloat(const std::string& label, float v, float step) + { + bool selected = ImGui::InputFloat(label.c_str(), &v, step); + return std::make_tuple(v, selected); + } + inline std::tuple InputFloat(const std::string& label, float v, float step, float step_fast) + { + bool selected = ImGui::InputFloat(label.c_str(), &v, step, step_fast); + return std::make_tuple(v, selected); + } + inline std::tuple InputFloat(const std::string& label, float v, float step, float step_fast, const std::string& format) + { + bool selected = ImGui::InputFloat(label.c_str(), &v, step, step_fast, format.c_str()); + return std::make_tuple(v, selected); + } + inline std::tuple InputFloat(const std::string& label, float v, float step, float step_fast, const std::string& format, int flags) + { + bool selected = ImGui::InputFloat(label.c_str(), &v, step, step_fast, format.c_str(), flags); + return std::make_tuple(v, selected); + } + inline std::tuple>, bool> InputFloat2(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::InputFloat2(label.c_str(), value); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> InputFloat2(const std::string& label, const sol::table& v, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::InputFloat2(label.c_str(), value, format.c_str()); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> InputFloat2(const std::string& label, const sol::table& v, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + float value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::InputFloat2(label.c_str(), value, format.c_str(), flags); + + sol::as_table_t float2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(float2, used); + } + inline std::tuple>, bool> InputFloat3(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::InputFloat3(label.c_str(), value); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> InputFloat3(const std::string& label, const sol::table& v, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::InputFloat3(label.c_str(), value, format.c_str()); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> InputFloat3(const std::string& label, const sol::table& v, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + float value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::InputFloat3(label.c_str(), value, format.c_str(), flags); + + sol::as_table_t float3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(float3, used); + } + inline std::tuple>, bool> InputFloat4(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::InputFloat4(label.c_str(), value); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> InputFloat4(const std::string& label, const sol::table& v, const std::string& format) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::InputFloat4(label.c_str(), value, format.c_str()); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple>, bool> InputFloat4(const std::string& label, const sol::table& v, const std::string& format, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + float value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::InputFloat4(label.c_str(), value, format.c_str(), flags); + + sol::as_table_t float4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(float4, used); + } + inline std::tuple InputInt(const std::string& label, int v) + { + bool selected = ImGui::InputInt(label.c_str(), &v); + return std::make_tuple(v, selected); + } + inline std::tuple InputInt(const std::string& label, int v, int step) + { + bool selected = ImGui::InputInt(label.c_str(), &v, step); + return std::make_tuple(v, selected); + } + inline std::tuple InputInt(const std::string& label, int v, int step, int step_fast) + { + bool selected = ImGui::InputInt(label.c_str(), &v, step, step_fast); + return std::make_tuple(v, selected); + } + inline std::tuple InputInt(const std::string& label, int v, int step, int step_fast, int flags) + { + bool selected = ImGui::InputInt(label.c_str(), &v, step, step_fast, flags); + return std::make_tuple(v, selected); + } + inline std::tuple>, bool> InputInt2(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::InputInt2(label.c_str(), value); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> InputInt2(const std::string& label, const sol::table& v, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}; + int value[2] = {static_cast(v1), static_cast(v2)}; + bool used = ImGui::InputInt2(label.c_str(), value, flags); + + sol::as_table_t int2 = sol::as_table(std::vector{value[0], value[1]}); + + return std::make_tuple(int2, used); + } + inline std::tuple>, bool> InputInt3(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::InputInt3(label.c_str(), value); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> InputInt3(const std::string& label, const sol::table& v, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}; + int value[3] = {static_cast(v1), static_cast(v2), static_cast(v3)}; + bool used = ImGui::InputInt3(label.c_str(), value, flags); + + sol::as_table_t int3 = sol::as_table(std::vector{value[0], value[1], value[2]}); + + return std::make_tuple(int3, used); + } + inline std::tuple>, bool> InputInt4(const std::string& label, const sol::table& v) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::InputInt4(label.c_str(), value); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple>, bool> InputInt4(const std::string& label, const sol::table& v, int flags) + { + const lua_Number v1{v[1].get>().value_or(static_cast(0))}, + v2{v[2].get>().value_or(static_cast(0))}, + v3{v[3].get>().value_or(static_cast(0))}, + v4{v[4].get>().value_or(static_cast(0))}; + int value[4] = {static_cast(v1), static_cast(v2), static_cast(v3), static_cast(v4)}; + bool used = ImGui::InputInt4(label.c_str(), value, flags); + + sol::as_table_t int4 = sol::as_table(std::vector{value[0], value[1], value[2], value[3]}); + + return std::make_tuple(int4, used); + } + inline std::tuple InputDouble(const std::string& label, double v) + { + bool selected = ImGui::InputDouble(label.c_str(), &v); + return std::make_tuple(v, selected); + } + inline std::tuple InputDouble(const std::string& label, double v, double step) + { + bool selected = ImGui::InputDouble(label.c_str(), &v, step); + return std::make_tuple(v, selected); + } + inline std::tuple InputDouble(const std::string& label, double v, double step, double step_fast) + { + bool selected = ImGui::InputDouble(label.c_str(), &v, step, step_fast); + return std::make_tuple(v, selected); + } + inline std::tuple InputDouble(const std::string& label, double v, double step, double step_fast, const std::string& format) + { + bool selected = ImGui::InputDouble(label.c_str(), &v, step, step_fast, format.c_str()); + return std::make_tuple(v, selected); + } + inline std::tuple InputDouble(const std::string& label, double v, double step, double step_fast, const std::string& format, int flags) + { + bool selected = ImGui::InputDouble(label.c_str(), &v, step, step_fast, format.c_str(), flags); + return std::make_tuple(v, selected); + } + inline void InputScalar() + { /* TODO: InputScalar(...) ==> UNSUPPORTED */ + } + inline void InputScalarN() + { /* TODO: InputScalarN(...) ==> UNSUPPORTED */ + } + + // Widgets: Color Editor / Picker + inline std::tuple>, bool> ColorEdit3(const std::string& label, const sol::table& col) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}; + float color[3] = {static_cast(r), static_cast(g), static_cast(b)}; + bool used = ImGui::ColorEdit3(label.c_str(), color); + + sol::as_table_t rgb = sol::as_table(std::vector{color[0], color[1], color[2]}); + + return std::make_tuple(rgb, used); + } + inline std::tuple>, bool> ColorEdit3(const std::string& label, const sol::table& col, int flags) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}; + float color[3] = {static_cast(r), static_cast(g), static_cast(b)}; + bool used = ImGui::ColorEdit3(label.c_str(), color, flags); + + sol::as_table_t rgb = sol::as_table(std::vector{color[0], color[1], color[2]}); + + return std::make_tuple(rgb, used); + } + inline std::tuple>, bool> ColorEdit4(const std::string& label, const sol::table& col) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + float color[4] = {static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + bool used = ImGui::ColorEdit4(label.c_str(), color); + + sol::as_table_t rgba = sol::as_table(std::vector{color[0], color[1], color[2], color[3]}); + + return std::make_tuple(rgba, used); + } + inline std::tuple>, bool> ColorEdit4(const std::string& label, const sol::table& col, int flags) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + float color[4] = {static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + bool used = ImGui::ColorEdit4(label.c_str(), color, flags); + + sol::as_table_t rgba = sol::as_table(std::vector{color[0], color[1], color[2], color[3]}); + + return std::make_tuple(rgba, used); + } + inline std::tuple>, bool> ColorPicker3(const std::string& label, const sol::table& col) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}; + float color[3] = {static_cast(r), static_cast(g), static_cast(b)}; + bool used = ImGui::ColorPicker3(label.c_str(), color); + + sol::as_table_t rgb = sol::as_table(std::vector{color[0], color[1], color[2]}); + + return std::make_tuple(rgb, used); + } + inline std::tuple>, bool> ColorPicker3(const std::string& label, const sol::table& col, int flags) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}; + float color[3] = {static_cast(r), static_cast(g), static_cast(b)}; + bool used = ImGui::ColorPicker3(label.c_str(), color, flags); + + sol::as_table_t rgb = sol::as_table(std::vector{color[0], color[1], color[2]}); + + return std::make_tuple(rgb, used); + } + inline std::tuple>, bool> ColorPicker4(const std::string& label, const sol::table& col) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + float color[4] = {static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + bool used = ImGui::ColorPicker4(label.c_str(), color); + + sol::as_table_t rgba = sol::as_table(std::vector{color[0], color[1], color[2], color[3]}); + + return std::make_tuple(rgba, used); + } + inline std::tuple>, bool> ColorPicker4(const std::string& label, const sol::table& col, int flags) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + float color[4] = {static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + bool used = ImGui::ColorPicker4(label.c_str(), color, flags); + + sol::as_table_t rgba = sol::as_table(std::vector{color[0], color[1], color[2], color[3]}); + + return std::make_tuple(rgba, used); + } + inline bool ColorButton(const std::string& desc_id, const sol::table& col) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + const ImVec4 color{static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + return ImGui::ColorButton(desc_id.c_str(), color); + } + inline bool ColorButton(const std::string& desc_id, const sol::table& col, int flags) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + const ImVec4 color{static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + return ImGui::ColorButton(desc_id.c_str(), color, flags); + } + inline bool ColorButton(const std::string& desc_id, const sol::table& col, int flags, float sizeX, float sizeY) + { + const lua_Number r{col[1].get>().value_or(static_cast(0))}, + g{col[2].get>().value_or(static_cast(0))}, + b{col[3].get>().value_or(static_cast(0))}, + a{col[4].get>().value_or(static_cast(0))}; + const ImVec4 color{static_cast(r), static_cast(g), static_cast(b), static_cast(a)}; + return ImGui::ColorButton(desc_id.c_str(), color, flags, {sizeX, sizeY}); + } + inline void SetColorEditOptions(int flags) + { + ImGui::SetColorEditOptions(flags); + } + + // Widgets: Trees + inline bool TreeNode(const std::string& label) + { + return ImGui::TreeNode(label.c_str()); + } + inline bool TreeNode(const std::string& label, const std::string& fmt) + { + return ImGui::TreeNode(label.c_str(), "%s", fmt.c_str()); + } + /* TODO: TreeNodeV(...) (2) ==> UNSUPPORTED */ + inline bool TreeNodeEx(const std::string& label) + { + return ImGui::TreeNodeEx(label.c_str()); + } + inline bool TreeNodeEx(const std::string& label, int flags) + { + return ImGui::TreeNodeEx(label.c_str(), flags); + } + inline bool TreeNodeEx(const std::string& label, int flags, const std::string& fmt) + { + return ImGui::TreeNodeEx(label.c_str(), flags, "%s", fmt.c_str()); + } + /* TODO: TreeNodeExV(...) (2) ==> UNSUPPORTED */ + inline void TreePush(const std::string& str_id) + { + ImGui::TreePush(str_id.c_str()); + } + /* TODO: TreePush(const void*) ==> UNSUPPORTED */ + inline void TreePop() + { + ImGui::TreePop(); + } + inline float GetTreeNodeToLabelSpacing() + { + return ImGui::GetTreeNodeToLabelSpacing(); + } + inline bool CollapsingHeader(const std::string& label) + { + return ImGui::CollapsingHeader(label.c_str()); + } + inline bool CollapsingHeader(const std::string& label, int flags) + { + return ImGui::CollapsingHeader(label.c_str(), flags); + } + inline std::tuple CollapsingHeader(const std::string& label, bool open) + { + bool notCollapsed = ImGui::CollapsingHeader(label.c_str(), &open); + return std::make_tuple(open, notCollapsed); + } + inline std::tuple CollapsingHeader(const std::string& label, bool open, int flags) + { + bool notCollapsed = ImGui::CollapsingHeader(label.c_str(), &open, flags); + return std::make_tuple(open, notCollapsed); + } + inline void SetNextItemOpen(bool is_open) + { + ImGui::SetNextItemOpen(is_open); + } + inline void SetNextItemOpen(bool is_open, int cond) + { + ImGui::SetNextItemOpen(is_open, cond); + } + + // Widgets: Selectables + // TODO: Only one of Selectable variations is possible due to same parameters for Lua + inline bool Selectable(const std::string& label) + { + return ImGui::Selectable(label.c_str()); + } + inline bool Selectable(const std::string& label, bool selected) + { + ImGui::Selectable(label.c_str(), &selected); + return selected; + } + inline bool Selectable(const std::string& label, bool selected, int flags) + { + ImGui::Selectable(label.c_str(), &selected, flags); + return selected; + } + inline bool Selectable(const std::string& label, bool selected, int flags, float sizeX, float sizeY) + { + ImGui::Selectable(label.c_str(), &selected, flags, {sizeX, sizeY}); + return selected; + } + + // Widgets: List Boxes + inline std::tuple ListBox(const std::string& label, int current_item, const sol::table& items, int items_count) + { + std::vector strings; + for (int i{1}; i <= items_count; i++) + { + const auto& stringItem = items.get>(i); + strings.emplace_back(stringItem.value_or("Missing")); + } + + std::vector cstrings; + for (auto& string : strings) + cstrings.emplace_back(string.c_str()); + + bool clicked = ImGui::ListBox(label.c_str(), ¤t_item, cstrings.data(), items_count); + return std::make_tuple(current_item, clicked); + } + inline std::tuple ListBox(const std::string& label, int current_item, const sol::table& items, int items_count, int height_in_items) + { + std::vector strings; + for (int i{1}; i <= items_count; i++) + { + const auto& stringItem = items.get>(i); + strings.emplace_back(stringItem.value_or("Missing")); + } + + std::vector cstrings; + for (auto& string : strings) + cstrings.emplace_back(string.c_str()); + + bool clicked = ImGui::ListBox(label.c_str(), ¤t_item, cstrings.data(), items_count, height_in_items); + return std::make_tuple(current_item, clicked); + } + inline bool BeginListBox(const std::string& label) + { + return ImGui::BeginListBox(label.c_str()); + } + inline bool BeginListBox(const std::string& label, float sizeX, float sizeY) + { + return ImGui::BeginListBox(label.c_str(), {sizeX, sizeY}); + } + inline void EndListBox() + { + ImGui::EndListBox(); + } + + // Widgets: Data Plotting + /* TODO: Widgets Data Plotting ==> UNSUPPORTED (barely used and quite long functions) */ + + // Widgets: Value() helpers + inline void Value(const std::string& prefix, bool b) + { + ImGui::Value(prefix.c_str(), b); + } + inline void Value(const std::string& prefix, int v) + { + ImGui::Value(prefix.c_str(), v); + } + inline void Value(const std::string& prefix, unsigned int v) + { + ImGui::Value(prefix.c_str(), v); + } + inline void Value(const std::string& prefix, float v) + { + ImGui::Value(prefix.c_str(), v); + } + inline void Value(const std::string& prefix, float v, const std::string& float_format) + { + ImGui::Value(prefix.c_str(), v, float_format.c_str()); + } + + // Widgets: Menus + inline bool BeginMenuBar() + { + return ImGui::BeginMenuBar(); + } + inline void EndMenuBar() + { + ImGui::EndMenuBar(); + } + inline bool BeginMainMenuBar() + { + return ImGui::BeginMainMenuBar(); + } + inline void EndMainMenuBar() + { + ImGui::EndMainMenuBar(); + } + inline bool BeginMenu(const std::string& label) + { + return ImGui::BeginMenu(label.c_str()); + } + inline bool BeginMenu(const std::string& label, bool enabled) + { + return ImGui::BeginMenu(label.c_str(), enabled); + } + inline void EndMenu() + { + ImGui::EndMenu(); + } + inline bool MenuItem(const std::string& label) + { + return ImGui::MenuItem(label.c_str()); + } + inline bool MenuItem(const std::string& label, const std::string& shortcut) + { + return ImGui::MenuItem(label.c_str(), shortcut.c_str()); + } + inline std::tuple MenuItem(const std::string& label, const std::string& shortcut, bool selected) + { + bool activated = ImGui::MenuItem(label.c_str(), shortcut.c_str(), &selected); + return std::make_tuple(selected, activated); + } + inline std::tuple MenuItem(const std::string& label, const std::string& shortcut, bool selected, bool enabled) + { + bool activated = ImGui::MenuItem(label.c_str(), shortcut.c_str(), &selected, enabled); + return std::make_tuple(selected, activated); + } + + // Tooltips + inline void BeginTooltip() + { + ImGui::BeginTooltip(); + } + inline void EndTooltip() + { + ImGui::EndTooltip(); + } + inline void SetTooltip(const std::string& fmt) + { + ImGui::SetTooltip("%s", fmt.c_str()); + } + inline void SetTooltipV() + { /* TODO: SetTooltipV(...) ==> UNSUPPORTED */ + } + + // Popups, Modals + inline bool BeginPopup(const std::string& str_id) + { + return ImGui::BeginPopup(str_id.c_str()); + } + inline bool BeginPopup(const std::string& str_id, int flags) + { + return ImGui::BeginPopup(str_id.c_str(), flags); + } + inline bool BeginPopupModal(const std::string& name) + { + return ImGui::BeginPopupModal(name.c_str()); + } + inline bool BeginPopupModal(const std::string& name, int flags) + { + return ImGui::BeginPopupModal(name.c_str(), nullptr, flags); + } + inline bool BeginPopupModal(const std::string& name, bool open) + { + return ImGui::BeginPopupModal(name.c_str(), &open); + } + inline bool BeginPopupModal(const std::string& name, bool open, int flags) + { + return ImGui::BeginPopupModal(name.c_str(), &open, flags); + } + inline void EndPopup() + { + ImGui::EndPopup(); + } + inline void OpenPopup(const std::string& str_id) + { + ImGui::OpenPopup(str_id.c_str()); + } + inline void OpenPopup(const std::string& str_id, int popup_flags) + { + ImGui::OpenPopup(str_id.c_str(), popup_flags); + } + inline void CloseCurrentPopup() + { + ImGui::CloseCurrentPopup(); + } + inline bool BeginPopupContextItem() + { + return ImGui::BeginPopupContextItem(); + } + inline bool BeginPopupContextItem(const std::string& str_id) + { + return ImGui::BeginPopupContextItem(str_id.c_str()); + } + inline bool BeginPopupContextItem(const std::string& str_id, int popup_flags) + { + return ImGui::BeginPopupContextItem(str_id.c_str(), popup_flags); + } + inline bool BeginPopupContextWindow() + { + return ImGui::BeginPopupContextWindow(); + } + inline bool BeginPopupContextWindow(const std::string& str_id) + { + return ImGui::BeginPopupContextWindow(str_id.c_str()); + } + inline bool BeginPopupContextWindow(const std::string& str_id, int popup_flags) + { + return ImGui::BeginPopupContextWindow(str_id.c_str(), popup_flags); + } + inline bool BeginPopupContextVoid() + { + return ImGui::BeginPopupContextVoid(); + } + inline bool BeginPopupContextVoid(const std::string& str_id) + { + return ImGui::BeginPopupContextVoid(str_id.c_str()); + } + inline bool BeginPopupContextVoid(const std::string& str_id, int popup_flags) + { + return ImGui::BeginPopupContextVoid(str_id.c_str(), popup_flags); + } + inline bool IsPopupOpen(const std::string& str_id) + { + return ImGui::IsPopupOpen(str_id.c_str()); + } + inline bool IsPopupOpen(const std::string& str_id, int popup_flags) + { + return ImGui::IsPopupOpen(str_id.c_str(), popup_flags); + } + + // Tables + inline bool BeginTable(const std::string& str_id, int columns) + { + return ImGui::BeginTable(str_id.c_str(), columns); + } + inline bool BeginTable(const std::string& str_id, int columns, int flags) + { + return ImGui::BeginTable(str_id.c_str(), columns, flags); + } + inline bool BeginTable(const std::string& str_id, int columns, int flags, float outer_sizeX, float outer_sizeY) + { + return ImGui::BeginTable(str_id.c_str(), columns, flags, {outer_sizeX, outer_sizeY}); + } + inline bool BeginTable(const std::string& str_id, int columns, int flags, float outer_sizeX, float outer_sizeY, float inner_width) + { + return ImGui::BeginTable(str_id.c_str(), columns, flags, {outer_sizeX, outer_sizeY}, inner_width); + } + inline void EndTable() + { + ImGui::EndTable(); + } + inline void TableNextRow() + { + ImGui::TableNextRow(); + } + inline void TableNextRow(int flags) + { + ImGui::TableNextRow(flags); + } + inline void TableNextRow(int flags, float min_row_height) + { + ImGui::TableNextRow(flags, min_row_height); + } + inline bool TableNextColumn() + { + return ImGui::TableNextColumn(); + } + inline bool TableSetColumnIndex(int column_n) + { + return ImGui::TableSetColumnIndex(column_n); + } + inline void TableSetupColumn(const std::string& label) + { + ImGui::TableSetupColumn(label.c_str()); + } + inline void TableSetupColumn(const std::string& label, int flags) + { + ImGui::TableSetupColumn(label.c_str(), ImGuiTableColumnFlags(flags)); + } + inline void TableSetupColumn(const std::string& label, int flags, float init_width_or_weight) + { + ImGui::TableSetupColumn(label.c_str(), ImGuiTableColumnFlags(flags), init_width_or_weight); + } + inline void TableSetupColumn(const std::string& label, int flags, float init_width_or_weight, int user_id) + { + ImGui::TableSetupColumn(label.c_str(), ImGuiTableColumnFlags(flags), init_width_or_weight, static_cast(user_id)); + } + inline void TableSetupScrollFreeze(int cols, int rows) + { + ImGui::TableSetupScrollFreeze(cols, rows); + } + inline void TableHeadersRow() + { + ImGui::TableHeadersRow(); + } + inline void TableHeader(const std::string& label) + { + ImGui::TableHeader(label.c_str()); + } + inline ImGuiTableSortSpecs* TableGetSortSpecs() + { + return ImGui::TableGetSortSpecs(); + } + inline int TableGetColumnCount() + { + return ImGui::TableGetColumnCount(); + } + inline int TableGetColumnIndex() + { + return ImGui::TableGetColumnIndex(); + } + inline int TableGetRowIndex() + { + return ImGui::TableGetRowIndex(); + } + inline std::string TableGetColumnName() + { + return std::string(ImGui::TableGetColumnName()); + } + inline std::string TableGetColumnName(int column_n) + { + return std::string(ImGui::TableGetColumnName(column_n)); + } + inline ImGuiTableColumnFlags TableGetColumnFlags() + { + return ImGui::TableGetColumnFlags(); + } + inline ImGuiTableColumnFlags TableGetColumnFlags(int column_n) + { + return ImGui::TableGetColumnFlags(column_n); + } + inline void TableSetBgColor(int target, int color) + { + ImGui::TableSetBgColor(target, static_cast(color)); + } + inline void TableSetBgColor(int target, float colR, float colG, float colB, float colA) + { + ImGui::TableSetBgColor(target, ImGui::ColorConvertFloat4ToU32({colR, colG, colB, colA})); + } + inline void TableSetBgColor(int target, int color, int column_n) + { + ImGui::TableSetBgColor(target, static_cast(color), column_n); + } + inline void TableSetBgColor(int target, float colR, float colG, float colB, float colA, int column_n) + { + ImGui::TableSetBgColor(target, ImGui::ColorConvertFloat4ToU32({colR, colG, colB, colA}), column_n); + } + + // Columns + inline void Columns() + { + ImGui::Columns(); + } + inline void Columns(int count) + { + ImGui::Columns(count); + } + inline void Columns(int count, const std::string& id) + { + ImGui::Columns(count, id.c_str()); + } + inline void Columns(int count, const std::string& id, bool border) + { + ImGui::Columns(count, id.c_str(), border); + } + inline void NextColumn() + { + ImGui::NextColumn(); + } + inline int GetColumnIndex() + { + return ImGui::GetColumnIndex(); + } + inline float GetColumnWidth() + { + return ImGui::GetColumnWidth(); + } + inline float GetColumnWidth(int column_index) + { + return ImGui::GetColumnWidth(column_index); + } + inline void SetColumnWidth(int column_index, float width) + { + ImGui::SetColumnWidth(column_index, width); + } + inline float GetColumnOffset() + { + return ImGui::GetColumnOffset(); + } + inline float GetColumnOffset(int column_index) + { + return ImGui::GetColumnOffset(column_index); + } + inline void SetColumnOffset(int column_index, float offset_x) + { + ImGui::SetColumnOffset(column_index, offset_x); + } + inline int GetColumnsCount() + { + return ImGui::GetColumnsCount(); + } + + // Tab Bars, Tabs + inline bool BeginTabBar(const std::string& str_id) + { + return ImGui::BeginTabBar(str_id.c_str()); + } + inline bool BeginTabBar(const std::string& str_id, int flags) + { + return ImGui::BeginTabBar(str_id.c_str(), flags); + } + inline void EndTabBar() + { + ImGui::EndTabBar(); + } + inline bool BeginTabItem(const std::string& label) + { + return ImGui::BeginTabItem(label.c_str()); + } + inline bool BeginTabItem(const std::string& label, int flags) + { + return ImGui::BeginTabItem(label.c_str(), nullptr, flags); + } + inline std::tuple BeginTabItem(const std::string& label, bool open) + { + bool selected = ImGui::BeginTabItem(label.c_str(), &open); + return std::make_tuple(open, selected); + } + inline std::tuple BeginTabItem(const std::string& label, bool open, int flags) + { + bool selected = ImGui::BeginTabItem(label.c_str(), &open, flags); + return std::make_tuple(open, selected); + } + inline void EndTabItem() + { + ImGui::EndTabItem(); + } + inline void SetTabItemClosed(const std::string& tab_or_docked_window_label) + { + ImGui::SetTabItemClosed(tab_or_docked_window_label.c_str()); + } + + // Drag and Drop + // TODO: Drag and Drop ==> UNSUPPORTED + + // Disabling + inline void BeginDisabled() + { + ImGui::BeginDisabled(); + } + inline void BeginDisabled(bool disabled) + { + ImGui::BeginDisabled(disabled); + } + inline void EndDisabled() + { + ImGui::EndDisabled(); + } + + // Clipping + inline void PushClipRect(float min_x, float min_y, float max_x, float max_y, bool intersect_current) + { + ImGui::PushClipRect({min_x, min_y}, {max_x, max_y}, intersect_current); + } + inline void PopClipRect() + { + ImGui::PopClipRect(); + } + + // Focus, Activation + inline void SetItemDefaultFocus() + { + ImGui::SetItemDefaultFocus(); + } + inline void SetKeyboardFocusHere() + { + ImGui::SetKeyboardFocusHere(); + } + inline void SetKeyboardFocusHere(int offset) + { + ImGui::SetKeyboardFocusHere(offset); + } + + // Item/Widgets Utilities + inline bool IsItemHovered() + { + return ImGui::IsItemHovered(); + } + inline bool IsItemHovered(int flags) + { + return ImGui::IsItemHovered(flags); + } + inline bool IsItemActive() + { + return ImGui::IsItemActive(); + } + inline bool IsItemFocused() + { + return ImGui::IsItemFocused(); + } + inline bool IsItemClicked() + { + return ImGui::IsItemClicked(); + } + inline bool IsItemClicked(int mouse_button) + { + return ImGui::IsItemClicked(mouse_button); + } + inline bool IsItemVisible() + { + return ImGui::IsItemVisible(); + } + inline bool IsItemEdited() + { + return ImGui::IsItemEdited(); + } + inline bool IsItemActivated() + { + return ImGui::IsItemActivated(); + } + inline bool IsItemDeactivated() + { + return ImGui::IsItemDeactivated(); + } + inline bool IsItemDeactivatedAfterEdit() + { + return ImGui::IsItemDeactivatedAfterEdit(); + } + inline bool IsItemToggledOpen() + { + return ImGui::IsItemToggledOpen(); + } + inline bool IsAnyItemHovered() + { + return ImGui::IsAnyItemHovered(); + } + inline bool IsAnyItemActive() + { + return ImGui::IsAnyItemActive(); + } + inline bool IsAnyItemFocused() + { + return ImGui::IsAnyItemFocused(); + } + inline std::tuple GetItemRectMin() + { + const auto vec2{ImGui::GetItemRectMin()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetItemRectMax() + { + const auto vec2{ImGui::GetItemRectMax()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetItemRectSize() + { + const auto vec2{ImGui::GetItemRectSize()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline void SetItemAllowOverlap() + { + ImGui::SetItemAllowOverlap(); + } + + // Miscellaneous Utilities + inline bool IsRectVisible(float sizeX, float sizeY) + { + return ImGui::IsRectVisible({sizeX, sizeY}); + } + inline bool IsRectVisible(float minX, float minY, float maxX, float maxY) + { + return ImGui::IsRectVisible({minX, minY}, {maxX, maxY}); + } + inline double GetTime() + { + return ImGui::GetTime(); + } + inline int GetFrameCount() + { + return ImGui::GetFrameCount(); + } + inline ImDrawList* GetBackgroundDrawList() + { + return ImGui::GetBackgroundDrawList(); + } + inline ImDrawList* GetForegroundDrawList() + { + return ImGui::GetForegroundDrawList(); + } + /* TODO: GetDrawListSharedData() ==> UNSUPPORTED */ + inline std::string GetStyleColorName(int idx) + { + return std::string(ImGui::GetStyleColorName(idx)); + } + /* TODO: SetStateStorage(), GetStateStorage(), CalcListClipping() ==> UNSUPPORTED */ + inline bool BeginChildFrame(unsigned int id, float sizeX, float sizeY) + { + return ImGui::BeginChildFrame(id, {sizeX, sizeY}); + } + inline bool BeginChildFrame(unsigned int id, float sizeX, float sizeY, int flags) + { + return ImGui::BeginChildFrame(id, {sizeX, sizeY}, flags); + } + inline void EndChildFrame() + { + return ImGui::EndChildFrame(); + } + inline ImGuiStyle& GetStyle() + { + return ImGui::GetStyle(); + } + + // Text Utilities + inline std::tuple CalcTextSize(const std::string& text) + { + const auto vec2{ImGui::CalcTextSize(text.c_str())}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple CalcTextSize(const std::string& text, bool hide_text_after_double_hash) + { + const auto vec2{ImGui::CalcTextSize(text.c_str(), nullptr, hide_text_after_double_hash)}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple CalcTextSize(const std::string& text, bool hide_text_after_double_hash, float wrap_width) + { + const auto vec2{ImGui::CalcTextSize(text.c_str(), nullptr, hide_text_after_double_hash, wrap_width)}; + return std::make_tuple(vec2.x, vec2.y); + } + + // Color Utilities + inline sol::as_table_t> ColorConvertU32ToFloat4(unsigned int in) + { + const auto vec4 = ImGui::ColorConvertU32ToFloat4(in); + sol::as_table_t rgba = sol::as_table(std::vector{vec4.x, vec4.y, vec4.z, vec4.w}); + + return rgba; + } + inline unsigned int ColorConvertFloat4ToU32(const sol::table& rgba) + { + const lua_Number r{rgba[1].get>().value_or(static_cast(0))}, + g{rgba[2].get>().value_or(static_cast(0))}, + b{rgba[3].get>().value_or(static_cast(0))}, + a{rgba[4].get>().value_or(static_cast(0))}; + + return ImGui::ColorConvertFloat4ToU32({static_cast(r), static_cast(g), static_cast(b), static_cast(a)}); + } + inline std::tuple ColorConvertRGBtoHSV(float r, float g, float b) + { + float h{}, s{}, v{}; + ImGui::ColorConvertRGBtoHSV(r, g, b, h, s, v); + return std::make_tuple(h, s, v); + } + inline std::tuple ColorConvertHSVtoRGB(float h, float s, float v) + { + float r{}, g{}, b{}; + ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); + return std::make_tuple(r, g, b); + } + + // Inputs Utilities: Mouse + inline bool IsMouseHoveringRect(float min_x, float min_y, float max_x, float max_y) + { + return ImGui::IsMouseHoveringRect({min_x, min_y}, {max_x, max_y}); + } + inline bool IsMouseHoveringRect(float min_x, float min_y, float max_x, float max_y, bool clip) + { + return ImGui::IsMouseHoveringRect({min_x, min_y}, {max_x, max_y}, clip); + } + inline std::tuple GetMousePos() + { + const auto vec2{ImGui::GetMousePos()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetMousePosOnOpeningCurrentPopup() + { + const auto vec2{ImGui::GetMousePosOnOpeningCurrentPopup()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline bool IsMouseDragging(int button) + { + return ImGui::IsMouseDragging(static_cast(button)); + } + inline bool IsMouseDragging(int button, float lock_threshold) + { + return ImGui::IsMouseDragging(static_cast(button), lock_threshold); + } + inline std::tuple GetMouseDragDelta() + { + const auto vec2{ImGui::GetMouseDragDelta()}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetMouseDragDelta(int button) + { + const auto vec2{ImGui::GetMouseDragDelta(static_cast(button))}; + return std::make_tuple(vec2.x, vec2.y); + } + inline std::tuple GetMouseDragDelta(int button, float lock_threshold) + { + const auto vec2{ImGui::GetMouseDragDelta(static_cast(button), lock_threshold)}; + return std::make_tuple(vec2.x, vec2.y); + } + inline void ResetMouseDragDelta() + { + ImGui::ResetMouseDragDelta(); + } + inline void ResetMouseDragDelta(int button) + { + ImGui::ResetMouseDragDelta(static_cast(button)); + } + + // Clipboard Utilities + inline std::string GetClipboardText() + { + return std::string(ImGui::GetClipboardText()); + } + inline void SetClipboardText(const std::string& text) + { + ImGui::SetClipboardText(text.c_str()); + } + + // Drawing APIs + // Primitives + inline void ImDrawListAddLine(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, int col) + { + drawlist->AddLine({p1X, p1Y}, {p2X, p2Y}, static_cast(col)); + } + inline void ImDrawListAddLine(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, int col, float thickness) + { + drawlist->AddLine({p1X, p1Y}, {p2X, p2Y}, static_cast(col), thickness); + } + inline void ImDrawListAddRect(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col) + { + drawlist->AddRect({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col)); + } + inline void ImDrawListAddRect(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col, float rounding) + { + drawlist->AddRect({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col), rounding); + } + inline void ImDrawListAddRect(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col, float rounding, int flags) + { + drawlist->AddRect({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col), rounding, static_cast(flags)); + } + inline void ImDrawListAddRect(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col, float rounding, int flags, float thickness) + { + drawlist->AddRect({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col), rounding, static_cast(flags), thickness); + } + inline void ImDrawListAddRectFilled(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col) + { + drawlist->AddRectFilled({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col)); + } + inline void ImDrawListAddRectFilled(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col, float rounding) + { + drawlist->AddRectFilled({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col), rounding); + } + inline void ImDrawListAddRectFilled(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col, float rounding, int flags) + { + drawlist->AddRectFilled({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col), rounding, static_cast(flags)); + } + inline void ImDrawListAddRectFilledMultiColor(ImDrawList* drawlist, float p_minX, float p_minY, float p_maxX, float p_maxY, int col_upr_left, int col_upr_right, int col_bot_right, int col_bot_left) + { + drawlist->AddRectFilledMultiColor({p_minX, p_minY}, {p_maxX, p_maxY}, static_cast(col_upr_left), static_cast(col_upr_right), static_cast(col_bot_right), static_cast(col_bot_left)); + } + inline void ImDrawListAddQuad(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col) + { + drawlist->AddQuad({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, {p4X, p4Y}, static_cast(col)); + } + inline void ImDrawListAddQuad(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col, float thickness) + { + drawlist->AddQuad({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, {p4X, p4Y}, static_cast(col), thickness); + } + inline void ImDrawListAddQuadFilled(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col) + { + drawlist->AddQuadFilled({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, {p4X, p4Y}, static_cast(col)); + } + inline void ImDrawListAddTriangle(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col) + { + drawlist->AddTriangle({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, static_cast(col)); + } + inline void ImDrawListAddTriangle(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col, float thickness) + { + drawlist->AddTriangle({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, static_cast(col), thickness); + } + inline void ImDrawListAddTriangleFilled(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col) + { + drawlist->AddTriangleFilled({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, static_cast(col)); + } + inline void ImDrawListAddCircle(ImDrawList* drawlist, float centerX, float centerY, float radius, int col) + { + drawlist->AddCircle({centerX, centerY}, radius, static_cast(col)); + } + inline void ImDrawListAddCircle(ImDrawList* drawlist, float centerX, float centerY, float radius, int col, int num_segments) + { + drawlist->AddCircle({centerX, centerY}, radius, static_cast(col), num_segments); + } + inline void ImDrawListAddCircle(ImDrawList* drawlist, float centerX, float centerY, float radius, int col, int num_segments, float thickness) + { + drawlist->AddCircle({centerX, centerY}, radius, static_cast(col), num_segments, thickness); + } + inline void ImDrawListAddCircleFilled(ImDrawList* drawlist, float centerX, float centerY, float radius, int col) + { + drawlist->AddCircleFilled({centerX, centerY}, radius, static_cast(col)); + } + inline void ImDrawListAddCircleFilled(ImDrawList* drawlist, float centerX, float centerY, float radius, int col, int num_segments) + { + drawlist->AddCircleFilled({centerX, centerY}, radius, static_cast(col), num_segments); + } + inline void ImDrawListAddNgon(ImDrawList* drawlist, float centerX, float centerY, float radius, int col, int num_segments) + { + drawlist->AddNgon({centerX, centerY}, radius, static_cast(col), num_segments); + } + inline void ImDrawListAddNgon(ImDrawList* drawlist, float centerX, float centerY, float radius, int col, int num_segments, float thickness) + { + drawlist->AddNgon({centerX, centerY}, radius, static_cast(col), num_segments, thickness); + } + inline void ImDrawListAddNgonFilled(ImDrawList* drawlist, float centerX, float centerY, float radius, int col, int num_segments) + { + drawlist->AddNgonFilled({centerX, centerY}, radius, static_cast(col), num_segments); + } + inline void ImDrawListAddText(ImDrawList* drawlist, float posX, float posY, int col, const std::string& text_begin) + { + drawlist->AddText({posX, posY}, static_cast(col), text_begin.c_str()); + } + inline void ImDrawListAddText(ImDrawList* drawlist, float font_size, float posX, float posY, int col, const std::string& text_begin) + { + drawlist->AddText(ImGui::GetFont(), font_size, {posX, posY}, static_cast(col), text_begin.c_str()); + } + inline void ImDrawListAddText(ImDrawList* drawlist, float font_size, float posX, float posY, int col, const std::string& text_begin, float wrap_width) + { + drawlist->AddText(ImGui::GetFont(), font_size, {posX, posY}, static_cast(col), text_begin.c_str(), nullptr, wrap_width); + } + // TODO + // inline void ImDrawListAddText(ImDrawList* drawlist, float font_size, float posX, float posY, int col, const + // std::string& text_begin, float wrap_width, sol::table float cpu_fine_clip_rect) { + // drawlist->AddText(ImGui::GetFont(), font_size, { posX, posY }, ImU32(col), text_begin.c_str(), NULL, wrap_width, + // cpu_fine_clip_rect); } inline void ImDrawListAddPolyline(ImDrawList* drawlist, sol::table points, int num_points, int + // col, int flags, float thickness) { + // drawlist->AddPolyline(points, num_points, ImU32(col), static_cast(flags), thickness); } inline void + // ImDrawListAddConvexPolyFilled(ImDrawList* drawlist, sol::table points, int num_points, int col) { + // drawlist->AddConvexPolyFilled(points, num_points, ImU32(col)); } + inline void ImDrawListAddBezierCubic(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col, float thickness) + { + drawlist->AddBezierCubic({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, {p4X, p4Y}, static_cast(col), thickness); + } + inline void ImDrawListAddBezierCubic(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col, float thickness, int num_segments) + { + drawlist->AddBezierCubic({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, {p4X, p4Y}, static_cast(col), thickness, num_segments); + } + inline void ImDrawListAddBezierQuadratic(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col, float thickness) + { + drawlist->AddBezierQuadratic({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, static_cast(col), thickness); + } + inline void ImDrawListAddBezierQuadratic(ImDrawList* drawlist, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col, float thickness, int num_segments) + { + drawlist->AddBezierQuadratic({p1X, p1Y}, {p2X, p2Y}, {p3X, p3Y}, static_cast(col), thickness, num_segments); + } + + inline void InitUserType(sol::table luaGlobals) + { + luaGlobals.new_usertype("ImVec2", sol::constructors(), "x", &ImVec2::x, "y", &ImVec2::y); + + luaGlobals.new_usertype("ImVec4", sol::constructors(), "x", &ImVec4::x, "y", &ImVec4::y, "z", &ImVec4::z, "w", &ImVec4::w); + + luaGlobals.new_usertype("ImGuiStyle", "Alpha", &ImGuiStyle::Alpha, "DisabledAlpha", &ImGuiStyle::DisabledAlpha, "WindowPadding", &ImGuiStyle::WindowPadding, "WindowRounding", &ImGuiStyle::WindowRounding, "WindowBorderSize", &ImGuiStyle::WindowBorderSize, "WindowMinSize", &ImGuiStyle::WindowMinSize, "WindowTitleAlign", &ImGuiStyle::WindowTitleAlign, "WindowMenuButtonPosition", &ImGuiStyle::WindowMenuButtonPosition, "ChildRounding", &ImGuiStyle::ChildRounding, "ChildBorderSize", &ImGuiStyle::ChildBorderSize, "PopupRounding", &ImGuiStyle::PopupRounding, "PopupBorderSize", &ImGuiStyle::PopupBorderSize, "FramePadding", &ImGuiStyle::FramePadding, "FrameRounding", &ImGuiStyle::FrameRounding, "FrameBorderSize", &ImGuiStyle::FrameBorderSize, "ItemSpacing", &ImGuiStyle::ItemSpacing, "ItemInnerSpacing", &ImGuiStyle::ItemInnerSpacing, "CellPadding", &ImGuiStyle::CellPadding, "TouchExtraPadding", &ImGuiStyle::TouchExtraPadding, "IndentSpacing", &ImGuiStyle::IndentSpacing, "ColumnsMinSpacing", &ImGuiStyle::ColumnsMinSpacing, "ScrollbarSize", &ImGuiStyle::ScrollbarSize, "ScrollbarRounding", &ImGuiStyle::ScrollbarRounding, "GrabMinSize", &ImGuiStyle::GrabMinSize, "GrabRounding", &ImGuiStyle::GrabRounding, "LogSliderDeadzone", &ImGuiStyle::LogSliderDeadzone, "TabRounding", &ImGuiStyle::TabRounding, "TabBorderSize", &ImGuiStyle::TabBorderSize, "TabMinWidthForCloseButton", &ImGuiStyle::TabMinWidthForCloseButton, "ColorButtonPosition", &ImGuiStyle::ColorButtonPosition, "ButtonTextAlign", &ImGuiStyle::ButtonTextAlign, "SelectableTextAlign", &ImGuiStyle::SelectableTextAlign, "DisplayWindowPadding", &ImGuiStyle::DisplayWindowPadding, "DisplaySafeAreaPadding", &ImGuiStyle::DisplaySafeAreaPadding, "MouseCursorScale", &ImGuiStyle::MouseCursorScale, "AntiAliasedLines", &ImGuiStyle::AntiAliasedLines, "AntiAliasedLinesUseTex", &ImGuiStyle::AntiAliasedLinesUseTex, "AntiAliasedFill", &ImGuiStyle::AntiAliasedFill, "CurveTessellationTol", &ImGuiStyle::CurveTessellationTol, "CircleTessellationMaxError", &ImGuiStyle::CircleTessellationMaxError, "ScaleAllSizes", &ImGuiStyle::ScaleAllSizes); + + luaGlobals.new_usertype("ImGuiListClipper", sol::constructors(), "Begin", &ImGuiListClipper::Begin, "Step", &ImGuiListClipper::Step, "DisplayStart", &ImGuiListClipper::DisplayStart, "DisplayEnd", &ImGuiListClipper::DisplayEnd); + } + + inline void InitEnums(sol::table luaGlobals) + { +#pragma region Window Flags + luaGlobals.new_enum("ImGuiWindowFlags", + "None", + ImGuiWindowFlags_None, + "NoTitleBar", + ImGuiWindowFlags_NoTitleBar, + "NoResize", + ImGuiWindowFlags_NoResize, + "NoMove", + ImGuiWindowFlags_NoMove, + "NoScrollbar", + ImGuiWindowFlags_NoScrollbar, + "NoScrollWithMouse", + ImGuiWindowFlags_NoScrollWithMouse, + "NoCollapse", + ImGuiWindowFlags_NoCollapse, + "AlwaysAutoResize", + ImGuiWindowFlags_AlwaysAutoResize, + "NoBackground", + ImGuiWindowFlags_NoBackground, + "NoSavedSettings", + ImGuiWindowFlags_NoSavedSettings, + "NoMouseInputs", + ImGuiWindowFlags_NoMouseInputs, + "MenuBar", + ImGuiWindowFlags_MenuBar, + "HorizontalScrollbar", + ImGuiWindowFlags_HorizontalScrollbar, + "NoFocusOnAppearing", + ImGuiWindowFlags_NoFocusOnAppearing, + "NoBringToFrontOnFocus", + ImGuiWindowFlags_NoBringToFrontOnFocus, + "AlwaysVerticalScrollbar", + ImGuiWindowFlags_AlwaysVerticalScrollbar, + "AlwaysHorizontalScrollbar", + ImGuiWindowFlags_AlwaysHorizontalScrollbar, + "AlwaysUseWindowPadding", + ImGuiWindowFlags_AlwaysUseWindowPadding, + "NoNavInputs", + ImGuiWindowFlags_NoNavInputs, + "NoNavFocus", + ImGuiWindowFlags_NoNavFocus, + "UnsavedDocument", + ImGuiWindowFlags_UnsavedDocument, + "NoNav", + ImGuiWindowFlags_NoNav, + "NoDecoration", + ImGuiWindowFlags_NoDecoration, + "NoInputs", + ImGuiWindowFlags_NoInputs, + // [Internal] + "NavFlattened", + ImGuiWindowFlags_NavFlattened, + "ChildWindow", + ImGuiWindowFlags_ChildWindow, + "Tooltip", + ImGuiWindowFlags_Tooltip, + "Popup", + ImGuiWindowFlags_Popup, + "Modal", + ImGuiWindowFlags_Modal, + "ChildMenu", + ImGuiWindowFlags_ChildMenu); +#pragma endregion Window Flags + +#pragma region Focused Flags + luaGlobals.new_enum("ImGuiFocusedFlags", "None", ImGuiFocusedFlags_None, "ChildWindows", ImGuiFocusedFlags_ChildWindows, "RootWindow", ImGuiFocusedFlags_RootWindow, "AnyWindow", ImGuiFocusedFlags_AnyWindow, "RootAndChildWindows", ImGuiFocusedFlags_RootAndChildWindows); +#pragma endregion Focused Flags + +#pragma region Hovered Flags + luaGlobals.new_enum("ImGuiHoveredFlags", "None", ImGuiHoveredFlags_None, "ChildWindows", ImGuiHoveredFlags_ChildWindows, "RootWindow", ImGuiHoveredFlags_RootWindow, "AnyWindow", ImGuiHoveredFlags_AnyWindow, "AllowWhenBlockedByPopup", ImGuiHoveredFlags_AllowWhenBlockedByPopup, "AllowWhenBlockedByActiveItem", ImGuiHoveredFlags_AllowWhenBlockedByActiveItem, "AllowWhenOverlapped", ImGuiHoveredFlags_AllowWhenOverlapped, "AllowWhenDisabled", ImGuiHoveredFlags_AllowWhenDisabled, "RectOnly", ImGuiHoveredFlags_RectOnly, "RootAndChildWindows", ImGuiHoveredFlags_RootAndChildWindows); +#pragma endregion Hovered Flags + +#pragma region Cond + luaGlobals.new_enum("ImGuiCond", "None", ImGuiCond_None, "Always", ImGuiCond_Always, "Once", ImGuiCond_Once, "FirstUseEver", ImGuiCond_FirstUseEver, "Appearing", ImGuiCond_Appearing); +#pragma endregion Cond + +#pragma region Col + luaGlobals.new_enum("ImGuiCol", "Text", ImGuiCol_Text, "TextDisabled", ImGuiCol_TextDisabled, "WindowBg", ImGuiCol_WindowBg, "ChildBg", ImGuiCol_ChildBg, "PopupBg", ImGuiCol_PopupBg, "Border", ImGuiCol_Border, "BorderShadow", ImGuiCol_BorderShadow, "FrameBg", ImGuiCol_FrameBg, "FrameBgHovered", ImGuiCol_FrameBgHovered, "FrameBgActive", ImGuiCol_FrameBgActive, "TitleBg", ImGuiCol_TitleBg, "TitleBgActive", ImGuiCol_TitleBgActive, "TitleBgCollapsed", ImGuiCol_TitleBgCollapsed, "MenuBarBg", ImGuiCol_MenuBarBg, "ScrollbarBg", ImGuiCol_ScrollbarBg, "ScrollbarGrab", ImGuiCol_ScrollbarGrab, "ScrollbarGrabHovered", ImGuiCol_ScrollbarGrabHovered, "ScrollbarGrabActive", ImGuiCol_ScrollbarGrabActive, "CheckMark", ImGuiCol_CheckMark, "SliderGrab", ImGuiCol_SliderGrab, "SliderGrabActive", ImGuiCol_SliderGrabActive, "Button", ImGuiCol_Button, "ButtonHovered", ImGuiCol_ButtonHovered, "ButtonActive", ImGuiCol_ButtonActive, "Header", ImGuiCol_Header, "HeaderHovered", ImGuiCol_HeaderHovered, "HeaderActive", ImGuiCol_HeaderActive, "Separator", ImGuiCol_Separator, "SeparatorHovered", ImGuiCol_SeparatorHovered, "SeparatorActive", ImGuiCol_SeparatorActive, "ResizeGrip", ImGuiCol_ResizeGrip, "ResizeGripHovered", ImGuiCol_ResizeGripHovered, "ResizeGripActive", ImGuiCol_ResizeGripActive, "Tab", ImGuiCol_Tab, "TabHovered", ImGuiCol_TabHovered, "TabActive", ImGuiCol_TabActive, "TabUnfocused", ImGuiCol_TabUnfocused, "TabUnfocusedActive", ImGuiCol_TabUnfocusedActive, "PlotLines", ImGuiCol_PlotLines, "PlotLinesHovered", ImGuiCol_PlotLinesHovered, "PlotHistogram", ImGuiCol_PlotHistogram, "PlotHistogramHovered", ImGuiCol_PlotHistogramHovered, "TableHeaderBg", ImGuiCol_TableHeaderBg, "TableBorderStrong", ImGuiCol_TableBorderStrong, "TableBorderLight", ImGuiCol_TableBorderLight, "TableRowBg", ImGuiCol_TableRowBg, "TableRowBgAlt", ImGuiCol_TableRowBgAlt, "TextSelectedBg", ImGuiCol_TextSelectedBg, "DragDropTarget", ImGuiCol_DragDropTarget, "NavHighlight", ImGuiCol_NavHighlight, "NavWindowingHighlight", ImGuiCol_NavWindowingHighlight, "NavWindowingDimBg", ImGuiCol_NavWindowingDimBg, "ModalWindowDimBg", ImGuiCol_ModalWindowDimBg, "COUNT", ImGuiCol_COUNT); +#pragma endregion Col + +#pragma region Style + luaGlobals.new_enum("ImGuiStyleVar", "Alpha", ImGuiStyleVar_Alpha, "DisabledAlpha", ImGuiStyleVar_DisabledAlpha, "WindowPadding", ImGuiStyleVar_WindowPadding, "WindowRounding", ImGuiStyleVar_WindowRounding, "WindowBorderSize", ImGuiStyleVar_WindowBorderSize, "WindowMinSize", ImGuiStyleVar_WindowMinSize, "WindowTitleAlign", ImGuiStyleVar_WindowTitleAlign, "ChildRounding", ImGuiStyleVar_ChildRounding, "ChildBorderSize", ImGuiStyleVar_ChildBorderSize, "PopupRounding", ImGuiStyleVar_PopupRounding, "PopupBorderSize", ImGuiStyleVar_PopupBorderSize, "FramePadding", ImGuiStyleVar_FramePadding, "FrameRounding", ImGuiStyleVar_FrameRounding, "FrameBorderSize", ImGuiStyleVar_FrameBorderSize, "ItemSpacing", ImGuiStyleVar_ItemSpacing, "ItemInnerSpacing", ImGuiStyleVar_ItemInnerSpacing, "IndentSpacing", ImGuiStyleVar_IndentSpacing, "CellPadding", ImGuiStyleVar_CellPadding, "ScrollbarSize", ImGuiStyleVar_ScrollbarSize, "ScrollbarRounding", ImGuiStyleVar_ScrollbarRounding, "GrabMinSize", ImGuiStyleVar_GrabMinSize, "GrabRounding", ImGuiStyleVar_GrabRounding, "TabRounding", ImGuiStyleVar_TabRounding, "SelectableTextAlign", ImGuiStyleVar_SelectableTextAlign, "ButtonTextAlign", ImGuiStyleVar_ButtonTextAlign, "COUNT", ImGuiStyleVar_COUNT); +#pragma endregion Style + +#pragma region Dir + luaGlobals.new_enum("ImGuiDir", "None", ImGuiDir_None, "Left", ImGuiDir_Left, "Right", ImGuiDir_Right, "Up", ImGuiDir_Up, "Down", ImGuiDir_Down, "COUNT", ImGuiDir_COUNT); +#pragma endregion Dir + +#pragma region Combo Flags + luaGlobals.new_enum("ImGuiComboFlags", "None", ImGuiComboFlags_None, "PopupAlignLeft", ImGuiComboFlags_PopupAlignLeft, "HeightSmall", ImGuiComboFlags_HeightSmall, "HeightRegular", ImGuiComboFlags_HeightRegular, "HeightLarge", ImGuiComboFlags_HeightLarge, "HeightLargest", ImGuiComboFlags_HeightLargest, "NoArrowButton", ImGuiComboFlags_NoArrowButton, "NoPreview", ImGuiComboFlags_NoPreview, "HeightMask", ImGuiComboFlags_HeightMask_); +#pragma endregion Combo Flags + +#pragma region InputText Flags + luaGlobals.new_enum("ImGuiInputTextFlags", "None", ImGuiInputTextFlags_None, "CharsDecimal", ImGuiInputTextFlags_CharsDecimal, "CharsHexadecimal", ImGuiInputTextFlags_CharsHexadecimal, "CharsUppercase", ImGuiInputTextFlags_CharsUppercase, "CharsNoBlank", ImGuiInputTextFlags_CharsNoBlank, "AutoSelectAll", ImGuiInputTextFlags_AutoSelectAll, "EnterReturnsTrue", ImGuiInputTextFlags_EnterReturnsTrue, "CallbackCompletion", ImGuiInputTextFlags_CallbackCompletion, "CallbackHistory", ImGuiInputTextFlags_CallbackHistory, "CallbackAlways", ImGuiInputTextFlags_CallbackAlways, "CallbackCharFilter", ImGuiInputTextFlags_CallbackCharFilter, "AllowTabInput", ImGuiInputTextFlags_AllowTabInput, "CtrlEnterForNewLine", ImGuiInputTextFlags_CtrlEnterForNewLine, "NoHorizontalScroll", ImGuiInputTextFlags_NoHorizontalScroll, "AlwaysOverwrite", ImGuiInputTextFlags_AlwaysOverwrite, "ReadOnly", ImGuiInputTextFlags_ReadOnly, "Password", ImGuiInputTextFlags_Password, "NoUndoRedo", ImGuiInputTextFlags_NoUndoRedo, "CharsScientific", ImGuiInputTextFlags_CharsScientific, "CallbackResize", ImGuiInputTextFlags_CallbackResize, "CallbackEdit", ImGuiInputTextFlags_CallbackEdit); +#pragma endregion InputText Flags + +#pragma region Slider Flags + luaGlobals.new_enum("ImGuiSliderFlags", "None", ImGuiSliderFlags_None, "AlwaysClamp", ImGuiSliderFlags_AlwaysClamp, "Logarithmic", ImGuiSliderFlags_Logarithmic, "NoRoundToFormat", ImGuiSliderFlags_NoRoundToFormat, "NoInput", ImGuiSliderFlags_NoInput); +#pragma endregion Slider Flags + +#pragma region ColorEdit Flags + luaGlobals.new_enum("ImGuiColorEditFlags", + "None", + ImGuiColorEditFlags_None, + "NoAlpha", + ImGuiColorEditFlags_NoAlpha, + "NoPicker", + ImGuiColorEditFlags_NoPicker, + "NoOptions", + ImGuiColorEditFlags_NoOptions, + "NoSmallPreview", + ImGuiColorEditFlags_NoSmallPreview, + "NoInputs", + ImGuiColorEditFlags_NoInputs, + "NoTooltip", + ImGuiColorEditFlags_NoTooltip, + "NoLabel", + ImGuiColorEditFlags_NoLabel, + "NoSidePreview", + ImGuiColorEditFlags_NoSidePreview, + "NoDragDrop", + ImGuiColorEditFlags_NoDragDrop, + "NoBorder", + ImGuiColorEditFlags_NoBorder, + + "AlphaBar", + ImGuiColorEditFlags_AlphaBar, + "AlphaPreview", + ImGuiColorEditFlags_AlphaPreview, + "AlphaPreviewHalf", + ImGuiColorEditFlags_AlphaPreviewHalf, + "HDR", + ImGuiColorEditFlags_HDR, + "DisplayRGB", + ImGuiColorEditFlags_DisplayRGB, + "DisplayHSV", + ImGuiColorEditFlags_DisplayHSV, + "DisplayHex", + ImGuiColorEditFlags_DisplayHex, + "Uint8", + ImGuiColorEditFlags_Uint8, + "Float", + ImGuiColorEditFlags_Float, + "PickerHueBar", + ImGuiColorEditFlags_PickerHueBar, + "PickerHueWheel", + ImGuiColorEditFlags_PickerHueWheel, + "InputRGB", + ImGuiColorEditFlags_InputRGB, + "InputHSV", + ImGuiColorEditFlags_InputHSV, + + "_OptionsDefault", + ImGuiColorEditFlags_DefaultOptions_, + + "_DisplayMask", + ImGuiColorEditFlags_DisplayMask_, + "_DataTypeMask", + ImGuiColorEditFlags_DataTypeMask_, + "_PickerMask", + ImGuiColorEditFlags_PickerMask_, + "_InputMask", + ImGuiColorEditFlags_InputMask_); +#pragma endregion ColorEdit Flags + +#pragma region TreeNode Flags + luaGlobals.new_enum("ImGuiTreeNodeFlags", "None", ImGuiTreeNodeFlags_None, "Selected", ImGuiTreeNodeFlags_Selected, "Framed", ImGuiTreeNodeFlags_Framed, "AllowItemOverlap", ImGuiTreeNodeFlags_AllowItemOverlap, "NoTreePushOnOpen", ImGuiTreeNodeFlags_NoTreePushOnOpen, "NoAutoOpenOnLog", ImGuiTreeNodeFlags_NoAutoOpenOnLog, "DefaultOpen", ImGuiTreeNodeFlags_DefaultOpen, "OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick, "OpenOnArrow", ImGuiTreeNodeFlags_OpenOnArrow, "Leaf", ImGuiTreeNodeFlags_Leaf, "Bullet", ImGuiTreeNodeFlags_Bullet, "FramePadding", ImGuiTreeNodeFlags_FramePadding, "SpanAvailWidth", ImGuiTreeNodeFlags_SpanAvailWidth, "SpanFullWidth", ImGuiTreeNodeFlags_SpanFullWidth, "NavLeftJumpsBackHere", ImGuiTreeNodeFlags_NavLeftJumpsBackHere, "CollapsingHeader", ImGuiTreeNodeFlags_CollapsingHeader); +#pragma endregion TreeNode Flags + +#pragma region Selectable Flags + luaGlobals.new_enum("ImGuiSelectableFlags", "None", ImGuiSelectableFlags_None, "DontClosePopups", ImGuiSelectableFlags_DontClosePopups, "SpanAllColumns", ImGuiSelectableFlags_SpanAllColumns, "AllowDoubleClick", ImGuiSelectableFlags_AllowDoubleClick, "Disabled", ImGuiSelectableFlags_Disabled, "AllowItemOverlap", ImGuiSelectableFlags_AllowItemOverlap); +#pragma endregion Selectable Flags + +#pragma region Popup Flags + luaGlobals.new_enum("ImGuiPopupFlags", "None", ImGuiPopupFlags_None, "MouseButtonLeft", ImGuiPopupFlags_MouseButtonLeft, "MouseButtonRight", ImGuiPopupFlags_MouseButtonRight, "MouseButtonMiddle", ImGuiPopupFlags_MouseButtonMiddle, "MouseButtonMask_", ImGuiPopupFlags_MouseButtonMask_, "MouseButtonDefault_", ImGuiPopupFlags_MouseButtonDefault_, "NoOpenOverExistingPopup", ImGuiPopupFlags_NoOpenOverExistingPopup, "NoOpenOverItems", ImGuiPopupFlags_NoOpenOverItems, "AnyPopupId", ImGuiPopupFlags_AnyPopupId, "AnyPopupLevel", ImGuiPopupFlags_AnyPopupLevel, "AnyPopup", ImGuiPopupFlags_AnyPopup); +#pragma endregion Popup Flags + +#pragma region Table Flags + luaGlobals.new_enum("ImGuiTableFlags", + // Features + "None", + ImGuiTableFlags_None, + "Resizable", + ImGuiTableFlags_Resizable, + "Reorderable", + ImGuiTableFlags_Reorderable, + "Hideable", + ImGuiTableFlags_Hideable, + "Sortable", + ImGuiTableFlags_Sortable, + "NoSavedSettings", + ImGuiTableFlags_NoSavedSettings, + "ContextMenuInBody", + ImGuiTableFlags_ContextMenuInBody, + // Decorations + "RowBg", + ImGuiTableFlags_RowBg, + "BordersInnerH", + ImGuiTableFlags_BordersInnerH, + "BordersOuterH", + ImGuiTableFlags_BordersOuterH, + "BordersInnerV", + ImGuiTableFlags_BordersInnerV, + "BordersOuterV", + ImGuiTableFlags_BordersOuterV, + "BordersH", + ImGuiTableFlags_BordersH, + "BordersV", + ImGuiTableFlags_BordersV, + "BordersInner", + ImGuiTableFlags_BordersInner, + "BordersOuter", + ImGuiTableFlags_BordersOuter, + "Borders", + ImGuiTableFlags_Borders, + "NoBordersInBody", + ImGuiTableFlags_NoBordersInBody, + "NoBordersInBodyUntilResize", + ImGuiTableFlags_NoBordersInBodyUntilResize, + // Sizing Policy (read above for defaults) + "SizingFixedFit", + ImGuiTableFlags_SizingFixedFit, + "SizingFixedSame", + ImGuiTableFlags_SizingFixedSame, + "SizingStretchProp", + ImGuiTableFlags_SizingStretchProp, + "SizingStretchSame", + ImGuiTableFlags_SizingStretchSame, + // Sizing Extra Options + "NoHostExtendX", + ImGuiTableFlags_NoHostExtendX, + "NoHostExtendY", + ImGuiTableFlags_NoHostExtendY, + "NoKeepColumnsVisible", + ImGuiTableFlags_NoKeepColumnsVisible, + "PreciseWidths", + ImGuiTableFlags_PreciseWidths, + // Clipping + "NoClip", + ImGuiTableFlags_NoClip, + // Padding + "PadOuterX", + ImGuiTableFlags_PadOuterX, + "NoPadOuterX", + ImGuiTableFlags_NoPadOuterX, + "NoPadInnerX", + ImGuiTableFlags_NoPadInnerX, + // Scrolling + "ScrollX", + ImGuiTableFlags_ScrollX, + "ScrollY", + ImGuiTableFlags_ScrollY, + // Sorting + "SortMulti", + ImGuiTableFlags_SortMulti, + "SortTristate", + ImGuiTableFlags_SortTristate, + // [Internal] Combinations and masks + "SizingMask", + ImGuiTableFlags_SizingMask_); +#pragma endregion Table Flags + +#pragma region TableColumn Flags + luaGlobals.new_enum("ImGuiTableColumnFlags", + // Input configuration flags + "None", + ImGuiTableColumnFlags_None, + "Disabled", + ImGuiTableColumnFlags_Disabled, + "DefaultHide", + ImGuiTableColumnFlags_DefaultHide, + "DefaultSort", + ImGuiTableColumnFlags_DefaultSort, + "WidthStretch", + ImGuiTableColumnFlags_WidthStretch, + "WidthFixed", + ImGuiTableColumnFlags_WidthFixed, + "NoResize", + ImGuiTableColumnFlags_NoResize, + "NoReorder", + ImGuiTableColumnFlags_NoReorder, + "NoHide", + ImGuiTableColumnFlags_NoHide, + "NoClip", + ImGuiTableColumnFlags_NoClip, + "NoSort", + ImGuiTableColumnFlags_NoSort, + "NoSortAscending", + ImGuiTableColumnFlags_NoSortAscending, + "NoSortDescending", + ImGuiTableColumnFlags_NoSortDescending, + "NoHeaderLabel", + ImGuiTableColumnFlags_NoHeaderLabel, + "NoHeaderWidth", + ImGuiTableColumnFlags_NoHeaderWidth, + "PreferSortAscending", + ImGuiTableColumnFlags_PreferSortAscending, + "PreferSortDescending", + ImGuiTableColumnFlags_PreferSortDescending, + "IndentEnable", + ImGuiTableColumnFlags_IndentEnable, + "IndentDisable", + ImGuiTableColumnFlags_IndentDisable, + // Output status flags, read-only via TableGetColumnFlags() + "IsEnabled", + ImGuiTableColumnFlags_IsEnabled, + "IsVisible", + ImGuiTableColumnFlags_IsVisible, + "IsSorted", + ImGuiTableColumnFlags_IsSorted, + "IsHovered", + ImGuiTableColumnFlags_IsHovered, + // [Internal] Combinations and masks + "WidthMask_", + ImGuiTableColumnFlags_WidthMask_, + "IndentMask_", + ImGuiTableColumnFlags_IndentMask_, + "StatusMask_", + ImGuiTableColumnFlags_StatusMask_, + "NoDirectResize_", + ImGuiTableColumnFlags_NoDirectResize_); +#pragma endregion TableColumn Flags + +#pragma region TableRow Flags + luaGlobals.new_enum("ImGuiTableRowFlags", "None", ImGuiTableRowFlags_None, "Headers", ImGuiTableRowFlags_Headers); +#pragma endregion TableRow Flags + +#pragma region TableBg Target + luaGlobals.new_enum("ImGuiTableBgTarget", "None", ImGuiTableBgTarget_None, "RowBg0", ImGuiTableBgTarget_RowBg0, "RowBg1", ImGuiTableBgTarget_RowBg1, "CellBg", ImGuiTableBgTarget_CellBg); +#pragma endregion TableBg Target + +#pragma region Draw Flags + luaGlobals.new_enum("ImDrawFlags", "None", ImDrawFlags_None, "Closed", ImDrawFlags_Closed, "ImDrawFlags_RoundCornersTopLeft", ImDrawFlags_RoundCornersTopLeft, "RoundCornersTopRight", ImDrawFlags_RoundCornersTopRight, "RoundCornersBottomLeft", ImDrawFlags_RoundCornersBottomLeft, "RoundCornersBottomRight", ImDrawFlags_RoundCornersBottomRight, "RoundCornersNone", ImDrawFlags_RoundCornersNone, "RoundCornersTop", ImDrawFlags_RoundCornersTop, "RoundCornersBottom", ImDrawFlags_RoundCornersBottom, "RoundCornersLeft", ImDrawFlags_RoundCornersLeft, "RoundCornersRight", ImDrawFlags_RoundCornersRight, "RoundCornersAll", ImDrawFlags_RoundCornersAll); +#pragma endregion Draw Flags + +#pragma region TabBar Flags + luaGlobals.new_enum("ImGuiTabBarFlags", "None", ImGuiTabBarFlags_None, "Reorderable", ImGuiTabBarFlags_Reorderable, "AutoSelectNewTabs", ImGuiTabBarFlags_AutoSelectNewTabs, "TabListPopupButton", ImGuiTabBarFlags_TabListPopupButton, "NoCloseWithMiddleMouseButton", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton, "NoTabListScrollingButtons", ImGuiTabBarFlags_NoTabListScrollingButtons, "NoTooltip", ImGuiTabBarFlags_NoTooltip, "FittingPolicyResizeDown", ImGuiTabBarFlags_FittingPolicyResizeDown, "FittingPolicyScroll", ImGuiTabBarFlags_FittingPolicyScroll, "FittingPolicyMask_", ImGuiTabBarFlags_FittingPolicyMask_, "FittingPolicyDefault_", ImGuiTabBarFlags_FittingPolicyDefault_); +#pragma endregion TabBar Flags + +#pragma region TabItem Flags + luaGlobals.new_enum("ImGuiTabItemFlags", "None", ImGuiTabItemFlags_None, "UnsavedDocument", ImGuiTabItemFlags_UnsavedDocument, "SetSelected", ImGuiTabItemFlags_SetSelected, "NoCloseWithMiddleMouseButton", ImGuiTabItemFlags_NoCloseWithMiddleMouseButton, "NoPushId", ImGuiTabItemFlags_NoPushId, "NoTooltip", ImGuiTabItemFlags_NoTooltip, "NoReorder", ImGuiTabItemFlags_NoReorder, "Leading", ImGuiTabItemFlags_Leading, "Trailing", ImGuiTabItemFlags_Trailing); +#pragma endregion TabItem Flags + +#pragma region MouseButton + luaGlobals.new_enum("ImGuiMouseButton", "Left", ImGuiMouseButton_Left, "Right", ImGuiMouseButton_Right, "Middle", ImGuiMouseButton_Middle, "COUNT", ImGuiMouseButton_COUNT); +#pragma endregion MouseButton + +#pragma region ImDrawCorner Flags + luaGlobals.new_enum("ImDrawCornerFlags", "None", ImDrawCornerFlags_None, "TopLeft", ImDrawCornerFlags_TopLeft, "TopRight", ImDrawCornerFlags_TopRight, "BotLeft", ImDrawCornerFlags_BotLeft, "BotRight", ImDrawCornerFlags_BotRight, "Top", ImDrawCornerFlags_Top, "Bot", ImDrawCornerFlags_Bot, "Left", ImDrawCornerFlags_Left, "Right", ImDrawCornerFlags_Right, "All", ImDrawCornerFlags_All); +#pragma endregion ImDrawCorner Flags + } + + inline void bind(sol::state& lua, sol::table luaGlobals) + { + InitUserType(luaGlobals); + InitEnums(luaGlobals); + + sol::table ImGui(lua, sol::create); + +#pragma region Windows + ImGui.set_function("Begin", sol::overload(sol::resolve(Begin), sol::resolve(Begin), sol::resolve(const std::string&, bool)>(Begin), sol::resolve(const std::string&, bool, int)>(Begin))); + ImGui.set_function("End", End); +#pragma endregion Windows + +#pragma region Child Windows + ImGui.set_function("BeginChild", sol::overload(sol::resolve(BeginChild), sol::resolve(BeginChild), sol::resolve(BeginChild), sol::resolve(BeginChild), sol::resolve(BeginChild))); + ImGui.set_function("EndChild", EndChild); +#pragma endregion Child Windows + +#pragma region Window Utilities + ImGui.set_function("IsWindowAppearing", IsWindowAppearing); + ImGui.set_function("IsWindowCollapsed", IsWindowCollapsed); + ImGui.set_function("IsWindowFocused", sol::overload(sol::resolve(IsWindowFocused), sol::resolve(IsWindowFocused))); + ImGui.set_function("IsWindowHovered", sol::overload(sol::resolve(IsWindowHovered), sol::resolve(IsWindowHovered))); + ImGui.set_function("GetWindowDrawList", GetWindowDrawList); + ImGui.set_function("GetWindowPos", GetWindowPos); + ImGui.set_function("GetWindowSize", GetWindowSize); + ImGui.set_function("GetWindowWidth", GetWindowWidth); + ImGui.set_function("GetWindowHeight", GetWindowHeight); + + // Prefer SetNext... + ImGui.set_function("SetNextWindowPos", sol::overload(sol::resolve(SetNextWindowPos), sol::resolve(SetNextWindowPos), sol::resolve(SetNextWindowPos))); + ImGui.set_function("SetNextWindowSize", sol::overload(sol::resolve(SetNextWindowSize), sol::resolve(SetNextWindowSize))); + ImGui.set_function("SetNextWindowSizeConstraints", SetNextWindowSizeConstraints); + ImGui.set_function("SetNextWindowContentSize", SetNextWindowContentSize); + ImGui.set_function("SetNextWindowCollapsed", sol::overload(sol::resolve(SetNextWindowCollapsed), sol::resolve(SetNextWindowCollapsed))); + ImGui.set_function("SetNextWindowFocus", SetNextWindowFocus); + ImGui.set_function("SetNextWindowBgAlpha", SetNextWindowBgAlpha); + ImGui.set_function("SetWindowPos", sol::overload(sol::resolve(SetWindowPos), sol::resolve(SetWindowPos), sol::resolve(SetWindowPos), sol::resolve(SetWindowPos))); + ImGui.set_function("SetWindowSize", sol::overload(sol::resolve(SetWindowSize), sol::resolve(SetWindowSize), sol::resolve(SetWindowSize), sol::resolve(SetWindowSize))); + ImGui.set_function("SetWindowCollapsed", sol::overload(sol::resolve(SetWindowCollapsed), sol::resolve(SetWindowCollapsed), sol::resolve(SetWindowCollapsed), sol::resolve(SetWindowCollapsed))); + ImGui.set_function("SetWindowFocus", sol::overload(sol::resolve(SetWindowFocus), sol::resolve(SetWindowFocus))); + ImGui.set_function("SetWindowFontScale", SetWindowFontScale); +#pragma endregion Window Utilities + +#pragma region Content Region + ImGui.set_function("GetContentRegionMax", GetContentRegionMax); + ImGui.set_function("GetContentRegionAvail", GetContentRegionAvail); + ImGui.set_function("GetWindowContentRegionMin", GetWindowContentRegionMin); + ImGui.set_function("GetWindowContentRegionMax", GetWindowContentRegionMax); + ImGui.set_function("GetWindowContentRegionWidth", GetWindowContentRegionWidth); +#pragma endregion Content Region + +#pragma region Windows Scrolling + ImGui.set_function("GetScrollX", GetScrollX); + ImGui.set_function("GetScrollY", GetScrollY); + ImGui.set_function("GetScrollMaxX", GetScrollMaxX); + ImGui.set_function("GetScrollMaxY", GetScrollMaxY); + ImGui.set_function("SetScrollX", SetScrollX); + ImGui.set_function("SetScrollY", SetScrollY); + ImGui.set_function("SetScrollHereX", sol::overload(sol::resolve(SetScrollHereX), sol::resolve(SetScrollHereX))); + ImGui.set_function("SetScrollHereY", sol::overload(sol::resolve(SetScrollHereY), sol::resolve(SetScrollHereY))); + ImGui.set_function("SetScrollFromPosX", sol::overload(sol::resolve(SetScrollFromPosX), sol::resolve(SetScrollFromPosX))); + ImGui.set_function("SetScrollFromPosY", sol::overload(sol::resolve(SetScrollFromPosY), sol::resolve(SetScrollFromPosY))); +#pragma endregion Windows Scrolling + +#pragma region Parameters stacks(shared) +#ifdef SOL_IMGUI_ENABLE_FONT_MANIPULATORS + ImGui.set_function("PushFont", PushFont); + ImGui.set_function("PopFont", PopFont); +#endif // SOL_IMGUI_ENABLE_FONT_MANIPULATORS + ImGui.set_function("PushStyleColor", sol::overload(sol::resolve(PushStyleColor), sol::resolve(PushStyleColor))); + ImGui.set_function("PopStyleColor", sol::overload(sol::resolve(PopStyleColor), sol::resolve(PopStyleColor))); + ImGui.set_function("PushStyleVar", sol::overload(sol::resolve(PushStyleVar), sol::resolve(PushStyleVar))); + ImGui.set_function("PopStyleVar", sol::overload(sol::resolve(PopStyleVar), sol::resolve(PopStyleVar))); + ImGui.set_function("GetStyleColorVec4", GetStyleColorVec4); +#ifdef SOL_IMGUI_ENABLE_FONT_MANIPULATORS + ImGui.set_function("GetFont", GetFont); +#endif // SOL_IMGUI_ENABLE_FONT_MANIPULATORS + ImGui.set_function("GetFontSize", GetFontSize); + ImGui.set_function("GetFontTexUvWhitePixel", GetFontTexUvWhitePixel); + ImGui.set_function("GetColorU32", sol::overload(sol::resolve(GetColorU32), sol::resolve(GetColorU32), sol::resolve(GetColorU32))); +#pragma endregion Parameters stacks(shared) + +#pragma region Parameters stacks(current window) + ImGui.set_function("PushItemWidth", PushItemWidth); + ImGui.set_function("PopItemWidth", PopItemWidth); + ImGui.set_function("SetNextItemWidth", SetNextItemWidth); + ImGui.set_function("CalcItemWidth", CalcItemWidth); + ImGui.set_function("PushTextWrapPos", sol::overload(sol::resolve(PushTextWrapPos), sol::resolve(PushTextWrapPos))); + ImGui.set_function("PopTextWrapPos", PopTextWrapPos); + ImGui.set_function("PushAllowKeyboardFocus", PushAllowKeyboardFocus); + ImGui.set_function("PopAllowKeyboardFocus", PopAllowKeyboardFocus); + ImGui.set_function("PushButtonRepeat", PushButtonRepeat); + ImGui.set_function("PopButtonRepeat", PopButtonRepeat); +#pragma endregion Parameters stacks(current window) + +#pragma region Cursor / Layout + ImGui.set_function("Separator", Separator); + ImGui.set_function("SameLine", sol::overload(sol::resolve(SameLine), sol::resolve(SameLine))); + ImGui.set_function("NewLine", NewLine); + ImGui.set_function("Spacing", Spacing); + ImGui.set_function("Dummy", Dummy); + ImGui.set_function("Indent", sol::overload(sol::resolve(Indent), sol::resolve(Indent))); + ImGui.set_function("Unindent", sol::overload(sol::resolve(Unindent), sol::resolve(Unindent))); + ImGui.set_function("BeginGroup", BeginGroup); + ImGui.set_function("EndGroup", EndGroup); + ImGui.set_function("GetCursorPos", GetCursorPos); + ImGui.set_function("GetCursorPosX", GetCursorPosX); + ImGui.set_function("GetCursorPosY", GetCursorPosY); + ImGui.set_function("SetCursorPos", SetCursorPos); + ImGui.set_function("SetCursorPosX", SetCursorPosX); + ImGui.set_function("SetCursorPosY", SetCursorPosY); + ImGui.set_function("GetCursorStartPos", GetCursorStartPos); + ImGui.set_function("GetCursorScreenPos", GetCursorScreenPos); + ImGui.set_function("SetCursorScreenPos", SetCursorScreenPos); + ImGui.set_function("AlignTextToFramePadding", AlignTextToFramePadding); + ImGui.set_function("GetTextLineHeight", GetTextLineHeight); + ImGui.set_function("GetTextLineHeightWithSpacing", GetTextLineHeightWithSpacing); + ImGui.set_function("GetFrameHeight", GetFrameHeight); + ImGui.set_function("GetFrameHeightWithSpacing", GetFrameHeightWithSpacing); +#pragma endregion Cursor / Layout + +#pragma region ID stack / scopes + ImGui.set_function("PushID", sol::overload(sol::resolve(PushID), sol::resolve(PushID))); + ImGui.set_function("PopID", PopID); + ImGui.set_function("GetID", GetID); +#pragma endregion ID stack / scopes + +#pragma region Widgets : Text + ImGui.set_function("TextUnformatted", TextUnformatted); + ImGui.set_function("Text", Text); + ImGui.set_function("TextColored", TextColored); + ImGui.set_function("TextDisabled", TextDisabled); + ImGui.set_function("TextWrapped", TextWrapped); + ImGui.set_function("LabelText", LabelText); + ImGui.set_function("BulletText", BulletText); +#pragma endregion Widgets : Text + +#pragma region Widgets : Main + ImGui.set_function("Button", sol::overload(sol::resolve(Button), sol::resolve(Button))); + ImGui.set_function("SmallButton", SmallButton); + ImGui.set_function("InvisibleButton", InvisibleButton); + ImGui.set_function("ArrowButton", ArrowButton); + ImGui.set_function("Checkbox", Checkbox); + ImGui.set_function("RadioButton", sol::overload(sol::resolve(RadioButton), sol::resolve(const std::string&, int, int)>(RadioButton))); + ImGui.set_function("ProgressBar", sol::overload(sol::resolve(ProgressBar), sol::resolve(ProgressBar), sol::resolve(ProgressBar))); + ImGui.set_function("Bullet", Bullet); +#pragma endregion Widgets : Main + +#pragma region Widgets : Combo Box + ImGui.set_function("BeginCombo", sol::overload(sol::resolve(BeginCombo), sol::resolve(BeginCombo))); + ImGui.set_function("EndCombo", EndCombo); + ImGui.set_function("Combo", sol::overload(sol::resolve(const std::string&, int, const sol::table&, int)>(Combo), sol::resolve(const std::string&, int, const sol::table&, int, int)>(Combo), sol::resolve(const std::string&, int, const std::string&)>(Combo), sol::resolve(const std::string&, int, const std::string&, int)>(Combo))); +#pragma endregion Widgets : Combo Box + +#pragma region Widgets : Drags + ImGui.set_function("DragFloat", sol::overload(sol::resolve(const std::string&, float)>(DragFloat), sol::resolve(const std::string&, float, float)>(DragFloat), sol::resolve(const std::string&, float, float, float)>(DragFloat), sol::resolve(const std::string&, float, float, float, float)>(DragFloat), sol::resolve(const std::string&, float, float, float, float, const std::string&)>(DragFloat), sol::resolve(const std::string&, float, float, float, float, const std::string&, int)>(DragFloat))); + ImGui.set_function("DragFloat2", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(DragFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float)>(DragFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float, float)>(DragFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float)>(DragFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float, const std::string&)>(DragFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float, const std::string&, int)>(DragFloat2))); + ImGui.set_function("DragFloat3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(DragFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float)>(DragFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float, float)>(DragFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float)>(DragFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float, const std::string&)>(DragFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float, const std::string&, int)>(DragFloat3))); + ImGui.set_function("DragFloat4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(DragFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float)>(DragFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float, float)>(DragFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float)>(DragFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float, const std::string&)>(DragFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, float, const std::string&, int)>(DragFloat4))); + ImGui.set_function("DragInt", sol::overload(sol::resolve(const std::string&, int)>(DragInt), sol::resolve(const std::string&, int, float)>(DragInt), sol::resolve(const std::string&, int, float, int)>(DragInt), sol::resolve(const std::string&, int, float, int, int)>(DragInt), sol::resolve(const std::string&, int, float, int, int, const std::string&)>(DragInt), sol::resolve(const std::string&, int, float, int, int, const std::string&, int)>(DragInt))); + ImGui.set_function("DragInt2", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(DragInt2), sol::resolve>, bool>(const std::string&, const sol::table&, float)>(DragInt2), sol::resolve>, bool>(const std::string&, const sol::table&, float, int)>(DragInt2), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int)>(DragInt2), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int, const std::string&)>(DragInt2), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int, const std::string&, int)>(DragInt2))); + ImGui.set_function("DragInt3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(DragInt3), sol::resolve>, bool>(const std::string&, const sol::table&, float)>(DragInt3), sol::resolve>, bool>(const std::string&, const sol::table&, float, int)>(DragInt3), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int)>(DragInt3), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int, const std::string&)>(DragInt3), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int, const std::string&, int)>(DragInt3))); + ImGui.set_function("DragInt4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(DragInt4), sol::resolve>, bool>(const std::string&, const sol::table&, float)>(DragInt4), sol::resolve>, bool>(const std::string&, const sol::table&, float, int)>(DragInt4), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int)>(DragInt4), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int, const std::string&)>(DragInt4), sol::resolve>, bool>(const std::string&, const sol::table&, float, int, int, const std::string&, int)>(DragInt4))); +#pragma endregion Widgets : Drags + +#pragma region Widgets : Sliders + ImGui.set_function("SliderFloat", sol::overload(sol::resolve(const std::string&, float, float, float)>(SliderFloat), sol::resolve(const std::string&, float, float, float, const std::string&)>(SliderFloat), sol::resolve(const std::string&, float, float, float, const std::string&, int)>(SliderFloat))); + ImGui.set_function("SliderFloat2", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&, float, float)>(SliderFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, const std::string&)>(SliderFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, const std::string&, int)>(SliderFloat2))); + ImGui.set_function("SliderFloat3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&, float, float)>(SliderFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, const std::string&)>(SliderFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, const std::string&, int)>(SliderFloat3))); + ImGui.set_function("SliderFloat4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&, float, float)>(SliderFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, const std::string&)>(SliderFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, float, float, const std::string&, int)>(SliderFloat4))); + ImGui.set_function("SliderAngle", sol::overload(sol::resolve(const std::string&, float)>(SliderAngle), sol::resolve(const std::string&, float, float)>(SliderAngle), sol::resolve(const std::string&, float, float, float)>(SliderAngle), sol::resolve(const std::string&, float, float, float, const std::string&)>(SliderAngle), sol::resolve(const std::string&, float, float, float, const std::string&, int)>(SliderAngle))); + ImGui.set_function("SliderInt", sol::overload(sol::resolve(const std::string&, int, int, int)>(SliderInt), sol::resolve(const std::string&, int, int, int, const std::string&)>(SliderInt), sol::resolve(const std::string&, int, int, int, const std::string&, int)>(SliderInt))); + ImGui.set_function("SliderInt2", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&, int, int)>(SliderInt2), sol::resolve>, bool>(const std::string&, const sol::table&, int, int, const std::string&)>(SliderInt2), sol::resolve>, bool>(const std::string&, const sol::table&, int, int, const std::string&, int)>(SliderInt2))); + ImGui.set_function("SliderInt3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&, int, int)>(SliderInt3), sol::resolve>, bool>(const std::string&, const sol::table&, int, int, const std::string&)>(SliderInt3), sol::resolve>, bool>(const std::string&, const sol::table&, int, int, const std::string&, int)>(SliderInt3))); + ImGui.set_function("SliderInt4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&, int, int)>(SliderInt4), sol::resolve>, bool>(const std::string&, const sol::table&, int, int, const std::string&)>(SliderInt4), sol::resolve>, bool>(const std::string&, const sol::table&, int, int, const std::string&, int)>(SliderInt4))); + ImGui.set_function("VSliderFloat", sol::overload(sol::resolve(const std::string&, float, float, float, float, float)>(VSliderFloat), sol::resolve(const std::string&, float, float, float, float, float, const std::string&)>(VSliderFloat), sol::resolve(const std::string&, float, float, float, float, float, const std::string&, int)>(VSliderFloat))); + ImGui.set_function("VSliderInt", sol::overload(sol::resolve(const std::string&, float, float, int, int, int)>(VSliderInt), sol::resolve(const std::string&, float, float, int, int, int, const std::string&)>(VSliderInt), sol::resolve(const std::string&, float, float, int, int, int, const std::string&, int)>(VSliderInt))); +#pragma endregion Widgets : Sliders + +#pragma region Widgets : Inputs using Keyboard + ImGui.set_function("InputText", sol::overload(sol::resolve(const std::string&, std::string, unsigned int)>(InputText), sol::resolve(const std::string&, std::string, unsigned int, int)>(InputText))); + ImGui.set_function("InputTextMultiline", sol::overload(sol::resolve(const std::string&, std::string, unsigned int)>(InputTextMultiline), sol::resolve(const std::string&, std::string, unsigned int, float, float)>(InputTextMultiline), sol::resolve(const std::string&, std::string, unsigned int, float, float, int)>(InputTextMultiline))); + ImGui.set_function("InputTextWithHint", sol::overload(sol::resolve(const std::string&, const std::string&, std::string, unsigned int)>(InputTextWithHint), sol::resolve(const std::string&, const std::string&, std::string, unsigned int, int)>(InputTextWithHint))); + ImGui.set_function("InputFloat", sol::overload(sol::resolve(const std::string&, float)>(InputFloat), sol::resolve(const std::string&, float, float)>(InputFloat), sol::resolve(const std::string&, float, float, float)>(InputFloat), sol::resolve(const std::string&, float, float, float, const std::string&)>(InputFloat), sol::resolve(const std::string&, float, float, float, const std::string&, int)>(InputFloat))); + ImGui.set_function("InputFloat2", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(InputFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, const std::string&)>(InputFloat2), sol::resolve>, bool>(const std::string&, const sol::table&, const std::string&, int)>(InputFloat2))); + ImGui.set_function("InputFloat3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(InputFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, const std::string&)>(InputFloat3), sol::resolve>, bool>(const std::string&, const sol::table&, const std::string&, int)>(InputFloat3))); + ImGui.set_function("InputFloat4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(InputFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, const std::string&)>(InputFloat4), sol::resolve>, bool>(const std::string&, const sol::table&, const std::string&, int)>(InputFloat4))); + ImGui.set_function("InputInt", sol::overload(sol::resolve(const std::string&, int)>(InputInt), sol::resolve(const std::string&, int, int)>(InputInt), sol::resolve(const std::string&, int, int, int)>(InputInt), sol::resolve(const std::string&, int, int, int)>(InputInt), sol::resolve(const std::string&, int, int, int, int)>(InputInt))); + ImGui.set_function("InputInt2", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(InputInt2), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(InputInt2))); + ImGui.set_function("InputInt3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(InputInt3), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(InputInt3))); + ImGui.set_function("InputInt4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(InputInt4), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(InputInt4))); + ImGui.set_function("InputDouble", sol::overload(sol::resolve(const std::string&, double)>(InputDouble), sol::resolve(const std::string&, double, double)>(InputDouble), sol::resolve(const std::string&, double, double, double)>(InputDouble), sol::resolve(const std::string&, double, double, double, const std::string&)>(InputDouble), sol::resolve(const std::string&, double, double, double, const std::string&, int)>(InputDouble))); +#pragma endregion Widgets : Inputs using Keyboard + +#pragma region Widgets : Color Editor / Picker + ImGui.set_function("ColorEdit3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(ColorEdit3), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(ColorEdit3))); + ImGui.set_function("ColorEdit4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(ColorEdit4), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(ColorEdit4))); + ImGui.set_function("ColorPicker3", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(ColorPicker3), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(ColorPicker3))); + ImGui.set_function("ColorPicker4", sol::overload(sol::resolve>, bool>(const std::string&, const sol::table&)>(ColorPicker4), sol::resolve>, bool>(const std::string&, const sol::table&, int)>(ColorPicker4))); + ImGui.set_function("ColorButton", sol::overload(sol::resolve(ColorButton), sol::resolve(ColorButton), sol::resolve(ColorButton))); +#pragma endregion Widgets : Color Editor / Picker + +#pragma region Widgets : Trees + ImGui.set_function("TreeNode", sol::overload(sol::resolve(TreeNode), sol::resolve(TreeNode))); + ImGui.set_function("TreeNodeEx", sol::overload(sol::resolve(TreeNodeEx), sol::resolve(TreeNodeEx), sol::resolve(TreeNodeEx))); + ImGui.set_function("TreePush", TreePush); + ImGui.set_function("TreePop", TreePop); + ImGui.set_function("GetTreeNodeToLabelSpacing", GetTreeNodeToLabelSpacing); + ImGui.set_function("CollapsingHeader", sol::overload(sol::resolve(CollapsingHeader), sol::resolve(CollapsingHeader), sol::resolve(const std::string&, bool)>(CollapsingHeader), sol::resolve(const std::string&, bool, int)>(CollapsingHeader))); + ImGui.set_function("SetNextItemOpen", sol::overload(sol::resolve(SetNextItemOpen), sol::resolve(SetNextItemOpen))); +#pragma endregion Widgets : Trees + +#pragma region Widgets : Selectables + ImGui.set_function("Selectable", sol::overload(sol::resolve(Selectable), sol::resolve(Selectable), sol::resolve(Selectable), sol::resolve(Selectable))); +#pragma endregion Widgets : Selectables + +#pragma region Widgets : List Boxes + ImGui.set_function("ListBox", sol::overload(sol::resolve(const std::string&, int, const sol::table&, int)>(ListBox), sol::resolve(const std::string&, int, const sol::table&, int, int)>(ListBox))); + ImGui.set_function("BeginListBox", sol::overload(sol::resolve(BeginListBox), sol::resolve(BeginListBox))); + ImGui.set_function("EndListBox", EndListBox); +#pragma endregion Widgets : List Boxes + +#pragma region Widgets : Value() Helpers + ImGui.set_function("Value", sol::overload(sol::resolve(Value), sol::resolve(Value), sol::resolve(Value), sol::resolve(Value), sol::resolve(Value))); +#pragma endregion Widgets : Value() Helpers + +#pragma region Widgets : Menu + ImGui.set_function("BeginMenuBar", BeginMenuBar); + ImGui.set_function("EndMenuBar", EndMenuBar); + ImGui.set_function("BeginMainMenuBar", BeginMainMenuBar); + ImGui.set_function("EndMainMenuBar", EndMainMenuBar); + ImGui.set_function("BeginMenu", sol::overload(sol::resolve(BeginMenu), sol::resolve(BeginMenu))); + ImGui.set_function("EndMenu", EndMenu); + ImGui.set_function("MenuItem", sol::overload(sol::resolve(MenuItem), sol::resolve(MenuItem), sol::resolve(const std::string&, const std::string&, bool)>(MenuItem), sol::resolve(const std::string&, const std::string&, bool, bool)>(MenuItem))); +#pragma endregion Widgets : Menu + +#pragma region Tooltips + ImGui.set_function("BeginTooltip", BeginTooltip); + ImGui.set_function("EndTooltip", EndTooltip); + ImGui.set_function("SetTooltip", SetTooltip); +#pragma endregion Tooltips + +#pragma region Popups, Modals + ImGui.set_function("BeginPopup", sol::overload(sol::resolve(BeginPopup), sol::resolve(BeginPopup))); + ImGui.set_function("BeginPopupModal", sol::overload(sol::resolve(BeginPopupModal), sol::resolve(BeginPopupModal), sol::resolve(BeginPopupModal), sol::resolve(BeginPopupModal))); + ImGui.set_function("EndPopup", EndPopup); + ImGui.set_function("OpenPopup", sol::overload(sol::resolve(OpenPopup), sol::resolve(OpenPopup))); + ImGui.set_function("CloseCurrentPopup", CloseCurrentPopup); + ImGui.set_function("BeginPopupContextItem", sol::overload(sol::resolve(BeginPopupContextItem), sol::resolve(BeginPopupContextItem), sol::resolve(BeginPopupContextItem))); + ImGui.set_function("BeginPopupContextWindow", sol::overload(sol::resolve(BeginPopupContextWindow), sol::resolve(BeginPopupContextWindow), sol::resolve(BeginPopupContextWindow))); + ImGui.set_function("BeginPopupContextVoid", sol::overload(sol::resolve(BeginPopupContextVoid), sol::resolve(BeginPopupContextVoid), sol::resolve(BeginPopupContextVoid))); + ImGui.set_function("IsPopupOpen", sol::overload(sol::resolve(IsPopupOpen), sol::resolve(IsPopupOpen))); +#pragma endregion Popups, Modals + +#pragma region Tables + ImGui.set_function("BeginTable", sol::overload(sol::resolve(BeginTable), sol::resolve(BeginTable), sol::resolve(BeginTable), sol::resolve(BeginTable))); + ImGui.set_function("EndTable", EndTable); + ImGui.set_function("TableNextRow", sol::overload(sol::resolve(TableNextRow), sol::resolve(TableNextRow), sol::resolve(TableNextRow))); + ImGui.set_function("TableNextColumn", TableNextColumn); + ImGui.set_function("TableSetColumnIndex", TableSetColumnIndex); + ImGui.set_function("TableSetupColumn", sol::overload(sol::resolve(TableSetupColumn), sol::resolve(TableSetupColumn), sol::resolve(TableSetupColumn), sol::resolve(TableSetupColumn))); + ImGui.set_function("TableSetupScrollFreeze", TableSetupScrollFreeze); + ImGui.set_function("TableHeadersRow", TableHeadersRow); + ImGui.set_function("TableHeader", TableHeader); + ImGui.set_function("TableGetSortSpecs", TableGetSortSpecs); + ImGui.set_function("TableGetColumnCount", TableGetColumnCount); + ImGui.set_function("TableGetColumnIndex", TableGetColumnIndex); + ImGui.set_function("TableGetRowIndex", TableGetRowIndex); + ImGui.set_function("TableGetColumnName", sol::overload(sol::resolve(TableGetColumnName), sol::resolve(TableGetColumnName))); + ImGui.set_function("TableGetColumnFlags", sol::overload(sol::resolve(TableGetColumnFlags), sol::resolve(TableGetColumnFlags))); + ImGui.set_function("TableSetBgColor", sol::overload(sol::resolve(TableSetBgColor), sol::resolve(TableSetBgColor), sol::resolve(TableSetBgColor), sol::resolve(TableSetBgColor))); +#pragma endregion Tables + +#pragma region Columns + ImGui.set_function("Columns", sol::overload(sol::resolve(Columns), sol::resolve(Columns), sol::resolve(Columns), sol::resolve(Columns))); + ImGui.set_function("NextColumn", NextColumn); + ImGui.set_function("GetColumnIndex", GetColumnIndex); + ImGui.set_function("GetColumnWidth", sol::overload(sol::resolve(GetColumnWidth), sol::resolve(GetColumnWidth))); + ImGui.set_function("SetColumnWidth", SetColumnWidth); + ImGui.set_function("GetColumnOffset", sol::overload(sol::resolve(GetColumnOffset), sol::resolve(GetColumnOffset))); + ImGui.set_function("SetColumnOffset", SetColumnOffset); + ImGui.set_function("GetColumnsCount", GetColumnsCount); +#pragma endregion Columns + +#pragma region Tab Bars, Tabs + ImGui.set_function("BeginTabBar", sol::overload(sol::resolve(BeginTabBar), sol::resolve(BeginTabBar))); + ImGui.set_function("EndTabBar", EndTabBar); + ImGui.set_function("BeginTabItem", sol::overload(sol::resolve(BeginTabItem), sol::resolve(BeginTabItem), sol::resolve(const std::string&, bool)>(BeginTabItem), sol::resolve(const std::string&, bool, int)>(BeginTabItem))); + ImGui.set_function("EndTabItem", EndTabItem); + ImGui.set_function("SetTabItemClosed", SetTabItemClosed); +#pragma endregion Tab Bars, Tabs + +#pragma region Disabling + ImGui.set_function("BeginDisabled", sol::overload(sol::resolve(BeginDisabled), sol::resolve(BeginDisabled))); + ImGui.set_function("EndDisabled", EndDisabled); + +#pragma endregion Disabling + +#pragma region Clipping + ImGui.set_function("PushClipRect", PushClipRect); + ImGui.set_function("PopClipRect", PopClipRect); +#pragma endregion Clipping + +#pragma region Focus, Activation + ImGui.set_function("SetItemDefaultFocus", SetItemDefaultFocus); + ImGui.set_function("SetKeyboardFocusHere", sol::overload(sol::resolve(SetKeyboardFocusHere), sol::resolve(SetKeyboardFocusHere))); +#pragma endregion Focus, Activation + +#pragma region Item /Widgets Utilities + ImGui.set_function("IsItemHovered", sol::overload(sol::resolve(IsItemHovered), sol::resolve(IsItemHovered))); + ImGui.set_function("IsItemActive", IsItemActive); + ImGui.set_function("IsItemFocused", IsItemFocused); + ImGui.set_function("IsItemClicked", sol::overload(sol::resolve(IsItemClicked), sol::resolve(IsItemClicked))); + ImGui.set_function("IsItemVisible", IsItemVisible); + ImGui.set_function("IsItemEdited", IsItemEdited); + ImGui.set_function("IsItemActivated", IsItemActivated); + ImGui.set_function("IsItemDeactivated", IsItemDeactivated); + ImGui.set_function("IsItemDeactivatedAfterEdit", IsItemDeactivatedAfterEdit); + ImGui.set_function("IsItemToggledOpen", IsItemToggledOpen); + ImGui.set_function("IsAnyItemHovered", IsAnyItemHovered); + ImGui.set_function("IsAnyItemActive", IsAnyItemActive); + ImGui.set_function("IsAnyItemFocused", IsAnyItemFocused); + ImGui.set_function("GetItemRectMin", GetItemRectMin); + ImGui.set_function("GetItemRectMax", GetItemRectMax); + ImGui.set_function("GetItemRectSize", GetItemRectSize); + ImGui.set_function("SetItemAllowOverlap", SetItemAllowOverlap); +#pragma endregion Item / Widgets Utilities + +#pragma region Miscellaneous Utilities + ImGui.set_function("IsRectVisible", sol::overload(sol::resolve(IsRectVisible), sol::resolve(IsRectVisible))); + ImGui.set_function("GetTime", GetTime); + ImGui.set_function("GetFrameCount", GetFrameCount); + ImGui.set_function("GetBackgroundDrawList", GetBackgroundDrawList); + ImGui.set_function("GetForegroundDrawList", GetForegroundDrawList); + ImGui.set_function("GetStyleColorName", GetStyleColorName); + ImGui.set_function("BeginChildFrame", sol::overload(sol::resolve(BeginChildFrame), sol::resolve(BeginChildFrame))); + ImGui.set_function("EndChildFrame", EndChildFrame); + ImGui.set_function("GetStyle", GetStyle); +#pragma endregion Miscellaneous Utilities + +#pragma region Text Utilities + ImGui.set_function("CalcTextSize", sol::overload(sol::resolve(const std::string&)>(CalcTextSize), sol::resolve(const std::string&, bool)>(CalcTextSize), sol::resolve(const std::string&, bool, float)>(CalcTextSize))); +#pragma endregion Text Utilities + +#pragma region Color Utilities + ImGui.set_function("ColorConvertU32ToFloat4", ColorConvertU32ToFloat4); + ImGui.set_function("ColorConvertFloat4ToU32", ColorConvertFloat4ToU32); + ImGui.set_function("ColorConvertRGBtoHSV", ColorConvertRGBtoHSV); + ImGui.set_function("ColorConvertHSVtoRGB", ColorConvertHSVtoRGB); +#pragma endregion Color Utilities + +#pragma region Inputs Utilities : Mouse + ImGui.set_function("IsMouseHoveringRect", sol::overload(sol::resolve(IsMouseHoveringRect), sol::resolve(IsMouseHoveringRect))); + ImGui.set_function("GetMousePos", GetMousePos); + ImGui.set_function("GetMousePosOnOpeningCurrentPopup", GetMousePosOnOpeningCurrentPopup); + ImGui.set_function("IsMouseDragging", sol::overload(sol::resolve(IsMouseDragging), sol::resolve(IsMouseDragging))); + ImGui.set_function("GetMouseDragDelta", sol::overload(sol::resolve()>(GetMouseDragDelta), sol::resolve(int)>(GetMouseDragDelta), sol::resolve(int, float)>(GetMouseDragDelta))); + ImGui.set_function("ResetMouseDragDelta", sol::overload(sol::resolve(ResetMouseDragDelta), sol::resolve(ResetMouseDragDelta))); +#pragma endregion Inputs Utilities : Mouse + +#pragma region Clipboard Utilities + ImGui.set_function("GetClipboardText", GetClipboardText); + ImGui.set_function("SetClipboardText", SetClipboardText); +#pragma endregion Clipboard Utilities + +#pragma region Drawing APIs + ImGui.set_function("ImDrawListAddLine", sol::overload(sol::resolve(ImDrawListAddLine), sol::resolve(ImDrawListAddLine))); + ImGui.set_function("ImDrawListAddRect", sol::overload(sol::resolve(ImDrawListAddRect), sol::resolve(ImDrawListAddRect), sol::resolve(ImDrawListAddRect), sol::resolve(ImDrawListAddRect))); + ImGui.set_function("ImDrawListAddRectFilled", sol::overload(sol::resolve(ImDrawListAddRectFilled), sol::resolve(ImDrawListAddRectFilled), sol::resolve(ImDrawListAddRectFilled))); + ImGui.set_function("ImDrawListAddRectFilledMultiColor", ImDrawListAddRectFilledMultiColor); + ImGui.set_function("ImDrawListAddQuad", sol::overload(sol::resolve(ImDrawListAddQuad), sol::resolve(ImDrawListAddQuad))); + ImGui.set_function("ImDrawListAddQuadFilled", ImDrawListAddQuadFilled); + ImGui.set_function("ImDrawListAddTriangle", sol::overload(sol::resolve(ImDrawListAddTriangle), sol::resolve(ImDrawListAddTriangle))); + ImGui.set_function("ImDrawListAddTriangleFilled", ImDrawListAddTriangleFilled); + ImGui.set_function("ImDrawListAddCircle", sol::overload(sol::resolve(ImDrawListAddCircle), sol::resolve(ImDrawListAddCircle), sol::resolve(ImDrawListAddCircle))); + ImGui.set_function("ImDrawListAddCircleFilled", sol::overload(sol::resolve(ImDrawListAddCircleFilled), sol::resolve(ImDrawListAddCircleFilled))); + ImGui.set_function("ImDrawListAddNgon", sol::overload(sol::resolve(ImDrawListAddNgon), sol::resolve(ImDrawListAddNgon))); + ImGui.set_function("ImDrawListAddNgonFilled", ImDrawListAddNgonFilled); + ImGui.set_function("ImDrawListAddText", + sol::overload(sol::resolve(ImDrawListAddText), sol::resolve(ImDrawListAddText), sol::resolve(ImDrawListAddText) + // sol::resolve(ImDrawListAddText) + )); + // ImGui.set_function("ImDrawListAddPolyline " , ImDrawListAddPolyline); + // ImGui.set_function("ImDrawListAddConvexPolyFilled" , ImDrawListAddConvexPolyFilled); + ImGui.set_function("ImDrawListAddBezierCubic", sol::overload(sol::resolve(ImDrawListAddBezierCubic), sol::resolve(ImDrawListAddBezierCubic))); + ImGui.set_function("ImDrawListAddBezierQuadratic", sol::overload(sol::resolve(ImDrawListAddBezierQuadratic), sol::resolve(ImDrawListAddBezierQuadratic))); +#pragma endregion Drawing APIs + + luaGlobals["ImGui"] = ImGui; + } +} \ No newline at end of file diff --git a/src/lua/bindings/script.hpp b/src/lua/bindings/script.hpp index 6353d121..03c37d2e 100644 --- a/src/lua/bindings/script.hpp +++ b/src/lua/bindings/script.hpp @@ -47,7 +47,7 @@ namespace lua::script // Param: name: string: name of your new looped script // Param: func: function: function that will be executed in a forever loop. // Registers a function that will be looped as a gta script. - // **Exemple Usage:** + // **Example Usage:** // ```lua // script.register_looped("nameOfMyLoopedScript", function (script) // -- sleep until next game frame @@ -108,7 +108,7 @@ namespace lua::script // Name: run_in_fiber // Param: func: function: function that will be executed once in the fiber pool. // Executes a function once inside the fiber pool, you can call natives inside it and yield or sleep. - // **Exemple Usage:** + // **Example Usage:** // ```lua // script.run_in_fiber(function (script) // -- sleep until next game frame diff --git a/src/lua/lua_manager.cpp b/src/lua/lua_manager.cpp index cb2ea3af..4bc70805 100644 --- a/src/lua/lua_manager.cpp +++ b/src/lua/lua_manager.cpp @@ -42,6 +42,19 @@ namespace big return false; } + void lua_manager::draw_independent_gui() + { + std::lock_guard guard(m_module_lock); + + for (const auto& module : m_modules) + { + for (const auto& element : module->m_independent_gui) + { + element->draw(); + } + } + } + void lua_manager::draw_gui(rage::joaat_t tab_hash) { std::lock_guard guard(m_module_lock); diff --git a/src/lua/lua_manager.hpp b/src/lua/lua_manager.hpp index 8f473bfd..340cbdd9 100644 --- a/src/lua/lua_manager.hpp +++ b/src/lua/lua_manager.hpp @@ -46,6 +46,7 @@ namespace big } + void draw_independent_gui(); void draw_gui(rage::joaat_t tab_hash); void unload_module(rage::joaat_t module_id); diff --git a/src/lua/lua_module.cpp b/src/lua/lua_module.cpp index ee4bb90d..fe50b815 100644 --- a/src/lua/lua_module.cpp +++ b/src/lua/lua_module.cpp @@ -13,6 +13,7 @@ #include "bindings/script.hpp" #include "bindings/tunables.hpp" #include "bindings/vector.hpp" +#include "bindings/imgui.hpp" #include "file_manager.hpp" #include "script_mgr.hpp" @@ -215,5 +216,6 @@ namespace big lua::event::bind(state); lua::vector::bind(state); lua::global_table::bind(state); + lua::imgui::bind(state, state.globals()); } } \ No newline at end of file diff --git a/src/lua/lua_module.hpp b/src/lua/lua_module.hpp index 458c4fe3..ec97d932 100644 --- a/src/lua/lua_module.hpp +++ b/src/lua/lua_module.hpp @@ -26,6 +26,7 @@ namespace big std::unordered_map> m_tab_to_sub_tabs; + std::vector> m_independent_gui; std::unordered_map>> m_gui; std::unordered_map> m_event_callbacks; std::vector m_allocated_memory; diff --git a/src/views/core/view_root.cpp b/src/views/core/view_root.cpp index c78020dc..260e507c 100644 --- a/src/views/core/view_root.cpp +++ b/src/views/core/view_root.cpp @@ -1,4 +1,5 @@ #include "views/view.hpp" +#include "lua/lua_manager.hpp" namespace big { @@ -11,6 +12,9 @@ namespace big debug::main(); + if (g_lua_manager) + g_lua_manager->draw_independent_gui(); + if (g.window.demo) // It is not the YimMenu way. ImGui::ShowDemoWindow(&g.window.demo); }