Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3821 in orxonox.OLD


Ignore:
Timestamp:
Apr 14, 2005, 12:48:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: pause and play function

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

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

    r3816 r3821  
    2929
    3030   this->animationList = new tList<Anim>();
     31   this->play();
    3132}
    3233
     
    111112void AnimationPlayer::tick(float timePassed)
    112113{
    113   tIterator<Anim>* animIt = this->animationList->getIterator();
    114   Anim* anim = animIt->nextElement();
    115   while( anim != NULL)
     114  if (this->bRunning)
    116115    {
    117       anim->tick(timePassed);
    118       anim = animIt->nextElement();
     116      // iterate through all the animations and tick them.
     117      tIterator<Anim>* animIt = this->animationList->getIterator();
     118      Anim* anim = animIt->nextElement();
     119      while( anim != NULL)
     120        {
     121          anim->tick(timePassed);
     122          anim = animIt->nextElement();
     123        }
     124      delete animIt;
    119125    }
    120   delete animIt;
    121126}
     127/**
     128   \brief starts playing the AnimationPlayer
     129*/
     130void AnimationPlayer::play(void)
     131{
     132  this->bRunning = true;
     133}
     134
     135/**
     136   \brief pauses playing of the AnimationPlayer
     137*/
     138void AnimationPlayer::pause(void)
     139{
     140  this->bRunning = false;
     141}
     142
    122143
    123144
  • orxonox/trunk/src/animation_player.h

    r3820 r3821  
    3232  virtual ~AnimationPlayer(void);
    3333
     34  // animation handling
    3435  void addAnimation(Anim* animation);
    3536  void removeAnimation(Anim* animation);
    3637  void flush(void);
    3738
     39  // time functions
    3840  void tick(float timePassed);
     41  void play(void);
     42  void pause(void);
    3943
    4044  void debug(void);
     
    4650
    4751  /* class specific */
    48   tList<Anim>* animationList;              //!< A List of Animations to be handled
     52  tList<Anim>* animationList;              //!< A List of Animations to be handled.
     53  bool bRunning;                           //!< If the AnimationPlayer is running.
    4954};
    5055
Note: See TracChangeset for help on using the changeset viewer.