Index: trunk/src/defs/class_id.h
===================================================================
--- trunk/src/defs/class_id.h	(revision 7871)
+++ trunk/src/defs/class_id.h	(revision 7919)
@@ -325,10 +325,15 @@
   CL_GLGUI_CHECKBUTTON          =    0x00000b04,
   CL_GLGUI_RADIOBUTTON          =    0x00000b05,
+  CL_GLGUI_SLIDER               =    0x00000b06,
+  CL_GLGUI_PROGRESSBAR          =    0x00000b07,
   CL_GLGUI_CONTAINER            =    0x00b04000,
-  CL_GLGUI_BOX                  =    0x00000b07,
-  CL_GLGUI_FRAME                =    0x00000b08,
-  CL_GLGUI_WINDOW               =    0x00000b09,
+  CL_GLGUI_BOX                  =    0x00000b17,
+  CL_GLGUI_FRAME                =    0x00000b18,
+  CL_GLGUI_WINDOW               =    0x00000b19,
   CL_GLMENU_IMAGE_SCREEN        =    0x00000b20,
   CL_GLGUI_BAR                  =    0x00000b30,
+  CL_GLGUI_CURSOR               =    0x00000b50,
+  CL_GLGUI_INPUTLINE            =    0x00000b60,
+  CL_GLGUI_TEXTFIELD            =    0x00000b61,
 
   // QT_GUI
Index: trunk/src/lib/Makefile.am
===================================================================
--- trunk/src/lib/Makefile.am	(revision 7871)
+++ trunk/src/lib/Makefile.am	(revision 7919)
@@ -28,4 +28,5 @@
 		util/file.cc \
 		util/directory.cc \
+		util/timer.cc \
 		\
 		data/data_tank.cc
@@ -49,4 +50,5 @@
 		util/file.h \
 		util/directory.h \
+		util/timer.h \
 		\
 		util/loading/resource_manager.h \
Index: trunk/src/lib/event/event_def.h
===================================================================
--- trunk/src/lib/event/event_def.h	(revision 7871)
+++ trunk/src/lib/event/event_def.h	(revision 7919)
@@ -28,6 +28,8 @@
   EV_JOY_BUTTON,
 
+  EV_WINDOW_FOCUS,
   EV_VIDEO_RESIZE,
 
+  EV_LEAVE_STATE,
   EV_MAIN_QUIT,
 
Index: trunk/src/lib/event/event_handler.cc
===================================================================
--- trunk/src/lib/event/event_handler.cc	(revision 7871)
+++ trunk/src/lib/event/event_handler.cc	(revision 7919)
@@ -29,6 +29,6 @@
 
 /**
- *  standard constructor
-*/
+ * @brief standard constructor
+ */
 EventHandler::EventHandler ()
 {
@@ -42,5 +42,6 @@
 
   /* now initialize them all to zero */
-  this->withUNICODE(false);
+  for (unsigned int i = 0; i < ES_NUMBER; i++)
+    this->bUNICODE[i] = false;
   this->grabEvents(false);
 
@@ -51,5 +52,5 @@
 
 /**
- *  the singleton reference to this class
+ * @brief the singleton reference to this class
 */
 EventHandler* EventHandler::singletonRef = NULL;
@@ -57,7 +58,6 @@
 
 /**
- *  standard deconstructor
-
-*/
+ * @brief standard deconstructor
+ */
 EventHandler::~EventHandler ()
 {
@@ -79,5 +79,5 @@
 
 /**
- *  initializes the event handler
+ * @brief initializes the event handler
  *
  * this has to be called before the use of the event handler
@@ -89,5 +89,44 @@
 
 /**
- * pushes the current State in the State-stack, and selects state
+ * @param state: to which the event handler shall change
+ */
+void EventHandler::setState(elState state)
+{
+  if (state == this->state)
+    return;
+
+  /// When Changing the State, all the keys will be released.
+  /// This is done by sending each eventListener, that still
+  /// has an Event subscribed, a Release Event.
+  int keyCount;
+  Uint8 * pressedKeys = SDL_GetKeyState(&keyCount);
+  for (unsigned int i = 0; i < SDLK_LAST; i++)
+  {
+    if (pressedKeys[i])
+    {
+      Event ev;
+      ev.bPressed = false;
+      ev.type = i;
+      if (unlikely(this->bUNICODE[this->state]))
+        ev.x = i;
+      this->dispachEvent(this->state, ev );
+    }
+  }
+
+  // switching to the new State.
+  elState oldState = this->state;
+  this->state = state;
+
+  // in the End the Corresponding handler will be notified.
+  Event stateSwitchEvent;
+  stateSwitchEvent.type = EV_LEAVE_STATE;
+  this->dispachEvent(oldState, stateSwitchEvent);
+
+  SDL_EnableUNICODE(this->bUNICODE[state]);
+};
+
+
+/**
+ * @brief pushes the current State in the State-stack, and selects state
  * @param state the new State to set
  */
@@ -106,5 +145,5 @@
 
 /**
- * this removes the topmost stack-entry and select the underlying one
+ * @brief this removes the topmost stack-entry and select the underlying one
  * @returns the next stack-entry
  */
@@ -144,19 +183,19 @@
   {
     for(unsigned int i = 0; i < ES_NUMBER; i++)
-    {
-      if( !likely(this->listeners[i][eventType].empty()))
+      if (!this->findListener( NULL, (elState)i, eventType, el))
+        this->listeners[i][eventType].push_back(el);
+      else
       {
-        PRINTF(2)("'%s' of class '%s' tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state);
+        PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassName(), el->getName(), i, eventType);
       }
-      this->listeners[i][eventType].push_back(el);
-    }
-  }
-  else
-  {
-    if( likely(!this->listeners[state][eventType].empty()))
-    {
-      PRINTF(2)("%s of class %s tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state);
-    }
-    this->listeners[state][eventType].push_back(el);
+  }
+  else
+  {
+    if (!this->findListener( NULL, state, eventType, el))
+      this->listeners[state][eventType].push_back(el);
+    else
+    {
+      PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassName(), el->getName(), state, eventType);
+    }
   }
 }
@@ -167,8 +206,8 @@
  * @param state: the stat in which it has been subscribed
  * @param eventType: the event, that shall be unsubscribed
-
-   if you want to unsubscribe an event listener from all subscribed events, just use the
-   unsubscribe(EventListener* el, elState state) function
-*/
+ *
+ * if you want to unsubscribe an event listener from all subscribed events, just use the
+ * unsubscribe(EventListener* el, elState state) function
+ */
 void EventHandler::unsubscribe(EventListener* el, elState state, int eventType)
 {
@@ -177,18 +216,12 @@
     for (unsigned int i = 0; i < ES_NUMBER; i++)
     {
-      std::vector<EventListener*>::iterator listener =
-         std::find(this->listeners[i][eventType].begin(),
-                   this->listeners[i][eventType].end(),
-                   el);
-      if (listener != this->listeners[i][eventType].end())
+      std::vector<EventListener*>::iterator listener;
+      if (this->findListener(&listener, (elState)i, eventType, el))
         this->listeners[i][eventType].erase(listener);
     }
   else
   {
-    std::vector<EventListener*>::iterator listener =
-        std::find(this->listeners[state][eventType].begin(),
-                  this->listeners[state][eventType].end(),
-                  el);
-    if (listener != this->listeners[state][eventType].end())
+    std::vector<EventListener*>::iterator listener;
+    if (this->findListener(&listener, state, eventType, el))
       this->listeners[state][eventType].erase(listener);
   }
@@ -203,6 +236,5 @@
 void EventHandler::unsubscribe(EventListener* el, elState state)
 {
-  if( el == NULL || state >= ES_NUMBER)
-    return;
+  assert( el != NULL && state < ES_NUMBER);
   if( state == ES_ALL)
   {
@@ -228,4 +260,10 @@
 }
 
+/**
+ * @brief returns true if at state and eventType there is something subscribed.
+ * @param state the state to check in.
+ * @param eventType the eventtype to check.
+ * @returns true if a event is subscibed.
+ */
 bool EventHandler::isSubscribed(elState state, int eventType)
 {
@@ -236,5 +274,5 @@
 
 /**
- * flush all registered events
+ * @brief flush all registered events
  * @param state: a specific state
 */
@@ -261,10 +299,32 @@
 
 
-void EventHandler::withUNICODE(bool enableUNICODE)
-{
-  SDL_EnableUNICODE(enableUNICODE);
-  this->bUNICODE = enableUNICODE;
-}
-
+bool EventHandler::findListener(std::vector<EventListener*>::iterator* it, elState state, int eventType, EventListener* listener)
+{
+  std::vector<EventListener*>::iterator findIterator =
+    std::find(this->listeners[state][eventType].begin(), this->listeners[state][eventType].end(), listener);
+  if (it != NULL)
+    *it = findIterator;
+  return ( findIterator != this->listeners[state][eventType].end());
+
+}
+
+
+
+/**
+ * @brief if the unicode characters should be recorded.
+ * @param state the State in whitch to set the new Value.
+ * @param enableUNICODE: enabled, or disabled.
+ */
+void EventHandler::withUNICODE(elState state, bool enableUNICODE)
+{
+  this->bUNICODE[state] = enableUNICODE;
+  if (this->state == state)
+    SDL_EnableUNICODE(enableUNICODE);
+}
+
+/**
+ * @brief grabs InputEvents.
+ * @param grabEvents if the Events should be grabbed(true) or released(false)
+ */
 void EventHandler::grabEvents(bool grabEvents)
 {
@@ -282,10 +342,12 @@
 }
 
-/**
- *  core function of event handler: receives all events from SDL
-
-   The event from the SDL framework are collected here and distributed to all listeners.
-*/
-void EventHandler::process()
+
+
+/**
+ * @brief core function of event handler: receives all events from SDL
+ *
+ * The event from the SDL framework are collected here and distributed to all listeners.
+ */
+void EventHandler::process() const
 {
   SDL_Event event;
@@ -299,5 +361,5 @@
         ev.bPressed = true;
         ev.type = event.key.keysym.sym;
-        if (unlikely(this->bUNICODE))
+        if (unlikely(this->bUNICODE[this->state]))
           ev.x = event.key.keysym.unicode;
         break;
@@ -305,5 +367,5 @@
         ev.bPressed = false;
         ev.type = event.key.keysym.sym;
-        if (unlikely(this->bUNICODE))
+        if (unlikely(this->bUNICODE[this->state]))
           ev.x = event.key.keysym.unicode;
         break;
@@ -344,4 +406,8 @@
         ev.type = EV_JOY_BUTTON;
         break;
+      case SDL_ACTIVEEVENT:
+        ev.type = EV_WINDOW_FOCUS;
+        ev.bPressed = (event.active.gain != 0);
+        break;
       case SDL_VIDEORESIZE:
         ev.resize = event.resize;
@@ -355,25 +421,41 @@
         break;
     }
-
-    /* small debug routine: shows all events dispatched by the event handler */
-    PRINT(4)("\n==========================| EventHandler::process () |===\n");
-    PRINT(4)("=  Got Event nr %i, for state %i", ev.type, this->state);
-
-
-    for (unsigned int i = 0; i < this->listeners[this->state][ev.type].size(); i++)
-    {
-      PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
-      PRINT(4)("=======================================================\n");
-      listeners[this->state][ev.type][i]->process(ev);
-    }
-    /*    else
-        {
-          PRINT(4)("=  Event dispatcher msg: This event has NOT been consumed\n");
-          PRINT(4)("=======================================================\n");
-        }*/
-  }
-}
-
-
+    this->dispachEvent(this->state, ev);
+  }
+}
+
+
+/**
+ * @brief dispaches an Event.
+ * @param event the Event to dispach.
+ */
+void EventHandler::dispachEvent(elState state, const Event& event) const
+{
+  /* small debug routine: shows all events dispatched by the event handler */
+  PRINT(4)("\n==========================| EventHandler::process () |===\n");
+  PRINT(4)("=  Got Event nr %i, for state %i\n", event.type, state);
+
+  /// setting a temporary state in case of an EventListener's process changes the state.
+  for (unsigned int i = 0; i < this->listeners[state][event.type].size(); i++)
+  {
+    PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
+    PRINT(4)("=  Got Event nr %i, for state %i (%d registered) to %s::%s(%p)\n", event.type, i, state, this->listeners[state][event.type][i]->getClassName(), this->listeners[state][event.type][i]->getName(), this->listeners[state][event.type][i]);
+    PRINT(4)("=======================================================\n");
+    this->listeners[state][event.type][i]->process(event);
+  }
+  /*    else
+  {
+        PRINT(4)("=  Event dispatcher msg: This event has NOT been consumed\n");
+        PRINT(4)("=======================================================\n");
+  }*/
+}
+
+
+
+/**
+ * @brief An eventFilter.
+ * @param event the Event to be filtered.
+ * @returns 0 on filtered Event. 1 Otherwise.
+ */
 int EventHandler::eventFilter(const SDL_Event *event)
 {
@@ -400,5 +482,5 @@
 
 /**
- * outputs some nice information about the EventHandler
+ * @brief outputs some nice information about the EventHandler
  */
 void EventHandler::debug() const
@@ -408,7 +490,9 @@
   PRINT(0)("===============================\n");
   for(int i = 0; i < ES_NUMBER; ++i)
+  {
     for(int j = 0; j < EV_NUMBER; ++j)
       for (unsigned int evl = 0; evl < this->listeners[i][j].size(); evl++)
         PRINT(0)("Event %d of State %d subscribed to %s (%p)\n", j, i, this->listeners[i][j][evl]->getName(), this->listeners[i][j][evl]);
+  }
   PRINT(0)("============================EH=\n");
 }
