Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 6, 2005, 5:36:38 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: minor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/lib/graphics/font/glfont.cc

    r3718 r3735  
    145145
    146146  this->setText(FONT_DEFAULT_TEXT);
     147 
     148  this->setColor(0,255,0);
    147149
    148150  this->createTexture();
     
    449451   *  97-122: a-z
    450452   */
     453  SDL_Color tmpColor;
     454  tmpColor.r = tmpColor.g = tmpColor.b = 0;
    451455  SDL_Surface* tmpSurf =  SDL_CreateRGBSurface(
    452456                                               SDL_SWSURFACE,
    453                                                100, 100,
     457                                               1000, 300,
    454458                                               32,
    455459#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
     
    466470                                               );
    467471  SDL_Rect tmpRect;
    468   tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = 100; tmpRect.h = 100;
    469   for ( int i = 65; i <= 90; i++ )
     472
     473  tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h;
     474  SDL_SetClipRect(tmpSurf, &tmpRect);
     475  for ( int i = 33; i <= 122; i++ )
    470476    {
    471477      SDL_Surface* glyph = NULL;
    472      
    473       glyph = TTF_RenderGlyph_Blended( this->font, i, this->currentText->color );
    474      
     478      SDL_Surface* glyph2 = NULL;
     479      Glyph tmpGlyph;
     480
     481      tmpGlyph = getGlyphMetrics(i);
     482      if (tmpRect.x+tmpGlyph.width > tmpSurf->w)
     483        {
     484          tmpRect.x = 0;
     485          tmpRect.y = tmpRect.y+tmpGlyph.height+1;
     486          printf("x:%d, y:%d\n", tmpRect.x, tmpRect.y);
     487        }
     488      if (tmpRect.y +tmpGlyph.height > tmpSurf->h)
     489        {
     490          PRINTF(1)("Protection, so font cannot write over the boundraries error\n");
     491          break;
     492        }
     493
     494
     495      glyph = TTF_RenderGlyph_Shaded(this->font,
     496                                     i,
     497                                     this->currentText->color,
     498                                     tmpColor);
     499
    475500      if( glyph ) {
    476501        char outname[64];
     
    482507          sprintf( outname, "glyph-%d.bmp", i );
    483508
     509        SDL_SetColorKey (glyph, SDL_SRCCOLORKEY, 1);
     510        if (glyph->flags & SDL_SRCALPHA)
     511          printf("glyph-flags: %d\n", glyph->flags);
     512
    484513        SDL_BlitSurface(glyph, NULL, tmpSurf, &tmpRect);
    485         SDL_SaveBMP( tmpSurf, outname );
     514        SDL_SaveBMP(tmpSurf, outname);
     515        tmpRect.x += tmpGlyph.width+1;
    486516      }
    487517    }
Note: See TracChangeset for help on using the changeset viewer.