Changeset 5077 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Aug 19, 2005, 4:12:19 AM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine.cc
r5076 r5077 32 32 #include "graphics_engine.h" 33 33 #include "resource_manager.h" 34 #include "class_list.h" 34 35 35 36 #include "p_node.h" … … 74 75 ResourceManager::getInstance()->unload(this->font); 75 76 76 // if (this->text) 77 //delete []this->text; 78 TextEngine::getInstance()->deleteText(this); 77 if (this->text) 78 delete []this->text; 79 79 } 80 80 … … 764 764 this->setName("TextEngine"); 765 765 this->enableFonts(); 766 767 this->textList = new tList<Text>;768 766 } 769 767 … … 780 778 { 781 779 this->disableFonts(); 782 783 delete this->textList;784 780 785 781 TextEngine::singletonRef = NULL; … … 834 830 } 835 831 836 newText = new Text(tmpFont, TEXT_DYNAMIC); 837 textList->add(newText); 838 839 return newText; 840 } 841 842 /** 843 * removes a Text from the List 844 * @param text: the text to delete 845 846 this only ereases allocated memory, and removes the text 847 The normal way to call it, is through "delete text;" 848 So you do not have to concetn yourselves with this. 849 */ 850 void TextEngine::deleteText(Text* text) 851 { 852 textList->remove(text); 832 return new Text(tmpFont, TEXT_DYNAMIC); 853 833 } 854 834 … … 858 838 void TextEngine::flush() 859 839 { 860 tIterator< Text>* textIterator = textList->getIterator();861 Text* text = textIterator->nextElement();840 tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator(); 841 Text* text = dynamic_cast<Text*>(textIterator->nextElement()); 862 842 while( text != NULL) 863 843 { 864 844 delete text; 865 text = textIterator->nextElement();845 text = dynamic_cast<Text*>(textIterator->nextElement()); 866 846 } 867 847 delete textIterator; … … 878 858 PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n"); 879 859 PRINT(0)("+-------------------------------+\n"); 880 PRINT(0)("Reference: %p; Text Counts: %d\n", this, this->textList->getSize());881 882 tIterator< Text>* textIterator = textList->getIterator();883 Text* text = textIterator->nextElement();860 PRINT(0)("Reference: %p; Text Counts: %d\n", this, ClassList::getList(CL_TEXT)->getSize()); 861 862 tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator(); 863 Text* text = dynamic_cast<Text*>(textIterator->nextElement()); 884 864 while( text != NULL) 885 865 { 886 866 text->debug(); 887 text = textIterator->nextElement();867 text = dynamic_cast<Text*>(textIterator->nextElement()); 888 868 } 889 869 delete textIterator; -
trunk/src/lib/graphics/text_engine.h
r5039 r5077 218 218 Uint8 b = FONT_DEFAULT_COLOR_B); 219 219 220 void deleteText(Text* text);221 220 void flush(); 222 221 … … 234 233 private: 235 234 // tList<Font>* fontList; 236 tList<Text>* textList; //!< a list of all texts registered to the textEngine @todo this is overhead, do we need this??237 235 238 236 };
Note: See TracChangeset
for help on using the changeset viewer.