Index: trunk/src/lib/event/event_handler.h
===================================================================
--- trunk/src/lib/event/event_handler.h	(revision 7871)
+++ trunk/src/lib/event/event_handler.h	(revision 7919)
@@ -11,4 +11,5 @@
 #include "key_mapper.h"
 #include "event_def.h"
+#include "event.h"
 #include <stack>
 #include <vector>
@@ -26,6 +27,5 @@
   void init();
 
-  /** @param state: to which the event handler shall change */
-  inline void setState(elState state) { this->state = state; };
+  void setState(elState state);
   /** @returns the current state */
   inline elState getState() const { return this->state; };
@@ -42,9 +42,10 @@
 
 
-  void withUNICODE(bool enableUNICODE);
+  void withUNICODE(elState state, bool enableUNICODE);
   void grabEvents(bool grabEvents);
   bool grabbedEvents() const { return this->eventsGrabbed; };
 
-  void process();
+  void process() const;
+  void dispachEvent(elState state, const Event& event) const;
 
   static int eventFilter(const SDL_Event *event);
@@ -53,4 +54,6 @@
  private:
   EventHandler();
+
+  bool findListener(std::vector<EventListener*>::iterator* it, elState state, int eventType, EventListener* listener);
 
  private:
@@ -62,5 +65,5 @@
   KeyMapper                    keyMapper;                       //!< reference to the key mapper.
 
-  bool                         bUNICODE;                        //!< If unicode should be enabled.
+  bool                         bUNICODE[ES_NUMBER];             //!< If unicode should be enabled.
   bool                         eventsGrabbed;                   //!< If the events should be grabbed
 };
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 7871)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 7919)
@@ -286,4 +286,7 @@
   SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);	//Use at least 16 bits for the depth buffer
   SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);  //Enable double buffering
+
+  glEnable(GL_CULL_FACE);
+  glCullFace(GL_FRONT);
 }
 
@@ -576,4 +579,6 @@
 void GraphicsEngine::drawBackgroundElements() const
 {
+  GraphicsEngine::storeMatrices();
+
   Render2D::getInstance()->draw(E2D_LAYER_BELOW_ALL, E2D_LAYER_BELOW_ALL);
 }
Index: trunk/src/lib/graphics/importer/material.cc
===================================================================
--- trunk/src/lib/graphics/importer/material.cc	(revision 7871)
+++ trunk/src/lib/graphics/importer/material.cc	(revision 7919)
@@ -108,6 +108,15 @@
       return true;
 
-
-  // setting diffuse color
+  if (likely(Material::selectedMaterial != NULL))
+  {
+    for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)
+    {
+        glActiveTexture(Material::glTextureArbs[i]);
+        //glBindTexture(GL_TEXTURE_2D, 0);
+        glDisable(GL_TEXTURE_2D);
+    }
+  }
+
+    // setting diffuse color
   glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency);
   // setting ambient color
@@ -118,5 +127,4 @@
   glMaterialf(GL_FRONT, GL_SHININESS, this->shininess);
 
-
   // setting the transparency
   if (this->transparency < 1.0 ||       /* This allows alpha blending of 2D textures with the scene */
@@ -138,13 +146,4 @@
     glShadeModel(GL_SMOOTH);
 
-  if (likely(Material::selectedMaterial != NULL))
-  {
-    for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)
-    {
-        glActiveTexture(Material::glTextureArbs[i]);
-        glBindTexture(GL_TEXTURE_2D, 0);
-        glDisable(GL_TEXTURE_2D);
-    }
-  }
 
   for(unsigned int i = 0; i < this->textures.size(); ++i)
@@ -159,15 +158,4 @@
   }
   Material::selectedMaterial = this;
-
-  /*  if (this->diffuseTexture != NULL)
-      {
-        glEnable(GL_TEXTURE_2D);
-        glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
-      }
-    else
-      {
-        glDisable(GL_TEXTURE_2D);
-        glBindTexture(GL_TEXTURE_2D, 0);
-      }*/
 }
 
Index: trunk/src/lib/graphics/importer/material.h
===================================================================
--- trunk/src/lib/graphics/importer/material.h	(revision 7871)
+++ trunk/src/lib/graphics/importer/material.h	(revision 7919)
@@ -16,6 +16,4 @@
 
 #include <vector>
-#include "SDL_image.h"
-
 #include "texture.h"
 
@@ -51,4 +49,5 @@
     void setTransparency (char* trans);
 
+    void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; }
 
     // MAPPING //
Index: trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.cc	(revision 7871)
+++ trunk/src/lib/graphics/render2D/element_2d.cc	(revision 7919)
@@ -62,6 +62,7 @@
   this->toCoordinate = NULL;
   this->toDirection = NULL;
+
+  this->size = Vector2D(0,0);
   this->toSize = NULL;
-  this->setSize2D(1, 1);
 
 
@@ -448,5 +449,4 @@
   this->relCoordinate += shift;
   this->bRelCoorChanged = true;
-
 }
 
@@ -847,9 +847,8 @@
     if (unlikely(this->toSize != NULL))
     {
-      Vector2D shiftSize = (*this->toSize - Vector2D(this->sizeX, this->sizeY)) *fabsf(dt)*bias;
+      Vector2D shiftSize = (*this->toSize - this->size) *fabsf(dt)*bias;
       if (likely((shiftSize).len() >= .001))//PNODE_ITERATION_DELTA))
       {
-        this->sizeX += shiftSize.x;
-        this->sizeY += shiftSize.y;
+        this->size += shiftSize;
       }
       else
@@ -1109,5 +1108,4 @@
   if (level == 0)
     glPopAttrib();
-
 }
 
Index: trunk/src/lib/graphics/render2D/element_2d.h
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.h	(revision 7871)
+++ trunk/src/lib/graphics/render2D/element_2d.h	(revision 7919)
@@ -125,10 +125,12 @@
     inline const PNode* getBindNode() const { return this->bindNode; };
 
-    inline void setSize2D(float x, float y) { this->sizeX = x, this->sizeY = y; };
+    inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); };
+    inline void setSize2D(const Vector2D& size) { this->size = size; };
+    inline const Vector2D& getSize2D() const { return this->size; };
     void setSizeSoft2D(float x, float y, float bias = 1.0);
-    inline void setSizeX2D(float x) { this->sizeX = x; };
-    inline void setSizeY2D(float y) { this->sizeY = y; };
-    inline float getSizeX2D() const { return this->sizeX; };
-    inline float getSizeY2D() const { return this->sizeY; };
+    inline void setSizeX2D(float x) { this->size.x = x; };
+    inline void setSizeY2D(float y) { this->size.y = y; };
+    inline float getSizeX2D() const { return this->size.x; };
+    inline float getSizeY2D() const { return this->size.y; };
 
   public:
@@ -238,6 +240,5 @@
   private:
     const PNode*            bindNode;           //!< a node over which to display this 2D-element
-    float                   sizeX;              //!< The size of the rendered item in x-direction
-    float                   sizeY;              //!< The size of the rendered Item in y-direction
+    Vector2D                size;               //!< The size of the rendered item
     Vector2D*               toSize;             //!< The Size to iterate to.
 
Index: trunk/src/lib/graphics/text_engine/multi_line_text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 7871)
+++ trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 7919)
@@ -64,4 +64,5 @@
     return;
   glPushMatrix();
+  glPushAttrib(GL_ENABLE_BIT);
   // transform for alignment.
   // TODO make the Stuff with the alignment
@@ -117,4 +118,5 @@
   }
   glEnd();
+  glPopAttrib();
   glPopMatrix();
 }
Index: trunk/src/lib/graphics/text_engine/text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text.cc	(revision 7871)
+++ trunk/src/lib/graphics/text_engine/text.cc	(revision 7919)
@@ -36,4 +36,5 @@
   this->font = NULL;
   this->size = textSize;
+  this->setSizeY2D(size);
   this->blending = TEXT_DEFAULT_BLENDING;
   this->color = TEXT_DEFAULT_COLOR;
@@ -127,4 +128,14 @@
 
 /**
+ * @brief appends one Character to the String.
+ */
+void Text::appendCharacter(char character)
+{
+  this->text += character;
+  this->setupTextWidth();
+}
+
+
+/**
  * @brief append some text to the already existing Text.
  * @param appendText The text to append to this Text.
@@ -135,4 +146,20 @@
   return this->text;
 }
+
+/**
+ * @brief removes char characters from the Text.
+ *
+ * @note this function checks, if the count can be removed, and if so does it.
+ * Otherwise the maximum count of characters will be removed.
+ */
+void Text::removeCharacters(unsigned int chars)
+{
+  if (text.size() > chars)
+    this->text.resize(this->text.size()-chars);
+  else if (!text.empty())
+    text.clear();
+  this->setupTextWidth();
+}
+
 
 /**
@@ -188,4 +215,5 @@
     return;
   glPushMatrix();
+  glPushAttrib(GL_ENABLE_BIT);
   // transform for alignment.
   if (this->getAlignment() == TEXT_ALIGN_RIGHT)
@@ -229,4 +257,5 @@
   }
   glEnd();
+  glPopAttrib();
   glPopMatrix();
 }
@@ -242,5 +271,5 @@
     if(this->font->getGlyphArray()[this->text[i]] != NULL)
       width += this->font->getGlyphArray()[this->text[i]]->advance;
-  this->setSizeX2D(width *this->getSize());
+  this->setSizeX2D(width * this->getSize());
 }
 
Index: trunk/src/lib/graphics/text_engine/text.h
===================================================================
--- trunk/src/lib/graphics/text_engine/text.h	(revision 7871)
+++ trunk/src/lib/graphics/text_engine/text.h	(revision 7919)
@@ -37,5 +37,7 @@
     void setText(const std::string& text);
     void append(const std::string& appendText);
+    void appendCharacter(char character);
     const std::string& operator<<(const std::string& appendText);
+    void removeCharacters(unsigned int chars);
 
     /// SETUP
Index: trunk/src/lib/gui/gl_gui/Makefile.am
===================================================================
--- trunk/src/lib/gui/gl_gui/Makefile.am	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/Makefile.am	(revision 7919)
@@ -9,21 +9,29 @@
 
 
-libORXglgui_a_SOURCES = glmenu/glmenu_imagescreen.cc \
-                        glgui_handler.cc \
-                        signal_connector.cc \
-                        glgui_mainwidget.cc \
-                        glgui_widget.cc \
-                        glgui_button.cc \
-                        glgui_pushbutton.cc \
-                        glgui_container.cc \
-                        glgui_bar.cc \
-                        glgui_box.cc \
-                        glgui_frame.cc \
-                        glgui_window.cc
+libORXglgui_a_SOURCES = \
+		glmenu/glmenu_imagescreen.cc \
+		glgui_handler.cc \
+		signal_connector.cc \
+		glgui_mainwidget.cc \
+		glgui_widget.cc \
+		glgui_button.cc \
+		glgui_pushbutton.cc \
+		glgui_checkbutton.cc \
+		glgui_slider.cc \
+		glgui_container.cc \
+		glgui_bar.cc \
+		glgui_box.cc \
+		glgui_frame.cc \
+		glgui_inputline.cc \
+		glgui_textfield.cc \
+		glgui_window.cc \
+		glgui_cursor.cc
 
 
-noinst_HEADERS= glmenu/glmenu_imagescreen.h \
+noinst_HEADERS= \
+		glmenu/glmenu_imagescreen.h \
 		signal_connector.h \
 		glgui.h \
+		glgui_defs.h \
 		glgui_handler.h \
 		glgui_mainwidget.h \
@@ -31,9 +39,14 @@
 		glgui_button.h \
 		glgui_pushbutton.h \
+		glgui_checkbutton.h \
+		glgui_slider.h \
 		glgui_container.h \
 		glgui_bar.h \
 		glgui_box.h \
 		glgui_frame.h \
-		glgui_window.h
+		glgui_inputline.h \
+		glgui_textfield.h \
+		glgui_window.h \
+		glgui_cursor.h
 
 
Index: trunk/src/lib/gui/gl_gui/glgui.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui.h	(revision 7919)
@@ -6,4 +6,7 @@
 #ifndef _GLGUI_H
 #define _GLGUI_H
+
+#include "glgui_handler.h"
+
 #include "glgui_widget.h"
 
@@ -12,15 +15,10 @@
 #include "glgui_button.h"
 #include "glgui_checkbutton.h"
-#include "glgui_colorselector.h"
-
-namespace OrxGui
-{
+//#include "glgui_colorselector.h"
+#include "glgui_pushbutton.h"
+#include "glgui_cursor.h"
+#include "glgui_inputline.h"
+#include "glgui_textfield.h"
 
 
-};
-
-
-
-
-
-#endif _GLGUI_H
+#endif /* _GLGUI_H */
Index: trunk/src/lib/gui/gl_gui/glgui_bar.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_bar.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_bar.cc	(revision 7919)
@@ -46,5 +46,5 @@
     this->setClassID(CL_GLGUI_BAR, "GLGuiBar");
 
