Changeset 3812 in orxonox.OLD for orxonox/trunk/src/animation_player.cc
- Timestamp:
- Apr 13, 2005, 11:08:43 PM (20 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation_player.cc
r3807 r3812 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 12 10 13 11 ### File Specific: 14 main-programmer: ...12 main-programmer: Benjamin Grauer 15 13 co-programmer: ... 16 14 */ 17 15 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ WORLD_ENTITY16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM 19 17 20 #include "proto_class.h" 21 22 #include "stdincl.h" // maybe 18 #include "animation_player.h" 23 19 24 20 using namespace std; … … 27 23 /** 28 24 \brief standard constructor 29 \todo this constructor is not jet implemented - do it30 25 */ 31 ProtoClass::ProtoClass()26 AnimationPlayer::AnimationPlayer () 32 27 { 33 this->setClassName ("ProtoClass"); 28 this->setClassName ("AnimationPlayer"); 29 30 this->animationList = new tList<Anim>(); 34 31 } 35 32 33 /** 34 \brief the singleton reference to this class 35 */ 36 AnimationPlayer* AnimationPlayer::singletonRef = NULL; 37 38 /** 39 \returns a Pointer to this Class 40 */ 41 AnimationPlayer* AnimationPlayer::getInstance(void) 42 { 43 if (!AnimationPlayer::singletonRef) 44 AnimationPlayer::singletonRef = new AnimationPlayer(); 45 return AnimationPlayer::singletonRef; 46 } 36 47 37 48 /** 38 49 \brief standard deconstructor 39 50 51 !! 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. 40 54 */ 41 ProtoClass::~ProtoClass()55 AnimationPlayer::~AnimationPlayer () 42 56 { 43 // delete what has to be deleted here 57 // 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; 66 delete this->animationList; 67 68 AnimationPlayer::singletonRef = NULL; 44 69 } 45 70 46 71 /** 47 \brief nonsense - delete this method 48 \param realy nothing to give 49 \returns true or false - probably nothing? 72 \brief adds an Animation to the AnimationList. 73 \param animation the Animation to handle 50 74 51 this is just to show the doxygen abilities (this for example is an extension for a long comment) 75 when adding a Animation the Animation will too be deleted when 76 the AnimationPlayer gets deleted. Consider not adding it, or 77 unadding it with animation->notHandled(); 52 78 */ 53 bool ProtoClass::doNonSense (int nothing) {} 79 void AnimationPlayer::addAnimation(Anim* animation) 80 { 81 this->animationList->add(animation); 82 } 83 84 /** 85 \brief Ticks all the animations in animationList 86 \param timePassed the time passed since the last tick. 87 */ 88 void AnimationPlayer::tick(float timePassed) 89 { 90 tIterator<Anim>* animIt = animationList->getIterator(); 91 Anim* anim = animIt->nextElement(); 92 while( anim != NULL) 93 { 94 anim->tick(timePassed); 95 anim = animIt->nextElement(); 96 } 97 delete animIt; 98 99 }
Note: See TracChangeset
for help on using the changeset viewer.