Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain/src/util/animation/animation_player.h @ 10770

Last change on this file since 10770 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.9 KB
Line 
1/*!
2 * @file animation_player.h
3*/
4
5#ifndef _ANIMATION_PLAYER_H
6#define _ANIMATION_PLAYER_H
7
8#include "base_object.h"
9#include "animation.h"
10
11#include <list>
12
13/* FORWARD DECLARATION */
14
15//! A AnimationPlayer, that handles the animation of all the Animations in the scene.
16/**
17   <b>AnimationPlayer usage:</b> \n
18
19   <b>Initialisation</b>: AnimationPlayer::getInstance() does the trick this is
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
25   if you do not want a specific Animation to be handled by the AnimationPlayer, you have to
26   unload it explicitely with animation->doNotHandle();
27   \n
28   eveything else will be done by the AnimationPlayer itself.\n
29*/
30class AnimationPlayer : public BaseObject
31{
32  ObjectListDeclaration(AnimationPlayer);
33
34public:
35  /** @returns a Pointer to the only object of this Class */
36  inline static AnimationPlayer* getInstance() { if (!singletonRef) singletonRef = new AnimationPlayer();  return singletonRef; };
37
38  virtual ~AnimationPlayer();
39
40  // animation handling
41  void addAnimation(Animation* animation);
42  void removeAnimation(Animation* animation);
43  void flush();
44
45  // time functions
46  void tick(float timePassed);
47  void play();
48  void pause();
49
50  Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const;
51
52  void debug();
53
54private:
55  /* singleton */
56  AnimationPlayer();
57  static AnimationPlayer*      singletonRef;          //!< SingletonReference to this class.
58
59  /* class specific */
60  std::list<Animation*>        animationList;         //!< A List of Animations to be handled.
61  bool                         bRunning;              //!< If the AnimationPlayer is running.
62};
63
64
65#endif /* _ANIMATION_PLAYER_H */
Note: See TracBrowser for help on using the repository browser.