The Rectangle
class provides a simple object for storing
and manipulating a logical rectangle for calculations
Constructor
Variables
Methods
contains(x:Float, y:Float):Bool
Returns whether this rectangle contains the specified (x, y) point
Parameters:
x | The x coordinate to test |
---|---|
y | The y coordinate to test |
Returns:
Whether the point is contained in the rectangle
containsRect(rect:Rectangle):Bool
containsVector(vector:Vector2):Bool
Returns whether this rectangle contains the specified vector
Parameters:
vector | The vector to test |
---|
Returns:
Whether the vector is contained in the rectangle
inflate(dx:Float, dy:Float):Void
Increases the size of the current rectangle by the given delta x and y values
Parameters:
dx | A delta x value to increase the size by |
---|---|
dy | A delta y value to increase the size by |
inflateVector(vector:Vector2):Void
Increases the size of the current rectangle by the given delta vector values
Parameters:
vector | A delta vector to increase the size by |
---|
intersection(toIntersect:Rectangle, ?result:Rectangle):Rectangle
Returns a new rectangle with the area where the current
Rectangle
and another Rectangle
instance overlap.
If they do not overlap, the returned Rectangle
will
be empty
Parameters:
toIntersect | Another |
---|---|
result | (Optional) A |
Returns:
A Rectangle
of the intersection area
intersects(toIntersect:Rectangle):Bool
offset(dx:Float, dy:Float):Void
Moves the rectangle by offset x and values
Parameters:
dx | A delta x value |
---|---|
dy | A delta y value |
offsetVector(vector:Vector2):Void
setTo(xa:Float, ya:Float, widtha:Float, heighta:Float):Void
Sets the values of this rectangle at once
Parameters:
xa | A new x value |
---|---|
ya | A new y value |
widtha | A new width value |
heighta | A new height value |