#include <AnimatedSprite.hpp>
Inheritance diagram for sfAnimatedSprite:
Public Member Functions | |
sfAnimatedSprite (const sfImage *Img=NULL) | |
sfAnimatedSprite (const sfImage *Img, const sfIntRect &SourceRect, unsigned int FrameWidth, unsigned int FrameHeight) | |
void | CreateAnimation (const sfImage *Img, const sfIntRect &SourceRect, unsigned int FrameWidth, unsigned int FrameHeight) |
void | AddFrame (const sfIntRect &FrameRect, int Index=-1) |
Public Attributes | |
float | Timing |
Time between two frames of animation (in seconds). | |
Protected Member Functions | |
virtual void | Render (sfRenderWindow &Window) |
Definition at line 44 of file AnimatedSprite.hpp.
sfAnimatedSprite::sfAnimatedSprite | ( | const sfImage * | Img = NULL |
) |
Default constructor
Img | : Image containing sprite frames (NULL by default) |
Definition at line 35 of file AnimatedSprite.cpp.
sfAnimatedSprite::sfAnimatedSprite | ( | const sfImage * | Img, | |
const sfIntRect & | SourceRect, | |||
unsigned int | FrameWidth, | |||
unsigned int | FrameHeight | |||
) |
Construct the animated sprite from its parameters
Img | : Image containing sprite frames | |
SourceRect | : Sub-rectangle contaning frames in source image | |
FrameWidth | : Width of one frame of animation, in pixels | |
FrameHeight | : Height of one frame of animation, in pixels |
Definition at line 47 of file AnimatedSprite.cpp.
References CreateAnimation().
void sfAnimatedSprite::CreateAnimation | ( | const sfImage * | Img, | |
const sfIntRect & | SourceRect, | |||
unsigned int | FrameWidth, | |||
unsigned int | FrameHeight | |||
) |
Create the animated sprite
Img | : Image containing sprite frames | |
SourceRect | : Sub-rectangle contaning frames in source image | |
FrameWidth | : Width of one frame of animation, in pixels | |
FrameHeight | : Height of one frame of animation, in pixels |
Definition at line 59 of file AnimatedSprite.cpp.
References AddFrame(), sfRect< T >::GetHeight(), sfRect< T >::GetWidth(), sfSprite::Image, sfRect< T >::Left, and sfRect< T >::Top.
Referenced by sfAnimatedSprite().
void sfAnimatedSprite::AddFrame | ( | const sfIntRect & | FrameRect, | |
int | Index = -1 | |||
) |
Add a frame to the animation, defined as a sub-rectangle of source image
FrameRect | : Rectangle defining the frame | |
Index | : Index of insertion (-1 by default, means at the end) |
Definition at line 87 of file AnimatedSprite.cpp.
References sfSprite::SubRect.
Referenced by CreateAnimation().
void sfAnimatedSprite::Render | ( | sfRenderWindow & | Window | ) | [protected, virtual] |
/see sfDrawable::Render
Reimplemented from sfSprite.
Definition at line 121 of file AnimatedSprite.cpp.
References sfClock::GetElapsedTime(), sfSprite::Render(), sfClock::Reset(), sfSprite::SubRect, and Timing.