summaryrefslogtreecommitdiff
path: root/core/math/rect2.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/rect2.h')
-rw-r--r--core/math/rect2.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 5a746aa732..b1fe865ba5 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -306,6 +306,15 @@ struct Rect2 {
return false;
}
}
+
+ _FORCE_INLINE_ void set_end(const Vector2 &p_end) {
+ size = p_end - position;
+ }
+
+ _FORCE_INLINE_ Vector2 get_end() const {
+ return position + size;
+ }
+
operator String() const { return String(position) + ", " + String(size); }
Rect2() {}
@@ -475,6 +484,14 @@ struct Rect2i {
return Rect2i(Point2i(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0)), size.abs());
}
+ _FORCE_INLINE_ void set_end(const Vector2i &p_end) {
+ size = p_end - position;
+ }
+
+ _FORCE_INLINE_ Vector2i get_end() const {
+ return position + size;
+ }
+
operator String() const { return String(position) + ", " + String(size); }
operator Rect2() const { return Rect2(position, size); }