Changeset 5402 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Oct 19, 2005, 12:10:26 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
r5401 r5402 45 45 * itself. Otherwise it would result in an endless Loop. 46 46 */ 47 Element2D::Element2D (Element2D* parent )47 Element2D::Element2D (Element2D* parent, E2D_LAYER layer) 48 48 { 49 49 this->init(); 50 50 this->layer = layer; 51 51 // check Parenting, and if ok parent the stuff 52 52 if (this->parent != NULL) … … 129 129 void Element2D::loadParams(const TiXmlElement* root) 130 130 { 131 // ELEMENT2D-native settings. 131 132 LoadParam<Element2D>(root, "alignment", this, &Element2D::setAlignment) 132 133 .describe("loads the alignment: (either: center, left, right or screen-center)"); … … 142 143 143 144 144 145 // PNode-style: 145 146 LoadParam<Element2D>(root, "rel-coor", this, &Element2D::setRelCoor2D) 146 147 .describe("Sets The relative position of the Node to its parent."); … … 198 199 void Element2D::setLayer(E2D_LAYER layer) 199 200 { 200 201 202 203 201 if (this->parent != NULL && this->parent->getLayer() > layer) 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())); 205 layer = this->parent->getLayer(); 206 } 204 207 this->layer = layer; 205 208 } … … 463 466 child->parent = this; 464 467 if (likely(this != NULL)) 468 { 465 469 this->children->add(child); 470 if (unlikely(this->layer > child->getLayer())) 471 { 472 PRINTF(2)("Layer '%s' of Child %s lower than parents layer '%s'. updating\n", 473 Element2D::layer2DToChar(child->getLayer()), Element2D::layer2DToChar(this->layer)); 474 child->setLayer(this->layer); 475 } 476 } 466 477 child->parentCoorChanged(); 467 478 } … … 772 783 Element2D::parentingModeToChar2D(parentMode), 773 784 Element2D::layer2DToChar(this->layer)); 785 774 786 if (depth >= 2 || depth == 0) 775 787 { … … 941 953 * @param absCoordinate the cordinate of the Parent (normally Vector(0,0,0)) 942 954 */ 943 NullElement2D::NullElement2D () : Element2D(NULL )955 NullElement2D::NullElement2D () : Element2D(NULL, E2D_LAYER_TOP) 944 956 { 945 957 this->setClassID(CL_NULL_ELEMENT_2D, "NullElement2D"); -
trunk/src/lib/graphics/render2D/element_2d.h
r5401 r5402 67 67 public: 68 68 Element2D(); 69 Element2D(Element2D* parent );69 Element2D(Element2D* parent, E2D_LAYER layer = E2D_DEFAULT_LAYER); 70 70 virtual ~Element2D(); 71 71
Note: See TracChangeset
for help on using the changeset viewer.