Changeset 7355 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Apr 19, 2006, 6:08:21 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/text_engine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/text.cc
r7221 r7355 19 19 #include "font.h" 20 20 21 #include "graphics_engine.h"22 21 #include "util/loading/resource_manager.h" 23 #include "class_list.h"24 22 #include "debug.h" 25 #include "p_node.h"26 23 27 24 using namespace std; 28 25 29 26 /** 30 * creates a new Text Element27 * @brief creates a new Text Element 31 28 * @param fontFile the Font to render this text in 32 29 * @param type The renderType to display this font in 33 30 */ 34 31 Text::Text(const std::string& fontFile, unsigned int textSize) 35 {36 this->init();37 38 if (!fontFile.empty())39 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);40 this->setSizeY2D(textSize);41 }42 43 /**44 * deletes a Text out of memory45 *46 * This also ereases the text from the textList of the TextEngine47 */48 Text::~Text()49 {50 if (this->font != NULL && this->font != Font::getDefaultFont())51 ResourceManager::getInstance()->unload(this->font);52 }53 54 /**55 * initializes Text56 */57 void Text::init()58 32 { 59 33 this->setClassID(CL_TEXT, "Text"); … … 67 41 this->setSize(TEXT_DEFAULT_SIZE); 68 42 this->setText(""); 69 } 70 71 /** 72 * sets the Font of this Text to font from fontFile 43 44 45 if (!fontFile.empty()) 46 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE); 47 this->setSizeY2D(textSize); 48 } 49 50 /** 51 * @brief deletes a Text out of memory 52 */ 53 Text::~Text() 54 { 55 if (this->font != NULL && this->font != Font::getDefaultFont()) 56 ResourceManager::getInstance()->unload(this->font); 57 } 58 59 60 /** 61 * @brief sets the Font of this Text to font from fontFile 73 62 * @param fontFile the File to load the Font from. 74 63 * @param fontSize the Size of the Font … … 97 86 98 87 /** 99 * Sets a new Text to the font88 * @brief Sets a new Text to the font 100 89 * @param text the new text to set 101 90 */ … … 127 116 128 117 /** 129 * draws the Text118 * @brief draws the Text 130 119 */ 131 120 void Text::draw() const … … 194 183 195 184 /** 196 * prints out some nice debug information about this text185 * @brief prints out some nice debug information about this text 197 186 */ 198 187 void Text::debug() const 199 188 { 200 189 PRINT(0)("=== TEXT: %s ===\n", this->text.c_str()); 201 202 if (this->getBindNode())203 PRINT(0)("is bind to %s; ref=%p\n", this->getBindNode()->getName(), this->getBindNode());204 190 PRINT(0)("Color: %0.2f %0.2f %0.2f\n", this->color.x, this->color.y, this->color.z); 205 191 } … … 210 196 //////////// 211 197 /** 212 * Loads a Font from an SDL_surface into a texture.198 * @brief Loads a Font from an SDL_surface into a texture. 213 199 * @param surface The surface to make the texture of 214 200 * @param texCoord The texture coordinates of the 4 corners of the texture … … 291 277 292 278 /** 293 * Quick utility function for texture creation279 * @brief Quick utility function for texture creation 294 280 * @param input an integer 295 281 * @returns the next bigger 2^n-integer than input -
trunk/src/lib/graphics/text_engine/text.h
r7221 r7355 2 2 * @file text.h 3 3 * @brief Definition of a text Class, that is able to render text. 4 */4 */ 5 5 6 6 #ifndef _TEXT_H … … 41 41 Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE); 42 42 virtual ~Text(); 43 void init();44 43 45 44 void setFont(const std::string& fontFile, unsigned int renderSize);
Note: See TracChangeset
for help on using the changeset viewer.