-    this->frontMat.setDiffuse(1,1,1);
+    this->frontMaterial().setDiffuse(1,1,1);
 
     this->setSize2D(50, 10);
@@ -64,5 +64,5 @@
     GLGuiWidget::draw();
 
-    this->frontMat.select();
+    this->frontMaterial().select();
     glBegin(GL_QUADS);
 
Index: trunk/src/lib/gui/gl_gui/glgui_button.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_button.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_button.cc	(revision 7919)
@@ -26,8 +26,9 @@
    * standard constructor
   */
-  GLGuiButton::GLGuiButton ()
+  GLGuiButton::GLGuiButton (const std::string& label)
   {
     this->init();
 
+    this->label.setText( label );
   }
 
@@ -45,24 +46,27 @@
 
   /**
-   * initializes the GUI-element
+   * @brief initializes the GUI-element
    */
   void GLGuiButton::init()
   {
     this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton");
+    this->setFocusable(true);
+    this->setClickable(true);
 
-    this->label = new Text();
-    this->label->setParent2D(this);
+    this->label.setFont("fonts/final_frontier.ttf", 20);
+    this->frontMaterial().setDiffuse(1, 0, 0);
+
+    this->label.setParent2D(this);
   }
+
 
   void GLGuiButton::setLabel(const std::string& label)
   {
-    this->label->setText(label);
-    this->label->setRelCoor2D(5, 5);
-    this->setSize2D(this->label->getSizeX2D()+10, this->label->getSizeY2D()+10);
+    this->label.setText(label);
+    this->resize();
   }
 
-
   /**
-   * draws the GLGuiButton
+   * @brief draws the GLGuiButton
    */
   void GLGuiButton::draw() const
Index: trunk/src/lib/gui/gl_gui/glgui_button.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_button.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_button.h	(revision 7919)
@@ -10,5 +10,5 @@
 #include "glgui_widget.h"
 
-class Text;
+#include "text.h"
 
 namespace OrxGui
@@ -27,5 +27,5 @@
   //! This is part of the openglGUI class
   /**
-   *
+   * The Button is an Abstract class, that can be pushed to Toggle its state.
    */
   class GLGuiButton : public GLGuiWidget
@@ -33,14 +33,21 @@
 
   public:
-    GLGuiButton();
+    GLGuiButton(const std::string& label);
     virtual ~GLGuiButton();
 
-    void init();
+    const std::string& getLabel() const { return this->label.getText(); };
     void setLabel(const std::string& label);
+
+    virtual void resize() = 0;
 
     virtual void draw() const;
 
+    private:
+      void init();
+
+
   protected:
-    Text*                label;
+
+    Text                 label;
 
   private:
Index: trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc	(revision 7919)
@@ -27,8 +27,11 @@
    * standard constructor
   */
-  GLGuiCheckButton::GLGuiCheckButton ()
+  GLGuiCheckButton::GLGuiCheckButton (const std::string& label, bool active)
+  : GLGuiButton(label)
   {
     this->init();
+    this->bActive = active;
 
+    this->resize();
   }
 
@@ -44,15 +47,86 @@
    * initializes the GUI-element
    */
-  GLGuiCheckButton::init()
+  void GLGuiCheckButton::init()
   {
     this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton");
+  }
 
+
+  void GLGuiCheckButton::toggleActiveState()
+  {
+    this->bActive = !this->bActive;
+  }
+
+  void GLGuiCheckButton::resize()
+  {
+    this->label.setRelCoor2D(25, 5);
+    this->setSize2D(this->label.getSizeX2D() + 30, this->label.getSizeY2D() + 10);
+  }
+
+
+  void GLGuiCheckButton::released()
+  {
+    printf("%s released\n", this->getLabel().c_str());
+    GLGuiWidget::released();
+    this->toggleActiveState();
   }
 
   /**
-   * draws the GLGuiCheckButton
+   * @brief draws the GLGuiPushButton
    */
   void GLGuiCheckButton::draw() const
   {
+    this->startDraw();
+    GLGuiButton::draw();
+
+    this->frontMaterial().select();
+    glBegin(GL_QUADS);
+
+    glTexCoord2i(0,0); glVertex2d(1, 1);
+    glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1);
+    glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1);
+    glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1);
+
+    if (this->bActive)
+    {
+      glColor3f( 1, 1 ,1);
+      glTexCoord2i(0,0); glVertex2d(8, 8);
+      glTexCoord2i(0,1); glVertex2d(8, this->getSizeY2D()-8);
+      glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8, this->getSizeY2D()-8);
+      glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8, 8);
+      glEnd();
+
+
+      // DRAW a cross :)
+      glColor3f(0,0,0);
+      glLineWidth(3.0);
+      glBegin(GL_LINE_LOOP);
+      glVertex2d(8,8);
+      glVertex2d(this->getSizeY2D()/2, this->getSizeY2D()/2 - 1);
+
+      glVertex2d(this->getSizeY2D() -8, 8);
+      glVertex2d(this->getSizeY2D()/2 +1, this->getSizeY2D()/2);
+
+      glVertex2d(this->getSizeY2D() -8, this->getSizeY2D() - 8);
+      glVertex2d(this->getSizeY2D()/2, this->getSizeY2D()/2+1);
+
+      glVertex2d(8, this->getSizeY2D() - 8);
+      glVertex2d(this->getSizeY2D()/2 -1, this->getSizeY2D()/2);
+      glEnd();
+    }
+    else
+    {
+      glColor3f(0, 0, 0);
+      glTexCoord2i(0,0); glVertex2d(8, 8);
+      glTexCoord2i(0,1); glVertex2d(8, this->getSizeY2D()-8);
+      glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8, this->getSizeY2D()-8);
+      glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8, 8);
+      glEnd();
+    }
+
+
+    this->endDraw();
+    //   this->label->draw();
+    //  printf("test");
   }
 }
Index: trunk/src/lib/gui/gl_gui/glgui_checkbutton.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_checkbutton.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_checkbutton.h	(revision 7919)
@@ -6,5 +6,5 @@
 
 #ifndef _GLGUI_CHECKBUTTON_H
-#define _GLGUI__H
+#define _GLGUI_CHECKBUTTON_H
 
 #include "glgui_button.h"
@@ -23,14 +23,20 @@
 
   public:
-    GLGuiCheckButton();
+    GLGuiCheckButton(const std::string& label = "", bool active = false);
     virtual ~GLGuiCheckButton();
 
-    void init();
+    virtual void resize();
+    virtual void released();
 
     bool    isActive() { return this->bActive; };
     void    setActivity(bool bActive);
+    void    toggleActiveState();
 
     virtual void draw() const;
     virtual void update() {};
+
+  private:
+    void init();
+
 
   private:
Index: trunk/src/lib/gui/gl_gui/glgui_colorselector.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_colorselector.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_colorselector.h	(revision 7919)
@@ -5,8 +5,8 @@
  */
 
-#ifndef _GLGUI__H
-#define _GLGUI__H
+#ifndef _GLGUI_COLORSELECTOR_H
+#define _GLGUI_COLORSELECTOR_H
 
-#include "base_object.h"
+#include "glgui_widget.h"
 
 namespace OrxGui
Index: trunk/src/lib/gui/gl_gui/glgui_cursor.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_cursor.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_cursor.cc	(revision 7919)
@@ -16,5 +16,9 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
 
-#include "glgui_.h"
+#include "glgui_cursor.h"
+
+#include "glgui_handler.h"
+#include "color.h"
+
 
 namespace OrxGui
@@ -24,7 +28,11 @@
    * standard constructor
   */
-  GLGui::GLGui ()
+  GLGuiCursor::GLGuiCursor ()
   {
     this->init();
+
+    this->subscribeEvent(ES_MENU,  EV_MOUSE_MOTION);
+    this->subscribeEvent(ES_MENU, EV_WINDOW_FOCUS);
+
 
   }
@@ -32,24 +40,84 @@
 
   /**
-   * standard deconstructor
-  */
-  GLGui::~GLGui()
+   * @brief standard deconstructor
+   */
+  GLGuiCursor::~GLGuiCursor()
   {
+    GLGuiHandler::getInstance()->deactivateCursor(false);
+  }
+
+  float GLGuiCursor::_mouseSensitivity = 1.0;
+
+
+  /**
+   * @brief initializes the GUI-element
+   */
+  void GLGuiCursor::init()
+  {
+    this->setClassID(CL_GLGUI_CURSOR, "GLGuiCursor");
+
+    this->backMaterial().setDiffuse(1.0,0.0,0.0);
+    this->backMaterial().setDiffuseMap("cursor.png");
+    this->setSize2D(10, 20);
+    this->setAbsCoor2D(100, 100);
+    this->setLayer(E2D_LAYER_ABOVE_ALL);
+    this->color = 0.0f;
+
+  }
+
+  void GLGuiCursor::tick(float dt)
+  {
+    this->color += dt*10.0;
+    if (this->color > 360.0)
+      this->color -= 360.0;
+    Vector color =  Color::HSVtoRGB(Vector(this->color, 1.0, 1.0));
+    this->backMaterial().setDiffuse(color.x, color.y, color.z);
+
+    if (this->movement != Vector2D())
+    {
+      newPos += movement;
+      // reposition the cursor.
+      if (newPos.x < 0.0f )
+        newPos.x = 0.0f;
+      if (newPos.x > this->_maxBorders.x)
+        newPos.x = this->_maxBorders.x;
+      if (newPos.y < 0.0f )
+        newPos.y = 0.0f;
+      if (newPos.y > this->_maxBorders.y)
+        newPos.y = this->_maxBorders.y;
+
+
+      this->setAbsCoorSoft2D(newPos, 10);
+      movement = Vector2D();
+    }
   }
 
   /**
-   * initializes the GUI-element
+   * @brief draws the GLGuiCursor
    */
-  GLGui::init()
+  void GLGuiCursor::draw() const
   {
-    this->setClassID(CL_GLGUI_, "GLGui");
-
+    this->startDraw();
+    GLGuiWidget::draw();
+    this->endDraw();
   }
 
-  /**
-   * draws the GLGui
-   */
-  void GLGui::draw()
+  void GLGuiCursor::process(const Event& event)
   {
+    switch (event.type)
+    {
+      case EV_WINDOW_FOCUS:
+        if (event.bPressed)
+        {
+          int mouseX, mouseY;
+          SDL_GetMouseState(&mouseX, &mouseY);
+          newPos = Vector2D(mouseX, mouseY);
+        }
+        break;
+      case EV_MOUSE_MOTION:
+        movement += Vector2D((float)event.xRel * _mouseSensitivity, (float)event.yRel * _mouseSensitivity);
+        break;
+
+    }
   }
 }
Index: trunk/src/lib/gui/gl_gui/glgui_cursor.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_cursor.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_cursor.h	(revision 7919)
@@ -1,12 +1,14 @@
 /*!
- * @file glgui_.h
- * The gl_ widget of th openglGUI
+ * @file glgui_cursor.h
+ * The gl_cursor widget of th openglGUI
  *
  */
 
-#ifndef _GLGUI__H
-#define _GLGUI__H
+#ifndef _GLGUI_CURSOR_H
+#define _GLGUI_CURSOR_H
 
-#include "base_object.h"
+#include "glgui_widget.h"
+#include "event_listener.h"
+#include "vector2D.h"
 
 namespace OrxGui
@@ -18,18 +20,35 @@
    *
    */
-  class GLGui : public GLGui
+  class GLGuiCursor : public GLGuiWidget, public EventListener
   {
 
   public:
-    GLGui();
-    virtual ~GLGui();
+    GLGuiCursor();
+    virtual ~GLGuiCursor();
+
+    static void setMouseSensitivity(float mouseSensitivity);
+    static float mouseSensitivity() { return GLGuiCursor::_mouseSensitivity; };
+
+    void setMaxBorders(const Vector2D& maxBorders) { this->_maxBorders = maxBorders; };
 
     void init();
+    const Vector2D& position() const { return Element2D::getAbsCoor2D(); }
 
-    virtual void draw();
 
+    virtual void tick(float dt);
+    virtual void draw() const;
+    virtual void process(const Event& event);
   private:
+
+    Vector2D      _maxBorders;
+
+    Vector2D      newPos;
+    Vector2D      movement;
+
+    float         color; // so f****ing temporary... ... ....
+
+    static float _mouseSensitivity;
 
   };
 }
