summaryrefslogtreecommitdiffstats
path: root/src/math/Rect.h
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-05 16:14:01 +0200
committerGitHub <noreply@github.com>2020-05-05 16:14:01 +0200
commitfcd386f55d54b84a22540c106ba53f60b7c9b5f5 (patch)
tree4263c1f88eb693268e4b75104a5b2430b6dff580 /src/math/Rect.h
parentfixed traffic lights (diff)
parentMerge branch 'master' of github.com:gtamodding/re3 (diff)
downloadre3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.tar
re3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.tar.gz
re3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.tar.bz2
re3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.tar.lz
re3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.tar.xz
re3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.tar.zst
re3-fcd386f55d54b84a22540c106ba53f60b7c9b5f5.zip
Diffstat (limited to 'src/math/Rect.h')
-rw-r--r--src/math/Rect.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/math/Rect.h b/src/math/Rect.h
index fd1bd05e..326bb479 100644
--- a/src/math/Rect.h
+++ b/src/math/Rect.h
@@ -26,6 +26,25 @@ public:
if(v.y < top) top = v.y;
if(v.y > bottom) bottom = v.y;
}
+ void ContainRect(const CRect &r){
+ if(r.left < left) left = r.left;
+ if(r.right > right) right = r.right;
+ if(r.top < top) top = r.top;
+ if(r.bottom > bottom) bottom = r.bottom;
+ }
+
+ bool IsPointInside(const CVector2D &p){
+ return p.x >= left &&
+ p.x <= right &&
+ p.y >= top &&
+ p.y <= bottom;
+ }
+ bool IsPointInside(const CVector2D &p, float extraRadius){
+ return p.x >= left-extraRadius &&
+ p.x <= right+extraRadius &&
+ p.y >= top-extraRadius &&
+ p.y <= bottom+extraRadius;
+ }
void Translate(float x, float y){
left += x;