#include <algorithm>
#include <ostream>
+#include <SDL.h>
namespace space {
return *this;
}
+ SDL_Point ToPoint() const {
+ SDL_Point p;
+ p.x = x;
+ p.y = y;
+ return p;
+ }
+
public:
Scalar x;
Scalar y;
};
+/// specialization with same layout as SDL_Point
+template<>
+class Vector<int>
+: public SDL_Point {
+
+public:
+ constexpr Vector() : SDL_Point({0, 0}) { }
+ constexpr Vector(int x, int y) : SDL_Point({x, y}) { }
+
+ template<class Other>
+ constexpr Vector(Vector<Other> other)
+ : SDL_Point({int(other.x), int(other.y)}) { }
+
+public:
+ Vector<int> &operator +=(Vector<int> other) {
+ x += other.x;
+ y += other.y;
+ return *this;
+ }
+ Vector<int> &operator -=(Vector<int> other) {
+ x -= other.x;
+ y -= other.y;
+ return *this;
+ }
+
+ SDL_Point ToPoint() const {
+ return *this;
+ }
+
+};
+
template<class Scalar>
constexpr Vector<Scalar> operator -(Vector<Scalar> v) {