- Timestamp:
- Apr 6, 2005, 5:36:38 PM (20 years ago)
- Location:
- orxonox/branches/textEngine/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/font/glfont.cc
r3718 r3735 145 145 146 146 this->setText(FONT_DEFAULT_TEXT); 147 148 this->setColor(0,255,0); 147 149 148 150 this->createTexture(); … … 449 451 * 97-122: a-z 450 452 */ 453 SDL_Color tmpColor; 454 tmpColor.r = tmpColor.g = tmpColor.b = 0; 451 455 SDL_Surface* tmpSurf = SDL_CreateRGBSurface( 452 456 SDL_SWSURFACE, 453 100 , 100,457 1000, 300, 454 458 32, 455 459 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ … … 466 470 ); 467 471 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++ ) 470 476 { 471 477 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 475 500 if( glyph ) { 476 501 char outname[64]; … … 482 507 sprintf( outname, "glyph-%d.bmp", i ); 483 508 509 SDL_SetColorKey (glyph, SDL_SRCCOLORKEY, 1); 510 if (glyph->flags & SDL_SRCALPHA) 511 printf("glyph-flags: %d\n", glyph->flags); 512 484 513 SDL_BlitSurface(glyph, NULL, tmpSurf, &tmpRect); 485 SDL_SaveBMP( tmpSurf, outname ); 514 SDL_SaveBMP(tmpSurf, outname); 515 tmpRect.x += tmpGlyph.width+1; 486 516 } 487 517 } -
orxonox/branches/textEngine/src/lib/graphics/font/glfont.h
r3718 r3735 26 26 27 27 28 29 //! A Struct to handel Texture Coordinates for quads 30 struct 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 28 38 //! A struct for handling glyphs 29 39 /** … … 32 42 struct Glyph 33 43 { 44 // Glyph-specific (size and so on) 34 45 Uint16 character; //!< The character 35 46 int minX; //!< The minimum distance from the origin in X … … 42 53 int bearingY; //!< How much is above the Origin 43 54 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 53 58 }; 54 59 -
orxonox/branches/textEngine/src/story_entities/world.cc
r3715 r3735 406 406 glNewList (objectList, GL_COMPILE); 407 407 408 trackManager->drawGraph(.01);408 // trackManager->drawGraph(.01); 409 409 trackManager->debug(2); 410 410 glEndList();
Note: See TracChangeset
for help on using the changeset viewer.