Changeset 5368 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text.cc
- Timestamp:
- Oct 13, 2005, 12:00:01 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/text.cc
r5367 r5368 32 32 * @param type The renderType to display this font in 33 33 */ 34 Text::Text(const char* fontFile, unsigned int fontSize, TEXT_RENDER_TYPE type)34 Text::Text(const char* fontFile, unsigned int textSize, TEXT_RENDER_TYPE type) 35 35 { 36 36 this->init(); 37 37 38 38 if (fontFile != NULL) 39 this->setFont(fontFile, fontSize);39 this->setFont(fontFile, textSize); 40 40 this->setType(type); 41 this->size = textSize; 41 42 } 42 43 … … 109 110 void Text::setType(TEXT_RENDER_TYPE type) 110 111 { 111 if (this->font != NULL && this->font->font )112 if (this->font != NULL && this->font->fontTTF) 112 113 this->type = type; 113 114 else … … 150 151 Glyph** glyphArray = this->font->getGlyphArray(); 151 152 152 int width = 0;153 float width = 0; 153 154 const char* tmpText = this->externText; 154 155 if (this->externText == NULL) … … 184 185 { 185 186 SDL_Color theColor = { (int)(this->color.x*255), (int)(this->color.y*255), (int)(this->color.z*255) }; 186 tmpSurf = TTF_RenderText_Blended(this->font->font ,187 tmpSurf = TTF_RenderText_Blended(this->font->fontTTF, 187 188 this->text, 188 189 theColor); … … 248 249 glBegin(GL_QUADS); 249 250 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]); 250 glVertex2d(0, - tmpGlyph->bearingY );251 glVertex2d(0, - tmpGlyph->bearingY * this->size); 251 252 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]); 252 glVertex2d(0, tmpGlyph->height - tmpGlyph->bearingY);253 glVertex2d(0, (tmpGlyph->height - tmpGlyph->bearingY)*this->size); 253 254 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]); 254 glVertex2d(tmpGlyph->width , tmpGlyph->height - tmpGlyph->bearingY);255 glVertex2d(tmpGlyph->width*this->size, (tmpGlyph->height - tmpGlyph->bearingY)*this->size); 255 256 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]); 256 glVertex2d(tmpGlyph->width , - tmpGlyph->bearingY);257 glVertex2d(tmpGlyph->width*this->size, - tmpGlyph->bearingY*this->size); 257 258 glEnd(); 258 259 glEndList(); 259 glTranslatef(glyphArray[*tmpText]->width , 0, 0);260 glTranslatef(glyphArray[*tmpText]->width*this->size, 0, 0); 260 261 } 261 262 tmpText++; … … 371 372 glGenTextures(1, &texture); 372 373 glBindTexture(GL_TEXTURE_2D, texture); 373 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_ NEAREST);374 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 374 375 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 375 376 glTexImage2D(GL_TEXTURE_2D,
Note: See TracChangeset
for help on using the changeset viewer.