Index: /branches/playability/src/util/hud.cc
===================================================================
--- /branches/playability/src/util/hud.cc	(revision 10233)
+++ /branches/playability/src/util/hud.cc	(revision 10234)
@@ -57,8 +57,8 @@
   this->resY = 1;
 
-  this->overlayPercentage = 5;
+  this->overlayPercentage = 40;
   this->overlayActive = false;
-  this->rightRect = NULL;
-  this->leftRect = NULL;
+  this->rightRect = new OrxGui::GLGuiImage();
+  this->leftRect = new OrxGui::GLGuiImage();
 
   this->inputLine = new OrxGui::GLGuiInputLine();
@@ -126,4 +126,5 @@
     //this->shipValuesBox->pack(this->energyWidget);
     //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings();
+    this->energyWidget->setParent2D(this->leftRect);
     this->energyWidget->show();
     /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
@@ -153,4 +154,5 @@
     //this->shipValuesBox->pack(this->shieldWidget);
     //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings();
+    this->shieldWidget->setParent2D(this->leftRect);
     this->shieldWidget->show();
     /*    this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
@@ -182,4 +184,5 @@
     //this->shipValuesBox->pack(this->armorWidget);
     //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings();
+    this->armorWidget->setParent2D(this->leftRect);
     this->armorWidget->show();
     /*    this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
@@ -249,7 +252,9 @@
       {
         //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
+        weapon->getEnergyWidget()->setParent2D(this->rightRect);
         weapon->getEnergyWidget()->show();
         weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
         weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
+        weapon->getEnergyWidget()->setWidgetSize(120,30);
         //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
         this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
@@ -264,4 +269,5 @@
       {
         //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
+        weapon->getEnergyWidget()->setParent2D(this->rightRect);
         weapon->getEnergyWidget()->show();
         weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
@@ -291,31 +297,29 @@
   this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
 
+  int overlayWidth = this->resX * (overlayPercentage)/(200);
+  this->rightRect->hide();
+  this->leftRect->hide();
+
+  this->leftRect->setParent2D(this);
+  this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
+  this->leftRect->setAbsCoor2D(0,0);
+  this->leftRect->setBackgroundTexture(Texture());
+  this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
+  this->leftRect->setForegroundTexture(Texture());
+  this->leftRect->setForegroundColor(Color(0,0,0,0));
+
+  this->rightRect->setParent2D(this);
+  this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
+  this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0);
+  this->rightRect->setBackgroundTexture(Texture());
+  this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
+  this->rightRect->setForegroundTexture(Texture());
+  this->rightRect->setForegroundColor(Color(0,0,0,0));
+
+
   if (this->overlayActive == true)
   {
-    if (this->rightRect == NULL)
-      this->rightRect = new OrxGui::GLGuiWidget();
-    //if (this->leftRect == NULL)
-      //this->leftRect = new OrxGui::GLGuiWidget();
-    
-    int overlayWidth = this->resX * (100-overlayPercentage)/(200);
-    this->rightRect->hide();
-    /*
-    this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
-    this->leftRect->setAbsCoor2D(0,0);
-    this->leftRect->setBackgroundTexture(Texture());
-    this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
+    this->rightRect->show();
     this->leftRect->show();
-    */
-    
-    
-    this->rightRect->setParent2D(this);
-    this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
-    this->rightRect->setAbsCoor2D(this->resX - overlayWidth,this->resY);
-    this->rightRect->setBackgroundTexture(Texture());
-    this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
-    //this->rightRect->setForegroundTexture(Texture());
-    //this->rightRect->setForegroundColor(Color(1,1,1,1));
-    this->rightRect->show();
-    
   }
 
