![]() |
GearBlocks
The GearBlocks Lua scripting API
|
A 2D rectangle. More...
Public Member Functions | |
RectProxy (float x, float y, float width, float height) | |
Constructor. | |
RectProxy (Vector2Proxy position, Vector2Proxy size) | |
Constructor. | |
void | Set (float x, float y, float width, float height) |
Set the components of the rect. | |
bool | Contains (Vector2Proxy point) |
Test if a point lies within the rect. | |
bool | Contains (Vector3Proxy point) |
Test if a point lies within the rect. | |
bool | Overlaps (RectProxy rect) |
Test if another rect overlaps this one. | |
Static Public Member Functions | |
static RectProxy | MinMaxRect (float xMin, float yMin, float xMax, float yMax) |
Create a rect from min / max coordinate values. | |
static bool | operator== (RectProxy lhs, RectProxy rhs) |
Compare two rects. | |
static bool | operator!= (RectProxy lhs, RectProxy rhs) |
Compare two rects. | |
Properties | |
float | X [get, set] |
The rect's x coordinate. | |
float | Y [get, set] |
The rect's y coordinate. | |
float | Width [get, set] |
The rect's width. | |
float | Height [get, set] |
The rect's height. | |
Vector2Proxy | Position [get, set] |
The rect's position. | |
Vector2Proxy | Center [get, set] |
The rect's centre. | |
Vector2Proxy | Min [get, set] |
The rect's minimum corner. | |
Vector2Proxy | Max [get, set] |
The rect's maximum corner. | |
Vector2Proxy | Size [get, set] |
The rect's size. | |
float | XMin [get, set] |
The rect's min x coordinate. | |
float | YMin [get, set] |
The rect's min y coordinate. | |
float | XMax [get, set] |
The rect's max x coordinate. | |
float | YMax [get, set] |
The rect's max y coordinate. | |
static RectProxy | Zero [get] |
A zero sized rect. | |
A 2D rectangle.
Static methods available in Lua via the "Rect" global, for example:
SmashHammer.Scripting.RectProxy.RectProxy | ( | float | x, |
float | y, | ||
float | width, | ||
float | height | ||
) |
Constructor.
x | The x coordinate to initialise with. |
y | The y coordinate to initialise with. |
width | The width to initialise with. |
height | The height to initialise with. |
SmashHammer.Scripting.RectProxy.RectProxy | ( | Vector2Proxy | position, |
Vector2Proxy | size | ||
) |
Constructor.
position | The position to initialise with. |
size | The size to initialise with. |
|
static |
Create a rect from min / max coordinate values.
xMin | The minimum x coordinate. |
yMin | The minimum y coordinate. |
xMax | The maximum x coordinate. |
yMax | The maximum y coordinate. |
void SmashHammer.Scripting.RectProxy.Set | ( | float | x, |
float | y, | ||
float | width, | ||
float | height | ||
) |
Set the components of the rect.
x | The x coordinate of the rect. |
y | The y coordinate of the rect. |
width | The width of the rect. |
height | The height of the rect. |
bool SmashHammer.Scripting.RectProxy.Contains | ( | Vector2Proxy | point | ) |
Test if a point lies within the rect.
point | The point to test. |
true
if the rect contains the point; otherwise, false
.bool SmashHammer.Scripting.RectProxy.Contains | ( | Vector3Proxy | point | ) |
Test if a point lies within the rect.
point | The point to test. |
true
if the rect contains the point; otherwise, false
.bool SmashHammer.Scripting.RectProxy.Overlaps | ( | RectProxy | rect | ) |
Test if another rect overlaps this one.
rect | The rect to test. |
true
if the rects overlap; otherwise, false
.Compare two rects.
lhs | The first rect. |
rhs | The second rect. |
true
if the rects are equal; otherwise, false
.Compare two rects.
lhs | The first rect. |
rhs | The second rect. |
true
if the rects are not equal; otherwise, false
.
|
getset |
The rect's x coordinate.
The x coordinate of this rect.
|
getset |
The rect's y coordinate.
The y coordinate of this rect.
|
getset |
The rect's width.
The width of this rect.
|
getset |
The rect's height.
The height of this rect.
|
getset |
The rect's position.
The position of this rect.
|
getset |
The rect's centre.
The centre of this rect.
|
getset |
The rect's minimum corner.
The minimum corner of this rect.
|
getset |
The rect's maximum corner.
The maximum corner of this rect.
|
getset |
The rect's size.
The width and height of this rect.
|
getset |
The rect's min x coordinate.
The minimum x coordinate of this rect.
|
getset |
The rect's min y coordinate.
The minimum y coordinate of this rect.
|
getset |
The rect's max x coordinate.
The maximum x coordinate of this rect.
|
getset |
The rect's max y coordinate.
The maximum y coordinate of this rect.
|
staticget |
A zero sized rect.
A new rect with all components initialised to zero.