/*!
* @file animation_player.h
*/
#ifndef _ANIMATION_PLAYER_H
#define _ANIMATION_PLAYER_H
#include "base_object.h"
#include "animation.h"
/* FORWARD DECLARATION */
//! A AnimationPlayer, that handles the animation of all the Animations in the scene.
/**
AnimationPlayer usage: \n
Initialisation: AnimationPlayer::getInstance() does the trick this is
usually done when initializing a world \n
Adding Animations: create an Animation the following Way:
\li Anim* animation = new Anim(); // also use any other Subclass of Animation to initialize this
\li set some parameters: also see the specific classes for more info
\n
if you do not want a specific Animation to be handled by the AnimationPlayer, you have to
unload it explicitely with animation->doNotHandle();
\n
eveything else will be done by the AnimationPlayer itself.\n
*/
class AnimationPlayer : public BaseObject {
public:
/** @returns a Pointer to the only object of this Class */
inline static AnimationPlayer* getInstance() { if (!singletonRef) singletonRef = new AnimationPlayer(); return singletonRef; };
virtual ~AnimationPlayer();
// animation handling
void addAnimation(Animation* animation);
void removeAnimation(Animation* animation);
void flush();
// time functions
void tick(float timePassed);
void play();
void pause();
Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const;
void debug();
private:
/* singleton */
AnimationPlayer();
static AnimationPlayer* singletonRef; //!< SingletonReference to this class.
/* class specific */
tList* animationList; //!< A List of Animations to be handled.
bool bRunning; //!< If the AnimationPlayer is running.
};
#endif /* _ANIMATION_PLAYER_H */