Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3735 in orxonox.OLD


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

orxonox/branches/textEngine: minor

Location:
orxonox/branches/textEngine/src
Files:
3 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    }
  • orxonox/branches/textEngine/src/lib/graphics/font/glfont.h

    r3718 r3735  
    2626
    2727
     28
     29//! A Struct to handel Texture Coordinates for quads
     30struct TexCoord
     31{
     32  float minU;                      //!< The minimum U-Coordinate
     33  float maxU;                      //!< The maximum U-Coordinate
     34  float minV;                      //!< The minimum V-Coordinate
     35  float maxV;                      //!< The maximum V-Coordinate
     36};
     37
    2838//! A struct for handling glyphs
    2939/**
     
    3242struct Glyph
    3343{
     44  // Glyph-specific (size and so on)
    3445  Uint16 character;              //!< The character
    3546  int minX;                      //!< The minimum distance from the origin in X
     
    4253  int bearingY;                  //!< How much is above the Origin
    4354  int advance;                   //!< How big a Glyph would be in monospace-mode
    44 };
    45 
    46 //! A Struct to handel Texture Coordinates for quads
    47 struct TexCoord
    48 {
    49   float minU;                      //!< The minimum U-Coordinate
    50   float maxU;                      //!< The maximum U-Coordinate
    51   float minV;                      //!< The minimum V-Coordinate
    52   float maxV;                      //!< The maximum V-Coordinate
     55 
     56  // OpenGL-specific
     57  TexCoord texCoord;             //!< A Texture Coordinate for this glyph
    5358};
    5459
  • orxonox/branches/textEngine/src/story_entities/world.cc

    r3715 r3735  
    406406  glNewList (objectList, GL_COMPILE);
    407407 
    408   trackManager->drawGraph(.01);
     408  //  trackManager->drawGraph(.01);
    409409  trackManager->debug(2);
    410410  glEndList();
Note: See TracChangeset for help on using the changeset viewer.