Pixel.cpp 843 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "Pixel.h"
  2. Pixel::Pixel( Vertex pos, Vertex speed, float ep, int id )
  3. : Object2D()
  4. {
  5. setPosition( pos );
  6. setSpeed( speed );
  7. this->ep = ep;
  8. pixelId = id;
  9. collision = false;
  10. }
  11. bool Pixel::tick( const WeltInfo &info, double zeit )
  12. {
  13. ep -= (float)zeit;
  14. return Object2D::tick( info, zeit );
  15. }
  16. void Pixel::render( Mat3< float > &kamMat, Bild &zRObj, const char *kamName )
  17. {}
  18. Rect2< float > Pixel::getBoundingBox() const
  19. {
  20. Rect2< float > r = Rect2< float >();
  21. r.topLeft.x = -( ep / 5 + 1 );
  22. r.topLeft.y = -( ep / 5 + 1 );
  23. r.bottomRight.x = ep / 5 + 1;
  24. r.bottomRight.y = ep / 5 + 1;
  25. r.topLeft = getWorldPos( r.topLeft );
  26. r.bottomRight = getWorldPos( r.bottomRight );
  27. return r;
  28. }
  29. float Pixel::getEp() const
  30. {
  31. return ep;
  32. }
  33. int Pixel::getId() const
  34. {
  35. return pixelId;
  36. }