4#ifndef GAMA_MAX_SPRITE_ANIM_LENGTH
5#define GAMA_MAX_SPRITE_ANIM_LENGTH 10
27 for (
int i = 0; i < n_sprites; i++)
43 for (i = 0; pattern[i] !=
'\0'; i++) {
44 anim.
anim[i] = (int)pattern[i] - (
int)
'a';
102static inline void gm_sprite_update(
gmSprite *sprite) {
gmImage gm_image_open(const char *path)
Loads an image from a file path.
Definition image.h:20
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 part of an image at the specified position and size.
Definition image.h:50
gmSpriteAnim gm_sprite_anim_browse(int n_sprites, double interval)
Creates a sprite animation that sequentially browses through frames.
Definition sprite.h:23
gmSpriteAnim gm_sprite_anim_create(double interval, const char *pattern)
Creates a sprite animation based on a pattern string.
Definition sprite.h:39
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:114
gmSprite gm_sprite_open(const char *path, int n_frames)
Creates a new sprite by loading an image from a file.
Definition sprite.h:127
#define GAMA_MAX_SPRITE_ANIM_LENGTH
Definition sprite.h:5
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:72
void gm_sprite_update_dt(gmSprite *sprite, double dt)
Updates the sprite's animation state based on elapsed time.
Definition sprite.h:88
Structure representing an image with handle and dimensions.
Definition image.h:9
uint32_t width
Definition image.h:11
uint32_t height
Definition image.h:12
Structure representing a sprite animation sequence.
Definition sprite.h:11
double interval
Definition sprite.h:12
size_t length
Definition sprite.h:14
int anim[GAMA_MAX_SPRITE_ANIM_LENGTH]
Definition sprite.h:13
Structure representing a sprite with animation capabilities.
Definition sprite.h:54
size_t n_frames
Definition sprite.h:59
size_t animation_frame
Definition sprite.h:60
gmImage image
Definition sprite.h:63
gmSpriteAnim animation
Definition sprite.h:57
size_t _frame
Definition sprite.h:61
double _backlog_t
Definition sprite.h:55