Changeset 7031 in orxonox.OLD for trunk/src/lib/graphics/render2D
- Timestamp:
- Feb 4, 2006, 4:42:28 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/render2D
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r7029 r7031 55 55 this->toCoordinate = NULL; 56 56 this->toDirection = NULL; 57 this->toSize = NULL; 57 58 this->setSize2D(1, 1); 58 59 … … 221 222 } 222 223 224 void 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 223 234 224 235 /** … … 247 258 this->bRelCoorChanged = true; 248 259 } 249 250 260 251 261 /** … … 798 808 } 799 809 } 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 } 800 825 801 826 // MAIN UPDATE ///////////////////////////////////// -
trunk/src/lib/graphics/render2D/element_2d.h
r6848 r7031 10 10 11 11 #include "vector.h" 12 #include "vector2D.h" 12 13 #include <list> 13 14 … … 124 125 125 126 inline void setSize2D(float x, float y) { this->sizeX = x, this->sizeY = y; }; 127 void setSizeSoft2D(float x, float y, float bias = 1.0); 126 128 inline void setSizeX2D(float x) { this->sizeX = x; }; 127 129 inline void setSizeY2D(float y) { this->sizeY = y; }; … … 234 236 float sizeX; //!< The size of the rendered item in x-direction 235 237 float sizeY; //!< The size of the rendered Item in y-direction 238 Vector2D* toSize; //!< The Size to iterate to. 236 239 237 240 E2D_ALIGNMENT alignment; //!< How the Element is aligned around its Position
Note: See TracChangeset
for help on using the changeset viewer.