Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/animation.h @ 3853

Last change on this file since 3853 was 3853, checked in by bensch, 20 years ago

orxonox/trunk: doxygen-comments

File size: 3.0 KB
RevLine 
[3781]1/*!
2    \file animation.h
[3849]3    A Subclass for all animations in orxonox
[3781]4*/
5
6#ifndef _ANIMATION_H
7#define _ANIMATION_H
8
[3795]9#include "list.h"
[3833]10#include "base_object.h"
11
[3782]12// FORWARD DEFINITION
13
[3832]14#define DELTA_X 0.05  //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta
15
[3853]16//! An enumerator of Functions to describe the flow of the Animation
[3784]17typedef enum ANIM_FUNCTION {ANIM_CONSTANT,
18                            ANIM_LINEAR,
19                            ANIM_SINE,
[3825]20                            ANIM_COSINE,
21                            ANIM_EXP,
22                            ANIM_NEG_EXP,
23                            ANIM_QUADRATIC,
[3784]24                            ANIM_RANDOM};
[3787]25
[3853]26//! An enumerator describing what the animation should do after the last keyframe.
[3784]27typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT,
28                            ANIM_INF_LINEAR,
29                            ANIM_INF_PINGPONG,
30                            ANIM_INF_REWIND};//, ANIM_DELETE}
[3543]31
[3853]32//! A Struct for Keyframes that simply hold a float
[3848]33typedef struct KeyFrameF
[3784]34{
[3853]35  float duration;             //!< duration of this keyframe
36  float value;                //!< value of this keyframe
37  ANIM_FUNCTION animFunc;     //!< with whitch function to iterate to the next KeyFrameF
[3784]38};
39
[3853]40//! A Superclass for describing an animation (all animations will be derived from this one)
41/** implement in subclasses:
42 *
43 * De-/Constructor
44 * Animation Functions
45 * virtual tick
46 * List of keyFrames
47 * currentKeyFrame/nextKeyFrame
48 * virtual rewind, to go to the first Keyframe. (other functions will call this one)
49*/
[3847]50class Animation
[3782]51{
[3785]52 public:
[3847]53  virtual ~Animation(void);
[3820]54  void doNotHandle(void);
[3794]55
56  void setInfinity(ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
57
58  void play(); // equals resume();
59  void stop();
60  void pause();
61  void replay();
[3853]62  //! A virtual function that should change to the first keyframe.
[3797]63  virtual void rewind() = 0;
[3853]64  /** \brief A virtual function that ticks the animation \param dt the time passed */
[3852]65  virtual void tick(float dt) = 0;
[3794]66
[3833]67  /**
68     \returns the BaseObject, this animation operates on
69  */
[3851]70  BaseObject* getBaseObject(void) const {return baseObject;}
[3833]71
[3782]72 protected:
[3847]73  Animation(void);
[3782]74
[3784]75  // variables
[3853]76  float localTime;                //!< The Time passed since the beginning of the currentKeyFrame.
77  ANIM_INFINITY postInfinity;     //!< describing what the animation should do after the last keyframe.
[3794]78
[3833]79  BaseObject* baseObject;         //!< The same as object in the derived classes, but with reference to BaseObject
[3853]80  bool bHasKeys;                  //!< If the animation has any keys at all. Needed to add the first keyframe (and delete the dummy).
[3820]81  bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
[3853]82  bool bRunning;                  //!< If the animation is running
[3782]83};
84
85
[3833]86/**********************TEST*******************************/
87class aTest
88{
89 public:
90  aTest() { last = 0.0;}
91  ~aTest() {}
92  void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
93 private:
94  float diff;
95  float last;
96};
97
98//aTest::aTest() {}
99//aTest::~aTest() {}
100
101//void aTest::littleDebug(float f)
102
103/**********************TEST*******************************/
104
105
[3781]106#endif /* _ANIMATION_H */
Note: See TracBrowser for help on using the repository browser.