Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3787 in orxonox.OLD


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

orxonox/branches/textEngine: rewind and constant work

Location:
orxonox/branches/textEngine/src
Files:
4 edited

Legend:

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

    r3786 r3787  
    3434  // setting default values
    3535  this->localTime = 0.0;
     36  this->bRunning = true;
    3637  this->animFunc = &Anim::linear;
    3738  this->currentKeyFrame = tmpKeyFrame;
  • 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
  • orxonox/branches/textEngine/src/lib/util/list.h

    r3681 r3787  
    107107  void destroy();
    108108  T* firstElement();
     109  T* lastElement();
    109110  bool isEmpty();
    110111  int getSize();
     
    217218}
    218219
     220template<class T>
     221T* tList<T>::lastElement()
     222{
     223  return this->last->curr;
     224}
     225
    219226
    220227template<class T>
  • orxonox/branches/textEngine/src/story_entities/world.cc

    r3786 r3787  
    365365            tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
    366366            tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
     367            tmpAnim->setInfinity(ANIM_INF_CONSTANT, ANIM_INF_REWIND);
    367368            break;
    368369          }
Note: See TracChangeset for help on using the changeset viewer.