Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3816 in orxonox.OLD


Ignore:
Timestamp:
Apr 13, 2005, 11:55:17 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: AnimationPlayer updated, created a debug function, and general functionality

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

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

    r3812 r3816  
    3535Anim::~Anim(void)
    3636{
     37  AnimationPlayer::getInstance()->removeAnimation(this);
    3738}
    3839
  • orxonox/trunk/src/animation_player.cc

    r3812 r3816  
    5050
    5151   !! DANGER !! when unloading the AnimationPlayer no other Function
    52    should reference any Animations, because it automatically deletes
    53    them. This usually happens when unloading a World.
     52   should reference any Animations, from the animationList because it
     53   automatically deletes them.
     54   This usually happens when unloading a World.
    5455*/
    5556AnimationPlayer::~AnimationPlayer ()
    5657{
    5758  // deleting the Animation List AND all the elements of the List
    58    tIterator<Anim>* animIt = animationList->getIterator();
    59   Anim* anim = animIt->nextElement();
    60   while( anim != NULL)
    61     {
    62       delete anim;
    63       anim = animIt->nextElement();
    64     }
    65   delete animIt;
     59  this->flush();
    6660  delete this->animationList;
    6761
     
    8377
    8478/**
     79   \brief removes an Animation from the Animation List, WITHOUT deleting it.
     80   \param animation the Anmination to remove from the List
     81*/
     82void AnimationPlayer::removeAnimation(Anim* animation)
     83{
     84  this->animationList->remove(animation);
     85}
     86
     87/**
     88   \brief empties the list AND deletes all the Animations
     89*/
     90void AnimationPlayer::flush(void)
     91{
     92  // deleting the Animation List AND all the elements of the List
     93  tIterator<Anim>* animIt = this->animationList->getIterator();
     94  Anim* anim = animIt->nextElement();
     95  while( anim != NULL)
     96    {
     97      delete anim;
     98      this->animationList->remove(anim);
     99      anim = animIt->nextElement();
     100    }
     101  delete animIt;
     102
     103  delete this->animationList;
     104  this->animationList = new tList<Anim>();
     105}
     106
     107/**
    85108   \brief Ticks all the animations in animationList
    86109   \param timePassed the time passed since the last tick.
     
    88111void AnimationPlayer::tick(float timePassed)
    89112{
    90   tIterator<Anim>* animIt = animationList->getIterator();
     113  tIterator<Anim>* animIt = this->animationList->getIterator();
    91114  Anim* anim = animIt->nextElement();
    92115  while( anim != NULL)
     
    96119    }
    97120  delete animIt;
     121}
    98122
     123
     124/**
     125   \brief Outputs some nice debug-information
     126*/
     127void AnimationPlayer::debug(void)
     128{
     129  PRINT(0)("+------------------------------------+\n");
     130  PRINT(0)("+ ANIMATION PLAYER DEBUG INFORMATION +\n");
     131  PRINT(0)("+------------------------------------+\n");
     132  PRINT(0)("| Reference: %p\n", this);
     133  PRINT(0)("| CountOfAnims %d\n", this->animationList->getSize());
     134  PRINT(0)("-Animation Information---------------+\n");
     135  // Per ANIMATION DEBUG
     136  tIterator<Anim>* animIt = this->animationList->getIterator();
     137  Anim* anim = animIt->nextElement();
     138  while( anim != NULL)
     139    {
     140      //      anim->debug();
     141      anim = animIt->nextElement();
     142    }
     143  delete animIt;
     144
     145  PRINT(0)("+--------------------------------AP--+\n");
    99146}
  • orxonox/trunk/src/animation_player.h

    r3812 r3816  
    1919
    2020  void addAnimation(Anim* animation);
     21  void removeAnimation(Anim* animation);
     22  void flush(void);
    2123
    2224  void tick(float timePassed);
     25
     26  void debug(void);
    2327
    2428 private:
  • orxonox/trunk/src/story_entities/world.cc

    r3812 r3816  
    162162
    163163  delete this->simpleAnimation;
     164
     165  AnimationPlayer::getInstance()->debug();
    164166  delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
    165167  //delete garbagecollecor
     
    382384            testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
    383385            testAnim->setInfinity(ANIM_INF_REWIND);
    384 
    385386            break;
    386387          }
     
    947948      this->simpleAnimation->tick(seconds);
    948949      AnimationPlayer::getInstance()->tick(seconds);
    949       //testAnim->tick(seconds);
    950 
    951950    }
    952951  this->lastFrame = currentFrame;
Note: See TracChangeset for help on using the changeset viewer.