Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 26, 2006, 6:31:56 PM (19 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/text.cc

    r9836 r9839  
    1717
    1818#include "text.h"
     19#include "resource_font.h"
    1920#include "font.h"
    20 #include "loading/old_resource_manager.h"
    2121#include "debug.h"
    2222
     
    2929 */
    3030Text::Text(const std::string& fontFile, unsigned int textSize)
    31     // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
     31// : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
    3232{
    3333  this->registerObject(this, Text::_objectList);
    3434
    3535  // 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);
    3740  this->_size = textSize;
    3841  this->setSizeY2D(textSize);
     
    170173void Text::setFont(const std::string& fontFile, unsigned int fontSize)
    171174{
    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);
    190176
    191177  this->setupTextWidth();
Note: See TracChangeset for help on using the changeset viewer.