Changeset 3767 in orxonox.OLD for orxonox/branches/textEngine/src/lib/graphics/font/text_engine.cc
- Timestamp:
- Apr 9, 2005, 4:52:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/font/text_engine.cc
r3766 r3767 17 17 !! IMPORTANT !! When using ttf fonts clear the license issues prior to 18 18 adding them to orxonox. This is really important, because we do not 19 want to defend anyone.19 want to offend anyone. 20 20 */ 21 21 … … 43 43 \brief constructs a Font 44 44 \param fontFile the File to load the font from 45 */ 46 Font::Font(const char* fontFile) 47 { 48 this->init(fontFile); 49 } 50 51 /** 52 \brief destructs a font 53 */ 54 Font::~Font(void) 55 { 56 delete this->currentText; 57 58 if (this->glyphArray) 59 { 60 for (int i = 0; i < FONT_HIGHEST_KNOWN_CHAR; i++) 61 delete this->glyphArray[i]; 62 delete []this->glyphArray; 63 } 64 65 if (this->font) 66 TTF_CloseFont(this->font); 67 } 68 69 /** 70 \brief initializes a new Font 71 \param fontFile The file to load a Font from 72 \param fontSize the Size in pixels of the Font 73 */ 74 bool Font::init(const char* fontFile, unsigned int fontSize) 75 { 76 if (!TTF_WasInit()) 45 \param fontSize the Size of the Font in Pixels 46 \param r Red value of the Font. 47 \param g Green value of the Font. 48 \param b Blue value of the Font. 49 */ 50 Font::Font(const char* fontFile, unsigned int fontSize, Uint8 r, Uint8 g, Uint8 b) 51 { 52 if (!TTF_WasInit()) 77 53 TextEngine::enableFonts(); 78 54 … … 96 72 this->setFont(fontFile); 97 73 98 this->setColor(0, 255, 0);99 74 this->setPosition(0, 0); 100 75 101 76 this->setText(FONT_DEFAULT_TEXT); 102 77 103 this->setColor( 0,255,0);78 this->setColor(r, g, b); 104 79 105 80 this->createTexture(); 106 81 107 82 this->fastTextureID = this->createFastTexture(); 83 } 84 85 /** 86 \brief destructs a font 87 */ 88 Font::~Font(void) 89 { 90 delete this->currentText; 91 92 if (this->glyphArray) 93 { 94 for (int i = 0; i < FONT_HIGHEST_KNOWN_CHAR; i++) 95 delete this->glyphArray[i]; 96 delete []this->glyphArray; 97 } 98 99 if (this->font) 100 TTF_CloseFont(this->font); 108 101 } 109 102
Note: See TracChangeset
for help on using the changeset viewer.