diff options
| author | Filippos Karapetis | 2011-01-23 19:00:35 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2011-01-23 19:00:35 +0000 |
| commit | b0321af3434dcc7e9330d79fa5d0ed083e50631e (patch) | |
| tree | 9fa29f7ece7cd34788e0f0156bf7d83a0ef5e12c | |
| parent | 85406467e2fc234066f87628709c7cbf094556ad (diff) | |
| download | scummvm-rg350-b0321af3434dcc7e9330d79fa5d0ed083e50631e.tar.gz scummvm-rg350-b0321af3434dcc7e9330d79fa5d0ed083e50631e.tar.bz2 scummvm-rg350-b0321af3434dcc7e9330d79fa5d0ed083e50631e.zip | |
COMMON: Added some very simple operators to the Point class (+, -, += and -=), taken from the BS25 Vertex class
svn-id: r55476
| -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. |
