Changes a sprite's subrect over time. More...
Public Types | |
typedef std::tr1::shared_ptr < FrameAnimation > | Ptr |
Shared pointer type to FrameAnimation objects. | |
Static Public Member Functions | |
static Ptr | Create () |
Returns a shared pointer to a newly created FrameAnimation. | |
Public Member Functions | |
FrameAnimation () | |
Default constructor. | |
void | AddFrame (float relativeDuration, const sf::IntRect &subrect) |
Adds a frame to the animation, changes only the sub-rect. | |
void | AddFrame (float relativeDuration, ResourcePtr< const sf::Texture > texture, const sf::IntRect &subrect) |
Adds a frame to the animation, changes both texture and sub-rect. | |
virtual void | Apply (sf::Sprite &target, float progress) const |
Applies the animation to a sprite. |
Changes a sprite's subrect over time.
This class stores multiple frames that represent the sub-rectangle of a sf::Texture. The resulting animation consists of a sequence of frames that are drawn one after another.
void thor::FrameAnimation::AddFrame | ( | float | relativeDuration, |
const sf::IntRect & | subrect | ||
) |
Adds a frame to the animation, changes only the sub-rect.
relativeDuration | Duration of the frame relative to the other durations. |
subrect | Rectangle of the sf::Texture that is used for the new frame. |
void thor::FrameAnimation::AddFrame | ( | float | relativeDuration, |
ResourcePtr< const sf::Texture > | texture, | ||
const sf::IntRect & | subrect | ||
) |
Adds a frame to the animation, changes both texture and sub-rect.
relativeDuration | Duration of the frame relative to the other durations. |
texture | Smart pointer to sf::Texture that is used for the new frame. |
subrect | Rectangle of the sf::Texture that is used for the new frame. |
virtual void thor::FrameAnimation::Apply | ( | sf::Sprite & | target, |
float | progress | ||
) | const [virtual] |
Applies the animation to a sprite.
target | The sprite who is modified according to the animation. |
progress | Total animation progress, in the interval [0,1]. |
Implements thor::Animation.
static Ptr thor::FrameAnimation::Create | ( | ) | [static] |
Returns a shared pointer to a newly created FrameAnimation.