#include "image.h"
#include <stdlib.h>
Go to the source code of this file.
◆ GAMA_MAX_SPRITE_ANIM_LENGTH
| #define GAMA_MAX_SPRITE_ANIM_LENGTH 10 |
◆ gm_sprite_anim_browse()
| gmSpriteAnim gm_sprite_anim_browse |
( |
int | n_sprites, |
|
|
double | interval ) |
Creates a sprite animation that sequentially browses through frames.
- Parameters
-
| n_sprites | The number of sprites/frames in the animation. |
| interval | The time interval between frames. |
- Returns
- A new gmSpriteAnim instance.
◆ gm_sprite_anim_create()
| gmSpriteAnim gm_sprite_anim_create |
( |
double | interval, |
|
|
const char * | pattern ) |
Creates a sprite animation based on a pattern string.
- Parameters
-
| interval | The time interval between frames. |
| pattern | A string where each character represents a frame index (a=0, b=1, etc.). |
- Returns
- A new gmSpriteAnim instance.
◆ gm_sprite_create()
Creates a new sprite from an image with a specified number of frames.
- Parameters
-
| img | The image containing the sprite sheet. |
| n_frames | The number of frames in the sprite sheet. |
- Returns
- A new gmSprite instance.
◆ gm_sprite_draw()
| void gm_sprite_draw |
( |
gmSprite * | sprite, |
|
|
double | x, |
|
|
double | y, |
|
|
double | width, |
|
|
double | height ) |
Draws the current frame of a sprite at the specified position and size.
- Parameters
-
| sprite | Pointer to the sprite to draw. |
| x | The x-coordinate to draw at. |
| y | The y-coordinate to draw at. |
| width | The width to draw the sprite. |
| height | The height to draw the sprite. |
◆ gm_sprite_open()
| gmSprite gm_sprite_open |
( |
const char * | path, |
|
|
int | n_frames ) |
Creates a new sprite by loading an image from a file.
- Parameters
-
| path | The file path to the sprite sheet image. |
| n_frames | The number of frames in the sprite sheet. |
- Returns
- A new gmSprite instance.
◆ gm_sprite_update_dt()
| void gm_sprite_update_dt |
( |
gmSprite * | sprite, |
|
|
double | dt ) |
Updates the sprite's animation state based on elapsed time.
- Parameters
-
| sprite | Pointer to the sprite to update. |
| dt | Delta time since the last update. |