diff options
| -rw-r--r-- | common/rect.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/rect.h b/common/rect.h index 326f481f3b..03ad02d27a 100644 --- a/common/rect.h +++ b/common/rect.h @@ -43,6 +43,18 @@ struct Point { Point(int16 x1, int16 y1) : x(x1), y(y1) {} bool operator==(const Point &p) const { return x == p.x && y == p.y; } bool operator!=(const Point &p) const { return x != p.x || y != p.y; } + Point operator+(const Point &delta) const { return Point(x + delta.x, y + delta.y); } + Point operator-(const Point &delta) const { return Point(x - delta.x, y - delta.y); } + + void operator+=(const Point &delta) { + x += delta.x; + y += delta.y; + } + + void operator-=(const Point &delta) { + x -= delta.x; + y -= delta.y; + } /** * Return the square of the distance between this point and the point p. |
