Changeset 7426 in orxonox.OLD for trunk/src/lib/graphics/text_engine
- Timestamp:
- Apr 28, 2006, 10:27:28 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/text.cc
r7355 r7426 65 65 void Text::setFont(const std::string& fontFile, unsigned int fontSize) 66 66 { 67 Font* tmpFont; 68 Text* newText; 69 Vector tmpVec; 70 71 // unloading the Font if we alrady have one loaded. 72 if (this->font != NULL && this->font != Font::getDefaultFont()) 73 ResourceManager::getInstance()->unload(this->font); 74 this->font = NULL; 67 Font* newFont; 68 Font* oldFont = this->font; 75 69 76 70 // load a new Font 77 71 if (!fontFile.empty()) 78 72 { 79 tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize);80 if ( tmpFont != NULL)81 this->font = tmpFont;82 else73 newFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize); 74 if (newFont == NULL) 75 { 76 newFont = Font::getDefaultFont(); 83 77 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile.c_str()); 84 } 78 } 79 } 80 else 81 newFont = Font::getDefaultFont(); 82 83 // unloading the Font if we alrady have one loaded. 84 this->font = newFont; 85 if (oldFont != NULL && oldFont != Font::getDefaultFont()) 86 ResourceManager::getInstance()->unload(oldFont); 85 87 } 86 88
Note: See TracChangeset
for help on using the changeset viewer.