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