Changeset 5344 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text.cc
- Timestamp:
- Oct 10, 2005, 12:39:21 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/text.cc
r5343 r5344 38 38 if (fontFile != NULL) 39 39 this->setFont(fontFile, fontSize); 40 this->setType(type);41 }42 43 /**44 * creates a new Text Element45 * @param font the Font to render this text in46 * @param type The renderType to display this font in47 *48 * this constructor is private, because the user should initialize49 * a text with the TextEngine.50 */51 Text::Text(Font* font, TEXT_RENDER_TYPE type)52 {53 this->init();54 55 this->font = font;56 40 this->setType(type); 57 41 } … … 89 73 90 74 /** 91 * sets the Font of this Text to font92 * @param font the Font (normaly from the ResourceManager) to allocate to this Text93 */94 void Text::setFont(Font* font)95 {96 if (this->font != NULL)97 ResourceManager::getInstance()->unload(this->font);98 this->font = font;99 }100 101 /**102 75 * sets the Font of this Text to font from fontFile 103 76 * @param fontFile the File to load the Font from. … … 111 84 112 85 tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, &fontSize); 113 if (tmpFont == NULL) 86 if (tmpFont != NULL) 87 { 88 if (this->font != NULL) 89 ResourceManager::getInstance()->unload(this->font); 90 this->font = tmpFont; 91 } 92 93 else 114 94 { 115 95 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile); 116 this->setFont(NULL);117 }118 else119 this->setFont(tmpFont);96 if (this->font != NULL) 97 ResourceManager::getInstance()->unload(this->font); 98 this->font = NULL; 99 } 120 100 } 121 101
Note: See TracChangeset
for help on using the changeset viewer.