Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | Private Attributes | List of all members
Animation Class Reference

#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< Frameframes
 
int current_frame
 
int ms_per_frame
 
long current_ms
 
int x
 
int y
 
int chunk_x
 
int chunk_y
 
bool done
 

Detailed Description

The class for performing animations. Contains coordinates for the animation to be executed at, a frame rate, and a set of frames.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Member Data Documentation

int Animation::chunk_x
private

X coordinate of the center of the animation.

int Animation::chunk_y
private

X coordinate of the center of the animation.

int Animation::current_frame
private

The current frame of the animation.

long Animation::current_ms
private

The number of milliseconds which have accumulated since the execution of the last frame.

bool Animation::done
private

If the animation has completed execution or not.

std::vector<Frame> Animation::frames
private

Contains the frames for animation.

int Animation::ms_per_frame
private

The number of millisecondes per frame.

int Animation::x
private

X coordinate of the center of the animation.

int Animation::y
private

X coordinate of the center of the animation.


The documentation for this class was generated from the following files: