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/limited_width_text.cc

    r8538 r8539  
    6262  // drawing this Text.
    6363  // setting the Blending effects
    64   glColor4fv(&this->getColor()[0]);
     64  glColor4fv(&this->color()[0]);
    6565
    6666
     
    7272  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE );
    7373
    74   glBindTexture(GL_TEXTURE_2D, this->getFont()->getTexture());
     74  glBindTexture(GL_TEXTURE_2D, this->font()->getTexture());
    7575  glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0);
    7676  glRotatef(this->getAbsDir2D(), 0, 0, 1);
     
    8181  for (unsigned int i = 0; i < this->_dotedText.size(); i++)
    8282  {
    83     if(likely((tmpGlyph = this->getFont()->getGlyphArray()[this->_dotedText[i]]) != NULL))
     83    if(likely((tmpGlyph = this->font()->getGlyphArray()[this->_dotedText[i]]) != NULL))
    8484    {
    8585      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    86       glVertex2d(posX+tmpGlyph->maxX*this->getSize(), 0);
     86      glVertex2d(posX+tmpGlyph->maxX*this->size(), 0);
    8787
    8888      glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
    89       glVertex2d(posX+tmpGlyph->maxX*this->getSize(), this->getSize());
     89      glVertex2d(posX+tmpGlyph->maxX*this->size(), this->size());
    9090
    9191      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
    92       glVertex2d(posX+tmpGlyph->minX*this->getSize(), this->getSize());
     92      glVertex2d(posX+tmpGlyph->minX*this->size(), this->size());
    9393
    9494      glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
    95       glVertex2d(posX+tmpGlyph->minX*this->getSize(), 0);
     95      glVertex2d(posX+tmpGlyph->minX*this->size(), 0);
    9696
    97       posX += tmpGlyph->advance * this->getSize();
     97      posX += tmpGlyph->advance * this->size();
    9898    }
    9999  }
     
    109109void LimitedWidthText::setupTextWidth()
    110110{
    111   float dotsSize = this->getFont()->getGlyphArray()[46]->advance * 3.0;
     111  float dotsSize = this->font()->getGlyphArray()[46]->advance * 3.0;
    112112
    113113  float width = 0.0f;
    114   float maxWidth = this->_lineWidth / this->getSize();
     114  float maxWidth = this->_lineWidth / this->size();
    115115
    116116  switch (this->_dotsPosition)
    117117  {
    118118    case End:
    119       for (unsigned int i = 0; i < this->getText().size(); i++)
     119      for (unsigned int i = 0; i < this->text().size(); i++)
    120120      {
    121121        if (width + dotsSize > maxWidth )
    122122        {
    123           this->_dotedText = this->getText().substr(0, i) + "...";
     123          this->_dotedText = this->text().substr(0, i) + "...";
    124124          width += dotsSize;
    125125          break;
    126126        }
    127127        // Advance the Text.
    128         if(this->getFont()->getGlyphArray()[this->getText()[i]] != NULL)
    129           width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
     128        if(this->font()->getGlyphArray()[this->text()[i]] != NULL)
     129          width += this->font()->getGlyphArray()[this->text()[i]]->advance;
    130130      }
    131131      this->setSizeX2D(width);
    132132      break;
    133133    case Begin:
    134       for (unsigned int i = this->getText().size() - 1; i < 0; i--)
     134      for (unsigned int i = this->text().size() - 1; i < 0; i--)
    135135      {
    136136        if (width + dotsSize > maxWidth )
    137137        {
    138           this->_dotedText = std::string("...") + this->getText().substr(i);
     138          this->_dotedText = std::string("...") + this->text().substr(i);
    139139          width += dotsSize;
    140140          break;
    141141        }
    142142        // Advance the Text.
    143         if(this->getFont()->getGlyphArray()[this->getText()[i]] != NULL)
    144           width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
     143        if(this->font()->getGlyphArray()[this->text()[i]] != NULL)
     144          width += this->font()->getGlyphArray()[this->text()[i]]->advance;
    145145      }
    146146      this->setSizeX2D(width);
Note: See TracChangeset for help on using the changeset viewer.