diff options
author | nathanwfranke <nathanwfranke@gmail.com> | 2020-02-07 14:43:27 -0600 |
---|---|---|
committer | nathanwfranke <nathanwfranke@gmail.com> | 2020-02-07 14:43:27 -0600 |
commit | e5cb557b73d804b59a5eda30b4b09d3d18ea91ad (patch) | |
tree | 648dccafa12d7a8cd256f95b8d9e98f46e84c2dd /core/math | |
parent | 3c3ed67c3944a555d18fa8b68603f3a68416e27e (diff) |
Fix bug where Control at origin with 0 size not rendered
Make a new method instead to make the code more elegant
Move Function down a bit
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/rect2.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h index 9017377770..0d2e7eb6e5 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -60,6 +60,19 @@ struct Rect2 { return true; } + inline bool intersects_touch(const Rect2 &p_rect) const { + if (position.x > (p_rect.position.x + p_rect.size.width)) + return false; + if ((position.x + size.width) < p_rect.position.x) + return false; + if (position.y > (p_rect.position.y + p_rect.size.height)) + return false; + if ((position.y + size.height) < p_rect.position.y) + return false; + + return true; + } + inline real_t distance_to(const Vector2 &p_point) const { real_t dist = 0.0; |