aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils/rectangle.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/rectangle.hpp b/src/utils/rectangle.hpp
index 5ea2787f..1d8abda2 100644
--- a/src/utils/rectangle.hpp
+++ b/src/utils/rectangle.hpp
@@ -163,6 +163,21 @@ namespace usdx
this->point2 = Point<T>(left + width, top + height);
return *this;
}
+
+ bool is_in(const Point<T>& p) const
+ {
+ if (p.get_x() < get_left())
+ return false;
+ if (p.get_x() > get_right())
+ return false;
+
+ if (p.get_y() < get_top())
+ return false;
+ if (p.get_y() > get_bottom())
+ return false;
+
+ return true;
+ }
};
};