diff options
author | Max Horn | 2004-03-04 22:26:31 +0000 |
---|---|---|
committer | Max Horn | 2004-03-04 22:26:31 +0000 |
commit | af2f29f55cb5ae611b0c9e83474b1f0f14b33508 (patch) | |
tree | 4011132dd51b60fefea614a7cc90ff3a51e54ff4 /common | |
parent | 601723408ff4aee14b9f0d4a1ff3de29720e1d9d (diff) | |
download | scummvm-rg350-af2f29f55cb5ae611b0c9e83474b1f0f14b33508.tar.gz scummvm-rg350-af2f29f55cb5ae611b0c9e83474b1f0f14b33508.tar.bz2 scummvm-rg350-af2f29f55cb5ae611b0c9e83474b1f0f14b33508.zip |
added Rect::moveTo methods
svn-id: r13190
Diffstat (limited to 'common')
-rw-r--r-- | common/rect.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/common/rect.h b/common/rect.h index 2f28aae097..c9a6a572fd 100644 --- a/common/rect.h +++ b/common/rect.h @@ -78,7 +78,7 @@ struct Rect { @return true if the given point is inside this rectangle, false otherwise */ bool contains(const Point & p) const { - return (left <= p.x) && (p.x < right) && (top <= p.y) && (p.y < bottom); + return contains(p.x, p.y); } /*! @brief check if given rectangle intersects with this rectangle @@ -137,6 +137,17 @@ struct Rect { bool isValidRect() const { return (left <= right && top <= bottom); } + + void moveTo(int16 x, int16 y) { + bottom += y - top; + right += x - left; + top = y; + left = x; + } + + void moveTo(const Point & p) { + moveTo(p.x, p.y); + } }; } // End of namespace Common |