Index: /code/branches/hud2/src/orxonox/Orxonox.cc
===================================================================
--- /code/branches/hud2/src/orxonox/Orxonox.cc	(revision 1001)
+++ /code/branches/hud2/src/orxonox/Orxonox.cc	(revision 1002)
@@ -375,5 +375,5 @@
       // show the current time in the HUD
       //orxonoxHUD_->setTime((int)now, 0);
-      orxonoxHUD_->energyCounter->reset(20);
+//      orxonoxHUD_->energyCounter->reset(20);
 
 
Index: /code/branches/hud2/src/orxonox/hud/Bar.cc
===================================================================
--- /code/branches/hud2/src/orxonox/hud/Bar.cc	(revision 1001)
+++ /code/branches/hud2/src/orxonox/hud/Bar.cc	(revision 1002)
@@ -26,87 +26,49 @@
 */
 
-#include "OrxonoxStableHeaders.h"
-
 #include <OgreOverlayManager.h>
 #include <OgreOverlayElement.h>
-#include <OgreTextAreaOverlayElement.h>
 #include <OgreStringConverter.h>
+#include <OgreColourValue.h>
 #include <string.h>
 
-#include "Bar.h"
+#include "BarV1.h"
 
 namespace orxonox
 {
   using namespace Ogre;
-    
-  Bar::Bar(Real left, Real top, Real width, Real height,
-          int dir,  int colour, std::string name){
-    Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
-    element = overlayManager.createOverlayElement("Panel",name);
-    element->setMetricsMode(Ogre::GMM_PIXELS);
-    dir_ = dir;
-    left_ = left;
-    top_ = top;
-    width_ = width;
-    height_ = height;
-    element->setPosition(left_,top_);
-    element->setDimensions(width_,height_);
-    setColour(colour);
-  }
+
+    Bar::Bar(const String& name):Ogre::OverlayElement(name){}
+
+
+
+
+
+
+/*  Bar::Bar(const Ogre::String& s){}
   
   Bar::~Bar(void){}
   
-  
-  void Bar::reset(int percentage){
-    switch(dir_){
-      case 1:
-	element->setPosition(left_,top_);
-	element->setDimensions(width_,height_*percentage/100);
-	break;
-      case 2:
-	element->setPosition(left_+width_-width_*percentage/100,top_);
-	element->setDimensions(width_*percentage/100,height_);
-	break;
-      case 3:
-	element->setPosition(left_,top_+height_-height_*percentage/100);
-	element->setDimensions(width_,height_*percentage/100);
-	break;
-      default:
-	element->setPosition(left_,top_);
-	element->setDimensions(width_*percentage/100,height_);	
+  */
+/*  void Bar::setPercentage(float percentage){
+    percentage_=percentage;
+    if(dir_){setWidth(int(percentage_* getWidth()));}
+	else {setHeight(int(percentage_ * getHeight()));}
     }
+
+
+  void Bar::setPercentage(float percentage){
+    percentage_ = percentage;
+//    setWidth(getWidth());
   }
 
-  void Bar::setColour(int colour){
-    switch(colour){
-     case 0:
-	element->setMaterialName("Orxonox/Red");
-	break;
-     case 1:
-	element->setMaterialName("Orxonox/Yellow");
-	break;
-     case 2:
-	element->setMaterialName("Orxonox/Green");
-    }
-  }
-
-  void Bar::show(){element->show();}
-
-  void Bar::hide(){element->hide();}
-
-  SmartBar::SmartBar(Ogre::Real left, Ogre::Real top, Ogre::Real width, Ogre::Real height,
-        int dir, std::string name) : Bar(left, top, width, height, dir, Bar::YELLOW, name){
-  }
-
-  SmartBar::~SmartBar(void){}
 
 
-  void SmartBar::reset(int percentage){
-    if (percentage>50) {setColour(Bar::GREEN);}
-    else if (percentage>25) {setColour(Bar::YELLOW);}
-    else setColour(Bar::RED);
-    Bar::reset(percentage);
+  
+  void Bar::setColor(ColourValue color){
+    color_=color;
+    setColour(color);
   }
-
+*/	  
+	
 }
 
Index: /code/branches/hud2/src/orxonox/hud/Bar.h
===================================================================
--- /code/branches/hud2/src/orxonox/hud/Bar.h	(revision 1001)
+++ /code/branches/hud2/src/orxonox/hud/Bar.h	(revision 1002)
@@ -30,8 +30,9 @@
 #define _BAR_H__
 
+#include <string>
+#include <OgreColourValue.h>
+#include <OgreOverlayElement.h>
+#include <OgrePrerequisites.h>
 #include <string.h>
