summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/variant
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-02-09 12:36:22 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-02-14 23:17:21 +0200
commitbf8fc4c53d07cf8ac4d8343364899c197076fbc2 (patch)
tree222f7845fd6ce4bc602adebc6da5fa5e7c37d39a /include/godot_cpp/variant
parentbe34bcfff12ace4f79d88cbd9d25415deea058f4 (diff)
downloadredot-cpp-bf8fc4c53d07cf8ac4d8343364899c197076fbc2.tar.gz
Add `ptr()` / `ptrw()` to the arrays, add missing `String` methods, add missing `CharString` method implementations.
Diffstat (limited to 'include/godot_cpp/variant')
-rw-r--r--include/godot_cpp/variant/aabb.hpp10
-rw-r--r--include/godot_cpp/variant/basis.hpp6
-rw-r--r--include/godot_cpp/variant/char_string.hpp12
-rw-r--r--include/godot_cpp/variant/color.hpp8
-rw-r--r--include/godot_cpp/variant/plane.hpp8
-rw-r--r--include/godot_cpp/variant/quaternion.hpp6
-rw-r--r--include/godot_cpp/variant/rect2.hpp16
-rw-r--r--include/godot_cpp/variant/rect2i.hpp8
-rw-r--r--include/godot_cpp/variant/transform2d.hpp6
-rw-r--r--include/godot_cpp/variant/transform3d.hpp6
-rw-r--r--include/godot_cpp/variant/variant.hpp2
-rw-r--r--include/godot_cpp/variant/vector2.hpp6
-rw-r--r--include/godot_cpp/variant/vector2i.hpp6
-rw-r--r--include/godot_cpp/variant/vector3.hpp6
-rw-r--r--include/godot_cpp/variant/vector3i.hpp6
15 files changed, 75 insertions, 37 deletions
diff --git a/include/godot_cpp/variant/aabb.hpp b/include/godot_cpp/variant/aabb.hpp
index f654aae..2cfcc2a 100644
--- a/include/godot_cpp/variant/aabb.hpp
+++ b/include/godot_cpp/variant/aabb.hpp
@@ -44,9 +44,11 @@
namespace godot {
class AABB {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
Vector3 position;
Vector3 size;
@@ -73,8 +75,8 @@ public:
inline bool encloses(const AABB &p_aabb) const; /// p_aabb is completely inside this
AABB merge(const AABB &p_with) const;
- void merge_with(const AABB &p_aabb); ///merge with another AABB
- AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
+ void merge_with(const AABB &p_aabb); /// merge with another AABB
+ AABB intersection(const AABB &p_aabb) const; /// get box where two intersect, empty if no intersection occurs
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
inline bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
diff --git a/include/godot_cpp/variant/basis.hpp b/include/godot_cpp/variant/basis.hpp
index 5dfa95e..8f49c7a 100644
--- a/include/godot_cpp/variant/basis.hpp
+++ b/include/godot_cpp/variant/basis.hpp
@@ -38,9 +38,11 @@
namespace godot {
class Basis {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
Vector3 elements[3] = {
Vector3(1, 0, 0),
Vector3(0, 1, 0),
diff --git a/include/godot_cpp/variant/char_string.hpp b/include/godot_cpp/variant/char_string.hpp
index 3ba8948..469a8e3 100644
--- a/include/godot_cpp/variant/char_string.hpp
+++ b/include/godot_cpp/variant/char_string.hpp
@@ -48,6 +48,9 @@ public:
int length() const;
const char *get_data() const;
+ CharString(CharString &&p_str);
+ void operator=(CharString &&p_str);
+ CharString() {}
~CharString();
};
@@ -63,6 +66,9 @@ public:
int length() const;
const char16_t *get_data() const;
+ Char16String(Char16String &&p_str);
+ void operator=(Char16String &&p_str);
+ Char16String() {}
~Char16String();
};
@@ -78,6 +84,9 @@ public:
int length() const;
const char32_t *get_data() const;
+ Char32String(Char32String &&p_str);
+ void operator=(Char32String &&p_str);
+ Char32String() {}
~Char32String();
};
@@ -93,6 +102,9 @@ public:
int length() const;
const wchar_t *get_data() const;
+ CharWideString(CharWideString &&p_str);
+ void operator=(CharWideString &&p_str);
+ CharWideString() {}
~CharWideString();
};
diff --git a/include/godot_cpp/variant/color.hpp b/include/godot_cpp/variant/color.hpp
index d8948d1..df76833 100644
--- a/include/godot_cpp/variant/color.hpp
+++ b/include/godot_cpp/variant/color.hpp
@@ -38,9 +38,11 @@ namespace godot {
class String;
class Color {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
union {
struct {
float r;
@@ -198,7 +200,7 @@ public:
static Color from_hsv(float p_h, float p_s, float p_v, float p_a);
static Color from_rgbe9995(uint32_t p_rgbe);
- inline bool operator<(const Color &p_color) const; //used in set keys
+ inline bool operator<(const Color &p_color) const; // used in set keys
operator String() const;
// For the binder.
diff --git a/include/godot_cpp/variant/plane.hpp b/include/godot_cpp/variant/plane.hpp
index aa7ccae..4527e9e 100644
--- a/include/godot_cpp/variant/plane.hpp
+++ b/include/godot_cpp/variant/plane.hpp
@@ -38,14 +38,16 @@
namespace godot {
class Plane {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
Vector3 normal;
real_t d = 0;
void set_normal(const Vector3 &p_normal);
- inline Vector3 get_normal() const { return normal; }; ///Point is coplanar, CMP_EPSILON for precision
+ inline Vector3 get_normal() const { return normal; }; /// Point is coplanar, CMP_EPSILON for precision
void normalize();
Plane normalized() const;
diff --git a/include/godot_cpp/variant/quaternion.hpp b/include/godot_cpp/variant/quaternion.hpp
index e87862c..dd7319d 100644
--- a/include/godot_cpp/variant/quaternion.hpp
+++ b/include/godot_cpp/variant/quaternion.hpp
@@ -37,9 +37,11 @@
namespace godot {
class Quaternion {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
union {
struct {
real_t x;
diff --git a/include/godot_cpp/variant/rect2.hpp b/include/godot_cpp/variant/rect2.hpp
index e5a25ca..f696bca 100644
--- a/include/godot_cpp/variant/rect2.hpp
+++ b/include/godot_cpp/variant/rect2.hpp
@@ -40,9 +40,11 @@ namespace godot {
class Transform2D;
class Rect2 {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
Point2 position;
Size2 size;
@@ -161,7 +163,7 @@ public:
new_rect.size.x = Math::max(p_rect.position.x + p_rect.size.x, position.x + size.x);
new_rect.size.y = Math::max(p_rect.position.y + p_rect.size.y, position.y + size.y);
- new_rect.size = new_rect.size - new_rect.position; //make relative again
+ new_rect.size = new_rect.size - new_rect.position; // make relative again
return new_rect;
}
@@ -225,7 +227,7 @@ public:
return r;
}
- inline void expand_to(const Vector2 &p_vector) { //in place function for speed
+ inline void expand_to(const Vector2 &p_vector) { // in place function for speed
Vector2 begin = position;
Vector2 end = position + size;
@@ -279,7 +281,7 @@ public:
continue;
}
- //check inside
+ // check inside
Vector2 tg = r.orthogonal();
float s = tg.dot(center) - tg.dot(a);
if (s < 0.0) {
@@ -288,7 +290,7 @@ public:
side_minus++;
}
- //check ray box
+ // check ray box
r /= l;
Vector2 ir((real_t)1.0 / r.x, (real_t)1.0 / r.y);
@@ -309,7 +311,7 @@ public:
}
if (side_plus * side_minus == 0) {
- return true; //all inside
+ return true; // all inside
} else {
return false;
}
diff --git a/include/godot_cpp/variant/rect2i.hpp b/include/godot_cpp/variant/rect2i.hpp
index f9d023f..9d82668 100644
--- a/include/godot_cpp/variant/rect2i.hpp
+++ b/include/godot_cpp/variant/rect2i.hpp
@@ -37,9 +37,11 @@
namespace godot {
class Rect2i {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
Point2i position;
Size2i size;
@@ -107,7 +109,7 @@ public:
new_rect.size.x = Math::max(p_rect.position.x + p_rect.size.x, position.x + size.x);
new_rect.size.y = Math::max(p_rect.position.y + p_rect.size.y, position.y + size.y);
- new_rect.size = new_rect.size - new_rect.position; //make relative again
+ new_rect.size = new_rect.size - new_rect.position; // make relative again
return new_rect;
}
diff --git a/include/godot_cpp/variant/transform2d.hpp b/include/godot_cpp/variant/transform2d.hpp
index 8e611d0..ac9bc6d 100644
--- a/include/godot_cpp/variant/transform2d.hpp
+++ b/include/godot_cpp/variant/transform2d.hpp
@@ -40,9 +40,11 @@
namespace godot {
class Transform2D {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of elements array, the basis matrix looks like "on paper":
// M = (elements[0][0] elements[1][0])
// (elements[0][1] elements[1][1])
diff --git a/include/godot_cpp/variant/transform3d.hpp b/include/godot_cpp/variant/transform3d.hpp
index 805042b..953dbd6 100644
--- a/include/godot_cpp/variant/transform3d.hpp
+++ b/include/godot_cpp/variant/transform3d.hpp
@@ -40,9 +40,11 @@
namespace godot {
class Transform3D {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
Basis basis;
Vector3 origin;
diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp
index 32536c8..06358a1 100644
--- a/include/godot_cpp/variant/variant.hpp
+++ b/include/godot_cpp/variant/variant.hpp
@@ -45,7 +45,7 @@ namespace godot {
class Variant {
uint8_t opaque[GODOT_CPP_VARIANT_SIZE]{ 0 };
- _FORCE_INLINE_ GDNativeVariantPtr ptr() const { return const_cast<uint8_t(*)[GODOT_CPP_VARIANT_SIZE]>(&opaque); }
+ _FORCE_INLINE_ GDNativeVariantPtr _native_ptr() const { return const_cast<uint8_t(*)[GODOT_CPP_VARIANT_SIZE]>(&opaque); }
friend class GDExtensionBinding;
friend class MethodBind;
diff --git a/include/godot_cpp/variant/vector2.hpp b/include/godot_cpp/variant/vector2.hpp
index f7ae8b0..05ba72f 100644
--- a/include/godot_cpp/variant/vector2.hpp
+++ b/include/godot_cpp/variant/vector2.hpp
@@ -39,9 +39,11 @@ namespace godot {
class Vector2i;
class Vector2 {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
enum Axis {
AXIS_X,
AXIS_Y,
diff --git a/include/godot_cpp/variant/vector2i.hpp b/include/godot_cpp/variant/vector2i.hpp
index a975812..69c6897 100644
--- a/include/godot_cpp/variant/vector2i.hpp
+++ b/include/godot_cpp/variant/vector2i.hpp
@@ -38,9 +38,11 @@
namespace godot {
class Vector2i {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
enum Axis {
AXIS_X,
AXIS_Y,
diff --git a/include/godot_cpp/variant/vector3.hpp b/include/godot_cpp/variant/vector3.hpp
index e435fb6..f34aa05 100644
--- a/include/godot_cpp/variant/vector3.hpp
+++ b/include/godot_cpp/variant/vector3.hpp
@@ -40,9 +40,11 @@ class Basis;
class Vector3i;
class Vector3 {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
enum Axis {
AXIS_X,
AXIS_Y,
diff --git a/include/godot_cpp/variant/vector3i.hpp b/include/godot_cpp/variant/vector3i.hpp
index 8351a8d..9aa0341 100644
--- a/include/godot_cpp/variant/vector3i.hpp
+++ b/include/godot_cpp/variant/vector3i.hpp
@@ -37,9 +37,11 @@
namespace godot {
class Vector3i {
-public:
- _FORCE_INLINE_ GDNativeTypePtr ptr() const { return (void *)this; }
+ _FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
+
+ friend class Variant;
+public:
enum Axis {
AXIS_X,
AXIS_Y,