diff options
Diffstat (limited to 'engines/wintermute/math/rect32.h')
-rw-r--r-- | engines/wintermute/math/rect32.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 190c1135cf..6618a51e91 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -24,14 +24,38 @@ #define WINTERMUTE_RECT32_H #include "common/system.h" +#include "engines/wintermute/math/floatrect.h" namespace Wintermute { struct Point32 { int32 x; int32 y; -}; + Point32() : x(0), y(0) {} + Point32(int32 x1, int32 y1) : x(x1), y(y1) {} + bool operator==(const Point32 &p) const { return x == p.x && y == p.y; } + bool operator!=(const Point32 &p) const { return x != p.x || y != p.y; } + Point32 operator+(const Point32 &delta) const { return Point32(x + delta.x, y + delta.y); } + Point32 operator-(const Point32 &delta) const { return Point32(x - delta.x, y - delta.y); } + + Point32 &operator+=(const Point32 &delta) { + x += delta.x; + y += delta.y; + return *this; + } + Point32 &operator-=(const Point32 &delta) { + x -= delta.x; + y -= delta.y; + return *this; + } + + operator FloatPoint() { + return FloatPoint(x,y); + } + + +}; struct Rect32 { int32 top, left; ///< The point at the top left of the rectangle (part of the rect). int32 bottom, right; ///< The point at the bottom right of the rectangle (not part of the rect). |