LPCGame
A Simple 2d Game Engine
|
An image that can store and play animation sequences. More...
#include <animatedimage.h>
Inherits Image.
Public Member Functions | |
AnimatedImage (const std::string &file) | |
void | Update () |
void | Play (std::string name) |
std::string | Playing () |
void | Save (const std::string &file) const |
![]() | |
Image (const std::string &file) | |
~Image () | |
void | SetClips (const std::vector< Recti > &clips) |
void | GenClips (int cW, int cH) |
SDL_Texture * | Texture () |
Recti | Clip (int clipNum) const |
Recti | Clip () const |
void | SetActiveClip (int clip) |
int | ClipCount () const |
void | Size (int *w, int *h=NULL) const |
int | W () const |
Get the Image texture's width. | |
int | H () const |
Get the Image texture's height. | |
std::string | File () const |
Get the Image filename. | |
virtual void | Load (const std::string &file) |
Additional Inherited Members | |
![]() | |
Json::Value | SaveClips () const |
![]() | |
std::shared_ptr< SDL_Texture > | mTexture |
std::string | mFile |
Recti * | mClips |
int | mNumClips |
int | mActiveClip |
An image that can store and play animation sequences.
Used for storing and playing animation sequences, inherits from Image
AnimatedImage::AnimatedImage | ( | const std::string & | file | ) |
Setup the AnimatedImage class, if a filename is passed load the image
file | The filename |
void AnimatedImage::Play | ( | std::string | name | ) |
Play the desired animation
name | The animation name to play |
std::string AnimatedImage::Playing | ( | ) |
Get the name of the active animation
|
virtual |
void AnimatedImage::Update | ( | ) |
Update the animation, called every frame We check if time greater than the time for one frame (1 / frameRate) and if yes we then increment the frame counter by the # frames elapsed in case the animation frameRate is higher than the game framerate