Changeset 9869 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text_engine.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/text_engine.cc
r9406 r9869 33 33 34 34 #include "graphics_engine.h" 35 #include "util/loading/resource_manager.h"36 #include "class_list.h"37 35 38 36 #include "debug.h" … … 40 38 /// TEXT-ENGINE /// 41 39 /////////////////// 40 ObjectListDefinition(TextEngine); 42 41 /** 43 42 * standard constructor … … 45 44 TextEngine::TextEngine () 46 45 { 47 this->setClassID(CL_TEXT_ENGINE, "TextEngine");48 49 46 this->registerObject(this, TextEngine::_objectList); 47 this->setName("TextEngine"); 48 this->enableFonts(); 50 49 } 51 50 … … 62 61 { 63 62 // first remove all the remaining Texts (if any). 64 const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT); 65 if (textList != NULL) 66 { 67 while(textList->size() > 0) 68 delete dynamic_cast<Text*>(textList->front()); 69 } 63 while (!Text::objectList().empty()) 64 delete Text::objectList().front(); 70 65 // delete all remaining fonts (There should not be Anything to do here) 71 const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT); 72 if (fontList != NULL) 66 67 //const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT); 68 //if (fontList != NULL) 73 69 { 74 70 ///FIXME 75 // while (fontList->size() > 0)71 // while (fontList->size() > 0) 76 72 { 77 // Font* font = dynamic_cast<Font*>(fontList->back());73 // Font* font = dynamic_cast<Font*>(fontList->back()); 78 74 //if (likely(font != Font::getDefaultFont())) 79 75 // ResourceManager::getInstance()->unload(font, RP_GAME); … … 91 87 { 92 88 if (!TTF_WasInit()) 93 94 95 89 { 90 if(TTF_Init()==-1) 91 PRINTF(1)("TTF_Init: %s\n", TTF_GetError()); 96 92 97 98 93 TextEngine::checkVersion(); 94 } 99 95 else 100 96 PRINTF(4)("Fonts already initialized\n"); … … 107 103 { 108 104 if (TTF_WasInit()) 109 110 // Font::removeDefaultFont();111 112 105 { 106 // Font::removeDefaultFont(); 107 TTF_Quit(); 108 } 113 109 else 114 110 PRINTF(4)("Fonts were not initialized.\n"); … … 122 118 void TextEngine::debug() const 123 119 { 124 const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT); 125 if (textList != NULL) 120 PRINT(0)("+-------------------------------+\n"); 121 PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n"); 122 PRINT(0)("+-------------------------------+\n"); 123 PRINT(0)("Reference: %p; Text Counts: %d\n", this, Text::objectList().size()); 124 125 for (ObjectList<Text>::const_iterator it = Text::objectList().begin(); 126 it != Text::objectList().end(); 127 ++it) 126 128 { 127 PRINT(0)("+-------------------------------+\n"); 128 PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n"); 129 PRINT(0)("+-------------------------------+\n"); 130 PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size()); 131 132 std::list<BaseObject*>::const_iterator text; 133 for ( text = textList->begin(); text != textList->end(); text++) 134 dynamic_cast<Text*>(*text)->debug(); 129 (*it)->debug(); 135 130 PRINT(0)("+---------------------------TE--+\n"); 136 131 } … … 152 147 compile_version.minor == link_version.minor && 153 148 compile_version.patch == link_version.patch) 154 155 156 149 { 150 return true; 151 } 157 152 else 158 159 160 161 162 153 { 154 PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n", 155 compile_version.major, 156 compile_version.minor, 157 compile_version.patch); 163 158 164 165 166 167 168 169 159 PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n", 160 link_version.major, 161 link_version.minor, 162 link_version.patch); 163 return false; 164 } 170 165 }
Note: See TracChangeset
for help on using the changeset viewer.