diff options
author | reduz <reduzio@gmail.com> | 2020-11-06 22:29:22 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2020-11-07 15:16:15 -0300 |
commit | 05de7ce6caf441f8b64dd60d1837835f10d06520 (patch) | |
tree | 0c33e76f2effa5dcb48a7443ae888c20cbda1e44 /core/math/rect2.h | |
parent | 709964849fdc0c2cb34e5e851df71a66ee28ba1e (diff) |
Refactored variant setters/getters
-Discern between named, indexed and keyed
-Get direct access to functions for typed GDScript and GDNative bindings
-Small changes to some classes in order to work with the new setget binder
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); } |