136 int startFrameIndex,
int endFrameIndex,
137 float frameDuration,
bool looping );
181 float angle, SDL_Point* rotationCenter, SDL_RendererFlip flip
void Animation_Stop(Animation *animation)
Stops the animation.
Definition animation.c:242
bool Animation_ClipIsFinished(Animation *animation)
Definition animation.c:315
void Animation_Update(Animation *animation)
Updates the animation.
Definition animation.c:75
int Animation_AddClipFromGrid(Animation *animation, const char *name, int startFrameIndex, int endFrameIndex, float frameDuration, bool looping)
Adds a new animation clip from a grid-based spritesheet.
Definition animation.c:145
void Animation_Play(Animation *animation, const char *clipName)
Plays an animation clip by name.
Definition animation.c:221
void Animation_Resume(Animation *animation)
Resumes the animation.
Definition animation.c:262
void Animation_Destroy(Animation *animation)
Destroys an animation and frees its memory.
Definition animation.c:116
Animation * Animation_Create(AnimationData *data)
Creates a new animation from animation data.
Definition animation.c:30
void Animation_Render(Animation *animation, Vec2 destPosition, Vec2 destSize, float angle, SDL_Point *rotationCenter, SDL_RendererFlip flip)
Renders the animation.
Definition animation.c:276
void Animation_Pause(Animation *animation)
Pauses the animation.
Definition animation.c:253
Data structure for defining an animation clip.
Definition animation.h:72
bool looping
Whether the animation should loop.
Definition animation.h:77
char * name
Name of the animation clip.
Definition animation.h:73
int endFrameIndex
Ending frame index in the spritesheet.
Definition animation.h:75
float frameDuration
Duration of each frame in seconds.
Definition animation.h:76
int startFrameIndex
Starting frame index in the spritesheet.
Definition animation.h:74
Represents an animation clip, which is a sequence of frames.
Definition animation.h:61
AnimationFrame * frames
Array of frames.
Definition animation.h:63
float frameDuration
Time per frame in seconds.
Definition animation.h:65
int frameCount
Number of frames.
Definition animation.h:64
bool looping
Whether animation should loop.
Definition animation.h:66
char * name
Animation name (e.g., "idle", "walk")
Definition animation.h:62
Configuration data for creating an animation.
Definition animation.h:102
Vec2 spriteSize
The size of the rendered sprite.
Definition animation.h:107
char * spritesheetPath
The path to the spriteSheet.
Definition animation.h:103
bool playOnStart
Whether to play the animation on creation.
Definition animation.h:109
int frameCount
Number of frames inside the sprite sheet.
Definition animation.h:105
AnimationClipData clips[15]
Array of different animation clips.
Definition animation.h:106
Vec2 frameSize
The size of each frame in the sprite sheet.
Definition animation.h:104
char * defaultClip
The default clip to play.
Definition animation.h:108
Represents a single frame in an animation.
Definition animation.h:53
Vec2 position
Position of the frame in the spritesheet.
Definition animation.h:54
Vec2 size
Size of the frame.
Definition animation.h:55
The main animation structure.
Definition animation.h:83
bool isPlaying
Whether animation is playing.
Definition animation.h:95
float timer
Time accumulator for frame changes.
Definition animation.h:94
AnimationClip * clips
Array of different animations.
Definition animation.h:85
int clipCount
Number of animation clips.
Definition animation.h:86
SDL_Texture * spritesheet
Spritesheet texture.
Definition animation.h:84
int direction
1 for forward, -1 for backward
Definition animation.h:96
int currentFrame
Current frame within the clip.
Definition animation.h:93
int frameCount
Total number of frames in the spritesheet.
Definition animation.h:89
Vec2 frameSize
Size of each frame in the spritesheet.
Definition animation.h:88
int currentClip
Currently active clip index.
Definition animation.h:92
A 2D vector structure.
Definition vec2.h:81
Provides 2D vector functionality for positions, directions, and transformations.