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
Name | Type | Description |
---|
w | Int | width |
h | Int | height |
Creates a new rectangle
New(x:Int, y:Int, w:Int, h:Int)
Parameters
Name | Type | Description |
---|
x | Int | x-location |
y | Int | y-location |
w | Int | width |
h | Int | height |
Creates a new rectangle
New(rect:Rect)
Parameters
Name | Type | Description |
---|
rect | Rect | rect to copy |
AddH
Add to current height
method : public : AddH(h:Int) ~ Nil
Parameters
Name | Type | Description |
---|
h | Int | value to add |
AddW
Add to current width
method : public : AddW(w:Int) ~ Nil
Parameters
Name | Type | Description |
---|
w | Int | value to add |
AddX
Add to current x position
method : public : AddX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | value to add |
AddY
Add to current y position
method : public : AddY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | value to add |
GetH
Get height
method : public : GetH() ~ Int
Return
GetW
Get width
method : public : GetW() ~ Int
Return
GetX
Get X
method : public : GetX() ~ Int
Return
Type | Description |
---|
Int | x-position |
GetY
Get Y
method : public : GetY() ~ Int
Return
Type | Description |
---|
Int | y-position |
HasIntersection
Determines if two rectangles intersects
method : public : HasIntersection(B:Rect) ~ Bool
Parameters
Name | Type | Description |
---|
B | Rect | rectangle to compare |
Return
Type | Description |
---|
Bool | true if intersection |
Intersect
Calculate the intersection of two rectangles
method : public : Intersect(B:Rect, result:Rect) ~ Bool
Parameters
Name | Type | Description |
---|
B | Rect | rectangle to compare |
result | Rect | Rect filled in with the intersection of rectangles A and B |
Return
Type | Description |
---|
Bool | Returns 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
Name | Type | Description |
---|
X1 | IntRef | a holder to the starting X-coordinate of the line |
Y1 | IntRef | a holder to the starting Y-coordinate of the line |
X2 | IntRef | a holder to the ending X-coordinate of the line |
Y2 | IntRef | a holder to the ending Y-coordinate of the line |
Return
Type | Description |
---|
Bool | true if there is an intersection, false otherwise |
PointIn
Check if a point resides inside a rectangle
method : public : PointIn(p:Point) ~ Bool
Parameters
Name | Type | Description |
---|
p | Point | an SDL_Point which is the point |
Return
Type | Description |
---|
Bool | true if there is an intersection, false otherwise |
SetH
Set height
method : public : SetH(h:Int) ~ Nil
Parameters
Name | Type | Description |
---|
h | Int | height |
SetW
Set width
method : public : SetW(w:Int) ~ Nil
Parameters
Name | Type | Description |
---|
w | Int | width |
SetX
Set x-position
method : public : SetX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | x-position |
SetY
Set y-position
method : public : SetY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | y-position |
SubH
Subtracts from current height
method : public : SubH(h:Int) ~ Nil
Parameters
Name | Type | Description |
---|
h | Int | value to subtract |
SubW
Subtracts from current width
method : public : SubW(w:Int) ~ Nil
Parameters
Name | Type | Description |
---|
w | Int | value to subtract |
SubX
Subtracts from current x position
method : public : SubX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | value to subtract |
SubY
Subtracts from current y position
method : public : SubY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | value to subtract |
ToString
String representation of rect
method : public : ToString() ~ String
Return
Type | Description |
---|
String | string representation |
Union
Calculate the union of two rectangles
method : public : Union(B:Rect, result:Rect) ~ Nil
Parameters
Name | Type | Description |
---|
B | Rect | rectangle to compare |
result | Rect | Rect filled in with the union of rectangles A and B |
Return
Type | Description |
---|
Nil | Returns true if there is an union, false otherwise. |