Add missing Vector2::operator Vector2i()

pull/688/head
Zhehang Ding 2022-02-07 01:21:36 -08:00
parent 24c94e4af0
commit df0e28fe43
2 changed files with 6 additions and 0 deletions

View File

@ -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) {

View File

@ -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);
}