Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7031 in orxonox.OLD for trunk/src


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

softed stuff

Location:
trunk/src
Files:
3 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
  • trunk/src/story_entities/simple_game_menu.cc

    r7030 r7031  
    376376    {
    377377      this->menuSelected = this->menuLayers[this->layerIndex].menuList[++this->menuSelectedIndex];
    378       this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D() + Vector(0, this->menuSelected->getSizeY2D() *.5,0));
    379       this->menuSelector->setSize(this->menuSelected->getSizeX2D(), this->menuSelected->getSizeY2D());
     378      this->menuSelector->setAbsCoorSoft2D(this->menuSelected->getAbsCoor2D() + Vector(0, this->menuSelected->getSizeY2D() *.5,0), 3.0);
     379      this->menuSelector->setSizeSoft2D(this->menuSelected->getSizeX2D(), this->menuSelected->getSizeY2D(), 3.0);
    380380
    381381      if( this->layerIndex == 1)
     
    391391    {
    392392      this->menuSelected = this->menuLayers[this->layerIndex].menuList[--this->menuSelectedIndex];
    393       this->menuSelector->setAbsCoor2D(this->menuSelected->getAbsCoor2D() + Vector(0, this->menuSelected->getSizeY2D() *.5,0));
    394       this->menuSelector->setSize(this->menuSelected->getSizeX2D(), this->menuSelected->getSizeY2D());
     393      this->menuSelector->setAbsCoorSoft2D(this->menuSelected->getAbsCoor2D() + Vector(0, this->menuSelected->getSizeY2D() *.5,0), 3.0);
     394      this->menuSelector->setSizeSoft2D(this->menuSelected->getSizeX2D(), this->menuSelected->getSizeY2D(), 3.0);
    395395
    396396      if( this->layerIndex == 1)
Note: See TracChangeset for help on using the changeset viewer.