Changeset 3719 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 5, 2005, 12:00:35 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/simple_animation.cc
r3717 r3719 100 100 this->frames = new tList<KeyFrame>(); 101 101 this->localTime = 0; 102 this->b Pause= false;102 this->bRunning = false; 103 103 this->parent = parent; 104 this->currentFrame = NULL; 105 this->lastFrame = NULL; 104 106 } 105 107 … … 178 180 this->frames = new tList<KeyFrame>(); 179 181 this->localTime = 0; 180 this->bPause = false; 181 182 this->bRunning = false; 183 184 this->currentFrame = NULL; 185 this->lastFrame = NULL; 182 186 } 183 187 … … 186 190 */ 187 191 void SimpleAnimation::start() 188 {} 192 { 193 if( this->bRunning) 194 { 195 PRINTF(2)("SimpleAnimatin is already running. You are trying to start it again.\n"); 196 return; 197 } 198 199 this->localTime = 0; 200 this->lastFrame = this->frames->firstElement(); 201 this->currentFrame = this->frames->nextElement(this->currentFrame); 202 this->bRunning = true; 203 } 189 204 190 205 … … 193 208 */ 194 209 void SimpleAnimation::stop() 195 {} 210 { 211 this->bRunning = false; 212 } 196 213 197 214 /** … … 201 218 { 202 219 this->localTime = 0; 203 this->bPause = false; 220 this->lastFrame = this->frames->firstElement(); 221 this->currentFrame = this->frames->nextElement(this->currentFrame); 222 this->bRunning = true; 204 223 } 205 224 … … 209 228 void SimpleAnimation::pause() 210 229 { 211 this->b Pause = true;230 this->bRunning = false; 212 231 } 213 232 … … 217 236 void SimpleAnimation::resume() 218 237 { 219 this->b Pause = false;238 this->bRunning = true; 220 239 } 221 240 … … 226 245 void SimpleAnimation::tick(float time) 227 246 { 228 if(!this->bPause) 247 if( !this->bRunning) 248 return; 249 250 this->localTime += time; 251 /* first get the current frame via time-stamps */ 252 while( this->localTime > this->currentFrame->time) 229 253 { 230 switch( this->mode) 231 { 232 case LINEAR: 233 234 break; 235 case EXP: 236 237 break; 238 case NEG_EXP: 239 240 break; 241 case SIN: 242 243 break; 244 case COS: 245 246 break; 247 case QUADRATIC: 248 249 break; 250 default: 251 break; 252 } 253 } 254 } 254 printf("SimpleAnimation::tick(...) - changing Frame"); 255 this->currentFrame = this->frames->nextElement(this->currentFrame); 256 this->localTime -= this->currentFrame->time; 257 } 258 259 260 261 /* now animate it */ 262 switch( this->mode) 263 { 264 case LINEAR: 265 266 break; 267 case EXP: 268 269 break; 270 case NEG_EXP: 271 272 break; 273 case SIN: 274 275 break; 276 case COS: 277 278 break; 279 case QUADRATIC: 280 281 break; 282 default: 283 break; 284 } 285 } -
orxonox/trunk/src/simple_animation.h
r3717 r3719 32 32 void set(Vector* point, Quaternion* orientation, float time, movementMode mode); 33 33 34 private:35 34 float time; 36 35 movementMode mode; … … 62 61 63 62 private: 64 bool b Pause; //<! is set, when there is a pause63 bool bRunning; //<! is set, when the animation is running 65 64 tList<KeyFrame>* frames; //<! where keyframes are stored in 66 65 KeyFrame* currentFrame; //<! the frame that is been played now 66 KeyFrame* lastFrame; 67 67 movementMode mode; //<! this is an enum of the mode, how the speed is distributed 68 68 float localTime;
Note: See TracChangeset
for help on using the changeset viewer.