Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 26, 2006, 6:31:56 PM (18 years ago)
Author:
bensch
Message:

Font completely ported to the new Resource-Format.
Now all the Basic Resources previously loaded from a central ResourceManager are Distributed over the Resource-Types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/graphics/text_engine/resource_font.cc

    r9838 r9839  
    66
    77
    8 ResourceFont::ResourceFont(const std::string& imageName, GLenum target)
    9     : NewResource(&ResourceFont::type)
     8ResourceFont::ResourceFont(const std::string& fontName, unsigned int renderSize)
     9  : Font(), NewResource(&ResourceFont::type)
    1010{
    11   Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + "TEST");
     11  assert(!fontName.empty());
     12  Resources::StorePointer* ptr = this->acquireResource(fontName + ',' + MultiType((int)renderSize).getString());
    1213
    1314  if (ptr)
    1415  {
    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());
    1718  }
    1819  else
    1920  {
    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()));
    2428  }
    2529}
     
    2832{
    2933  SubString loadValues(loadString, ',');
    30   std::string imageName;
    31   GLenum target = GL_FONT_2D;
     34  std::string fontName;
     35  unsigned int renderSize = 20;
    3236  if (loadValues.size() > 0)
    33     imageName = loadValues[0];
     37    fontName = loadValues[0];
    3438  if (loadValues.size() > 1)
    35     target = (GLenum)MultiType(loadValues[2]).getInt();
     39    renderSize = (unsigned int)MultiType(loadValues[2]).getInt();
    3640
    37   return ResourceFont(imageName, target);
     41  return ResourceFont(fontName, renderSize);
    3842}
    3943
Note: See TracChangeset for help on using the changeset viewer.