Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2006, 1:16:23 PM (18 years ago)
Author:
bensch
Message:

adapted many classes to the new ClassID System, now comes the hard part… Scripting… then Network… wow this will be so bad :/

Location:
branches/new_class_id/src/lib/graphics/text_engine
Files:
10 edited

Legend:

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

    r8989 r9685  
    2929#include "compiler.h"
    3030
     31NewObjectListDefinition(Font);
    3132
    3233Font::Font()
     
    130131  this->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    131132
    132   this->setClassID(CL_FONT, "Font");
     133  this->registerObject(this, Font::_objectList);
    133134  if (Font::defaultFontData.get() == NULL)
    134135  {
  • branches/new_class_id/src/lib/graphics/text_engine/font.h

    r8766 r9685  
    1919class Font : public Material
    2020{
     21  NewObjectListDeclaration(Font);
    2122
    2223public:
  • branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.cc

    r9406 r9685  
    1919#include "font.h"
    2020
     21NewObjectListDefinition(LimitedWidthText);
    2122/**
    2223 * @brief creates a new Text Element
     
    2728    : Text(fontFile, textSize)
    2829{
    29   this->setClassID(CL_LIMITED_WIDTH_TEXT, "LimitedWidthText");
     30  this->registerObject(this, LimitedWidthText::_objectList);
    3031
    3132  this->_dotsPosition = End;
  • branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.h

    r8980 r9685  
    1414class LimitedWidthText : public Text
    1515{
     16  NewObjectListDeclaration(LimitedWidthText);
    1617  public:
    1718    typedef enum {
  • branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.cc

    r9406 r9685  
    1919#include "font.h"
    2020
     21NewObjectListDefinition(MultiLineText);
     22
    2123/**
    2224 * @brief creates a new Text Element
     
    2729  : Text(fontFile, textSize)
    2830{
    29   this->setClassID(CL_MULTI_LINE_TEXT, "MultiLineText");
     31  this->registerObject(this, MultiLineText::_objectList);
    3032
    3133  this->lineSpacing = 1.0;
  • branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.h

    r7757 r9685  
    1414class MultiLineText : public Text
    1515{
     16  NewObjectListDeclaration(MultiLineText);
    1617  public:
    1718    MultiLineText(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE, float lineWidth = 100.0);
  • branches/new_class_id/src/lib/graphics/text_engine/text.cc

    r9406 r9685  
    2222#include "debug.h"
    2323
     24NewObjectListDefinition(Text);
     25
    2426/**
    2527 * @brief creates a new Text Element
     
    3032    // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
    3133{
    32   this->setClassID(CL_TEXT, "Text");
     34  this->registerObject(this, Text::_objectList);
    3335
    3436  // initialize this Text
     
    4446    : _font()
    4547{
    46   this->setClassID(CL_TEXT, "Text");
     48  this->registerObject(this, Text::_objectList);
    4749
    4850  *this = text;
  • branches/new_class_id/src/lib/graphics/text_engine/text.h

    r8764 r9685  
    2626class Text : public Element2D
    2727{
     28  NewObjectListDeclaration(Text);
    2829  public:
    2930    Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE);
  • branches/new_class_id/src/lib/graphics/text_engine/text_engine.cc

    r9406 r9685  
    3434#include "graphics_engine.h"
    3535#include "util/loading/resource_manager.h"
    36 #include "class_list.h"
    3736
    3837#include "debug.h"
     
    4039/// TEXT-ENGINE ///
    4140///////////////////
     41NewObjectListDefinition(TextEngine);
    4242/**
    4343 *  standard constructor
     
    4545TextEngine::TextEngine ()
    4646{
    47    this->setClassID(CL_TEXT_ENGINE, "TextEngine");
    48    this->setName("TextEngine");
    49    this->enableFonts();
     47  this->registerObject(this, TextEngine::_objectList);
     48  this->setName("TextEngine");
     49  this->enableFonts();
    5050}
    5151
     
    6262{
    6363  // first remove all the remaining Texts (if any).
    64   const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
    65   if (textList != NULL)
    66   {
    67     while(textList->size() > 0)
    68       delete dynamic_cast<Text*>(textList->front());
    69   }
     64  while (!Text::objectList().empty())
     65    delete Text::objectList().front();
    7066  // delete all remaining fonts (There should not be Anything to do here)
    71   const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
    72   if (fontList != NULL)
     67
     68  //const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
     69  //if (fontList != NULL)
    7370  {
    7471    ///FIXME
    75 //    while (fontList->size() > 0)
     72    //    while (fontList->size() > 0)
    7673    {
    77 //      Font* font = dynamic_cast<Font*>(fontList->back());
     74      //      Font* font = dynamic_cast<Font*>(fontList->back());
    7875      //if (likely(font != Font::getDefaultFont()))
    7976      //        ResourceManager::getInstance()->unload(font, RP_GAME);
     
    9188{
    9289  if (!TTF_WasInit())
    93     {
    94       if(TTF_Init()==-1)
    95         PRINTF(1)("TTF_Init: %s\n", TTF_GetError());
     90  {
     91    if(TTF_Init()==-1)
     92      PRINTF(1)("TTF_Init: %s\n", TTF_GetError());
    9693
    97       TextEngine::checkVersion();
    98     }
     94    TextEngine::checkVersion();
     95  }
    9996  else
    10097    PRINTF(4)("Fonts already initialized\n");
     
    107104{
    108105  if (TTF_WasInit())
    109     {
    110 //      Font::removeDefaultFont();
    111       TTF_Quit();
    112     }
     106  {
     107    //      Font::removeDefaultFont();
     108    TTF_Quit();
     109  }
    113110  else
    114111    PRINTF(4)("Fonts were not initialized.\n");
     
    122119void TextEngine::debug() const
    123120{
    124   const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
    125   if (textList != NULL)
     121  PRINT(0)("+-------------------------------+\n");
     122  PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
     123  PRINT(0)("+-------------------------------+\n");
     124  PRINT(0)("Reference: %p; Text Counts: %d\n", this, Text::objectList().size());
     125
     126  for (NewObjectList<Text>::const_iterator it = Text::objectList().begin();
     127       it != Text::objectList().end();
     128       ++it)
    126129  {
    127     PRINT(0)("+-------------------------------+\n");
    128     PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
    129     PRINT(0)("+-------------------------------+\n");
    130     PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size());
    131 
    132     std::list<BaseObject*>::const_iterator text;
    133     for ( text = textList->begin(); text != textList->end(); text++)
    134       dynamic_cast<Text*>(*text)->debug();
     130      (*it)->debug();
    135131    PRINT(0)("+---------------------------TE--+\n");
    136132  }
     
    152148      compile_version.minor == link_version.minor &&
    153149      compile_version.patch == link_version.patch)
    154     {
    155       return true;
    156     }
     150  {
     151    return true;
     152  }
    157153  else
    158     {
    159       PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n",
    160                 compile_version.major,
    161                 compile_version.minor,
    162                 compile_version.patch);
     154  {
     155    PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n",
     156              compile_version.major,
     157              compile_version.minor,
     158              compile_version.patch);
    163159
    164       PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n",
    165                 link_version.major,
    166                 link_version.minor,
    167                 link_version.patch);
    168       return false;
    169     }
     160    PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n",
     161              link_version.major,
     162              link_version.minor,
     163              link_version.patch);
     164    return false;
     165  }
    170166}
  • branches/new_class_id/src/lib/graphics/text_engine/text_engine.h

    r5515 r9685  
    2424class TextEngine : public BaseObject
    2525{
    26  public:
     26  NewObjectListDeclaration(TextEngine);
     27  public:
    2728  virtual ~TextEngine();
    2829  /** @returns a Pointer to the only object of this Class */
Note: See TracChangeset for help on using the changeset viewer.