animation¶
struct animation¶
-
struct
animation
¶ Animation frames and durations for a sprite. You may use the same animation definition for any number of sprites:
struct animation* walk = create_animation(); add_frame(walk, 0, 50, NULL); add_frame(walk, 1, 100, NULL); add_frame(walk, 2, 50,NULL); ... play_animation(zombie, walk); ... play_animation(robot, walk);
You may also associate custom data with specific key frames.
animation modes¶
create_animation¶
-
struct animation *
create_animation
(void)¶ Create a new animation.
- Return
- New animation instance, ready to have frames added using add_frame().
destroy_animation¶
add_frame¶
-
void
add_frame
(struct animation *animation, int index_in_sprite, int duration, void *userdata)¶ Add a new frame to an animation
- Parameters
animation
-Animation to add the frame to
index_in_sprite
-The frame index in the sprite frames image
duration
-The time in milliseconds to play this frame
userdata
-Any data you would like to associate with this frame You will get this data pointer back when this frame gets played