-#endif /* _GLGUI__H */
+#endif /* _GLGUI_CURSOR_H */
Index: trunk/src/lib/gui/gl_gui/glgui_defs.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_defs.h	(revision 7919)
+++ trunk/src/lib/gui/gl_gui/glgui_defs.h	(revision 7919)
@@ -0,0 +1,20 @@
+/*!
+ * @file glgui_defs.h
+ * Definitions for the GLGui.
+ */
+
+#ifndef _GLGUI_DEFS_H
+#define _GLGUI_DEFS_H
+
+/// TODO MOVE TO ORXGUI_TYPES
+namespace OrxGui
+{
+  //! An enumeration for the Orientation of an Element.
+  typedef enum {
+    Horizontal,    //!< Horizontal Orientation.
+    Vertical       //!< Vertical Orientation.
+  } Orientation;
+};
+
+
+#endif /* _GLGUI_DEFS_H */
Index: trunk/src/lib/gui/gl_gui/glgui_handler.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_handler.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_handler.cc	(revision 7919)
@@ -20,4 +20,11 @@
 
 #include "glgui_mainwidget.h"
+#include "glgui_cursor.h"
+
+#include "class_list.h"
+
+
+/// TAKE THIS OUT OF HERE.
+#include "graphics_engine.h"
 
 namespace OrxGui
@@ -32,6 +39,12 @@
     this->setName("GLGuiHandler");
 
-    //this->subscribeEvent()
 
+    EventHandler::getInstance()->withUNICODE(ES_MENU, true );
+
+    this->cursor = NULL;
+    for (unsigned int i = 0; i < EV_NUMBER; i++)
+    {
+      this->subscribeEvent(ES_MENU, i);
+    }
   }
 
@@ -49,7 +62,28 @@
   }
 
+  void GLGuiHandler::activateCursor()
+  {
+    if (this->cursor == NULL)
+      this->cursor = new GLGuiCursor();
+    this->cursor->show();
+    this->cursor->setMaxBorders(Vector2D(GraphicsEngine::getInstance()->getResolutionX(), GraphicsEngine::getInstance()->getResolutionY()));
+  }
+
+  void GLGuiHandler::deactivateCursor(bool deleteCursor)
+  {
+    if (this->cursor)
+    {
+      if (deleteCursor)
+        delete this->cursor;
+      this->cursor = NULL;
+    }
+  }
+
+
   void GLGuiHandler::activate()
   {
     EventHandler::getInstance()->pushState(ES_MENU);
+
+
 
   }
@@ -59,4 +93,5 @@
     EventHandler::getInstance()->popState();
 
+
   }
 
@@ -64,4 +99,39 @@
   void GLGuiHandler::process(const Event &event)
   {
+    switch (event.type)
+    {
+      case  EV_MOUSE_BUTTON_LEFT:
+        if (GLGuiWidget::focused() != NULL)
+        {
+          if (event.bPressed)
+          {
+            if (GLGuiWidget::focused()->clickable())
+              GLGuiWidget::focused()->click();
+          }
+          else
+          {
+            if (GLGuiWidget::focused()->clickable())
+              GLGuiWidget::focused()->release();
+          }
+        }
+        break;
+      case EV_LEAVE_STATE:
+        if (GLGuiWidget::focused() != NULL)
+          GLGuiWidget::focused()->breakFocus();
+        break;
+
+      case EV_VIDEO_RESIZE:
+        if (this->cursor != NULL)
+          this->cursor->setMaxBorders(Vector2D(event.resize.w, event.resize.h));
+        break;
+    }
+
+
+
+    if (GLGuiWidget::focused())
+    {
+      GLGuiWidget::focused()->processEvent(event);
+    }
+
 
 
@@ -70,5 +140,5 @@
   void GLGuiHandler::draw()
   {
-//    GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP);
+    //    GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP);
   }
 
@@ -76,4 +146,29 @@
   void GLGuiHandler::tick(float dt)
   {
+
+    // CHECK THE COLLISIONS.
+    const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET);
+
+    if (objects != NULL && this->cursor != NULL)
+    {
+      for (std::list<BaseObject*>::const_iterator it = objects->begin(); it != objects->end(); it++)
+      {
+        GLGuiWidget* widget = dynamic_cast<GLGuiWidget*>(*it);
+
+        if (widget->isVisible() &&
+            widget->focusable() &&
+            widget->focusOverWidget(this->cursor))
+        {
+          // receiving Focus
+          if (GLGuiWidget::focused() != widget)
+          {
+            widget->giveFocus();
+          }
+          return ;
+        }
+      }
+      if (GLGuiWidget::focused() != NULL)
+        GLGuiWidget::focused()->breakFocus();
+    }
   }
 }
Index: trunk/src/lib/gui/gl_gui/glgui_handler.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_handler.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_handler.h	(revision 7919)
@@ -8,7 +8,11 @@
 
 #include "event_listener.h"
+#include "glgui_widget.h"
 
 namespace OrxGui
 {
+
+  class GLGuiCursor;
+
   // FORWARD DECLARATION
 
@@ -21,4 +25,8 @@
     /** @returns a Pointer to the only object of this Class */
     inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler();  return GLGuiHandler::singletonRef; };
+
+    void activateCursor();
+    void deactivateCursor(/** ignore param */ bool deleteCursor = true);
+    GLGuiCursor* getCursor() const { return this->cursor; }
 
     void activate();
@@ -36,4 +44,6 @@
 
     bool                 isActive;
+    GLGuiCursor*         cursor;
+
   };
 }
Index: trunk/src/lib/gui/gl_gui/glgui_inputline.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_inputline.cc	(revision 7919)
+++ trunk/src/lib/gui/gl_gui/glgui_inputline.cc	(revision 7919)
@@ -0,0 +1,176 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
+
+#include "glgui_inputline.h"
+
+namespace OrxGui
+{
+  /**
+   * standard constructor
+  */
+  GLGuiInputLine::GLGuiInputLine ()
+  {
+    this->init();
+
+  }
+
+
+  /**
+   * standard deconstructor
+  */
+  GLGuiInputLine::~GLGuiInputLine()
+  {}
+
+  float GLGuiInputLine::repeatDelay = 0.3f;
+  float GLGuiInputLine::repeatRate  = 0.01f;
+
+
+  /**
+   * initializes the GUI-element
+   */
+  void GLGuiInputLine::init()
+  {
+    this->setClassID(CL_GLGUI_INPUTLINE, "GLGuiInputLine");
+
+    this->setFocusable(true);
+
+    this->text.setParent2D(this);
+    this->text.setRelCoor2D(4,4);
+    this->text.setFont("fonts/final_frontier.ttf", 20);
+  }
+
+  void GLGuiInputLine::setText(const std::string& text)
+  {
+    this->text.setText(text);
+    this->resize();
+  }
+
+  void GLGuiInputLine::append(const std::string& appendText)
+  {
+    this->text.append(appendText);
+    this->resize();
+  }
+
+  void GLGuiInputLine::appendCharacter(char character)
+  {
+    this->text.appendCharacter(character);
+    this->resize();
+  }
+
+
+  void GLGuiInputLine::removeCharacters(unsigned int chars)
+  {
+    this->text.removeCharacters(chars);
+    this->resize();
+  }
+
+
+  void GLGuiInputLine::removedFocus()
+  {
+    GLGuiWidget::removedFocus();
+    this->pressedKey = 0;
+    this->pressedKeyName = 0;
+  }
+
+
+  bool GLGuiInputLine::processEvent(const Event& event)
+  {
+    if (event.bPressed)
+    {
+      if (event.type == SDLK_BACKSPACE)
+      {
+        this->delayNext = GLGuiInputLine::repeatDelay;
+        this->pressedKey = SDLK_BACKSPACE;
+        this->pressedKeyName = SDLK_BACKSPACE;
+        this->removeCharacters(1);
+        return true;
+      }
+      // any other keyboard key
+      else if (likely(event.type < 127))
+      {
+        this->delayNext = GLGuiInputLine::repeatDelay;
+
+        this->appendCharacter(event.x);
+        this->pressedKey = event.type;
+        this->pressedKeyName = event.x;
+        return true;
+      }
+    }
+    else // if(!event.bPressed)
+    {
+      if (this->pressedKey == event.type)
+      {
+        this->pressedKeyName = 0;
+        this->pressedKey = 0;
+        this->delayNext = 0.0;
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+
+  void GLGuiInputLine::resize()
+  {
+    this->setSize2D( this->text.getSize2D() + Vector2D(8, 8));
+  }
+
+
+  void GLGuiInputLine::tick(float dt)
+  {
+    if (this->delayNext > 0.0)
+      this->delayNext -= dt;
+        else if (this->pressedKey != SDLK_FIRST )
+    {
+      this->delayNext = GLGuiInputLine::repeatRate;
+      switch (this->pressedKey)
+      {
+        case SDLK_BACKSPACE:
+          this->removeCharacters(1);
+          break;
+        default:
+        {
+          if (likely(this->pressedKey < 127))
+            this->appendCharacter(this->pressedKeyName);
+        }
+      }
+    }
+
+
+  }
+
+  /**
+   * draws the GLGuiInputLine
+   */
+  void GLGuiInputLine::draw() const
+  {
+    this->startDraw();
+    GLGuiWidget::draw();
+
+    this->frontMaterial().select();
+    glBegin(GL_QUADS);
+
+    glTexCoord2i(0,0); glVertex2d(3, 3);
+    glTexCoord2i(0,1); glVertex2d(3, this->getSizeY2D() - 3);
+    glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 3, this->getSizeY2D() -3);
+    glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 3, 3);
+
+    glEnd();
+    this->endDraw();
+  }
+}
Index: trunk/src/lib/gui/gl_gui/glgui_inputline.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_inputline.h	(revision 7919)
+++ trunk/src/lib/gui/gl_gui/glgui_inputline.h	(revision 7919)
@@ -0,0 +1,64 @@
+/*!
+ * @file glgui_inputline.h
+ * The gl_INPUTLINE widget of th openglGUI
+ *
+ */
+
+#ifndef _GLGUI_INPUTLINE_H
+#define _GLGUI_INPUTLINE_H
+
+#include "glgui_widget.h"
+#include "text.h"
+#include "event.h"
+
+// FORWARD DECLARATION
+namespace OrxGui
+{
+
+  //! This is part of the openglGUI class
+  /**
+   *
+   */
+  class GLGuiInputLine : public OrxGui::GLGuiWidget
+  {
+
+  public:
+    GLGuiInputLine();
+    virtual ~GLGuiInputLine();
+
+    void init();
+
+    void setText(const std::string& text);
+    void append(const std::string& appendText);
+    void appendCharacter(char character);
+    void removeCharacters(unsigned int chars);
+    const std::string& getName() const { return this->text.getText(); };
+
+
+    virtual void removedFocus();
+
+    virtual void tick(float dt);
+    virtual void draw() const;
+
+    virtual bool processEvent(const Event& event);
+
+    private:
+      void resize();
+
+
+  private:
+    Text                    text;             //!< The Text to display inside of the InputLine.
+
+    Uint16                  pressedKey;       //!< the pressed key that will be repeated.
+    Uint16                  pressedKeyName;   //!< The Name of the Key, that was pressed.
+
+    float                   delayNext;        //!< How much time must pass before next output.
+
+    static float            repeatDelay;
+    static float            repeatRate;
+
+
+  };
+}
+
+#endif /* _GLGUI_INPUTLINE_H */
Index: trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc	(revision 7919)
@@ -25,17 +25,26 @@
 
   /**
-   * standard constructor
-  */
-  GLGuiPushButton::GLGuiPushButton ()
+   * @brief standard constructor
+   */
+  GLGuiPushButton::GLGuiPushButton (const std::string& label)
+  : GLGuiButton(label)
   {
     this->init();
+
+    this->resize();
   }
 
 
   /**
-   * standard deconstructor
+   * @brief standard deconstructor
   */
   GLGuiPushButton::~GLGuiPushButton()
   {
+  }
+
+  void GLGuiPushButton::resize()
+  {
+    this->label.setRelCoor2D(5, 5);
+    this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10);
   }
 
@@ -46,27 +55,51 @@
   {
     this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
-    this->frontMat.setDiffuse(1,0,0);
-    //  this->label->setRelCoor2D(10, 10);
   }
 
+  void GLGuiPushButton::receivedFocus()
+  {
+    printf("%s received focus\n", this->getLabel().c_str());
+    GLGuiWidget::receivedFocus();
+  }
+
+  void GLGuiPushButton::removedFocus()
+  {
+    printf("%s removed focus\n", this->getLabel().c_str());
+    GLGuiWidget::removedFocus();
+
+  }
+
+  void GLGuiPushButton::clicked()
+  {
+    printf("%s clicked\n", this->getLabel().c_str());
+    GLGuiWidget::clicked();
+  }
+
+
+  void GLGuiPushButton::released()
+  {
+    printf("%s released\n", this->getLabel().c_str());
+    GLGuiWidget::released();
+  }
+
+
+
   /**
-   * draws the GLGuiPushButton
+   * @brief draws the GLGuiPushButton
    */
   void GLGuiPushButton::draw() const
   {
     this->startDraw();
+    GLGuiButton::draw();
 
-    //  GLGuiButton::draw();
-
-    this->frontMat.select();
+    this->frontMaterial().select();
     glBegin(GL_QUADS);
 
-    glVertex2d(0,0);
-    glVertex2d(0, this->getSizeY2D());
-    glVertex2d(this->getSizeX2D(), this->getSizeY2D());
-    glVertex2d(this->getSizeX2D(),0);
+    glTexCoord2i(0,0); glVertex2d(1, 1);
+    glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1);
+    glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1);
+    glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1);
 
     glEnd();
