Changeset 9839 in orxonox.OLD for branches/new_class_id/src/lib/graphics/text_engine/resource_font.cc
- Timestamp:
- Sep 26, 2006, 6:31:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/text_engine/resource_font.cc
r9838 r9839 6 6 7 7 8 ResourceFont::ResourceFont(const std::string& imageName, GLenum target)9 :NewResource(&ResourceFont::type)8 ResourceFont::ResourceFont(const std::string& fontName, unsigned int renderSize) 9 : Font(), NewResource(&ResourceFont::type) 10 10 { 11 Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + "TEST"); 11 assert(!fontName.empty()); 12 Resources::StorePointer* ptr = this->acquireResource(fontName + ',' + MultiType((int)renderSize).getString()); 12 13 13 14 if (ptr) 14 15 { 15 PRINTF(5)("FOUND FONT: %s\n", imageName.c_str());16 this-> acquireData(static_cast<ResourceFont::FontResourcePointer*>(ptr)->ptr());16 PRINTF(5)("FOUND FONT: %s\n", fontName.c_str()); 17 this->Font::acquireData(static_cast<ResourceFont::FontResourcePointer*>(ptr)->ptr()); 17 18 } 18 19 else 19 20 { 20 PRINTF(5)("NOT FOUND FONT: %s\n", imageName.c_str()); 21 std::string fileName = this->NewResource::locateFile(imageName); 22 this->Font::loadImage(fileName, target); 23 this->NewResource::addResource(new ResourceFont::FontResourcePointer(imageName + ',' + "TEST", Resources::KeepLevel(0), this->Font::dataPointer())); 21 PRINTF(5)("NOT FOUND FONT: %s\n", fontName.c_str()); 22 std::string fileName = this->NewResource::locateFile(fontName); 23 24 printf("FONTFILE %s TO %s\n", fontName.c_str(), fileName.c_str()); 25 26 this->Font::loadFontFromTTF(fileName, renderSize); 27 this->NewResource::addResource(new ResourceFont::FontResourcePointer(fontName + ',' + MultiType((int)renderSize).getString(), Resources::KeepLevel(0), this->Font::dataPointer())); 24 28 } 25 29 } … … 28 32 { 29 33 SubString loadValues(loadString, ','); 30 std::string imageName;31 GLenum target = GL_FONT_2D;34 std::string fontName; 35 unsigned int renderSize = 20; 32 36 if (loadValues.size() > 0) 33 imageName = loadValues[0];37 fontName = loadValues[0]; 34 38 if (loadValues.size() > 1) 35 target = (GLenum)MultiType(loadValues[2]).getInt();39 renderSize = (unsigned int)MultiType(loadValues[2]).getInt(); 36 40 37 return ResourceFont( imageName, target);41 return ResourceFont(fontName, renderSize); 38 42 } 39 43
Note: See TracChangeset
for help on using the changeset viewer.