struct Rect
Represents a rectangle.
public Rect( ref float x, ref float y, ref float width, ref float height )
Initialize a Rect at given position and with given size.
public Rect( ref Vector2 point, ref Vector2 size = null )
Initialize a Rect at given position and with given size.
public float Width { get; set; }
Width of the rect.
public float Height { get; set; }
Height of the rect.
public float Left { get; set; }
Position of rect's left edge relative to its parent, can also be interpreted as its position on the X axis.
public float Top { get; set; }
Position of rect's top edge relative to its parent, can also be interpreted as its position on the Y axis.
public float Right { get; set; }
Position of rect's right edge relative to its parent.
public float Bottom { get; set; }
Position of rect's bottom edge relative to its parent.
public Vector2 Position { get; set; }
Position of this rect.
public Vector2 Center { get; }
Center of this rect.
public Vector2 Size { get; set; }
Size of this rect.
public Rect WithoutPosition { get; }
Returns this rect with position set to 0 on both axes.
public bool IsInside( ref Rect rect, bool fullyInside = False )
Return true if the passed rect is partially or fully inside this rect.
rectThe passed rect to test.fullyInsideto test if the given rect is completely inside this rect. to test for an intersection.
public bool IsInside( ref Vector2 pos )
Return true if the passed point is inside this rect.
public Rect Shrink( ref float left, ref float top, ref float right, ref float bottom )
Returns a Rect shrunk in every direction by given values.
public Rect Shrink( ref Margin m )
Returns a Rect shrunk in every direction by Margin's values.
public Rect Shrink( ref float x, ref float y )
Returns a Rect shrunk in every direction by given values on each axis.
public Rect Shrink( ref float amt )
Returns a Rect shrunk in every direction by given amount.
public Rect Grow( ref float left, ref float top, ref float right, ref float bottom )
Returns a Rect grown in every direction by given amounts.
public Rect Grow( Margin m )
Returns a Rect grown in every direction by Margin's values.
public Rect Grow( ref float x, ref float y )
Returns a Rect grown in every direction by given values on each axis.
public Rect Grow( ref float amt )
Returns a Rect grown in every direction by given amount.
public static Rect FromPoints( ref Vector2 a, ref Vector2 b )
Create a rect between two points. The order of the points doesn't matter.
public void Add( Rect r )
Expand this Rect to contain the other rect
public void Add( Vector2 point )
Expand this Rect to contain the point
public Rect AddPoint( Vector2 pos )
Returns this rect expanded to include this point
public Vector2 ClosestPoint( ref Vector2 point )
Returns the closest point on this rect to another point
public Vector2 BottomLeft { get; }
Position of the bottom left edge of this rect.
public Vector2 BottomRight { get; }
Position of the bottom right edge of this rect.
public Vector2 TopRight { get; }
Position of the top right edge of this rect.
public Vector2 TopLeft { get; }
Position of the top left edge of this rect.
public Rect Align( ref Vector2 size, TextFlag align )
Align the smaller rect inside this rect. Default alignment on each axis is Top, Left.
public Rect Contain( ref Vector2 size, TextFlag align = Center, bool stretch = False )
Contain a given rectangle (image) within this rectangle (frame), preserving aspect ratio.
sizeSize of the rectagle (image) to try to contain within this frame rectangle.alignWhere to align the given box within this rectangle.stretchWhether to stretch the given rectagle (image) should its size be smaller than largest rectagle (image) size possible within this rectangle (frame).- Returns A rectangle with correct position and size to fit within the "parent" rectangle.
public static bool op_Equality( Rect left, Rect right )
😔 No documentation found.
public static bool op_Inequality( Rect left, Rect right )
😔 No documentation found.
public Type GetType( )
😔 No documentation found.
public bool Equals( object obj )
😔 No documentation found.
public int GetHashCode( )
😔 No documentation found.
public bool Equals( Rect o )
😔 No documentation found.
public static Rect op_Addition( ref Rect a, ref Rect b )
😔 No documentation found.
public Vector4 ToVector4( )
😔 No documentation found.
public string ToString( )
😔 No documentation found.
public static Rect op_Multiply( ref Rect a, ref Vector2 b )
😔 No documentation found.
public Rect Ceiling( )
😔 No documentation found.
public Rect Round( )
😔 No documentation found.
public Rect Floor( )
😔 No documentation found.
public static Rect op_Addition( Rect r, ref Vector2 p )
😔 No documentation found.
public Rect SnapToGrid( )
😔 No documentation found.
public static Rect op_Multiply( ref Rect a, ref float b )
😔 No documentation found.