Table of Contents

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

min Vector2
max Vector2

Fields

Max

public Vector2 Max

Field Value

Vector2

Min

public Vector2 Min

Field Value

Vector2

Properties

BottomLeft

Get the bottom left corner of this rect.

public Vector2 BottomLeft { get; }

Property Value

Vector2

BottomRight

Get the bottom right corner of this rect.

public Vector2 BottomRight { get; }

Property Value

Vector2

Center

The mid point of the rectangle.

public Vector2 Center { get; }

Property Value

Vector2

HalfSize

Half of the width and height of the rectangle.

public Vector2 HalfSize { get; }

Property Value

Vector2

Height

public float Height { get; }

Property Value

float

Size

Width and Height of the rectangle.

public Vector2 Size { get; }

Property Value

Vector2

TopLeft

Get the top left corner of this rect.

public Vector2 TopLeft { get; }

Property Value

Vector2

TopRight

Get the top right corner of this rect.

public Vector2 TopRight { get; }

Property Value

Vector2

Width

public float Width { get; }

Property Value

float

Methods

BottomCenterRect()

Create a new Rect with zero size and positioned at the center of the bottom edge.

public Rect BottomCenterRect()

Returns

Rect

BottomLeftRect()

Create a new Rect with zero size and positioned in the bottom left corner.

public Rect BottomLeftRect()

Returns

Rect

BottomRect()

Create a new Rect that describes the bottom edge of this one

public Rect BottomRect()

Returns

Rect

BottomRightRect()

Create a new Rect with zero size and positioned in the bottom right corner.

public Rect BottomRightRect()

Returns

Rect

CenterRect()

Create a new Rect with zero size and positioned in the center of this one.

public Rect CenterRect()

Returns

Rect

Contains(Vector2)

public bool Contains(Vector2 point)

Parameters

point Vector2

Returns

bool

Copy()

Create a new Rect as a copy of this one.

public Rect Copy()

Returns

Rect

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

Rect

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

Rect

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

Rect

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

Rect

Encapsulate(Rect)

public Rect Encapsulate(Rect other)

Parameters

other Rect

Returns

Rect

FitAspect(float, FitAspectKind)

public Rect FitAspect(float aspect, Rect.FitAspectKind kind = FitAspectKind.Auto)

Parameters

aspect float
kind Rect.FitAspectKind

Returns

Rect

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

Rect

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

top float
right float
bottom float
left float

Returns

Rect

GrowBottom(float)

public Rect GrowBottom(float pixels)

Parameters

pixels float

Returns

Rect

GrowBottomUnscaled(float)

public Rect GrowBottomUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

GrowLeft(float)

public Rect GrowLeft(float pixels)

Parameters

pixels float

Returns

Rect

GrowLeftUnscaled(float)

public Rect GrowLeftUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

GrowRight(float)

public Rect GrowRight(float pixels)

Parameters

pixels float

Returns

Rect

GrowRightUnscaled(float)

public Rect GrowRightUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

GrowTop(float)

public Rect GrowTop(float pixels)

Parameters

pixels float

Returns

Rect

GrowTopUnscaled(float)

public Rect GrowTopUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

GrowUnscaled(float, float, float, float)

public Rect GrowUnscaled(float top, float right, float bottom, float left)

Parameters

top float
right float
bottom float
left float

Returns

Rect

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

Rect

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

top float
right float
bottom float
left float

Returns

Rect

InsetBottom(float)

public Rect InsetBottom(float pixels)

Parameters

pixels float

Returns

Rect

InsetBottomUnscaled(float)

public Rect InsetBottomUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

InsetLeft(float)

public Rect InsetLeft(float pixels)

Parameters

pixels float

Returns

Rect

InsetLeftUnscaled(float)

public Rect InsetLeftUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

InsetRight(float)

public Rect InsetRight(float pixels)

Parameters

pixels float

Returns

Rect

InsetRightUnscaled(float)

public Rect InsetRightUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

InsetTop(float)

public Rect InsetTop(float pixels)

Parameters

pixels float

Returns

Rect

InsetTopUnscaled(float)

public Rect InsetTopUnscaled(float pixels)

Parameters

pixels float

Returns

Rect

InsetUnscaled(float, float, float, float)

public Rect InsetUnscaled(float top, float right, float bottom, float left)

Parameters

top float
right float
bottom float
left float

Returns

Rect

LeftCenterRect()

Create a new Rect with zero size and positioned at the center of the left edge.

public Rect LeftCenterRect()

Returns

Rect

LeftRect()

Create a new Rect that describes the left edge of this one

public Rect LeftRect()

Returns

Rect

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

x float
y float

Returns

Rect

OffsetUnscaled(float, float)

public Rect OffsetUnscaled(float x, float y)

Parameters

x float
y float

Returns

Rect

Overlaps(Rect)

public bool Overlaps(Rect other)

Parameters

other Rect

Returns

bool

RightCenterRect()

Create a new Rect with zero size and positioned at the center of the right edge.

public Rect RightCenterRect()

Returns

Rect

RightRect()

Create a new Rect that describes the right edge of this one

public Rect RightRect()

Returns

Rect

Round()

public Rect Round()

Returns

Rect

Scale(float)

public Rect Scale(float all)

Parameters

all float

Returns

Rect

Scale(float, float)

public Rect Scale(float x, float y)

Parameters

x float
y float

Returns

Rect

Slide(float, float)

public Rect Slide(float x, float y)

Parameters

x float
y float

Returns

Rect

SubRect(float, float, float, float)

public Rect SubRect(float xMin, float yMin, float xMax, float yMax)

Parameters

xMin float
yMin float
xMax float
yMax float

Returns

Rect

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

xMin float
yMin float
xMax float
yMax float
top float
right float
bottom float
left float

Returns

Rect

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

xMin float
yMin float
xMax float
yMax float
top float
right float
bottom float
left float

Returns

Rect

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

Rect

TopLeftRect()

Create a new Rect with zero size and positioned in the top left corner.

public Rect TopLeftRect()

Returns

Rect

TopRect()

Create a new Rect that describes the top edge of this one

public Rect TopRect()

Returns

Rect

TopRightRect()

Create a new Rect with zero size and positioned in the top right corner.

public Rect TopRightRect()

Returns

Rect