Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3794 in orxonox.OLD


Ignore:
Timestamp:
Apr 13, 2005, 3:44:38 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: definition of animation

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

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

    r3790 r3794  
    8686}
    8787
    88 void Anim::setInfinity(ANIM_INFINITY preInfinity, ANIM_INFINITY postInfinity)
     88void Anim::setInfinity(ANIM_INFINITY postInfinity)
    8989{
    90   this->preInfinity = preInfinity;
    9190  this->postInfinity = postInfinity;
    9291}
  • orxonox/trunk/src/animation.h

    r3790 r3794  
    5151{
    5252 public:
     53  virtual ~Anim(void);
     54
     55  void setInfinity(ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
     56
    5357  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
    54   void setInfinity(ANIM_INFINITY preInfinity = ANIM_INF_CONSTANT,
    55                    ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
    5658  void setAnimFunc(ANIM_FUNCTION animFunc);
     59
     60  void play(); // equals resume();
     61  void stop();
     62  void pause();
     63  void replay();
     64
     65  virtual void tick(float time) = 0;
    5766
    5867 protected:
    5968  Anim(void);
    60   virtual ~Anim(void);
    6169
    6270  static tList<Anim>* animatorList;
    63 
    64   virtual void tick(float time) = 0;
    65 
    66 
    6771
    6872  // animation functions
     
    7680  //  ANIM_FUNCTION animFunc;
    7781  float (Anim::*animFunc)(float) const;
    78   ANIM_INFINITY preInfinity;
     82
    7983  ANIM_INFINITY postInfinity;
    8084
     
    9094
    9195//! A Class to handle some animation for single floated values.
    92 template<class T> class Animation : public Anim
     96template<class T> class tAnim : public Anim
    9397{
    9498 public:
    95   Animation(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
    96   virtual ~Animation();
     99  tAnim(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
     100  virtual ~tAnim();
    97101
    98102  void setFuncToAnim(T* object, void (T::*funcToAnim)(float));
     
    112116*/
    113117template<class T>
    114 Animation<T>::Animation (T* object, void (T::*funcToAnim)(float))
     118tAnim<T>::tAnim (T* object, void (T::*funcToAnim)(float))
    115119{
    116120  this->setFuncToAnim(object, funcToAnim);
     
    123127*/
    124128template<class T>
    125 Animation<T>::~Animation ()
     129tAnim<T>::~tAnim ()
    126130{
    127131  // delete what has to be deleted here
     
    130134
    131135template<class T>
    132 void Animation<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
     136void tAnim<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
    133137{
    134138  this->object = object;
     
    138142
    139143template<class T>
    140 void Animation<T>::tick(float time)
     144void tAnim<T>::tick(float time)
    141145{
    142146  if (this->bRunning)
  • orxonox/trunk/src/story_entities/world.cc

    r3790 r3794  
    3838#include "garbage_collector.h"
    3939#include "simple_animation.h"
     40#include "animation.h"
    4041
    4142#include "command_node.h"
     
    368369            testText->setBindNode(tn);
    369370
    370             /*     
    371                    tmpAnim = new Animation<Text>(testText, &Text::setBlending);
    372                    tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
    373                    tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
    374                    tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
    375                    tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
    376                    tmpAnim->setInfinity(ANIM_INF_CONSTANT, ANIM_INF_REWIND);
    377             */
     371            testAnim = new tAnim<Text>(testText, &Text::setBlending);
     372            testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
     373            testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
     374            testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
     375            testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
     376            testAnim->setInfinity(ANIM_INF_REWIND);
     377
    378378            break;
    379379          }
     
    939939      this->garbageCollector->tick(seconds);
    940940      this->simpleAnimation->tick(seconds);
     941     
     942      //      testAnim->tick(seconds);
    941943
    942944    }
  • orxonox/trunk/src/story_entities/world.h

    r3790 r3794  
    2424class GarbageCollector;
    2525class SimpleAnimation;
    26 
     26class Anim;
    2727class Text;
    2828
     
    9999  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
    100100
     101  Anim* testAnim;
    101102  Text* testText;                     //!< A text to Test the TextEngine;
    102103
Note: See TracChangeset for help on using the changeset viewer.