summaryrefslogtreecommitdiff
path: root/modules/gdnative
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-05-27 12:55:17 +0200
committerGitHub <noreply@github.com>2020-05-27 12:55:17 +0200
commitbd14c6406ae24004fb5ff43d01e099da745219f7 (patch)
treeb2b67f6cfa363112d60f78b24f3b4f6076ae371f /modules/gdnative
parent5c98de273dcec4131ba3329e378e828d11bb0548 (diff)
parent9fbc424d4c3301db85606837901066d7f41d2d04 (diff)
Merge pull request #39064 from bruvzg/gdn_packed_array_ptr
GDNative: Add bindings for the Packed*Array ptr() and ptrw() functions.
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/gdnative/packed_arrays.cpp90
-rw-r--r--modules/gdnative/gdnative_api.json126
-rw-r--r--modules/gdnative/include/gdnative/packed_arrays.h27
3 files changed, 243 insertions, 0 deletions
diff --git a/modules/gdnative/gdnative/packed_arrays.cpp b/modules/gdnative/gdnative/packed_arrays.cpp
index 675d66056a..fc71d50289 100644
--- a/modules/gdnative/gdnative/packed_arrays.cpp
+++ b/modules/gdnative/gdnative/packed_arrays.cpp
@@ -78,6 +78,16 @@ void GDAPI godot_packed_byte_array_new_with_array(godot_packed_byte_array *r_des
}
}
+const uint8_t GDAPI *godot_packed_byte_array_ptr(const godot_packed_byte_array *p_self) {
+ const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self;
+ return self->ptr();
+}
+
+uint8_t GDAPI *godot_packed_byte_array_ptrw(godot_packed_byte_array *p_self) {
+ Vector<uint8_t> *self = (Vector<uint8_t> *)p_self;
+ return self->ptrw();
+}
+
void GDAPI godot_packed_byte_array_append(godot_packed_byte_array *p_self, const uint8_t p_data) {
Vector<uint8_t> *self = (Vector<uint8_t> *)p_self;
self->push_back(p_data);
@@ -162,6 +172,16 @@ void GDAPI godot_packed_int32_array_new_with_array(godot_packed_int32_array *r_d
}
}
+const int32_t GDAPI *godot_packed_int32_array_ptr(const godot_packed_int32_array *p_self) {
+ const Vector<int32_t> *self = (const Vector<int32_t> *)p_self;
+ return self->ptr();
+}
+
+int32_t GDAPI *godot_packed_int32_array_ptrw(godot_packed_int32_array *p_self) {
+ Vector<int32_t> *self = (Vector<int32_t> *)p_self;
+ return self->ptrw();
+}
+
void GDAPI godot_packed_int32_array_append(godot_packed_int32_array *p_self, const int32_t p_data) {
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
self->push_back(p_data);
@@ -246,6 +266,16 @@ void GDAPI godot_packed_int64_array_new_with_array(godot_packed_int64_array *r_d
}
}
+const int64_t GDAPI *godot_packed_int64_array_ptr(const godot_packed_int64_array *p_self) {
+ const Vector<int64_t> *self = (const Vector<int64_t> *)p_self;
+ return self->ptr();
+}
+
+int64_t GDAPI *godot_packed_int64_array_ptrw(godot_packed_int64_array *p_self) {
+ Vector<int64_t> *self = (Vector<int64_t> *)p_self;
+ return self->ptrw();
+}
+
void GDAPI godot_packed_int64_array_append(godot_packed_int64_array *p_self, const int64_t p_data) {
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
self->push_back(p_data);
@@ -330,6 +360,16 @@ void GDAPI godot_packed_float32_array_new_with_array(godot_packed_float32_array
}
}
+const float GDAPI *godot_packed_float32_array_ptr(const godot_packed_float32_array *p_self) {
+ const Vector<float> *self = (const Vector<float> *)p_self;
+ return self->ptr();
+}
+
+float GDAPI *godot_packed_float32_array_ptrw(godot_packed_float32_array *p_self) {
+ Vector<float> *self = (Vector<float> *)p_self;
+ return self->ptrw();
+}
+
void GDAPI godot_packed_float32_array_append(godot_packed_float32_array *p_self, const float p_data) {
Vector<float> *self = (Vector<float> *)p_self;
self->push_back(p_data);
@@ -414,6 +454,16 @@ void GDAPI godot_packed_float64_array_new_with_array(godot_packed_float64_array
}
}
+const double GDAPI *godot_packed_float64_array_ptr(const godot_packed_float64_array *p_self) {
+ const Vector<double> *self = (const Vector<double> *)p_self;
+ return self->ptr();
+}
+
+double GDAPI *godot_packed_float64_array_ptrw(godot_packed_float64_array *p_self) {
+ Vector<double> *self = (Vector<double> *)p_self;
+ return self->ptrw();
+}
+
void GDAPI godot_packed_float64_array_append(godot_packed_float64_array *p_self, const double p_data) {
Vector<double> *self = (Vector<double> *)p_self;
self->push_back(p_data);
@@ -498,6 +548,16 @@ void GDAPI godot_packed_string_array_new_with_array(godot_packed_string_array *r
}
}
+const godot_string GDAPI *godot_packed_string_array_ptr(const godot_packed_string_array *p_self) {
+ const Vector<String> *self = (const Vector<String> *)p_self;
+ return (const godot_string *)self->ptr();
+}
+
+godot_string GDAPI *godot_packed_string_array_ptrw(godot_packed_string_array *p_self) {
+ Vector<String> *self = (Vector<String> *)p_self;
+ return (godot_string *)self->ptrw();
+}
+
void GDAPI godot_packed_string_array_append(godot_packed_string_array *p_self, const godot_string *p_data) {
Vector<String> *self = (Vector<String> *)p_self;
String &s = *(String *)p_data;
@@ -590,6 +650,16 @@ void GDAPI godot_packed_vector2_array_new_with_array(godot_packed_vector2_array
}
}
+const godot_vector2 GDAPI *godot_packed_vector2_array_ptr(const godot_packed_vector2_array *p_self) {
+ const Vector<Vector2> *self = (const Vector<Vector2> *)p_self;
+ return (const godot_vector2 *)self->ptr();
+}
+
+godot_vector2 GDAPI *godot_packed_vector2_array_ptrw(godot_packed_vector2_array *p_self) {
+ Vector<Vector2> *self = (Vector<Vector2> *)p_self;
+ return (godot_vector2 *)self->ptrw();
+}
+
void GDAPI godot_packed_vector2_array_append(godot_packed_vector2_array *p_self, const godot_vector2 *p_data) {
Vector<Vector2> *self = (Vector<Vector2> *)p_self;
Vector2 &s = *(Vector2 *)p_data;
@@ -681,6 +751,16 @@ void GDAPI godot_packed_vector3_array_new_with_array(godot_packed_vector3_array
}
}
+const godot_vector3 GDAPI *godot_packed_vector3_array_ptr(const godot_packed_vector3_array *p_self) {
+ const Vector<Vector3> *self = (const Vector<Vector3> *)p_self;
+ return (const godot_vector3 *)self->ptr();
+}
+
+godot_vector3 GDAPI *godot_packed_vector3_array_ptrw(godot_packed_vector3_array *p_self) {
+ Vector<Vector3> *self = (Vector<Vector3> *)p_self;
+ return (godot_vector3 *)self->ptrw();
+}
+
void GDAPI godot_packed_vector3_array_append(godot_packed_vector3_array *p_self, const godot_vector3 *p_data) {
Vector<Vector3> *self = (Vector<Vector3> *)p_self;
Vector3 &s = *(Vector3 *)p_data;
@@ -772,6 +852,16 @@ void GDAPI godot_packed_color_array_new_with_array(godot_packed_color_array *r_d
}
}
+const godot_color GDAPI *godot_packed_color_array_ptr(const godot_packed_color_array *p_self) {
+ const Vector<Color> *self = (const Vector<Color> *)p_self;
+ return (const godot_color *)self->ptr();
+}
+
+godot_color GDAPI *godot_packed_color_array_ptrw(godot_packed_color_array *p_self) {
+ Vector<Color> *self = (Vector<Color> *)p_self;
+ return (godot_color *)self->ptrw();
+}
+
void GDAPI godot_packed_color_array_append(godot_packed_color_array *p_self, const godot_color *p_data) {
Vector<Color> *self = (Vector<Color> *)p_self;
Color &s = *(Color *)p_data;
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 9c38c8b58d..d174b936a8 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -519,6 +519,34 @@
]
},
{
+ "name": "godot_packed_int64_array_ptr",
+ "return_type": "const int64_t *",
+ "arguments": [
+ ["const godot_packed_int64_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_int64_array_ptrw",
+ "return_type": "int64_t *",
+ "arguments": [
+ ["godot_packed_int64_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_float64_array_ptr",
+ "return_type": "const double *",
+ "arguments": [
+ ["const godot_packed_float64_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_float64_array_ptrw",
+ "return_type": "double *",
+ "arguments": [
+ ["godot_packed_float64_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_rect2_as_rect2i",
"return_type": "godot_rect2i",
"arguments": [
@@ -2854,6 +2882,20 @@
]
},
{
+ "name": "godot_packed_byte_array_ptr",
+ "return_type": "const uint8_t *",
+ "arguments": [
+ ["const godot_packed_byte_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_byte_array_ptrw",
+ "return_type": "uint8_t *",
+ "arguments": [
+ ["godot_packed_byte_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_byte_array_set",
"return_type": "void",
"arguments": [
@@ -2964,6 +3006,20 @@
]
},
{
+ "name": "godot_packed_int32_array_ptr",
+ "return_type": "const int32_t *",
+ "arguments": [
+ ["const godot_packed_int32_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_int32_array_ptrw",
+ "return_type": "int32_t *",
+ "arguments": [
+ ["godot_packed_int32_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_int32_array_set",
"return_type": "void",
"arguments": [
@@ -3074,6 +3130,20 @@
]
},
{
+ "name": "godot_packed_float32_array_ptr",
+ "return_type": "const float *",
+ "arguments": [
+ ["const godot_packed_float32_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_float32_array_ptrw",
+ "return_type": "float *",
+ "arguments": [
+ ["godot_packed_float32_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_float32_array_set",
"return_type": "void",
"arguments": [
@@ -3184,6 +3254,20 @@
]
},
{
+ "name": "godot_packed_string_array_ptr",
+ "return_type": "const godot_string *",
+ "arguments": [
+ ["const godot_packed_string_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_string_array_ptrw",
+ "return_type": "godot_string *",
+ "arguments": [
+ ["godot_packed_string_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_string_array_set",
"return_type": "void",
"arguments": [
@@ -3294,6 +3378,20 @@
]
},
{
+ "name": "godot_packed_vector2_array_ptr",
+ "return_type": "const godot_vector2 *",
+ "arguments": [
+ ["const godot_packed_vector2_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_vector2_array_ptrw",
+ "return_type": "godot_vector2 *",
+ "arguments": [
+ ["godot_packed_vector2_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_vector2_array_set",
"return_type": "void",
"arguments": [
@@ -3404,6 +3502,20 @@
]
},
{
+ "name": "godot_packed_vector3_array_ptr",
+ "return_type": "const godot_vector3 *",
+ "arguments": [
+ ["const godot_packed_vector3_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_vector3_array_ptrw",
+ "return_type": "godot_vector3 *",
+ "arguments": [
+ ["godot_packed_vector3_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_vector3_array_set",
"return_type": "void",
"arguments": [
@@ -3512,6 +3624,20 @@
["godot_packed_color_array *", "p_self"],
["const godot_int", "p_size"]
]
+ },
+ {
+ "name": "godot_packed_color_array_ptr",
+ "return_type": "const godot_color *",
+ "arguments": [
+ ["const godot_packed_color_array *", "p_self"]
+ ]
+ },
+ {
+ "name": "godot_packed_color_array_ptrw",
+ "return_type": "godot_color *",
+ "arguments": [
+ ["godot_packed_color_array *", "p_self"]
+ ]
},
{
"name": "godot_packed_color_array_set",
diff --git a/modules/gdnative/include/gdnative/packed_arrays.h b/modules/gdnative/include/gdnative/packed_arrays.h
index d5bad70bdc..8cff6d49a5 100644
--- a/modules/gdnative/include/gdnative/packed_arrays.h
+++ b/modules/gdnative/include/gdnative/packed_arrays.h
@@ -158,6 +158,9 @@ void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *r_dest);
void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src);
void GDAPI godot_packed_byte_array_new_with_array(godot_packed_byte_array *r_dest, const godot_array *p_a);
+const uint8_t GDAPI *godot_packed_byte_array_ptr(const godot_packed_byte_array *p_self);
+uint8_t GDAPI *godot_packed_byte_array_ptrw(godot_packed_byte_array *p_self);
+
void GDAPI godot_packed_byte_array_append(godot_packed_byte_array *p_self, const uint8_t p_data);
void GDAPI godot_packed_byte_array_append_array(godot_packed_byte_array *p_self, const godot_packed_byte_array *p_array);
@@ -187,6 +190,9 @@ void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *r_dest);
void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src);
void GDAPI godot_packed_int32_array_new_with_array(godot_packed_int32_array *r_dest, const godot_array *p_a);
+const int32_t GDAPI *godot_packed_int32_array_ptr(const godot_packed_int32_array *p_self);
+int32_t GDAPI *godot_packed_int32_array_ptrw(godot_packed_int32_array *p_self);
+
void GDAPI godot_packed_int32_array_append(godot_packed_int32_array *p_self, const int32_t p_data);
void GDAPI godot_packed_int32_array_append_array(godot_packed_int32_array *p_self, const godot_packed_int32_array *p_array);
@@ -216,6 +222,9 @@ void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *r_dest);
void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src);
void GDAPI godot_packed_int64_array_new_with_array(godot_packed_int64_array *r_dest, const godot_array *p_a);
+const int64_t GDAPI *godot_packed_int64_array_ptr(const godot_packed_int64_array *p_self);
+int64_t GDAPI *godot_packed_int64_array_ptrw(godot_packed_int64_array *p_self);
+
void GDAPI godot_packed_int64_array_append(godot_packed_int64_array *p_self, const int64_t p_data);
void GDAPI godot_packed_int64_array_append_array(godot_packed_int64_array *p_self, const godot_packed_int64_array *p_array);
@@ -245,6 +254,9 @@ void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *r_dest);
void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src);
void GDAPI godot_packed_float32_array_new_with_array(godot_packed_float32_array *r_dest, const godot_array *p_a);
+const float GDAPI *godot_packed_float32_array_ptr(const godot_packed_float32_array *p_self);
+float GDAPI *godot_packed_float32_array_ptrw(godot_packed_float32_array *p_self);
+
void GDAPI godot_packed_float32_array_append(godot_packed_float32_array *p_self, const float p_data);
void GDAPI godot_packed_float32_array_append_array(godot_packed_float32_array *p_self, const godot_packed_float32_array *p_array);
@@ -274,6 +286,9 @@ void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *r_dest);
void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src);
void GDAPI godot_packed_float64_array_new_with_array(godot_packed_float64_array *r_dest, const godot_array *p_a);
+const double GDAPI *godot_packed_float64_array_ptr(const godot_packed_float64_array *p_self);
+double GDAPI *godot_packed_float64_array_ptrw(godot_packed_float64_array *p_self);
+
void GDAPI godot_packed_float64_array_append(godot_packed_float64_array *p_self, const double p_data);
void GDAPI godot_packed_float64_array_append_array(godot_packed_float64_array *p_self, const godot_packed_float64_array *p_array);
@@ -303,6 +318,9 @@ void GDAPI godot_packed_string_array_new(godot_packed_string_array *r_dest);
void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src);
void GDAPI godot_packed_string_array_new_with_array(godot_packed_string_array *r_dest, const godot_array *p_a);
+const godot_string GDAPI *godot_packed_string_array_ptr(const godot_packed_string_array *p_self);
+godot_string GDAPI *godot_packed_string_array_ptrw(godot_packed_string_array *p_self);
+
void GDAPI godot_packed_string_array_append(godot_packed_string_array *p_self, const godot_string *p_data);
void GDAPI godot_packed_string_array_append_array(godot_packed_string_array *p_self, const godot_packed_string_array *p_array);
@@ -332,6 +350,9 @@ void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *r_dest);
void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src);
void GDAPI godot_packed_vector2_array_new_with_array(godot_packed_vector2_array *r_dest, const godot_array *p_a);
+const godot_vector2 GDAPI *godot_packed_vector2_array_ptr(const godot_packed_vector2_array *p_self);
+godot_vector2 GDAPI *godot_packed_vector2_array_ptrw(godot_packed_vector2_array *p_self);
+
void GDAPI godot_packed_vector2_array_append(godot_packed_vector2_array *p_self, const godot_vector2 *p_data);
void GDAPI godot_packed_vector2_array_append_array(godot_packed_vector2_array *p_self, const godot_packed_vector2_array *p_array);
@@ -361,6 +382,9 @@ void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *r_dest);
void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src);
void GDAPI godot_packed_vector3_array_new_with_array(godot_packed_vector3_array *r_dest, const godot_array *p_a);
+const godot_vector3 GDAPI *godot_packed_vector3_array_ptr(const godot_packed_vector3_array *p_self);
+godot_vector3 GDAPI *godot_packed_vector3_array_ptrw(godot_packed_vector3_array *p_self);
+
void GDAPI godot_packed_vector3_array_append(godot_packed_vector3_array *p_self, const godot_vector3 *p_data);
void GDAPI godot_packed_vector3_array_append_array(godot_packed_vector3_array *p_self, const godot_packed_vector3_array *p_array);
@@ -390,6 +414,9 @@ void GDAPI godot_packed_color_array_new(godot_packed_color_array *r_dest);
void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src);
void GDAPI godot_packed_color_array_new_with_array(godot_packed_color_array *r_dest, const godot_array *p_a);
+const godot_color GDAPI *godot_packed_color_array_ptr(const godot_packed_color_array *p_self);
+godot_color GDAPI *godot_packed_color_array_ptrw(godot_packed_color_array *p_self);
+
void GDAPI godot_packed_color_array_append(godot_packed_color_array *p_self, const godot_color *p_data);
void GDAPI godot_packed_color_array_append_array(godot_packed_color_array *p_self, const godot_packed_color_array *p_array);