Index: /code/branches/hud/src/orxonox/overlays/HUD.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/HUD.cc	(revision 1600)
+++ /code/branches/hud/src/orxonox/overlays/HUD.cc	(revision 1600)
@@ -0,0 +1,249 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HUD.h"
+
+#include <string>
+#include <set>
+#include <assert.h>
+#include <OgreOverlay.h>
+#include <OgreOverlayContainer.h>
+#include <OgreOverlayManager.h>
+#include <OgreStringConverter.h>
+
+#include "core/Debug.h"
+#include "core/ConsoleCommand.h"
+#include "core/CoreIncludes.h"
+#include "objects/SpaceShip.h"
+#include "objects/WorldEntity.h"
+#include "GraphicsEngine.h"
+#include "HUDBar.h"
+#include "RadarObject.h"
+#include "RadarOverlayElement.h"
+#include "Navigation.h"
+
+namespace orxonox
+{
+    CreateFactory(HUD);
+
+    SetConsoleCommandShortcut(HUD, cycleNavigationFocus).setAccessLevel(AccessLevel::User);
+    SetConsoleCommandShortcut(HUD, releaseNavigationFocus).setAccessLevel(AccessLevel::User);
+    SetConsoleCommand(HUD, toggleVisibility, false).setAccessLevel(AccessLevel::User);
+
+    HUD* HUD::instance_s = 0;
+
+    using namespace Ogre;
+
+    HUD::HUD()
+    {
+        assert(instance_s == 0);
+        instance_s = this;
+        RegisterObject(HUD);
+
+        // Singleton like in Ogre. Constructor and destructor are public,
+        // but the assert prevents from having multiple instances.
+
+        orxonoxHUD_ = 0;
+        container_ = 0;
+        fpsText_ = 0;
+        rTRText_ = 0;
+        energyBar_ = 0;
+        speedoBar_ = 0;
+        radar_ = 0;
+        nav_ = 0;
+        showFPS_ = true;
+        showRenderTime_ = true;
+    }
+
+    HUD::~HUD()
+    {
+        if (this->isInitialized())
+        {
+            if (this->container_)
+                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->container_);
+            this->container_ = 0;
+            if (this->fpsText_)
+                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->fpsText_);
+            this->fpsText_ = 0;
+            if (this->rTRText_)
+                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->rTRText_);
+            this->rTRText_ = 0;
+            if (this->energyBar_)
+                delete this->energyBar_;
+            this->energyBar_ = 0;
+            /*if (this->speedoBar_)
+                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->speedoBar_);*/
+            this->speedoBar_ = 0;
+            if (this->radar_)
+                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->radar_);
+            this->radar_ = 0;
+            if (this->orxonoxHUD_)
+                Ogre::OverlayManager::getSingleton().destroy(this->orxonoxHUD_);
+            this->orxonoxHUD_ = 0;
+        }
+
+        instance_s = 0;
+    }
+
+    void HUD::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        BaseObject::XMLPort(xmlElement, mode);
+
+        showFPS_ = true;
+        showRenderTime_ = true;
+
+        XMLPortObject(HUD, HUDOverlay, "", addHUDElement, getHUDElement, xmlElement, mode, false, true);
+
+        // create Factories
+        Ogre::OverlayManager::getSingleton().addOverlayElementFactory(&radarOverlayElementFactory_);
+
+        // set up screen-wide container
+        container_ = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Orxonox/HUD/container"));
+        container_->setLeft(0.0);
+        container_->setTop(0.0);
+        container_->setWidth(1.0);
+        container_->setHeight(1.0);
+        container_->setMetricsMode(Ogre::GMM_RELATIVE);
+
+        orxonoxHUD_ = Ogre::OverlayManager::getSingleton().create("Orxonox/HUD");
+        orxonoxHUD_->add2D(container_);
+
+        // create radar
+        radar_ = static_cast<RadarOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Radar", "radar"));
+        radar_->init(0.5, 0.9, 0.2, container_);
+
+        WorldEntity* object;
+        object = new WorldEntity();
+        object->setPosition(2000.0, 0.0, 0.0);
+        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
+        object = new WorldEntity();
+        object->setPosition(0.0, 2000.0, 0.0);
+        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
+        object = new WorldEntity();
+        object->setPosition(0.0, 0.0, 2000.0);
+        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
+        object = new WorldEntity();
+        object->setPosition(10000.0,16000.0,0.0);
+        addRadarObject(object);
+
+        orxonoxHUD_->show();
+    }
+
+    void HUD::addHUDElement(HUDOverlay* element)
+    {
+        if (hudElements_.find(element->getName()) != hudElements_.end())
+        {
+          COUT(1) << "Ambiguous names encountered while load the HUD overlays" << std::endl;
+        }
+        else
+          hudElements_[element->getName()] = element;
+    }
+
+    HUDOverlay* HUD::getHUDElement(unsigned int index)
+    {
+        if (index < this->hudElements_.size())
+        {
+          std::map<std::string, HUDOverlay*>::const_iterator it = hudElements_.begin();
+          for (unsigned int i = 0; i != index; ++it, ++i)
+            ;
+          return (*it).second;
+        }
+        else
+            return 0;
+    }
+
+    void HUD::tick(float dt)
+    {
+        radar_->update();
+    }
+
+    void HUD::windowResized(int newWidth, int newHeight)
+    {
+        this->radar_->resize();
+    }
+
+    void HUD::addRadarObject(WorldEntity* object, const ColourValue& colour){
+        RadarObject* obj = new RadarObject(container_, object, colour);
+        roSet_.insert(roSet_.end(), obj);
+//        // check if this is the first RadarObject to create
+//        if(firstRadarObject == NULL){
+//            firstRadarObject = new RadarObject(container_, object, colour);
+//            lastRadarObject = firstRadarObject;
+//        }
+//        else{ // if not, append to list
+//            lastRadarObject->next = new RadarObject(container_, object, colour);
+//            lastRadarObject = lastRadarObject->next;
+//        }
+    }
+
+    void HUD::removeRadarObject(WorldEntity* object){
+        for(std::list<RadarObject*>::iterator it=roSet_.begin(); it!=roSet_.end(); ++it){
+            if ((*it)->getObject() == object)
+            {
+                /*if (this->nav_ && this->nav_->getFocus() == (*it))
+                    this->nav_->releaseFocus();*/
+
+                delete (*it);
+                roSet_.erase(it);
+                return;
+            }
+        }
+    }
+
+    /*static*/ HUD& HUD::getSingleton()
+    {
+        assert(instance_s);
+        return *instance_s;
+    }
+
+    /*static*/ void HUD::toggleVisibility(const std::string& name)
+    {
+        if (HUD::getSingleton().hudElements_.find(name) != HUD::getSingleton().hudElements_.end())
+        {
+            HUD::getSingleton().hudElements_[name]->setVisibility(!HUD::getSingleton().hudElements_[name]->isVisible());
+        }
+    }
+
+    /*static*/ void HUD::setEnergy(float value){
+        HUD::getSingleton().energyBar_->setValue(value);
+    }
+
+    /*static*/ void HUD::cycleNavigationFocus()
+    {
+        if (HUD::getSingleton().hudElements_.find("Navigation") != HUD::getSingleton().hudElements_.end())
+        {
+            Navigation* navi = dynamic_cast<Navigation*>(HUD::getSingleton().hudElements_["Navigation"]);
+            navi->cycleFocus();
+        }
+    }
+
+    /*static*/ void HUD::releaseNavigationFocus(){
+        //HUD::getSingleton().nav_->releaseFocus();
+    }
+}
Index: /code/branches/hud/src/orxonox/overlays/HUD.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/HUD.h	(revision 1600)
+++ /code/branches/hud/src/orxonox/overlays/HUD.h	(revision 1600)
@@ -0,0 +1,103 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Yuning Chai
+ *   Co-authors:
+ *      Felix Schulthess
+ *
+ */
+
+
+#ifndef _HUD_H__
+#define _HUD_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
+#include <OgreTextAreaOverlayElement.h>
+#include "core/BaseObject.h"
+#include "objects/Tickable.h"
+#include "util/Math.h"
+#include "OverlayElementFactories.h"
+#include "tools/WindowEventListener.h"
+
+namespace orxonox
+{
+    class HUDBar;
+    class HUDOverlay;
+
+    class _OrxonoxExport HUD : public BaseObject, public TickableReal, public WindowEventListener
+    {
+      public:
+        HUD();
+        ~HUD();
+
+        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+        virtual void tick(float);
+
+        void resize();
+        void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
+        void removeRadarObject(WorldEntity* object);
+        void setFPS();
+
+        inline std::list<RadarObject*>& getRadarObjects()
+            { return this->roSet_; }
+
+        static HUD& getSingleton();
+
+        static void setEnergy(float value);
+        static void cycleNavigationFocus();
+        static void releaseNavigationFocus();
+        static void toggleVisibility(const std::string& name);
+
+      private:
+        HUD(const HUD& instance);
+
+        void addHUDElement(HUDOverlay* element);
+        HUDOverlay* getHUDElement(unsigned int index);
+
+        void windowResized(int newWidth, int newHeight);
+
+        std::map<std::string, HUDOverlay*> hudElements_;
+
+        std::list<RadarObject*> roSet_;
+
+        RadarOverlayElementFactory radarOverlayElementFactory_;
+
+        Ogre::Overlay* orxonoxHUD_;
+        Ogre::OverlayContainer* container_;
+        Ogre::TextAreaOverlayElement* fpsText_;
+        Ogre::TextAreaOverlayElement* rTRText_;
+        HUDBar* energyBar_;
+        BarOverlayElement* speedoBar_;
+        RadarOverlayElement* radar_;
+        Navigation* nav_;
+
+        bool showFPS_;
+        bool showRenderTime_;
+
+        static HUD* instance_s;
+    };
+}
+
+#endif /* _HUD_H__ */
Index: /code/branches/hud/src/orxonox/overlays/HUDOverlay.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/HUDOverlay.cc	(revision 1600)
+++ /code/branches/hud/src/orxonox/overlays/HUDOverlay.cc	(revision 1600)
@@ -0,0 +1,151 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HUDOverlay.h"
+
+#include <OgreOverlayManager.h>
+#include "util/Convert.h"
+#include "core/CoreIncludes.h"
+#include "GraphicsEngine.h"
+
+namespace orxonox
+{
+  unsigned int HUDOverlay::hudOverlayCounter_s = 0;
+
+  HUDOverlay::HUDOverlay()
+    : overlay_(0)
+    , windowAspectRatio_(1.0f)
+    , bCorrectAspect_(false)
+    , size_(1.0f, 1.0f)
+    , sizeCorrection_(1.0f, 1.0f)
+    , angle_(0.0f)
+    , position_(0.0f, 0.0f)
+    , origin_(0.5f, 0.5f)
+  {
+    RegisterObject(HUDOverlay);
+  }
+
+  void HUDOverlay::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+  {
+    BaseObject::XMLPort(xmlElement, mode);
+
+    if (mode == XMLPort::LoadObject)
+    {
+      overlay_ = Ogre::OverlayManager::getSingleton().create("HUDOverlay"
+            + convertToString(hudOverlayCounter_s++) + "_" + this->getName());
+
+      this->windowResized(GraphicsEngine::getSingleton().getWindowWidth(),
+            GraphicsEngine::getSingleton().getWindowHeight());
+    }
+
+    XMLPortParam(HUDOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode);
+    XMLPortParam(HUDOverlay, "size", setSize, getSize, xmlElement, mode);
+    XMLPortParam(HUDOverlay, "rotation", setRotation, getRotation, xmlElement, mode);
+    XMLPortParam(HUDOverlay, "origin", setOrigin, getOrigin, xmlElement, mode);
+    XMLPortParam(HUDOverlay, "position", setPosition, getPosition, xmlElement, mode);
+
+    if (mode == XMLPort::LoadObject)
+    {
+      this->overlay_->show();
+      if (!this->isVisible())
+          this->overlay_->hide();
+
+      this->sizeChanged();
+    }
+  }
+
+  HUDOverlay::~HUDOverlay()
+  {
+  }
+
+  void HUDOverlay::changedVisibility()
+  {
+    if (this->overlay_)
+    {
+      if (this->isVisible())
+        this->overlay_->show();
+      else
+        this->overlay_->hide();
+    }
+  }
+
+  void HUDOverlay::windowResized(int newWidth, int newHeight)
+  {
+    this->windowAspectRatio_ = newWidth/(float)newHeight;
+
+    this->setAspectCorrection(this->bCorrectAspect_);
+  }
+
+  void HUDOverlay::setAspectCorrection(bool val)
+  {
+    if (val)
+    {
+      // note: this is only an approximation that is mostly valid when the
+      // magnitude of the width is about the magnitude of the height.
+      // Correctly we would have to take the square root of width*height
+      this->sizeCorrection_.x = 2.0 / (this->windowAspectRatio_ + 1.0);
+      this->sizeCorrection_.y = this->windowAspectRatio_ * this->sizeCorrection_.x;
+    }
+    else
+    {
+      this->sizeCorrection_ = Vector2::UNIT_SCALE;
+    }
+
+    this->bCorrectAspect_ = val;
+    this->sizeChanged();
+  }
+
+  /**
+    @remarks
+      This function can be overriden by any derivative.
+  */
+  void HUDOverlay::sizeChanged()
+  {
+    this->overlay_->setScale(size_.x * sizeCorrection_.x, size_.y * sizeCorrection_.y);
+  }
+
+  /**
+    @remarks
+      This function can be overriden by any derivative.
+  */
+  void HUDOverlay::angleChanged()
+  {
+    this->overlay_->setRotate(this->angle_);
+  }
+
+  /**
+    @remarks
+      This function can be overriden by any derivative.
+  */
+  void HUDOverlay::positionChanged()
+  {
+    Vector2 scroll = (position_ - 0.5 - size_ * (origin_ - 0.5)) * 2.0;
+    this->overlay_->setScroll(scroll.x, -scroll.y);
+  }
+}
Index: /code/branches/hud/src/orxonox/overlays/HUDOverlay.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/HUDOverlay.h	(revision 1600)
+++ /code/branches/hud/src/orxonox/overlays/HUDOverlay.h	(revision 1600)
@@ -0,0 +1,115 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDOverlay_H__
+#define _HUDOverlay_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
+#include "tools/WindowEventListener.h"
+#include "util/Math.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport HUDOverlay : public BaseObject, public WindowEventListener
+  {
+    public:
+      HUDOverlay();
+      virtual ~HUDOverlay();
+
+      virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+      void setAspectCorrection(bool val);
+      bool getAspectCorrection() { return this->bCorrectAspect_; }
+
+      /** Sets the position of this overlay. */
+      void setPosition(Vector2 pos) { this->position_ = pos; this->positionChanged(); }
+
+      /** Gets the current position. */
+      Vector2 getPosition() const { return this->position_; }
+
+      /** Scrolls the overlay by the offsets provided. */
+      void scroll(Vector2 scroll) { this->position_ += scroll; this->positionChanged(); }
+
+      /** Sets the origin point of this overlay. */
+      void setOrigin(Vector2 pos) { this->origin_ = pos; this->positionChanged(); }
+
+      /** Gets the origin point of this overlay */
+      Vector2 getOrigin() const { return this->origin_; }
+
+      /** Sets the rotation applied to this overlay.*/
+      void setRotation(const Ogre::Radian& angle) { this->angle_ = angle; this->angleChanged(); }
+
+      /** Gets the rotation applied to this overlay, in degrees.*/
+      const Radian& getRotation() const { return this->angle_; }
+
+      /** Adds the passed in angle to the rotation applied to this overlay. */
+      void rotate(const Radian& angle) { this->angle_ += angle; this->angleChanged(); }
+
+      /** Sets the scaling factor of this overlay. */
+      void setSize(const Vector2& size) { this->size_ = size; this->sizeChanged(); }
+
+      /** Gets the current size (not corrected) */
+      Vector2 getSize() const { return this->size_; }
+
+      /** Gets the current size (corrected) */
+      Vector2 getActualSize() const { return this->size_ * this->sizeCorrection_; }
+
+      /** Gets the current size correction */
+      Vector2 getSizeCorrection() const { return this->sizeCorrection_; }
+
+      /** Scales the overlay */
+      void scale(Vector2 scale) { this->size_ *= scale; this->sizeChanged(); }
+
+    protected:
+      virtual void changedVisibility();
+      virtual void sizeChanged();
+      virtual void angleChanged();
+      virtual void positionChanged();
+      float getWindowAspectRatio() { return windowAspectRatio_; } 
+
+      Ogre::Overlay* overlay_;
+
+    private:
+      void windowResized(int newWidth, int newHeight);
+
+      float windowAspectRatio_;
+      bool bCorrectAspect_;
+      Vector2 size_;
+      Vector2 sizeCorrection_;
+      Radian angle_;
+      Vector2 position_;
+      Vector2 origin_;
+
+      static unsigned int hudOverlayCounter_s;
+  };
+}
+
+#endif /* _HUDOverlay_H__ */
Index: de/branches/hud/src/orxonox/overlays/hud/HUD.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUD.cc	(revision 1599)
+++ 	(revision )
@@ -1,249 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Yuning Chai
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "HUD.h"
-
-#include <string>
-#include <set>
-#include <assert.h>
-#include <OgreOverlay.h>
-#include <OgreOverlayContainer.h>
-#include <OgreOverlayManager.h>
-#include <OgreStringConverter.h>
-
-#include "core/Debug.h"
-#include "core/ConsoleCommand.h"
-#include "core/CoreIncludes.h"
-#include "objects/SpaceShip.h"
-#include "objects/WorldEntity.h"
-#include "GraphicsEngine.h"
-#include "HUDBar.h"
-#include "RadarObject.h"
-#include "RadarOverlayElement.h"
-#include "Navigation.h"
-
-namespace orxonox
-{
-    CreateFactory(HUD);
-
-    SetConsoleCommandShortcut(HUD, cycleNavigationFocus).setAccessLevel(AccessLevel::User);
-    SetConsoleCommandShortcut(HUD, releaseNavigationFocus).setAccessLevel(AccessLevel::User);
-    SetConsoleCommand(HUD, toggleVisibility, false).setAccessLevel(AccessLevel::User);
-
-    HUD* HUD::instance_s = 0;
-
-    using namespace Ogre;
-
-    HUD::HUD()
-    {
-        assert(instance_s == 0);
-        instance_s = this;
-        RegisterObject(HUD);
-
-        // Singleton like in Ogre. Constructor and destructor are public,
-        // but the assert prevents from having multiple instances.
-
-        orxonoxHUD_ = 0;
-        container_ = 0;
-        fpsText_ = 0;
-        rTRText_ = 0;
-        energyBar_ = 0;
-        speedoBar_ = 0;
-        radar_ = 0;
-        nav_ = 0;
-        showFPS_ = true;
-        showRenderTime_ = true;
-    }
-
-    HUD::~HUD()
-    {
-        if (this->isInitialized())
-        {
-            if (this->container_)
-                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->container_);
-            this->container_ = 0;
-            if (this->fpsText_)
-                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->fpsText_);
-            this->fpsText_ = 0;
-            if (this->rTRText_)
-                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->rTRText_);
-            this->rTRText_ = 0;
-            if (this->energyBar_)
-                delete this->energyBar_;
-            this->energyBar_ = 0;
-            /*if (this->speedoBar_)
-                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->speedoBar_);*/
-            this->speedoBar_ = 0;
-            if (this->radar_)
-                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->radar_);
-            this->radar_ = 0;
-            if (this->orxonoxHUD_)
-                Ogre::OverlayManager::getSingleton().destroy(this->orxonoxHUD_);
-            this->orxonoxHUD_ = 0;
-        }
-
-        instance_s = 0;
-    }
-
-    void HUD::XMLPort(Element& xmlElement, XMLPort::Mode mode)
-    {
-        BaseObject::XMLPort(xmlElement, mode);
-
-        showFPS_ = true;
-        showRenderTime_ = true;
-
-        XMLPortObject(HUD, HUDOverlay, "", addHUDElement, getHUDElement, xmlElement, mode, false, true);
-
-        // create Factories
-        Ogre::OverlayManager::getSingleton().addOverlayElementFactory(&radarOverlayElementFactory_);
-
-        // set up screen-wide container
-        container_ = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Orxonox/HUD/container"));
-        container_->setLeft(0.0);
-        container_->setTop(0.0);
-        container_->setWidth(1.0);
-        container_->setHeight(1.0);
-        container_->setMetricsMode(Ogre::GMM_RELATIVE);
-
-        orxonoxHUD_ = Ogre::OverlayManager::getSingleton().create("Orxonox/HUD");
-        orxonoxHUD_->add2D(container_);
-
-        // create radar
-        radar_ = static_cast<RadarOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Radar", "radar"));
-        radar_->init(0.5, 0.9, 0.2, container_);
-
-        WorldEntity* object;
-        object = new WorldEntity();
-        object->setPosition(2000.0, 0.0, 0.0);
-        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
-        object = new WorldEntity();
-        object->setPosition(0.0, 2000.0, 0.0);
-        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
-        object = new WorldEntity();
-        object->setPosition(0.0, 0.0, 2000.0);
-        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
-        object = new WorldEntity();
-        object->setPosition(10000.0,16000.0,0.0);
-        addRadarObject(object);
-
-        orxonoxHUD_->show();
-    }
-
-    void HUD::addHUDElement(HUDOverlay* element)
-    {
-        if (hudElements_.find(element->getName()) != hudElements_.end())
-        {
-          COUT(1) << "Ambiguous names encountered while load the HUD overlays" << std::endl;
-        }
-        else
-          hudElements_[element->getName()] = element;
-    }
-
-    HUDOverlay* HUD::getHUDElement(unsigned int index)
-    {
-        if (index < this->hudElements_.size())
-        {
-          std::map<std::string, HUDOverlay*>::const_iterator it = hudElements_.begin();
-          for (unsigned int i = 0; i != index; ++it, ++i)
-            ;
-          return (*it).second;
-        }
-        else
-            return 0;
-    }
-
-    void HUD::tick(float dt)
-    {
-        radar_->update();
-    }
-
-    void HUD::windowResized(int newWidth, int newHeight)
-    {
-        this->radar_->resize();
-    }
-
-    void HUD::addRadarObject(WorldEntity* object, const ColourValue& colour){
-        RadarObject* obj = new RadarObject(container_, object, colour);
-        roSet_.insert(roSet_.end(), obj);
-//        // check if this is the first RadarObject to create
-//        if(firstRadarObject == NULL){
-//            firstRadarObject = new RadarObject(container_, object, colour);
-//            lastRadarObject = firstRadarObject;
-//        }
-//        else{ // if not, append to list
-//            lastRadarObject->next = new RadarObject(container_, object, colour);
-//            lastRadarObject = lastRadarObject->next;
-//        }
-    }
-
-    void HUD::removeRadarObject(WorldEntity* object){
-        for(std::list<RadarObject*>::iterator it=roSet_.begin(); it!=roSet_.end(); ++it){
-            if ((*it)->getObject() == object)
-            {
-                /*if (this->nav_ && this->nav_->getFocus() == (*it))
-                    this->nav_->releaseFocus();*/
-
-                delete (*it);
-                roSet_.erase(it);
-                return;
-            }
-        }
-    }
-
-    /*static*/ HUD& HUD::getSingleton()
-    {
-        assert(instance_s);
-        return *instance_s;
-    }
-
-    /*static*/ void HUD::toggleVisibility(const std::string& name)
-    {
-        if (HUD::getSingleton().hudElements_.find(name) != HUD::getSingleton().hudElements_.end())
-        {
-            HUD::getSingleton().hudElements_[name]->setVisibility(!HUD::getSingleton().hudElements_[name]->isVisible());
-        }
-    }
-
-    /*static*/ void HUD::setEnergy(float value){
-        HUD::getSingleton().energyBar_->setValue(value);
-    }
-
-    /*static*/ void HUD::cycleNavigationFocus()
-    {
-        if (HUD::getSingleton().hudElements_.find("Navigation") != HUD::getSingleton().hudElements_.end())
-        {
-            Navigation* navi = dynamic_cast<Navigation*>(HUD::getSingleton().hudElements_["Navigation"]);
-            navi->cycleFocus();
-        }
-    }
-
-    /*static*/ void HUD::releaseNavigationFocus(){
-        //HUD::getSingleton().nav_->releaseFocus();
-    }
-}
Index: de/branches/hud/src/orxonox/overlays/hud/HUD.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUD.h	(revision 1599)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Yuning Chai
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-
-#ifndef _HUD_H__
-#define _HUD_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <OgrePrerequisites.h>
-#include <OgreTextAreaOverlayElement.h>
-#include "core/BaseObject.h"
-#include "objects/Tickable.h"
-#include "util/Math.h"
-#include "OverlayElementFactories.h"
-#include "tools/WindowEventListener.h"
-
-namespace orxonox
-{
-    class HUDBar;
-    class HUDOverlay;
-
-    class _OrxonoxExport HUD : public BaseObject, public TickableReal, public WindowEventListener
-    {
-      public:
-        HUD();
-        ~HUD();
-
-        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
-
-        virtual void tick(float);
-
-        void resize();
-        void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
-        void removeRadarObject(WorldEntity* object);
-        void setFPS();
-
-        inline std::list<RadarObject*>& getRadarObjects()
-            { return this->roSet_; }
-
-        static HUD& getSingleton();
-
-        static void setEnergy(float value);
-        static void cycleNavigationFocus();
-        static void releaseNavigationFocus();
-        static void toggleVisibility(const std::string& name);
-
-      private:
-        HUD(const HUD& instance);
-
-        void addHUDElement(HUDOverlay* element);
-        HUDOverlay* getHUDElement(unsigned int index);
-
-        void windowResized(int newWidth, int newHeight);
-
-        std::map<std::string, HUDOverlay*> hudElements_;
-
-        std::list<RadarObject*> roSet_;
-
-        RadarOverlayElementFactory radarOverlayElementFactory_;
-
-        Ogre::Overlay* orxonoxHUD_;
-        Ogre::OverlayContainer* container_;
-        Ogre::TextAreaOverlayElement* fpsText_;
-        Ogre::TextAreaOverlayElement* rTRText_;
-        HUDBar* energyBar_;
-        BarOverlayElement* speedoBar_;
-        RadarOverlayElement* radar_;
-        Navigation* nav_;
-
-        bool showFPS_;
-        bool showRenderTime_;
-
-        static HUD* instance_s;
-    };
-}
-
-#endif /* _HUD_H__ */
Index: de/branches/hud/src/orxonox/overlays/hud/HUDOverlay.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUDOverlay.cc	(revision 1599)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "HUDOverlay.h"
-
-#include <OgreOverlayManager.h>
-#include "util/Convert.h"
-#include "core/CoreIncludes.h"
-#include "GraphicsEngine.h"
-
-namespace orxonox
-{
-  unsigned int HUDOverlay::hudOverlayCounter_s = 0;
-
-  HUDOverlay::HUDOverlay()
-    : overlay_(0)
-    , windowAspectRatio_(1.0f)
-    , bCorrectAspect_(false)
-    , size_(1.0f, 1.0f)
-    , sizeCorrection_(1.0f, 1.0f)
-    , angle_(0.0f)
-    , position_(0.0f, 0.0f)
-    , origin_(0.5f, 0.5f)
-  {
-    RegisterObject(HUDOverlay);
-  }
-
-  void HUDOverlay::XMLPort(Element& xmlElement, XMLPort::Mode mode)
-  {
-    BaseObject::XMLPort(xmlElement, mode);
-
-    if (mode == XMLPort::LoadObject)
-    {
-      overlay_ = Ogre::OverlayManager::getSingleton().create("HUDOverlay"
-            + convertToString(hudOverlayCounter_s++) + "_" + this->getName());
-
-      this->windowResized(GraphicsEngine::getSingleton().getWindowWidth(),
-            GraphicsEngine::getSingleton().getWindowHeight());
-    }
-
-    XMLPortParam(HUDOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode);
-    XMLPortParam(HUDOverlay, "size", setSize, getSize, xmlElement, mode);
-    XMLPortParam(HUDOverlay, "rotation", setRotation, getRotation, xmlElement, mode);
-    XMLPortParam(HUDOverlay, "origin", setOrigin, getOrigin, xmlElement, mode);
-    XMLPortParam(HUDOverlay, "position", setPosition, getPosition, xmlElement, mode);
-
-    if (mode == XMLPort::LoadObject)
-    {
-      this->overlay_->show();
-      if (!this->isVisible())
-          this->overlay_->hide();
-
-      this->sizeChanged();
-    }
-  }
-
-  HUDOverlay::~HUDOverlay()
-  {
-  }
-
-  void HUDOverlay::changedVisibility()
-  {
-    if (this->overlay_)
-    {
-      if (this->isVisible())
-        this->overlay_->show();
-      else
-        this->overlay_->hide();
-    }
-  }
-
-  void HUDOverlay::windowResized(int newWidth, int newHeight)
-  {
-    this->windowAspectRatio_ = newWidth/(float)newHeight;
-
-    this->setAspectCorrection(this->bCorrectAspect_);
-  }
-
-  void HUDOverlay::setAspectCorrection(bool val)
-  {
-    if (val)
-    {
-      // note: this is only an approximation that is mostly valid when the
-      // magnitude of the width is about the magnitude of the height.
-      // Correctly we would have to take the square root of width*height
-      this->sizeCorrection_.x = 2.0 / (this->windowAspectRatio_ + 1.0);
-      this->sizeCorrection_.y = this->windowAspectRatio_ * this->sizeCorrection_.x;
-    }
-    else
-    {
-      this->sizeCorrection_ = Vector2::UNIT_SCALE;
-    }
-
-    this->bCorrectAspect_ = val;
-    this->sizeChanged();
-  }
-
-  /**
-    @remarks
-      This function can be overriden by any derivative.
-  */
-  void HUDOverlay::sizeChanged()
-  {
-    this->overlay_->setScale(size_.x * sizeCorrection_.x, size_.y * sizeCorrection_.y);
-  }
-
-  /**
-    @remarks
-      This function can be overriden by any derivative.
-  */
-  void HUDOverlay::angleChanged()
-  {
-    this->overlay_->setRotate(this->angle_);
-  }
-
-  /**
-    @remarks
-      This function can be overriden by any derivative.
-  */
-  void HUDOverlay::positionChanged()
-  {
-    Vector2 scroll = (position_ - 0.5 - size_ * (origin_ - 0.5)) * 2.0;
-    this->overlay_->setScroll(scroll.x, -scroll.y);
-  }
-}
Index: de/branches/hud/src/orxonox/overlays/hud/HUDOverlay.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUDOverlay.h	(revision 1599)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   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
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _HUDOverlay_H__
-#define _HUDOverlay_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <OgrePrerequisites.h>
-#include "tools/WindowEventListener.h"
-#include "util/Math.h"
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
-  class _OrxonoxExport HUDOverlay : public BaseObject, public WindowEventListener
-  {
-    public:
-      HUDOverlay();
-      virtual ~HUDOverlay();
-
-      virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
-
-      void setAspectCorrection(bool val);
-      bool getAspectCorrection() { return this->bCorrectAspect_; }
-
-      /** Sets the position of this overlay. */
-      void setPosition(Vector2 pos) { this->position_ = pos; this->positionChanged(); }
-
-      /** Gets the current position. */
-      Vector2 getPosition() const { return this->position_; }
-
-      /** Scrolls the overlay by the offsets provided. */
-      void scroll(Vector2 scroll) { this->position_ += scroll; this->positionChanged(); }
-
-      /** Sets the origin point of this overlay. */
-      void setOrigin(Vector2 pos) { this->origin_ = pos; this->positionChanged(); }
-
-      /** Gets the origin point of this overlay */
-      Vector2 getOrigin() const { return this->origin_; }
-
-      /** Sets the rotation applied to this overlay.*/
-      void setRotation(const Ogre::Radian& angle) { this->angle_ = angle; this->angleChanged(); }
-
-      /** Gets the rotation applied to this overlay, in degrees.*/
-      const Radian& getRotation() const { return this->angle_; }
-
-      /** Adds the passed in angle to the rotation applied to this overlay. */
-      void rotate(const Radian& angle) { this->angle_ += angle; this->angleChanged(); }
-
-      /** Sets the scaling factor of this overlay. */
-      void setSize(const Vector2& size) { this->size_ = size; this->sizeChanged(); }
-
-      /** Gets the current size (not corrected) */
-      Vector2 getSize() const { return this->size_; }
-
-      /** Gets the current size (corrected) */
-      Vector2 getActualSize() const { return this->size_ * this->sizeCorrection_; }
-
-      /** Gets the current size correction */
-      Vector2 getSizeCorrection() const { return this->sizeCorrection_; }
-
-      /** Scales the overlay */
-      void scale(Vector2 scale) { this->size_ *= scale; this->sizeChanged(); }
-
-    protected:
-      virtual void changedVisibility();
-      virtual void sizeChanged();
-      virtual void angleChanged();
-      virtual void positionChanged();
-      float getWindowAspectRatio() { return windowAspectRatio_; } 
-
-      Ogre::Overlay* overlay_;
-
-    private:
-      void windowResized(int newWidth, int newHeight);
-
-      float windowAspectRatio_;
-      bool bCorrectAspect_;
-      Vector2 size_;
-      Vector2 sizeCorrection_;
-      Radian angle_;
-      Vector2 position_;
-      Vector2 origin_;
-
-      static unsigned int hudOverlayCounter_s;
-  };
-}
-
-#endif /* _HUDOverlay_H__ */
