User Tools

Site Tools


addons:functions:imgui

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
addons:functions:imgui [2016/06/27 04:33]
atom0s
addons:functions:imgui [2016/06/27 21:34]
atom0s
Line 62: Line 62:
   * <color green>​void SetNextWindowSize(const ImVec2& size, 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>​\\   * <color green>​void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback = NULL, void* custom_callback_data = NULL);</​color>​\\
-    * Callbacks are not implemented.+    * 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 SetNextWindowContentSize(const ImVec2& size);</​color>​\\
   * <color green>​void SetNextWindowContentWidth(float width);</​color>​\\   * <color green>​void SetNextWindowContentWidth(float width);</​color>​\\
Line 186: Line 186:
   * <color green>​bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);</​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 ColorEditMode(ImGuiColorEditMode mode);</​color>​\\
-  * <​color ​red>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>​\\+  * <​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 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 ​red>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>​\\+  * <​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 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>​\\
     * Not implemented currently.     * Not implemented currently.
Line 389: Line 395:
 ===== Notes ===== ===== Notes =====
  
-InputText / InputTextMultiline - The callback, if present, should be a string that points to a callback function like this:+**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.  - The callbacks data is a [[imgui.ImGuiTextEditCallbackData]] structure instance.
  
Line 403: Line 409:
 </​code>​ </​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/imgui.txt · Last modified: 2016/06/27 21:37 by atom0s