Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3812 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Apr 13, 2005, 11:08:43 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: animation-player added

Location:
orxonox/trunk/src
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r3796 r3812  
    3434                 track_node.cc \
    3535                 animation.cc \
     36                 animation_player.cc \
    3637                 simple_animation.cc \
    3738                 garbage_collector.cc \
     
    8586                 track_node.h \
    8687                 animation.h \
     88                 animation_player.h \
    8789                 simple_animation.h \
    8890                 garbage_collector.h \
  • orxonox/trunk/src/Makefile.in

    r3796 r3812  
    5656        command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \
    5757        track_manager.$(OBJEXT) track_node.$(OBJEXT) \
    58         animation.$(OBJEXT) simple_animation.$(OBJEXT) \
    59         garbage_collector.$(OBJEXT) story_entity.$(OBJEXT) \
    60         campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
    61         player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
    62         skybox.$(OBJEXT) terrain.$(OBJEXT) weapon.$(OBJEXT) \
    63         projectile.$(OBJEXT) satellite.$(OBJEXT) \
     58        animation.$(OBJEXT) animation_player.$(OBJEXT) \
     59        simple_animation.$(OBJEXT) garbage_collector.$(OBJEXT) \
     60        story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \
     61        world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \
     62        skysphere.$(OBJEXT) skybox.$(OBJEXT) terrain.$(OBJEXT) \
     63        weapon.$(OBJEXT) projectile.$(OBJEXT) satellite.$(OBJEXT) \
    6464        character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \
    6565        test_bullet.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
     
    7777am__depfiles_maybe = depfiles
    7878@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ai.Po ./$(DEPDIR)/animation.Po \
     79@AMDEP_TRUE@    ./$(DEPDIR)/animation_player.Po \
    7980@AMDEP_TRUE@    ./$(DEPDIR)/array.Po ./$(DEPDIR)/base_entity.Po \
    8081@AMDEP_TRUE@    ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \
     
    246247                 track_node.cc \
    247248                 animation.cc \
     249                 animation_player.cc \
    248250                 simple_animation.cc \
    249251                 garbage_collector.cc \
     
    297299                 track_node.h \
    298300                 animation.h \
     301                 animation_player.h \
    299302                 simple_animation.h \
    300303                 garbage_collector.h \
     
    422425@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Po@am__quote@
    423426@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation.Po@am__quote@
     427@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_player.Po@am__quote@
    424428@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    425429@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@
  • orxonox/trunk/src/animation.cc

    r3798 r3812  
    1717#include "animation.h"
    1818#include "debug.h"
     19#include "animation_player.h"
    1920
    2021
     
    2728  this->localTime = 0.0;
    2829  this->bRunning = true;
     30
     31  AnimationPlayer::getInstance()->addAnimation(this);
    2932}
    3033
  • orxonox/trunk/src/animation_player.cc

    r3807 r3812  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    1210
    1311   ### File Specific:
    14    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1513   co-programmer: ...
    1614*/
    1715
    18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM
    1917
    20 #include "proto_class.h"
    21 
    22 #include "stdincl.h" // maybe
     18#include "animation_player.h"
    2319
    2420using namespace std;
     
    2723/**
    2824   \brief standard constructor
    29    \todo this constructor is not jet implemented - do it
    3025*/
    31 ProtoClass::ProtoClass ()
     26AnimationPlayer::AnimationPlayer ()
    3227{
    33    this->setClassName ("ProtoClass");
     28   this->setClassName ("AnimationPlayer");
     29
     30   this->animationList = new tList<Anim>();
    3431}
    3532
     33/**
     34   \brief the singleton reference to this class
     35*/
     36AnimationPlayer* AnimationPlayer::singletonRef = NULL;
     37
     38/**
     39   \returns a Pointer to this Class
     40*/
     41AnimationPlayer* AnimationPlayer::getInstance(void)
     42{
     43  if (!AnimationPlayer::singletonRef)
     44    AnimationPlayer::singletonRef = new AnimationPlayer();
     45  return AnimationPlayer::singletonRef;
     46}
    3647
    3748/**
    3849   \brief standard deconstructor
    3950
     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.
    4054*/
    41 ProtoClass::~ProtoClass ()
     55AnimationPlayer::~AnimationPlayer ()
    4256{
    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;
    4469}
    4570
    4671/**
    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
    5074
    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();
    5278*/
    53 bool ProtoClass::doNonSense (int nothing) {}
     79void 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*/
     88void 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}
  • orxonox/trunk/src/animation_player.h

    r3807 r3812  
    11/*!
    2     \file proto_class.h
    3     \brief Definition of the proto class template, used quickly start work
    4     \todo Example: this shows how to use simply add a Marker that here has to be done something.
    5 
    6     The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
    7     It is an example for the CODING-CONVENTION, and a starting-point for every class.
     2    \file animation_player.h
    83*/
    94
    10 #ifndef _PROTO_CLASS_H
    11 #define _PROTO_CLASS_H
     5#ifndef _ANIMATION_PLAYER_H
     6#define _ANIMATION_PLAYER_H
    127
    13 #include "what realy has to be included"
    148#include "base_object.h"
     9#include "animation.h"
    1510
    16 // FORWARD DEFINITION \\
    17 class someClassWeNeed;
     11/* FORWARD DEFINITION */
     12
     13//! A AnimationPlayer, that handles the animation of all the Animations in the scene.
     14class AnimationPlayer : public BaseObject {
     15
     16 public:
     17  static AnimationPlayer* getInstance(void);
     18  virtual ~AnimationPlayer(void);
     19
     20  void addAnimation(Anim* animation);
     21
     22  void tick(float timePassed);
     23
     24 private:
     25  /* singleton */
     26  AnimationPlayer(void);
     27  static AnimationPlayer* singletonRef;
     28
     29  /* class specific */
     30  tList<Anim>* animationList;              //!< A List of Animations to be handled
     31};
    1832
    1933
    20 /*class Test;*/ /* forward definition of class Test (without including it here!)*/
    21 
    22 //! A default class that aids you to start creating a new class
    23 /**
    24    here can be some longer description of this class
    25 */
    26 class ProtoClass : public BaseObject {
    27 
    28  public:
    29   ProtoClass();
    30   virtual ~ProtoClass();
    31 
    32   bool doNonSense (int nothing);
    33 
    34  private:
    35   int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
    36 
    37 };
    38 
    39 #endif /* _PROTO_CLASS_H */
     34#endif /* _ANIMATION_PLAYER_H */
  • orxonox/trunk/src/defs/debug.h

    r3790 r3812  
    7272#define DEBUG_MODULE_MATH               0
    7373#define DEBUG_MODULE_FONT               4
     74#define DEBUG_MODULE_ANIM               3
    7475
    7576#define DEBUG_MODULE_NULL_PARENT        0
  • orxonox/trunk/src/story_entities/world.cc

    r3810 r3812  
    3939#include "garbage_collector.h"
    4040#include "simple_animation.h"
    41 #include "animation.h"
     41#include "animation_player.h"
    4242
    4343#include "command_node.h"
     
    162162
    163163  delete this->simpleAnimation;
     164  delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
    164165  //delete garbagecollecor
    165166  //delete animator
     
    184185  this->debugWorldNr = worldID;
    185186  this->entities = new tList<WorldEntity>();
     187  AnimationPlayer::getInstance(); // initializes the animationPlayer
    186188}
    187189
     
    374376            testText->setBindNode(tn);
    375377
    376             testAnim = new tAnim<Text>(testText, &Text::setBlending);
     378            tAnim<Text>* testAnim = new tAnim<Text>(testText, &Text::setBlending);
    377379            testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
    378380            testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
     
    944946      this->garbageCollector->tick(seconds);
    945947      this->simpleAnimation->tick(seconds);
    946      
     948      AnimationPlayer::getInstance()->tick(seconds);
    947949      //testAnim->tick(seconds);
    948950
     
    10551057  else if( !strcmp( cmd->cmd, "view4")) this->localCamera->setViewMode(VIEW_RIGHT);
    10561058  else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);
    1057   if (!strcmp(cmd->cmd, "view0")) testAnim->play();
    1058   if (!strcmp(cmd->cmd, "view1")) testAnim->stop();
    1059   if (!strcmp(cmd->cmd, "view2")) testAnim->pause();
    1060   if (!strcmp(cmd->cmd, "view3")) testAnim->replay();
    1061   if (!strcmp(cmd->cmd, "view4")) testAnim->rewind();
    10621059
    10631060  return false;
  • orxonox/trunk/src/story_entities/world.h

    r3803 r3812  
    2525class GarbageCollector;
    2626class SimpleAnimation;
    27 template<class T> class tAnim;
    2827class Text;
    2928
     
    10099  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
    101100
    102   tAnim<Text>* testAnim;
    103101  Text* testText;                     //!< A text to Test the TextEngine;
    104102
Note: See TracChangeset for help on using the changeset viewer.