summaryrefslogtreecommitdiffstats
path: root/src/variant
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2022-02-19 16:31:32 +0100
committerGitHub <noreply@github.com>2022-02-19 16:31:32 +0100
commit917b0c2ca3e8363082d62acdc7dc73d77b1c68ec (patch)
tree40f5ea8b599d011a1a11b0fd447ce2f00dc8343f /src/variant
parent6a464b53f1cba8f17f7d423cfe9b4b5a92c538d7 (diff)
parentdf0e28fe43ae40efe13df1dacc8f2fc617cc1e4c (diff)
downloadredot-cpp-917b0c2ca3e8363082d62acdc7dc73d77b1c68ec.tar.gz
Merge pull request #688 from zhehangd/master
Diffstat (limited to 'src/variant')
-rw-r--r--src/variant/vector2.cpp5
-rw-r--r--src/variant/vector3.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/variant/vector2.cpp b/src/variant/vector2.cpp
index 3cc9fda..7ba0910 100644
--- a/src/variant/vector2.cpp
+++ b/src/variant/vector2.cpp
@@ -31,6 +31,7 @@
#include <godot_cpp/core/error_macros.hpp>
#include <godot_cpp/variant/string.hpp>
#include <godot_cpp/variant/vector2.hpp>
+#include <godot_cpp/variant/vector2i.hpp>
namespace godot {
@@ -38,6 +39,10 @@ Vector2::operator String() const {
return String::num(x, 5) + ", " + String::num(y, 5);
}
+Vector2::operator Vector2i() const {
+ return Vector2i(x, y);
+}
+
real_t Vector2::angle() const {
return Math::atan2(y, x);
}
diff --git a/src/variant/vector3.cpp b/src/variant/vector3.cpp
index 5c12c75..6cfb92a 100644
--- a/src/variant/vector3.cpp
+++ b/src/variant/vector3.cpp
@@ -31,6 +31,7 @@
#include <godot_cpp/core/error_macros.hpp>
#include <godot_cpp/variant/basis.hpp>
#include <godot_cpp/variant/vector3.hpp>
+#include <godot_cpp/variant/vector3i.hpp>
namespace godot {
@@ -121,4 +122,8 @@ Vector3::operator String() const {
return (String::num(x, 5) + ", " + String::num(y, 5) + ", " + String::num(z, 5));
}
+Vector3::operator Vector3i() const {
+ return Vector3i(x, y, z);
+}
+
} // namespace godot