diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-12-19 16:31:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-01-12 22:47:45 +0100 |
| commit | d9b0b7a6319b9faecfb58df7c3c772f440f09db0 (patch) | |
| tree | 58097575a0773b2cdf4feac0ccec6c50a2b8e795 /src/lib/rect.h | |
| parent | 83f28a7c67794c0a9e48c8016db11585939e4d5d (diff) | |
Make PlayerText comparable.
Diffstat (limited to 'src/lib/rect.h')
| -rw-r--r-- | src/lib/rect.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/rect.h b/src/lib/rect.h index 4851ad007..4e4020073 100644 --- a/src/lib/rect.h +++ b/src/lib/rect.h @@ -112,6 +112,14 @@ public: { return (p.x >= x && p.x <= (x + width) && p.y >= y && p.y <= (y + height)); } + + bool equal (Rect<T> const & other, T threshold) const + { + return std::abs(x - other.x) < threshold && + std::abs(y - other.y) < threshold && + std::abs(width - other.width) < threshold && + std::abs(height - other.height) < threshold; + } }; } |
