Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 28, 2006, 3:48:13 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the gui branche back
merged with command:
https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File:
1 edited

Legend:

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

    r7753 r7919  
    3636  this->font = NULL;
    3737  this->size = textSize;
     38  this->setSizeY2D(size);
    3839  this->blending = TEXT_DEFAULT_BLENDING;
    3940  this->color = TEXT_DEFAULT_COLOR;
     
    127128
    128129/**
     130 * @brief appends one Character to the String.
     131 */
     132void Text::appendCharacter(char character)
     133{
     134  this->text += character;
     135  this->setupTextWidth();
     136}
     137
     138
     139/**
    129140 * @brief append some text to the already existing Text.
    130141 * @param appendText The text to append to this Text.
     
    135146  return this->text;
    136147}
     148
     149/**
     150 * @brief removes char characters from the Text.
     151 *
     152 * @note this function checks, if the count can be removed, and if so does it.
     153 * Otherwise the maximum count of characters will be removed.
     154 */
     155void Text::removeCharacters(unsigned int chars)
     156{
     157  if (text.size() > chars)
     158    this->text.resize(this->text.size()-chars);
     159  else if (!text.empty())
     160    text.clear();
     161  this->setupTextWidth();
     162}
     163
    137164
    138165/**
     
    188215    return;
    189216  glPushMatrix();
     217  glPushAttrib(GL_ENABLE_BIT);
    190218  // transform for alignment.
    191219  if (this->getAlignment() == TEXT_ALIGN_RIGHT)
     
    229257  }
    230258  glEnd();
     259  glPopAttrib();
    231260  glPopMatrix();
    232261}
     
    242271    if(this->font->getGlyphArray()[this->text[i]] != NULL)
    243272      width += this->font->getGlyphArray()[this->text[i]]->advance;
    244   this->setSizeX2D(width *this->getSize());
     273  this->setSizeX2D(width * this->getSize());
    245274}
    246275
Note: See TracChangeset for help on using the changeset viewer.