-
     this->endDraw();
     //   this->label->draw();
Index: trunk/src/lib/gui/gl_gui/glgui_pushbutton.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_pushbutton.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_pushbutton.h	(revision 7919)
@@ -23,12 +23,20 @@
 
   public:
-    GLGuiPushButton();
+    GLGuiPushButton(const std::string& label = "");
     virtual ~GLGuiPushButton();
 
-    void init();
+
+    virtual void resize();
+
+    virtual void receivedFocus();
+    virtual void removedFocus();
+    virtual void clicked();
+    virtual void released();
+
 
     virtual void draw() const;
     virtual void update();
   private:
+    void init();
 
   };
Index: trunk/src/lib/gui/gl_gui/glgui_slider.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_slider.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_slider.cc	(revision 7919)
@@ -50,5 +50,5 @@
    * draws the GLGuiSlider
    */
-  void GLGuiSlider::draw()
+  void GLGuiSlider::draw() const
   {
   }
Index: trunk/src/lib/gui/gl_gui/glgui_slider.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_slider.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_slider.h	(revision 7919)
@@ -8,6 +8,6 @@
 #define _GLGUI_SLIDER_H
 
-#include "base_object.h"
-
+#include "glgui_widget.h"
+#include "glgui_defs.h"
 
 namespace OrxGui
@@ -19,5 +19,5 @@
    *
    */
-  class GLGuiSlider : public GLGuiSlider
+  class GLGuiSlider : public GLGuiWidget
   {
 
@@ -28,7 +28,13 @@
     void init();
 
-    virtual void draw();
+    virtual void draw() const;
 
   private:
+    Orientation      orientation;
+
+    float            _maxValue;
+    float            _minValue;
+
+    float            _value;
 
   };
Index: trunk/src/lib/gui/gl_gui/glgui_textfield.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_textfield.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_textfield.cc	(revision 7919)
@@ -16,5 +16,5 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
 
-#include "glgui_textfield_.h"
+#include "glgui_textfield.h"
 namespace OrxGui
 {
@@ -42,5 +42,6 @@
   void GLGuiTextfield::init()
   {
-    this->setClassID(CL_GLGUI_, "GLGuiTextfield");
+    this->setClassID(CL_GLGUI_TEXTFIELD, "GLGuiTextfield");
+
 
   }
@@ -49,5 +50,5 @@
    * draws the GLGuiTextfield
    */
-  void GLGuiTextfield::draw()
+  void GLGuiTextfield::draw() const
   {
   }
Index: trunk/src/lib/gui/gl_gui/glgui_textfield.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_textfield.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_textfield.h	(revision 7919)
@@ -9,4 +9,7 @@
 
 #include "glgui_widget.h"
+
+#include "text.h"
+#include <vector>
 
 // FORWARD DECLARATION
@@ -28,8 +31,10 @@
     void init();
 
-    virtual void draw();
+    void process(const Event& event);
+
+    virtual void draw() const;
 
   private:
-    std::list<Text*>      textLines;
+    std::vector<Text>        textLines;
 
   };
Index: trunk/src/lib/gui/gl_gui/glgui_widget.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_widget.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_widget.cc	(revision 7919)
@@ -18,4 +18,6 @@
 #include "glgui_widget.h"
 
+#include "glgui_cursor.h"
+
 #include "material.h"
 
@@ -39,5 +41,11 @@
   GLGuiWidget::~GLGuiWidget()
   {
-  }
+    if (this == GLGuiWidget::_focused)
+      GLGuiWidget::_focused = NULL;
+  }
+
+  GLGuiWidget* GLGuiWidget::_focused = NULL;
+  GLGuiWidget* GLGuiWidget::_inputGrabber = NULL;
+
 
 
@@ -49,12 +57,12 @@
     this->setClassID(CL_GLGUI_WIDGET, "GLGuiWidget");
 
-    this->focusable = true;
-    this->clickable = true;
+    this->_focusable = false;
+    this->_clickable = false;
+    this->_pushed = false;
+
     this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE);
-    //  this->setParent2D((Element2D*)NULL);
 
     this->backMat.setDiffuse(1.0, 1.0, 1.0);
-
-    this->frontModel = 0;
+    this->frontMat.setDiffuse(1.0, 0.0, 0.0);
 
     this->widgetSignals.resize(SignalCount, SignalConnector());
@@ -62,12 +70,85 @@
 
 
-  bool GLGuiWidget::focusOverWidget(float x, float y)
-  {
-    if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x + this->getSizeX2D() > x &&
-        this->getAbsCoor2D().y < y && this->getAbsCoor2D().y + this->getSizeY2D() > y)
-      return true;
-    else
-      return false;
-  }
+  /** @brief gives focus to this widget */
+  void GLGuiWidget::giveFocus()
+  {
+    if (GLGuiWidget::focused() != NULL)
+      GLGuiWidget::focused()->breakFocus();
+    GLGuiWidget::_focused = this;
+    this->receivedFocus();
+  };
+
+  void GLGuiWidget::breakFocus()
+  {
+    if (GLGuiWidget::_focused == this)
+    {
+      GLGuiWidget::_focused = NULL;
+      this->_pushed = false;
+      this->removedFocus();
+    }
+  };
+
+
+  bool GLGuiWidget::focusOverWidget(const Vector2D& position) const
+  {
+    return (this->getAbsCoor2D().x < position.x && this->getAbsCoor2D().x + this->getSizeX2D() > position.x &&
+        this->getAbsCoor2D().y < position.y && this->getAbsCoor2D().y + this->getSizeY2D() > position.y);
+  }
+
+  bool GLGuiWidget::focusOverWidget(const GLGuiCursor* const cursor) const
+  {
+    return this->focusOverWidget(cursor->getAbsCoor2D());
+  }
+
+  void GLGuiWidget::click()
+  {
+    assert (!this->_pushed);
+    this->widgetSignals[Signal_click]("none");
+    this->_pushed = true;
+
+    this->clicked();
+  }
+
+  void GLGuiWidget::release()
+  {
+    if (this->_pushed)
+    {
+      this->widgetSignals[Signal_release]("none");
+
+      this->released();
+      this->_pushed = false;
+    }
+  }
+
+
+  void GLGuiWidget::clicked()
+  {
+    this->frontMaterial().setDiffuse(0, 0, 1);
+
+  }
+
+  void GLGuiWidget::released()
+  {
+    this->frontMat.setDiffuse(0,1,0);
+
+  }
+
+  void GLGuiWidget::receivedFocus()
+  {
+    this->frontMaterial().setDiffuse(0, 1, 0);
+  }
+
+  void GLGuiWidget::removedFocus()
+  {
+    this->frontMaterial().setDiffuse(1, 0, 0);
+
+  }
+
+  void GLGuiWidget::destroyed()
+  {
+  };
+
+
+
 
   /**
@@ -116,8 +197,8 @@
 
     glBegin(GL_QUADS);
-    glTexCoord2i(0,1); glVertex2d(0, 0);
-    glTexCoord2i(0,0); glVertex2d(0, this->getSizeY2D());
-    glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), this->getSizeY2D());
-    glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), 0);
+    glTexCoord2i(0,0); glVertex2d(0, 0);
+    glTexCoord2i(0,1); glVertex2d(0, this->getSizeY2D());
+    glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), this->getSizeY2D());
+    glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), 0);
     glEnd();
   }
Index: trunk/src/lib/gui/gl_gui/glgui_widget.h
===================================================================
--- trunk/src/lib/gui/gl_gui/glgui_widget.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glgui_widget.h	(revision 7919)
@@ -8,9 +8,14 @@
 
 #include "element_2d.h"
-#include "event.h"
+#include "rect2D.h"
+
 #include "material.h"
 
+#include "event.h"
+#include "signal_connector.h"
+
 #include "glincl.h"
-#include "signal_connector.h"
+
+#include <vector>
 
 // FORWARD DECLARATION
@@ -19,5 +24,4 @@
 namespace OrxGui
 {
-
   typedef enum
   {
@@ -34,4 +38,6 @@
 
 
+  class GLGuiCursor;
+
   //! if the Element should be visible by default.
 #define GLGUI_WIDGET_DEFAULT_VISIBLE       false
@@ -43,4 +49,5 @@
   class GLGuiWidget : public Element2D
   {
+
   private:
 
@@ -52,12 +59,37 @@
     void hide();
 
+    /// INTERCONNECTIVITY
     void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal);
     void disconnectSignal(SignalType signalType);
-    bool focusOverWidget(float x, float y);
 
+
+    /// FOCUS
+    /** @brief gives focus to this widget */
+    void giveFocus();
+    void breakFocus();
+    /** @returns true if the widget is focusable */
+    bool focusable() const { return this->_focusable; };
+    /** @param focusable sets if the Widget should be focusable */
+    void setFocusable(bool focusable = true) { this->_focusable = focusable; };
+    /** @returns true if the position is inside of the Widget. @param position the position to check */
+    bool focusOverWidget(const Vector2D& position) const;
+    /** @brief overloaded function, that returns true if the cursor is on top of the Widget */
+    bool focusOverWidget(const OrxGui::GLGuiCursor* const cursor) const;
+
+    /** @returns the currently focused Widget (NULL if none is selected) */
+    static GLGuiWidget* focused() { return GLGuiWidget::_focused; };
+
+
+    /// CLICK
+    void click();
+    void release();
+    bool clickable() const { return this->_clickable; };
+    void setClickable(bool clickable = true) { this->_clickable = clickable; };
 
     virtual void update() {};
     virtual void draw() const;
 
+
+    /// MATERIAL (looks)
     Material& backMaterial() { return this->backMat; };
     const Material& backMaterial() const { return this->backMat; };
@@ -66,13 +98,18 @@
     const Material& frontMaterial() const { return this->frontMat; };
 
+    /** @param the Event to process. @returns true if the Event has been consumed*/
+    virtual bool processEvent(const Event& event) { };
+
+
+    DeclareSignal(testSignal, ());
+
   protected:
         // if something was clickt on the GUI-widget.
-    virtual void clicked(const Event& event) {};
-    virtual void released(const Event& event) {};
+    virtual void clicked();
+    virtual void released();
+    virtual void receivedFocus();
+    virtual void removedFocus();
 
-    virtual void receivedFocus() {};
-    virtual void removedFocus() {};
-
-    virtual void destroyed() {};
+    virtual void destroyed();
 
 
@@ -84,18 +121,24 @@
 
 
+  private:
+    /// LOOKS
+    Material                       backMat;
+    Rect2D                         backRect;
+
+    Material                       frontMat;
+    Rect2D                         frontRect;
 
 
-  protected:
-    Material               backMat;
-    GLuint                 backModel;
+    /// SIGNALS
+    std::vector<SignalConnector>   widgetSignals;
 
-    Material               frontMat;
-    GLuint                 frontModel;
+    /// EVENTS
+    bool                           _focusable;        //!< If this widget can receive focus.
+    bool                           _clickable;        //!< if this widget can be clicked upon.
 
-  private:
-    std::vector<SignalConnector> widgetSignals;
+    bool                           _pushed;
 
-    bool                   focusable;        //!< If this widget can receive focus.
-    bool                   clickable;        //!< if this widget can be clicked upon.
+    static GLGuiWidget*            _focused;
+    static GLGuiWidget*            _inputGrabber;
   };
 }
Index: trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc	(revision 7919)
@@ -240,5 +240,4 @@
   glEnd();
 
-  glDisable(GL_TEXTURE_2D);
   /* draw white border */
   glBegin(GL_LINE_LOOP);
Index: trunk/src/lib/gui/gl_gui/signal_connector.h
===================================================================
--- trunk/src/lib/gui/gl_gui/signal_connector.h	(revision 7871)
+++ trunk/src/lib/gui/gl_gui/signal_connector.h	(revision 7919)
@@ -11,4 +11,17 @@
 namespace OrxGui
 {
+
+#define DeclareSignal(name, params) \
+  public: \
+   void signal_ ##connect ##name(const SignalConnector& connector) { \
+     name ## connected.push_back(connector); \
+   }\
+  private: \
+   void  signal_ ## name params { \
+     for (unsigned int i = 0; i < name ## connected . size(); i++) \
+       name ## connected[i] ("TEST"); \
+   }\
+   std::vector<SignalConnector> name ## connected
+
   //! A class for Conncting Signals to Objects, inside of the GUI
   class SignalConnector
Index: trunk/src/lib/math/Makefile.am
===================================================================
--- trunk/src/lib/math/Makefile.am	(revision 7871)
+++ trunk/src/lib/math/Makefile.am	(revision 7919)
@@ -13,4 +13,5 @@
 		plane.cc \
 		line.cc \
+		rect2D.cc \
 		rotation_OBSOLETE.cc
 
@@ -23,3 +24,4 @@
 		plane.h \
 		line.h \
+		rect2D.h \
 		rotation_OBSOLETE.h
