Merge pull request #39064 from bruvzg/gdn_packed_array_ptr

GDNative: Add bindings for the Packed*Array ptr() and ptrw() functions.
This commit is contained in:
Rémi Verschelde 2020-05-27 12:55:17 +02:00 committed by GitHub
commit bd14c6406a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 243 additions and 0 deletions

View file

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

View file

@ -518,6 +518,34 @@
["godot_packed_float64_array *", "p_self"]
]
},
{
"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",
@ -2853,6 +2881,20 @@
["const godot_int", "p_size"]
]
},
{
"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",
@ -2963,6 +3005,20 @@
["const godot_int", "p_size"]
]
},
{
"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",
@ -3073,6 +3129,20 @@
["const godot_int", "p_size"]
]
},
{
"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",
@ -3183,6 +3253,20 @@
["const godot_int", "p_size"]
]
},
{
"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",
@ -3293,6 +3377,20 @@
["const godot_int", "p_size"]
]
},
{
"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",
@ -3403,6 +3501,20 @@
["const godot_int", "p_size"]
]
},
{
"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",
@ -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",

View file

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