-#include <OgreOverlayElement.h>
-#include <OgreTextAreaOverlayElement.h>
-#include <OgrePrerequisites.h>
 #include "../OrxonoxPrereqs.h"
 
@@ -40,47 +41,25 @@
 namespace orxonox
 {
-  class _OrxonoxExport Bar
+  class Bar : public Ogre::OverlayElement
   {
   private:
-    int percentage_;
-    int dir_;	
-    int left_;
-    int top_;
-    int width_;
-    int height_;
+    float percentage_;
+    bool dir_;
+    Ogre::ColourValue color_;
+	
 	
   public:
-    static const int LEFT = 0;
-    static const int UP = 1;
-    static const int RIGHT = 2;
-    static const int DOWN = 3;
 
-    static const int RED = 0;
-    static const int YELLOW = 1;
-    static const int GREEN = 2;
-
-    Ogre::OverlayElement* element;
-
-    Bar(Ogre::Real left, Ogre::Real top, Ogre::Real width, Ogre::Real height,
-        int dir, int colour, std::string name);
-    ~Bar(void);
-    void reset(int percentage);
-    void setColour(int colour);
-    void show();
-    void hide();
-    
-  };
+    Bar(const Ogre::String& name);
+//    virtual ~Bar();
 
 
-  class _OrxonoxExport SmartBar : public Bar
-  {
-  private:
 
-  public:
-    SmartBar(Ogre::Real left, Ogre::Real top, Ogre::Real width, Ogre::Real height,
-        int dir, std::string name);
-    ~SmartBar(void);
-    void reset(int percentage);
-  };
+
+/*    Bar(const Ogre::String& s);
+    ~Bar(void);
+    void setPercentage(float percentage);
+    void setColor(Ogre::ColourValue color);
+*/  };
 }
 
Index: /code/branches/hud2/src/orxonox/hud/Factories.h
===================================================================
--- /code/branches/hud2/src/orxonox/hud/Factories.h	(revision 1002)
+++ /code/branches/hud2/src/orxonox/hud/Factories.h	(revision 1002)
@@ -0,0 +1,71 @@
+/*
+*   ORXONOX - the hottest 3D action shooter ever to exist
+*
+*
+*   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:
+*      ...
+*
+*/
+
+#ifndef _FACTORIES_H__
+#define _FACTORIES_H__
+
+
+#include <OgreOverlayElement.h>
+#include <OgrePrerequisites.h>
+#include <OgreOverlayElementFactory.h>
+
+#include "Bar.h"
+
+
+namespace orxonox{
+
+  class _OrxonoxExport BarOverlayElementFactory : public Ogre::OverlayElementFactory{
+  public:
+    Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
+      return new Bar(instanceName);
+    }
+    const Ogre::String& getTypeName(void) const{
+      static Ogre::String name = "Bar";
+      return name;
+    }
+  };
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif
Index: /code/branches/hud2/src/orxonox/hud/HUD.cc
===================================================================
--- /code/branches/hud2/src/orxonox/hud/HUD.cc	(revision 1001)
+++ /code/branches/hud2/src/orxonox/hud/HUD.cc	(revision 1002)
@@ -35,5 +35,5 @@
 #include "HUD.h"
 #include "Bar.h"
-#include "TestElement.h"
+#include "Factories.h"
 // ugly hack
 #include "Orxonox.h"
@@ -52,5 +52,5 @@
     Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
 
-    energyCounter = new Bar(0,0,100,20,Bar::LEFT,Bar::YELLOW,"Orxonox/HUD/energyCounterPanel/energyCounter");
+//    energyCounter = new Bar(0,0,100,20,Bar::LEFT,Bar::YELLOW,"Orxonox/HUD/energyCounterPanel/energyCounter");
 
     Ogre::OverlayContainer* energyCounterPanel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "Orxonox/HUD/energyCounterPanel"));
@@ -62,9 +62,13 @@
     energyCounterPanel->setMetricsMode(Ogre::GMM_PIXELS);	
     energyCounterPanel->show();
-    energyCounterPanel->addChild(energyCounter->element);
-
-    TestOverlayElementFactory *factory = new TestOverlayElementFactory();
+//    energyCounterPanel->addChild(energyCounter->element);
+
+    BarOverlayElementFactory *factory = new BarOverlayElementFactory();
     overlayManager.addOverlayElementFactory(factory);
-    Ogre::OverlayElement* testElement = overlayManager.createOverlayElementFromFactory("Test", "testElement");
+    Ogre::OverlayElement* BarElement = overlayManager.createOverlayElementFromFactory("Bar", "BarElement");
+
+
+
+
 
     Ogre::Overlay* orxonoxOverlay = overlayManager.create("Orxonox/HUD"); 
