#include <animation.h>
Public Member Functions | |
Animation (std::vector< Frame > _frames, int frame_rate, int _x, int _y, int chunk_x, int chunk_y) | |
Animation (int frame_rate, int num_frames, int _x, int _y, int chunk_x, int chunk_y) | |
Animation () | |
void | step (long ms) |
Frame | get_frame () |
void | add_frame (Frame new_frame, int location) |
int | frame_rate () |
void | new_frame (Frame new_frame) |
void | add_actor_to_frame (Actor actor, int frame) |
bool | get_done () |
int | get_x () |
int | get_y () |
int | get_chunk_x () |
int | get_chunk_y () |
Private Attributes | |
std::vector< Frame > | frames |
int | current_frame |
int | ms_per_frame |
long | current_ms |
int | x |
int | y |
int | chunk_x |
int | chunk_y |
bool | done |
The class for performing animations. Contains coordinates for the animation to be executed at, a frame rate, and a set of frames.
Animation::Animation | ( | std::vector< Frame > | _frames, |
int | frame_rate, | ||
int | _x, | ||
int | _y, | ||
int | chunk_x, | ||
int | chunk_y | ||
) |
Constructor with prebuilt frames.
Animation::Animation | ( | int | frame_rate, |
int | num_frames, | ||
int | _x, | ||
int | _y, | ||
int | chunk_x, | ||
int | chunk_y | ||
) |
Animation with frames to be added.
Animation::Animation | ( | ) |
Empty constructor.
void Animation::add_actor_to_frame | ( | Actor | actor, |
int | frame | ||
) |
Adds an actor to a frame at a given index.
void Animation::add_frame | ( | Frame | new_frame, |
int | location | ||
) |
Adds a new frame at a selected location. It will replace the frame at the current location.
int Animation::frame_rate | ( | ) |
Returns the current frame rate (in ms).
bool Animation::get_done | ( | ) |
Basic accessor functions.
Frame Animation::get_frame | ( | ) |
Gets the current frame.
void Animation::new_frame | ( | Frame | new_frame | ) |
Adds a new frame to the end.
void Animation::step | ( | long | ms | ) |
Steps the animation one frame forward, but only if enough time (ms) has passed.
|
private |
X coordinate of the center of the animation.
|
private |
X coordinate of the center of the animation.
|
private |
The current frame of the animation.
|
private |
The number of milliseconds which have accumulated since the execution of the last frame.
|
private |
If the animation has completed execution or not.
|
private |
Contains the frames for animation.
|
private |
The number of millisecondes per frame.
|
private |
X coordinate of the center of the animation.
|
private |
X coordinate of the center of the animation.