Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Sep 25, 2005, 1:13:19 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: saver change between fonts in Shell

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

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5215 r5251  
    3636/**
    3737 * standard constructor
    38  * @todo this constructor is not jet implemented - do it
    39 */
     38 * @param parent the Parent of this node (default NULL)
     39 */
    4040Element2D::Element2D (Element2D* parent)
    4141{
     
    4848/**
    4949 * standard deconstructor
    50 */
     50 */
    5151Element2D::~Element2D ()
    5252{
     
    5454  Render2D::getInstance()->unregisterElement2D(this);
    5555
    56   if (this->parent)
    57     this->parent->removeChild2D(this);
    58   else
    59   {
    60     tIterator<Element2D>* iterator = this->children->getIterator();
    61     Element2D* pn = iterator->firstElement();
    62     while( pn != NULL)
    63     {
    64       delete pn;
    65       pn = iterator->nextElement();
    66     }
    67     delete iterator;
    68     /* this deletes all children in the list */
    69   }
     56  this->remove2D();
     57//   else
     58//   {
     59//     tIterator<Element2D>* iterator = this->children->getIterator();
     60//     Element2D* pn = iterator->firstElement();
     61//     while( pn != NULL)
     62//     {
     63//       delete pn;
     64//       pn = iterator->nextElement();
     65//     }
     66//     delete iterator;
     67//     /* this deletes all children in the list */
     68//   }
    7069  delete this->children;
    7170
     
    9089  this->bindNode = NULL;
    9190
     91  // PNODE-stuff
     92  this->children = new tList<Element2D>;
    9293  this->setParentMode2D(E2D_PARENT_ALL);
    93   this->parent = NULL;
    94   this->children = new tList<Element2D>;
     94  if (NullElement2D::isInstanciated())
     95  {
     96    this->parent = NullElement2D::getInstance();
     97    NullElement2D::getInstance()->children->add(this);
     98    NullElement2D::getInstance()->debug(0);
     99  }
     100  else
     101    this->parent = NULL;
    95102  this->absDirection = 0.0;
    96103  this->relDirection = 0.0;
     
    442449  if( likely(child->parent != NULL))
    443450  {
    444     PRINTF(4)("Element2D::addChild() - reparenting node: removing it and adding it again\n");
    445451    child->parent->children->remove(child);
    446452  }
     
    505511void Element2D::setParent2D (Element2D* parent)
    506512{
    507   parent->addChild2D(this);
     513  if (parent != NULL)
     514    parent->addChild2D(this);
    508515}
    509516
     
    517524  if (parentNode != NULL)
    518525    parentNode->addChild2D(this);
    519 
    520526}
    521527
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5215 r5251  
    218218  public:
    219219    /** @returns a Pointer to the only object of this Class */
    220     inline static NullElement2D* getInstance() { if (!singletonRef) singletonRef = new NullElement2D();  return singletonRef; };
     220    inline static NullElement2D* getInstance() { if (!NullElement2D::singletonRef) NullElement2D::singletonRef = new NullElement2D();  return NullElement2D::singletonRef; };
     221    inline static bool isInstanciated() { return (likely(NullElement2D::singletonRef != NULL))?true:false; };
    221222    virtual ~NullElement2D ();
    222223
Note: See TracChangeset for help on using the changeset viewer.