Changeset 8761 in orxonox.OLD for trunk/src/lib/graphics/text_engine/limited_width_text.cc
- Timestamp:
- Jun 24, 2006, 2:16:12 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/limited_width_text.cc
r8619 r8761 76 76 glActiveTexture(GL_TEXTURE0); 77 77 78 glEnable(GL_BLEND); 79 glEnable(GL_TEXTURE_2D); 80 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 81 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE ); 78 // glEnable(GL_BLEND); 79 // glEnable(GL_TEXTURE_2D); 80 // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 81 // glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE ); 82 // 83 // glBindTexture(GL_TEXTURE_2D, this->font().getTexture()); 84 this->font().select(); 82 85 83 glBindTexture(GL_TEXTURE_2D, this->font()->getTexture());84 86 glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0); 85 87 glRotatef(this->getAbsDir2D(), 0, 0, 1); … … 90 92 for (unsigned int i = 0; i < this->_dotedText.size(); i++) 91 93 { 92 if(likely((tmpGlyph = this->font() ->getGlyphArray()[this->_dotedText[i]]) != NULL))94 if(likely((tmpGlyph = this->font().getGlyphArray()[this->_dotedText[i]]) != NULL)) 93 95 { 94 96 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]); … … 118 120 void LimitedWidthText::setupTextWidth() 119 121 { 120 float dotsSize = this->font() ->getGlyphArray()[46]->advance * 3.0;122 float dotsSize = this->font().getGlyphArray()[46]->advance * 3.0; 121 123 122 124 float width = 0.0f; … … 134 136 this->_dotedText = this->text().substr(0, i) + "..."; 135 137 if (i > 0) 136 width -= this->font() ->getGlyphArray()[this->text()[i-1]]->advance;138 width -= this->font().getGlyphArray()[this->text()[i-1]]->advance; 137 139 width += dotsSize; 138 140 break; 139 141 } 140 142 // Advance the Text. 141 if(this->font() ->getGlyphArray()[this->text()[i]] != NULL)142 width += this->font() ->getGlyphArray()[this->text()[i]]->advance;143 if(this->font().getGlyphArray()[this->text()[i]] != NULL) 144 width += this->font().getGlyphArray()[this->text()[i]]->advance; 143 145 } 144 146 break; … … 152 154 this->_dotedText = std::string("...") + this->text().substr(i); 153 155 if (i + 1 < (int)text().size() ) 154 width -= this->font() ->getGlyphArray()[this->text()[i+1]]->advance;156 width -= this->font().getGlyphArray()[this->text()[i+1]]->advance; 155 157 width += dotsSize; 156 158 break; 157 159 } 158 160 // Advance the Text. 159 if(this->font() ->getGlyphArray()[this->text()[i]] != NULL)160 width += this->font() ->getGlyphArray()[this->text()[i]]->advance;161 if(this->font().getGlyphArray()[this->text()[i]] != NULL) 162 width += this->font().getGlyphArray()[this->text()[i]]->advance; 161 163 } 162 164 break;
Note: See TracChangeset
for help on using the changeset viewer.