Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5090 in orxonox.OLD


Ignore:
Timestamp:
Aug 21, 2005, 8:50:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: math should be easy…

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/glmenu/glmenu_imagescreen.cc

    r4836 r5090  
    4444  // End of Background image code.
    4545
    46   if (root)
     46  if (root != NULL)
    4747    this->loadParams(root);
    4848}
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5089 r5090  
    194194void Element2D::setRelCoor2Dpx (int x, int y)
    195195{
    196   this->setRelCoor2D(Vector((float)GraphicsEngine::getInstance()->getResolutionX()/(float)x,
    197                      (float)GraphicsEngine::getInstance()->getResolutionY()/(float)y,
     196  this->setRelCoor2D(Vector((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
     197                     (float)y/(float)GraphicsEngine::getInstance()->getResolutionY(),
    198198                     0
    199199                           ));
     
    212212void Element2D::setRelCoorSoft2Dpx (int x, int y, float bias)
    213213{
    214   this->setRelCoorSoft2D(Vector((float)GraphicsEngine::getInstance()->getResolutionX()/(float)x,
    215                          (float)GraphicsEngine::getInstance()->getResolutionY()/(float)y,
     214  this->setRelCoorSoft2D(Vector((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
     215                         (float)y/(float)GraphicsEngine::getInstance()->getResolutionY(),
    216216                         0),
    217217                         bias);
     
    253253void Element2D::setAbsCoor2Dpx (int x, int y)
    254254{
    255   this->setAbsCoor2D(Vector((float)GraphicsEngine::getInstance()->getResolutionX()/(float)x,
    256                      (float)GraphicsEngine::getInstance()->getResolutionY()/(float)y,
     255  this->setAbsCoor2D(Vector((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
     256                     (float)y/(float)GraphicsEngine::getInstance()->getResolutionY(),
    257257                     0
    258258                           ));
     
    269269void Element2D::shiftCoor2Dpx (int x, int y)
    270270{
    271   this->shiftCoor2D(Vector((float)GraphicsEngine::getInstance()->getResolutionX()/(float)x,
    272                      (float)GraphicsEngine::getInstance()->getResolutionY()/(float)y,
     271  this->shiftCoor2D(Vector((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
     272                    (float)y/(float)GraphicsEngine::getInstance()->getResolutionY(),
    273273                     0));
    274274}
     
    453453    {
    454454      /* update the current absDirection - remember * means rotation around sth.*/
    455       this->prevRelCoordinate = this->relCoordinate;
     455      this->prevRelDirection = this->relDirection;
    456456      this->absDirection = this->relDirection + parent->getAbsDir2D();;
    457457    }
     
    493493        /* update the current absCoordinate */
    494494        this->prevRelCoordinate = this->relCoordinate;
     495        float sine = sin(this->parent->getAbsDir2D());
     496        float cose = cos(this->parent->getAbsDir2D());
     497//        this->absCoordinate.x = this->relCoordinate.x*cose - this->relCoordinate.y*sine + this->parent->getRelCoor2D().x*(1-cose) +this->parent->getRelCoor2D().y*sine;
     498//        this->absCoordinate.y = this->relCoordinate.x*sine + this->relCoordinate.y*cose + this->parent->getRelCoor2D().y*(1-cose) +this->parent->getRelCoor2D().x*sine;
     499
    495500        this->absCoordinate.x = this->parent->getAbsCoor2D().x + (this->relCoordinate.x*cos(this->parent->getAbsDir2D()) - this->relCoordinate.y * sin(this->parent->getAbsDir2D()));
    496501        this->absCoordinate.y = this->parent->getAbsCoor2D().y + (this->relCoordinate.x*sin(this->parent->getAbsDir2D()) + this->relCoordinate.y * cos(this->parent->getAbsDir2D()));
  • trunk/src/lib/graphics/text_engine.cc

    r5089 r5090  
    209209      //      glEnable(GL_TEXTURE_2D);
    210210      glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0);
     211//      glRotatef(this->getAbsDir2D(), 0,0,1);
    211212
    212213      const char* tmpText = this->text;
  • trunk/src/util/shell.cc

    r5089 r5090  
    4343  this->setBufferSize(100);
    4444  this->setBufferDisplaySize(10);
     45  this->setAbsCoor2D(2, 400);
     46  this->setAbsDir2D(0);
    4547
    4648  this->inputLineText = TextEngine::getInstance()->createText("fonts/earth.ttf", 10, TEXT_DYNAMIC, 255, 0, 0);
     
    8385    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/earth.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
    8486    this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT);
    85     this->bufferText[i]->setRelCoor2D(5, 400 + 12*i);
     87    this->bufferText[i]->setRelCoor2D(5, 12*i);
    8688    this->bufferText[i]->setText(NULL);
    8789    this->bufferText[i]->setParent2D(this);
Note: See TracChangeset for help on using the changeset viewer.