Rect2.h 487 B

12345678910111213141516171819
  1. #pragma once
  2. #include "Vec2.h"
  3. namespace Framework
  4. {
  5. template<typename T> struct Rect2
  6. {
  7. Vec2<T> topLeft;
  8. Vec2<T> bottomRight;
  9. //! Prueft, ob sich das Rechteck mit einem anderen UEberschneidet
  10. inline bool collidesWith(const Rect2& r)
  11. {
  12. return r.topLeft.x < bottomRight.x && r.bottomRight.x > topLeft.x
  13. && r.topLeft.y < bottomRight.y && r.bottomRight.y > r.topLeft.y;
  14. }
  15. };
  16. } // namespace Framework