Stores a rectangle.

Constructor

new(X:Float = 0, Y:Float = 0, Width:Float = 0, Height:Float = 0)

Variables

bottom:Float

The y coordinate of the bottom of the rectangle.

read onlyisEmpty:Bool

Whether width or height of this rectangle is equal to zero or not.

left:Float

The x coordinate of the left side of the rectangle.

right:Float

The x coordinate of the right side of the rectangle.

top:Float

The x coordinate of the top of the rectangle.

Methods

inlineceil():FlxRect

Rounds x, y, width and height using Math.ceil()

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

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: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.

destroy():Void

Necessary for IFlxDestroyable.

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.

inlinefloor():FlxRect

Rounds x, y, width and height using Math.floor()

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

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.

Returns:

The area of intersection of two rectangles.

inlineoffset(dx:Float, dy:Float):FlxRect

inlineoverlaps(Rect:FlxRect):Bool

Checks to see if some FlxRect object overlaps this FlxRect object.

Parameters:

Rect

The rectangle being tested.

Returns:

Whether or not the two rectangles overlap.

inlineput():Void

Add this FlxRect to the recycling pool.

inlineputWeak():Void

Add this FlxPoint to the recycling pool if it's a weak reference (allocated via weak()).

inlineround():FlxRect

Rounds x, y, width and height using Math.round()

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.

inlinesetPosition(x:Float, y:Float):FlxRect

Shortcut for setting both x and y.

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

Static variables

staticread onlypool:IFlxPool<FlxRect>

Static methods

staticinlineget(X:Float = 0, Y:Float = 0, Width:Float = 0, Height:Float = 0):FlxRect

Recycle or create new FlxRect. Be sure to put() them back into the pool after you're done with them!

staticinlineweak(X:Float = 0, Y:Float = 0, Width:Float = 0, Height:Float = 0):FlxRect

Recycle or create a new FlxRect which will automatically be released to the pool when passed into a flixel function.