Index: code/branches/presentation/src/orxonox/overlays/stats/CreateLines.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/stats/CreateLines.cc	(revision 2492)
+++ code/branches/presentation/src/orxonox/overlays/stats/CreateLines.cc	(revision 2495)
@@ -39,23 +39,63 @@
 #include "core/ConfigValueIncludes.h"
 
+#include "overlays/OverlayText.h"
+#include "overlays/stats/Stats.h"
+
 namespace orxonox
 {
-    CreateFactory(CreateLines);
-
     /**
         @brief Constructor: Creates a line.
     */
-    CreateLines::CreateLines(BaseObject* creator)
-        : OrxonoxOverlay(creator)
+    CreateLines::CreateLines(float leftOffset, float topOffset, float width, float height)
     {
-        RegisterObject(CreateLines);
+        playerNameText_ = new OverlayText(0);
+        playerNameText_->setTextSize(0.04);
+        playerNameText_->setColour(ColourValue(0, 0.75, 0.2, 1));
+        playerNameText_->setPosition(Vector2(0.1, topOffset + 0.01));
+
+        scoreText_ = new OverlayText(0);
+        scoreText_->setTextSize(0.04);
+        scoreText_->setColour(ColourValue(0, 0.75, 0.2, 1));
+        scoreText_->setPosition(Vector2(0.6, topOffset + 0.01));
+
+        deathsText_ = new OverlayText(0);
+        deathsText_->setTextSize(0.04);
+        deathsText_->setColour(ColourValue(0, 0.75, 0.2, 1));
+        deathsText_->setPosition(Vector2(0.8, topOffset + 0.01));
+
+        background_ = new Stats(0);
+        background_->setPosition(Vector2(leftOffset, topOffset));
+        background_->setSize(Vector2(width, height));
     }
 
-    /**
-        @brief Initializes the lines.
-    */
-    void CreateLines::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    CreateLines::~CreateLines()
     {
-        SUPER(CreateLines, XMLPort, xmlElement, mode);
+        delete this->playerNameText_;
+        delete this->scoreText_;
+        delete this->deathsText_;
+        delete this->background_;
+    }
+
+    void CreateLines::setPlayerName(const std::string& str)
+    {
+        this->playerNameText_->setCaption(str);
+    }
+
+    void CreateLines::setScore(const std::string& str)
+    {
+        this->scoreText_->setCaption(str);
+    }
+
+    void CreateLines::setDeaths(const std::string& str)
+    {
+        this->deathsText_->setCaption(str);
+    }
+
+    void CreateLines::setVisibility(bool visible)
+    {
+        this->scoreText_->setVisible(visible);
+        this->deathsText_->setVisible(visible);
+        this->playerNameText_->setVisible(visible);
+        this->background_->setVisible(visible);
     }
 
@@ -63,41 +103,35 @@
         @brief Ensures that the number of OverlayElements is equal to numberOfColumns.
     */
-    void CreateLines::setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex) {
+    //void CreateLines::setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex) {
 
-        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
+    //    Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
 
-        unsigned int colIndex = 0;
+    //    unsigned int colIndex = 0;
 
-        while (textColumns_.size() < numberOfColumns) {
+    //    while (textColumns_.size() < numberOfColumns)
+    //    {
+    //        Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + convertToString(lineIndex) + convertToString(colIndex)));
+    //        textColumns_.push_back(tempTextArea);
+    //        this->background_->addChild(tempTextArea);
 
-            Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + convertToString(lineIndex) + convertToString(colIndex)));
-            textColumns_.push_back(tempTextArea);
-            this->background_->addChild(tempTextArea);
+    //        colIndex++;
+    //    }
 
-            colIndex++;
+    //    while (textColumns_.size() > numberOfColumns)
+    //    {
+    //        this->background_->_removeChild(textColumns_.back());
+    //        ovMan->destroyOverlayElement(textColumns_.back());
+    //        textColumns_.pop_back();
+    //    }
+    //}
 
-        }
+    //void CreateLines::alignColumn(int columnIndex, float leftOffset, float topOffset)
+    //{
+    //    this->textColumns_[columnIndex]->setPosition(leftOffset, topOffset);
+    //}
 
