2D Sprite List Object Functions

From Danmakufu Wiki
Jump to: navigation, search

ObjSpriteList2D_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 next sprite to be added. This is the rectangle on the original texture from which the sprite will be drawn.

ObjSpriteList2D_SetDestRect

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

Sets the drawing rectangle for the next sprite to be added. This is the rectangle where the sprite will be drawn, relative to the sprite's position.

ObjSpriteList2D_SetDestCenter

Arguments:
 1) object ID (real)

Sets the drawing rectangle for the next sprite to be added, by mapping the center of the source rectangle to (0, 0), relative to the sprite's position.

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

ObjSpriteList2D_AddVertex

Arguments:
 1) object ID (real)

Adds a sprite vertex to the specified object, i.e. the current sprite is finalized and added to the list to be drawn.

After using this function, using functions to modify the object will target the next sprite to be added.

ObjSpriteList2D_CloseVertex

Arguments:
 1) object ID (real)

Finalizes the object by preventing more sprites from being added to the list to be drawn.

After using this function, using ObjRender_ functions to transform coordinates (e.g. position, angle, scale, etc) will affect all added sprites as a group.

The object's initial position is set at (0,0), so the sprites previously added are positioned relative to the overall object's position.

ObjSpriteList2D_ClearVertexCount

Arguments:
 1) object ID (real)

Clears the sprite vertices for the specified object, i.e. removes all of the sprites previously added.