Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7455 in orxonox.OLD for trunk


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

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

Location:
trunk/src/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/BuildLibs.am

    r7453 r7455  
    22libORXlibs_a_LIBRARIES_ = \
    33                $(LIB_PREFIX)/libORXlibs.a \
     4                $(LIB_PREFIX)/shell/libORXshell.a \
    45                $(LIB_PREFIX)/gui/gtk_gui/libORXgui.a \
    56                $(LIB_PREFIX)/gui/gl_gui/libORXglgui.a \
  • trunk/src/lib/graphics/text_engine/multi_line_text.cc

    r7454 r7455  
    9191  for (unsigned int i = 0; i < this->getText().size(); ++i)
    9292  {
    93     if (unlikely(this->getText()[i] == '\n' || i == this->lineEnds[lineNumber]))
     93    if (unlikely(!this->lineEnds.empty() && i == this->lineEnds[lineNumber]))
    9494    {
    9595      // go to the next Line.
     
    140140      width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
    141141  }
    142   this->setSizeY2D(this->lineEnds.size() * (this->lineSpacing+this->getFont()->getMaxHeight()));
     142  this->setSizeY2D(this->lineEnds.size() * (this->lineSpacing + this->getFont()->getMaxHeight()));
    143143}
  • 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.
  • trunk/src/lib/shell/shell_input.cc

    r7452 r7455  
    4646  */
    4747  ShellInput::ShellInput ()
    48       : Text ("")
    49   {
     48      : MultiLineText ("")
     49  {
     50    this->setLineWidth(100);
     51
    5052    this->pressedKey = SDLK_FIRST;
    5153    this->setClassID(CL_SHELL_INPUT, "ShellInput");
  • trunk/src/lib/shell/shell_input.h

    r7452 r7455  
    1010#define _SHELL_INPUT_H
    1111
    12 #include "text.h"
     12#include "multi_line_text.h"
    1313#include "event_listener.h"
    1414#include "shell_completion.h"
     
    2828   * [UP] and [DOWN] move through the history of allready given commands.
    2929   */
    30   class ShellInput : public Text,  public EventListener
     30  class ShellInput : public MultiLineText,  public EventListener
    3131  {
    3232
Note: See TracChangeset for help on using the changeset viewer.