diff options
| author | Juan Linietsky <juan@godotengine.org> | 2020-02-22 00:26:41 -0300 |
|---|---|---|
| committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-22 23:16:44 +0100 |
| commit | 6da0eef9e6695e0da17953d80a1e6b0b673b4678 (patch) | |
| tree | 1b08291b93a47f81c2a810f58996e1135777672a /core/math/rect2.h | |
| parent | a7891b9d120e1cb49bcdcffc1107f692ed481d86 (diff) | |
| download | redot-engine-6da0eef9e6695e0da17953d80a1e6b0b673b4678.tar.gz | |
Add support for Vector2i, Rect2i and Vector3i to Variant
WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous
operator problems in Variant.
This was added for this commit (and future C++17 uses) in #36457.
Diffstat (limited to 'core/math/rect2.h')
| -rw-r--r-- | core/math/rect2.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h index 0d2e7eb6e5..e4ea615c22 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -387,6 +387,11 @@ struct Rect2i { size = end - begin; } + _FORCE_INLINE_ Rect2i abs() const { + + return Rect2i(Point2i(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0)), size.abs()); + } + operator String() const { return String(position) + ", " + String(size); } operator Rect2() const { return Rect2(position, size); } |