Index: trunk/src/lib/math/rect2D.cc
===================================================================
--- trunk/src/lib/math/rect2D.cc	(revision 7919)
+++ trunk/src/lib/math/rect2D.cc	(revision 7919)
@@ -0,0 +1,444 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: Patrick Boenzli : Vector2D::scale()
+                                    Vector2D::abs()
+
+   Benjamin Grauer: port to Vector2D
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MATH
+
+#include "rect2D.h"
+#ifdef DEBUG
+  #include "debug.h"
+#else
+  #include <stdio.h>
+  #define PRINT(x) printf
+#endif
+
+/**
+ * @brief creates a new Rectangle with
+ * @param x the left border
+ * @param y the top border
+ * @param width: the width
+ * @param height the height
+ */
+Rect2D::Rect2D(float x, float y, float width, float height)
+{
+  this->setLeft(x), this->setTop(y);
+  this->setSize(width, height);
+}
+
+/**
+ * @brief creates a new Rectangle with
+ * @param topLeft the top-left corner
+ * @param bottomRight the lower-right corner
+ */
+Rect2D::Rect2D(const Vector2D& topLeft, const Vector2D& bottomRight )
+{
+  this->setTopLeft(topLeft);
+  this->setBottomRight(bottomRight);
+}
+
+/**
+ * @brief creates a new Rectangle with
+ * @param rect the rectangle to copy.
+ */
+Rect2D::Rect2D(const Rect2D& rect)
+{
+  *this = rect;
+}
+
+/**
+ * @brief copies the Values of rect to this rect
+ * @param rect copy the values from.
+ * @returns this reference.
+ */
+Rect2D& Rect2D::operator=(const Rect2D& rect)
+{
+  this->_topLeft = rect._topLeft;
+  this->_bottomRight = rect._bottomRight;
+  return *this;
+}
+
+/**
+ * @brief compares two rectanles.
+ * @param rect the rectangle to compare
+ * @returns true if the two rectangles are the same
+ */
+bool Rect2D::operator==(const Rect2D& rect) const
+{
+  return (this->_topLeft == rect._topLeft &&
+          this->_bottomRight == rect._bottomRight);
+}
+
+/**
+ * @brief negative compares two rectanles.
+ * @param rect the rectangle to compare
+ * @returns true if the two rectangles are different
+ */
+bool Rect2D::operator!=(const Rect2D& rect) const
+{
+  return (this->_topLeft != rect._topLeft ||
+          this->_bottomRight != rect._bottomRight);
+}
+
+/**
+ * @brief adds two rectangles together
+ * @param rect the rectagle to be added
+ * @returns a Rectangle, where both are added together.
+ *
+ * @note since adding rectangles does not make sense generally, here a description:
+ * adds toplefts and botomrights
+ */
+Rect2D Rect2D::operator+(const Rect2D& rect) const
+{
+  return Rect2D(this->_topLeft + rect._topLeft,
+                this->_bottomRight + rect._bottomRight);
+}
+
+
+/**
+ * @brief adds two rectangles together
+ * @param rect the rectagle to be added to this one
+ * @returns a Rectangle, where both are added together.
+ */
+Rect2D& Rect2D::operator+=(const Rect2D& rect)
+{
+  this->_topLeft += rect._topLeft;
+  this->_bottomRight += rect._bottomRight;
+  return *this;
+}
+
+
+/**
+ * @brief subracts two rectangles from each other
+ * @param rect the rectagle to be substracted from this one
+ * @returns a Rectangle, where both are substracted from one another.
+ */
+Rect2D Rect2D::operator-(const Rect2D& rect) const
+{
+  return Rect2D(this->_topLeft - rect._topLeft,
+                this->_bottomRight - rect._bottomRight);
+}
+
+/**
+ * @brief subracts two rectangles from each other
+ * @param rect the rectagle to be substracted from this one
+ * @returns a Rectangle, where both are substracted from one another.
+ */
+Rect2D& Rect2D::operator-=(const Rect2D& rect)
+{
+  this->_topLeft -= rect._topLeft;
+  this->_bottomRight -= rect._bottomRight;
+  return *this;
+}
+
+/**
+ * @brief intersects two Rectangles.
+ * @see intersection .
+ * @param rect the Rectangle to intersect with this one.
+ * @returns the intersection Region.
+ */
+Rect2D Rect2D::operator&(const Rect2D& rect) const
+{
+  return this->intersection(rect);
+}
+
+/**
+ * @brief intersects two Rectangles and assigns result to this one.
+ * @param rect the Rectangle to intersect with this one.
+ * @returns the intersection Region.
+ */
+Rect2D& Rect2D::operator&=(const Rect2D& rect)
+{
+  *this = this->intersection(rect);
+}
+
+/**
+ * TODO coment/implement
+ */
+Rect2D Rect2D::operator*(const Vector2D& scaling) const
+{
+#warning implements this...
+  //this->scale(scaling);
+}
+
+/**
+ * @brief sets the width of the Rectangle
+ * @param width the new width of the Rectangle
+ *
+ * the rectangle will be resized from the top left corner out.
+ */
+void Rect2D::setWidth(float width)
+{
+  this->_bottomRight.x = this->_topLeft.x + width;
+}
+
+
+/**
+ * @brief sets the height of the Rectangle
+ * @param height the new height of the Rectangle
+ *
+ * the rectangle will be resized from the top left corner out.
+ */
+void Rect2D::setHeight(float height)
+{
+  this->_bottomRight.y = this->_topLeft.y + height;
+}
+
+/**
+ * @brief sets the size of the Rectangle
+ * @param width the new width of the Rectangle.
+ * @param height the new height of the Rectangle.
+ * the rectangle will be resized from the top left corner out.
+ */
+void Rect2D::setSize(float width, float height)
+{
+  this->_bottomRight = this->_topLeft + Vector2D(width, height);
+}
+
+
+/**
+ * @brief sets the size of the Rectangle
+ * @param size the new size of the Rectangle.
+ * the rectangle will be resized from the top left corner out.
+ */
+void Rect2D::setSize(const Vector2D& size)
+{
+  this->_bottomRight = this->_topLeft + size;
+}
+
+/**
+ * @brief sets the new Center
+ * @param center the center to move the Rectangle to.
+ * moves the Rectangle from its current center to the new Center
+ */
+void Rect2D::setCenter(const Vector2D& center)
+{
+  this->move(center - this->center());
+}
+
+/**
+ * @brief scales the Rectangle from topLeft out.
+ * @param x: the scale factor in x direction
+ */
+void Rect2D::scaleX(float x)
+{
+  this->_bottomRight.x = this->_topLeft.x + this->width() * x;
+}
+
+/**
+ * @brief scales the Rectangle from topLeft out.
+ * @param y: the scale factor in y direction
+ */
+void Rect2D::scaleY(float y)
+{
+  this->_bottomRight.y = this->_topLeft.y + this->height() * y;
+}
+
+/**
+ * @brief scales the Rectangle from topLeft out.
+ * @param x: the scale factor in x direction
+ * @param y: the scale factor in y direction
+ */
+void Rect2D::scale(float x, float y)
+{
+  this->scale(Vector2D(x,y));
+}
+
+/**
+ * @brief scales the Rectangle from topLeft out.
+ * @param v: the scale factors.
+ */
+void Rect2D::scale(const Vector2D& v)
+{
+  this->_bottomRight = this->_topLeft + this->size().internalMultipy(v);
+
+}
+
+/**
+ * @brief scales the Rectangle from the Center out.
+ * @param x: the scale factor in x-direction.
+ * @param y: the scale factor in y-direction.
+ */
+void Rect2D::scaleCentered(float x, float y)
+{
+  this->scaleCentered(Vector2D(x, y));
+}
+
+
+/**
+ * @brief scales the Rectangle from the Center out.
+ * @param v: the scale factors.
+ */
+void Rect2D::scaleCentered(const Vector2D& v)
+{
+#warning implement this
+}
+
+/**
+ * @brief moves the Rectangle
+ * @param x the amount to move in x.
+ */
+void Rect2D::moveX(float x)
+{
+  this->_topLeft.x += x;
+  this->_bottomRight.x += x;
+}
+
+/**
+ * @brief moves the Rectangle
+ * @param y the amount to move in y.
+ */
+void Rect2D::moveY(float y)
+{
+  this->_topLeft.y += y;
+  this->_bottomRight.y += y;
+}
+
+/**
+ * @brief moves the Rectangle
+ * @param x the amount to move in x.
+ * @param y the amount to move in y.
+ */
+void Rect2D::move(float x, float y)
+{
+  this->move(Vector2D(x, y));
+}
+
+/**
+ * @brief moves the Rectangle
+ * @param v the amount to move.
+ */
+void Rect2D::move(const Vector2D& v)
+{
+  this->_topLeft += v;
+  this->_bottomRight += v;
+}
+
+/**
+ * @brief swaps top and bottom.
+ */
+void Rect2D::swapTopBottom()
+{
+  float tmp = this->top();
+  this->setTop(this->bottom());
+  this->setBottom(tmp);
+}
+
+/**
+ * @brief swaps left and right.
+ */
+void Rect2D::swapLeftRight()
+{
+  float tmp = this->left();
+  this->setLeft(this->right());
+  this->setRight(tmp);
+}
+
+/**
+ * @brief normalizes the Rectangle.
+ *
+ * Normalizing a Rectangle means, that the top is above bottom, and left is left of right afterwards :)
+ */
+void Rect2D::normalize()
+{
+  if (this->top() > this->bottom())
+    this->swapTopBottom();
+  if (this->left() > this->right())
+    this->swapLeftRight();
+}
+
+/**
+ * @brief normalizes the Rectangle.
+ * @returns the normalized version of this rectangle.
+ *
+ * Normalizing a Rectangle means, that the top is above bottom, and left is left of right afterwards :)
+ */
+Rect2D Rect2D::normalized() const
+{
+  Rect2D norm(*this);
+  norm.normalize();
+  return norm;
+}
+
+/**
+ * @brief The intersection of two Rectangles is calculated and returned.
+ * @param intersector the Rectangle to intersect with this one.
+ * @return the intersection region.
+ */
+Rect2D Rect2D::intersection(const Rect2D& intersector) const
+{
+#warning implement
+}
+
+/**
+ * @brief checks if the intersection of two Rectangles is not empty.
+ */
+bool Rect2D::intersects(const Rect2D& intersector) const
+{
+#warning implement
+
+}
+
+/**
+ * @brief make an Extensive join of two rectangles.
+ * @param rect the rectangle to unite with this one.
+ * @returns the united rectangle
+ */
+Rect2D Rect2D::unite(const Rect2D& rect)
+{
+#warning implement
+
+}
+
+/**
+ * @brief checks if rect is inside of this Rectangle.
+ * @param rect The Rectangle that should be inside of this one.
+ * @returns tru if it is.
+ */
+bool Rect2D::contains(const Rect2D& rect) const
+{
+  return (this->top() <= rect.top() &&
+          this->bottom() >= rect.bottom() &&
+          this->left() <= rect.left() &&
+          this->right() >= rect.right());
+}
+
+/**
+ * @param point the point to check if it is inside.
+ * @returns true if the point is inside of this Rectangle.
+ */
+bool Rect2D::contains(const Vector2D& point) const
+{
+  return (this->top() <= point.y &&
+          this->bottom() >= point.y &&
+          this->left() <= point.x &&
+          this->right() >= point.x);
+}
+
+/**
+ * @brief slerps this Rectangle to rect.
+ * @param rect the rectangle to slerp to.
+ * @param value how much to slerp to [0:stay, 1:go there]
+ * @returns reference to this.
+ */
+const Rect2D& Rect2D::slerp(const Rect2D& rect, float value)
+{
+  this->_topLeft.slerp(rect._topLeft, value);
+  this->_bottomRight.slerp(rect._bottomRight, value);
+
+  return *this;
+}
+
Index: trunk/src/lib/math/rect2D.h
===================================================================
--- trunk/src/lib/math/rect2D.h	(revision 7919)
+++ trunk/src/lib/math/rect2D.h	(revision 7919)
@@ -0,0 +1,128 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+/*!
+ * @file vector2D.h
+ * A basic 2D Vector math framework
+ *
+ * Contains classes to handle vectors, lines, rotations and planes
+*/
+
+#ifndef __RECT2D_H_
+#define __RECT2D_H_
+
+#include "vector2D.h"
+
+//! 2D Rectangle 2D
+/**
+ *       Class to handle 2-Dimensional Rectangles.
+ */
+class Rect2D
+{
+public:
+  Rect2D() { };
+  Rect2D(float x, float y, float width, float height);
+  Rect2D(const Vector2D& topLeft, const Vector2D& bottomRight );
+  Rect2D(const Rect2D& rect);
+
+  Rect2D& operator=(const Rect2D& rect);
+  bool operator==(const Rect2D& rect) const;
+  bool operator!=(const Rect2D& rect) const;
+
+  Rect2D operator+(const Rect2D& rect) const;
+  Rect2D& operator+=(const Rect2D& rect);
+
+  Rect2D operator-(const Rect2D& rect) const;
+  Rect2D& operator-=(const Rect2D& rect);
+
+  Rect2D operator&(const Rect2D& rect) const;
+  Rect2D& operator&=(const Rect2D& rect);
+
+  Rect2D operator*(const Vector2D& scaling) const;
+
+
+
+  /** @returns the top of the Rectangle */
+  inline float top() const { return _topLeft.y; };
+  /** @returns the bottom of the Rectangle */
+  inline float bottom() const { return _bottomRight.y; };
+  /** @returns the left border of the Rectangle */
+  inline float left() const { return _topLeft.x; };
+  /** @returns the right border of the rectangle */
+  inline float right() const { return _bottomRight.x; };
+  /** @returns the Center of the Rectangle */
+  inline Vector2D center() const { return (_topLeft+_bottomRight)/ 2.0; }
+  /** @returns the width of the Rectangle */
+  inline float width() const { return (right() - left()); };
+  /** @returns the height of the rectangle */
+  inline float height() const { return (bottom() - top()); };
+  /** @returns the Size of the Rectangle */
+  inline Vector2D size() const { return Vector2D(width(), height()); }
+  /** @returns the area of the Rectangle */
+  float area() const { return width()*height(); }
+
+  /** @param top sets the top border of the Rectangle */
+  inline void setTop(float top) { _topLeft.y = top; };
+  /** @param bottom the bottom border of the Rectangle */
+  inline void setBottom(float bottom) { _bottomRight.y = bottom; };
+  /** @param left the left border of the Rectangle */
+  inline void setLeft(float left) { _topLeft.x = left; };
+  /** @param right the right border of the Rectangle */
+  inline void setRight(float right) { _bottomRight.x = right; };
+  /** @param topLeft the top left corner of the Rectangle */
+  void setTopLeft(const Vector2D& topLeft) { _topLeft = topLeft; };
+  /** @param bottomRight the lower right corner of the Rectangle */
+  void setBottomRight(const Vector2D& bottomRight) { _bottomRight = bottomRight; };
+
+  void setWidth(float width);
+  void setHeight(float height);
+  void setSize(float width, float height);
+  void setSize(const Vector2D& size);
+  void setCenter(const Vector2D& center);
+
+  void scaleX(float x);
+  void scaleY(float y);
+  void scale(float x, float y);
+  void scale(const Vector2D& v);
+  void scaleCentered(float x, float y);
+  void scaleCentered(const Vector2D& v);
+
+  void moveX(float x);
+  void moveY(float y);
+  void move(float x, float y);
+  void move(const Vector2D& v);
+
+  void swapTopBottom();
+  void swapLeftRight();
+  void normalize();
+  Rect2D normalized() const;
+
+
+  Rect2D intersection(const Rect2D& intersector) const;
+  bool intersects(const Rect2D& intersector) const;
+  Rect2D unite(const Rect2D& rect);
+  bool contains(const Rect2D& rect) const;
+  bool contains(const Vector2D& point) const;
+
+  const Rect2D& slerp(const Rect2D& rect, float value);
+
+private:
+  Vector2D _topLeft;
+  Vector2D _bottomRight;
+};
+
+
+#endif /* __RECT2D_H_ */
+
Index: trunk/src/lib/math/vector2D.h
===================================================================
--- trunk/src/lib/math/vector2D.h	(revision 7871)
+++ trunk/src/lib/math/vector2D.h	(revision 7919)
@@ -24,5 +24,5 @@
 #define __VECTOR2D_H_
 
