Changeset 5090 in orxonox.OLD for trunk/src/lib/graphics/render2D
- Timestamp:
- Aug 21, 2005, 8:50:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r5089 r5090 194 194 void Element2D::setRelCoor2Dpx (int x, int y) 195 195 { 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(), 198 198 0 199 199 )); … … 212 212 void Element2D::setRelCoorSoft2Dpx (int x, int y, float bias) 213 213 { 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(), 216 216 0), 217 217 bias); … … 253 253 void Element2D::setAbsCoor2Dpx (int x, int y) 254 254 { 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(), 257 257 0 258 258 )); … … 269 269 void Element2D::shiftCoor2Dpx (int x, int y) 270 270 { 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(), 273 273 0)); 274 274 } … … 453 453 { 454 454 /* update the current absDirection - remember * means rotation around sth.*/ 455 this->prevRel Coordinate = this->relCoordinate;455 this->prevRelDirection = this->relDirection; 456 456 this->absDirection = this->relDirection + parent->getAbsDir2D();; 457 457 } … … 493 493 /* update the current absCoordinate */ 494 494 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 495 500 this->absCoordinate.x = this->parent->getAbsCoor2D().x + (this->relCoordinate.x*cos(this->parent->getAbsDir2D()) - this->relCoordinate.y * sin(this->parent->getAbsDir2D())); 496 501 this->absCoordinate.y = this->parent->getAbsCoor2D().y + (this->relCoordinate.x*sin(this->parent->getAbsDir2D()) + this->relCoordinate.y * cos(this->parent->getAbsDir2D()));
Note: See TracChangeset
for help on using the changeset viewer.