-        while (textColumns_.size() > numberOfColumns) {
-
-            this->background_->_removeChild(textColumns_.back());
-            ovMan->destroyOverlayElement(textColumns_.back());
-            textColumns_.pop_back();
-
-        }
-
-    }
-
-    void CreateLines::alignColumn(int columnIndex, float leftOffset, float topOffset) {
-
-        this->textColumns_[columnIndex]->setPosition(leftOffset, topOffset);
-
-    }
-
-    void CreateLines::setColumnText(int columnIndex, std::string columnText) {
-
-        this->textColumns_[columnIndex]->setCaption(columnText);
-
-    }
-
+    //void CreateLines::setColumnText(int columnIndex, std::string columnText)
+    //{
+    //    this->textColumns_[columnIndex]->setCaption(columnText);
+    //}
 }
Index: code/branches/presentation/src/orxonox/overlays/stats/CreateLines.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/stats/CreateLines.h	(revision 2492)
+++ code/branches/presentation/src/orxonox/overlays/stats/CreateLines.h	(revision 2495)
@@ -40,21 +40,30 @@
 namespace orxonox
 {
-    class _OrxonoxExport CreateLines : public OrxonoxOverlay
+    class _OrxonoxExport CreateLines
     {
 
     public: // functions
-        CreateLines(BaseObject* creator);
-        virtual ~CreateLines() {}
+        CreateLines(float, float, float, float);
+        virtual ~CreateLines();
 
-        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+        void setPlayerName(const std::string&);
+        void setScore(const std::string&);
+        void setDeaths(const std::string&);
 
-        void setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex);
-        void alignColumn(int columnIndex, float leftOffset, float topOffset);
-        void setColumnText(int columnIndex, std::string columnText);
+        void setVisibility(bool);
+
+        //void setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex);
+        //void alignColumn(int columnIndex, float leftOffset, float topOffset);
+        //void setColumnText(int columnIndex, std::string columnText);
 
     private: // functions
 
     private: // variables
-        std::vector<Ogre::TextAreaOverlayElement*> textColumns_;
+        //std::vector<OverlayText*> textColumns_;
+        OverlayText* playerNameText_;
+        OverlayText* scoreText_;
+        OverlayText* deathsText_;
+
+        Stats* background_;
 
     };
Index: code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.cc	(revision 2492)
+++ code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.cc	(revision 2495)
@@ -39,4 +39,5 @@
 #include "core/ConfigValueIncludes.h"
 #include "objects/gametypes/Gametype.h"
+#include "objects/infos/PlayerInfo.h"
 #include "CreateLines.h"
 
@@ -52,7 +53,5 @@
     {
         RegisterObject(Scoreboard);
-
-        createlines_ = new CreateLines(this);
-        // this->gametype_ = new Gametype(this);
+        this->setGametype(creator->getGametype());
     }
 
@@ -64,8 +63,13 @@
         SUPER(Scoreboard, XMLPort, xmlElement, mode);
 
-        printLines();
+        COUT(0) << "XMLPort executed." << std::endl;
+    }
 
-        COUT(0) << "XMLPort executed." << std::endl;
+    void Scoreboard::changedVisibility()
+    {
+        SUPER(Scoreboard, changedVisibility);
 
+        for (unsigned int i = 0; i < this->lines_.size(); ++i)
+            this->lines_[i]->setVisibility(this->isVisible());
     }
 
@@ -73,37 +77,63 @@
         @brief Prints the scoreboard on the screen.
     */
