User Tools

Site Tools


addons:functions:imgui.imguisizeconstraintcallbackdata

Differences

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

Link to this comparison view

addons:functions:imgui.imguisizeconstraintcallbackdata [2016/06/27 13:48]
atom0s created
addons:functions:imgui.imguisizeconstraintcallbackdata [2016/06/27 13:53] (current)
atom0s
Line 18: Line 18:
 <code lua> <code lua>
 DesiredSize = ImVec(200, 200); DesiredSize = ImVec(200, 200);
 +</​code>​
 +
 +------
 +====== Example ======
 +
 +The following example would apply a sizing constraint to keep the window in a square shape. (Similar to aspect ratio resizing.)
 +
 +<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>​ </​code>​
addons/functions/imgui.imguisizeconstraintcallbackdata.txt · Last modified: 2016/06/27 13:53 by atom0s