Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7455 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text.cc


Ignore:
Timestamp:
Apr 29, 2006, 10:38:12 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: fixed a SegFault (that this worked before is some wonder :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/text.cc

    r7453 r7455  
    3535  // initialize this Text
    3636  this->font = NULL;
    37   this->text = "";
    38   this->setAlignment(TEXT_DEFAULT_ALIGNMENT);
     37
     38  this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
     39
    3940  this->blending = TEXT_DEFAULT_BLENDING;
    4041  this->color = TEXT_DEFAULT_COLOR;
    41 
    42   if (!fontFile.empty())
    43     this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
    44 
     42  this->setAlignment(TEXT_DEFAULT_ALIGNMENT);
    4543  this->setSize(TEXT_DEFAULT_SIZE);
    4644}
     
    6361void Text::setFont(const std::string& fontFile, unsigned int fontSize)
    6462{
    65   Font* newFont;
     63  Font* newFont = NULL;
    6664  Font* oldFont = this->font;
    6765
     
    7674    }
    7775  }
    78   else
     76  if (newFont == NULL)
    7977    newFont = Font::getDefaultFont();
     78  assert(newFont != NULL);
    8079
    8180  // unloading the Font if we alrady have one loaded.
Note: See TracChangeset for help on using the changeset viewer.