Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 12, 2006, 5:14:44 PM (18 years ago)
Author:
bensch
Message:

orxonox/std: less char*

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/graphics/graphics_engine.cc

    r7211 r7219  
    7878  this->screen = NULL;
    7979
    80 
    81   // Hardware
    82   this->hwRenderer = NULL;
    83   this->hwVendor = NULL;
    84   this->hwVersion = NULL;
    85   this->hwExtensions = NULL;
    86 
    8780  // initialize the Modules
    8881  TextEngine::getInstance();
     
    10396  // delete what has to be deleted here
    10497  this->displayFPS( false );
    105 
    106   delete[] this->hwRenderer;
    107   delete[] this->hwVendor;
    108   delete[] this->hwVersion;
    109   delete this->hwExtensions;
    11098
    11199  //TextEngine
     
    312300  //  printf("%s %s %s\n %s", renderer, vendor, version, extensions);
    313301
    314   if (this->hwRenderer == NULL && renderer != NULL)
    315   {
    316     this->hwRenderer = new char[strlen(renderer)+1];
    317     strcpy(this->hwRenderer, renderer);
    318   }
    319   if (this->hwVendor == NULL && vendor != NULL)
    320   {
    321     this->hwVendor = new char[strlen(vendor)+1];
    322     strcpy(this->hwVendor, vendor);
    323   }
    324   if (this->hwVersion == NULL && version != NULL)
    325   {
    326     this->hwVersion = new char[strlen(version)+11];
    327     strcpy(this->hwVersion, version);
    328   }
    329 
    330   if (this->hwExtensions == NULL && extensions != NULL)
    331     this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), " \n\t,");
     302  if (renderer != NULL)
     303  {
     304    this->hwRenderer == renderer;
     305  }
     306  if (vendor != NULL)
     307  {
     308    this->hwVendor == vendor;
     309  }
     310  if (version != NULL)
     311  {
     312    this->hwVersion == version;
     313  }
     314
     315  if (extensions != NULL)
     316    this->hwExtensions.split(extensions, " \n\t,");
    332317
    333318  PRINT(4)("Running on : vendor: %s,  renderer: %s,  version:%s\n", vendor, renderer, version);
    334319  PRINT(4)("Extensions:\n");
    335   if (this->hwExtensions != NULL)
    336     for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++)
    337       PRINT(4)("%d: %s\n", i, this->hwExtensions->getString(i));
     320  for (unsigned int i = 0; i < this->hwExtensions.getCount(); i++)
     321    PRINT(4)("%d: %s\n", i, this->hwExtensions.getString(i).c_str());
    338322
    339323
     
    529513 * @return true if it is, false otherwise
    530514 */
    531 bool GraphicsEngine::hwSupportsEXT(const char* extension)
    532 {
    533   if (this->hwExtensions != NULL)
    534     for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++)
    535       if ( this->hwExtensions->getString(i) == extension)
    536         return true;
     515bool GraphicsEngine::hwSupportsEXT(const std::string& extension)
     516{
     517  for (unsigned int i = 0; i < this->hwExtensions.getCount(); i++)
     518    if ( this->hwExtensions.getString(i) == extension)
     519      return true;
    537520  return false;
    538521}
     
    587570void GraphicsEngine::draw() const
    588571{
    589 //  LightManager::getInstance()->draw();
     572  //  LightManager::getInstance()->draw();
    590573
    591574  GraphicsEngine::storeMatrices();
     
    668651  switch (event.type)
    669652  {
    670       case EV_VIDEO_RESIZE:
    671       this->resolutionChanged(event.resize);
    672       break;
    673   }
    674 }
     653  case EV_VIDEO_RESIZE:
     654    this->resolutionChanged(event.resize);
     655    break;
     656  }
     657}
Note: See TracChangeset for help on using the changeset viewer.