Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5077 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Aug 19, 2005, 4:12:19 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now no runtime-errors anymore.
Also fixed the TextEngine, so no it does not need the TextList anymore, but ClassList

Location:
trunk/src/lib/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine.cc

    r5076 r5077  
    3232#include "graphics_engine.h"
    3333#include "resource_manager.h"
     34#include "class_list.h"
    3435
    3536#include "p_node.h"
     
    7475  ResourceManager::getInstance()->unload(this->font);
    7576
    76 //  if (this->text)
    77     //delete []this->text;
    78   TextEngine::getInstance()->deleteText(this);
     77  if (this->text)
     78    delete []this->text;
    7979}
    8080
     
    764764   this->setName("TextEngine");
    765765   this->enableFonts();
    766 
    767    this->textList = new tList<Text>;
    768766}
    769767
     
    780778{
    781779  this->disableFonts();
    782 
    783   delete this->textList;
    784780
    785781  TextEngine::singletonRef = NULL;
     
    834830    }
    835831
    836   newText = new Text(tmpFont, TEXT_DYNAMIC);
    837   textList->add(newText);
    838 
    839   return newText;
    840 }
    841 
    842 /**
    843  *  removes a Text from the List
    844  * @param text: the text to delete
    845 
    846    this only ereases allocated memory, and removes the text
    847    The normal way to call it, is through "delete text;"
    848    So you do not have to concetn yourselves with this.
    849 */
    850 void TextEngine::deleteText(Text* text)
    851 {
    852   textList->remove(text);
     832  return new Text(tmpFont, TEXT_DYNAMIC);
    853833}
    854834
     
    858838void TextEngine::flush()
    859839{
    860   tIterator<Text>* textIterator = textList->getIterator();
    861   Text* text = textIterator->nextElement();
     840  tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator();
     841  Text* text = dynamic_cast<Text*>(textIterator->nextElement());
    862842  while( text != NULL)
    863843    {
    864844      delete text;
    865       text = textIterator->nextElement();
     845      text = dynamic_cast<Text*>(textIterator->nextElement());
    866846    }
    867847  delete textIterator;
     
    878858  PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
    879859  PRINT(0)("+-------------------------------+\n");
    880   PRINT(0)("Reference: %p; Text Counts: %d\n", this, this->textList->getSize());
    881 
    882   tIterator<Text>* textIterator = textList->getIterator();
    883   Text* text = textIterator->nextElement();
     860  PRINT(0)("Reference: %p; Text Counts: %d\n", this, ClassList::getList(CL_TEXT)->getSize());
     861
     862  tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator();
     863  Text* text = dynamic_cast<Text*>(textIterator->nextElement());
    884864  while( text != NULL)
    885865    {
    886866      text->debug();
    887       text = textIterator->nextElement();
     867      text = dynamic_cast<Text*>(textIterator->nextElement());
    888868    }
    889869  delete textIterator;
  • trunk/src/lib/graphics/text_engine.h

    r5039 r5077  
    218218                   Uint8 b = FONT_DEFAULT_COLOR_B);
    219219
    220   void deleteText(Text* text);
    221220  void flush();
    222221
     
    234233 private:
    235234  //  tList<Font>* fontList;
    236   tList<Text>*       textList;      //!< a list of all texts registered to the textEngine @todo this is overhead, do we need this??
    237235
    238236};
Note: See TracChangeset for help on using the changeset viewer.