Changeset 8760 in orxonox.OLD for branches/fontdata/src/lib/graphics/text_engine/text.cc
- Timestamp:
- Jun 24, 2006, 2:14:37 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/fontdata/src/lib/graphics/text_engine/text.cc
r8759 r8760 28 28 */ 29 29 Text::Text(const std::string& fontFile, unsigned int textSize) 30 : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)30 : _font(fontFile, FONT_DEFAULT_RENDER_SIZE) 31 31 { 32 32 this->setClassID(CL_TEXT, "Text"); … … 35 35 this->_size = textSize; 36 36 this->setSizeY2D(textSize); 37 this-> _color = TEXT_DEFAULT_COLOR;37 this->setColor(TEXT_DEFAULT_COLOR); 38 38 39 39 this->setAlignment(TEXT_DEFAULT_ALIGNMENT); … … 41 41 42 42 Text::Text(const Text& text) 43 : _font()43 : _font() 44 44 { 45 45 this->setClassID(CL_TEXT, "Text"); … … 54 54 Text::~Text() 55 55 { 56 /* if (this->_font != NULL && this->_font != Font::getDefaultFont())57 ResourceManager::getInstance()->unload(this->_font);*/56 /* if (this->_font != NULL && this->_font != Font::getDefaultFont()) 57 ResourceManager::getInstance()->unload(this->_font);*/ 58 58 } 59 59 … … 67 67 return (this->_text == text._text && 68 68 this->_size == text._size && 69 this->_font == text._font && 70 this->_color == text._color); 69 this->_font == text._font ); 71 70 } 72 71 … … 89 88 { 90 89 this->_size = text._size; 91 this->_color = text._color;92 90 this->setAlignment(text.getAlignment()); 93 91 … … 171 169 { 172 170 Font* newFont = NULL; 173 // Font* oldFont = this->_font;171 // Font* oldFont = this->_font; 174 172 175 173 // load a new Font … … 179 177 if (newFont == NULL) 180 178 { 181 // newFont = &Font::();179 // newFont = &Font::(); 182 180 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile.c_str()); 183 181 } 184 182 } 185 // if (newFont == NULL) 186 // newFont = Font::getDefaultFont(); 187 assert(newFont != NULL); 188 189 // unloading the Font if we alrady have one loaded. 190 191 this->_font = *newFont; 192 // if (oldFont != NULL && oldFont != Font::getDefaultFont()) 193 // ResourceManager::getInstance()->unload(oldFont); 194 183 184 if (newFont == NULL) 185 this->_font = Font(); 186 else 187 this->_font = *newFont; 188 189 printf("Font Texture is\n" ); 190 _font.debug(); 195 191 this->setupTextWidth(); 196 192 } … … 223 219 glTranslatef(-this->getSizeX2D()/2, 0, 0); 224 220 225 // drawing this Text.226 // setting the Blending effects227 glColor4fv(&this->_color[0]);228 229 221 this->font().select(); 230 222 glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0); … … 278 270 { 279 271 PRINT(0)("=== TEXT: %s (with Font:'%s') displaying %s ===\n", this->getName(), this->_font.getName(), this->_text.c_str()); 280 PRINT(0)("Color: r=%0.2f g=%0.2f b=%0.2f a=%0.2f\n", this->_color.r(), this->_color.g(), this->_color.b(), this->_color.a());281 } 282 272 // PRINT(0)("Color: r=%0.2f g=%0.2f b=%0.2f a=%0.2f\n", this->_color.r(), this->_color.g(), this->_color.b(), this->_color.a()); 273 } 274
Note: See TracChangeset
for help on using the changeset viewer.