diff --git a/SDL2pp/Point.cc b/SDL2pp/Point.cc index 5ed4146..1a24745 100644 --- a/SDL2pp/Point.cc +++ b/SDL2pp/Point.cc @@ -66,6 +66,10 @@ Point& Point::SetY(int ny) { return *this; } +Point Point::operator-() const { + return Point(-x, -y); +} + Point Point::operator+(const Point& other) const { return Point(x + other.x, y + other.y); } diff --git a/SDL2pp/Point.hh b/SDL2pp/Point.hh index bae5ba6..bce691f 100644 --- a/SDL2pp/Point.hh +++ b/SDL2pp/Point.hh @@ -156,6 +156,14 @@ public: //////////////////////////////////////////////////////////// Point& SetY(int ny); + //////////////////////////////////////////////////////////// + /// \brief Get point's memberwise negation + /// + /// \returns New Point representing memberwise negation + /// + //////////////////////////////////////////////////////////// + Point operator-() const; + //////////////////////////////////////////////////////////// /// \brief Get point's memberwise addition with another point ///