Changeset 5420 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Oct 22, 2005, 1:57:29 PM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/render_2d.h
r5417 r5420 2 2 * @file render_2d.h 3 3 * @brief Definition of the 2D-rendering engine singleton Class 4 * @todo implement Layer-rendering 5 */ 4 */ 6 5 7 6 #ifndef _RENDER_2D_H -
trunk/src/lib/graphics/text_engine/font.cc
r5418 r5420 412 412 413 413 this->initGlyphs(32, numberOfGlyphs); 414 this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space414 // this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space 415 415 416 416 int rectSize = this->findOptimalFastTextureSize(); … … 437 437 tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h; 438 438 SDL_SetClipRect(tmpSurf, &tmpRect); 439 int maxLineHeight = 0;439 int maxLineHeight = this->getMaxHeight(); 440 440 441 441 // all the interessting Glyphs … … 453 453 { 454 454 tmpRect.x = 0; 455 tmpRect.y = tmpRect.y + maxLineHeight + 1; 456 maxLineHeight = 0; 455 tmpRect.y = tmpRect.y + maxLineHeight; 457 456 } 458 457 if (tmpRect.y + maxLineHeight > tmpSurf->h) … … 470 469 { 471 470 SDL_SetAlpha(glyphSurf, 0, 0); 472 471 int tmp = tmpRect.y; 472 tmpRect.y += this->getMaxAscent()-(int)((float)tmpGlyph->bearingY*this->renderSize); 473 473 SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect); 474 tmpGlyph->texCoord[0] = (float)tmpRect.x/(float)tmpSurf->w; 475 tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->advance*this->renderSize)/(float)tmpSurf->w; 474 tmpRect.y = tmp; 475 476 tmpGlyph->texCoord[0] = (float)(tmpRect.x)/(float)tmpSurf->w; 477 tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->width*(float)this->renderSize)/(float)tmpSurf->w; 476 478 tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w; 477 tmpGlyph->texCoord[3] = (float)(tmpRect.y+t mpGlyph->height*this->renderSize)/(float)tmpSurf->w;479 tmpGlyph->texCoord[3] = (float)(tmpRect.y+this->getMaxHeight())/(float)tmpSurf->w; 478 480 SDL_FreeSurface(glyphSurf); 479 480 tmpRect.x += (int)(tmpGlyph->advance*this->renderSize)+1; 481 482 // Outputting Glyphs to BMP-files. 481 tmpRect.x += (int)(tmpGlyph->advance * this->renderSize)+1; 482 483 483 /* 484 char outname[512]; 484 // Outputting Glyphs to BMP-files. 485 char outname[1024]; 485 486 if (i < 10) 486 487 sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i ); … … 489 490 else 490 491 sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i ); 491 SDL_SaveBMP(tmpSurf, outname); 492 */ 492 SDL_SaveBMP(tmpSurf, outname);*/ 493 493 } 494 494 } 495 495 } 496 // outputting the GLYPH-table 497 // char outName[1024]; 498 // sprintf( outName, "%s-glyphs.bmp", this->getName()); 499 // SDL_SaveBMP(tmpSurf, outName); 496 500 497 501 GLuint texture; -
trunk/src/lib/graphics/text_engine/text.cc
r5419 r5420 243 243 { 244 244 glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0); 245 glRotatef(this->getAbsDir2D(), 0, 0,1);245 glRotatef(this->getAbsDir2D(), 0, 0, 1); 246 246 Glyph* tmpGlyph; 247 247 float posX = 0.0f; … … 253 253 254 254 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]); 255 glVertex2d(posX, - tmpGlyph->bearingY * this->size);255 glVertex2d(posX, 0); 256 256 257 257 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]); 258 glVertex2d(posX, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);258 glVertex2d(posX, this->size); 259 259 260 260 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]); 261 glVertex2d(posX+tmpGlyph->width*this->size, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);261 glVertex2d(posX+tmpGlyph->width*this->size, this->size); 262 262 263 263 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]); 264 glVertex2d(posX+tmpGlyph->width*this->size, - tmpGlyph->bearingY*this->size);264 glVertex2d(posX+tmpGlyph->width*this->size, 0); 265 265 266 266 glEnd();
Note: See TracChangeset
for help on using the changeset viewer.