Index: orxonox/trunk/src/animation.cc
===================================================================
--- orxonox/trunk/src/animation.cc	(revision 3794)
+++ orxonox/trunk/src/animation.cc	(revision 3795)
@@ -21,21 +21,11 @@
 
 Anim::Anim(void)
-{
-  // create a new List
-  this->keyFrameList = new tList<AnimKeyFrame>();
-  
+{  
   // initialize a beginning KeyFrame, that will be deleted afterwards
   this->bHasKeys = false;
-  AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame;
-  tmpKeyFrame->value = 0.0;
-  tmpKeyFrame->duration = 1.0;
-  keyFrameList->add(tmpKeyFrame);
 
   // setting default values
   this->localTime = 0.0;
   this->bRunning = true;
-  this->animFunc = &Anim::linear;
-  this->currentKeyFrame = tmpKeyFrame;
-  this->nextKeyFrame = tmpKeyFrame;
 }
 
@@ -43,45 +33,4 @@
 Anim::~Anim(void)
 {
-  // delete all the KeyFrames
-  tIterator<AnimKeyFrame>* itKF = keyFrameList->getIterator();
-  AnimKeyFrame*  enumKF = itKF->nextElement();
-  while (enumKF)
-    {
-      delete enumKF;
-      enumKF = itKF->nextElement();
-    }
-  delete itKF;
-  delete this->keyFrameList;
-}
-
-tList<Anim>* Anim::animatorList = NULL;
-
-
-void Anim::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
-{
-  // some small check
-  if (duration <= 0.0)
-    duration = 1.0;
-  
-
-  AnimKeyFrame* tmpKeyFrame;
-    
-  if (bHasKeys)
-    {
-      tmpKeyFrame = new AnimKeyFrame;
-      if (this->currentKeyFrame == this->nextKeyFrame)
-	this->nextKeyFrame = tmpKeyFrame;
-      this->keyFrameList->add(tmpKeyFrame);
-
-    }
-  else
-    {
-      tmpKeyFrame = this->keyFrameList->firstElement();
-      bHasKeys = true;
-    }
-  tmpKeyFrame->value = value;
-  tmpKeyFrame->duration = duration;
-  tmpKeyFrame->animFunc = animFunc;
-  
 }
 
@@ -90,47 +39,2 @@
   this->postInfinity = postInfinity;
 }
-
-void Anim::setAnimFunc(ANIM_FUNCTION animFunc)
-{
-  switch (animFunc)
-    {
-    default:
-    case ANIM_CONSTANT:
-      this->animFunc = &Anim::constant;
-      break;
-    case ANIM_LINEAR:
-      this->animFunc = &Anim::linear;
-      break;
-    case ANIM_RANDOM:
-      this->animFunc = &Anim::random;
-      break;
-    case ANIM_SINE:
-      this->animFunc = &Anim::sine;
-      break;
-    }
-}
-
-
-// animation functions
-float Anim::random(float timePassed) const
-{
-  return (float)rand()/(float)RAND_MAX;
-}
-
-float Anim::constant(float timePassed) const
-{
-  return this->currentKeyFrame->value;
-}
-
-float Anim::linear(float timePassed) const 
-{
-  return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 
-    * (timePassed / this->currentKeyFrame->duration);
-  //  PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame);
-  //  return val;
-}
-
-float Anim::sine(float timePassed) const
-{
-  
-}
Index: orxonox/trunk/src/animation.h
===================================================================
--- orxonox/trunk/src/animation.h	(revision 3794)
+++ orxonox/trunk/src/animation.h	(revision 3795)
@@ -27,7 +27,6 @@
 #define _ANIMATION_H
 
-
+#include "list.h"
 // FORWARD DEFINITION
