Index: /trunk/src/lib/graphics/text_engine/multi_line_text.cc
===================================================================
--- /trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 7736)
+++ /trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 7737)
@@ -32,4 +32,5 @@
 
   this->lineSpacing = 1.0f;
+  this->lineCount = 0;
   this->setLineWidth(100.0f);
 }
@@ -141,4 +142,6 @@
       width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
   }
+
+  this->lineCount = lineEnds.size()+1;
   this->setSizeY2D((this->lineEnds.size()+1) * (this->lineSpacing + this->getFont()->getMaxHeight()));
 }
Index: /trunk/src/lib/graphics/text_engine/multi_line_text.h
===================================================================
--- /trunk/src/lib/graphics/text_engine/multi_line_text.h	(revision 7736)
+++ /trunk/src/lib/graphics/text_engine/multi_line_text.h	(revision 7737)
@@ -26,4 +26,5 @@
     /** @returns the LineSpacing */
     inline float getLineSpacing() const { return this->lineSpacing; };
+    inline unsigned int getLineCount() const { return this->lineCount; };
 
     virtual void draw() const;
@@ -36,4 +37,5 @@
     float                      lineSpacing;
     std::vector<unsigned int>  lineEnds;
+    unsigned int               lineCount;
 };
 
Index: /trunk/src/lib/shell/shell.cc
===================================================================
--- /trunk/src/lib/shell/shell.cc	(revision 7736)
+++ /trunk/src/lib/shell/shell.cc	(revision 7737)
@@ -21,15 +21,9 @@
 #include "shell_input.h"
 
-
-#include "text.h"
+#include "multi_line_text.h"
+
 #include "graphics_engine.h"
 #include "material.h"
 #include "event_handler.h"
-#include "debug.h"
-#include "class_list.h"
-
-#include "key_names.h"
-#include <stdarg.h>
-#include <stdio.h>
 
 namespace OrxShell
@@ -137,5 +131,5 @@
     std::list<std::string>::const_iterator textLine = --ShellBuffer::getInstance()->getBuffer().end();
     bool top = false;
