diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-06-06 09:44:38 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-06-06 09:44:38 -0300 |
commit | 9acab32daaea38e09c4d74d5f0340479d3dd41bd (patch) | |
tree | c978e8206cc9319f32c71168fb612fc30b4ec809 /core/math | |
parent | 07a466f6e6dd28bbb8b917690b634070537f1613 (diff) |
new file dialog!
-ItemList control for easier lists/thumbnails
-New file dialog, with support for thumbnails, favorites, recent places,
etc
-Moved .fscache out of the project, no more bugs due to committed/pulled
.fscache!
-Dir dialog now sorts directories
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/math_2d.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/math/math_2d.h b/core/math/math_2d.h index ac315fddb7..5e6cefd114 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -226,6 +226,29 @@ struct Rect2 { return true; } + inline float distance_to(const Vector2& p_point) const { + + float dist = 1e20; + + if (p_point.x < pos.x) { + dist=MIN(dist,pos.x-p_point.x); + } + if (p_point.y < pos.y) { + dist=MIN(dist,pos.y-p_point.y); + } + if (p_point.x >= (pos.x+size.x) ) { + dist=MIN(p_point.x-(pos.x+size.x),dist); + } + if (p_point.y >= (pos.y+size.y) ) { + dist=MIN(p_point.y-(pos.y+size.y),dist); + } + + if (dist==1e20) + return 0; + else + return dist; + } + _FORCE_INLINE_ bool intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const; bool intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos=NULL, Point2* r_normal=NULL) const; |