Changeset 5340 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Oct 9, 2005, 11:38:38 PM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine.cc
r5339 r5340 422 422 int value = 1; 423 423 424 while ( value < input ) {424 while ( value < input ) 425 425 value <<= 1; 426 }427 426 return value; 428 427 } … … 472 471 473 472 // this->setSize(fontSize); 474 473 SDL_Surface* image = NULL; 475 474 if (xpmArray != NULL) 476 this->loadFontFromXPMArray(xpmArray); 475 image = IMG_ReadXPMFromArray(xpmArray); 476 if (image != NULL) 477 { 478 this->loadFontFromSDL_Surface(image); 479 SDL_FreeSurface(image); 480 } 481 else 482 PRINTF(1)("loading from surface failed: %s\n", IMG_GetError()); 477 483 478 484 } … … 537 543 * @param xpmArray the array of the XPM to load the font from. 538 544 */ 539 bool Font::loadFontFromXPMArray(char** xpmArray) 540 { 541 if (xpmArray == NULL) 545 bool Font::loadFontFromSDL_Surface(SDL_Surface* surface) 546 { 547 // loading to a texture. 548 if(surface == NULL) 542 549 return false; 543 544 // loading to a texture.545 SDL_Surface* image = IMG_ReadXPMFromArray(xpmArray);546 if(image == NULL)547 {548 PRINTF(1)("loading from XPM-array failed: %s\n", IMG_GetError());549 return false;550 }551 550 TexCoord texCoord; 552 this->fastTextureID = Text::loadTexture( image, &texCoord);551 this->fastTextureID = Text::loadTexture(surface, &texCoord); 553 552 554 553 // initializing the Glyphs. … … 587 586 } 588 587 } 589 SDL_FreeSurface(image);590 588 return true; 591 589 } -
trunk/src/lib/graphics/text_engine.h
r5339 r5340 171 171 // font 172 172 bool loadFont(const char* fontFile); 173 bool loadFontFrom XPMArray(char** xpmArray);173 bool loadFontFromSDL_Surface(SDL_Surface* surface); 174 174 175 175 void setSize(unsigned int fontSize);
Note: See TracChangeset
for help on using the changeset viewer.