Changeset 5403 in orxonox.OLD for trunk/src/lib/graphics/render2D
- Timestamp:
- Oct 19, 2005, 1:00:43 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
r5402 r5403 201 201 if (this->parent != NULL && this->parent->getLayer() > layer) 202 202 { 203 PRINTF(2)("Unable to set this Element2D to layer %s, because it's parent is of higher layer %s\n", 204 Element2D::layer2DToChar(layer), Element2D::layer2DToChar(this->parent->getLayer())); 203 PRINTF(2)("Unable to set %s to layer %s, because it's parent(%s) is of higher layer %s\n", 204 this->getName(), 205 Element2D::layer2DToChar(layer), 206 this->parent->getName(), 207 Element2D::layer2DToChar(this->parent->getLayer())); 205 208 layer = this->parent->getLayer(); 206 209 } … … 455 458 * use this to add a child to this node. 456 459 */ 457 void Element2D::addChild2D (Element2D* child , int parentingMode)460 void Element2D::addChild2D (Element2D* child) 458 461 { 459 462 if( likely(child->parent != NULL)) … … 462 465 child->parent->children->remove(child); 463 466 } 464 if (parentingMode != E2D_PARENT_NONE)465 child->parentMode = parentingMode;466 467 child->parent = this; 467 468 if (likely(this != NULL)) 468 469 { 469 this->children->add(child); 470 // ELEMENT SORTING TO LAYERS // 471 unsigned int childCount = this->children->getSize(); 472 tIterator<Element2D>* iterator = this->children->getIterator(); 473 Element2D* elem = iterator->firstElement(); 474 while (elem != NULL) 475 { 476 if (elem->layer < child->layer) 477 { 478 this->children->addAtIteratorPosition(child, iterator); 479 break; 480 } 481 elem = iterator->nextElement(); 482 } 483 delete iterator; 484 if (childCount == this->children->getSize()) 485 this->children->add(child); 486 //////////////////////////////// 470 487 if (unlikely(this->layer > child->getLayer())) 471 488 { 472 PRINTF(2)("Layer '%s' of Child %s lower than parents layer '%s'. updating\n",473 Element2D::layer2DToChar(child->getLayer()), Element2D::layer2DToChar(this->layer));489 PRINTF(2)("Layer '%s' of Child(%s) lower than parents(%s) layer '%s'. updating...\n", 490 Element2D::layer2DToChar(child->getLayer()),child->getName(), this->getName(), Element2D::layer2DToChar(this->layer)); 474 491 child->setLayer(this->layer); 475 492 } … … 498 515 { 499 516 if (child != NULL) 500 {501 517 child->remove2D(); 502 // this->children->remove(child);503 // child->parent = NULL;504 }505 518 } 506 519 … … 517 530 while( pn != NULL) 518 531 { 519 NullElement2D::getInstance()->addChild2D(pn , pn->getParentMode2D());532 NullElement2D::getInstance()->addChild2D(pn); 520 533 pn = iterator->nextElement(); 521 534 } … … 953 966 * @param absCoordinate the cordinate of the Parent (normally Vector(0,0,0)) 954 967 */ 955 NullElement2D::NullElement2D () : Element2D(NULL, E2D_LAYER_ TOP)968 NullElement2D::NullElement2D () : Element2D(NULL, E2D_LAYER_BELOW_ALL) 956 969 { 957 970 this->setClassID(CL_NULL_ELEMENT_2D, "NullElement2D"); -
trunk/src/lib/graphics/render2D/element_2d.h
r5402 r5403 152 152 153 153 154 void addChild2D (Element2D* child , int parentingMode = E2D_PARENT_NONE);154 void addChild2D (Element2D* child); 155 155 void addChild2D (const char* childName); 156 156 void removeChild2D (Element2D* child);
Note: See TracChangeset
for help on using the changeset viewer.