Changeset 3851 in orxonox.OLD for orxonox/trunk/src/t_animation.h
- Timestamp:
- Apr 17, 2005, 1:21:59 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/t_animation.h
r3849 r3851 1 2 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Benjamin Grauer 13 co-programmer: ... 14 */ 15 16 17 /*! 18 \file t_animation.h 19 */ 20 21 #ifndef _T_ANIMATION_H 22 #define _T_ANIMATION_H 3 23 4 24 #include "animation.h" … … 16 36 void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR); 17 37 18 virtual void tick(float time );38 virtual void tick(float timePassed); 19 39 20 40 // animation functions 21 41 void setAnimFunc(ANIM_FUNCTION animFunc); 42 43 private: 22 44 23 45 float constant(float timePassed) const; … … 29 51 float quadratic(float timePassed) const; 30 52 float random(float timePassed) const; 53 54 31 55 // ANIM_FUNCTION animFunc; 32 56 float (tAnimation<T>::*animFunc)(float) const; … … 35 59 tList<KeyFrameF>* keyFrameList; 36 60 37 38 39 40 private:41 61 float expFactor; 42 62 T* object; … … 110 130 if (duration <= 0.0) 111 131 duration = 1.0; 112 113 132 114 133 KeyFrameF* tmpKeyFrame; … … 135 154 136 155 template<class T> 137 void tAnimation<T>::tick(float time )156 void tAnimation<T>::tick(float timePassed) 138 157 { 139 158 if (this->bRunning) 140 159 { 141 this->localTime += time ;160 this->localTime += timePassed; 142 161 if (localTime >= this->currentKeyFrame->duration) 143 162 { 144 163 // switching to the next Key-Frame 164 this->localTime -= this->currentKeyFrame->duration; 165 145 166 this->currentKeyFrame = this->nextKeyFrame; 146 this->localTime = 0;147 167 // checking, if we should still Play the animation 148 168 if (this->currentKeyFrame == this->keyFrameList->lastElement()) … … 270 290 271 291 } 292 293 294 #endif /* _T_ANIMATION_H */
Note: See TracChangeset
for help on using the changeset viewer.