@@ -324,4 +328,5 @@
   {
     PRINTF(4)("UPDATING RADAR\n");
+    this->_radar->setParent2D(this->leftRect);
     this->_radar->setCenterNode(State::getPlayer()->getPlayable());
     //this->_radar->addEntityList(&State::getObjectManager()->getEntityList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0));
@@ -354,28 +359,33 @@
 
   std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
-  Vector2D pos(this->resX, 0.5*this->resY);
+  Vector2D pos(overlayWidth, 0.5*this->resY);
+
+  // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other
+  // element2D- related function works tough.. :s
+
   for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
   {
-    if (pos.x < 0.9*resX)
-    {
-      pos.x = this->resX;
-      pos.y += 150;
-    }
-    pos.x -= 40;
+    if (pos.x < overlayWidth*0.2)
+    {
+      pos.x = overlayWidth;
+      pos.y += (*weaponWidget)->getSizeX2D();
+    }
+    pos.x -= (*weaponWidget)->getSizeY2D();
     (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);
+    //(*weaponWidget)->setAbsCoor2D(0,100);
     (*weaponWidget)->show();
     //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
   }
 
-  pos.y += 150;
-  pos.x = this->resX;
+  pos.y += 160;
+  pos.x = overlayWidth;
   for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
   {
-    if (pos.x < 0.9*resX)
-    {
-      pos.x = this->resX;
-      pos.y += 150;
-    }
-    pos.x -= 40;
+    if (pos.x < overlayWidth*0.2)
+    {
+      pos.x = overlayWidth;
+      pos.y += (*weaponWidget)->getSizeX2D();
+    }
+    pos.x -= (*weaponWidget)->getSizeY2D();
     (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);
     (*weaponWidget)->show();
Index: /branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc
===================================================================
--- /branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc	(revision 10233)
+++ /branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc	(revision 10234)
@@ -30,4 +30,51 @@
   GLGuiEnergyWidgetVertical::GLGuiEnergyWidgetVertical ()
   {
+
+    this->setAbsDir2D(270);
+    this->setBackgroundTexture(Texture());
+    this->setBackgroundColor(Color(1,1,1,0));
+    this->setBorderTop(10);
+    this->setBorderLeft(10);
+    this->setBorderRight(10);
+    this->setBorderBottom(10);
+    this->setWidgetSize(120,50);
+
+    this->_bar.setParent2D(this);
+    this->_bar.setBackgroundTexture(Texture());
+    this->_bar.setBackgroundColor(Color(0,0,0,0));
+    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
+    this->_bar.setForegroundColor(Color::green);
+    this->_bar.setChangedValueColor(Color(1,0,0,0.2));
+    this->_bar.setBorderTop(0);
+    this->_bar.setBorderLeft(0);
+    this->_bar.setBorderRight(0);
+    this->_bar.setBorderBottom(0);
+    this->_bar.setWidgetSize(100,30);
+    //this->_bar.setRelCoor2D(borderLeft(), 0);
+    this->_bar.setRelCoor2D(0,0);
+
+    this->_image.setParent2D(this);
+    this->_image.setBorderTop(0);
+    this->_image.setBorderLeft(0);
+    this->_image.setBorderRight(0);
+    this->_image.setBorderBottom(0);
+    this->_image.setWidgetSize(30,30);
+    this->_image.setForegroundColor(Color(1,1,1,0.6));
+    this->_image.setBackgroundColor(Color(1,1,1,0));
+    this->_image.setBackgroundTexture(Texture());
+    this->_image.loadImageFromFile("maps/evil-flower.png");
+    //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
+    this->_image.setRelCoor2D(0,0);
+    this->_image.setRelDir2D(90);
+    this->_image.setVisibility(true);
+
+    this->_valueText.setParent2D(&this->_bar);
+    this->_valueText.setWidgetSize(100,20);
+    //this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
+    this->_valueText.setAbsCoor2D(-15,-20);
+    this->_valueText.setChangedTextColor(Color::white);
+    this->_valueText.setForegroundColor(Color::white);
+    this->_valueText.setBackgroundTexture(Texture());
+    this->_valueText.setBackgroundColor(Color(0,0,0,0));
   }
 
@@ -66,5 +113,14 @@
   void GLGuiEnergyWidgetVertical::resize()
   {
-    //GLGuiBox::resize();
+    Vector2D widgetSize = this->getSize2D();
+
+    this->setBorderTop(widgetSize.y * 0.1);
+    this->setBorderBottom(widgetSize.y * 0.1);
+    this->setBorderLeft(widgetSize.x * 0.2);
+    this->setBorderRight(widgetSize.x * 0.2);
+    
+    this->_bar.setWidgetSize(widgetSize.x * 0.8, widgetSize.y * 0.6);
+    this->_image.setWidgetSize(widgetSize.y * 0.6, widgetSize.y * 0.6);
+    this->_valueText.setWidgetSize(widgetSize.x* 0.8, widgetSize.y * 0.4);
   }
 
@@ -72,49 +128,7 @@
   void GLGuiEnergyWidgetVertical::showing()
   {
-    this->setAbsDir2D(270);
-    this->setBackgroundTexture(Texture());
-    this->setBackgroundColor(Color(1,1,1,0));
-    this->setBorderTop(10);
-    this->setBorderLeft(10);
-    this->setBorderRight(10);
-    this->setBorderBottom(10);
-    this->setWidgetSize(120,50);
-
-    this->_bar.setParent2D(&this->_valueText);
-    this->_bar.setBackgroundTexture(Texture());
-    this->_bar.setBackgroundColor(Color(0,0,0,0));
-    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
-    this->_bar.setForegroundColor(Color::green);
-    this->_bar.setChangedValueColor(Color(1,0,0,0.2));
-    this->_bar.setBorderTop(0);
-    this->_bar.setBorderLeft(0);
-    this->_bar.setBorderRight(0);
-    this->_bar.setBorderBottom(0);
-    this->_bar.setWidgetSize(100,30);
-    //this->_bar.setRelCoor2D(borderLeft(), 0);
-    this->_bar.setRelCoor2D(0,0);
+   
     this->_bar.show();
-  
-    this->_image.setParent2D(this);
-    this->_image.setBorderTop(0);
-    this->_image.setBorderLeft(0);
-    this->_image.setBorderRight(0);
-    this->_image.setBorderBottom(0);
-    this->_image.setWidgetSize(30,30);
-    this->_image.setForegroundColor(Color(1,1,1,0.6));
-    this->_image.setBackgroundColor(Color(1,1,1,0));
-    this->_image.setBackgroundTexture(Texture());
-    this->_image.loadImageFromFile("maps/evil-flower.png");
-    //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
-    this->_image.setRelCoor2D(0,0);
-    this->_image.setRelDir2D(90);
-    this->_image.setVisibility(true);
     this->_image.show();
-
-    this->_valueText.setParent2D(this);
-    this->_valueText.setWidgetSize(100,20);
-    //this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
-    this->_valueText.setRelCoor2D(0,0);
-    this->_valueText.setChangedTextColor(Color::black);
     this->_valueText.show();
   }
