Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3719 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Apr 5, 2005, 12:00:35 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: implementing simpleanimation

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/simple_animation.cc

    r3717 r3719  
    100100   this->frames = new tList<KeyFrame>();
    101101   this->localTime = 0;
    102    this->bPause = false;
     102   this->bRunning = false;
    103103   this->parent = parent;
     104   this->currentFrame = NULL;
     105   this->lastFrame = NULL;
    104106}
    105107
     
    178180  this->frames = new tList<KeyFrame>();
    179181  this->localTime = 0;
    180   this->bPause = false;
    181 
     182  this->bRunning = false;
     183
     184  this->currentFrame = NULL;
     185  this->lastFrame = NULL;
    182186}
    183187
     
    186190*/
    187191void 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}
    189204
    190205
     
    193208*/
    194209void SimpleAnimation::stop()
    195 {}
     210{
     211  this->bRunning = false;
     212}
    196213
    197214/**
     
    201218{
    202219  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;
    204223}
    205224
     
    209228void SimpleAnimation::pause()
    210229{
    211   this->bPause = true;
     230  this->bRunning = false;
    212231}
    213232
     
    217236void SimpleAnimation::resume()
    218237{
    219   this->bPause = false;
     238  this->bRunning = true;
    220239}
    221240
     
    226245void SimpleAnimation::tick(float time)
    227246{
    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)
    229253    {
    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  
    3232  void set(Vector* point, Quaternion* orientation, float time, movementMode mode);
    3333 
    34  private:
    3534  float time;
    3635  movementMode mode;
     
    6261
    6362 private:
    64   bool bPause;                     //<! is set, when there is a pause
     63  bool bRunning;                   //<! is set, when the animation is running
    6564  tList<KeyFrame>* frames;         //<! where keyframes are stored in
    6665  KeyFrame* currentFrame;          //<! the frame that is been played now
     66  KeyFrame* lastFrame;
    6767  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
    6868  float localTime;
Note: See TracChangeset for help on using the changeset viewer.