- Timestamp:
- Apr 12, 2005, 4:54:45 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/animation.h
r3782 r3783 27 27 template<class T> class tList; 28 28 29 enum ANIM_FUNCTION {ANIM_LINEAR }; 29 enum ANIM_FUNCTION {ANIM_LINEAR, ANIM_SINE }; 30 enum ANIM_INFINITY {ANIM_INF_CONSTANT, ANIM_INF_LINEAR, ANIM_INF_PINGPONG, ANIM_INF_REWIND};//, ANIM_DELETE} 30 31 31 32 class Anim … … 35 36 36 37 static tList<Anim>* animatorList; 38 39 virtual void tick(float time) = 0; 37 40 }; 38 41 … … 45 48 virtual ~Animation(); 46 49 47 void setFuncToAnim(T* object, void (T::* animFunc)(float));48 void setAnimFunc( );50 void setFuncToAnim(T* object, void (T::*funcToAnim)(float)); 51 void setAnimFunc(ANIM_FUNCTION animFunc); 49 52 void setValue(float value); 50 53 51 v oid tick(float time);54 virtual void tick(float time); 52 55 53 56 private: 54 void (T::* animFunc)(float);55 57 void (T::*funcToAnim)(float); 58 ANIM_FUNCTION animFunc; 56 59 float value; 57 60 T* object; … … 83 86 84 87 template<class T> 85 void Animation<T>::setFuncToAnim(T* object, void (T::* animFunc)(float))88 void Animation<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float)) 86 89 { 87 90 this->object = object; 88 this-> animFunc = animFunc;91 this->funcToAnim = funcToAnim; 89 92 } 90 93 … … 93 96 { 94 97 this->value = value; 95 (object->*( animFunc))(value);98 (object->*(funcToAnim))(value); 96 99 } 97 100 … … 99 102 void Animation<T>::tick(float time) 100 103 { 101 setValue(value +time/1000);102 if (value >1)103 setValue ( 0);104 setValue(value - time/1000); 105 if (value < 0) 106 setValue (1.0); 104 107 } 105 108
Note: See TracChangeset
for help on using the changeset viewer.