The Rect instances are structures defining a rectangular portion.
They have read-only properties:
- xmin
integerthe minimum x-coordinate of the rectangle - xmax
integerthe maximum x-coordinate of the rectangle (included) - ymin
integerthe minimum y-coordinate of the rectangle - ymax
integerthe maximum y-coordinate of the rectangle (included) - width
integerthe width of the rectangle - height
integerthe height of the rectangle - isNull
booleantrue if the rectangle is considered null
This creates a Rect instance.
This constructor has three argument signatures.
- xmin
integerthe minimum x-coordinate of the rectangle - xmax
integerthe maximum x-coordinate of the rectangle (included) - ymin
integerthe minimum y-coordinate of the rectangle - ymax
integerthe maximum y-coordinate of the rectangle (included)
-
obj
Object, it can contain either:- xmin
integerthe minimum x-coordinate of the rectangle - xmax
integerthe maximum x-coordinate of the rectangle (included) - ymin
integerthe minimum y-coordinate of the rectangle - ymax
integerthe maximum y-coordinate of the rectangle (included)
or:
- x
integerthe minimum x-coordinate of the rectangle - y
integerthe minimum y-coordinate of the rectangle - width
integerthe width of the rectangle - height
integerthe height of the rectangle
- xmin
- src: the source to create a rect from, it can be:
- a
Rectinstance - a
Terminalinstance - a
ScreenBufferinstance - a
TextBufferinstance
- a
DEPRECATED, use new Rect() instead.
- params
Objectparameters, where:- srcRect
Rectthe source rectangle - dstRect
Rectthe destination rectangle - offsetX
integerthe x-offset of the source relative to the destination - offsetY
integerthe y-offset of the source relative to the destination - wrapOnly
String(optional) either 'x' or 'y': only wrap along that axis
- srcRect
This class method is useful to wrap a source on a destination. It returns an array of up to 4 blitter parameters, objects having the those properties:
- srcRect
- dstRect
- offsetX
- offsetY
This compute how the source can be copied (blitted) into the destination if the destination feature wrapping. E.g.: if we have got a sprite moving past the right-side, part of the sprite that is outside of the destination would not be clipped away, instead it would be copied on the left-side.
Internal usage only, not part of the public API.
Internal usage only, not part of the public API.
Internal usage only, not part of the public API.
- obj
Object, it can contain either:- xmin
integerthe minimum x-coordinate of the rectangle - xmax
integerthe maximum x-coordinate of the rectangle (included) - ymin
integerthe minimum y-coordinate of the rectangle - ymax
integerthe maximum y-coordinate of the rectangle (included)
- xmin
This set the new positions and dimensions for the rectangle.
- dstRect
Rectthe destination Rect instance - offsetX
integerthe x-offset of the source relative to the destination - offsetY
integerthe y-offset of the source relative to the destination - dstClipping
booleanif true, the dstRect is clipped too (i.e. mutual clipping of src and dst)
This clips the source Rect instance relative to the dstRect.
Argument offsetX and offsetY are offsets of the source relative to the dstRect coordinate system, i.e. the position of the source rectangle inside the destination rectangle.