User Tools

Site Tools


addons:functions:gui

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

addons:functions:gui [2017/04/21 22:03]
atom0s
addons:functions:gui [2017/04/22 00:10]
Line 1: Line 1:
-===== 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: 
-<code lua>​ashita.gui.</​code>​ 
- 
-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 
- 
-<WRAP important>​ 
-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:\\ 
-<code lua>​require '​imguidef'</​code>​ 
-</​WRAP>​ 
- 
----- 
- 
-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. 
- 
----- 
- 
-  * <color green>​bool GetHideObjects(void) const;</​color>​\\ 
-  * <color green>​void SetHideObjects(bool bHide);</​color>​\\ 
-    * Implemented as '​imgui.GetHide()'​ and '​imgui.SetHide(hide)'​. 
- 
-  * <color red>​ImGuiIO&​ GetIO(void);</​color>​\\ 
-  * <color red>​ImGuiStyle&​ GetStyle(void);</​color>​\\ 
-  * <color red>​ImDrawData* GetDrawData(void);</​color>​\\ 
-    * 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. 
- 
-  * <color green>​void ShowUserGuide(void);</​color>​\\ 
-  * <color green>​void ShowStyleEditor(ImGuiStyle* ref = NULL);</​color>​\\ 
-  * <color green>​void ShowTestWindow(bool* p_open = NULL);</​color>​\\ 
-  * <color green>​void ShowMetricsWindow(bool* p_open = NULL);</​color>​\\ 
- 
-  * <color green>​bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);</​color>​\\ 
-  * <color green>​bool Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use,​ float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0);</​color>​\\ 
-  * <color green>​void End(void);</​color>​\\ 
-  * <color green>​bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​void EndChild(void);</​color>​\\ 
-  * <color green>​ImVec2 GetContentRegionMax(void);</​color>​\\ 
-  * <color green>​ImVec2 GetContentRegionAvail(void);</​color>​\\ 
-  * <color green>​float GetContentRegionAvailWidth(void);</​color>​\\ 
-  * <color green>​ImVec2 GetWindowContentRegionMin(void);</​color>​\\ 
-  * <color green>​ImVec2 GetWindowContentRegionMax(void);</​color>​\\ 
-  * <color green>​float GetWindowContentRegionWidth(void);</​color>​\\ 
-  * <color red>​ImDrawList* GetWindowDrawList(void);</​color>​\\ 
-  * <color green>​ImVec2 GetWindowPos(void);</​color>​\\ 
-  * <color green>​ImVec2 GetWindowSize(void);</​color>​\\ 
-  * <color green>​float GetWindowWidth(void);</​color>​\\ 
-  * <color green>​float GetWindowHeight(void);</​color>​\\ 
-  * <color green>​bool IsWindowCollapsed(void);</​color>​\\ 
-  * <color green>​void SetWindowFontScale(float scale);</​color>​\\ 
- 
-  * <color green>​void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetNextWindowPosCenter(ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback = NULL, void* custom_callback_data = NULL);</​color>​\\ 
-    * 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.) 
-  * <color green>​void SetNextWindowContentSize(const ImVec2& size);</​color>​\\ 
-  * <color green>​void SetNextWindowContentWidth(float width);</​color>​\\ 
-  * <color green>​void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetNextWindowFocus(void);</​color>​\\ 
-  * <color green>​void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetWindowFocus(void);</​color>​\\ 
-  * <color green>​void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​void SetWindowFocus(const char* name);</​color>​\\ 
- 
-  * <color green>​float GetScrollX(void);</​color>​\\ 
-  * <color green>​float GetScrollY(void);</​color>​\\ 
-  * <color green>​float GetScrollMaxX(void);</​color>​\\ 
-  * <color green>​float GetScrollMaxY(void);</​color>​\\ 
-  * <color green>​void SetScrollX(float scroll_x);</​color>​\\ 
-  * <color green>​void SetScrollY(float scroll_y);</​color>​\\ 
-  * <color green>​void SetScrollHere(float center_y_ratio = 0.5f);</​color>​\\ 
-  * <color green>​void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);</​color>​\\ 
-  * <color green>​void SetKeyboardFocusHere(int offset = 0);</​color>​\\ 
-  * <color red>void SetStateStorage(ImGuiStorage* tree);</​color>​\\ 
-  * <color red>​ImGuiStorage* GetStateStorage(void);</​color>​\\ 
- 
-  * <color green>​void PushFont(ImFont* font);</​color>​\\ 
-  * <color green>​void PopFont(void);</​color>​\\ 
-  * <color green>​void PushStyleColor(ImGuiCol idx, const ImVec4& col);</​color>​\\ 
-  * <color green>​void PopStyleColor(int count = 1);</​color>​\\ 
-  * <color green>​void PushStyleVar(ImGuiStyleVar idx, float val);</​color>​\\ 
-  * <color green>​void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val);</​color>​\\ 
-  * <color green>​void PopStyleVar(int count = 1);</​color>​\\ 
-  * <color red>​ImFont* GetFont(void);</​color>​\\ 
-  * <color green>​float GetFontSize(void);</​color>​\\ 
-  * <color green>​ImVec2 GetFontTexUvWhitePixel(void);</​color>​\\ 
-  * <color green>​ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f);</​color>​\\ 
-  * <color green>​ImU32 GetColorU32(const ImVec4& col);</​color>​\\ 
- 
-  * <color green>​void PushItemWidth(float item_width);</​color>​\\ 
-  * <color green>​void PopItemWidth(void);</​color>​\\ 
-  * <color green>​float CalcItemWidth(void);</​color>​\\ 
-  * <color green>​void PushTextWrapPos(float wrap_pos_x = 0.0f);</​color>​\\ 
-  * <color green>​void PopTextWrapPos(void);</​color>​\\ 
-  * <color green>​void PushAllowKeyboardFocus(bool v);</​color>​\\ 
-  * <color green>​void PopAllowKeyboardFocus(void);</​color>​\\ 
-  * <color green>​void PushButtonRepeat(bool repeat);</​color>​\\ 
-  * <color green>​void PopButtonRepeat(void);</​color>​\\ 
- 
-  * <color green>​void Separator(void);</​color>​\\ 
-  * <color green>​void SameLine(float pos_x = 0.0f, float spacing_w = -1.0f);</​color>​\\ 
-  * <color green>​void NewLine(void);</​color>​\\ 
-  * <color green>​void Spacing(void);</​color>​\\ 
-  * <color green>​void Dummy(const ImVec2& size);</​color>​\\ 
-  * <color green>​void Indent(float indent_w = 0.0f);</​color>​\\ 
-  * <color green>​void Unindent(float indent_w = 0.0f);</​color>​\\ 
-  * <color green>​void BeginGroup(void);</​color>​\\ 
-  * <color green>​void EndGroup(void);</​color>​\\ 
-  * <color green>​ImVec2 GetCursorPos(void);</​color>​\\ 
-  * <color green>​float GetCursorPosX(void);</​color>​\\ 
-  * <color green>​float GetCursorPosY(void);</​color>​\\ 
-  * <color green>​void SetCursorPos(const ImVec2& local_pos);</​color>​\\ 
-  * <color green>​void SetCursorPosX(float x);</​color>​\\ 
-  * <color green>​void SetCursorPosY(float y);</​color>​\\ 
-  * <color green>​ImVec2 GetCursorStartPos(void);</​color>​\\ 
-  * <color green>​ImVec2 GetCursorScreenPos(void);</​color>​\\ 
-  * <color green>​void SetCursorScreenPos(const ImVec2& pos);</​color>​\\ 
-  * <color green>​void AlignFirstTextHeightToWidgets(void);</​color>​\\ 
-  * <color green>​float GetTextLineHeight(void);</​color>​\\ 
-  * <color green>​float GetTextLineHeightWithSpacing(void);</​color>​\\ 
-  * <color green>​float GetItemsLineHeightWithSpacing(void);</​color>​\\ 
- 
-  * <color green>​void Columns(int count = 1, const char* id = NULL, bool border = true);</​color>​\\ 
-  * <color green>​void NextColumn(void);</​color>​\\ 
-  * <color green>​int GetColumnIndex(void);</​color>​\\ 
-  * <color green>​float GetColumnOffset(int column_index = -1);</​color>​\\ 
-  * <color green>​void SetColumnOffset(int column_index,​ float offset_x);</​color>​\\ 
-  * <color green>​float GetColumnWidth(int column_index = -1);</​color>​\\ 
-  * <color green>​int GetColumnsCount(void);</​color>​\\ 
- 
-  * <color green>​void PushID(const char* str_id);</​color>​\\ 
-  * <color green>​void PushID(const char* str_id_begin,​ const char* str_id_end);</​color>​\\ 
-  * <color green>​void PushID(const void* ptr_id);</​color>​\\ 
-  * <color green>​void PushID(int int_id);</​color>​\\ 
-  * <color green>​void PopID(void);</​color>​\\ 
-  * <color green>​ImGuiID GetID(const char* str_id);</​color>​\\ 
-  * <color green>​ImGuiID GetID(const char* str_id_begin,​ const char* str_id_end);</​color>​\\ 
-  * <color green>​ImGuiID GetID(const void* ptr_id);</​color>​\\ 
- 
-  * <color green>​void Text(const char* fmt, ...);</​color>​\\ 
-  * <color red>void TextV(const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void TextColored(const ImVec4& col, const char* fmt, ...);</​color>​\\ 
-  * <color red>void TextColoredV(const ImVec4& col, const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void TextDisabled(const char* fmt, ...);</​color>​\\ 
-  * <color red>void TextDisabledV(const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void TextWrapped(const char* fmt, ...);</​color>​\\ 
-  * <color red>void TextWrappedV(const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void TextUnformatted(const char* text, const char* text_end = NULL);</​color>​\\ 
-    * There may be some issues with this function. It may change in the future. 
-  * <color green>​void LabelText(const char* label, const char* fmt, ...);</​color>​\\ 
-  * <color red>void LabelTextV(const char* label, const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void Bullet(void);</​color>​\\ 
-  * <color green>​void BulletText(const char* fmt, ...);</​color>​\\ 
-  * <color red>void BulletTextV(const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​bool Button(const char* label, const ImVec2& size = ImVec2(0, 0));</​color>​\\ 
-  * <color green>​bool SmallButton(const char* label);</​color>​\\ 
-  * <color green>​bool InvisibleButton(const char* str_id, const ImVec2& size);</​color>​\\ 
-  * <color green>​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));</​color>​\\ 
-  * <color green>​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));</​color>​\\ 
-  * <color green>​bool Checkbox(const char* label, bool* v);</​color>​\\ 
-  * <color green>​bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);</​color>​\\ 
-  * <color green>​bool RadioButton(const char* label, bool active);</​color>​\\ 
-  * <color green>​bool RadioButton(const char* label, int* v, int v_button);</​color>​\\ 
-  * <color red>bool Combo(const char* label, int* current_item,​ const char%%**%% items, int items_count,​ int height_in_items = -1);</​color>​\\ 
-  * <color green>​bool Combo(const char* label, int* current_item,​ const char* items_separated_by_zeros,​ int height_in_items = -1);</​color>​\\ 
-  * <color red>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);</​color>​\\ 
-  * <color green>​bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);</​color>​\\ 
-  * <color green>​bool ColorEdit3(const char* label, float col[3]);</​color>​\\ 
-  * <color green>​bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);</​color>​\\ 
-  * <color green>​void ColorEditMode(ImGuiColorEditMode mode);</​color>​\\ 
-  * <color green>​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));</​color>​\\ 
-    * 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. 
-  * <color red>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));</​color>​\\ 
-  * <color green>​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));</​color>​\\ 
-    * 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. 
-  * <color red>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));</​color>​\\ 
-  * <color green>​void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL);</​color>​\\ 
- 
-  * <color green>​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);</​color>​\\ 
-  * <color green>​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);</​color>​\\ 
-  * <color green>​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);</​color>​\\ 
-  * <color green>​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);</​color>​\\ 
-  * <color green>​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);</​color>​\\ 
-  * <color green>​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"​);</​color>​\\ 
-  * <color green>​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"​);</​color>​\\ 
-  * <color green>​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"​);</​color>​\\ 
-  * <color green>​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"​);</​color>​\\ 
-  * <color green>​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);</​color>​\\ 
- 
-  * <color green>​bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);</​color>​\\ 
-    * 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.) 
-  * <color green>​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);</​color>​\\ 
-    * 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.) 
-  * <color green>​bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);</​color>​\\ 
- 
-  * <color green>​bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "​%.3f",​ float power = 1.0f);</​color>​\\ 
-  * <color green>​bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "​%.3f",​ float power = 1.0f);</​color>​\\ 
-  * <color green>​bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "​%.3f",​ float power = 1.0f);</​color>​\\ 
-  * <color green>​bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "​%.3f",​ float power = 1.0f);</​color>​\\ 
-  * <color green>​bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);</​color>​\\ 
-  * <color green>​bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "​%.0f"​);</​color>​\\ 
-  * <color green>​bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "​%.0f"​);</​color>​\\ 
-  * <color green>​bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "​%.0f"​);</​color>​\\ 
-  * <color green>​bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "​%.0f"​);</​color>​\\ 
-  * <color green>​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);</​color>​\\ 
-  * <color green>​bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "​%.0f"​);</​color>​\\ 
- 
-  * <color green>​bool TreeNode(const char* label);</​color>​\\ 
-  * <color green>​bool TreeNode(const char* str_id, const char* fmt, ...);</​color>​\\ 
-  * <color green>​bool TreeNode(const void* ptr_id, const char* fmt, ...);</​color>​\\ 
-  * <color red>bool TreeNodeV(const char* str_id, const char* fmt, va_list args);</​color>​\\ 
-  * <color red>bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0);</​color>​\\ 
-  * <color green>​bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...);</​color>​\\ 
-  * <color green>​bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...);</​color>​\\ 
-  * <color red>bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args);</​color>​\\ 
-  * <color red>bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void TreePush(const char* str_id = NULL);</​color>​\\ 
-  * <color green>​void TreePush(const void* ptr_id = NULL);</​color>​\\ 
-  * <color green>​void TreePop(void);</​color>​\\ 
-  * <color green>​void TreeAdvanceToLabelPos(void);</​color>​\\ 
-  * <color green>​float GetTreeNodeToLabelSpacing(void);</​color>​\\ 
-  * <color green>​void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0);</​color>​\\ 
-  * <color green>​bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0);</​color>​\\ 
-  * <color green>​bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0);</​color>​\\ 
- 
-  * <color green>​bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));</​color>​\\ 
-  * <color green>​bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));</​color>​\\ 
-  * <color red>bool ListBox(const char* label, int* current_item,​ const char%%**%% items, int items_count,​ int height_in_items = -1);</​color>​\\ 
-  * <color green>​bool ListBox(const char* label, int* current_item,​ const char* items_separated_by_zeros,​ int height_in_items = -1);</​color>​\\ 
-  * <color red>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);</​color>​\\ 
-  * <color green>​bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0));</​color>​\\ 
-  * <color green>​bool ListBoxHeader(const char* label, int items_count,​ int height_in_items = -1);</​color>​\\ 
-  * <color green>​void ListBoxFooter(void);</​color>​\\ 
- 
-  * <color green>​void Value(const char* prefix, bool b);</​color>​\\ 
-  * <color green>​void Value(const char* prefix, int v);</​color>​\\ 
-  * <color green>​void Value(const char* prefix, unsigned int v);</​color>​\\ 
-  * <color green>​void Value(const char* prefix, float v, const char* float_format = NULL);</​color>​\\ 
-    * 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 
-  * <color green>​void ValueColor(const char* prefix, const ImVec4& v);</​color>​\\ 
-  * <color green>​void ValueColor(const char* prefix, unsigned int v);</​color>​\\ 
- 
-  * <color green>​void SetTooltip(const char* fmt, ...);</​color>​\\ 
-  * <color red>void SetTooltipV(const char* fmt, va_list args);</​color>​\\ 
-  * <color green>​void BeginTooltip(void);</​color>​\\ 
-  * <color green>​void EndTooltip(void);</​color>​\\ 
- 
-  * <color green>​bool BeginMainMenuBar(void);</​color>​\\ 
-  * <color green>​void EndMainMenuBar(void);</​color>​\\ 
-  * <color green>​bool BeginMenuBar(void);</​color>​\\ 
-  * <color green>​void EndMenuBar(void);</​color>​\\ 
-  * <color green>​bool BeginMenu(const char* label, bool enabled = true);</​color>​\\ 
-  * <color green>​void EndMenu(void);</​color>​\\ 
-  * <color green>​bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true);</​color>​\\ 
-  * <color green>​bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true);</​color>​\\ 
- 
-  * <color green>​void OpenPopup(const char* str_id);</​color>​\\ 
-  * <color green>​bool BeginPopup(const char* str_id);</​color>​\\ 
-  * <color green>​bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​bool BeginPopupContextItem(const char* str_id, int mouse_button = 1);</​color>​\\ 
-  * <color green>​bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1);</​color>​\\ 
-  * <color green>​bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1);</​color>​\\ 
-  * <color green>​void EndPopup(void);</​color>​\\ 
-  * <color green>​void CloseCurrentPopup(void);</​color>​\\ 
- 
-  * <color green>​void LogToTTY(int max_depth = -1);</​color>​\\ 
-  * <color green>​void LogToFile(int max_depth = -1, const char* filename = NULL);</​color>​\\ 
-  * <color green>​void LogToClipboard(int max_depth = -1);</​color>​\\ 
-  * <color green>​void LogFinish(void);</​color>​\\ 
-  * <color green>​void LogButtons(void);</​color>​\\ 
-  * <color green>​void LogText(const char* fmt, ...);</​color>​\\ 
-    * These logging functions should not be relied on, they may be removed in the future. 
- 
-  * <color green>​void PushClipRect(const ImVec2& clip_rect_min,​ const ImVec2& clip_rect_max,​ bool intersect_with_current_clip_rect);</​color>​\\ 
-  * <color green>​void PopClipRect(void);</​color>​\\ 
- 
-  * <color green>​bool IsItemHovered(void);</​color>​\\ 
-  * <color green>​bool IsItemHoveredRect(void);</​color>​\\ 
-  * <color green>​bool IsItemActive(void);</​color>​\\ 
-  * <color green>​bool IsItemClicked(int mouse_button = 0);</​color>​\\ 
-  * <color green>​bool IsItemVisible(void);</​color>​\\ 
-  * <color green>​bool IsAnyItemHovered(void);</​color>​\\ 
-  * <color green>​bool IsAnyItemActive(void);</​color>​\\ 
-  * <color green>​ImVec2 GetItemRectMin(void);</​color>​\\ 
-  * <color green>​ImVec2 GetItemRectMax(void);</​color>​\\ 
-  * <color green>​ImVec2 GetItemRectSize(void);</​color>​\\ 
-  * <color green>​void SetItemAllowOverlap(void);</​color>​\\ 
-  * <color green>​bool IsWindowHovered(void);</​color>​\\ 
-  * <color green>​bool IsWindowFocused(void);</​color>​\\ 
-  * <color green>​bool IsRootWindowFocused(void);</​color>​\\ 
-  * <color green>​bool IsRootWindowOrAnyChildFocused(void);</​color>​\\ 
-  * <color green>​bool IsRootWindowOrAnyChildHovered(void);</​color>​\\ 
-  * <color green>​bool IsRectVisible(const ImVec2& size);</​color>​\\ 
-  * <color green>​bool IsPosHoveringAnyWindow(const ImVec2& pos);</​color>​\\ 
-  * <color green>​float GetTime(void);</​color>​\\ 
-  * <color green>​int GetFrameCount(void);</​color>​\\ 
-  * <color green>​const char* GetStyleColName(ImGuiCol idx);</​color>​\\ 
-  * <color red>​ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f);</​color>​\\ 
-    * Not implementing this unless its requested. 
-  * <color red>​ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);</​color>​\\ 
-    * Not implementing this unless it's requested. 
-  * <color red>void CalcListClipping(int items_count,​ float items_height,​ int* out_items_display_start,​ int* out_items_display_end);</​color>​\\ 
-    * Not implementing this unless it's requested. 
- 
-  * <color green>​bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags = 0);</​color>​\\ 
-  * <color green>​void EndChildFrame(void);</​color>​\\ 
- 
-  * <color green>​ImVec4 ColorConvertU32ToFloat4(ImU32 in);</​color>​\\ 
-  * <color green>​ImU32 ColorConvertFloat4ToU32(const ImVec4& in);</​color>​\\ 
-  * <color green>​void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);</​color>​\\ 
-    * Lua does not support '​out'​ values, instead, this function will return out_h, out_s, out_v. 
-  * <color green>​void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);</​color>​\\ 
-    * Lua does not support '​out'​ values, instead, this function will return out_r, out_g, out_b. 
-    ​ 
-  * <color green>​int GetKeyIndex(ImGuiKey key);</​color>​\\ 
-  * <color green>​bool IsKeyDown(int key_index);</​color>​\\ 
-  * <color green>​bool IsKeyPressed(int key_index, bool repeat = true);</​color>​\\ 
-  * <color green>​bool IsKeyReleased(int key_index);</​color>​\\ 
-  * <color green>​bool IsMouseDown(int button);</​color>​\\ 
-  * <color green>​bool IsMouseClicked(int button, bool repeat = false);</​color>​\\ 
-  * <color green>​bool IsMouseDoubleClicked(int button);</​color>​\\ 
-  * <color green>​bool IsMouseReleased(int button);</​color>​\\ 
-  * <color green>​bool IsMouseHoveringWindow(void);</​color>​\\ 
-  * <color green>​bool IsMouseHoveringAnyWindow(void);</​color>​\\ 
-  * <color green>​bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);</​color>​\\ 
-  * <color green>​bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f);</​color>​\\ 
-  * <color green>​ImVec2 GetMousePos(void);</​color>​\\ 
-  * <color green>​ImVec2 GetMousePosOnOpeningCurrentPopup(void);</​color>​\\ 
-  * <color green>​ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f);</​color>​\\ 
-  * <color green>​void ResetMouseDragDelta(int button = 0);</​color>​\\ 
-  * <color green>​ImGuiMouseCursor GetMouseCursor(void);</​color>​\\ 
-  * <color green>​void SetMouseCursor(ImGuiMouseCursor type);</​color>​\\ 
-  * <color green>​void CaptureKeyboardFromApp(bool capture = true);</​color>​\\ 
-  * <color green>​void CaptureMouseFromApp(bool capture = true);</​color>​\\ 
- 
-  * <color red>​void* MemAlloc(size_t sz);</​color>​\\ 
-    * Not implementing this function. 
-  * <color red>void MemFree(void* ptr);</​color>​\\ 
-    * Not implementing this function. 
-  * <color green>​const char* GetClipboardText(void);</​color>​\\ 
-  * <color green>​void SetClipboardText(const char* text);</​color>​\\ 
- 
-  * <color green>​const char* GetVersion(void);</​color>​\\ 
-  * <color red>​ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void(*free_fn)(void*) = NULL);</​color>​\\ 
-    * Not implementing this function. 
-  * <color red>void DestroyContext(ImGuiContext* ctx);</​color>​\\ 
-    * Not implementing this function. 
-  * <color red>​ImGuiContext* GetCurrentContext(void);</​color>​\\ 
-    * Not implementing this function. 
-  * <color red>void SetCurrentContext(ImGuiContext* ctx);</​color>​\\ 
-    * 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. 
- 
-<code lua> 
-    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 
-</​code>​ 
- 
-**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. 
- 
-<code lua> 
-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'​);​ 
-</​code>​ 
addons/functions/gui.txt · Last modified: 2017/04/22 00:10 (external edit)