| [4597] | 1 | /*! | 
|---|
| [5039] | 2 | * @file animation_player.h | 
|---|
| [3245] | 3 | */ | 
|---|
| [1853] | 4 |  | 
|---|
| [3812] | 5 | #ifndef _ANIMATION_PLAYER_H | 
|---|
|  | 6 | #define _ANIMATION_PLAYER_H | 
|---|
| [1853] | 7 |  | 
|---|
| [3543] | 8 | #include "base_object.h" | 
|---|
| [3812] | 9 | #include "animation.h" | 
|---|
| [1853] | 10 |  | 
|---|
| [5777] | 11 | #include <list> | 
|---|
|  | 12 |  | 
|---|
| [5405] | 13 | /* FORWARD DECLARATION */ | 
|---|
| [3543] | 14 |  | 
|---|
| [3812] | 15 | //! A AnimationPlayer, that handles the animation of all the Animations in the scene. | 
|---|
| [3820] | 16 | /** | 
|---|
|  | 17 | <b>AnimationPlayer usage:</b> \n | 
|---|
|  | 18 |  | 
|---|
| [4597] | 19 | <b>Initialisation</b>: AnimationPlayer::getInstance() does the trick this is | 
|---|
| [3820] | 20 | usually done when initializing a world \n | 
|---|
|  | 21 | <b>Adding Animations</b>: create an Animation the following Way: | 
|---|
|  | 22 | \li Anim* animation = new Anim(); // also use any other Subclass of Animation to initialize this | 
|---|
|  | 23 | \li set some parameters: also see the specific classes for more info | 
|---|
|  | 24 | \n | 
|---|
| [4597] | 25 | if you do not want a specific Animation to be handled by the AnimationPlayer, you have to | 
|---|
| [3820] | 26 | unload it explicitely with animation->doNotHandle(); | 
|---|
|  | 27 | \n | 
|---|
|  | 28 | eveything else will be done by the AnimationPlayer itself.\n | 
|---|
|  | 29 | */ | 
|---|
| [3812] | 30 | class AnimationPlayer : public BaseObject { | 
|---|
| [3543] | 31 |  | 
|---|
| [3812] | 32 | public: | 
|---|
| [4836] | 33 | /** @returns a Pointer to the only object of this Class */ | 
|---|
| [4746] | 34 | inline static AnimationPlayer* getInstance() { if (!singletonRef) singletonRef = new AnimationPlayer();  return singletonRef; }; | 
|---|
| [4485] | 35 |  | 
|---|
| [4746] | 36 | virtual ~AnimationPlayer(); | 
|---|
| [2036] | 37 |  | 
|---|
| [3821] | 38 | // animation handling | 
|---|
| [3847] | 39 | void addAnimation(Animation* animation); | 
|---|
|  | 40 | void removeAnimation(Animation* animation); | 
|---|
| [4746] | 41 | void flush(); | 
|---|
| [1853] | 42 |  | 
|---|
| [3821] | 43 | // time functions | 
|---|
| [3812] | 44 | void tick(float timePassed); | 
|---|
| [4746] | 45 | void play(); | 
|---|
|  | 46 | void pause(); | 
|---|
| [1853] | 47 |  | 
|---|
| [4485] | 48 | Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const; | 
|---|
| [3833] | 49 |  | 
|---|
| [4746] | 50 | void debug(); | 
|---|
| [3816] | 51 |  | 
|---|
| [3245] | 52 | private: | 
|---|
| [3812] | 53 | /* singleton */ | 
|---|
| [4746] | 54 | AnimationPlayer(); | 
|---|
| [4485] | 55 | static AnimationPlayer*      singletonRef;          //!< SingletonReference to this class. | 
|---|
| [3245] | 56 |  | 
|---|
| [3812] | 57 | /* class specific */ | 
|---|
| [5777] | 58 | std::list<Animation*>        animationList;         //!< A List of Animations to be handled. | 
|---|
| [4485] | 59 | bool                         bRunning;              //!< If the AnimationPlayer is running. | 
|---|
| [1853] | 60 | }; | 
|---|
|  | 61 |  | 
|---|
| [3812] | 62 |  | 
|---|
|  | 63 | #endif /* _ANIMATION_PLAYER_H */ | 
|---|