-template<class T> class tList;
 
 typedef enum ANIM_FUNCTION {ANIM_CONSTANT,
@@ -55,50 +54,60 @@
   void setInfinity(ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
 
-  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
-  void setAnimFunc(ANIM_FUNCTION animFunc);
-
   void play(); // equals resume();
   void stop();
   void pause();
   void replay();
+  //  virtual void rewind();
 
   virtual void tick(float time) = 0;
 
+  /* implement in subclasses:
+   * 
+   * De-/Constructor
+   * Animation Functions
+   * virtual tick
+   * List of keyFrames
+   * currentKeyFrame/nextKeyFrame
+   * virtual rewind, to go to the first Keyframe. (other functions will call this one)
+   */
  protected:
   Anim(void);
 
-  static tList<Anim>* animatorList;
+  // variables
+
+  float localTime;
+  ANIM_INFINITY postInfinity;
+
+  bool bHasKeys;
+  bool bRunning;
+};
+
+
+//! A Class to handle some animation for single floated values.
+template<class T> class tAnim : public Anim
+{
+ public:
+  tAnim(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
+  virtual ~tAnim();
+
+  void setFuncToAnim(T* object, void (T::*funcToAnim)(float));
+  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
+
 
   // animation functions
+  void setAnimFunc(ANIM_FUNCTION animFunc);
+
   float random(float timePassed) const;
   float constant(float timePassed) const;
   float linear(float timePassed) const;
   float sine(float timePassed) const;
-
-
-  // variables
   //  ANIM_FUNCTION animFunc;
-  float (Anim::*animFunc)(float) const;
-
-  ANIM_INFINITY postInfinity;
-
-  bool bHasKeys;
-  bool bRunning;
-
-  float localTime;
+  float (tAnim<T>::*animFunc)(float) const;
   AnimKeyFrame* currentKeyFrame;
   AnimKeyFrame* nextKeyFrame;
   tList<AnimKeyFrame>* keyFrameList;
-};
-
-
-//! A Class to handle some animation for single floated values.
-template<class T> class tAnim : public Anim
-{
- public:
-  tAnim(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
-  virtual ~tAnim();
-
-  void setFuncToAnim(T* object, void (T::*funcToAnim)(float));
+
+
+
 
   virtual void tick(float time);
@@ -118,4 +127,16 @@
 tAnim<T>::tAnim (T* object, void (T::*funcToAnim)(float)) 
 {
+  // create a new List
+  this->keyFrameList = new tList<AnimKeyFrame>();
+  AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame;
+  tmpKeyFrame->value = 0.0;
+  tmpKeyFrame->duration = 1.0;
+  keyFrameList->add(tmpKeyFrame);
+
+  this->currentKeyFrame = tmpKeyFrame;
+  this->nextKeyFrame = tmpKeyFrame;
+
+  this->animFunc = &tAnim<T>::linear;
+
   this->setFuncToAnim(object, funcToAnim);
 }
@@ -129,5 +150,15 @@
 tAnim<T>::~tAnim () 
 {
-  // delete what has to be deleted here
+  // delete all the KeyFrames
+  tIterator<AnimKeyFrame>* itKF = keyFrameList->getIterator();
+  AnimKeyFrame*  enumKF = itKF->nextElement();
+  while (enumKF)
+    {
+      delete enumKF;
+      enumKF = itKF->nextElement();
+    }
+  delete itKF;
+  delete this->keyFrameList;
+
 }
 
@@ -138,4 +169,33 @@
   this->object = object;
   this->funcToAnim = funcToAnim;
+}
+
+template<class T>
+void tAnim<T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
+{
+  // some small check
+  if (duration <= 0.0)
+    duration = 1.0;
+  
+
+  AnimKeyFrame* tmpKeyFrame;
+    
+  if (bHasKeys)
+    {
+      tmpKeyFrame = new AnimKeyFrame;
+      if (this->currentKeyFrame == this->nextKeyFrame)
+	this->nextKeyFrame = tmpKeyFrame;
+      this->keyFrameList->add(tmpKeyFrame);
+
+    }
+  else
+    {
+      tmpKeyFrame = this->keyFrameList->firstElement();
+      bHasKeys = true;
+    }
+  tmpKeyFrame->value = value;
+  tmpKeyFrame->duration = duration;
+  tmpKeyFrame->animFunc = animFunc;
+  
 }
 
@@ -170,3 +230,54 @@
 }
 
+
+template<class T>
+void tAnim<T>::setAnimFunc(ANIM_FUNCTION animFunc)
+{
+  switch (animFunc)
+    {
+    default:
+    case ANIM_CONSTANT:
+      this->animFunc = &tAnim<T>::constant;
+      break;
+    case ANIM_LINEAR:
+      this->animFunc = &tAnim<T>::linear;
+      break;
+    case ANIM_RANDOM:
+      this->animFunc = &tAnim<T>::random;
+      break;
+    case ANIM_SINE:
+      this->animFunc = &tAnim<T>::sine;
+      break;
+    }
+}
+
+
+// animation functions
+template<class T>
+float tAnim<T>::random(float timePassed) const
+{
+  return (float)rand()/(float)RAND_MAX;
+}
+
+template<class T>
+float tAnim<T>::constant(float timePassed) const
+{
+  return this->currentKeyFrame->value;
+}
+
+template<class T>
+float tAnim<T>::linear(float timePassed) const 
+{
+  return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 
+    * (timePassed / this->currentKeyFrame->duration);
+  //  PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame);
+  //  return val;
+}
+
+template<class T>
+float tAnim<T>::sine(float timePassed) const
+{
+  
+}
+
 #endif /* _ANIMATION_H */
Index: orxonox/trunk/src/story_entities/world.h
===================================================================
--- orxonox/trunk/src/story_entities/world.h	(revision 3794)
+++ orxonox/trunk/src/story_entities/world.h	(revision 3795)
@@ -24,5 +24,5 @@
 class GarbageCollector;
 class SimpleAnimation;
-class Anim;
+template<class T> class tAnim;
 class Text;
 
@@ -99,5 +99,5 @@
   GLMenuImageScreen* glmis;           //!< The Level-Loader Display
 
-  Anim* testAnim;
+  tAnim<Text>* testAnim;
   Text* testText;                     //!< A text to Test the TextEngine;
 
