From 6da0eef9e6695e0da17953d80a1e6b0b673b4678 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 22 Feb 2020 00:26:41 -0300 Subject: 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. --- core/math/rect2.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/math/rect2.h') 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); } -- cgit v1.2.3