Sprites management. More...
Sprites management.
Functions | |
bool | TLN_ConfigSprite (int nsprite, TLN_Spriteset spriteset, uint32_t flags) |
Configures a sprite, setting spriteset and flags at once. More... | |
bool | TLN_SetSpriteSet (int nsprite, TLN_Spriteset spriteset) |
Assigns the spriteset and its palette to a given sprite. More... | |
bool | TLN_SetSpriteFlags (int nsprite, uint32_t flags) |
Sets flags for a given sprite. More... | |
bool | TLN_EnableSpriteFlag (int nsprite, uint32_t flag, bool enable) |
Enables or disables specified flag for a sprite. More... | |
bool | TLN_SetSpritePivot (int nsprite, float px, float py) |
Sets sprite pivot point. By default is at (0,0) = top left corner. More... | |
bool | TLN_SetSpritePosition (int nsprite, int x, int y) |
Sets the sprite position in screen space. More... | |
bool | TLN_SetSpritePicture (int nsprite, int entry) |
Sets the actual graphic to the sprite. More... | |
bool | TLN_SetSpritePalette (int nsprite, TLN_Palette palette) |
Assigns a palette to a sprite. More... | |
bool | TLN_SetSpriteBlendMode (int nsprite, TLN_Blend mode, uint8_t factor) |
Sets the blending mode (transparency effect) More... | |
bool | TLN_SetSpriteScaling (int nsprite, float sx, float sy) |
Sets the scaling factor of the sprite. More... | |
bool | TLN_ResetSpriteScaling (int nsprite) |
Disables scaling for a given sprite. More... | |
int | TLN_GetSpritePicture (int nsprite) |
Returns the index of the assigned picture from the spriteset. More... | |
int | TLN_GetAvailableSprite (void) |
Finds an available (unused) sprite. More... | |
bool | TLN_EnableSpriteCollision (int nsprite, bool enable) |
Enable sprite collision checking at pixel level. More... | |
bool | TLN_GetSpriteCollision (int nsprite) |
Gets the collision status of a given sprite. More... | |
bool | TLN_GetSpriteState (int nsprite, TLN_SpriteState *state) |
Returns runtime info about a given sprite. More... | |
bool | TLN_SetFirstSprite (int nsprite) |
Sets the first sprite drawn (beginning of list) More... | |
bool | TLN_SetNextSprite (int nsprite, int next) |
Sets the next sprite to draw after a given sprite, builds list. More... | |
bool | TLN_EnableSpriteMasking (int nsprite, bool enable) |
Enables or disables masking for this sprite, if enabled it won't be drawn inside the region set up with TLN_SetSpritesMaskRegion() More... | |
void | TLN_SetSpritesMaskRegion (int top_line, int bottom_line) |
Defines a sprite masking region between the two scanlines. Sprites masked with TLN_EnableSpriteMasking() won't be drawn inside this region. More... | |
bool | TLN_SetSpriteAnimation (int nsprite, TLN_Sequence sequence, int loop) |
Starts a sprite animation. More... | |
bool | TLN_DisableSpriteAnimation (int nsprite) |
Disables animation for the given sprite. More... | |
bool | TLN_PauseSpriteAnimation (int index) |
Pauses animation for the given sprite. More... | |
bool | TLN_ResumeSpriteAnimation (int index) |
Restores animation for the given sprite. More... | |
bool | TLN_DisableSprite (int nsprite) |
Disables the sprite so it is not drawn. More... | |
TLN_Palette | TLN_GetSpritePalette (int nsprite) |
Gets the palette assigned to a given sprite. More... | |
bool TLN_ConfigSprite | ( | int | nsprite, |
TLN_Spriteset | spriteset, | ||
uint32_t | flags | ||
) |
Configures a sprite, setting spriteset and flags at once.
nsprite | Id of the sprite [0, num_sprites - 1] |
spriteset | Reference of the spriteset containing the graphics to set |
flags | Can be 0 or a combination of FLAG_FLIPX and FLAG_FLIPY |
bool TLN_SetSpriteSet | ( | int | nsprite, |
TLN_Spriteset | spriteset | ||
) |
Assigns the spriteset and its palette to a given sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
spriteset | Reference of the spriteset containing the graphics to set |
bool TLN_SetSpriteFlags | ( | int | nsprite, |
uint32_t | flags | ||
) |
Sets flags for a given sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
flags | Can be 0 or a combination of TLN_TileFlags |
bool TLN_EnableSpriteFlag | ( | int | nsprite, |
uint32_t | flag, | ||
bool | enable | ||
) |
Enables or disables specified flag for a sprite.
nsprite | of the sprite [0, num_sprites - 1] |
flag | flag (or combination of flags) to modfy |
enable | true for enable, false for disable |
bool TLN_SetSpritePivot | ( | int | nsprite, |
float | px, | ||
float | py | ||
) |
Sets sprite pivot point. By default is at (0,0) = top left corner.
nsprite | Id of the sprite [0, num_sprites - 1] |
px | horizontal normalized value (0.0 = full left, 1.0 = full right) |
py | vertical normalized value (0.0 = full top, 1.0 = full bottom) |
bool TLN_SetSpritePosition | ( | int | nsprite, |
int | x, | ||
int | y | ||
) |
Sets the sprite position in screen space.
nsprite | Id of the sprite [0, num_sprites - 1] |
x | Horizontal position of pivot (0 = left margin) |
y | Vertical position of pivot (0 = top margin) |
bool TLN_SetSpritePicture | ( | int | nsprite, |
int | entry | ||
) |
Sets the actual graphic to the sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
entry | Index of the actual picture inside the srpteset to assign (0 <= entry < num_spriteset_graphics) |
bool TLN_SetSpritePalette | ( | int | nsprite, |
TLN_Palette | palette | ||
) |
Assigns a palette to a sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
palette | Reference of the palete to assign |
bool TLN_SetSpriteBlendMode | ( | int | nsprite, |
TLN_Blend | mode, | ||
uint8_t | factor | ||
) |
Sets the blending mode (transparency effect)
nsprite | Id of the sprite [0, num_sprites - 1] |
mode | Member of the TLN_Blend enumeration |
factor | Deprecated as of 1.12, left for backwards compatibility but doesn't have effect. |
bool TLN_SetSpriteScaling | ( | int | nsprite, |
float | sx, | ||
float | sy | ||
) |
Sets the scaling factor of the sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
sx | Horizontal scale factor |
sy | Vertical scale factor |
By default the scaling factor of a given sprite is 1.0f, 1.0f, which means no scaling. Use values below 1.0 to downscale (shrink) and above 1.0 to upscale (enlarge). Call TLN_ResetScaling() to disable scaling
bool TLN_ResetSpriteScaling | ( | int | nsprite | ) |
Disables scaling for a given sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
int TLN_GetSpritePicture | ( | int | nsprite | ) |
Returns the index of the assigned picture from the spriteset.
nsprite | Id of the sprite [0, num_sprites - 1] |
int TLN_GetAvailableSprite | ( | void | ) |
Finds an available (unused) sprite.
bool TLN_EnableSpriteCollision | ( | int | nsprite, |
bool | enable | ||
) |
Enable sprite collision checking at pixel level.
nsprite | Id of the sprite [0, num_sprites - 1] |
enable | Set true to enable o false to disable (default value) |
bool TLN_GetSpriteCollision | ( | int | nsprite | ) |
Gets the collision status of a given sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
bool TLN_GetSpriteState | ( | int | nsprite, |
TLN_SpriteState * | state | ||
) |
Returns runtime info about a given sprite.
nsprite | Id of the sprite [0, num_sprites - 1] |
state | Pointer to a user-allocated TLN_SpriteState structure to fill with requested data |
bool TLN_SetFirstSprite | ( | int | nsprite | ) |
Sets the first sprite drawn (beginning of list)
nsprite | Id of the sprite [0, num_sprites - 1]. Must be enabled (visible) |
bool TLN_SetNextSprite | ( | int | nsprite, |
int | next | ||
) |
Sets the next sprite to draw after a given sprite, builds list.
nsprite | Id of the sprite [0, num_sprites - 1]. Must be enabled (visible) |
next | Id of the sprite to draw after Id [0, num_sprites - 1]. Must be enabled (visible) |
bool TLN_EnableSpriteMasking | ( | int | nsprite, |
bool | enable | ||
) |
Enables or disables masking for this sprite, if enabled it won't be drawn inside the region set up with TLN_SetSpritesMaskRegion()
nsprite | Id of the sprite to mask [0, num_sprites - 1]. |
enable | Enables (true) or disables (false) masking |
void TLN_SetSpritesMaskRegion | ( | int | top_line, |
int | bottom_line | ||
) |
Defines a sprite masking region between the two scanlines. Sprites masked with TLN_EnableSpriteMasking() won't be drawn inside this region.
top_line | Top scaline where masking starts |
bottom_line | Bottom scaline where masking ends |
bool TLN_SetSpriteAnimation | ( | int | nsprite, |
TLN_Sequence | sequence, | ||
int | loop | ||
) |
Starts a sprite animation.
nsprite | If of the sprite to animate (0 <= id < num_sprites) |
sequence | Reference of the sequence to assign |
loop | amount of times to loop, 0=infinite |
bool TLN_DisableSpriteAnimation | ( | int | index | ) |
Disables animation for the given sprite.
index | Id of the spriteto set (0 <= id < num_sprites) |
bool TLN_PauseSpriteAnimation | ( | int | index | ) |
Pauses animation for the given sprite.
index | Id of the sprite to pause animation (0 <= id < num_sprites) |
bool TLN_ResumeSpriteAnimation | ( | int | index | ) |
Restores animation for the given sprite.
index | Id of the sprite to resume animation (0 <= id < num_sprites) |
bool TLN_DisableSprite | ( | int | nsprite | ) |
Disables the sprite so it is not drawn.
nsprite | Id of the sprite [0, num_sprites - 1] |
TLN_Palette TLN_GetSpritePalette | ( | int | nsprite | ) |
Gets the palette assigned to a given sprite.
nsprite | Id of the sprite to query (0 <= id < max_sprites) |
Last update on Tue Aug 29 2023 for Tilengine 2.15.1