Changeset 9839 in orxonox.OLD for branches/new_class_id/src/lib/graphics/text_engine/text.cc
- Timestamp:
- Sep 26, 2006, 6:31:56 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/text_engine/text.cc
r9836 r9839 17 17 18 18 #include "text.h" 19 #include "resource_font.h" 19 20 #include "font.h" 20 #include "loading/old_resource_manager.h"21 21 #include "debug.h" 22 22 … … 29 29 */ 30 30 Text::Text(const std::string& fontFile, unsigned int textSize) 31 31 // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE) 32 32 { 33 33 this->registerObject(this, Text::_objectList); 34 34 35 35 // initialize this Text 36 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE); 36 if (!fontFile.empty()) 37 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE); 38 else 39 this->setFont("fonts/final_frontier.ttf", FONT_DEFAULT_RENDER_SIZE); 37 40 this->_size = textSize; 38 41 this->setSizeY2D(textSize); … … 170 173 void Text::setFont(const std::string& fontFile, unsigned int fontSize) 171 174 { 172 Font* newFont = NULL; 173 // Font* oldFont = this->_font; 174 175 // load a new Font 176 if (!fontFile.empty()) 177 { 178 newFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize); 179 if (newFont == NULL) 180 { 181 // newFont = &Font::(); 182 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile.c_str()); 183 } 184 } 185 186 if (newFont == NULL) 187 this->_font = Font(); 188 else 189 this->_font = *newFont; 175 this->_font = ResourceFont(fontFile, fontSize); 190 176 191 177 this->setupTextWidth();
Note: See TracChangeset
for help on using the changeset viewer.