Changeset 3735 in orxonox.OLD for orxonox/branches/textEngine/src/lib/graphics/font/glfont.cc
- Timestamp:
- Apr 6, 2005, 5:36:38 PM (19 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.