Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3833 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Apr 14, 2005, 2:03:05 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: animation can now return the BaseObject it operates on

Location:
orxonox/trunk/src
Files:
6 edited

Legend:

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

    r3820 r3833  
    2525  this->bHasKeys = false;
    2626  this->bHandled = true;
     27  this->baseObject = NULL;
    2728
    2829  // setting default values
     
    5556  this->bRunning = true;
    5657}
     58
     59
    5760void Anim::stop()
    5861{
  • orxonox/trunk/src/animation.h

    r3832 r3833  
    2828
    2929#include "list.h"
     30#include "base_object.h"
     31
    3032// FORWARD DEFINITION
    3133
     
    5254  ANIM_FUNCTION animFunc;
    5355};
    54 
    55 
    56 /**********************TEST*******************************/
    57 class aTest
    58 {
    59  public:
    60   aTest() { last = 0.0;}
    61   ~aTest() {}
    62   void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
    63  private:
    64   float diff;
    65   float last;
    66 };
    67 
    68 //aTest::aTest() {}
    69 //aTest::~aTest() {}
    70 
    71 //void aTest::littleDebug(float f)
    72 
    73 /**********************TEST*******************************/
    74 
    7556
    7657class Anim
     
    9980   * virtual rewind, to go to the first Keyframe. (other functions will call this one)
    10081   */
     82
     83  /**
     84     \returns the BaseObject, this animation operates on
     85  */
     86  BaseObject* getBaseObject(void) const { return baseObject;}
     87
    10188 protected:
    10289  Anim(void);
     
    10794  ANIM_INFINITY postInfinity;
    10895
     96  BaseObject* baseObject;         //!< The same as object in the derived classes, but with reference to BaseObject
    10997  bool bHasKeys;
    11098  bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
     
    209197void tAnim<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
    210198{
    211   this->object = object;
     199  this->baseObject = this->object = object;
    212200  this->funcToAnim = funcToAnim;
    213201}
     
    380368
    381369
     370
     371/**********************TEST*******************************/
     372class aTest
     373{
     374 public:
     375  aTest() { last = 0.0;}
     376  ~aTest() {}
     377  void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
     378 private:
     379  float diff;
     380  float last;
     381};
     382
     383//aTest::aTest() {}
     384//aTest::~aTest() {}
     385
     386//void aTest::littleDebug(float f)
     387
     388/**********************TEST*******************************/
     389
     390
    382391#endif /* _ANIMATION_H */
  • orxonox/trunk/src/animation_player.cc

    r3821 r3833  
    142142
    143143
     144Anim* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const
     145{
     146  tIterator<Anim>* animIt = this->animationList->getIterator();
     147  Anim* anim = animIt->nextElement();
     148  while( anim != NULL)
     149    {
     150      if(anim->getBaseObject() == baseObject)
     151        {
     152          delete animIt;
     153          return anim;
     154        }
     155      anim = animIt->nextElement();
     156    }
     157  delete animIt;
     158
     159}
     160
     161
    144162
    145163/**
  • orxonox/trunk/src/animation_player.h

    r3821 r3833  
    4242  void pause(void);
    4343
     44  Anim* getObjectFromBaseObject(const BaseObject* baseObject) const;
     45
    4446  void debug(void);
    4547
  • orxonox/trunk/src/lib/graphics/text_engine.cc

    r3790 r3833  
    5151Text::Text(Font* font, int type)
    5252{
     53  this->setClassName("Text");
     54
    5355  // initialize this Text
    5456  this->bindNode = NULL;
  • orxonox/trunk/src/lib/graphics/text_engine.h

    r3790 r3833  
    9090////////////
    9191//! Represents one textElement.
    92 class Text
     92class Text : public BaseObject
    9393{
    9494  friend class TextEngine;
Note: See TracChangeset for help on using the changeset viewer.