summaryrefslogtreecommitdiffstats
path: root/core/math/rect2.h
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2020-02-22 00:26:41 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-22 23:16:44 +0100
commit6da0eef9e6695e0da17953d80a1e6b0b673b4678 (patch)
tree1b08291b93a47f81c2a810f58996e1135777672a /core/math/rect2.h
parenta7891b9d120e1cb49bcdcffc1107f692ed481d86 (diff)
downloadredot-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.h5
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); }