All Bundles

Rect

Definition of a rectangle, with the origin at the upper left.

Operations

New

Creates a new rectangle

New()

Creates a new rectangle

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

Creates a new rectangle

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

Creates a new rectangle

New(rect:Rect)
Parameters
NameTypeDescription
rectRectrect to copy

AddH

Add to current height

method : public : AddH(h:Int) ~ Nil
Parameters
NameTypeDescription
hIntvalue to add

AddW

Add to current width

method : public : AddW(w:Int) ~ Nil
Parameters
NameTypeDescription
wIntvalue to add

AddX

Add to current x position

method : public : AddX(x:Int) ~ Nil
Parameters
NameTypeDescription
xIntvalue to add

AddY

Add to current y position

method : public : AddY(y:Int) ~ Nil
Parameters
NameTypeDescription
yIntvalue to add

GetH

Get height

method : public : GetH() ~ Int
Return
TypeDescription
Intheight

GetW

Get width

method : public : GetW() ~ Int
Return
TypeDescription
Intwidth

GetX

Get X

method : public : GetX() ~ Int
Return
TypeDescription
Intx-position

GetY

Get Y

method : public : GetY() ~ Int
Return
TypeDescription
Inty-position

HasIntersection

Determines if two rectangles intersects

method : public : HasIntersection(B:Rect) ~ Bool
Parameters
NameTypeDescription
BRectrectangle to compare

Return
TypeDescription
Booltrue if intersection

Intersect

Calculate the intersection of two rectangles

method : public : Intersect(B:Rect, result:Rect) ~ Bool
Parameters
NameTypeDescription
BRectrectangle to compare
resultRectRect filled in with the intersection of rectangles A and B

Return
TypeDescription
BoolReturns true if there is an intersection, false otherwise.

IntersectAndLine

Calculate the intersection of a rectangle and line segment

method : public : IntersectAndLine(X1:IntRef, Y1:IntRef, X2:IntRef, Y2:IntRef) ~ Bool
Parameters
NameTypeDescription
X1IntRefa holder to the starting X-coordinate of the line
Y1IntRefa holder to the starting Y-coordinate of the line
X2IntRefa holder to the ending X-coordinate of the line
Y2IntRefa holder to the ending Y-coordinate of the line

Return
TypeDescription
Booltrue if there is an intersection, false otherwise

PointIn

Check if a point resides inside a rectangle

method : public : PointIn(p:Point) ~ Bool
Parameters
NameTypeDescription
pPointan SDL_Point which is the point

Return
TypeDescription
Booltrue if there is an intersection, false otherwise

SetH

Set height

method : public : SetH(h:Int) ~ Nil
Parameters
NameTypeDescription
hIntheight

SetW

Set width

method : public : SetW(w:Int) ~ Nil
Parameters
NameTypeDescription
wIntwidth

SetX

Set x-position

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

SetY

Set y-position

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

SubH

Subtracts from current height

method : public : SubH(h:Int) ~ Nil
Parameters
NameTypeDescription
hIntvalue to subtract

SubW

Subtracts from current width

method : public : SubW(w:Int) ~ Nil
Parameters
NameTypeDescription
wIntvalue to subtract

SubX

Subtracts from current x position

method : public : SubX(x:Int) ~ Nil
Parameters
NameTypeDescription
xIntvalue to subtract

SubY

Subtracts from current y position

method : public : SubY(y:Int) ~ Nil
Parameters
NameTypeDescription
yIntvalue to subtract

ToString

String representation of rect

method : public : ToString() ~ String
Return
TypeDescription
Stringstring representation

Union

Calculate the union of two rectangles

method : public : Union(B:Rect, result:Rect) ~ Nil
Parameters
NameTypeDescription
BRectrectangle to compare
resultRectRect filled in with the union of rectangles A and B

Return
TypeDescription
NilReturns true if there is an union, false otherwise.