Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5084 in orxonox.OLD for trunk/src/lib/graphics/render2D


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

Location:
trunk/src/lib/graphics/render2D
Files:
2 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;
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5083 r5084  
    22 * @file element_2d.h
    33 * Definition of the 2D elements rendered on top through the GraphicsEngine
     4 *
    45 * @todo reimplement it, so it looks just like PNode.
    56*/
     
    6263
    6364  public:
    64     Element2D();
     65    Element2D(Element2D* parent = NULL);
    6566    virtual ~Element2D();
    6667
    67     void init();
     68    void init(Element2D* parent = NULL);
    6869    void loadParams(const TiXmlElement* root);
    6970
     
    156157
    157158  private:
    158     void init(Element2D* parent);
    159159    /** tells the child that the parent's Coordinate has changed */
    160160    inline void parentCoorChanged () { this->bRelCoorChanged = true; }
     
    170170  protected:
    171171    void positioning();
     172    //void Element2D(NullElement2D* nullElem);
    172173
    173174  protected:
     
    184185
    185186
    186 
    187 
    188 
    189187  private:
    190188    bool              bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
Note: See TracChangeset for help on using the changeset viewer.