-    void Scoreboard::printLines() {
+    void Scoreboard::tick(float dt)
+    {
+        const std::map<PlayerInfo*, Player>& playerList = this->getGametype()->getPlayers();
 
-        numberOfColumns = 2;
-        // numberOfLines = this->gametype_->getNumberOfPlayers();
-        numberOfLines = 3;
-        topOffset = 0.1;
-        lineSpacing = 0.1;
-
-        for (unsigned int i = 0; i < numberOfLines; i++) {
-
-            columnIndex = 0;
-            leftOffset = 0.1;
-
-            this->createlines_->setNumberOfColumns(numberOfColumns, i);
-
-            // columnText = this->gametype_->getPlayersName();
-            columnText = "PlayerName";
-            this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
-            this->createlines_->setColumnText(columnIndex, columnText);
-
-            columnIndex++;
-            leftOffset = leftOffset + 0.3;
-
-            // columnText = this->gametype_->getPlayersFrags();
-            columnText = "PlayerFrags";
-            this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
-            this->createlines_->setColumnText(columnIndex, columnText);
-
-            topOffset = topOffset + lineSpacing;
-
+        const float topOffset  = 0.2;
+        const float leftOffset = 0.075;
+        const float distance   = 0.01;
+        const float width      = 0.85;
+        const float height     = 0.05;
+        while (playerList.size() > this->lines_.size())
+        {
+            // create new lines
+            this->lines_.push_back(new CreateLines(leftOffset, topOffset + (distance + height) * lines_.size(), width, height));
+        }
+        while (playerList.size() < this->lines_.size())
+        {
+            // destroy lines
+            delete this->lines_.back();
+            this->lines_.pop_back();
         }
 
+        // update board
+
+        unsigned int index = 0;
+        for (std::map<PlayerInfo*, Player>::const_iterator it = playerList.begin(); it != playerList.end(); ++it)
+        {
+            this->lines_[index]->setPlayerName(omni_cast<std::string>(it->first->getName()));
+            this->lines_[index]->setScore(omni_cast<std::string>(it->second.frags_));
+            this->lines_[index]->setDeaths(omni_cast<std::string>(it->second.killed_));
+            index++;
+        }
+
+        //numberOfColumns = 2;
+        //numberOfLines = 3;
+        //topOffset = 0.1;
+        //lineSpacing = 0.1;
+
+        //for (unsigned int i = 0; i < this->lines_.size(); ++i)
+        //{
+        //    columnIndex = 0;
+        //    leftOffset = 0.1;
+
+        //    this->createlines_->setNumberOfColumns(numberOfColumns, i);
+
+        //    // columnText = this->gametype_->getPlayersName();
+        //    columnText = "PlayerName";
+        //    this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
+        //    this->createlines_->setColumnText(columnIndex, columnText);
+
+        //    columnIndex++;
+        //    leftOffset = leftOffset + 0.3;
+
+        //    // columnText = this->gametype_->getPlayersFrags();
+        //    columnText = "PlayerFrags";
+        //    this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
+        //    this->createlines_->setColumnText(columnIndex, columnText);
+
+        //    topOffset = topOffset + lineSpacing;
+        //}
     }
-
 }
Index: code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.h	(revision 2492)
+++ code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.h	(revision 2495)
@@ -40,12 +40,13 @@
 namespace orxonox
 {
-    class _OrxonoxExport Scoreboard : public OrxonoxOverlay
+    class _OrxonoxExport Scoreboard : public OrxonoxOverlay, public Tickable
     {
 
     public: // functions
         Scoreboard(BaseObject* creator);
-        ~Scoreboard() {}
+        virtual ~Scoreboard() {}
 
         virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+        virtual void tick(float dt);
 
         inline void setGametype(Gametype* gt)
@@ -59,8 +60,12 @@
             { return this->createlines_; }
 
+        virtual void changedVisibility();
+
     private: // functions
         void printLines();
 
     private: // variables
+        std::vector<CreateLines*> lines_;
+
         unsigned int numberOfColumns;
         unsigned int numberOfLines;
Index: code/branches/presentation/src/orxonox/overlays/stats/Stats.cc
===================================================================
--- code/branches/presentation/src/orxonox/overlays/stats/Stats.cc	(revision 2492)
+++ code/branches/presentation/src/orxonox/overlays/stats/Stats.cc	(revision 2495)
@@ -56,4 +56,40 @@
 
         this->setConfigValues();
+
+        // create overlay and elements
+        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
+
+        // create BorderPanel
+        this->statsOverlayBorder_ = static_cast<Ogre::BorderPanelOverlayElement*>(ovMan->createOverlayElement("BorderPanel", "StatsBorderPanel" + getUniqueNumberString()));
+        //this->statsOverlayBorder_->setMaterialName("StatsCenter");
+        this->statsOverlayBorder_->setBorderSize(0.003, 16 * 0.003);
+        this->statsOverlayBorder_->setBorderMaterialName("StatsBorder");
+        this->statsOverlayBorder_->setTopBorderUV(0.49, 0.0, 0.51, 0.5);
+        this->statsOverlayBorder_->setTopLeftBorderUV(0.0, 0.0, 0.5, 0.5);
+        this->statsOverlayBorder_->setTopRightBorderUV(0.5, 0.0, 1.0, 0.5);
+        this->statsOverlayBorder_->setLeftBorderUV(0.0, 0.49, 0.5, 0.51);
+        this->statsOverlayBorder_->setRightBorderUV(0.5, 0.49, 1.0, 0.5);
+        this->statsOverlayBorder_->setBottomBorderUV(0.49, 0.5, 0.51, 1.0);
+        this->statsOverlayBorder_->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0);
+        this->statsOverlayBorder_->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0);
+
+        background_->addChild(statsOverlayBorder_);
+
+        // create noise
+        //this->statsOverlayNoise_ = static_cast<Ogre::PanelOverlayElement*>(ovMan->createOverlayElement("Panel", "StatsNoise" + getUniqueNumberString()));
+        //this->statsOverlayNoise_->setPosition(0,0);
+        //this->statsOverlayNoise_->setMaterialName("StatsNoiseSmall");
+        // comment following line to disable noise
+        //background_->addChild(this->statsOverlayNoise_);
+    }
+
+    Stats::~Stats()
+    {
+        if (this->isInitialized())
+        {
+            Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
+            ovMan->destroyOverlayElement(this->statsOverlayBorder_);
+            //ovMan->destroyOverlayElement(this->statsOverlayNoise_);
+        }
     }
 