-#include <math.h>
+#include <cmath>
 #include "compiler.h"
 
@@ -40,5 +40,7 @@
 
   /** @param v: the Vecor to compare with this one @returns true, if the Vecors are the same, false otherwise */
-  inline bool operator== (const Vector2D& v) const { return (this->x==v.x && this->y==v.y)?true:false; };
+  inline bool operator== (const Vector2D& v) const { return (this->x==v.x && this->y==v.y); };
+  /** @param v: the Vector to negative-compare with this one @returns true if the two vectors are different */
+  inline bool operator!= (const Vector2D& v) const { return (this->x!=v.x && this->y!=v.y); };
   /** @param index The index of the "array" @returns the x/y coordinate */
   inline float operator[] (float index) const { return ( index == 0)? this->x : this->y; }
@@ -77,4 +79,6 @@
   /** @param v: the other vector \return the dot product of the vectors */
   float dot (const Vector2D& v) const { return x*v.x+y*v.y; };
+  /** @param v multipy each entry with each other @returns this reference */
+  const Vector2D& internalMultipy(const Vector2D& v) { this->x *= v.x; this->y *= y; };
   /** scales the this vector with v* @param v the vector to scale this with */
   void scale(const Vector2D& v) {   x *= v.x;  y *= v.y; };
@@ -85,4 +89,7 @@
   Vector2D getNormalized() const;
   Vector2D abs();
+
+  /** @param v the Vector to slerp to @param val 0 = stay 1 = at v */
+  void slerp(const Vector2D& v, float val) { *this += (*this - v) * val; }
 
   void debug() const;
Index: trunk/src/lib/shell/shell.cc
===================================================================
--- trunk/src/lib/shell/shell.cc	(revision 7871)
+++ trunk/src/lib/shell/shell.cc	(revision 7919)
@@ -70,4 +70,5 @@
     this->subscribeEvent(ES_SHELL, SDLK_PAGEDOWN);
     this->subscribeEvent(ES_SHELL, EV_VIDEO_RESIZE);
+    EventHandler::getInstance()->withUNICODE(ES_SHELL, true);
 
     // BUFFER
@@ -83,5 +84,5 @@
     this->textSize = 15;
     this->lineSpacing = 0;
-    this->bActive = true;
+    this->bActive = false;
     this->fontFile = SHELL_DEFAULT_FONT;
 
@@ -121,5 +122,4 @@
 
     EventHandler::getInstance()->pushState(ES_SHELL);
-    EventHandler::getInstance()->withUNICODE(true);
 
     this->setRelCoorSoft2D(0, 0, 5);
@@ -138,4 +138,5 @@
         (*text)->setText("");
     }
+    this->shellInput.setVisibility(true);
     this->updateResolution( GraphicsEngine::getInstance()->getResolutionX());
     this->repositionText();
@@ -152,5 +153,4 @@
     this->deactivate2D();
 
-    EventHandler::getInstance()->withUNICODE(false);
     EventHandler::getInstance()->popState();
 
@@ -159,4 +159,6 @@
     for (std::list<MultiLineText*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
       (*text)->setVisibility(false);
+    this->shellInput.setVisibility(false);
+
     // Go to the End again.
     this->bufferIterator = this->shellBuffer->getBuffer().begin();
Index: trunk/src/lib/shell/shell_input.cc
===================================================================
--- trunk/src/lib/shell/shell_input.cc	(revision 7871)
+++ trunk/src/lib/shell/shell_input.cc	(revision 7919)
@@ -305,4 +305,5 @@
         this->historyMoveUp();
         this->pressedKey = event.type;
+        this->pressedEvent = event.type;
       }
       else if (event.type == SDLK_DOWN)
@@ -310,4 +311,5 @@
         this->historyMoveDown();
         this->pressedKey = event.type;
+        this->pressedEvent = event.type;
       }
       else if (event.type == SDLK_TAB)
@@ -320,4 +322,5 @@
         this->delayed = this->repeatDelay;
         this->pressedKey = SDLK_BACKSPACE;
+        this->pressedEvent = SDLK_BACKSPACE;
         this->removeCharacters(1);
       }
@@ -326,4 +329,5 @@
         this->executeCommand();
         this->pressedKey = event.type;
+        this->pressedEvent = event.type;
       }
       // any other keyboard key
Index: trunk/src/lib/util/color.cc
===================================================================
--- trunk/src/lib/util/color.cc	(revision 7871)
+++ trunk/src/lib/util/color.cc	(revision 7919)
@@ -113,6 +113,6 @@
   }
   else {
-   if(h == 360.)
-     h = 0.0;
+   if(h >= 360.)
+     h = h - (float)((int)(ceilf(h) / 360.0));
     h /= 60.;
     i = (int) h;
Index: trunk/src/lib/util/timer.cc
===================================================================
--- trunk/src/lib/util/timer.cc	(revision 7919)
+++ trunk/src/lib/util/timer.cc	(revision 7919)
@@ -0,0 +1,46 @@
+/**
+ * @file timer.cc
+ * @brief A Timer class, that handles all about time.
+ *
+ * code taken from audiere.
+ */
+
+#include "timer.h"
+
+
+#include <time.h>
+#include <sys/time.h>
+
+#ifdef __WIN32__
+#include <windows.h>
+int gettimeofday
+      (struct timeval* tp, void* tzp) {
+    DWORD t;
+    t = timeGetTime();
+    tp->tv_sec = t / 1000;
+    tp->tv_usec = 1000 * (t % 1000 );
+    /* 0 indicates success. */
+    return 0;
+}
+#endif
+
+/**
+ * @returns the current time in Second exact to the micro-second
+ */
+double Timer::getNow() {
+
+#if HAVE_CLOCK_GETTIME
+
+   // use the POSIX realtime clock to get the current time
+    struct timespec tp;
+    int result = clock_gettime(CLOCK_REALTIME, &tp);
+    if (result == 0) {
+      return tp.tv_sec * tp.tv_nsec / 1000000000.0;
+    }
+#endif
+
+    // can't use realtime clock!  Try to use gettimeofday
+    struct timeval tv;
+    gettimeofday(&tv, 0);
+    return tv.tv_sec + tv.tv_usec / 1000000.0;
+}
Index: trunk/src/lib/util/timer.h
===================================================================
--- trunk/src/lib/util/timer.h	(revision 7919)
+++ trunk/src/lib/util/timer.h	(revision 7919)
@@ -0,0 +1,21 @@
+
+/*!
+ * @file timer.h
+ * @brief Definition of Time Class.
+ *
+ * These are mainly Classes, that are used for wrapping around SDL_thread
+ */
+
+#ifndef __TIMER_H__
+#define __TIMER_H__
+
+//! A class to handle time itself
+class Timer
+{
+public:
+  static double getNow();
+
+
+};
+
+#endif /* __TIMER_H__ */
Index: trunk/src/story_entities/game_world.cc
===================================================================
--- trunk/src/story_entities/game_world.cc	(revision 7871)
+++ trunk/src/story_entities/game_world.cc	(revision 7919)
@@ -25,4 +25,5 @@
 
 #include "util/loading/game_loader.h"
+#include "util/timer.h"
 
 #include "player.h"
@@ -259,7 +260,7 @@
   this->cycle = 0;
   for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++)
-    this->frameTimes[i] = 100;
+    this->frameTimes[i] = 0.01f;
   this->dtS = 0.0f;
-  this->lastFrame = SDL_GetTicks ();
+  this->lastFrame = Timer::getNow();
 
   if (this->dataTank->music != NULL)
@@ -356,22 +357,19 @@
 void GameWorld::tick ()
 {
-  Uint32 currentFrame = SDL_GetTicks();
-
   if( !this->bPaused)
   {
     // CALCULATE FRAMERATE
     Uint32 frameTimesIndex;
-    Uint32 getTicks;
     Uint32 i;
+    double currentFrame = Timer::getNow();
 
     frameTimesIndex = this->cycle % TICK_SMOOTH_VALUE;
-    getTicks = SDL_GetTicks();
-    this->frameTimes[frameTimesIndex] = getTicks - this->lastFrame;
-    this->lastFrame = getTicks;
+    this->frameTimes[frameTimesIndex] = currentFrame - this->lastFrame;
+    this->lastFrame = currentFrame;
     ++this->cycle;
-    this->dtS = 0;
+    this->dtS = 0.0;
     for (i = 0; i < TICK_SMOOTH_VALUE; i++)
       this->dtS += this->frameTimes[i];
-    this->dtS = this->dtS / TICK_SMOOTH_VALUE / 1000.0f * speed;
+    this->dtS = this->dtS / TICK_SMOOTH_VALUE * speed;
 
     // TICK everything
@@ -390,5 +388,4 @@
       this->dataTank->gameRule->tick(this->dtS);
   }
-  this->lastFrame = currentFrame;
 }
 
@@ -526,5 +523,9 @@
   GraphicsEngine* engine = GraphicsEngine::getInstance();
 
+
   AtmosphericEngine::getInstance()->draw();
+
+  //glEnable(GL_DEPTH_TEST);
+  //glEnable(GL_LIGHTING);
 
   // set camera
Index: trunk/src/story_entities/game_world.h
===================================================================
--- trunk/src/story_entities/game_world.h	(revision 7871)
+++ trunk/src/story_entities/game_world.h	(revision 7919)
@@ -93,10 +93,10 @@
 
     /* world timing */
-    Uint32              lastFrame;                    //!< last time of frame (in MiliSeconds)
+    double              lastFrame;                    //!< last time of frame (in MiliSeconds)
     Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
     float               dtS;                          //!< The time needed for caluculations in seconds
     float               speed;                        //!< how fast the game flows
     double              gameTime;                     //!< this is where the game time is saved
-    Uint32              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
+    double              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
 
     GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
Index: trunk/src/story_entities/movie_loader.cc
===================================================================
--- trunk/src/story_entities/movie_loader.cc	(revision 7871)
+++ trunk/src/story_entities/movie_loader.cc	(revision 7919)
@@ -115,4 +115,5 @@
   GraphicsEngine::enter2DMode();
 
