Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6349 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Dec 30, 2005, 5:32:59 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: minor fix in the TextEngine

Location:
trunk/src/lib/graphics/text_engine
Files:
3 edited

Legend:

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

    r5859 r6349  
    247247 * @param fileName the File to write the image into.
    248248 */
    249 void Font::createAsciiImage(const char* fileName)
     249void Font::createAsciiImage(const char* fileName, uint size) const
    250250{
    251251  if (this->fontTTF == NULL)
     
    258258  SDL_Rect tmpRect; // this represents a Rectangle for blitting.
    259259  SDL_Surface* tmpSurf =  SDL_CreateRGBSurface(SDL_SWSURFACE,
    260                                                height*16, height*16,
     260                                               height*size, height*size,
    261261                                               32,
    262262#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
     
    286286      {
    287287        SDL_Color white = {255, 255, 255};
    288         glyphSurf = TTF_RenderGlyph_Blended(this->fontTTF, posX+16*posY, white);
     288        glyphSurf = TTF_RenderGlyph_Blended(this->fontTTF, posX+size*posY, white);
    289289      }
    290290      if( glyphSurf != NULL )
     
    326326 * @returns the maximum height of the Font, if the font was initialized, 0 otherwise
    327327 */
    328 int Font::getMaxHeight()
     328int Font::getMaxHeight() const
    329329{
    330330  if (likely (this->fontTTF != NULL))
     
    339339   the ascent is the pixels of the font above the baseline
    340340 */
    341 int Font::getMaxAscent()
     341int Font::getMaxAscent() const
    342342{
    343343  if (likely(this->fontTTF != NULL))
     
    352352   the descent is the pixels of the font below the baseline
    353353 */
    354 int Font::getMaxDescent()
     354int Font::getMaxDescent() const
    355355{
    356356  if (likely(this->fontTTF != NULL))
  • trunk/src/lib/graphics/text_engine/font.h

    r5768 r6349  
    7878    inline static Font* getDefaultFont() { if (Font::defaultFont == NULL) initDefaultFont(); return Font::defaultFont; };
    7979
    80     void createAsciiImage(const char* fileName);
     80    void createAsciiImage(const char* fileName, uint size) const;
    8181    static void initDefaultFont();
    8282    static void removeDefaultFont();
    8383
    8484  private:
    85     int getMaxHeight();
    86     int getMaxAscent();
    87     int getMaxDescent();
     85    int getMaxHeight() const;
     86    int getMaxAscent() const;
     87    int getMaxDescent() const;
    8888    Glyph* getGlyphMetrics(Uint16 character);
    8989
  • trunk/src/lib/graphics/text_engine/text.cc

    r5768 r6349  
    199199    Glyph* tmpGlyph;
    200200    float posX = 0.0f;
     201
     202    glBegin(GL_QUADS);
    201203    while (likely(*tmpText != '\0'))
    202204    {
    203205      if(likely((tmpGlyph = glyphArray[*tmpText]) != NULL))
    204206      {
    205         glBegin(GL_QUADS);
     207        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
     208        glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), 0);
     209
     210        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
     211        glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), this->getSizeY2D());
     212
     213        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
     214        glVertex2d(posX, this->getSizeY2D());
    206215
    207216        glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
    208217        glVertex2d(posX, 0);
    209218
    210         glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
    211         glVertex2d(posX, this->getSizeY2D());
    212 
    213         glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
    214         glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), this->getSizeY2D());
    215 
    216         glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    217         glVertex2d(posX+tmpGlyph->width*this->getSizeY2D(), 0);
    218 
    219         glEnd();
    220         glEndList();
    221219        posX += tmpGlyph->advance * this->getSizeY2D();
    222220      }
    223221      ++tmpText;
    224222    }
     223    glEnd();
    225224  }
    226225
Note: See TracChangeset for help on using the changeset viewer.