diff options
author | crupest <crupest@outlook.com> | 2018-09-19 23:43:26 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-19 23:43:26 +0800 |
commit | dea11f34bfab5bfd5f66dec9f2fa0239abf44d89 (patch) | |
tree | 89ba9f88b86c22b25506e43277c3a2fc51a9c2c9 /CruUI/ui/ui_base.h | |
parent | 9caec47adf266946fdce290aaf5ec0c865197650 (diff) | |
download | cru-dea11f34bfab5bfd5f66dec9f2fa0239abf44d89.tar.gz cru-dea11f34bfab5bfd5f66dec9f2fa0239abf44d89.tar.bz2 cru-dea11f34bfab5bfd5f66dec9f2fa0239abf44d89.zip |
Improve linear layout. Add debug border visualization.
Diffstat (limited to 'CruUI/ui/ui_base.h')
-rw-r--r-- | CruUI/ui/ui_base.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/CruUI/ui/ui_base.h b/CruUI/ui/ui_base.h index 8ce82cdf..21d41c6a 100644 --- a/CruUI/ui/ui_base.h +++ b/CruUI/ui/ui_base.h @@ -7,13 +7,16 @@ namespace cru { struct Point { - static const Point zero; + constexpr static Point Zero() + { + return Point(0, 0); + } - Point() = default; - Point(const float x, const float y) : x(x), y(y) { } + constexpr Point() = default; + constexpr Point(const float x, const float y) : x(x), y(y) { } - float x; - float y; + float x = 0; + float y = 0; }; inline bool operator==(const Point& left, const Point& right) @@ -28,13 +31,16 @@ namespace cru struct Size { - static const Size zero; + constexpr static Size Zero() + { + return Size(0, 0); + } - Size() = default; - Size(const float width, const float height) : width(width), height(height) { } + constexpr Size() = default; + constexpr Size(const float width, const float height) : width(width), height(height) { } - float width; - float height; + float width = 0; + float height = 0; }; inline Size operator - (const Size& left, const Size& right) |