Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4104 in orxonox.OLD


Ignore:
Timestamp:
May 7, 2005, 1:55:44 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: loadScreen now loadable as well

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/glmenu/glmenu_imagescreen.cc

    r4101 r4104  
    2929/**
    3030   \brief standard constructor
    31 
    32    \todo this constructor is not jet implemented - do it
    3331*/
    3432GLMenuImageScreen::GLMenuImageScreen ()
    3533{
    36    this->setClassName ("GLMenuImageScreen");
    3734   this->init();
    3835}
    3936
    40 
     37/**
     38   \param root The Element to load the GLMenu from
     39*/
    4140GLMenuImageScreen::GLMenuImageScreen (TiXmlElement* root)
    4241{
    4342  this->init();
    44 
     43  this->load(root);
     44
     45}
     46
     47/**
     48   \brief Loads a GLMenu from an inputElement
     49   \param root The Element to load the GLMenu from
     50
     51   Tags are:
     52   \li BackgroundImage STRING: the background Image
     53   \li BarImage: STRING: the Image on the Bar
     54   \li BackgroundPS: FLOAT FLOAT FLOAT FLOAT: posX posY scaleX scaleY
     55   \li BarPS: FLOAT FLOAT FLOAT FLOAT: posX posY scaleX scaleY
     56   \li ElementCount: INT: how many elements will be loaded
     57*/
     58void GLMenuImageScreen::load(TiXmlElement* root)
     59{
    4560  const char* string;
    4661
     
    4964  if( string != NULL)
    5065    this->setBackgroundImage(string);
    51  
     66
     67  string = grabParameter(root, "BackgroundPS");
     68  if (string != NULL)
     69    {
     70      float f1, f2, f3, f4;
     71      sscanf (string, "%f %f %f %f", &f1, &f2, &f3, &f4);
     72      this->setPosition(f1,f2);
     73      this->setScale(f3,f4);
     74    }
     75
    5276  string = grabParameter( root, "BarImage");
    5377  if (string != NULL)
    5478    this->setBarImage(string);
    55 
    56 }
    57 
     79  string = grabParameter(root, "BarPS");
     80  if (string != NULL)
     81    {
     82      float f1, f2, f3, f4;
     83      sscanf (string, "%f %f %f %f", &f1, &f2, &f3, &f4);
     84      this->setBarPosScale(f1,f2,f3,f4);
     85    }
     86
     87  string = grabParameter( root, "ElementCount");
     88  if (string != NULL)
     89    this->setMaximum(atoi(string));
     90}
    5891
    5992/**
     
    72105void GLMenuImageScreen::init ()
    73106{
     107  this->setClassName ("GLMenuImageScreen");
     108
    74109  // Select Our VU Meter Background Texture
    75110  this->backMat = new Material("load_screen");
     
    200235
    201236  PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n",
    202          this->currentValue, this->maxValue);
     237            this->currentValue, this->maxValue);
    203238
    204239  /* screen size */
     
    218253  int barH = (int)(this->barH *screenHeight);
    219254 
    220   int val = (int)(((float)this->currentValue/(float)this->maxValue)
    221                   * this->barW * (float)screenWidth);
     255  float val = (float)this->currentValue/(float)this->maxValue;
     256                 
    222257  if( val > barW)
    223258    val = barW;
     
    248283  barMat->select();
    249284  glBegin(GL_TRIANGLE_STRIP);
    250   glTexCoord2i(0, 0); glVertex2i(barX, barY + barH);
    251   glTexCoord2i(1, 0); glVertex2i(barX + val, barY + barH);
    252   glTexCoord2i(0, 1); glVertex2i(barX, barY);
    253   glTexCoord2i(1, 1); glVertex2i(barX + val, barY);
     285  glTexCoord2f(0, 0); glVertex2i(barX, barY + barH);
     286  glTexCoord2f(val, 0); glVertex2i(barX + (int)(val * this->barW * (float)screenWidth), barY + barH);
     287  glTexCoord2f(0, 1); glVertex2i(barX, barY);
     288  glTexCoord2f(val, 1); glVertex2i(barX + (int)(val * this->barW * (float)screenWidth), barY);
    254289  glEnd();
    255290
  • orxonox/trunk/src/glmenu/glmenu_imagescreen.h

    r4101 r4104  
    1818  GLMenuImageScreen ();
    1919  GLMenuImageScreen (TiXmlElement* root);
     20  void load(TiXmlElement* root);
    2021  virtual ~GLMenuImageScreen ();
    2122
  • orxonox/trunk/src/story_entities/world.cc

    r4099 r4104  
    268268ErrorMessage World::load()
    269269{       
    270   PRINTF(0)("> Loading world: '%s'\n", getPath());
    271  
     270  PRINTF(3)("> Loading world: '%s'\n", getPath());
     271  TiXmlElement* element;
    272272  GameLoader* loader = GameLoader::getInstance();
    273273 
    274274  if( getPath() == NULL)
    275275    {
    276       PRINTF0("World has no path specified for loading");
     276      PRINTF(1)("World has no path specified for loading");
    277277      return (ErrorMessage){213,"Path not specified","World::load()"};
    278278    }
     
    280280  TiXmlDocument* XMLDoc = new TiXmlDocument( path);
    281281  // load the campaign document
    282   if( !XMLDoc->LoadFile())
    283     //this->glmis->step();
    284  
     282  if( !XMLDoc->LoadFile()) 
    285283  {
    286284    // report an error
    287     PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     285    PRINTF(1)("loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    288286    delete XMLDoc;
    289287    return (ErrorMessage){213,"XML File parsing error","World::load()"};
     
    297295    {
    298296      // report an error
    299       PRINTF0("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
     297      PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
    300298      delete XMLDoc;
    301299      return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"};
     
    308306  if( string == NULL)
    309307    {
    310       PRINTF0("World is missing a proper 'name'\n");
     308      PRINTF(2)("World is missing a proper 'name'\n");
    311309      string = "Unknown";
    312310      temp = new char[strlen(string + 2)];
     
    320318      this->worldName = temp;
    321319    }
    322  
    323  
     320  ////////////////
     321  // LOADSCREEN //
     322  ////////////////
     323  element = root->FirstChildElement("LoadScreen");
     324  if (element == NULL)
     325    {
     326      PRINTF(2)("no LoadScreen specified, loading default\n");
     327
     328      glmis->setBackgroundImage("pictures/load_screen.jpg");
     329      this->glmis->setMaximum(8);
     330      this->glmis->draw();
     331    }
     332  else
     333    {
     334      this->glmis->load(element);
     335      this->glmis->draw();
     336    }
     337  this->glmis->draw();
    324338  // find WorldEntities
    325   TiXmlElement* element = root->FirstChildElement( "WorldEntities");
     339  element = root->FirstChildElement("WorldEntities");
    326340 
    327341  if( element == NULL)
    328342    {
    329       PRINTF0("World is missing 'WorldEntities'\n");
     343      PRINTF(1)("World is missing 'WorldEntities'\n");
    330344    }
    331345  else
     
    333347      element = element->FirstChildElement();
    334348      // load Players/Objects/Whatever
    335       PRINTF0("Loading WorldEntities\n");
     349      PRINTF(4)("Loading WorldEntities\n");
    336350      while( element != NULL)
    337351        {
     
    345359          glmis->step(); //! \todo temporary
    346360        }
    347       PRINTF0("Done loading WorldEntities\n");
     361      PRINTF(4)("Done loading WorldEntities\n");
    348362    }
    349363 
     
    831845  glmis->setBackgroundImage("pictures/load_screen.jpg");
    832846  this->glmis->setMaximum(8);
    833   this->glmis->draw();
     847  //  this->glmis->draw();
    834848 
    835849  PRINTF(3)("World::displayLoadScreen - end\n");
Note: See TracChangeset for help on using the changeset viewer.