Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5306 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Oct 7, 2005, 6:17:49 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ResourceManage-fixes

Location:
trunk/src/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/material.cc

    r5303 r5306  
    3131
    3232/**
    33  *  creates a Material.
     33 * creates a Material.
    3434 * @param mtlName Name of the Material to be added to the Material List
    35 */
     35 */
    3636Material::Material (const char* mtlName)
    3737{
     
    105105    glShadeModel(GL_SMOOTH);
    106106
    107   if (this->diffuseTexture)
     107  if (this->diffuseTexture != NULL)
    108108    {
    109109      glEnable(GL_TEXTURE_2D);
  • trunk/src/lib/graphics/importer/texture.cc

    r5305 r5306  
    3333{
    3434  this->setClassID(CL_TEXTURE, "Texture");
     35  this->setName(imageName);
    3536
    3637  this->bAlpha = false;
  • trunk/src/lib/graphics/text_engine.cc

    r5290 r5306  
    4242/// TEXT ///
    4343////////////
     44
     45/**
     46 *  creates a new Text Element
     47 * @param fontFile the Font to render this text in
     48 * @param type The renderType to display this font in
     49 */
     50Text::Text(const char* fontFile, unsigned int fontSize, TEXT_RENDER_TYPE type)
     51{
     52  this->init();
     53
     54  if (fontFile != NULL)
     55    this->setFont(fontFile, fontSize);
     56  this->setType(type);
     57}
     58
    4459/**
    4560 *  creates a new Text Element
    4661 * @param font the Font to render this text in
    4762 * @param type The renderType to display this font in
    48 
    49    this constructor is private, because the user should initialize
    50    a text with the TextEngine.
    51 */
     63 *
     64 * this constructor is private, because the user should initialize
     65 * a text with the TextEngine.
     66 */
    5267Text::Text(Font* font, TEXT_RENDER_TYPE type)
    5368{
     69  this->init();
     70
     71  this->font = font;
     72  this->setType(type);
     73}
     74
     75/**
     76 *  deletes a Text out of memory
     77 *
     78 * This also ereases the text from the textList of the TextEngine
     79*/
     80Text::~Text()
     81{
     82  if (this->font != NULL)
     83    ResourceManager::getInstance()->unload(this->font);
     84
     85  if (this->text)
     86    delete[] this->text;
     87}
     88
     89void Text::init()
     90{
    5491  this->setClassID(CL_TEXT, "Text");
    5592
    5693  // initialize this Text
    57   this->font = font;
     94  this->font = NULL;
    5895  this->text = NULL;
    5996  this->externText = NULL;
     
    6299  this->blending = TEXT_DEFAULT_BLENDING;
    63100  this->color = TEXT_DEFAULT_COLOR;
    64   this->setType(type);
     101  this->setType(TEXT_RENDER_DYNAMIC);
    65102
    66103  this->setText(NULL);
    67 }
    68 
    69 /**
    70  *  deletes a Text out of memory
    71  *
    72  * This also ereases the text from the textList of the TextEngine
    73 */
    74 Text::~Text()
    75 {
    76   if (this->font != NULL)
    77     ResourceManager::getInstance()->unload(this->font);
    78 
    79   if (this->text)
    80     delete[] this->text;
    81104}
    82105
  • trunk/src/lib/graphics/text_engine.h

    r5275 r5306  
    105105class Text : public Element2D
    106106{
     107  friend class TextEngine;
    107108 public:
    108    Text(Font* font = NULL, TEXT_RENDER_TYPE type = TEXT_RENDER_DYNAMIC);
     109   Text(const char* fontFile, unsigned int fontSize = FONT_DEFAULT_SIZE, TEXT_RENDER_TYPE type = TEXT_RENDER_DYNAMIC);
    109110  ~Text();
    110111
    111   void setFont(Font* font);
     112  void init();
     113
    112114  void setFont(const char* fontFile, unsigned int fontSize);
    113115  void setType(TEXT_RENDER_TYPE type);
     
    128130
    129131 private:
    130   static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
    131   static int powerOfTwo(int input);
     132   Text(Font* font = NULL, TEXT_RENDER_TYPE type = TEXT_RENDER_DYNAMIC);
     133   void setFont(Font* font);
     134
     135   static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
     136   static int powerOfTwo(int input);
    132137
    133138 private:
  • trunk/src/lib/shell/shell_input.cc

    r5254 r5306  
    4141 * this also generates a ShellCompletion automatically.
    4242*/
    43 ShellInput::ShellInput ()
     43ShellInput::ShellInput () : Text ((const char*)NULL)
    4444{
    4545  this->pressedKey = SDLK_FIRST;
Note: See TracChangeset for help on using the changeset viewer.