+  glPushAttrib(GL_ENABLE_BIT);
   glEnable(GL_TEXTURE_2D);
   glBindTexture(GL_TEXTURE_2D, movie_player->getTexture());
@@ -127,4 +128,5 @@
   glEnd();
 
+  glPopAttrib();
   GraphicsEngine::leave2DMode();
 
Index: trunk/src/story_entities/simple_game_menu.cc
===================================================================
--- trunk/src/story_entities/simple_game_menu.cc	(revision 7871)
+++ trunk/src/story_entities/simple_game_menu.cc	(revision 7919)
@@ -28,5 +28,4 @@
 #include "util/loading/factory.h"
 
-#include "p_node.h"
 #include "world_entity.h"
 #include "elements/image_entity.h"
@@ -41,7 +40,5 @@
 #include "cd_engine.h"
 
-
-using namespace std;
-
+#include "glgui.h"
 
 //! This creates a Factory to fabricate a SimpleGameMenu
@@ -51,5 +48,5 @@
 
 SimpleGameMenu::SimpleGameMenu(const TiXmlElement* root)
-  : GameWorld()
+    : GameWorld()
 {
   this->setClassID(CL_SIMPLE_GAME_MENU, "SimpleGameMenu");
@@ -66,4 +63,16 @@
   this->selectorSource = NULL;
 
+
+  /// GUI
+  ///(this is as modular as it is possible).
+  OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("PUSH ME");
+  pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui));
+  pb->show();
+  pb->setAbsCoor2D(50, 50);
+
+  OrxGui::GLGuiHandler::getInstance()->activateCursor();
+  OrxGui::GLGuiHandler::getInstance()->activate();
+  /////
+
   if (root != NULL)
     this->loadParams(root);
@@ -72,11 +81,65 @@
 }
 
-
-/**
- *  @brief remove the SimpleGameMenu from memory
- *
- *  delete everything explicitly, that isn't contained in the parenting tree!
- *  things contained in the tree are deleted automaticaly
- */
+/// HACK only for testing.
+void SimpleGameMenu::enterGui()
+{
+  ///
+  OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button");
+  dnpb->show();
+  dnpb->setAbsCoor2D(350, 50);
+  dnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::execURL));
+
+  OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!");
+  rdnpb->show();
+  rdnpb->setAbsCoor2D(200, 180);
+  rdnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::quitMenu));
+
+  OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
+  input->setText("input some text here");
+  input->show();
+  input->setAbsCoor2D(200, 230);
+
+
+  /////
+}
+
+
+#include "threading.h"
+void SimpleGameMenu::execURL() const
+{
+  std::string URL = "http://www.orxonox.net";
+  SDL_CreateThread(startURL, (void*)&URL);
+}
+
+#ifdef __OSX__
+#include <ApplicationServices/ApplicationServices.h>
+#elif defined __WIN32__
+#include <shellapi.h>
+#endif
+
+int SimpleGameMenu::startURL(void* url)
+{
+  std::string URL = *(std::string*)url;
+#ifdef __linux__
+  system ((std::string("firefox ") + URL).c_str());
+#elif defined __OSX__
+    CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(),
+                                         kCFStringEncodingASCII, NULL);
+    LSOpenCFURLRef (url_handle, NULL);
+    CFRelease (url_handle);
+#elif defined __WIN32__
+    ShellExecute(GetActiveWindow(),
+                 "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
+  }
+#endif
+  PRINTF(3)("loaded external webpage %s\n", URL.c_str());
+}
+
+/**
+*  @brief remove the SimpleGameMenu from memory
+*
+*  delete everything explicitly, that isn't contained in the parenting tree!
+*  things contained in the tree are deleted automaticaly
+*/
 SimpleGameMenu::~SimpleGameMenu ()
 {
@@ -85,11 +148,12 @@
   if( this->dataTank)
     delete this->dataTank;
-}
-
-
-/**
- * @brief loads the parameters of a SimpleGameMenu from an XML-element
- * @param root the XML-element to load from
- */
+  delete OrxGui::GLGuiHandler::getInstance( );
+}
+
+
+/**
+* @brief loads the parameters of a SimpleGameMenu from an XML-element
+* @param root the XML-element to load from
+*/
 void SimpleGameMenu::loadParams(const TiXmlElement* root)
 {
@@ -103,9 +167,9 @@
 
 /**
- * @brief this is executed just before load
- *
- * since the load function sometimes needs data, that has been initialized
- * before the load and after the proceeding storyentity has finished
- */
+* @brief this is executed just before load
+*
+* since the load function sometimes needs data, that has been initialized
+* before the load and after the proceeding storyentity has finished
+*/
 ErrorMessage SimpleGameMenu::init()
 {
@@ -129,6 +193,6 @@
 
 /**
- * @brief load the data
- */
+* @brief load the data
+*/
 ErrorMessage SimpleGameMenu::loadData()
 {
@@ -149,5 +213,5 @@
     {
       element = element->FirstChildElement();
-    // load Players/Objects/Whatever
+      // load Players/Objects/Whatever
       PRINTF(4)("Loading Elements\n");
       while( element != NULL)
@@ -196,5 +260,5 @@
       this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL);
       this->menuStartMultiplayerGame->setRelCoor2D(State::getResX() / 2.0f,
-                                                   State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f));
+          State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f));
       this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity));
     }
@@ -244,7 +308,7 @@
 
 /**
- * @brief set the Sound to play when switching menu entry.
- * @param selectorSound the sound to load.
- */
+* @brief set the Sound to play when switching menu entry.
+* @param selectorSound the sound to load.
+*/
 void SimpleGameMenu::setSelectorSound(const std::string& selectorSound)
 {
@@ -280,6 +344,6 @@
 
 /**
- * @brief start the menu
- */
+* @brief start the menu
+*/
 bool SimpleGameMenu::start()
 {
@@ -293,6 +357,6 @@
 
 /**
- * stop the menu
- */
+* stop the menu
+*/
 bool SimpleGameMenu::stop()
 {
@@ -305,10 +369,13 @@
 
 /**
- *  override the standard tick for more functionality
- */
+*  override the standard tick for more functionality
+*/
 void SimpleGameMenu::tick()
 {
   GameWorld::tick();
 
+  // Make the GLGui tick.
+  OrxGui::GLGuiHandler::getInstance()->tick(this->dtS);
+
   this->animateScene(this->dtS);
 }
@@ -316,15 +383,15 @@
 
 /**
- * @brief no collision detection in the menu
- */
+* @brief no collision detection in the menu
+*/
 void SimpleGameMenu::collide()
 {
-//   this->dataTank->localCamera->
-}
-
-
-/**
- * @brief animate the scene
- */
+  //   this->dataTank->localCamera->
+}
+
+
+/**
+* @brief animate the scene
+*/
 void SimpleGameMenu::animateScene(float dt)
 {
@@ -335,9 +402,15 @@
 }
 
-
-/**
- * @brief event dispatcher funciton
- * @param event the incoming event
- */
+void SimpleGameMenu::quitMenu()
+{
+  this->setNextStoryID(WORLD_ID_GAMEEND);
+  this->stop();
+}
+
+
+/**
+* @brief event dispatcher funciton
+* @param event the incoming event
+*/
 void SimpleGameMenu::process(const Event &event)
 {
@@ -422,8 +495,8 @@
 
 /**
- * @brief switches to from one meny layer to an other
- * @param layer1 from layer
- * @param layer2 to layer
- */
+* @brief switches to from one meny layer to an other
+* @param layer1 from layer
+* @param layer2 to layer
+*/
 void SimpleGameMenu::switchMenuLayer(int layer1, int layer2)
 {
@@ -485,17 +558,17 @@
 
 /**********************************************************************************************
-    SimpleGameMenuData
- **********************************************************************************************/
-
-
-/**
- * SimpleGameMenuData constructor
- */
+SimpleGameMenuData
+**********************************************************************************************/
+
+
+/**
+* SimpleGameMenuData constructor
+*/
 SimpleGameMenuData::SimpleGameMenuData()
 {}
 
 /**
- * SimpleGameMenuData decontructor
- */
+* SimpleGameMenuData decontructor
+*/
 SimpleGameMenuData::~SimpleGameMenuData()
 {}
@@ -503,6 +576,6 @@
 
 /**
- *  initialize the GameWorldDataData
- */
+*  initialize the GameWorldDataData
+*/
 ErrorMessage SimpleGameMenuData::init()
 {
@@ -513,7 +586,7 @@
 
 /**
- *  loads the GUI data
- * @param root reference to the xml root element
- */
+*  loads the GUI data
+* @param root reference to the xml root element
+*/
 ErrorMessage SimpleGameMenuData::loadGUI(const TiXmlElement* root)
 {
@@ -524,6 +597,6 @@
 
 /**
- *  unloads the GUI data
- */
+*  unloads the GUI data
+*/
 ErrorMessage SimpleGameMenuData::unloadGUI()
 {
@@ -534,7 +607,7 @@
 
 /**
- *  overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff)
- * @param root reference to the xml root parameter
- */
+*  overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff)
+* @param root reference to the xml root parameter
+*/
 ErrorMessage SimpleGameMenuData::loadWorldEntities(const TiXmlElement* root)
 {
@@ -545,20 +618,20 @@
   if( element != NULL)
   {
-    element = element->FirstChildElement();
-    PRINTF(4)("Loading WorldEntities\n");
-    while(element != NULL)
-    {
-      BaseObject* created = Factory::fabricate(element);
-      if( created != NULL )
-        printf("Created a %s: %s\n", created->getClassName(), created->getName());
-
-      if( element->Value() == "SkyBox")
-        this->sky = dynamic_cast<WorldEntity*>(created);
-      if( element->Value() == "Terrain")
-        this->terrain = dynamic_cast<Terrain*>(created);
-      element = element->NextSiblingElement();
-    }
-
-    PRINTF(4)("Done loading WorldEntities\n");
+  element = element->FirstChildElement();
+  PRINTF(4)("Loading WorldEntities\n");
+  while(element != NULL)
+  {
+  BaseObject* created = Factory::fabricate(element);
+  if( created != NULL )
+  printf("Created a %s: %s\n", created->getClassName(), created->getName());
+
+  if( element->Value() == "SkyBox")
+  this->sky = dynamic_cast<WorldEntity*>(created);
+  if( element->Value() == "Terrain")
+  this->terrain = dynamic_cast<Terrain*>(created);
+  element = element->NextSiblingElement();
+  }
+
+  PRINTF(4)("Done loading WorldEntities\n");
   }
 
@@ -570,6 +643,6 @@
 
 /**
- *  unloads the world entities from the xml file
- */
+*  unloads the world entities from the xml file
+*/
 ErrorMessage SimpleGameMenuData::unloadWorldEntities()
 {
@@ -580,7 +653,7 @@
 
 /**
- *  loads the scene data
- * @param root reference to the xml root element
- */
+*  loads the scene data
+* @param root reference to the xml root element
+*/
 ErrorMessage SimpleGameMenuData::loadScene(const TiXmlElement* root)
 {
@@ -591,6 +664,6 @@
 
 /**
- *  unloads the scene data
- */
+*  unloads the scene data
+*/
 ErrorMessage SimpleGameMenuData::unloadScene()
 {
Index: trunk/src/story_entities/simple_game_menu.h
===================================================================
--- trunk/src/story_entities/simple_game_menu.h	(revision 7871)
+++ trunk/src/story_entities/simple_game_menu.h	(revision 7919)
@@ -49,4 +49,9 @@
     virtual ~SimpleGameMenu();
 
+    /// TODO TAKE THIS OUT
+    void enterGui();
+    void execURL() const;
+    static int startURL(void* data);
+    ///
     virtual void loadParams(const TiXmlElement* root);
 
@@ -60,4 +65,9 @@
     virtual void process(const Event &event);
 
+
+    void startLevel(int level);
+    void quitMenu();
+
+    void TEST() { printf("TEST\n"); }
 
   protected:
Index: trunk/src/world_entities/planet.cc
===================================================================
--- trunk/src/world_entities/planet.cc	(revision 7871)
+++ trunk/src/world_entities/planet.cc	(revision 7919)
@@ -109,23 +109,7 @@
 void Planet::draw() const
 {
-  glMatrixMode(GL_MODELVIEW);
-  glPushMatrix();
-
-  glShadeModel(GL_SMOOTH);
-
-  /* translate */
-  glTranslatef (this->getAbsCoor ().x,
-                this->getAbsCoor ().y,
-                this->getAbsCoor ().z);
-  Vector tmpRot = this->getAbsDir().getSpacialAxis();
-  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
-
   this->material.select();
 
-//   /WorldEntity::draw();
-  this->getModel(0)->draw();
- // static_cast<VertexArrayModel*>(this->getModel(0))->debug();
-
-  glPopMatrix();
+  WorldEntity::draw();
 }
 
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 7871)
+++ trunk/src/world_entities/skybox.cc	(revision 7919)
@@ -227,10 +227,8 @@
   glDisable(GL_LIGHTING);
 
-  glPushAttrib(GL_ENABLE_BIT);
   glDisable(GL_FOG);
 
   WorldEntity::draw();
 
-  glPopAttrib();
   glPopAttrib();
 
