diff options
author | crupest <crupest@outlook.com> | 2018-09-02 16:25:47 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-02 16:25:47 +0800 |
commit | 09e480f0c956a16751a535558b84431ea47cd38f (patch) | |
tree | f98aa86d2b23970c7d03ea2463ea120d06838e17 /CruUI/ui/ui_base.h | |
parent | f3d62dec00748a306af658b87bffc54e4949a4f4 (diff) | |
download | cru-09e480f0c956a16751a535558b84431ea47cd38f.tar.gz cru-09e480f0c956a16751a535558b84431ea47cd38f.tar.bz2 cru-09e480f0c956a16751a535558b84431ea47cd38f.zip |
...
Diffstat (limited to 'CruUI/ui/ui_base.h')
-rw-r--r-- | CruUI/ui/ui_base.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/CruUI/ui/ui_base.h b/CruUI/ui/ui_base.h index 8dfbf53d..43b4a6dc 100644 --- a/CruUI/ui/ui_base.h +++ b/CruUI/ui/ui_base.h @@ -15,6 +15,16 @@ namespace cru float y; }; + inline bool operator==(const Point& left, const Point& right) + { + return left.x == right.x && left.y == right.y; + } + + inline bool operator!=(const Point& left, const Point& right) + { + return !(left == right); + } + struct Size { static const Size zero; @@ -26,7 +36,7 @@ namespace cru float height; }; - struct Rect + struct Rect { Rect() = default; Rect(const float left, const float top, const float width, const float height) @@ -54,10 +64,10 @@ namespace cru return Point(left, top); } - Point GetRightBottom() const + Point GetRightBottom() const { - return Point(left + width, top + height); - } + return Point(left + width, top + height); + } Size GetSize() const { @@ -67,9 +77,9 @@ namespace cru bool IsPointInside(const Point& point) const { return - point.x >= left && - point.x < GetRight() && - point.y >= top && + point.x >= left && + point.x < GetRight() && + point.y >= top && point.y < GetBottom(); } |