Static methods

@:value({ scale_y : 1, scale_x : 1, rotation : 0, height : 0, width : 1, y : 0, x : 0 })staticinlineget(x:Float = 0, y:Float = 0, width:Float = 1, height:Float = 0, rotation:Float = 0, scale_x:Float = 1, scale_y:Float = 1):Rect

Gets a Rect from the pool, or creates a new one if none are available. Call put() on the Rect to place it back in the pool.

Note - The X and Y positions represent the center of the Rect. To set the Rect from its Top-Left origin, Rect.get_from_min_max() is available.

Parameters:

x

The centered X position of the Rect.

y

The centered Y position of the Rect.

width

The width of the Rect.

height

The height of the Rect.

rotation

The rotation of the Rect.

Returns:

Rect

staticinlineget_from_min_max(min_x:Float, min_y:Float, max_x:Float, max_y:Float):Rect

Gets a Rect from the pool, or creates a new one if none are available. Call put() on the Rect to place it back in the pool.

Parameters:

min_x
min_y
max_x
max_y

Returns:

Rect

staticget_pool():Pool<Rect>

Variables

ex:Float

The half-width of the Rectangle, transformed with scale_x. Use local_ex to get the untransformed extent.

ey:Float

The half-height of the Rectangle, transformed with scale_y. Use local_ey to get the untransformed extent.

height:Float

The height of the Rectangle, transformed with scale_y. Use local_height to get the untransformed height.

local_ex:Float

The half-width of the Rectangle.

local_ey:Float

The half-height of the Rectangle.

local_height:Float

The height of the Rectangle.

local_width:Float

The width of the Rectangle.

read onlymax:Vector2

The bottom-right position of the Rectangle.

read onlymin:Vector2

The top-left position of the Rectangle.

@:value(false)read onlypooled:Bool = false

read onlytransformed_rect:Null<Polygon>

If the Rectangle has a rotation, this Polygon is constructed to represent the transformed vertices of the Rectangle.

width:Float

The width of the Rectangle, transformed with scale_x. Use local_width to get the untransformed width.

Methods

inlineload(rect:Rect):Rect

@:value({ scale_y : 1, scale_x : 1, rotation : 0, height : 0, width : 1, y : 0, x : 0 })inlineset(x:Float = 0, y:Float = 0, width:Float = 1, height:Float = 0, rotation:Float = 0, scale_x:Float = 1, scale_y:Float = 1):Rect

inlineset_from_min_max(min_x:Float, min_y:Float, max_x:Float, max_y:Float):Rect

@:value({ put_self : false })to_aabb(put_self:Bool = false):AABB

@:value({ put_self : false })to_polygon(put_self:Bool = false):Polygon

Inherited Variables

Defined by Shape

read onlybottom:Float

The Lower Bounds of the Shape.

collided:Bool

Flag to determine if the Shape has collided in the last World step. Used Internally for Debugging.

read onlyleft:Float

The Left Bounds of the Shape.

local_x:Float

The Shape's position on the X axis. For Rects, Circles, and simple Polygons, this position is based on the center of the Shape.

If added to a Body, this value is treated as an offset to the Body's X position.

local_y:Float

The Shape's position on the Y axis. For Rects, Circles, and simple Polygons, this position is based on the center of the Shape.

If added to a Body, this value is treated as an offset to the Body's Y position.

read onlyright:Float

The Right Bounds of the Shape.

rotation:Float

The Shape's angular rotation.

If added to a Body, this value is relative to the Body's rotation. To get the Shape's local rotation in this case, use local_rotation.

@:value(true)solid:Bool = true

Flag to set whether the Shape collides with other Shapes.

If false, this Shape's Body will not have its position or velocity affected by other Bodies, but it will still call collision callbacks

read onlytop:Float

The Upper Bounds of the Shape.

@:value(new Transform())transform:Transform = new Transform()

type:ShapeType

Enum value determining what shape this Object is (Rect, Circle, Polygon).

x:Float

The Shape's position on the X axis. For Rects, Circles, and simple Polygons, this position is based on the center of the Shape.

If added to a Body, this value is relative to the Body's X position. To get the Shape's local X position in this case, use local_x.

y:Float

The Shape's position on the Y axis. For Rects, Circles, and simple Polygons, this position is based on the center of the Shape.

If added to a Body, this value is relative to the Body's Y position. To get the Shape's local Y position in this case, use local_y.

Inherited Methods

Defined by Shape

inlineget_position():Vector2

Gets the Shape's position on the X and Y axis as a Vector2.

inlineset_position(position:Vector2):Void