Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5402 in orxonox.OLD


Ignore:
Timestamp:
Oct 19, 2005, 12:10:26 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: promised checking should be working now.

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

Legend:

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

    r5401 r5402  
    4545 * itself. Otherwise it would result in an endless Loop.
    4646 */
    47 Element2D::Element2D (Element2D* parent)
     47Element2D::Element2D (Element2D* parent, E2D_LAYER layer)
    4848{
    4949  this->init();
    50 
     50  this->layer = layer;
    5151  // check Parenting, and if ok parent the stuff
    5252  if (this->parent != NULL)
     
    129129void Element2D::loadParams(const TiXmlElement* root)
    130130{
     131  // ELEMENT2D-native settings.
    131132  LoadParam<Element2D>(root, "alignment", this, &Element2D::setAlignment)
    132133      .describe("loads the alignment: (either: center, left, right or screen-center)");
     
    142143
    143144
    144   // PNode-style:
     145// PNode-style:
    145146  LoadParam<Element2D>(root, "rel-coor", this, &Element2D::setRelCoor2D)
    146147      .describe("Sets The relative position of the Node to its parent.");
     
    198199void Element2D::setLayer(E2D_LAYER layer)
    199200{
    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  }
    204207  this->layer = layer;
    205208}
     
    463466  child->parent = this;
    464467  if (likely(this != NULL))
     468  {
    465469    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  }
    466477  child->parentCoorChanged();
    467478}
     
    772783            Element2D::parentingModeToChar2D(parentMode),
    773784            Element2D::layer2DToChar(this->layer));
     785
    774786  if (depth >= 2 || depth == 0)
    775787  {
     
    941953 * @param absCoordinate the cordinate of the Parent (normally Vector(0,0,0))
    942954 */
    943 NullElement2D::NullElement2D () : Element2D(NULL)
     955NullElement2D::NullElement2D () : Element2D(NULL, E2D_LAYER_TOP)
    944956{
    945957  this->setClassID(CL_NULL_ELEMENT_2D, "NullElement2D");
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5401 r5402  
    6767  public:
    6868    Element2D();
    69     Element2D(Element2D* parent);
     69    Element2D(Element2D* parent, E2D_LAYER layer = E2D_DEFAULT_LAYER);
    7070    virtual ~Element2D();
    7171
Note: See TracChangeset for help on using the changeset viewer.