diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-22 00:26:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-22 23:16:44 +0100 |
commit | 6da0eef9e6695e0da17953d80a1e6b0b673b4678 (patch) | |
tree | 1b08291b93a47f81c2a810f58996e1135777672a /core/math/vector2.h | |
parent | a7891b9d120e1cb49bcdcffc1107f692ed481d86 (diff) | |
download | redot-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/vector2.h')
-rw-r--r-- | core/math/vector2.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h index 1dec830821..ba5558102f 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -311,10 +311,15 @@ struct Vector2i { bool operator<(const Vector2i &p_vec2) const { return (x == p_vec2.x) ? (y < p_vec2.y) : (x < p_vec2.x); } bool operator>(const Vector2i &p_vec2) const { return (x == p_vec2.x) ? (y > p_vec2.y) : (x > p_vec2.x); } + bool operator<=(const Vector2i &p_vec2) const { return x == p_vec2.x ? (y <= p_vec2.y) : (x < p_vec2.x); } + bool operator>=(const Vector2i &p_vec2) const { return x == p_vec2.x ? (y >= p_vec2.y) : (x > p_vec2.x); } + bool operator==(const Vector2i &p_vec2) const; bool operator!=(const Vector2i &p_vec2) const; - real_t get_aspect() const { return width / (real_t)height; } + real_t aspect() const { return width / (real_t)height; } + Vector2i sign() const { return Vector2i(SGN(x), SGN(y)); } + Vector2i abs() const { return Vector2i(ABS(x), ABS(y)); } operator String() const { return String::num(x) + ", " + String::num(y); } |