Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5368 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text.cc


Ignore:
Timestamp:
Oct 13, 2005, 12:00:01 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: rendering font with RenderSize, but not with TextSize. This makes the Font more controllable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/text.cc

    r5367 r5368  
    3232 * @param type The renderType to display this font in
    3333 */
    34 Text::Text(const char* fontFile, unsigned int fontSize, TEXT_RENDER_TYPE type)
     34Text::Text(const char* fontFile, unsigned int textSize, TEXT_RENDER_TYPE type)
    3535{
    3636  this->init();
    3737
    3838  if (fontFile != NULL)
    39     this->setFont(fontFile, fontSize);
     39    this->setFont(fontFile, textSize);
    4040  this->setType(type);
     41  this->size = textSize;
    4142}
    4243
     
    109110void Text::setType(TEXT_RENDER_TYPE type)
    110111{
    111   if (this->font != NULL && this->font->font)
     112  if (this->font != NULL && this->font->fontTTF)
    112113    this->type = type;
    113114  else
     
    150151    Glyph** glyphArray = this->font->getGlyphArray();
    151152
    152     int width = 0;
     153    float width = 0;
    153154    const char* tmpText = this->externText;
    154155    if (this->externText == NULL)
     
    184185  {
    185186    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,
    187188                                     this->text,
    188189                                     theColor);
     
    248249          glBegin(GL_QUADS);
    249250          glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
    250           glVertex2d(0, - tmpGlyph->bearingY);
     251          glVertex2d(0, - tmpGlyph->bearingY * this->size);
    251252          glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
    252           glVertex2d(0, tmpGlyph->height - tmpGlyph->bearingY);
     253          glVertex2d(0, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);
    253254          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);
    255256          glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    256           glVertex2d(tmpGlyph->width, - tmpGlyph->bearingY);
     257          glVertex2d(tmpGlyph->width*this->size, - tmpGlyph->bearingY*this->size);
    257258          glEnd();
    258259          glEndList();
    259           glTranslatef(glyphArray[*tmpText]->width, 0, 0);
     260          glTranslatef(glyphArray[*tmpText]->width*this->size, 0, 0);
    260261        }
    261262        tmpText++;
     
    371372  glGenTextures(1, &texture);
    372373  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);
    374375  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    375376  glTexImage2D(GL_TEXTURE_2D,
Note: See TracChangeset for help on using the changeset viewer.