sftools  2.0 dev
Bunch of tools for SFML application development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
sftools::Animation Class Reference

Drawable capable of rendering an animation based on a stream of frames. More...

#include <Animation.hpp>

+ Collaboration diagram for sftools::Animation:

Public Member Functions

 Animation (FrameStream const &stream, sf::Time initialTime=sf::Time::Zero)
 Constructor.
 
void setFrameStream (FrameStream const &stream)
 Change the animation stream.
 
void restart (sf::Time initialTime=sf::Time::Zero)
 Restart the animation.
 
void update (sf::Time dt)
 Update the animation frame.
 
virtual void draw (sf::RenderTarget &target, sf::RenderStates states) const
 Implement sf::Drawable::draw() method.
 

Detailed Description

Drawable capable of rendering an animation based on a stream of frames.

All sf::Transformable and sf::Drawable methods are publicly available.

See Also
Frame
FrameStream

Definition at line 54 of file Animation/Animation.hpp.

Constructor & Destructor Documentation

sftools::Animation::Animation ( FrameStream const &  stream,
sf::Time  initialTime = sf::Time::Zero 
)
inline

Constructor.

Parameters
streamframe stream
initialTimeby default the animation start a time zero but an offset can bet given

Definition at line 64 of file Animation/Animation.hpp.

References restart(), and setFrameStream().

Member Function Documentation

virtual void sftools::Animation::draw ( sf::RenderTarget &  target,
sf::RenderStates  states 
) const
inlinevirtual

Implement sf::Drawable::draw() method.

Look at SFML's documentation of sf::Drawable.

Definition at line 116 of file Animation/Animation.hpp.

void sftools::Animation::restart ( sf::Time  initialTime = sf::Time::Zero)
inline

Restart the animation.

Parameters
initialTimeoptional time offset

Definition at line 88 of file Animation/Animation.hpp.

Referenced by Animation().

void sftools::Animation::setFrameStream ( FrameStream const &  stream)
inline

Change the animation stream.

Parameters
streamthe new stream to use

Definition at line 76 of file Animation/Animation.hpp.

Referenced by Animation().

void sftools::Animation::update ( sf::Time  dt)
inline

Update the animation frame.

Note
the dt parameter is used to allow custom time handling very easily : for example you can apply a factor on the elapsed time to create bullet time effect.
Parameters
dttime elapsed since the last update

Definition at line 104 of file Animation/Animation.hpp.


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