Merge pull request #688 from zhehangd/master

pull/707/head
Rémi Verschelde 2022-02-19 16:31:32 +01:00 committed by GitHub
commit 917b0c2ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -153,6 +153,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);
}

View File

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