Stores a rectangle.
Static variables
Static methods
Constructor
Variables
Methods
clipTo(rect:FlxRect):FlxRect
Resizes this
instance so that it fits within the intersection of the this and
the target rect. If there is no overlap between them, The result is an empty rect.
Parameters:
rect | Rectangle to check intersection against |
---|
Returns:
This rect, useful for chaining
5.9.0
.inlinecontainsPoint(point:FlxPoint):Bool
Returns true if this FlxRect contains the FlxPoint
Parameters:
point | The FlxPoint to check |
---|
Returns:
True if the FlxPoint is within this FlxRect, otherwise false
inlinecontainsXY(xPos:Float, yPos:Float):Bool
Returns true if this FlxRect contains the FlxPoint
Parameters:
xPos | The x position to check |
---|---|
yPos | The y position to check |
Returns:
True if the FlxPoint is within this FlxRect, otherwise false
inlinecopyFrom(Rect:FlxRect):FlxRect
Helper function, just copies the values from the specified rectangle.
Parameters:
Rect | Any FlxRect. |
---|
Returns:
A reference to itself.
inlinecopyFromFlash(FlashRect:Rectangle):FlxRect
Helper function, just copies the values from the specified Flash rectangle.
Parameters:
FlashRect | Any Rectangle. |
---|
Returns:
A reference to itself.
inlinecopyTo(Rect:FlxRect):FlxRect
Helper function, just copies the values from this rectangle to the specified rectangle.
Parameters:
Point | Any FlxRect. |
---|
Returns:
A reference to the altered rectangle parameter.
inlinecopyToFlash(?FlashRect:Null<Rectangle>):Rectangle
Helper function, just copies the values from this rectangle to the specified Flash rectangle.
Parameters:
Point | Any Rectangle. |
---|
Returns:
A reference to the altered rectangle parameter.
inlineequals(rect:FlxRect):Bool
Checks if this rectangle's properties are equal to properties of provided rect.
Parameters:
rect | Rectangle to check equality to. |
---|
Returns:
Whether both rectangles are equal.
inlinefromTwoPoints(Point1:FlxPoint, Point2:FlxPoint):FlxRect
Calculation of bounding box for two points
Parameters:
point1 | first point to calculate bounding box |
---|---|
point2 | second point to calculate bounding box |
Returns:
this rectangle filled with the position and size of bounding box for two specified points
getMidpoint(?point:FlxPoint):FlxPoint
The middle point of this rect
Parameters:
point | The point to hold the result, if |
---|
5.9.0
.getRotatedBounds(degrees:Float, ?origin:FlxPoint, ?newRect:FlxRect):FlxRect
Calculates the globally aligned bounding box of a FlxRect
with the given angle and origin.
Parameters:
degrees | The rotation, in degrees of the rect. |
---|---|
origin | The relative pivot point, or the point that the rectangle rotates around.
if |
newRect | Optional output |
Returns:
A globally aligned FlxRect
that fully contains the input rectangle.
4.11.0
.intersection(rect:FlxRect, ?result:FlxRect):FlxRect
Returns the area of intersection with specified rectangle. If the rectangles do not intersect, this method returns an empty rectangle.
Parameters:
rect | Rectangle to check intersection against |
---|---|
result | The resulting instance, if |
Returns:
The area of intersection of two rectangles
inlineoverlaps(rect:FlxRect):Bool
Checks to see if this rectangle overlaps another
Parameters:
rect | The other rectangle |
---|
Returns:
Whether the two rectangles overlap
inlineputWeak():Void
Add this FlxRect to the recycling pool if it's a weak reference (allocated via weak()).
inlineset(X:Float = 0, Y:Float = 0, Width:Float = 0, Height:Float = 0):FlxRect
Fill this rectangle with the data provided.
Parameters:
X | The X-coordinate of the point in space. |
---|---|
Y | The Y-coordinate of the point in space. |
Width | Desired width of the rectangle. |
Height | Desired height of the rectangle. |
Returns:
A reference to itself.
inlinesetSize(Width:Float, Height:Float):FlxRect
Shortcut for setting both width and Height.
Parameters:
Width | The new sprite width. |
---|---|
Height | The new sprite height. |
inlinetoString():String
Convert object to readable string name. Useful for debugging, save games, etc.
inlineunion(Rect:FlxRect):FlxRect
Add another rectangle to this one by filling in the horizontal and vertical space between the two rectangles.
Parameters:
Rect | The second FlxRect to add to this one |
---|
Returns:
The changed FlxRect
inlineunionWithPoint(Point:FlxPoint):FlxRect
Add another point to this rectangle one by filling in the horizontal and vertical space between the point and this rectangle.
Parameters:
Point | point to add to this one |
---|
Returns:
The changed FlxRect