Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7219 in orxonox.OLD for branches/std/src/lib/graphics


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

orxonox/std: less char*

Location:
branches/std/src/lib/graphics
Files:
4 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}
  • branches/std/src/lib/graphics/graphics_engine.h

    r7203 r7219  
    1414#include "sdlincl.h"
    1515#include "glincl.h"
     16#include <list>
    1617
    17 #include <list>
     18#include "substring.h"
    1819
    1920// Forward Declaration
    2021class Text;
    2122class IniParser;
    22 class SubString;
    2323class WorldEntity;
    2424class GraphicsEffect;
     
    7474
    7575    void listModes();
    76     bool hwSupportsEXT(const char* extension);
     76    bool hwSupportsEXT(const std::string& extension);
    7777
    7878    /** @brief swaps the GL_BUFFERS */
     
    116116
    117117    // HARDWARE-Settings:
    118     char*                      hwRenderer;         //!< HW-renderer-string
    119     char*                      hwVendor;           //!< HW-vendor-string
    120     char*                      hwVersion;          //!< HW-version-string
    121     SubString*                 hwExtensions;       //!< All suported Extensions.
     118    std::string                hwRenderer;         //!< HW-renderer-string
     119    std::string                hwVendor;           //!< HW-vendor-string
     120    std::string                hwVersion;          //!< HW-version-string
     121    SubString                  hwExtensions;       //!< All suported Extensions.
    122122
    123123    // FPS-related
  • branches/std/src/lib/graphics/render2D/element_2d.cc

    r7216 r7219  
    726726void Element2D::setParentMode2D (const std::string& parentingMode)
    727727{
    728   this->setParentMode2D(Element2D::charToParentingMode2D(parentingMode));
     728  this->setParentMode2D(Element2D::stringToParentingMode2D(parentingMode));
    729729}
    730730
     
    952952            this->relCoordinate.y,
    953953            this->getAbsDir2D(),
    954             Element2D::parentingModeToChar2D(parentMode),
     954            Element2D::parentingModeToString2D(parentMode),
    955955            Element2D::layer2DToChar(this->layer));
    956956
     
    10741074 * @return the converted string
    10751075 */
    1076 const char* Element2D::parentingModeToChar2D(int parentingMode)
     1076const char* Element2D::parentingModeToString2D(int parentingMode)
    10771077{
    10781078  if (parentingMode == E2D_PARENT_LOCAL_ROTATE)
     
    10931093 * @return the int corresponding to the named parentingMode
    10941094 */
    1095 E2D_PARENT_MODE Element2D::charToParentingMode2D(const std::string& parentingMode)
     1095E2D_PARENT_MODE Element2D::stringToParentingMode2D(const std::string& parentingMode)
    10961096{
    10971097  if (parentingMode == "local-rotate")
  • branches/std/src/lib/graphics/render2D/element_2d.h

    r7216 r7219  
    212212
    213213    // helper functions //
    214     static const char* parentingModeToChar2D(int parentingMode);
    215     static E2D_PARENT_MODE charToParentingMode2D(const std::string& parentingMode);
     214    static const char* parentingModeToString2D(int parentingMode);
     215    static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode);
    216216
    217217    static const char* layer2DToChar(E2D_LAYER layer);
Note: See TracChangeset for help on using the changeset viewer.