- Timestamp:
- Sep 25, 2005, 1:16:41 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/render2D
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r5251 r5252 36 36 /** 37 37 * standard constructor 38 * @ param parent the Parent of this node (default NULL)39 38 * @todo this constructor is not jet implemented - do it 39 */ 40 40 Element2D::Element2D (Element2D* parent) 41 41 { … … 48 48 /** 49 49 * standard deconstructor 50 50 */ 51 51 Element2D::~Element2D () 52 52 { … … 54 54 Render2D::getInstance()->unregisterElement2D(this); 55 55 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 // } 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 } 69 70 delete this->children; 70 71 … … 89 90 this->bindNode = NULL; 90 91 91 // PNODE-stuff 92 this->setParentMode2D(E2D_PARENT_ALL); 93 this->parent = NULL; 92 94 this->children = new tList<Element2D>; 93 this->setParentMode2D(E2D_PARENT_ALL);94 if (NullElement2D::isInstanciated())95 {96 this->parent = NullElement2D::getInstance();97 NullElement2D::getInstance()->children->add(this);98 NullElement2D::getInstance()->debug(0);99 }100 else101 this->parent = NULL;102 95 this->absDirection = 0.0; 103 96 this->relDirection = 0.0; … … 449 442 if( likely(child->parent != NULL)) 450 443 { 444 PRINTF(4)("Element2D::addChild() - reparenting node: removing it and adding it again\n"); 451 445 child->parent->children->remove(child); 452 446 } … … 511 505 void Element2D::setParent2D (Element2D* parent) 512 506 { 513 if (parent != NULL) 514 parent->addChild2D(this); 507 parent->addChild2D(this); 515 508 } 516 509 … … 524 517 if (parentNode != NULL) 525 518 parentNode->addChild2D(this); 519 526 520 } 527 521 -
trunk/src/lib/graphics/render2D/element_2d.h
r5251 r5252 218 218 public: 219 219 /** @returns a Pointer to the only object of this Class */ 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; }; 220 inline static NullElement2D* getInstance() { if (!singletonRef) singletonRef = new NullElement2D(); return singletonRef; }; 222 221 virtual ~NullElement2D (); 223 222
Note: See TracChangeset
for help on using the changeset viewer.