Use forward declares for vector math types

Adds operators to convert from int vector types to float vector types
as done in the upstream engine implementations.
This commit is contained in:
Rémi Verschelde
2022-02-20 11:47:57 +01:00
parent 917b0c2ca3
commit 7e3321d1b2
12 changed files with 75 additions and 38 deletions

View File

@@ -32,11 +32,12 @@
#define GODOT_VECTOR2I_HPP
#include <godot_cpp/core/math.hpp>
#include <godot_cpp/variant/string.hpp>
#include <godot_cpp/variant/vector2.hpp>
namespace godot {
class String;
class Vector2;
class Vector2i {
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
@@ -96,14 +97,9 @@ public:
Vector2i abs() const { return Vector2i(Math::abs(x), Math::abs(y)); }
operator String() const;
operator Vector2() const { return Vector2((real_t)x, (real_t)y); }
operator Vector2() const;
inline Vector2i() {}
inline Vector2i(const Vector2 &p_vec2) {
x = (int32_t)p_vec2.x;
y = (int32_t)p_vec2.y;
}
inline Vector2i(int32_t p_x, int32_t p_y) {
x = p_x;
y = p_y;