User Tools

Site Tools


addons:functions:gui

Gui Namespace

The gui namespace contains functions that interact with the ImGui interface of Ashita. This allows addons to create rich user interfaces.

You can access these functions via:

ashita.gui.

Because of the nature of these functions and the amount of functions that exist, I do not plan to create full documentation for each function. You can find an example of the ImGui demo application ported to an Ashita addon here instead.

This will serve as a demo of how to use these functions:
https://gist.github.com/atom0s/188283e6ff097f37fa31400f22ec8762

It is important that when making use of the GUI functions, that your addon includes the script: 'imguidef'.
You can do this by adding the following line of code to the top of your addon:

require 'imguidef'

By including this helper file, this also exposes these GUI functions via a global 'imgui'. Instead of having to use 'ashita.gui.' before every call, instead you just need to use 'imgui.' instead. For example:

-- before
local hide = ashita.gui.GetHide();

-- after
local hide = imgui.GetHide();


Most of the calls are straight-forward and used as they are in C++. However, some of them had to have minor changes to work with Lua's types and lack of pointers. The following is a list of how things are implemented.

Please note, the following changes apply to ALL functions listed below:

  • Any function that takes ImVec2(…) is replaced by two float values instead.
  • Any function that takes ImVec4(…) is replaced by four float values instead.
    • Example (Before): void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);
    • Example (After): void SetNextWindowPos(float pos_x, float pos_y, ImGuiSetCond cond = 0);
  • Any function that returns ImVec2(…) instead returns two values.
  • Any function that returns ImVec4(…) instead returns four values.
    • Example (Before): ImVec2 GetWindowPos(void);
    • Example (After): pos_x, pos_y = GetWindowPos();
  • Any function that takes a pointer value is replaced with an ImGuiVar variable instead. (See more info on ImGuiVar below.)
  • Any function that accepts varargs '…' are not handled as such. Instead they accept only a single string. Use Lua's buildt-in string.format function to format strings.
  • Any function that accepts va_list as an argument type is not implemented as Lua has no way to do this natively.

  • bool GetHideObjects(void) const;
  • void SetHideObjects(bool bHide);
    • Implemented as 'imgui.GetHide()' and 'imgui.SetHide(hide)'.
  • ImGuiIO& GetIO(void);
  • ImGuiStyle& GetStyle(void);
  • ImDrawData* GetDrawData(void);
    • Not implemented through these functions.
    • GetIO can be accessed via 'imgui.io'.
    • GetStyle can be accessed via 'imgui.style'.
    • GetDrawData is not implemented at all currently.
  • void ShowUserGuide(void);
  • void ShowStyleEditor(ImGuiStyle* ref = NULL);
  • void ShowTestWindow(bool* p_open = NULL);
  • void ShowMetricsWindow(bool* p_open = NULL);
  • bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
  • bool Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0);
  • void End(void);
  • bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0);
  • bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0);
  • void EndChild(void);
  • ImVec2 GetContentRegionMax(void);
  • ImVec2 GetContentRegionAvail(void);
  • float GetContentRegionAvailWidth(void);
  • ImVec2 GetWindowContentRegionMin(void);
  • ImVec2 GetWindowContentRegionMax(void);
  • float GetWindowContentRegionWidth(void);
  • ImDrawList* GetWindowDrawList(void);
  • ImVec2 GetWindowPos(void);
  • ImVec2 GetWindowSize(void);
  • float GetWindowWidth(void);
  • float GetWindowHeight(void);
  • bool IsWindowCollapsed(void);
  • void SetWindowFontScale(float scale);
  • void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);
  • void SetNextWindowPosCenter(ImGuiSetCond cond = 0);
  • void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);
  • void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback = NULL, void* custom_callback_data = NULL);
    • callback is implemented as a string. It is the name to a Lua function to call when the callback is invoked. (custom_callback_data is not implemented.)
  • void SetNextWindowContentSize(const ImVec2& size);
  • void SetNextWindowContentWidth(float width);
  • void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);
  • void SetNextWindowFocus(void);
  • void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);
  • void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);
  • void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);
  • void SetWindowFocus(void);
  • void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0);
  • void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0);
  • void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0);
  • void SetWindowFocus(const char* name);
  • float GetScrollX(void);
  • float GetScrollY(void);
  • float GetScrollMaxX(void);
  • float GetScrollMaxY(void);
  • void SetScrollX(float scroll_x);
  • void SetScrollY(float scroll_y);
  • void SetScrollHere(float center_y_ratio = 0.5f);
  • void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);
  • void SetKeyboardFocusHere(int offset = 0);
  • void SetStateStorage(ImGuiStorage* tree);
  • ImGuiStorage* GetStateStorage(void);
  • void PushFont(ImFont* font);
  • void PopFont(void);
  • void PushStyleColor(ImGuiCol idx, const ImVec4& col);
  • void PopStyleColor(int count = 1);
  • void PushStyleVar(ImGuiStyleVar idx, float val);
  • void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val);
  • void PopStyleVar(int count = 1);
  • ImFont* GetFont(void);
  • float GetFontSize(void);
  • ImVec2 GetFontTexUvWhitePixel(void);
  • ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f);
  • ImU32 GetColorU32(const ImVec4& col);
  • void PushItemWidth(float item_width);
  • void PopItemWidth(void);
  • float CalcItemWidth(void);
  • void PushTextWrapPos(float wrap_pos_x = 0.0f);
  • void PopTextWrapPos(void);
  • void PushAllowKeyboardFocus(bool v);
  • void PopAllowKeyboardFocus(void);
  • void PushButtonRepeat(bool repeat);
  • void PopButtonRepeat(void);
  • void Separator(void);
  • void SameLine(float pos_x = 0.0f, float spacing_w = -1.0f);
  • void NewLine(void);
  • void Spacing(void);
  • void Dummy(const ImVec2& size);
  • void Indent(float indent_w = 0.0f);
  • void Unindent(float indent_w = 0.0f);
  • void BeginGroup(void);
  • void EndGroup(void);
  • ImVec2 GetCursorPos(void);
  • float GetCursorPosX(void);
  • float GetCursorPosY(void);
  • void SetCursorPos(const ImVec2& local_pos);
  • void SetCursorPosX(float x);
  • void SetCursorPosY(float y);
  • ImVec2 GetCursorStartPos(void);
  • ImVec2 GetCursorScreenPos(void);
  • void SetCursorScreenPos(const ImVec2& pos);
  • void AlignFirstTextHeightToWidgets(void);
  • float GetTextLineHeight(void);
  • float GetTextLineHeightWithSpacing(void);
  • float GetItemsLineHeightWithSpacing(void);
  • void Columns(int count = 1, const char* id = NULL, bool border = true);
  • void NextColumn(void);
  • int GetColumnIndex(void);
  • float GetColumnOffset(int column_index = -1);
  • void SetColumnOffset(int column_index, float offset_x);
  • float GetColumnWidth(int column_index = -1);
  • int GetColumnsCount(void);
  • void PushID(const char* str_id);
  • void PushID(const char* str_id_begin, const char* str_id_end);
  • void PushID(const void* ptr_id);
  • void PushID(int int_id);
  • void PopID(void);
  • ImGuiID GetID(const char* str_id);
  • ImGuiID GetID(const char* str_id_begin, const char* str_id_end);
  • ImGuiID GetID(const void* ptr_id);
  • void Text(const char* fmt, …);
  • void TextV(const char* fmt, va_list args);
  • void TextColored(const ImVec4& col, const char* fmt, …);
  • void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
  • void TextDisabled(const char* fmt, …);
  • void TextDisabledV(const char* fmt, va_list args);
  • void TextWrapped(const char* fmt, …);
  • void TextWrappedV(const char* fmt, va_list args);
  • void TextUnformatted(const char* text, const char* text_end = NULL);
    • There may be some issues with this function. It may change in the future.
  • void LabelText(const char* label, const char* fmt, …);
  • void LabelTextV(const char* label, const char* fmt, va_list args);
  • void Bullet(void);
  • void BulletText(const char* fmt, …);
  • void BulletTextV(const char* fmt, va_list args);
  • bool Button(const char* label, const ImVec2& size = ImVec2(0, 0));
  • bool SmallButton(const char* label);
  • bool InvisibleButton(const char* str_id, const ImVec2& size);
  • void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
  • bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
  • bool Checkbox(const char* label, bool* v);
  • bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
  • bool RadioButton(const char* label, bool active);
  • bool RadioButton(const char* label, int* v, int v_button);
  • bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
  • bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1);
  • bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
  • bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
  • bool ColorEdit3(const char* label, float col[3]);
  • bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
  • void ColorEditMode(ImGuiColorEditMode mode);
  • void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
    • Implemented in a custom manner to support an array of float values, using a Lua table. Call is setup as:
      • imgui.PlotLines(label, values_table, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size_x, graph_size_y, stride);
      • Default values are still present starting at values_offset.
  • void PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
  • void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
    • Implemented in a custom manner to support an array of float values, using a Lua table. Call is setup as:
      • imgui.PlotHistogram(label, values_table, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size_x, graph_size_y, stride);
      • Default values are still present starting at values_offset.
  • void PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
  • void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL);
  • bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = “%.3f”, float power = 1.0f);
  • bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = “%.3f”, float power = 1.0f);
  • bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = “%.3f”, float power = 1.0f);
  • bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = “%.3f”, float power = 1.0f);
  • bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = “%.3f”, const char* display_format_max = NULL, float power = 1.0f);
  • bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = “%.0f”);
  • bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = “%.0f”);
  • bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = “%.0f”);
  • bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = “%.0f”);
  • bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = “%.0f”, const char* display_format_max = NULL);
  • bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
    • callback is implemented as a string. It is the name to a Lua function to call when the callback is invoked. (user_data is not implemented.)
  • bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
    • callback is implemented as a string. It is the name to a Lua function to call when the callback is invoked. (user_data is not implemented.)
  • bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
  • bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
  • bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
  • bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
  • bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
  • bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);
  • bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);
  • bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);
  • bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = “%.3f”, float power = 1.0f);
  • bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = “%.3f”, float power = 1.0f);
  • bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = “%.3f”, float power = 1.0f);
  • bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = “%.3f”, float power = 1.0f);
  • bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
  • bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = “%.0f”);
  • bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = “%.0f”);
  • bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = “%.0f”);
  • bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = “%.0f”);
  • bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = “%.3f”, float power = 1.0f);
  • bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = “%.0f”);
  • bool TreeNode(const char* label);
  • bool TreeNode(const char* str_id, const char* fmt, …);
  • bool TreeNode(const void* ptr_id, const char* fmt, …);
  • bool TreeNodeV(const char* str_id, const char* fmt, va_list args);
  • bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args);
  • bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0);
  • bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, …);
  • bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, …);
  • bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args);
  • bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args);
  • void TreePush(const char* str_id = NULL);
  • void TreePush(const void* ptr_id = NULL);
  • void TreePop(void);
  • void TreeAdvanceToLabelPos(void);
  • float GetTreeNodeToLabelSpacing(void);
  • void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0);
  • bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0);
  • bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0);
  • bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));
  • bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));
  • bool ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
  • bool ListBox(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1);
  • bool ListBox(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
  • bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0));
  • bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1);
  • void ListBoxFooter(void);
  • void Value(const char* prefix, bool b);
  • void Value(const char* prefix, int v);
  • void Value(const char* prefix, unsigned int v);
  • void Value(const char* prefix, float v, const char* float_format = NULL);
    • Value functions take an extra argument due to not being able to differentiate between the types in Lua.
      • Value(prefix, type, b);
      • Value(prefix, type, v);
      • Value(prefix, type, v);
      • Value(prefix, type, v, float_format);
        • Type: 0 = bool
        • Type: 1 = int
        • Type: 2 = unsigned int
        • Type: 3 = float
  • void ValueColor(const char* prefix, const ImVec4& v);
  • void ValueColor(const char* prefix, unsigned int v);
  • void SetTooltip(const char* fmt, …);
  • void SetTooltipV(const char* fmt, va_list args);
  • void BeginTooltip(void);
  • void EndTooltip(void);
  • bool BeginMainMenuBar(void);
  • void EndMainMenuBar(void);
  • bool BeginMenuBar(void);
  • void EndMenuBar(void);
  • bool BeginMenu(const char* label, bool enabled = true);
  • void EndMenu(void);
  • bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true);
  • bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true);
  • void OpenPopup(const char* str_id);
  • bool BeginPopup(const char* str_id);
  • bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags extra_flags = 0);
  • bool BeginPopupContextItem(const char* str_id, int mouse_button = 1);
  • bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1);
  • bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1);
  • void EndPopup(void);
  • void CloseCurrentPopup(void);
  • void LogToTTY(int max_depth = -1);
  • void LogToFile(int max_depth = -1, const char* filename = NULL);
  • void LogToClipboard(int max_depth = -1);
  • void LogFinish(void);
  • void LogButtons(void);
  • void LogText(const char* fmt, …);
    • These logging functions should not be relied on, they may be removed in the future.
  • void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
  • void PopClipRect(void);
  • bool IsItemHovered(void);
  • bool IsItemHoveredRect(void);
  • bool IsItemActive(void);
  • bool IsItemClicked(int mouse_button = 0);
  • bool IsItemVisible(void);
  • bool IsAnyItemHovered(void);
  • bool IsAnyItemActive(void);
  • ImVec2 GetItemRectMin(void);
  • ImVec2 GetItemRectMax(void);
  • ImVec2 GetItemRectSize(void);
  • void SetItemAllowOverlap(void);
  • bool IsWindowHovered(void);
  • bool IsWindowFocused(void);
  • bool IsRootWindowFocused(void);
  • bool IsRootWindowOrAnyChildFocused(void);
  • bool IsRootWindowOrAnyChildHovered(void);
  • bool IsRectVisible(const ImVec2& size);
  • bool IsPosHoveringAnyWindow(const ImVec2& pos);
  • float GetTime(void);
  • int GetFrameCount(void);
  • const char* GetStyleColName(ImGuiCol idx);
  • ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f);
    • Not implementing this unless its requested.
  • ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
    • Not implementing this unless it's requested.
  • void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);
    • Not implementing this unless it's requested.
  • bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags = 0);
  • void EndChildFrame(void);
  • ImVec4 ColorConvertU32ToFloat4(ImU32 in);
  • ImU32 ColorConvertFloat4ToU32(const ImVec4& in);
  • void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
    • Lua does not support 'out' values, instead, this function will return out_h, out_s, out_v.
  • void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
    • Lua does not support 'out' values, instead, this function will return out_r, out_g, out_b.
  • int GetKeyIndex(ImGuiKey key);
  • bool IsKeyDown(int key_index);
  • bool IsKeyPressed(int key_index, bool repeat = true);
  • bool IsKeyReleased(int key_index);
  • bool IsMouseDown(int button);
  • bool IsMouseClicked(int button, bool repeat = false);
  • bool IsMouseDoubleClicked(int button);
  • bool IsMouseReleased(int button);
  • bool IsMouseHoveringWindow(void);
  • bool IsMouseHoveringAnyWindow(void);
  • bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);
  • bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f);
  • ImVec2 GetMousePos(void);
  • ImVec2 GetMousePosOnOpeningCurrentPopup(void);
  • ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f);
  • void ResetMouseDragDelta(int button = 0);
  • ImGuiMouseCursor GetMouseCursor(void);
  • void SetMouseCursor(ImGuiMouseCursor type);
  • void CaptureKeyboardFromApp(bool capture = true);
  • void CaptureMouseFromApp(bool capture = true);
  • void* MemAlloc(size_t sz);
    • Not implementing this function.
  • void MemFree(void* ptr);
    • Not implementing this function.
  • const char* GetClipboardText(void);
  • void SetClipboardText(const char* text);
  • const char* GetVersion(void);
  • ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void(*free_fn)(void*) = NULL);
    • Not implementing this function.
  • void DestroyContext(ImGuiContext* ctx);
    • Not implementing this function.
  • ImGuiContext* GetCurrentContext(void);
    • Not implementing this function.
  • void SetCurrentContext(ImGuiContext* ctx);
    • Not implementing this function.

Notes

InputText / InputTextMultiline - The callback, if present, should be a string that points to a callback function like this: - The callbacks data is a imgui.ImGuiTextEditCallbackData structure instance.

    if (imgui.InputText('test', test_text_input_buffer, 1024, imgui.bor(ImGuiInputTextFlags_EnterReturnsTrue,ImGuiInputTextFlags_CallbackCompletion,ImGuiInputTextFlags_CallbackHistory), 'test_callback')) then
        print('Enter was pressed!');
    end
    
    function test_callback(data)
        print('Callback was fired!');
        return 0;
    end

SetNextWindowSizeConstraints - The callback, if present, should be a string that points to a callback function like this: - The callbacks data is a imgui.ImGuiSizeConstraintCallbackData structure instance.

function SquareResizeConstraint(data)
    data.DesiredSize = ImVec2(math.max(data.DesiredSize.x, data.DesiredSize.y), math.max(data.DesiredSize.x, data.DesiredSize.y));    
end

imgui.SetNextWindowSizeConstraints(0, 0, float_max, float_max, 'SquareResizeConstraint');

addons/functions/gui.txt · Last modified: 2017/04/22 00:10 (external edit)