diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2020-11-07 16:34:54 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-07 16:34:54 -0300 |
| commit | 30b6db99a99a94c64d906c1b828ff44f79a1bc75 (patch) | |
| tree | 0c33e76f2effa5dcb48a7443ae888c20cbda1e44 /core/math/rect2.h | |
| parent | 709964849fdc0c2cb34e5e851df71a66ee28ba1e (diff) | |
| parent | 05de7ce6caf441f8b64dd60d1837835f10d06520 (diff) | |
| download | redot-engine-30b6db99a99a94c64d906c1b828ff44f79a1bc75.tar.gz | |
Merge pull request #43371 from reduz/variant-setget-refactor
Refactored Variant setters/getters
Diffstat (limited to 'core/math/rect2.h')
| -rw-r--r-- | core/math/rect2.h | 17 |
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); } |
