Changeset 9685 in orxonox.OLD for branches/new_class_id/src/lib/graphics/text_engine
- Timestamp:
- Aug 22, 2006, 1:16:23 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/graphics/text_engine
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/text_engine/font.cc
r8989 r9685 29 29 #include "compiler.h" 30 30 31 NewObjectListDefinition(Font); 31 32 32 33 Font::Font() … … 130 131 this->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 131 132 132 this-> setClassID(CL_FONT, "Font");133 this->registerObject(this, Font::_objectList); 133 134 if (Font::defaultFontData.get() == NULL) 134 135 { -
branches/new_class_id/src/lib/graphics/text_engine/font.h
r8766 r9685 19 19 class Font : public Material 20 20 { 21 NewObjectListDeclaration(Font); 21 22 22 23 public: -
branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.cc
r9406 r9685 19 19 #include "font.h" 20 20 21 NewObjectListDefinition(LimitedWidthText); 21 22 /** 22 23 * @brief creates a new Text Element … … 27 28 : Text(fontFile, textSize) 28 29 { 29 this-> setClassID(CL_LIMITED_WIDTH_TEXT, "LimitedWidthText");30 this->registerObject(this, LimitedWidthText::_objectList); 30 31 31 32 this->_dotsPosition = End; -
branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.h
r8980 r9685 14 14 class LimitedWidthText : public Text 15 15 { 16 NewObjectListDeclaration(LimitedWidthText); 16 17 public: 17 18 typedef enum { -
branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.cc
r9406 r9685 19 19 #include "font.h" 20 20 21 NewObjectListDefinition(MultiLineText); 22 21 23 /** 22 24 * @brief creates a new Text Element … … 27 29 : Text(fontFile, textSize) 28 30 { 29 this-> setClassID(CL_MULTI_LINE_TEXT, "MultiLineText");31 this->registerObject(this, MultiLineText::_objectList); 30 32 31 33 this->lineSpacing = 1.0; -
branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.h
r7757 r9685 14 14 class MultiLineText : public Text 15 15 { 16 NewObjectListDeclaration(MultiLineText); 16 17 public: 17 18 MultiLineText(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE, float lineWidth = 100.0); -
branches/new_class_id/src/lib/graphics/text_engine/text.cc
r9406 r9685 22 22 #include "debug.h" 23 23 24 NewObjectListDefinition(Text); 25 24 26 /** 25 27 * @brief creates a new Text Element … … 30 32 // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE) 31 33 { 32 this-> setClassID(CL_TEXT, "Text");34 this->registerObject(this, Text::_objectList); 33 35 34 36 // initialize this Text … … 44 46 : _font() 45 47 { 46 this-> setClassID(CL_TEXT, "Text");48 this->registerObject(this, Text::_objectList); 47 49 48 50 *this = text; -
branches/new_class_id/src/lib/graphics/text_engine/text.h
r8764 r9685 26 26 class Text : public Element2D 27 27 { 28 NewObjectListDeclaration(Text); 28 29 public: 29 30 Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE); -
branches/new_class_id/src/lib/graphics/text_engine/text_engine.cc
r9406 r9685 34 34 #include "graphics_engine.h" 35 35 #include "util/loading/resource_manager.h" 36 #include "class_list.h"37 36 38 37 #include "debug.h" … … 40 39 /// TEXT-ENGINE /// 41 40 /////////////////// 41 NewObjectListDefinition(TextEngine); 42 42 /** 43 43 * standard constructor … … 45 45 TextEngine::TextEngine () 46 46 { 47 this->setClassID(CL_TEXT_ENGINE, "TextEngine");48 49 47 this->registerObject(this, TextEngine::_objectList); 48 this->setName("TextEngine"); 49 this->enableFonts(); 50 50 } 51 51 … … 62 62 { 63 63 // 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 } 64 while (!Text::objectList().empty()) 65 delete Text::objectList().front(); 70 66 // 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) 67 68 //const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT); 69 //if (fontList != NULL) 73 70 { 74 71 ///FIXME 75 // while (fontList->size() > 0)72 // while (fontList->size() > 0) 76 73 { 77 // Font* font = dynamic_cast<Font*>(fontList->back());74 // Font* font = dynamic_cast<Font*>(fontList->back()); 78 75 //if (likely(font != Font::getDefaultFont())) 79 76 // ResourceManager::getInstance()->unload(font, RP_GAME); … … 91 88 { 92 89 if (!TTF_WasInit()) 93 94 95 90 { 91 if(TTF_Init()==-1) 92 PRINTF(1)("TTF_Init: %s\n", TTF_GetError()); 96 93 97 98 94 TextEngine::checkVersion(); 95 } 99 96 else 100 97 PRINTF(4)("Fonts already initialized\n"); … … 107 104 { 108 105 if (TTF_WasInit()) 109 110 // Font::removeDefaultFont();111 112 106 { 107 // Font::removeDefaultFont(); 108 TTF_Quit(); 109 } 113 110 else 114 111 PRINTF(4)("Fonts were not initialized.\n"); … … 122 119 void TextEngine::debug() const 123 120 { 124 const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT); 125 if (textList != NULL) 121 PRINT(0)("+-------------------------------+\n"); 122 PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n"); 123 PRINT(0)("+-------------------------------+\n"); 124 PRINT(0)("Reference: %p; Text Counts: %d\n", this, Text::objectList().size()); 125 126 for (NewObjectList<Text>::const_iterator it = Text::objectList().begin(); 127 it != Text::objectList().end(); 128 ++it) 126 129 { 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(); 130 (*it)->debug(); 135 131 PRINT(0)("+---------------------------TE--+\n"); 136 132 } … … 152 148 compile_version.minor == link_version.minor && 153 149 compile_version.patch == link_version.patch) 154 155 156 150 { 151 return true; 152 } 157 153 else 158 159 160 161 162 154 { 155 PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n", 156 compile_version.major, 157 compile_version.minor, 158 compile_version.patch); 163 159 164 165 166 167 168 169 160 PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n", 161 link_version.major, 162 link_version.minor, 163 link_version.patch); 164 return false; 165 } 170 166 } -
branches/new_class_id/src/lib/graphics/text_engine/text_engine.h
r5515 r9685 24 24 class TextEngine : public BaseObject 25 25 { 26 public: 26 NewObjectListDeclaration(TextEngine); 27 public: 27 28 virtual ~TextEngine(); 28 29 /** @returns a Pointer to the only object of this Class */
Note: See TracChangeset
for help on using the changeset viewer.