2D Sprite Object Functions

From Danmakufu Wiki
Jump to: navigation, search

ObjSprite2D_SetSourceRect

Arguments:
 1) object ID (real)
 2) texture coordinate (left) (real)
 3) texture coordinate (top) (real)
 4) texture coordinate (right) (real)
 5) texture coordinate (bottom) (real)

Sets the texture rectangle for the sprite. This is the rectangle on the original texture from which the sprite will be drawn.

ObjSprite2D_SetDestRect

Arguments:
 1) object ID (real)
 2) left (real)
 3) top (real)
 4) right (real)
 5) bottom (real)

Sets the drawing rectangle for the sprite. This is the rectangle where the sprite will be drawn.

ObjSprite2D_SetDestCenter

Arguments:
 1) object ID (real)

Sets the drawing rectangle for the sprite by mapping the center of the source rectangle to (0, 0).

For instance, if the rectangle set with ObjSprite2D_SetSourceRect is (24, 32, 48, 46) (which is 24 wide and 14 high), the destination rectangle becomes (-12, -7, 12, 7).