Bromeon
Public Types | Static Public Member Functions | Public Member Functions
thor::FrameAnimation Class Reference

Changes a sprite's subrect over time. More...

Inheritance diagram for thor::FrameAnimation:
Inheritance graph

List of all members.

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.

Detailed Description

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.


Member Function Documentation

void thor::FrameAnimation::AddFrame ( float  relativeDuration,
const sf::IntRect &  subrect 
)

Adds a frame to the animation, changes only the sub-rect.

Parameters:
relativeDurationDuration of the frame relative to the other durations.
subrectRectangle 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.

Parameters:
relativeDurationDuration of the frame relative to the other durations.
textureSmart pointer to sf::Texture that is used for the new frame.
subrectRectangle 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.

Parameters:
targetThe sprite who is modified according to the animation.
progressTotal 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.


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