Home

Position

Shape position

Operations

New

Creates a new rectangle with given size

New(rect:Rect)
Parameters
NameTypeDescription
rectRectposition

Creates a new rectangle with given position and size

New(x:Int, y:Int, w:Int, h:Int)
Parameters
NameTypeDescription
xIntx-position
yInty-position
wIntwidth
hIntheight

Creates a new rectangle with given size

New(w:Int, h:Int)
Parameters
NameTypeDescription
wIntwidth
hIntheight

AddX

Increments the current x-position

method : public : AddX(x:Int) ~ Nil
Parameters
NameTypeDescription
xIntincrement to the current x-position

AddY

Increments the current y-position

method : public : AddY(y:Int) ~ Nil
Parameters
NameTypeDescription
yIntincrement to the current y-position

Contains

Determines if position a point

method : public : Contains(p:Point) ~ Bool
Parameters
NameTypeDescription
pPointpoint

Return
TypeDescription
Booltrue of intersection, false otherwise

Determines if position a point

method : public : Contains(x:Int, y:Int) ~ Bool
Parameters
NameTypeDescription
xIntx-position
yInty-position

Return
TypeDescription
Booltrue of intersection, false otherwise

GetBottom

Gets bottom position

method : public : GetBottom() ~ Int
Return
TypeDescription
Intbottom position

GetCenterX

Gets the center x-position

method : public : GetCenterX() ~ Int
Return
TypeDescription
Intcenter x-position

GetCenterY

Gets the center y-position

method : public : GetCenterY() ~ Int
Return
TypeDescription
Intcenter y-position

GetLeft

Gets left position

method : public : GetLeft() ~ Int
Return
TypeDescription
Intleft position

GetRect

Gets bounding size

method : public : GetRect() ~ Rect
Return
TypeDescription
Rectsize and rectangle

GetRight

Gets right position

method : public : GetRight() ~ Int
Return
TypeDescription
Intright position

GetTop

Gets top position

method : public : GetTop() ~ Int
Return
TypeDescription
Inttop position

IntersectsLine

Determines if position intersect line

method : public : IntersectsLine(x1:Int, y1:Int, x2:Int, y2:Int) ~ Bool
Parameters
NameTypeDescription
x1Int'x' start position
y1Int'y' start position
x2Int'x' end position
y2Int'y' end position

Return
TypeDescription
Booltrue of intersection, false otherwise

Overlaps

Determines if position overlaps rectangle

method : public : native : Overlaps(pos:Position) ~ Bool
Parameters
NameTypeDescription
posPositionposition to test

Return
TypeDescription
Booltrue of overlap, false otherwise

Set

Set upper left position

method : public : Set(x:Int, y:Int) ~ Nil
Parameters
NameTypeDescription
xIntx-position
yInty-position

SetBottom

Sets bottom position

method : public : SetBottom(y2:Int) ~ Nil
Parameters
NameTypeDescription
y2Intbottom position

SetCenter

Set center position

method : public : SetCenter(x:Int, y:Int) ~ Nil
Parameters
NameTypeDescription
xIntx-position
yInty-position

SetCenterX

Set center x-position

method : public : SetCenterX(x:Int) ~ Nil
Parameters
NameTypeDescription
xIntx-position

SetCenterY

Set center y-position

method : public : SetCenterY(y:Int) ~ Nil
Parameters
NameTypeDescription
yInty-position

SetLeft

Sets left position

method : public : SetLeft(x:Int) ~ Nil
Parameters
NameTypeDescription
xIntx-position

SetRight

Sets right position

method : public : SetRight(x2:Int) ~ Nil
Parameters
NameTypeDescription
x2Intright position

SetTop

Sets top position

method : public : SetTop(y:Int) ~ Nil
Parameters
NameTypeDescription
yInttop position