Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3787 in orxonox.OLD for orxonox/branches/textEngine/src/animation.h


Ignore:
Timestamp:
Apr 13, 2005, 2:32:26 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: rewind and constant work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/animation.h

    r3786 r3787  
    3535                            ANIM_SINE,
    3636                            ANIM_RANDOM};
     37
    3738typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT,
    3839                            ANIM_INF_LINEAR,
     
    7980
    8081  bool bHasKeys;
    81   bool bPlay;
     82  bool bRunning;
    8283
    8384  float localTime;
     
    139140void Animation<T>::tick(float time)
    140141{
    141   this->localTime += time;
    142   if (localTime >= this->currentKeyFrame->duration)
     142  if (this->bRunning)
    143143    {
    144       this->localTime = 0;
    145       this->currentKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
    146       this->nextKeyFrame = this->keyFrameList->nextElement(this->nextKeyFrame);
    147       printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
    148 
    149 
     144      this->localTime += time;
     145      if (localTime >= this->currentKeyFrame->duration)
     146        {
     147          this->localTime = 0;
     148          if (this->currentKeyFrame == this->keyFrameList->lastElement())
     149            switch (this->postInfinity)
     150              {
     151              case ANIM_INF_CONSTANT:
     152                this->bRunning = false;
     153                break;
     154              case ANIM_INF_REWIND:
     155                break;
     156              }
     157          this->currentKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
     158          this->nextKeyFrame = this->keyFrameList->nextElement(this->nextKeyFrame);
     159          printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
     160         
     161         
     162        }
     163     
     164      (this->object->*(funcToAnim))((this->*animFunc)(this->localTime));
    150165    }
    151 
    152   (this->object->*(funcToAnim))((this->*animFunc)(this->localTime));
    153166}
    154167
Note: See TracChangeset for help on using the changeset viewer.