aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/math/rect32.h
diff options
context:
space:
mode:
authorTobia Tesan2013-06-27 15:09:19 +0200
committerTobia Tesan2013-07-31 23:26:09 +0200
commit03c4b7a240d53b36c86aea564fb8ae0b0a747604 (patch)
tree6091f118f6f78be5e2379010edd748e59cd2dee2 /engines/wintermute/math/rect32.h
parent6716fa39a6fb2a3925576288c256688c5aadd7e9 (diff)
downloadscummvm-rg350-03c4b7a240d53b36c86aea564fb8ae0b0a747604.tar.gz
scummvm-rg350-03c4b7a240d53b36c86aea564fb8ae0b0a747604.tar.bz2
scummvm-rg350-03c4b7a240d53b36c86aea564fb8ae0b0a747604.zip
WINTERMUTE: Introduce TransformStruct and FloatPoint; add operators to Point32
Diffstat (limited to 'engines/wintermute/math/rect32.h')
-rw-r--r--engines/wintermute/math/rect32.h26
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).