@@ -72,31 +108,4 @@
     {
         OrxonoxOverlay::XMLPort(xmlElement, mode);
-
-        // create overlay and elements
-        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
-
-        // create BorderPanel
-        this->statsOverlayBorder_ = static_cast<Ogre::BorderPanelOverlayElement*>(ovMan->createOverlayElement("BorderPanel", "StatsBorderPanel"));
-        this->statsOverlayBorder_->setMaterialName("StatsCenter");
-        this->statsOverlayBorder_->setBorderSize(0.02, 0.02, 0.02, 0.02);
-        this->statsOverlayBorder_->setBorderMaterialName("StatsBorder");
-        this->statsOverlayBorder_->setTopBorderUV(0.49, 0.0, 0.51, 0.5);
-        this->statsOverlayBorder_->setTopLeftBorderUV(0.0, 0.0, 0.5, 0.5);
-        this->statsOverlayBorder_->setTopRightBorderUV(0.5, 0.0, 1.0, 0.5);
-        this->statsOverlayBorder_->setLeftBorderUV(0.0, 0.49, 0.5, 0.51);
-        this->statsOverlayBorder_->setRightBorderUV(0.5, 0.49, 1.0, 0.5);
-        this->statsOverlayBorder_->setBottomBorderUV(0.49, 0.5, 0.51, 1.0);
-        this->statsOverlayBorder_->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0);
-        this->statsOverlayBorder_->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0);
-
-        background_->addChild(statsOverlayBorder_);
-
-        // create noise
-        this->statsOverlayNoise_ = static_cast<Ogre::PanelOverlayElement*>(ovMan->createOverlayElement("Panel", "StatsNoise"));
-        this->statsOverlayNoise_->setPosition(0,0);
-        this->statsOverlayNoise_->setMaterialName("StatsNoiseSmall");
-        // comment following line to disable noise
-        background_->addChild(this->statsOverlayNoise_);
-
     }
 
@@ -106,7 +115,7 @@
 
             // this creates a flickering effect (extracts exactly 80% of the texture at a random location)
-            float uRand = (rand() & 1023) / 1023.0f * 0.2f;
-            float vRand = (rand() & 1023) / 1023.0f * 0.2f;
-            this->statsOverlayNoise_->setUV(uRand, vRand, 7.5f + uRand, 7.5f + vRand);
+            //float uRand = (rand() & 1023) / 1023.0f * 0.2f;
+            //float vRand = (rand() & 1023) / 1023.0f * 0.2f;
+            //this->statsOverlayNoise_->setUV(uRand, vRand, 7.5f + uRand, 7.5f + vRand);
     }
 
Index: code/branches/presentation/src/orxonox/overlays/stats/Stats.h
===================================================================
--- code/branches/presentation/src/orxonox/overlays/stats/Stats.h	(revision 2492)
+++ code/branches/presentation/src/orxonox/overlays/stats/Stats.h	(revision 2495)
@@ -46,5 +46,5 @@
     public: // functions
         Stats(BaseObject* creator);
-        virtual ~Stats(){}
+        virtual ~Stats();
 
         void setConfigValues();
