diff --git a/include/godot_cpp/variant/vector2.hpp b/include/godot_cpp/variant/vector2.hpp index f7ae8b06..56a2c958 100644 --- a/include/godot_cpp/variant/vector2.hpp +++ b/include/godot_cpp/variant/vector2.hpp @@ -151,6 +151,7 @@ public: real_t aspect() const { return width / height; } operator String() const; + operator Vector2i() const; inline Vector2() {} inline Vector2(real_t p_x, real_t p_y) { diff --git a/src/variant/vector2.cpp b/src/variant/vector2.cpp index 3cc9fda5..7ba09102 100644 --- a/src/variant/vector2.cpp +++ b/src/variant/vector2.cpp @@ -31,6 +31,7 @@ #include #include #include +#include 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); }