Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cd_merge/src/util/animation/animation_player.h @ 6656

Last change on this file since 6656 was 5777, checked in by bensch, 19 years ago

orxonox/trunk: stl::list in AnimationPlayer

File size: 1.8 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 public:
33  /** @returns a Pointer to the only object of this Class */
34  inline static AnimationPlayer* getInstance() { if (!singletonRef) singletonRef = new AnimationPlayer();  return singletonRef; };
35
36  virtual ~AnimationPlayer();
37
38  // animation handling
39  void addAnimation(Animation* animation);
40  void removeAnimation(Animation* animation);
41  void flush();
42
43  // time functions
44  void tick(float timePassed);
45  void play();
46  void pause();
47
48  Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const;
49
50  void debug();
51
52 private:
53  /* singleton */
54  AnimationPlayer();
55  static AnimationPlayer*      singletonRef;          //!< SingletonReference to this class.
56
57  /* class specific */
58  std::list<Animation*>        animationList;         //!< A List of Animations to be handled.
59  bool                         bRunning;              //!< If the AnimationPlayer is running.
60};
61
62
63#endif /* _ANIMATION_PLAYER_H */
Note: See TracBrowser for help on using the repository browser.