Changeset 8539 in orxonox.OLD for branches/gui/src/lib/graphics/text_engine/multi_line_text.cc
- Timestamp:
- Jun 16, 2006, 4:52:35 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/graphics/text_engine/multi_line_text.cc
r8448 r8539 61 61 void MultiLineText::draw() const 62 62 { 63 if (unlikely(this-> getText().empty()))63 if (unlikely(this->text().empty())) 64 64 return; 65 65 glPushMatrix(); … … 76 76 glActiveTexture(GL_TEXTURE0); 77 77 78 glColor4fv(&this-> getColor()[0]);78 glColor4fv(&this->color()[0]); 79 79 glEnable(GL_BLEND); 80 80 glEnable(GL_TEXTURE_2D); … … 82 82 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE ); 83 83 84 glBindTexture(GL_TEXTURE_2D, this-> getFont()->getTexture());84 glBindTexture(GL_TEXTURE_2D, this->font()->getTexture()); 85 85 glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); 86 86 glRotatef(this->getAbsDir2D(), 0, 0, 1); … … 92 92 93 93 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) 95 95 { 96 96 if (unlikely(this->lineEnds.size() > lineNumber && i == this->lineEnds[lineNumber])) … … 99 99 ++lineNumber; 100 100 posX = 0.0f; 101 posY += this->lineSpacing + this-> getSize(); //this->getFont()->getMaxHeight();101 posY += this->lineSpacing + this->size(); //this->font()->getMaxHeight(); 102 102 } 103 103 104 if(likely((tmpGlyph = this-> getFont()->getGlyphArray()[this->getText()[i]]) != NULL))104 if(likely((tmpGlyph = this->font()->getGlyphArray()[this->text()[i]]) != NULL)) 105 105 { 106 106 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]); 107 glVertex2d(posX+tmpGlyph->maxX*this-> getSize(), posY);107 glVertex2d(posX+tmpGlyph->maxX*this->size(), posY); 108 108 109 109 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()); 111 111 112 112 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()); 114 114 115 115 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]); 116 glVertex2d(posX+tmpGlyph->minX*this-> getSize(), posY);116 glVertex2d(posX+tmpGlyph->minX*this->size(), posY); 117 117 118 posX += tmpGlyph->advance * this-> getSize();118 posX += tmpGlyph->advance * this->size(); 119 119 } 120 120 } … … 132 132 this->lineEnds.clear(); 133 133 float width = 0.0f; 134 float maxWidth = this->lineWidth / this-> getSize();134 float maxWidth = this->lineWidth / this->size(); 135 135 136 for (unsigned int i = 0; i < this-> getText().size(); i++)136 for (unsigned int i = 0; i < this->text().size(); i++) 137 137 { 138 if (width > maxWidth || this-> getText()[i] == '\n')138 if (width > maxWidth || this->text()[i] == '\n') 139 139 { 140 140 if (likely(i > 0)) 141 141 { 142 142 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; 144 144 } 145 145 else … … 148 148 149 149 // 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; 152 152 } 153 153 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())); 155 155 } 156 156 … … 162 162 printf("Debug %s::%s: %d lines\n", this->getClassName(), this->getName(), this->getLineCount()); 163 163 164 std::string tmpText = this-> getText();164 std::string tmpText = this->text(); 165 165 std::vector<unsigned int> ends = this->lineEnds; 166 166 ends.push_back(tmpText.size());
Note: See TracChangeset
for help on using the changeset viewer.