diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-13 11:58:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-13 11:58:24 +0200 |
commit | 600b4c9c7b11622e4eb5ed1e5fd70b3d3f66170e (patch) | |
tree | 1b246c4e0efba31a91fbfafa15380f99c45708f0 /core/math/vector2.cpp | |
parent | f4ab76444fc166c592b9b11cb9bd51f3b51a2e77 (diff) | |
parent | 554c776e08c9ee35fa9e2677e02f4005c11ddbc0 (diff) |
Merge pull request #34668 from aaronfranke/to-string
[Core] Reformat structure string operators
Diffstat (limited to 'core/math/vector2.cpp')
-rw-r--r-- | core/math/vector2.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index ea430b15c4..eb3301f5d0 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -193,6 +193,10 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const { return Math::is_equal_approx(x, p_v.x) && Math::is_equal_approx(y, p_v.y); } +Vector2::operator String() const { + return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ")"; +} + /* Vector2i */ Vector2i Vector2i::clamp(const Vector2i &p_min, const Vector2i &p_max) const { @@ -269,3 +273,7 @@ bool Vector2i::operator==(const Vector2i &p_vec2) const { bool Vector2i::operator!=(const Vector2i &p_vec2) const { return x != p_vec2.x || y != p_vec2.y; } + +Vector2i::operator String() const { + return "(" + itos(x) + ", " + itos(y) + ")"; +} |