Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 16, 2006, 4:52:35 PM (19 years ago)
Author:
bensch
Message:

new imrpooved interface in text

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/graphics/text_engine/multi_line_text.cc

    r8448 r8539  
    6161void MultiLineText::draw() const
    6262{
    63   if (unlikely(this->getText().empty()))
     63  if (unlikely(this->text().empty()))
    6464    return;
    6565  glPushMatrix();
     
    7676  glActiveTexture(GL_TEXTURE0);
    7777
    78   glColor4fv(&this->getColor()[0]);
     78  glColor4fv(&this->color()[0]);
    7979  glEnable(GL_BLEND);
    8080  glEnable(GL_TEXTURE_2D);
     
    8282  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE );
    8383
    84   glBindTexture(GL_TEXTURE_2D, this->getFont()->getTexture());
     84  glBindTexture(GL_TEXTURE_2D, this->font()->getTexture());
    8585  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
    8686  glRotatef(this->getAbsDir2D(), 0, 0, 1);
     
    9292
    9393  glBegin(GL_QUADS);
    94   for (unsigned int i = 0; i < this->getText().size(); ++i)
     94  for (unsigned int i = 0; i < this->text().size(); ++i)
    9595  {
    9696    if (unlikely(this->lineEnds.size() > lineNumber && i == this->lineEnds[lineNumber]))
     
    9999      ++lineNumber;
    100100      posX = 0.0f;
    101       posY += this->lineSpacing + this->getSize(); //this->getFont()->getMaxHeight();
     101      posY += this->lineSpacing + this->size(); //this->font()->getMaxHeight();
    102102    }
    103103
    104     if(likely((tmpGlyph = this->getFont()->getGlyphArray()[this->getText()[i]]) != NULL))
     104    if(likely((tmpGlyph = this->font()->getGlyphArray()[this->text()[i]]) != NULL))
    105105    {
    106106      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    107       glVertex2d(posX+tmpGlyph->maxX*this->getSize(), posY);
     107      glVertex2d(posX+tmpGlyph->maxX*this->size(), posY);
    108108
    109109      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
    110       glVertex2d(posX+tmpGlyph->maxX*this->getSize(), posY + this->getSize());
     110      glVertex2d(posX+tmpGlyph->maxX*this->size(), posY + this->size());
    111111
    112112      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
    113       glVertex2d(posX+tmpGlyph->minX*this->getSize(), posY+ this->getSize());
     113      glVertex2d(posX+tmpGlyph->minX*this->size(), posY+ this->size());
    114114
    115115      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
    116       glVertex2d(posX+tmpGlyph->minX*this->getSize(), posY);
     116      glVertex2d(posX+tmpGlyph->minX*this->size(), posY);
    117117
    118       posX += tmpGlyph->advance * this->getSize();
     118      posX += tmpGlyph->advance * this->size();
    119119    }
    120120  }
     
    132132  this->lineEnds.clear();
    133133  float width = 0.0f;
    134   float maxWidth = this->lineWidth / this->getSize();
     134  float maxWidth = this->lineWidth / this->size();
    135135
    136   for (unsigned int i = 0; i < this->getText().size(); i++)
     136  for (unsigned int i = 0; i < this->text().size(); i++)
    137137  {
    138     if (width > maxWidth || this->getText()[i] == '\n')
     138    if (width > maxWidth || this->text()[i] == '\n')
    139139    {
    140140      if (likely(i > 0))
    141141      {
    142142        this->lineEnds.push_back( i -1 );
    143         width = this->getFont()->getGlyphArray()[this->getText()[i-1]]->advance;
     143        width = this->font()->getGlyphArray()[this->text()[i-1]]->advance;
    144144      }
    145145      else
     
    148148
    149149    // Advance the Text.
    150     if(this->getFont()->getGlyphArray()[this->getText()[i]] != NULL)
    151       width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
     150    if(this->font()->getGlyphArray()[this->text()[i]] != NULL)
     151      width += this->font()->getGlyphArray()[this->text()[i]]->advance;
    152152  }
    153153  this->lineCount = lineEnds.size() + 1;
    154   this->setSizeY2D((this->lineEnds.size()+1) * (this->lineSpacing + this->getFont()->getMaxHeight()));
     154  this->setSizeY2D((this->lineEnds.size()+1) * (this->lineSpacing + this->font()->getMaxHeight()));
    155155}
    156156
     
    162162 printf("Debug %s::%s: %d lines\n", this->getClassName(), this->getName(), this->getLineCount());
    163163
    164  std::string tmpText = this->getText();
     164 std::string tmpText = this->text();
    165165 std::vector<unsigned int> ends = this->lineEnds;
    166166 ends.push_back(tmpText.size());
Note: See TracChangeset for help on using the changeset viewer.