ifRegion

Implemented by

NameDescription
roRegionThe roRegion component is used to represent a subsection of a bitmap

Supported methods

GetBitmap() as Object

Description

Returns the roBitmap object of the bitmap to which this region refers. A region is always a section of a bitmap.

Return Value

An roBitmap object of the bitmap.

GetX() as Integer

Description

Returns the x coordinate of the region in its bitmap.

Return Value

The x coordinate value

GetY() as Integer

Description

Returns the y coordinate of the region in its bitmap.

Return Value

The y coordinate value

GetWidth() as Integer

Description

Returns the width of the region.

Return Value

The width of the region.

GetHeight() as Integer

Description

Returns the height of the region.

Return Value

The height of the region.

Offset(x as Dynamic, y as Dynamic, w as Dynamic, h as Dynamic) as Void

Description

Adds the passed parameters x,y, w, and h to the values of those roRegion fields. Respects the wrap setting when adjusting the fields by the offsets.

Parameters

NameTypeDescription
xDynamicThe x-coordinate of the region.
yDynamicThe y-coordinate of the region.
wDynamicThe width of the region.
hDynamicThe height of the region.

Set(srcRegion as Object) as Void

Description

Initializes the fields of this region to be the same as the values of the fields in the srcRegion.

Parameters

NameTypeDescription
srcRegionObjectAn roRegion object.

Copy() as Object

Description

Returns a newly created copy of the region as a new roRegion object.

Return Value

An roRegion Object.

SetWrap(wrap as Boolean) as Void

Description

Wraps any part of a region that extends beyond the bounds of its bitmap to the other side of the bitmap and renders it there.

Parameters

NameTypeDescription
wrapBooleanA flag specifying whether wrapping of the region is enabled. If this flag is set to false, the part of the region beyond the bounds of its bitmap is not rendered.

GetWrap() as Boolean

Description

Returns if the region can be wrapped.

Parameters

A flag indicating whether wrapping of the region is enabled.

SetTime(time as Integer) as Void

Description

Sets the duration of each frame of any animated sprite that uses this region.

Parameters

A flag indicating whether wrapping of region is enabled.

NameTypeDescription
timeIntegerThe "frame hold time" in milliseconds.

GetTime() as Integer

NameReturn TypeReturn ValueDescription
GetTimeIntegerMilliseconds - IntegerReturns the "frame hold time" in milliseconds

SetPretranslation(x as Integer, y as Integer) as Void

Description

Sets the pre-translation for DrawObject, DrawRotatedObject, and DrawScaledObject.

Parameters

NameTypeDescription
xIntegerThe pre-translation x-value.
yIntegerThe pre-translation y-value.

GetPretranslationX() as Integer

Description

Returns the pre-translation x value.

Return Value

The pre-translation x value.

GetPretranslationY() as Integer

Description

Returns the pre-translation y value.

Return Value

The pre-translation y value.

SetScaleMode(mode as Integer) as Void

Description

Sets the scaling mode used for DrawScaledObject.

Parameters

NameTypeDescription
modeIntegerThe scaling mode, which may be one of the following values:
  • 0 = fast scaling operation (may have jaggies)
  • 1 = smooth scaling operation (may be slow)

GetScaleMode() as Integer

Description

Returns the scaling mode.

Return Value

The scaling mode, which may be one of the following values:

  • 0 = fast scaling operation (may have jaggies)
  • 1 = smooth scaling operation (may be slow)

SetCollisionType(collisiontype as Integer) as Void

Description

Sets the type of region to be used for collision tests with this sprite.

Parameters

NameTypeDescription
collisiontypeIntegerThe collision type, which may be one of the following values:
  • Type 0– Use the entire defined region of the sprite. Type 0 is the default
  • Type 1 – Use the defined rectangular region specified by the SetCollisionRectangle() method
  • Type 2 – Use a circular region specified by the SetCollisionCircle() method

GetCollisionType() as Integer

Description

Returns the collision type.

Return Value

The collision type, which may be one of the following values:

  • Type 0– Use the entire defined region of the sprite. Type 0 is the default
  • Type 1 – Use the defined rectangular region specified by the SetCollisionRectangle() method
  • Type 2 – Use a circular region specified by the SetCollisionCircle() method

SetCollisionRectangle(xOffset as Integer, yOffset as Integer, width as Integer, height as Integer) as Void

Description

Sets the collision rectangle used for type-1 collision tests. The upper left corner of the rectangle is the (x,y) position of the sprite plus the specified offsets. The width and height specify the size of the rectangle.

Parameters

NameTypeDescription
xOffsetIntegerThe offset for the x position of the sprite.
yOffsetIntegerThe offset for the y position of the sprite.
widthIntegerThe width of the rectangle.
heightIntegerThe height of the rectangle.

SetCollisionCircle(xOffset as Integer, yOffset as Integer, Radius as Integer) as Void

Description

Sets the collision circle used for type-2 collision tests. The center of the circle is the (x,y) position of the sprite plus the specified offsets. The radius specifies the size of the circle.

Parameters