aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorGregory Montoir2006-11-03 21:04:10 +0000
committerGregory Montoir2006-11-03 21:04:10 +0000
commitc71e6599bc160329319c0c05ca453184a45fb0f7 (patch)
tree1dc20d63bbe5356610fc30a93e15a51cd68ed6a2 /common
parenta8d7265c5eae16b18bb336b3f3f70f6eb5552374 (diff)
downloadscummvm-rg350-c71e6599bc160329319c0c05ca453184a45fb0f7.tar.gz
scummvm-rg350-c71e6599bc160329319c0c05ca453184a45fb0f7.tar.bz2
scummvm-rg350-c71e6599bc160329319c0c05ca453184a45fb0f7.zip
added translation method to Common::Rect
svn-id: r24591
Diffstat (limited to 'common')
-rw-r--r--common/rect.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/rect.h b/common/rect.h
index 1e37733af0..7751d9a84a 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -42,7 +42,7 @@ struct Point {
Point & operator=(const Point & p) { x = p.x; y = p.y; return *this; };
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; };
-
+
/**
* Return the square of the distance between this point and the point p.
*
@@ -53,7 +53,7 @@ struct Point {
int diffx = ABS(p.x - x);
if (diffx >= 0x1000)
return 0xFFFFFF;
-
+
int diffy = ABS(p.y - y);
if (diffy >= 0x1000)
return 0xFFFFFF;
@@ -185,6 +185,11 @@ struct Rect {
left = x;
}
+ void translate(int16 dx, int16 dy) {
+ left += dx; right += dx;
+ top += dy; bottom += dy;
+ }
+
void moveTo(const Point &p) {
moveTo(p.x, p.y);
}