diff options
Diffstat (limited to 'include/vector2.hpp')
-rw-r--r-- | include/vector2.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/vector2.hpp b/include/vector2.hpp index beb2787..77ee7e7 100644 --- a/include/vector2.hpp +++ b/include/vector2.hpp @@ -35,10 +35,20 @@ struct vector2 { return vector2<T>(x + v.x, y + v.y); } + template<typename T2> + vector2<T> operator+(const vector2<T2>& v) const { + return vector2<T>(x + v.x, y + v.y); + } + vector2<T> operator+(const T& n) const { return vector2<T>(x + n, y + n); } + vector2<T> operator+=(const vector2<T>& v) { + x += v.x, y += v.y; + return *this; + } + // subtraction vector2<T> operator-(const vector2<T>& v) const { return vector2<T>(x - v.x, y - v.y); |