16#ifndef GAMA_MAX_SPRITE_ANIM_LENGTH
17#define GAMA_MAX_SPRITE_ANIM_LENGTH 10
45 for (
int i = 0; i < n_sprites; i++)
66 for (i = 0; pattern[i] !=
'\0'; i++) {
67 anim.
anim[i] = (int)pattern[i] - (
int)
'a';
133static inline void gm_sprite_update(
gmSprite *sprite) {
void gm_image_draw_part(gmImage i, int slice_x, int slice_y, int slice_width, int slice_height, double x, double y, double w, double h)
Draws a rectangular sub-region of an image.
Definition image.h:171
gmSpriteAnim gm_sprite_anim_browse(int n_sprites, double interval)
Creates a sprite animation that sequentially browses through all available frames.
Definition sprite.h:41
gmSpriteAnim gm_sprite_anim_create(double interval, const char *pattern)
Creates a sprite animation based on a pattern string.
Definition sprite.h:62
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.
Definition sprite.h:150
#define GAMA_MAX_SPRITE_ANIM_LENGTH
Defines the maximum number of frames an animation sequence can have.
Definition sprite.h:17
gmSprite gm_sprite_create(gmImage img, int n_frames)
Creates a new sprite from an image with a specified number of frames.
Definition sprite.h:103
void gm_sprite_update_dt(gmSprite *sprite, double dt)
Updates the sprite's animation state based on elapsed time.
Definition sprite.h:119
A handle to a GPU-managed image or texture.
Definition image.h:97
int width
Definition image.h:99
int height
Definition image.h:100
Structure representing a sprite animation sequence.
Definition sprite.h:23
int8_t anim[GAMA_MAX_SPRITE_ANIM_LENGTH]
Definition sprite.h:25
double interval
Definition sprite.h:24
size_t length
Definition sprite.h:28
Structure representing a sprite with animation capabilities.
Definition sprite.h:80
size_t n_frames
Definition sprite.h:85
size_t animation_frame
Definition sprite.h:86
gmImage image
Definition sprite.h:89
gmSpriteAnim animation
Definition sprite.h:83
size_t _frame
Definition sprite.h:87
double _backlog_t
Definition sprite.h:81