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

@@ -31,11 +31,15 @@
#ifndef GODOT_RECT2I_HPP
#define GODOT_RECT2I_HPP
#include <godot_cpp/variant/rect2.hpp>
#include <godot_cpp/classes/global_constants.hpp>
#include <godot_cpp/core/math.hpp>
#include <godot_cpp/variant/vector2i.hpp>
namespace godot {
class Rect2;
class String;
class Rect2i {
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
@@ -206,15 +210,10 @@ public:
return position + size;
}
operator String() const { return String(position) + ", " + String(size); }
operator Rect2() const { return Rect2(position, size); }
operator String() const;
operator Rect2() const;
Rect2i() {}
Rect2i(const Rect2 &p_r2) :
position(p_r2.position),
size(p_r2.size) {
}
Rect2i(int p_x, int p_y, int p_width, int p_height) :
position(Point2i(p_x, p_y)),
size(Size2i(p_width, p_height)) {