Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 19, 2005, 2:37:18 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: flush
i am going into the weekend now
@patrick: ther might be some strange behaviour, and i noticed, that the CD-engine is iterating more through the entities, than it should
I hope, this is just a minor bug, because it almost killed me in the process of developing
i do not exactly know if it is from the CD-engine, but it is producing different outputs when i start the game five times in a row

File:
1 edited

Legend:

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

    r5083 r5084  
    3333 * @todo this constructor is not jet implemented - do it
    3434*/
    35 Element2D::Element2D ()
    36 {
    37   this->init();
     35Element2D::Element2D (Element2D* parent)
     36{
     37  this->init(parent);
    3838}
    3939
     
    5151 * initializes a Element2D
    5252 */
    53 void Element2D::init()
     53void Element2D::init(Element2D* parent)
    5454{
    5555  this->setClassID(CL_ELEMENT_2D, "Element2D");
     
    6060  this->setAlignment(E2D_ALIGN_NONE);
    6161  this->layer = E2D_TOP;
     62
    6263  this->setParentMode2D(E2D_PARENT_ALL);
    63 
     64  this->children = new tList<Element2D>;
    6465  this->bRelCoorChanged = true;
    6566  this->bRelDirChanged = true;
     67  if (parent == NULL)
     68    this->parent = NULL;
     69//  else
     70  //  this->setParent2D(parent);
    6671
    6772  Render2D::getInstance()->registerElement2D(this);
     
    148153 * this sets the position of the Element on the screen.
    149154 * Use this in the your tick function, if you want the element to be automatically positioned.
     155 *
     156 * @todo must be in update
    150157 */
    151158void Element2D::positioning()
     
    279286  if( likely(child->parent != NULL))
    280287  {
    281     PRINTF(4)("PNode::addChild() - reparenting node: removing it and adding it again\n");
     288    PRINTF(4)("Element2D::addChild() - reparenting node: removing it and adding it again\n");
    282289    child->parent->children->remove(child);
    283290  }
     
    414421    this->lastAbsCoordinate = this->absCoordinate;
    415422
    416     PRINTF(5)("PNode::update - %s - (%f, %f, %f)\n", this->getName(), this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
     423    PRINTF(5)("Element2D::update - %s - (%f, %f, %f)\n", this->getName(), this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    417424
    418425
     
    434441      /* update the current absCoordinate */
    435442      this->prevRelCoordinate = this->relCoordinate;
    436       //this->absCoordinate = this->parent->getAbsCoor2D();
    437443      this->absCoordinate.x = this->parent->getAbsCoor2D().x + (this->relCoordinate.x*cos(this->parent->getAbsDir2D()) - this->relCoordinate.y * sin(this->parent->getAbsDir2D()));
    438444      this->absCoordinate.y = this->parent->getAbsCoor2D().y + (this->relCoordinate.x*sin(this->parent->getAbsDir2D()) + this->relCoordinate.y * cos(this->parent->getAbsDir2D()));
     
    443449  else
    444450  {
    445     PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
     451    PRINTF(5)("Element2D::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    446452    if (this->bRelCoorChanged)
    447453      this->absCoordinate = this->relCoordinate;
Note: See TracChangeset for help on using the changeset viewer.