Index: orxonox/branches/trackManager/src/glmenu_imagescreen.cc
===================================================================
--- orxonox/branches/trackManager/src/glmenu_imagescreen.cc	(revision 3369)
+++ orxonox/branches/trackManager/src/glmenu_imagescreen.cc	(revision 3430)
@@ -18,8 +18,17 @@
 
 #include "glmenu_imagescreen.h"
-#include "importer/texture.h"
+
+#include "importer/material.h"
 
 using namespace std;
 
+GLMenuImageScreen* GLMenuImageScreen::singletonRef = 0;
+
+GLMenuImageScreen* GLMenuImageScreen::getInstance()
+{
+  if( singletonRef == NULL)
+    singletonRef = new GLMenuImageScreen ();
+  return singletonRef;
+}
 
 /**
@@ -39,5 +48,9 @@
    \todo this deconstructor is not jet implemented - do it
 */
-GLMenuImageScreen::~GLMenuImageScreen () {}
+GLMenuImageScreen::~GLMenuImageScreen() 
+{
+  if (backMat)
+    delete backMat;
+}
 
 
@@ -58,7 +71,4 @@
   glMatrixMode(GL_MODELVIEW); 
 
-  this->backTex = new Texture();
-  this->backTex->loadImage("orx_tex.bmp");
-
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glLoadIdentity();
@@ -71,6 +81,8 @@
   
   // Select Our VU Meter Background Texture
-  this->backTex = new Texture();
-  this->backTex->loadImage("load_screen.jpg");
+  this->backMat = new Material("load_screen");
+  this->backMat->setDiffuseMap("../data/pictures/load_screen.jpg");
+  this->maxValue = 10;
+  this->currentValue = 0;
 
   // End of Background image code.
@@ -126,22 +138,24 @@
   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
 
-  // Screen Size.
+  /* screen size */
   int screenWidth = 640;
   int screenHeight = 480;
   
-  // Set Image Size.
+  /* set image size */
   int imageWidth = 640;
   int imageHeight = 480;
   
-  // Start pos of image.
+  /* start pos of image */
   int offsetX = (screenWidth - imageWidth)/2;
   int offsetY = (screenHeight - imageHeight)/2;
   
-  glEnable(GL_BLEND);
-  glEnable(GL_TEXTURE_2D);
-
-  glPushAttrib(GL_LIGHTING_BIT | GL_TRANSFORM_BIT);
-  
-  glDisable(GL_LIGHTING);
+  /* loadbar pos */
+  int barX = 390;
+  int barY = 50;
+  int barWidth = 230;
+  int barHeight = 30;
+
+  int val = (int)((float)this->currentValue/(float)this->maxValue) * barWidth;
+
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
@@ -152,23 +166,56 @@
   glLoadIdentity();
   glPushMatrix();
+
   glEnable(GL_BLEND);
-
+  glPushAttrib(GL_LIGHTING_BIT | GL_TRANSFORM_BIT);
+  glDisable(GL_LIGHTING);
+
+  backMat->select();
+  glBegin(GL_QUADS);
+  glColor3f(0.96, 0.84, 0.34);
+  glVertex2i(barX, barY);
+  glVertex2i(barX + val, barY);
+  glVertex2i(barX + val, barY + barHeight);
+  glVertex2i(barX, barY + barHeight);
+  glColor3f(1.0, 1.0, 1.0);
+  glEnd();
+
+  glBegin(GL_QUADS);
+  glColor3f(0.0, 0.0, 0.0);
+  glVertex2i(barX, barY);
+  glVertex2i(barX + barWidth, barY);
+  glVertex2i(barX + barWidth, barY + barHeight);
+  glVertex2i(barX, barY + barHeight);
+  glColor3f(1.0, 1.0, 1.0);
+  glEnd();
+
+  /* draw black border */
+  glBegin(GL_QUADS);
+  glColor3f(0.0, 0.0, 0.0);
+  glVertex2i(barX-1, barY-1);
+  glVertex2i(barX + barWidth +1, barY-1);
+  glVertex2i(barX + barWidth+1, barY + barHeight+1);
+  glVertex2i(barX - 1, barY + barHeight +1);
+  glColor3f(1.0, 1.0, 1.0);
+  glEnd();
+
+  /* draw white border */
+  glBegin(GL_QUADS);
+  glColor3f(1.0, 1.0, 1.0);
+  glVertex2i(barX-2, barY-2);
+  glVertex2i(barX + barWidth +2, barY-2);
+  glVertex2i(barX + barWidth+2, barY + barHeight+2);
+  glVertex2i(barX - 2, barY + barHeight +2);
+  glColor3f(1.0, 1.0, 1.0);
+  glEnd();
+
+  glEnable(GL_TEXTURE_2D);
   glBegin(GL_QUADS);
   glTexCoord2i(0, 0); glVertex2i(offsetX, offsetY);
-  glTexCoord2i(1, 0 ); glVertex2i(offsetX + imageWidth, offsetY);
-  glTexCoord2i( 1, 1 ); glVertex2i(offsetX + imageWidth, offsetY + imageHeight);
-  glTexCoord2i( 0, 1 ); glVertex2i(offsetX, offsetY + imageHeight);
-  glEnd();
-
+  glTexCoord2i(1, 0); glVertex2i(offsetX + imageWidth, offsetY);
+  glTexCoord2i(1, 1); glVertex2i(offsetX + imageWidth, offsetY + imageHeight);
+  glTexCoord2i(0, 1); glVertex2i(offsetX, offsetY + imageHeight);
+  glEnd();
   glDisable(GL_TEXTURE_2D);
-
-  glBegin(GL_QUADS);
-  glColor3f(1.0, 0.0, 0.0);
-  glVertex2i(100, 100);
-  glVertex2i(200, 100);
-  glVertex2i(200, 150);
-  glVertex2i(100, 150);
-  glEnd();
-
 
   glDisable(GL_BLEND);
@@ -179,5 +226,4 @@
 
   SDL_GL_SwapBuffers();                    
-  SDL_Delay(1000);
 }
  
@@ -213,7 +259,7 @@
    \param maximum of steps
 */
-void GLMenuImageScreen::setMaximum(int maxStep)
-{
-  this->maxStep = maxStep;
+void GLMenuImageScreen::setMaximum(int maxValue)
+{
+  this->maxValue = maxValue;
 }
 
@@ -224,5 +270,5 @@
 int GLMenuImageScreen::getMaximum()
 {
-  return this->maxStep;
+  return this->maxValue;
 }
 
@@ -256,3 +302,4 @@
 {
   this->currentValue++;
-}
+  this->draw();
+}
