Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7031 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Feb 4, 2006, 4:42:28 AM (19 years ago)
Author:
bensch
Message:

softed stuff

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

Legend:

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

    r7029 r7031  
    5555  this->toCoordinate = NULL;
    5656  this->toDirection = NULL;
     57  this->toSize = NULL;
    5758  this->setSize2D(1, 1);
    5859
     
    221222}
    222223
     224void Element2D::setSizeSoft2D(float x, float y, float bias)
     225{
     226  if (likely(this->toSize == NULL))
     227    this->toSize = new Vector2D();
     228
     229  *this->toSize = Vector2D(x,y);;
     230  this->bias = bias;
     231}
     232
     233
    223234
    224235/**
     
    247258  this->bRelCoorChanged = true;
    248259}
    249 
    250260
    251261/**
     
    798808      }
    799809    }
     810    if (unlikely(this->toSize != NULL))
     811    {
     812      Vector2D shiftSize = (*this->toSize - Vector2D(this->sizeX, this->sizeY)) *fabsf(dt)*bias;
     813      if (likely((shiftSize).len() >= .001))//PNODE_ITERATION_DELTA))
     814      {
     815        this->sizeX += shiftSize.x;
     816        this->sizeY += shiftSize.y;
     817      }
     818      else
     819      {
     820        delete this->toSize;
     821        this->toSize = NULL;
     822        PRINTF(5)("SmoothRotate of %s finished\n", this->getName());
     823      }
     824    }
    800825
    801826    // MAIN UPDATE /////////////////////////////////////
  • trunk/src/lib/graphics/render2D/element_2d.h

    r6848 r7031  
    1010
    1111#include "vector.h"
     12#include "vector2D.h"
    1213#include <list>
    1314
     
    124125
    125126    inline void setSize2D(float x, float y) { this->sizeX = x, this->sizeY = y; };
     127    void setSizeSoft2D(float x, float y, float bias = 1.0);
    126128    inline void setSizeX2D(float x) { this->sizeX = x; };
    127129    inline void setSizeY2D(float y) { this->sizeY = y; };
     
    234236    float                   sizeX;              //!< The size of the rendered item in x-direction
    235237    float                   sizeY;              //!< The size of the rendered Item in y-direction
     238    Vector2D*               toSize;             //!< The Size to iterate to.
    236239
    237240    E2D_ALIGNMENT           alignment;          //!< How the Element is aligned around its Position
Note: See TracChangeset for help on using the changeset viewer.