/*! \file animation.h A Subclass for all animations in orxonox */ #ifndef _ANIMATION_H #define _ANIMATION_H #include "list.h" #include "base_object.h" // FORWARD DEFINITION #define DELTA_X 0.05 //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta typedef enum ANIM_FUNCTION {ANIM_CONSTANT, ANIM_LINEAR, ANIM_SINE, ANIM_COSINE, ANIM_EXP, ANIM_NEG_EXP, ANIM_QUADRATIC, ANIM_RANDOM}; typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT, ANIM_INF_LINEAR, ANIM_INF_PINGPONG, ANIM_INF_REWIND};//, ANIM_DELETE} typedef struct KeyFrameF { float duration; float value; ANIM_FUNCTION animFunc; }; class Animation { public: virtual ~Animation(void); void doNotHandle(void); void setInfinity(ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT); void play(); // equals resume(); void stop(); void pause(); void replay(); virtual void rewind() = 0; virtual void tick(float time) = 0; /* implement in subclasses: * * De-/Constructor * Animation Functions * virtual tick * List of keyFrames * currentKeyFrame/nextKeyFrame * virtual rewind, to go to the first Keyframe. (other functions will call this one) */ /** \returns the BaseObject, this animation operates on */ BaseObject* getBaseObject(void) const { return baseObject;} protected: Animation(void); // variables float localTime; ANIM_INFINITY postInfinity; BaseObject* baseObject; //!< The same as object in the derived classes, but with reference to BaseObject bool bHasKeys; bool bHandled; //!< If this Animation is handled by the AnimationPlayer. bool bRunning; }; /**********************TEST*******************************/ class aTest { public: aTest() { last = 0.0;} ~aTest() {} void littleDebug(float f) { diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;} private: float diff; float last; }; //aTest::aTest() {} //aTest::~aTest() {} //void aTest::littleDebug(float f) /**********************TEST*******************************/ #endif /* _ANIMATION_H */