| [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 | */ | 
|---|
| [9869] | 30 | class AnimationPlayer : public BaseObject | 
|---|
|  | 31 | { | 
|---|
|  | 32 | ObjectListDeclaration(AnimationPlayer); | 
|---|
| [3543] | 33 |  | 
|---|
| [9869] | 34 | public: | 
|---|
| [4836] | 35 | /** @returns a Pointer to the only object of this Class */ | 
|---|
| [4746] | 36 | inline static AnimationPlayer* getInstance() { if (!singletonRef) singletonRef = new AnimationPlayer();  return singletonRef; }; | 
|---|
| [4485] | 37 |  | 
|---|
| [4746] | 38 | virtual ~AnimationPlayer(); | 
|---|
| [2036] | 39 |  | 
|---|
| [3821] | 40 | // animation handling | 
|---|
| [3847] | 41 | void addAnimation(Animation* animation); | 
|---|
|  | 42 | void removeAnimation(Animation* animation); | 
|---|
| [4746] | 43 | void flush(); | 
|---|
| [1853] | 44 |  | 
|---|
| [3821] | 45 | // time functions | 
|---|
| [3812] | 46 | void tick(float timePassed); | 
|---|
| [4746] | 47 | void play(); | 
|---|
|  | 48 | void pause(); | 
|---|
| [1853] | 49 |  | 
|---|
| [4485] | 50 | Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const; | 
|---|
| [3833] | 51 |  | 
|---|
| [4746] | 52 | void debug(); | 
|---|
| [3816] | 53 |  | 
|---|
| [9869] | 54 | private: | 
|---|
| [3812] | 55 | /* singleton */ | 
|---|
| [4746] | 56 | AnimationPlayer(); | 
|---|
| [4485] | 57 | static AnimationPlayer*      singletonRef;          //!< SingletonReference to this class. | 
|---|
| [3245] | 58 |  | 
|---|
| [3812] | 59 | /* class specific */ | 
|---|
| [5777] | 60 | std::list<Animation*>        animationList;         //!< A List of Animations to be handled. | 
|---|
| [4485] | 61 | bool                         bRunning;              //!< If the AnimationPlayer is running. | 
|---|
| [1853] | 62 | }; | 
|---|
|  | 63 |  | 
|---|
| [3812] | 64 |  | 
|---|
|  | 65 | #endif /* _ANIMATION_PLAYER_H */ | 
|---|