Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 5111)
+++ trunk/src/lib/coord/p_node.cc	(revision 5113)
@@ -165,4 +165,10 @@
 void PNode::setRelCoor (const Vector& relCoord)
 {
+  if (this->toCoordinate!= NULL)
+  {
+    delete this->toCoordinate;
+    this->toCoordinate = NULL;
+  }
+
   this->relCoordinate = relCoord;
   this->bRelCoorChanged = true;
@@ -213,4 +219,10 @@
 void PNode::setAbsCoor (const Vector& absCoord)
 {
+  if (this->toCoordinate!= NULL)
+  {
+    delete this->toCoordinate;
+    this->toCoordinate = NULL;
+  }
+
   if( likely(this->parentMode & PNODE_MOVEMENT))
   {
@@ -276,4 +288,9 @@
 void PNode::setRelDir (const Quaternion& relDir)
 {
+  if (this->toDirection!= NULL)
+  {
+    delete this->toDirection;
+    this->toDirection = NULL;
+  }
   this->relDirection = relDir;
   this->bRelCoorChanged = true;
@@ -327,4 +344,10 @@
 void PNode::setAbsDir (const Quaternion& absDir)
 {
+  if (this->toDirection!= NULL)
+  {
+    delete this->toDirection;
+    this->toDirection = NULL;
+  }
+
   if (likely(this->parent != NULL))
     this->relDirection = absDir / this->parent->getAbsDir();
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 5111)
+++ trunk/src/lib/coord/p_node.h	(revision 5113)
@@ -66,4 +66,6 @@
   /** @returns the relative position */
   inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
+  /** @returns the Relative Coordinate Destination */
+  inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
   void setAbsCoor (const Vector& absCoord);
   void setAbsCoor (float x, float y, float z);
@@ -78,4 +80,6 @@
   /** @returns the relative Direction */
   inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
+  /** @returns the Relative Directional Destination */
+  inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
   /** @returns a Vector pointing into the relative Direction */
   inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
Index: trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.cc	(revision 5111)
+++ trunk/src/lib/graphics/render2D/element_2d.cc	(revision 5113)
@@ -214,4 +214,9 @@
 void Element2D::setRelCoor2D (const Vector& relCoord)
 {
+  if (this->toCoordinate!= NULL)
+  {
+    delete this->toCoordinate;
+    this->toCoordinate = NULL;
+  }
   this->relCoordinate = relCoord;
   this->bRelCoorChanged = true;
@@ -227,5 +232,5 @@
 void Element2D::setRelCoor2D (float x, float y, float z)
 {
-  this->setAbsCoor2D(Vector(x,y,z));
+  this->setRelCoor2D(Vector(x,y,z));
 }
 
@@ -288,4 +293,10 @@
 void Element2D::setAbsCoor2D (const Vector& absCoord)
 {
+  if (this->toCoordinate!= NULL)
+  {
+    delete this->toCoordinate;
+    this->toCoordinate = NULL;
+  }
+
   if( likely(this->parentMode & E2D_PARENT_MOVEMENT))
   {
@@ -362,4 +373,10 @@
 void Element2D::setRelDir2D (float relDir)
 {
+  if (this->toDirection!= NULL)
+  {
+    delete this->toDirection;
+    this->toDirection = NULL;
+  }
+
   this->relDirection = relDir;
   this->bRelDirChanged = true;
@@ -386,4 +403,10 @@
 void Element2D::setAbsDir2D (float absDir)
 {
+  if (this->toDirection!= NULL)
+  {
+    delete this->toDirection;
+    this->toDirection = NULL;
+  }
+
   if (likely(this->parent != NULL))
     this->relDirection = absDir - this->parent->getAbsDir2D();
@@ -712,5 +735,4 @@
   {
     tIterator<Element2D>* iterator = this->children->getIterator();
-      //PNode* pn = this->children->enumerate ();
     Element2D* pn = iterator->nextElement();
     while( pn != NULL)
Index: trunk/src/lib/graphics/render2D/element_2d.h
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.h	(revision 5111)
+++ trunk/src/lib/graphics/render2D/element_2d.h	(revision 5113)
@@ -108,4 +108,6 @@
     /** @returns the relative position */
     inline const Vector& getRelCoor2D () const { return this->prevRelCoordinate; };
+    /** @returns the Relative Coordinate Destination */
+    inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
     const Vector& getRelCoor2Dpx() const;
     void setAbsCoor2D (const Vector& absCoord);
@@ -123,4 +125,6 @@
     /** @returns the relative Direction */
     inline float getRelDir2D () const { return this->prevRelDirection; };
+    /** @returns the Relative Directional Destination */
+    inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
     void setAbsDir2D (float absDir);
     /** @returns the absolute Direction */
Index: trunk/src/lib/graphics/text_engine.cc
===================================================================
--- trunk/src/lib/graphics/text_engine.cc	(revision 5111)
+++ trunk/src/lib/graphics/text_engine.cc	(revision 5113)
@@ -592,5 +592,4 @@
           if( glyphSurf != NULL )
             {
-
               SDL_SetAlpha(glyphSurf, 0, 0);
 
@@ -598,5 +597,5 @@
               TexCoord tmpTexCoord;
               tmpTexCoord.minU = (float)tmpRect.x/(float)tmpSurf->w;
-              tmpTexCoord.maxU = (float)(tmpRect.x +1 +tmpGlyph->width)/(float)tmpSurf->w;
+              tmpTexCoord.maxU = (float)(tmpRect.x +1 + tmpGlyph->width)/(float)tmpSurf->w;
               tmpTexCoord.minV = (float)tmpRect.y/(float)tmpSurf->w;
               tmpTexCoord.maxV = (float)(tmpRect.y+tmpGlyph->height)/(float)tmpSurf->w;
@@ -620,14 +619,14 @@
 
               // Outputting Glyphs to BMP-files.
-              /*
-                char outname[64];
+/*
+                char outname[512];
                 if (i < 10)
-                sprintf( outname, "glyph-00%d.bmp", i );
+                sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i );
                 else if (i <100)
-                sprintf( outname, "glyph-0%d.bmp", i );
+                  sprintf( outname, "%s-glyph-0%d.bmp", this->getName(), i );
                 else
-                sprintf( outname, "glyph-%d.bmp", i );
-                SDL_SaveBMP(tmpSurf, outname);
-              */
+                  sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i );
+                SDL_SaveBMP(tmpSurf, outname);*/
+
             }
         }
@@ -712,5 +711,5 @@
                   x = 0;
                   y = y + maxLineHeight;
-                  maxLineHeight = 0;
+                  //maxLineHeight = 0;
                 }
               if (y + maxLineHeight + 1 > size)
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 5111)
+++ trunk/src/lib/lang/base_object.cc	(revision 5113)
@@ -52,5 +52,5 @@
   //  delete []this->className;
   if (this->objectName)
-    delete []this->objectName;}
+    delete[] this->objectName;}
 
 /**
@@ -84,5 +84,5 @@
 {
   if (this->objectName)
-    delete []this->objectName;
+    delete[] this->objectName;
   if (objectName)
   {
Index: trunk/src/lib/lang/base_object.h
===================================================================
--- trunk/src/lib/lang/base_object.h	(revision 5111)
+++ trunk/src/lib/lang/base_object.h	(revision 5113)
@@ -27,5 +27,5 @@
 
   void setName (const char* newName);
-  /** \brief returns the Name of this Object */
+  /** returns the Name of this Object */
   inline const char* getName ()const { return this->objectName; };
 
Index: trunk/src/lib/lang/class_list.cc
===================================================================
--- trunk/src/lib/lang/class_list.cc	(revision 5111)
+++ trunk/src/lib/lang/class_list.cc	(revision 5113)
@@ -48,4 +48,9 @@
 {
   delete this->objectList;
+  if(ClassList::classList != NULL)
+  {
+    delete ClassList::classList;
+    ClassList::classList = NULL;
+  }
   --ClassList::classCount;
 }
@@ -56,4 +61,7 @@
 //! the Count of classes
 unsigned int ClassList::classCount = 0;
+
+//! a List of all strings of all classes, that have registered so far.
+tList<const char>* ClassList::classList = NULL;
 
 /**
@@ -109,4 +117,38 @@
 }
 
+/**
+ * grabs the names of all Classes, and injects it into a List of const chars
+ * @return the generated List
+ *
+ * This function first looks, if the List has been changed (by the ListSize)
+ * befor it changes anything.
+ */
+const tList<const char>* ClassList::getClassList()
+{
+  if (unlikely(ClassList::classList != NULL && ClassList::classList->getSize() != ClassList::classCount))
+  {
+    delete ClassList::classList;
+    ClassList::classList = NULL;
+  }
+  if (unlikely(ClassList::classList == NULL))
+    ClassList::classList = new tList<const char>;
+
+  if(likely(ClassList::first != NULL))
+  {
+    ClassList* tmpCL = ClassList::first;
+    while (likely(tmpCL != NULL))
+    {
+      ClassList::classList->add(tmpCL->className);
+      tmpCL = tmpCL->next;
+    }
+  }
+  return ClassList::classList;
+}
+
+/**
+ * searches for classID and returns the list of Entities
+ * @param classID the ID of the class to get the list from
+ * @return the List accessed by classID, or NULL if not found
+ */
 tList<BaseObject>* ClassList::getList(long classID)
 {
@@ -119,4 +161,25 @@
     {
       if (unlikely(tmpCL->classID == classID))
+        return tmpCL->objectList;
+      tmpCL = tmpCL->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * searches for className and returns the list of Entities
+ * @param className the name of the class to get the list from
+ * @return the List accessed by classID, or NULL if not found
+ */tList<BaseObject>* ClassList::getList(const char* className)
+{
+  if(unlikely(ClassList::first == NULL))
+    return NULL;
+  else
+  {
+    ClassList* tmpCL = ClassList::first;
+    while (likely(tmpCL != NULL))
+    {
+      if (unlikely(!strcmp(tmpCL->className, className)))
         return tmpCL->objectList;
       tmpCL = tmpCL->next;
@@ -205,5 +268,4 @@
 }
 
-
 /**
  * prints out a string of all the types this Object matches
@@ -222,4 +284,46 @@
   }
 }
+
+/**
+ * converts a ClassID into a string
+ * @param classID the ClassID to search for
+ * @return a String containing the name of the Class, NULL if the Class was not found
+ */
+const char* ClassList::IDToString(ClassID classID)
+{
+  if(likely(ClassList::first != NULL))
+  {
+    ClassList* tmpCL = ClassList::first;
+    while (likely(tmpCL != NULL))
+    {
+      if (tmpCL->classID == classID)
+        return tmpCL->className;
+      tmpCL = tmpCL->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * converts a String into a ClassID
+ * @param className the name of the class to search for
+ * @return the ClassID. CL_NULL, if the class was not found.
+ */
+long ClassList::StringToID(const char* className)
+{
+  if(likely(ClassList::first != NULL))
+  {
+    ClassList* tmpCL = ClassList::first;
+    while (likely(tmpCL != NULL))
+    {
+      if (!strcasecmp(tmpCL->className, className))
+        return tmpCL->classID;
+      tmpCL = tmpCL->next;
+    }
+  }
+  return CL_NULL;
+}
+
+
 
 /**
Index: trunk/src/lib/lang/class_list.h
===================================================================
--- trunk/src/lib/lang/class_list.h	(revision 5111)
+++ trunk/src/lib/lang/class_list.h	(revision 5113)
@@ -35,25 +35,32 @@
 
     // STATIC FUNCTIONS
-    static void               addToClassList(BaseObject* objectPointer, const long& classID, const char* className);
-    static void               removeFromClassList(BaseObject* objectPointer);
+    static void                     addToClassList(BaseObject* objectPointer, const long& classID, const char* className);
+    static void                     removeFromClassList(BaseObject* objectPointer);
 
-    static tList<BaseObject>* getList(long classID = CL_NULL);
-    static BaseObject*        getObject(const char* name, long classID = CL_NULL);
-    static bool               exists(const BaseObject* object, long classID = CL_NULL);
+    static tList<BaseObject>*       getList(long classID = CL_NULL);
+    static tList<BaseObject>*       getList(const char* className);
+    static const tList<const char>* getClassList();
+    static BaseObject*              getObject(const char* name, long classID = CL_NULL);
+    static bool                     exists(const BaseObject* object, long classID = CL_NULL);
 
-    static void               whatIs(const BaseObject* object);
-    static void debug(unsigned int debugLevel = 0, long classID = CL_NULL);
+    static void                     whatIs(const BaseObject* object);
+
+    static const char*              IDToString(ClassID classID = CL_NULL);
+    static long                     StringToID(const char* className);
+    static void                     debug(unsigned int debugLevel = 0, long classID = CL_NULL);
+
 
   private:
-    tList<BaseObject>*       objectList;             //!< A list of Objects belonging to this Class
+    tList<BaseObject>*              objectList;             //!< A list of Objects belonging to this Class
 
-    long                     classID;                //!< ClassID stored in this ClassList \see ClassID
-    const char*              className;              //!< Name of the Class Stored here
+    long                            classID;                //!< ClassID stored in this ClassList \see ClassID
+    const char*                     className;              //!< Name of the Class Stored here
 
-    ClassList*               next;                   //!< Pointer to the next class in the List
+    ClassList*                      next;                   //!< Pointer to the next class in the List
 
     // STATIC MEMBERS
-    static ClassList*        first;                  //!< The first Class in the List
-    static unsigned int      classCount;             //!< The Count of classes that have been registered (should match the lower description)
+    static ClassList*               first;                  //!< The first Class in the List
+    static tList<const char>*       classList;              //!< a List of all Names of all classes, that have registered so far.
+    static unsigned int             classCount;             //!< The Count of classes that have been registered (should match the lower description)
 };
 
Index: trunk/src/lib/util/list.h
===================================================================
--- trunk/src/lib/util/list.h	(revision 5111)
+++ trunk/src/lib/util/list.h	(revision 5113)
@@ -135,10 +135,10 @@
   void removeLast();
   void flush();
-  T* firstElement();
-  T* lastElement();
-  bool isEmpty();
-  unsigned int getSize();
+  T* firstElement() const;
+  T* lastElement() const;
+  bool isEmpty() const;
+  unsigned int getSize() const;
   bool inList(T* entity);
-  tIterator<T>* getIterator();
+  tIterator<T>* getIterator() const;
   T* nextElement(T* toEntity);
   T* toArray();
@@ -303,5 +303,5 @@
 */
 template<class T>
-inline T* tList<T>::firstElement()
+inline T* tList<T>::firstElement() const
 {
   return this->first->curr;
@@ -314,5 +314,5 @@
 */
 template<class T>
-inline T* tList<T>::lastElement()
+inline T* tList<T>::lastElement() const
 {
   return this->last->curr;
@@ -325,5 +325,5 @@
 */
 template<class T>
-inline bool tList<T>::isEmpty()
+inline bool tList<T>::isEmpty() const
 {
   return (this->size==0)?true:false;
@@ -359,5 +359,5 @@
 */
 template<class T>
-inline unsigned int tList<T>::getSize()
+inline unsigned int tList<T>::getSize() const
 {
   return this->size;
@@ -372,5 +372,5 @@
 */
 template<class T>
-inline tIterator<T>* tList<T>::getIterator()
+inline tIterator<T>* tList<T>::getIterator() const
 {
   tIterator<T>* iterator = new tIterator<T>(this->first);
Index: trunk/src/util/loading/load_param.cc
===================================================================
--- trunk/src/util/loading/load_param.cc	(revision 5111)
+++ trunk/src/util/loading/load_param.cc	(revision 5113)
@@ -17,5 +17,4 @@
 
 #include "list.h"
-#include "array.h"
 #include "base_object.h"
 
@@ -386,11 +385,11 @@
  * searches for classes, which beginn with classNameBegin
  * @param classNameBegin the beginning string of a Class
- * @return a NEW char-array with ClassNames. The ARRAY should be deleted afterwards,
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
  * !! The strings MUST NOT be deleted !!
  */
-Array<char*>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
+tList<const char>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
 {
   unsigned int searchLength = strlen(classNameBegin);
-  Array<char*>* retVal = new Array<char*>;
+  tList<const char>* retVal = new tList<const char>;
 
   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
@@ -401,5 +400,5 @@
         !strncasecmp(enumClassDesc->className, classNameBegin, searchLength))
     {
-      retVal->addEntry(enumClassDesc->className);
+      retVal->add(enumClassDesc->className);
     }
     enumClassDesc = iterator->nextElement();
@@ -407,5 +406,4 @@
   delete iterator;
 
-  retVal->finalizeArray();
   return retVal;
 }
Index: trunk/src/util/loading/load_param.h
===================================================================
--- trunk/src/util/loading/load_param.h	(revision 5111)
+++ trunk/src/util/loading/load_param.h	(revision 5113)
@@ -31,5 +31,4 @@
 // Forward Declaration //
 template<class T> class tList;
-template<class T> class Array;
 
 //! macro that makes it even more easy to load a Parameter
@@ -312,5 +311,5 @@
 
   static void printAll(const char* fileName = NULL);
-  static Array<char*>* searchClassWithShort(const char* classNameBegin);
+  static tList<const char>* searchClassWithShort(const char* classNameBegin);
 //  static const LoadParamDescription* getClass(const char* className);
 
Index: trunk/src/util/resource_manager.cc
===================================================================
--- trunk/src/util/resource_manager.cc	(revision 5111)
+++ trunk/src/util/resource_manager.cc	(revision 5113)
@@ -99,11 +99,11 @@
       this->dataDir = new char[strlen(realDir)+1];
       strcpy(this->dataDir, realDir);
-      delete realDir;
+      delete[] realDir;
       return true;
     }
   else
     {
-      PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", dataDir, this->dataDir);
-      delete realDir;
+      PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", realDir, this->dataDir);
+      delete[] realDir;
       return false;
     }
@@ -631,5 +631,6 @@
 
   // checking for the termination of the string given. If there is a "/" at the end cut it away
-  if (directoryName[strlen(directoryName)-1] == '/')
+  if (directoryName[strlen(directoryName)-1] == '/' ||
+      directoryName[strlen(directoryName)-1] == '\\')
     {
       tmpDirName = new char[strlen(directoryName)+1];
@@ -651,5 +652,5 @@
                             ))
         {
-          delete tmpDirName;
+          delete[] tmpDirName;
           return true;
         }
Index: trunk/src/util/shell.cc
===================================================================
--- trunk/src/util/shell.cc	(revision 5111)
+++ trunk/src/util/shell.cc	(revision 5113)
@@ -20,9 +20,11 @@
 #include "text_engine.h"
 #include "list.h"
-#include "array.h"
 #include "graphics_engine.h"
 #include "event_handler.h"
 
 #include "load_param.h"
+#include "class_list.h"
+
+#include "key_names.h"
 #include "debug.h"
 #include <stdarg.h>
@@ -40,25 +42,29 @@
   this->setName("Shell");
 
+  this->shellHeight = 400;
+  this->bActive = false;
   this->buffer = new tList<char>;
 
-  this->textSize = 10;
+  this->textSize = 15;
+  this->lineSpacing = 5;
 
   //this->bufferSize = 0;
   this->bufferText = NULL;
   this->setBufferSize(100);
+  this->bufferDisplaySize = 10;
   this->setBufferDisplaySize(10);
-  this->setAbsCoor2D(3, GraphicsEngine::getInstance()->getResolutionY());
+  this->setAbsCoor2D(3, -400);
   this->delayed = 0;
   this->setRepeatDelay(.3, .05);
   this->pressedKey = SDLK_FIRST;
 
-  this->inputLineText = TextEngine::getInstance()->createText("fonts/earth.ttf", 10, TEXT_DYNAMIC, 255, 0, 0);
-  this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);
-  this->inputLineText->setText(NULL);
+  this->inputLineText = NULL;
   this->inputLine = new char[1];
   this->inputLine[0] = '\0';
-  this->inputLineText->setParent2D(this);
-
-
+
+  this->rebuildText();
+  this->completionList = NULL;
+
+  // EVENT-Handler subscription of '`' to all States, and all other keyboard commands to ES_SEHLL
   EventHandler* evh = EventHandler::getInstance();
   evh->subscribe(this, ES_ALL, SDLK_BACKQUOTE);
@@ -77,5 +83,5 @@
   for (int i = 0; i < this->bufferDisplaySize; i++)
     delete this->bufferText[i];
-  delete this->bufferText;
+  delete[] this->bufferText;
 
   // delete the inputLine
@@ -93,6 +99,53 @@
   delete charIterator;
 
+//  if (this->completionList != NULL)
+    //delete this->completionList;
+
   Shell::singletonRef = NULL;
 }
+
+
+void Shell::activate()
+{
+  if (this->bActive == true)
+    PRINTF(3)("The shell is already active\n");
+  this->bActive = true;
+
+  EventHandler::getInstance()->setState(ES_SHELL);
+  this->setRelCoorSoft2D(0, 0, 1, 5);
+}
+
+void Shell::deactivate()
+{
+  if (this->bActive == false)
+    PRINTF(3)("The shell is already inactive\n");
+  this->bActive = false;
+
+  EventHandler::getInstance()->setState(ES_GAME);
+  this->setRelCoorSoft2D(0, -400, 1, 5);
+}
+
+void Shell::setTextSize(unsigned int textSize, unsigned int lineSpacing)
+{
+  this->textSize = textSize;
+  this->lineSpacing = lineSpacing;
+
+  this->rebuildText();
+}
+
+void Shell::rebuildText()
+{
+  if (this->inputLineText == NULL)
+    delete this->inputLineText;
+  this->inputLineText = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
+  this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);
+  this->inputLineText->setText(NULL);
+  this->inputLineText->setParent2D(this);
+  this->inputLineText->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize);
+
+  this->setBufferDisplaySize(this->bufferDisplaySize);
+}
+
+
 
 /**
@@ -106,5 +159,5 @@
     for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
       delete this->bufferText[i];
-    delete this->bufferText;
+    delete[] this->bufferText;
   }
 
@@ -112,13 +165,13 @@
   for (unsigned int i = 0; i < bufferDisplaySize; i++)
   {
-    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/earth.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
+    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
     this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT);
-    this->bufferText[i]->setRelCoor2D(5, 12+12*i);
+    this->bufferText[i]->setRelCoor2D(5, (this->textSize + this->lineSpacing)*(bufferDisplaySize - i -1));
     this->bufferText[i]->setText(NULL);
     this->bufferText[i]->setParent2D(this);
   }
-
-
   this->bufferDisplaySize = bufferDisplaySize;
+
+  this->shellHeight = (this->textSize + this->lineSpacing) * (bufferDisplaySize+1);
 }
 
@@ -153,6 +206,4 @@
  * @param line the Line as in the first argument in printf
  * @param args the arguments as a va_list
- *
- * @todo optimize
  */
 bool Shell::addBufferLineStatic(const char* line, ...)
@@ -174,5 +225,4 @@
   return true;
 }
-int curr = 0;
 
 /**
@@ -199,16 +249,25 @@
    }
 
-   if (likely(bufferText != NULL))
+   if (this->bActive && likely(bufferText != NULL))
    {
-     Text* moveText = this->bufferText[this->bufferDisplaySize-1];
-     for (int i = this->bufferDisplaySize-1; i > 0; i--)
+     Text* lastText = this->bufferText[this->bufferDisplaySize-1];
+     Vector firstCoord = this->bufferText[0]->getRelCoorSoft2D();
+
+     Text* swapText;
+     Text* moveText = this->bufferText[0];
+     this->bufferText[0]->setRelCoorSoft2D(this->bufferText[1]->getRelCoorSoft2D(), 5);
+     for (unsigned int i = 1; i < this->bufferDisplaySize; i++)
      {
-       this->bufferText[i] = this->bufferText[i-1];
+       if ( i < this->bufferDisplaySize-1)
+         this->bufferText[i]->setRelCoorSoft2D(this->bufferText[i+1]->getRelCoorSoft2D(),5);
+       swapText = this->bufferText[i];
+       this->bufferText[i] = moveText;
+       moveText = swapText;
      }
-     this->bufferText[0] = moveText;
+     lastText->setRelCoor2D(firstCoord);
+     this->bufferText[0] = lastText;
+
+     this->bufferText[0]->setText(newLine);
    }
-   this->bufferText[0]->setText(newLine);
-   // this->bufferText->
-//  this->inputLineText->setText(newLine);
 }
 
@@ -246,5 +305,4 @@
 }
 
-
 /**
  * deletes the InputLine
@@ -258,5 +316,4 @@
   this->inputLine = new char[1];
   *this->inputLine = '\0';
-
 }
 
@@ -316,5 +373,4 @@
 bool Shell::executeCommand()
 {
-
   this->addBufferLineStatic("Execute Command: %s\n", this->inputLine);
   delete this->inputLine;
@@ -337,6 +393,4 @@
 }
 
-
-#include "key_names.h"
 /**
  * listens for some event
@@ -352,12 +406,10 @@
       if (EventHandler::getInstance()->getState() == ES_GAME)
       {
-        EventHandler::getInstance()->setState(ES_SHELL);
-        this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()-150, 1, 5);
+        this->activate();
       }
 
       else
       {
-        EventHandler::getInstance()->setState(ES_GAME);
-        this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()+10, 1, 5);
+        this->deactivate();
       }
     }
@@ -382,6 +434,8 @@
   {
     if (this->pressedKey == event.type)
+    {
       this->pressedKey = SDLK_FIRST;
-    this->delayed = 0.0;
+      this->delayed = 0.0;
+    }
   }
 }
@@ -426,11 +480,11 @@
 
 //  glTexCoord2f(this->texCoord.maxU, this->texCoord.minV);
-  glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y  );
+  glVertex2f(GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y  );
 
 //  glTexCoord2f(this->texCoord.maxU, this->texCoord.maxV);
-  glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y + 150);
+  glVertex2f(GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);
 
 //  glTexCoord2f(this->texCoord.minU, this->texCoord.maxV);
-  glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + 150);
+  glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);
 
   glEnd();
@@ -451,5 +505,5 @@
   strcpy(completionLine, this->inputLine);
 
-   char* commandBegin = strrchr(completionLine, ' ');
+  char* commandBegin = strrchr(completionLine, ' ');
   if (commandBegin == NULL)
     commandBegin = completionLine;
@@ -462,27 +516,189 @@
   }
 
-  printf("%s\n",commandBegin);
-   Array<char*>* classArray = LoadClassDescription::searchClassWithShort(commandBegin);
-   if (classArray->getCount() == 0)
-   {
-     delete[] completionLine;
-     delete classArray;
-     //PRINTF(0)("no completion found for %s\n", commandBegin);
-     return false;
-   }
-
-   for (unsigned int i = 0; i < classArray->getCount(); i++)
-   {
-     PRINTF(0)("%s\n", classArray->getEntry(i));
-   }
-   if (classArray->getCount() == 1)
-   {
-     this->removeCharacters(strlen(commandBegin));
-     this->addCharacters(classArray->getEntry(0));
-     this->addCharacter(' ');
-   }
-
-   delete[] completionLine;
-   delete classArray;
+  char* objectStart;
+  if (objectStart = strstr(commandBegin, "::"))
+  {
+    char* classIdentity = new char[objectStart - commandBegin +1];
+    strncpy(classIdentity, commandBegin, objectStart - commandBegin);
+    classIdentity[objectStart - commandBegin] = '\0';
+    this->objectComplete(objectStart+2, ClassList::StringToID(classIdentity));
+    delete[] classIdentity;
+  }
+  else
+    this->classComplete(commandBegin);
+
+  delete[] completionLine;
+}
+
+/**
+ * autocompletes a className
+ * @param classBegin the Beginning of a String to autoComplete
+ * @return true on success, false otherwise
+ */
+bool Shell::classComplete(const char* classBegin)
+{
+  if (unlikely(classBegin == NULL))
+    return false;
+  const tList<const char>* clList = ClassList::getClassList();
+  if (clList != NULL)
+  {
+    const tList<const char>* classList = this->createCompleteList(clList, classBegin);
+    if (classList != NULL)
+      this->generalComplete(classList, classBegin, "%s::", "::");
+    else
+      return false;
+  }
+  else
+    return false;
+  return true;
+}
+
+/**
+ * autocompletes an ObjectName
+ * @param objectBegin the beginning string of a Object
+ * @param classID the ID of the Class to search for.
+ * @return true on success, false otherwise
+ */
+bool Shell::objectComplete(const char* objectBegin, long classID)
+{
+  printf("%s\n", objectBegin);
+
+  if (unlikely(objectBegin == NULL))
+    return false;
+  tList<BaseObject>* boList = ClassList::getList(classID);
+  if (boList != NULL)
+  {
+    printf("\n", boList->firstElement()->getName());
+    const tList<const char>* objectList = this->createCompleteList(boList, objectBegin);
+    if (objectList != NULL)
+      this->generalComplete(objectList, objectBegin, "%s");
+    else
+      return false;
+  }
+  else
+    return false;
+  return true;
+}
+
+bool Shell::functionComplete(const char* functionBegin)
+{
+}
+
+/**
+ * completes the inputline on grounds of an inputList
+ * @param stringList the List to parse through
+ * @param begin the String to search in the inputList, and to extend with it.
+ * @param displayAs how to display the found value to the user, printf-style, !!with only one %s!! ex.: "::%s::"
+ * @param addBack what should be added at the end of the completion
+ * @param addFront what should be added to the front of one finished completion
+ * @return true if ok, false otherwise
+ */
+bool Shell::generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs, const char* addBack, const char* addFront)
+{
+  if (stringList->getSize() == 0)
+    return false;
+
+  const char* addString = stringList->firstElement();
+  unsigned int addLength = 0;
+  unsigned int inputLenght = strlen(begin);
+
+  if (addString != NULL)
+    addLength = strlen(addString);
+  tIterator<const char>* charIterator = stringList->getIterator();
+  const char* charElem = charIterator->nextElement();
+  while (charElem != NULL)
+  {
+    PRINTF(0)(displayAs, charElem);
+    for (unsigned int i = inputLenght; i < addLength; i++)
+      if (addString[i] != charElem[i])
+    {
+      addLength = i;
+      break;
+    }
+    charElem = charIterator->nextElement();
+  }
+  delete charIterator;
+
+  if (addLength >= inputLenght)
+  {
+    char* adder = new char[addLength+1];
+    strncpy(adder, addString, addLength);
+    adder[addLength] = '\0';
+    this->removeCharacters(inputLenght);
+    this->addCharacters(adder);
+    if (addBack != NULL && stringList->getSize() == 1)
+      this->addCharacters("::");
+    delete[] adder;
+  }
+  return true;
+}
+
+
+
+/**
+ * searches for classes, which beginn with classNameBegin
+ * @param inputList the List to parse through
+ * @param classNameBegin the beginning string
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * !! The strings MUST NOT be deleted !!
+ */
+const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin)
+{
+  if (inputList == NULL || classNameBegin == NULL)
+    return NULL;
+  unsigned int searchLength = strlen(classNameBegin);
+  if (this->completionList != NULL)
+    delete this->completionList;
+  this->completionList = new tList<const char>;
+
+//  tList<const char>* classList = ClassList::getClassList();
+
+  tIterator<const char>* iterator = inputList->getIterator();
+  const char* enumString = iterator->nextElement();
+  while (enumString != NULL)
+  {
+    if (strlen(enumString)>searchLength+1 &&
+        !strncasecmp(enumString, classNameBegin, searchLength))
+    {
+      this->completionList->add(enumString);
+    }
+    enumString = iterator->nextElement();
+  }
+  delete iterator;
+
+  return this->completionList;
+}
+
+/**
+ * searches for classes, which beginn with classNameBegin
+ * @param inputList the List to parse through
+ * @param classNameBegin the beginning string
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * !! The strings MUST NOT be deleted !!
+ */
+const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin)
+{
+  if (inputList == NULL || classNameBegin == NULL)
+    return NULL;
+  unsigned int searchLength = strlen(classNameBegin);
+  if (this->completionList != NULL)
+    delete this->completionList;
+  this->completionList = new tList<const char>;
+
+  tIterator<BaseObject>* iterator = inputList->getIterator();
+  BaseObject* enumBO = iterator->nextElement();
+  while (enumBO != NULL)
+  {
+    if (enumBO->getName() != NULL &&
+        strlen(enumBO->getName())>searchLength+1 &&
+        !strncasecmp(enumBO->getName(), classNameBegin, searchLength))
+    {
+      this->completionList->add(enumBO->getName());
+    }
+    enumBO = iterator->nextElement();
+  }
+  delete iterator;
+
+  return this->completionList;
 }
 
@@ -494,4 +710,3 @@
   if (this->pressedKey != SDLK_FIRST)
     printf("%s::%f %f\n", SDLKToKeyname(this->pressedKey), this->delayed, this->repeatDelay);
-
-}
+}
Index: trunk/src/util/shell.h
===================================================================
--- trunk/src/util/shell.h	(revision 5111)
+++ trunk/src/util/shell.h	(revision 5113)
@@ -36,9 +36,13 @@
 
 
-    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
+    void activate();
+    void deactivate();
 
-    void setBufferDisplaySize(unsigned int bufferDisplaySize);
+    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
+    void rebuildText();
 
     // BUFFER //
+    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
+    void setBufferDisplaySize(unsigned int bufferDisplaySize);
     void flushBuffers();
     static bool addBufferLineStatic(const char* line, ...);
@@ -67,4 +71,12 @@
   private:
     bool autoComplete();
+    bool classComplete(const char* classBegin);
+    bool objectComplete(const char* objectBegin, long classID);
+    bool functionComplete(const char* functionBegin);
+
+    bool generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
+
+    const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin);
+    const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin);
 
 
@@ -88,6 +100,11 @@
     unsigned int           textSize;               //!< The size of the text.
     unsigned int           lineSpacing;            //!< The Spacing between lines.
+    unsigned int           shellHeight;            //!< The hight of the Shell in Pixels
+    bool                   bActive;                //!< if the shell is active;
 
     char                   bufferArray[10000];     //!< a BUFFER for fast writing
+
+    // completion
+    tList<const char>*    completionList;          //!< A list of completions, that are io.
 };
 
