Struct Rect
- Namespace
- AO
- Assembly
- CoreAssembly.dll
Defines a rectangle in 2D space. Most commonly used for UI layouting.
public struct Rect
- Inherited Members
- Extension Methods
Constructors
Rect()
public Rect()
Rect(Vector2)
public Rect(Vector2 pos)
Parameters
pos
Vector2
Rect(Vector2, Vector2)
public Rect(Vector2 min, Vector2 max)
Parameters
Fields
Max
public Vector2 Max
Field Value
Min
public Vector2 Min
Field Value
Properties
BottomLeft
Get the bottom left corner of this rect.
public Vector2 BottomLeft { get; }
Property Value
BottomRight
Get the bottom right corner of this rect.
public Vector2 BottomRight { get; }
Property Value
Center
The mid point of the rectangle.
public Vector2 Center { get; }
Property Value
HalfSize
Half of the width and height of the rectangle.
public Vector2 HalfSize { get; }
Property Value
Height
public float Height { get; }
Property Value
Size
Width and Height of the rectangle.
public Vector2 Size { get; }
Property Value
TopLeft
Get the top left corner of this rect.
public Vector2 TopLeft { get; }
Property Value
TopRight
Get the top right corner of this rect.
public Vector2 TopRight { get; }
Property Value
Width
public float Width { get; }
Property Value
Methods
BottomCenterRect()
Create a new Rect with zero size and positioned at the center of the bottom edge.
public Rect BottomCenterRect()
Returns
BottomLeftRect()
Create a new Rect with zero size and positioned in the bottom left corner.
public Rect BottomLeftRect()
Returns
BottomRect()
Create a new Rect that describes the bottom edge of this one
public Rect BottomRect()
Returns
BottomRightRect()
Create a new Rect with zero size and positioned in the bottom right corner.
public Rect BottomRightRect()
Returns
CenterRect()
Create a new Rect with zero size and positioned in the center of this one.
public Rect CenterRect()
Returns
Contains(Vector2)
public bool Contains(Vector2 point)
Parameters
point
Vector2
Returns
Copy()
Create a new Rect as a copy of this one.
public Rect Copy()
Returns
CutBottom(float)
Cut this rect from the bottom by the given amount.
public Rect CutBottom(float pixels)
Parameters
pixels
float
Returns
- Rect
A rect describing the cut amount.
CutBottomUnscaled(float)
public Rect CutBottomUnscaled(float pixels)
Parameters
pixels
float
Returns
CutLeft(float)
Cut this rect from the left by the given amount.
public Rect CutLeft(float pixels)
Parameters
pixels
float
Returns
- Rect
A rect describing the cut amount.
CutLeftUnscaled(float)
public Rect CutLeftUnscaled(float pixels)
Parameters
pixels
float
Returns
CutRight(float)
Cut this rect from the right by the given amount.
public Rect CutRight(float pixels)
Parameters
pixels
float
Returns
- Rect
A rect describing the cut amount.
CutRightUnscaled(float)
public Rect CutRightUnscaled(float pixels)
Parameters
pixels
float
Returns
CutTop(float)
Cut this rect from the top by the given amount.
public Rect CutTop(float pixels)
Parameters
pixels
float
Returns
- Rect
A rect describing the cut amount.
CutTopUnscaled(float)
public Rect CutTopUnscaled(float pixels)
Parameters
pixels
float
Returns
Encapsulate(Rect)
public Rect Encapsulate(Rect other)
Parameters
other
Rect
Returns
FitAspect(float, FitAspectKind)
public Rect FitAspect(float aspect, Rect.FitAspectKind kind = FitAspectKind.Auto)
Parameters
aspect
floatkind
Rect.FitAspectKind
Returns
Grow(float)
Returns a new rectangle that is grown from this one by the given amount on all sides.
public Rect Grow(float all)
Parameters
all
float
Returns
Grow(float, float, float, float)
Returns a new rectangle that is grown from this one by the given amounts.
public Rect Grow(float top, float right, float bottom, float left)
Parameters
Returns
GrowBottom(float)
public Rect GrowBottom(float pixels)
Parameters
pixels
float
Returns
GrowBottomUnscaled(float)
public Rect GrowBottomUnscaled(float pixels)
Parameters
pixels
float
Returns
GrowLeft(float)
public Rect GrowLeft(float pixels)
Parameters
pixels
float
Returns
GrowLeftUnscaled(float)
public Rect GrowLeftUnscaled(float pixels)
Parameters
pixels
float
Returns
GrowRight(float)
public Rect GrowRight(float pixels)
Parameters
pixels
float
Returns
GrowRightUnscaled(float)
public Rect GrowRightUnscaled(float pixels)
Parameters
pixels
float
Returns
GrowTop(float)
public Rect GrowTop(float pixels)
Parameters
pixels
float
Returns
GrowTopUnscaled(float)
public Rect GrowTopUnscaled(float pixels)
Parameters
pixels
float
Returns
GrowUnscaled(float, float, float, float)
public Rect GrowUnscaled(float top, float right, float bottom, float left)
Parameters
Returns
Inset(float)
Returns a new rectangle that is inset from this one by the given amount on all sides.
public Rect Inset(float all)
Parameters
all
float
Returns
Inset(float, float, float, float)
Returns a new rectangle that is inset from this one by the given amounts.
public Rect Inset(float top, float right, float bottom, float left)
Parameters
Returns
InsetBottom(float)
public Rect InsetBottom(float pixels)
Parameters
pixels
float
Returns
InsetBottomUnscaled(float)
public Rect InsetBottomUnscaled(float pixels)
Parameters
pixels
float
Returns
InsetLeft(float)
public Rect InsetLeft(float pixels)
Parameters
pixels
float
Returns
InsetLeftUnscaled(float)
public Rect InsetLeftUnscaled(float pixels)
Parameters
pixels
float
Returns
InsetRight(float)
public Rect InsetRight(float pixels)
Parameters
pixels
float
Returns
InsetRightUnscaled(float)
public Rect InsetRightUnscaled(float pixels)
Parameters
pixels
float
Returns
InsetTop(float)
public Rect InsetTop(float pixels)
Parameters
pixels
float
Returns
InsetTopUnscaled(float)
public Rect InsetTopUnscaled(float pixels)
Parameters
pixels
float
Returns
InsetUnscaled(float, float, float, float)
public Rect InsetUnscaled(float top, float right, float bottom, float left)
Parameters
Returns
LeftCenterRect()
Create a new Rect with zero size and positioned at the center of the left edge.
public Rect LeftCenterRect()
Returns
LeftRect()
Create a new Rect that describes the left edge of this one
public Rect LeftRect()
Returns
Offset(float, float)
Returns a new rectangle that is offset from this one by the given amounts.
public Rect Offset(float x, float y)
Parameters
Returns
OffsetUnscaled(float, float)
public Rect OffsetUnscaled(float x, float y)
Parameters
Returns
Overlaps(Rect)
public bool Overlaps(Rect other)
Parameters
other
Rect
Returns
RightCenterRect()
Create a new Rect with zero size and positioned at the center of the right edge.
public Rect RightCenterRect()
Returns
RightRect()
Create a new Rect that describes the right edge of this one
public Rect RightRect()
Returns
Round()
public Rect Round()
Returns
Scale(float)
public Rect Scale(float all)
Parameters
all
float
Returns
Scale(float, float)
public Rect Scale(float x, float y)
Parameters
Returns
Slide(float, float)
public Rect Slide(float x, float y)
Parameters
Returns
SubRect(float, float, float, float)
public Rect SubRect(float xMin, float yMin, float xMax, float yMax)
Parameters
Returns
SubRect(float, float, float, float, float, float, float, float)
public Rect SubRect(float xMin, float yMin, float xMax, float yMax, float top, float right, float bottom, float left)
Parameters
Returns
SubRectUnscaled(float, float, float, float, float, float, float, float)
public Rect SubRectUnscaled(float xMin, float yMin, float xMax, float yMax, float top, float right, float bottom, float left)
Parameters
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
TopCenterRect()
Create a new Rect with zero size and positioned at the center of the top edge.
public Rect TopCenterRect()
Returns
TopLeftRect()
Create a new Rect with zero size and positioned in the top left corner.
public Rect TopLeftRect()
Returns
TopRect()
Create a new Rect that describes the top edge of this one
public Rect TopRect()
Returns
TopRightRect()
Create a new Rect with zero size and positioned in the top right corner.
public Rect TopRightRect()