-    for (std::list<Text*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
+    for (std::list<MultiLineText*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
     {
       (*text)->setVisibility(true);
@@ -164,5 +158,5 @@
     this->setRelCoorSoft2D(0, -(int)this->shellHeight, 5);
 
-    for (std::list<Text*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
+    for (std::list<MultiLineText*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
       (*text)->setVisibility(false);
     this->bufferOffset = 0;
@@ -257,6 +251,6 @@
      * output is routed from Some other Thread or by Changing any Values.
      */
-    std::list<Text*> bufferTextCopy = this->bufferText;
-    for (std::list<Text*>::iterator text = bufferTextCopy.begin(); text != bufferTextCopy.end(); ++text, ++i)
+    std::list<MultiLineText*> bufferTextCopy = this->bufferText;
+    for (std::list<MultiLineText*>::iterator text = bufferTextCopy.begin(); text != bufferTextCopy.end(); ++text, ++i)
     {
       this->resetText(*text, i);
@@ -296,5 +290,7 @@
       for (unsigned int i = oldSize; i <= bufferDisplaySize; i++)
       {
-        this->bufferText.push_back(new Text);
+        this->bufferText.push_back(new MultiLineText);
+        this->bufferText.back()->setLineWidth(this->getSizeX2D() * GraphicsEngine::getInstance()->getResolutionX());
+        this->bufferText.back()->setLineSpacing(0);
       }
     }
@@ -308,5 +304,5 @@
   void Shell::flush()
   {
-    for (std::list<Text*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
+    for (std::list<MultiLineText*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text)
     {
       (*text)->setText("");  // remove all chars from the BufferTexts.
@@ -322,16 +318,24 @@
   void Shell::printToDisplayBuffer(const std::string& text)
   {
+    // Remove Last Entry and prepend it to the front.
     this->bufferText.push_front(this->bufferText.back());
     this->bufferText.pop_back();
 
-
-    unsigned int i = 0;
-    for (std::list<Text*>::iterator textIt = ++this->bufferText.begin(); textIt != this->bufferText.end(); ++textIt, i++)
-    {
-      (*textIt)->setRelCoorSoft2D(this->calculateLinePosition(i+1), 5);
-    }
-
-    this->bufferText.front()->setRelCoor2D(this->calculateLinePosition(0)- Vector2D(-1000,0));
-    this->bufferText.front()->setRelCoorSoft2D(this->calculateLinePosition(0),10);
+    // Set the new Text.
+    this->bufferText.front()->setText(text);
+
+    // The LineCount will be started here.
+    int linePos = -1;
+
+    // The First Line gets a special Animation
+    this->bufferText.front()->setRelCoor2D(this->calculateLinePosition(linePos)- Vector2D(-1000,0));
+
+    // Move all lines one Entry up.
+    for (std::list<MultiLineText*>::iterator textIt = this->bufferText.begin(); textIt != this->bufferText.end(); ++textIt)
+    {
+      linePos += (*textIt)->getLineCount();
+      (*textIt)->setRelCoorSoft2D(this->calculateLinePosition(linePos), 8);
+    }
+
 
     /*  FANCY EFFECTS :)
@@ -344,5 +348,4 @@
     */
 
-    this->bufferText.front()->setText(text);
   }
 
@@ -389,8 +392,8 @@
     {
       /// FIXME
-      PRINTF(1)("Should not heappen\n");
+      PRINTF(1)("Should not happen\n");
       it--;
     }
-    for (std::list<Text*>::iterator textIt = this->bufferText.begin(); textIt != this->bufferText.end(); ++textIt)
+    for (std::list<MultiLineText*>::iterator textIt = this->bufferText.begin(); textIt != this->bufferText.end(); ++textIt)
     {
       (*textIt)->setText((*it));
@@ -398,5 +401,5 @@
       {
         /// FIXME
-        PRINTF(1)("Should not heappen\n");
+        PRINTF(1)("Should not happen\n");
         break;
       }
@@ -478,5 +481,7 @@
   Vector2D Shell::calculateLinePosition(unsigned int lineNumber)
   {
-    return Vector2D(5, (this->textSize + this->lineSpacing)*(this->bufferDisplaySize - lineNumber - 2) + this->textSize);
+    Vector2D val(5, (int)(this->textSize + this->lineSpacing)*(int)((int)this->bufferDisplaySize - (int)lineNumber - (int)2) + (int)this->textSize);
+     val.debug();
+     return val;
   }
 
Index: /trunk/src/lib/shell/shell.h
===================================================================
--- /trunk/src/lib/shell/shell.h	(revision 7736)
+++ /trunk/src/lib/shell/shell.h	(revision 7737)
@@ -20,5 +20,5 @@
 
 // FORWARD DECLARATION
-class Text;
+class MultiLineText;
 class ShellInput;
 class Material;
@@ -104,5 +104,5 @@
     // BUFFER
     unsigned int                bufferDisplaySize;      //!< The Size of the Display-buffer, in lines (not in characters).
-    std::list<Text*>            bufferText;             //!< A list of stored bufferTexts for the display of the buffer.
+    std::list<MultiLineText*>   bufferText;             //!< A list of stored bufferTexts for the display of the buffer.
     int                         bufferOffset;           //!< how many lines from the bottom up we display the Buffer.
     std::list<std::string>::const_iterator  bufferIterator;         //!< used to move through and print the Buffer
Index: /trunk/src/lib/shell/shell_buffer.cc
===================================================================
--- /trunk/src/lib/shell/shell_buffer.cc	(revision 7736)
+++ /trunk/src/lib/shell/shell_buffer.cc	(revision 7737)
@@ -17,6 +17,10 @@
 
 #include "shell_buffer.h"
+
+#include <stdarg.h>
+
 #include "debug.h"
 #include "shell.h"
+#include "lib/util/threading.h"
 
 namespace OrxShell
@@ -39,5 +43,5 @@
 
   ShellBuffer* ShellBuffer::singletonRef = NULL;
-  SDL_mutex* ShellBuffer::bufferMutex = NULL;
+  std::list<std::string> ShellBuffer::buffer;
 
   /**
@@ -48,10 +52,4 @@
     if (this->shell != NULL)
       delete this->shell;
-
-    this->flush();
-
-    if (ShellBuffer::bufferMutex != NULL)
-      SDL_DestroyMutex(ShellBuffer::bufferMutex);
-    ShellBuffer::bufferMutex = NULL;
 
     ShellBuffer::singletonRef = NULL;
@@ -99,8 +97,7 @@
     va_start(arguments, line);
 
-    if (ShellBuffer::bufferMutex == NULL)
-      ShellBuffer::bufferMutex = SDL_CreateMutex();
+    static OrxThread::Mutex ShellBuffer__bufferMutex;
 
-    SDL_mutexP(ShellBuffer::bufferMutex);
+    OrxThread::MutexLock bufferLock(&ShellBuffer__bufferMutex);
 #if DEBUG_LEVEL < 3
     if (ShellBuffer::singletonRef == NULL)
@@ -113,5 +110,4 @@
 #endif
       ShellBuffer::singletonRef->addBufferLine(line, arguments);
-    SDL_mutexV(ShellBuffer::bufferMutex);
     return true;
   }
Index: /trunk/src/lib/shell/shell_buffer.h
===================================================================
--- /trunk/src/lib/shell/shell_buffer.h	(revision 7736)
+++ /trunk/src/lib/shell/shell_buffer.h	(revision 7737)
@@ -8,7 +8,5 @@
 #define _SHELL_BUFFER_H
 
-#include <stdarg.h>
 #include <list>
-#include "lib/util/threading.h"
 
 #define      SHELL_BUFFER_SIZE       16384         //!< The Size of the input-buffers (should be large enough to carry any kind of input)
@@ -50,16 +48,15 @@
 
   private:
-    static ShellBuffer*      singletonRef;                       //!< The singleton-reference to the only memeber of this class.
-    unsigned int             bufferSize;                         //!< The Size of the buffer
-    std::list<std::string>   buffer;                             //!< A list of stored char-arrays(strings) to store the history
+    static ShellBuffer*           singletonRef;                       //!< The singleton-reference to the only memeber of this class.
+    unsigned int                  bufferSize;                         //!< The Size of the buffer
 
-    Shell*                   shell;                              //!< the Registered Shell.
-    char                     bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
-    char                     keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
-    bool                     keepBuffer;                         //!< if the keepbuffer contains unfinished lines.
+    Shell*                        shell;                              //!< the Registered Shell.
+    char                          bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
+    char                          keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
+    bool                          keepBuffer;                         //!< if the keepbuffer contains unfinished lines.
 
-    unsigned long            lineCount;                          //!< how many Lines have been written out so far.
+    unsigned long                 lineCount;                          //!< how many Lines have been written out so far.
 
-    static SDL_mutex*        bufferMutex;                        //!< Only one thread may write into the ShellBuffer at a time.
+    static std::list<std::string> buffer;                             //!< A list of stored char-arrays(strings) to store the history
   };
 
Index: /trunk/src/lib/sound/ogg_player.cc
===================================================================
--- /trunk/src/lib/sound/ogg_player.cc	(revision 7736)
+++ /trunk/src/lib/sound/ogg_player.cc	(revision 7737)
@@ -48,5 +48,4 @@
     this->buffers[1] = 0;
     this->musicThreadID = NULL;
-    this->musicMutex = SDL_CreateMutex();
 
     if (!fileName.empty())
@@ -64,5 +63,4 @@
   {
     this->release();
-    SDL_DestroyMutex(this->musicMutex);
   }
 
@@ -76,5 +74,5 @@
   bool OggPlayer::open(const std::string& fileName)
   {
-    MutexLock(this->musicMutex);
+    OrxThread::MutexLock musicLock(&this->musicMutex);
     // release old Ogg-File (if loaded)
     if (this->state & OggPlayer::FileOpened)
@@ -208,7 +206,6 @@
     if (this->state & OggPlayer::FileOpened)
     {
-      SDL_mutexP(this->musicMutex);
+      OrxThread::MutexLock musicLock(&this->musicMutex);
       ov_time_seek(&this->oggStream, timeCode);
-      SDL_mutexV(this->musicMutex);
     }
   }
@@ -259,7 +256,8 @@
     while (ogg->state & OggPlayer::Playing)
     {
-      SDL_mutexP(ogg->musicMutex);
-      ogg->update();
-      SDL_mutexV(ogg->musicMutex);
+      {
+        OrxThread::MutexLock musicLock(&ogg->musicMutex);
+        ogg->update();
+      }
       SDL_Delay(1);
     }
@@ -281,8 +279,7 @@
     this->state |= OggPlayer::Playing;
 
-    SDL_mutexP(this->musicMutex);
+    OrxThread::MutexLock musicLock(&this->musicMutex);
     if(!this->stream(this->buffers[0]) || !this->stream(this->buffers[1]))
     {
-      SDL_mutexV(this->musicMutex);
       this->state &= ~OggPlayer::Playing;
       return false;
@@ -296,5 +293,4 @@
     if (DEBUG_LEVEL >= 3)
       SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__);
-    SDL_mutexV(this->musicMutex);
     return true;
   }
@@ -502,16 +498,16 @@
     switch(code)
     {
-    case OV_EREAD:
-      return ("Read from media.");
-    case OV_ENOTVORBIS:
-      return ("Not Vorbis data.");
-    case OV_EVERSION:
-      return ("Vorbis version mismatch.");
-    case OV_EBADHEADER:
-      return ("Invalid Vorbis header.");
-    case OV_EFAULT:
-      return ("Internal logic fault (bug or heap/stack corruption.");
-    default:
-      return ("Unknown Ogg error.");
+      case OV_EREAD:
+        return ("Read from media.");
+      case OV_ENOTVORBIS:
+        return ("Not Vorbis data.");
+      case OV_EVERSION:
+        return ("Vorbis version mismatch.");
+      case OV_EBADHEADER:
+        return ("Invalid Vorbis header.");
+      case OV_EFAULT:
+        return ("Internal logic fault (bug or heap/stack corruption.");
+      default:
+        return ("Unknown Ogg error.");
     }
   }
Index: /trunk/src/lib/sound/ogg_player.h
===================================================================
--- /trunk/src/lib/sound/ogg_player.h	(revision 7736)
+++ /trunk/src/lib/sound/ogg_player.h	(revision 7737)
@@ -87,5 +87,5 @@
 
     SDL_Thread*         musicThreadID;        //!< The Thread in which music is Played back.
-    SDL_mutex*          musicMutex;           //!< A Mutex so that the two threads do not interfere.
+    OrxThread::Mutex    musicMutex;           //!< A Mutex so that the two threads do not interfere.
   };
 
Index: /trunk/src/lib/util/threading.cc
===================================================================
--- /trunk/src/lib/util/threading.cc	(revision 7736)
+++ /trunk/src/lib/util/threading.cc	(revision 7737)
@@ -20,4 +20,6 @@
 using namespace std;
 
+namespace OrxThread
+{
 
 /**
@@ -25,5 +27,5 @@
  * @todo this constructor is not jet implemented - do it
 */
-Threading::Threading ()
+Thread::Thread()
 {
 }
@@ -33,6 +35,8 @@
  * standard deconstructor
 */
-Threading::~Threading ()
+Thread::~Thread()
 {
   // delete what has to be deleted here
 }
+
+}
Index: /trunk/src/lib/util/threading.h
===================================================================
--- /trunk/src/lib/util/threading.h	(revision 7736)
+++ /trunk/src/lib/util/threading.h	(revision 7737)
@@ -15,29 +15,44 @@
 #endif
 
+namespace OrxThread
+{
+  //! A class for Wrapping Threads
+  class Thread
+  {
 
-//! A class for Wrapping Threads
-class Threading
-{
-
-public:
-  Threading();
-  virtual ~Threading();
+  public:
+    Thread();
+    virtual ~Thread();
 
 
-private:
+  private:
 
-};
+  };
 
-//! A Class that locks a Mutex within its scope
-class MutexLock
-{
-public:
-  //! Locks the Mutex mutex in this Scope.
-  MutexLock(SDL_mutex* mutex) { SDL_mutexP(mutex); this->mutex = mutex; };
-  ~MutexLock() { SDL_mutexV(mutex); };
-private:
-  SDL_mutex* mutex;         //!< The Mutex to lock.
-};
+  class Mutex
+  {
+  public:
+    Mutex() {  this->mutex = SDL_CreateMutex(); };
+    ~Mutex() { SDL_DestroyMutex(this->mutex); }
 
+    void lock() { SDL_mutexP(mutex); };
+    void unlock() { SDL_mutexV(mutex); };
+
+    SDL_mutex* getMutex() const { return this->mutex; };
+  private:
+    SDL_mutex* mutex;
+  };
+
+  //! A Class that locks a Mutex within its scope
+  class MutexLock
+  {
+  public:
+    //! Locks the Mutex mutex in this Scope.
+    MutexLock(Mutex* mutex) { SDL_mutexP(mutex->getMutex()); this->mutex = mutex; };
+    ~MutexLock() { SDL_mutexV(mutex->getMutex()); };
+  private:
+    Mutex* mutex;         //!< The Mutex to lock.
+  };
+}
 
 #endif /* _THREADING_H */
