Finish implementation of GDnative builtins bindings

This commit is contained in:
Emmanuel Leblond 2017-04-17 21:42:11 +02:00
parent a75623f436
commit abcb044bf3
No known key found for this signature in database
GPG Key ID: C360860E645EFFC0
43 changed files with 2521 additions and 2338 deletions

View File

@ -1460,7 +1460,6 @@ void register_variant_methods() {
ADDFUNC1(VECTOR3, BASIS, Vector3, outer, VECTOR3, "b", varray());
ADDFUNC0(VECTOR3, BASIS, Vector3, to_diagonal_matrix, varray());
ADDFUNC0(VECTOR3, VECTOR3, Vector3, abs, varray());
ADDFUNC0(VECTOR3, VECTOR3, Vector3, abs, varray());
ADDFUNC0(VECTOR3, VECTOR3, Vector3, floor, varray());
ADDFUNC0(VECTOR3, VECTOR3, Vector3, ceil, varray());
ADDFUNC1(VECTOR3, REAL, Vector3, distance_to, VECTOR3, "b", varray());

View File

@ -1,7 +1,7 @@
def can_build(platform):
return False
return True
def configure(env):

View File

@ -40,7 +40,7 @@
#include "godot.h"
class GDNativeScriptData;
struct GDNativeScriptData;
class GDNativeLibrary;
struct NativeLibrary {
@ -127,8 +127,6 @@ struct GDNativeScriptData {
}
};
class GDNativeLibrary;
class GDNativeScript : public Script {
GDCLASS(GDNativeScript, Script);
@ -208,7 +206,7 @@ class GDNativeLibrary : public Resource {
protected:
friend class GDNativeScript;
friend class NativeLibrary;
friend struct NativeLibrary;
friend class GDNativeReloadNode;
GDNativeScriptData *get_script_data(const StringName p_name);

View File

@ -51,10 +51,8 @@ extern "C" void _basis_api_anchor();
extern "C" void _rect3_api_anchor();
extern "C" void _transform_api_anchor();
extern "C" void _color_api_anchor();
extern "C" void _image_api_anchor();
extern "C" void _node_path_api_anchor();
extern "C" void _rid_api_anchor();
extern "C" void _input_event_api_anchor();
extern "C" void _dictionary_api_anchor();
extern "C" void _array_api_anchor();
extern "C" void _pool_arrays_api_anchor();
@ -73,10 +71,8 @@ void _api_anchor() {
_basis_api_anchor();
_transform_api_anchor();
_color_api_anchor();
_image_api_anchor();
_node_path_api_anchor();
_rid_api_anchor();
_input_event_api_anchor();
_dictionary_api_anchor();
_array_api_anchor();
_pool_arrays_api_anchor();

View File

@ -139,6 +139,31 @@ typedef float godot_real;
/////// Object (forward declared)
typedef void godot_object;
/////// Brute force forward declarations for the rest
typedef struct godot_variant godot_variant;
typedef struct godot_string godot_string;
typedef struct godot_vector2 godot_vector2;
typedef struct godot_rect2 godot_rect2;
typedef struct godot_vector3 godot_vector3;
typedef struct godot_transform2d godot_transform2d;
typedef struct godot_plane godot_plane;
typedef struct godot_quat godot_quat;
typedef struct godot_rect3 godot_rect3;
typedef struct godot_basis godot_basis;
typedef struct godot_transform godot_transform;
typedef struct godot_color godot_color;
typedef struct godot_node_path godot_node_path;
typedef struct godot_rid godot_rid;
typedef struct godot_dictionary godot_dictionary;
typedef struct godot_array godot_array;
typedef struct godot_pool_byte_array godot_pool_byte_array;
typedef struct godot_pool_int_array godot_pool_int_array;
typedef struct godot_pool_real_array godot_pool_real_array;
typedef struct godot_pool_string_array godot_pool_string_array;
typedef struct godot_pool_vector2_array godot_pool_vector2_array;
typedef struct godot_pool_vector3_array godot_pool_vector3_array;
typedef struct godot_pool_color_array godot_pool_color_array;
/////// String
#include "godot/godot_string.h"
@ -183,10 +208,6 @@ typedef void godot_object;
#include "godot/godot_color.h"
/////// Image
#include "godot/godot_image.h"
/////// NodePath
#include "godot/godot_node_path.h"
@ -195,10 +216,6 @@ typedef void godot_object;
#include "godot/godot_rid.h"
/////// InputEvent
#include "godot/godot_input_event.h"
/////// Dictionary
#include "godot/godot_dictionary.h"

View File

@ -139,9 +139,13 @@ void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godo
a->operator[](p_idx) = *val;
}
godot_variant GDAPI *godot_array_get(godot_array *p_arr, const godot_int p_idx) {
Array *a = (Array *)p_arr;
return (godot_variant *)&a->operator[](p_idx);
godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx) {
godot_variant raw_dest;
Variant *dest = (Variant *)&raw_dest;
memnew_placement(dest, Variant);
const Array *a = (const Array *)p_arr;
*dest = a->operator[](p_idx);
return raw_dest;
}
void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) {
@ -155,25 +159,25 @@ void GDAPI godot_array_clear(godot_array *p_arr) {
a->clear();
}
godot_int GDAPI godot_array_count(godot_array *p_arr, const godot_variant *p_value) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_value;
godot_int GDAPI godot_array_count(const godot_array *p_arr, const godot_variant *p_value) {
const Array *a = (const Array *)p_arr;
const Variant *val = (const Variant *)p_value;
return a->count(*val);
}
godot_bool GDAPI godot_array_empty(const godot_array *p_arr) {
Array *a = (Array *)p_arr;
const Array *a = (const Array *)p_arr;
return a->empty();
}
void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_value;
const Variant *val = (const Variant *)p_value;
a->erase(*val);
}
godot_variant GDAPI godot_array_front(const godot_array *p_arr) {
Array *a = (Array *)p_arr;
const Array *a = (const Array *)p_arr;
godot_variant v;
Variant *val = (Variant *)&v;
memnew_placement(val, Variant);
@ -182,7 +186,7 @@ godot_variant GDAPI godot_array_front(const godot_array *p_arr) {
}
godot_variant GDAPI godot_array_back(const godot_array *p_arr) {
Array *a = (Array *)p_arr;
const Array *a = (const Array *)p_arr;
godot_variant v;
Variant *val = (Variant *)&v;
memnew_placement(val, Variant);
@ -191,31 +195,31 @@ godot_variant GDAPI godot_array_back(const godot_array *p_arr) {
}
godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_what;
const Array *a = (const Array *)p_arr;
const Variant *val = (const Variant *)p_what;
return a->find(*val, p_from);
}
godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_what;
const Array *a = (const Array *)p_arr;
const Variant *val = (const Variant *)p_what;
return a->find_last(*val);
}
godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_value;
const Array *a = (const Array *)p_arr;
const Variant *val = (const Variant *)p_value;
return a->has(*val);
}
uint32_t GDAPI godot_array_hash(const godot_array *p_arr) {
Array *a = (Array *)p_arr;
const Array *a = (const Array *)p_arr;
return a->hash();
}
void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_value;
const Variant *val = (const Variant *)p_value;
a->insert(p_pos, *val);
}
@ -224,11 +228,6 @@ void GDAPI godot_array_invert(godot_array *p_arr) {
a->invert();
}
godot_bool GDAPI godot_array_is_shared(const godot_array *p_arr) {
Array *a = (Array *)p_arr;
return false; // @Todo how do I do it?
}
godot_variant GDAPI godot_array_pop_back(godot_array *p_arr) {
Array *a = (Array *)p_arr;
godot_variant v;
@ -249,13 +248,13 @@ godot_variant GDAPI godot_array_pop_front(godot_array *p_arr) {
void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_value;
const Variant *val = (const Variant *)p_value;
a->push_back(*val);
}
void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_value;
const Variant *val = (const Variant *)p_value;
a->push_front(*val);
}
@ -270,13 +269,13 @@ void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size) {
}
godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
Array *a = (Array *)p_arr;
Variant *val = (Variant *)p_what;
const Array *a = (const Array *)p_arr;
const Variant *val = (const Variant *)p_what;
return a->rfind(*val, p_from);
}
godot_int GDAPI godot_array_size(const godot_array *p_arr) {
Array *a = (Array *)p_arr;
const Array *a = (const Array *)p_arr;
return a->size();
}
@ -287,7 +286,7 @@ void GDAPI godot_array_sort(godot_array *p_arr) {
void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func) {
Array *a = (Array *)p_arr;
String *func = (String *)p_func;
const String *func = (const String *)p_func;
a->sort_custom((Object *)p_obj, *func);
}

View File

@ -43,11 +43,11 @@ typedef struct godot_array {
} godot_array;
#endif
#include "../godot.h"
#include "godot_pool_arrays.h"
#include "godot_variant.h"
#include "../godot.h"
void GDAPI godot_array_new(godot_array *p_arr);
void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca);
void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a);
@ -59,13 +59,13 @@ void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_
void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value);
godot_variant GDAPI *godot_array_get(godot_array *p_arr, const godot_int p_idx);
godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx);
void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value);
void GDAPI godot_array_clear(godot_array *p_arr);
godot_int GDAPI godot_array_count(godot_array *p_arr, const godot_variant *p_value);
godot_int GDAPI godot_array_count(const godot_array *p_arr, const godot_variant *p_value);
godot_bool GDAPI godot_array_empty(const godot_array *p_arr);
@ -87,8 +87,6 @@ void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const g
void GDAPI godot_array_invert(godot_array *p_arr);
godot_bool GDAPI godot_array_is_shared(const godot_array *p_arr);
godot_variant GDAPI godot_array_pop_back(godot_array *p_arr);
godot_variant GDAPI godot_array_pop_front(godot_array *p_arr);

View File

@ -28,186 +28,243 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_basis.h"
#include "core/variant.h"
#include "math/matrix3.h"
#include "core/math/matrix3.h"
#ifdef __cplusplus
extern "C" {
#endif
void _basis_api_anchor() {
void _basis_api_anchor() {}
void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) {
const Vector3 *x_axis = (const Vector3 *)p_x_axis;
const Vector3 *y_axis = (const Vector3 *)p_y_axis;
const Vector3 *z_axis = (const Vector3 *)p_z_axis;
Basis *dest = (Basis *)r_dest;
*dest = Basis(*x_axis, *y_axis, *z_axis);
}
void GDAPI godot_basis_new(godot_basis *p_v) {
Basis *v = (Basis *)p_v;
*v = Basis();
void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi) {
const Vector3 *axis = (const Vector3 *)p_axis;
Basis *dest = (Basis *)r_dest;
*dest = Basis(*axis, p_phi);
}
void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_v, const godot_quat *p_euler) {
Basis *v = (Basis *)p_v;
Quat *euler = (Quat *)p_euler;
*v = Basis(*euler);
void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler) {
const Vector3 *euler = (const Vector3 *)p_euler;
Basis *dest = (Basis *)r_dest;
*dest = Basis(*euler);
}
void GDAPI godot_basis_new_with_euler(godot_basis *p_v, const godot_vector3 p_euler) {
Basis *v = (Basis *)p_v;
Vector3 *euler = (Vector3 *)&p_euler;
*v = Basis(*euler);
godot_string GDAPI godot_basis_as_string(const godot_basis *p_self) {
godot_string ret;
const Basis *self = (const Basis *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi) {
Basis *v = (Basis *)p_v;
const Vector3 *axis = (Vector3 *)&p_axis;
*v = Basis(*axis, p_phi);
godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self) {
godot_basis dest;
const Basis *self = (const Basis *)p_self;
*((Basis *)&dest) = self->inverse();
return dest;
}
void GDAPI godot_basis_new_with_rows(godot_basis *p_v, const godot_vector3 p_row0, const godot_vector3 p_row1, const godot_vector3 p_row2) {
Basis *v = (Basis *)p_v;
const Vector3 *row0 = (Vector3 *)&p_row0;
const Vector3 *row1 = (Vector3 *)&p_row1;
const Vector3 *row2 = (Vector3 *)&p_row2;
*v = Basis(*row0, *row1, *row2);
godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self) {
godot_basis dest;
const Basis *self = (const Basis *)p_self;
*((Basis *)&dest) = self->transposed();
return dest;
}
godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_v) {
const Basis *v = (const Basis *)p_v;
godot_quat quat;
Quat *p_quat = (Quat *)&quat;
*p_quat = v->operator Quat();
return quat;
godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self) {
godot_basis dest;
const Basis *self = (const Basis *)p_self;
*((Basis *)&dest) = self->orthonormalized();
return dest;
}
/*
* p_elements is a pointer to an array of 3 (!!) vector3
*/
void GDAPI godot_basis_get_elements(godot_basis *p_v, godot_vector3 *p_elements) {
Basis *v = (Basis *)p_v;
godot_real GDAPI godot_basis_determinant(const godot_basis *p_self) {
const Basis *self = (const Basis *)p_self;
return self->determinant();
}
godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi) {
godot_basis dest;
const Basis *self = (const Basis *)p_self;
const Vector3 *axis = (const Vector3 *)p_axis;
*((Basis *)&dest) = self->rotated(*axis, p_phi);
return dest;
}
godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale) {
godot_basis dest;
const Basis *self = (const Basis *)p_self;
const Vector3 *scale = (const Vector3 *)p_scale;
*((Basis *)&dest) = self->scaled(*scale);
return dest;
}
void GDAPI godot_basis_set_scale(godot_basis *p_self, const godot_vector3 *p_scale) {
Basis *self = (Basis *)p_self;
const Vector3 *scale = (const Vector3 *)p_scale;
self->set_scale(*scale);
}
void GDAPI godot_basis_set_rotation_euler(godot_basis *p_self, const godot_vector3 *p_euler) {
Basis *self = (Basis *)p_self;
const Vector3 *euler = (const Vector3 *)p_euler;
self->set_rotation_euler(*euler);
}
void GDAPI godot_basis_set_rotation_axis_angle(godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_angle) {
Basis *self = (Basis *)p_self;
const Vector3 *axis = (const Vector3 *)p_axis;
self->set_rotation_axis_angle(*axis, p_angle);
}
godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self) {
godot_vector3 dest;
const Basis *self = (const Basis *)p_self;
*((Vector3 *)&dest) = self->get_scale();
return dest;
}
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self) {
godot_vector3 dest;
const Basis *self = (const Basis *)p_self;
*((Vector3 *)&dest) = self->get_euler();
return dest;
}
godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with) {
const Basis *self = (const Basis *)p_self;
const Vector3 *with = (const Vector3 *)p_with;
return self->tdotx(*with);
}
godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with) {
const Basis *self = (const Basis *)p_self;
const Vector3 *with = (const Vector3 *)p_with;
return self->tdoty(*with);
}
godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with) {
const Basis *self = (const Basis *)p_self;
const Vector3 *with = (const Vector3 *)p_with;
return self->tdotz(*with);
}
godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v) {
godot_vector3 dest;
const Basis *self = (const Basis *)p_self;
const Vector3 *v = (const Vector3 *)p_v;
*((Vector3 *)&dest) = self->xform(*v);
return dest;
}
godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v) {
godot_vector3 dest;
const Basis *self = (const Basis *)p_self;
const Vector3 *v = (const Vector3 *)p_v;
*((Vector3 *)&dest) = self->xform_inv(*v);
return dest;
}
godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self) {
const Basis *self = (const Basis *)p_self;
return self->get_orthogonal_index();
}
void GDAPI godot_basis_new(godot_basis *r_dest) {
Basis *dest = (Basis *)r_dest;
*dest = Basis();
}
void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler) {
Basis *dest = (Basis *)r_dest;
const Quat *euler = (const Quat *)p_euler;
*dest = Basis(*euler);
}
// p_elements is a pointer to an array of 3 (!!) vector3
void GDAPI godot_basis_get_elements(godot_basis *p_self, godot_vector3 *p_elements) {
const Basis *self = (const Basis *)p_self;
Vector3 *elements = (Vector3 *)p_elements;
elements[0] = v->elements[0];
elements[1] = v->elements[1];
elements[2] = v->elements[2];
elements[0] = self->elements[0];
elements[1] = self->elements[1];
elements[2] = self->elements[2];
}
godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_v, const godot_int p_axis) {
godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Basis *v = (Basis *)p_v;
*d = v->get_axis(p_axis);
const Basis *self = (const Basis *)p_self;
*d = self->get_axis(p_axis);
return dest;
}
void GDAPI godot_basis_set_axis(godot_basis *p_v, const godot_int p_axis, const godot_vector3 p_value) {
Basis *v = (Basis *)p_v;
const Vector3 *value = (Vector3 *)&p_value;
v->set_axis(p_axis, *value);
void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value) {
Basis *self = (Basis *)p_self;
const Vector3 *value = (const Vector3 *)p_value;
self->set_axis(p_axis, *value);
}
godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_v, const godot_int p_row) {
godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Basis *v = (Basis *)p_v;
*d = v->get_row(p_row);
const Basis *self = (const Basis *)p_self;
*d = self->get_row(p_row);
return dest;
}
void GDAPI godot_basis_set_row(godot_basis *p_v, const godot_int p_row, const godot_vector3 p_value) {
Basis *v = (Basis *)p_v;
const Vector3 *value = (Vector3 *)&p_value;
v->set_row(p_row, *value);
void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value) {
Basis *self = (Basis *)p_self;
const Vector3 *value = (const Vector3 *)p_value;
self->set_row(p_row, *value);
}
godot_real godot_basis_determinant(const godot_basis *p_v) {
Basis *v = (Basis *)p_v;
return v->determinant();
godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b) {
const Basis *self = (const Basis *)p_self;
const Basis *b = (const Basis *)p_b;
return *self == *b;
}
godot_vector3 godot_basis_get_euler(const godot_basis *p_v) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Basis *v = (Basis *)p_v;
*d = v->get_euler();
return dest;
godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b) {
godot_basis raw_dest;
Basis *dest = (Basis *)&raw_dest;
const Basis *self = (const Basis *)p_self;
const Basis *b = (const Basis *)p_b;
*dest = *self + *b;
return raw_dest;
}
godot_int godot_basis_get_orthogonal_index(const godot_basis *p_v) {
const Basis *v = (Basis *)p_v;
return v->get_orthogonal_index();
godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b) {
godot_basis raw_dest;
Basis *dest = (Basis *)&raw_dest;
const Basis *self = (const Basis *)p_self;
const Basis *b = (const Basis *)p_b;
*dest = *self - *b;
return raw_dest;
}
godot_vector3 godot_basis_get_scale(const godot_basis *p_v) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Basis *v = (Basis *)p_v;
*d = v->get_scale();
return dest;
godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b) {
godot_basis raw_dest;
Basis *dest = (Basis *)&raw_dest;
const Basis *self = (const Basis *)p_self;
const Basis *b = (const Basis *)p_b;
*dest = *self * *b;
return raw_dest;
}
void godot_basis_inverse(godot_basis *p_dest, const godot_basis *p_v) {
Basis *d = (Basis *)p_dest;
const Basis *v = (Basis *)p_v;
*d = v->inverse();
}
void godot_basis_orthonormalized(godot_basis *p_dest, const godot_basis *p_v) {
Basis *d = (Basis *)p_dest;
const Basis *v = (Basis *)p_v;
*d = v->orthonormalized();
}
void godot_basis_rotated(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi) {
Basis *d = (Basis *)p_dest;
const Basis *v = (Basis *)p_v;
const Vector3 *axis = (Vector3 *)&p_axis;
*d = v->rotated(*axis, p_phi);
}
void godot_basis_scaled(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_scale) {
Basis *d = (Basis *)p_dest;
const Basis *v = (Basis *)p_v;
const Vector3 *scale = (Vector3 *)&p_scale;
*d = v->scaled(*scale);
}
godot_real godot_basis_tdotx(const godot_basis *p_v, const godot_vector3 p_with) {
const Basis *v = (Basis *)p_v;
const Vector3 *with = (Vector3 *)&p_with;
return v->tdotx(*with);
}
godot_real godot_basis_tdoty(const godot_basis *p_v, const godot_vector3 p_with) {
const Basis *v = (Basis *)p_v;
const Vector3 *with = (Vector3 *)&p_with;
return v->tdoty(*with);
}
godot_real godot_basis_tdotz(const godot_basis *p_v, const godot_vector3 p_with) {
const Basis *v = (Basis *)p_v;
const Vector3 *with = (Vector3 *)&p_with;
return v->tdotz(*with);
}
void godot_basis_transposed(godot_basis *p_dest, const godot_basis *p_v) {
Basis *d = (Basis *)p_dest;
const Basis *v = (Basis *)p_v;
*d = v->transposed();
}
godot_vector3 godot_basis_xform(const godot_basis *p_v, const godot_vector3 p_vect) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Basis *v = (Basis *)p_v;
const Vector3 *vect = (Vector3 *)&p_vect;
*d = v->xform(*vect);
return dest;
}
godot_vector3 godot_basis_xform_inv(const godot_basis *p_v, const godot_vector3 p_vect) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Basis *v = (Basis *)p_v;
const Vector3 *vect = (Vector3 *)&p_vect;
*d = v->xform_inv(*vect);
return dest;
godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b) {
godot_basis raw_dest;
Basis *dest = (Basis *)&raw_dest;
const Basis *self = (const Basis *)p_self;
*dest = *self * p_b;
return raw_dest;
}
#ifdef __cplusplus

View File

@ -37,45 +37,79 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
typedef struct godot_basis {
uint8_t _dont_touch_that[36];
} godot_basis;
#endif
#include "../godot.h"
#include "godot_quat.h"
#include "godot_vector3.h"
void GDAPI godot_basis_new(godot_basis *p_v);
void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_v, const godot_quat *p_euler);
void GDAPI godot_basis_new_with_euler(godot_basis *p_v, const godot_vector3 p_euler);
void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi);
void GDAPI godot_basis_new_with_rows(godot_basis *p_v, const godot_vector3 p_row0, const godot_vector3 p_row1, const godot_vector3 p_row2);
void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis);
void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi);
void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler);
godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_v);
godot_string GDAPI godot_basis_as_string(const godot_basis *p_self);
/*
* p_elements is a pointer to an array of 3 (!!) vector3
*/
void GDAPI godot_basis_get_elements(godot_basis *p_v, godot_vector3 *p_elements);
godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_v, const godot_int p_axis);
void GDAPI godot_basis_set_axis(godot_basis *p_v, const godot_int p_axis, const godot_vector3 p_value);
godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_v, const godot_int p_row);
void GDAPI godot_basis_set_row(godot_basis *p_v, const godot_int p_row, const godot_vector3 p_value);
godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self);
godot_real godot_basis_determinant(const godot_basis *p_v);
godot_vector3 godot_basis_get_euler(const godot_basis *p_v);
godot_int godot_basis_get_orthogonal_index(const godot_basis *p_v);
godot_vector3 godot_basis_get_scale(const godot_basis *p_v);
void godot_basis_inverse(godot_basis *p_dest, const godot_basis *p_v);
void godot_basis_orthonormalized(godot_basis *p_dest, const godot_basis *p_v);
void godot_basis_rotated(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi);
void godot_basis_scaled(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_scale);
godot_real godot_basis_tdotx(const godot_basis *p_v, const godot_vector3 p_with);
godot_real godot_basis_tdoty(const godot_basis *p_v, const godot_vector3 p_with);
godot_real godot_basis_tdotz(const godot_basis *p_v, const godot_vector3 p_with);
void godot_basis_transposed(godot_basis *p_dest, const godot_basis *p_v);
godot_vector3 godot_basis_xform(const godot_basis *p_v, const godot_vector3 p_vect);
godot_vector3 godot_basis_xform_inv(const godot_basis *p_v, const godot_vector3 p_vect);
godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self);
godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self);
godot_real GDAPI godot_basis_determinant(const godot_basis *p_self);
godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi);
godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale);
void GDAPI godot_basis_set_scale(godot_basis *p_self, const godot_vector3 *p_scale);
void GDAPI godot_basis_set_rotation_euler(godot_basis *p_self, const godot_vector3 *p_euler);
void GDAPI godot_basis_set_rotation_axis_angle(godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_angle);
godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self);
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self);
godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with);
godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with);
godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with);
godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v);
godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v);
godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self);
void GDAPI godot_basis_new(godot_basis *r_dest);
void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler);
// p_elements is a pointer to an array of 3 (!!) vector3
void GDAPI godot_basis_get_elements(godot_basis *p_self, godot_vector3 *p_elements);
godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis);
void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value);
godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row);
void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value);
godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b);
godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b);
godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b);
godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b);
godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b);
#ifdef __cplusplus
}

View File

@ -28,34 +28,98 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_color.h"
#include "core/variant.h"
#include "color.h"
#include "core/color.h"
#ifdef __cplusplus
extern "C" {
#endif
void _color_api_anchor() {
void _color_api_anchor() {}
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) {
Color *dest = (Color *)r_dest;
*dest = Color(p_r, p_g, p_b, p_a);
}
void GDAPI godot_color_new(godot_color *p_color) {
Color *color = (Color *)p_color;
*color = Color();
void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b) {
Color *dest = (Color *)r_dest;
*dest = Color(p_r, p_g, p_b);
}
void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
Color *color = (Color *)p_color;
*color = Color(r, g, b, a);
godot_string GDAPI godot_color_as_string(const godot_color *p_self) {
godot_string ret;
const Color *self = (const Color *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
const Color *color = (const Color *)p_color;
return color->to_32();
godot_int GDAPI godot_color_to_32(const godot_color *p_self) {
const Color *self = (const Color *)p_self;
return self->to_32();
}
float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
Color *color = (Color *)p_color;
return &color->operator[](idx);
godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self) {
const Color *self = (const Color *)p_self;
return self->to_ARGB32();
}
godot_real GDAPI godot_color_gray(const godot_color *p_self) {
const Color *self = (const Color *)p_self;
return self->gray();
}
godot_color GDAPI godot_color_inverted(const godot_color *p_self) {
godot_color dest;
const Color *self = (const Color *)p_self;
*((Color *)&dest) = self->inverted();
return dest;
}
godot_color GDAPI godot_color_contrasted(const godot_color *p_self) {
godot_color dest;
const Color *self = (const Color *)p_self;
*((Color *)&dest) = self->contrasted();
return dest;
}
godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) {
godot_color dest;
const Color *self = (const Color *)p_self;
const Color *b = (const Color *)p_b;
*((Color *)&dest) = self->linear_interpolate(*b, p_t);
return dest;
}
godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over) {
godot_color dest;
const Color *self = (const Color *)p_self;
const Color *over = (const Color *)p_over;
*((Color *)&dest) = self->blend(*over);
return dest;
}
godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha) {
godot_string dest;
const Color *self = (const Color *)p_self;
*((String *)&dest) = self->to_html(p_with_alpha);
return dest;
}
godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b) {
const Color *self = (const Color *)p_self;
const Color *b = (const Color *)p_b;
return *self == *b;
}
godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b) {
const Color *self = (const Color *)p_self;
const Color *b = (const Color *)p_b;
return *self < *b;
}
#ifdef __cplusplus

View File

@ -37,19 +37,39 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
typedef struct godot_color {
uint8_t _dont_touch_that[16];
} godot_color;
#endif
#include "../godot.h"
#include "godot_string.h"
void GDAPI godot_color_new(godot_color *p_color);
void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a);
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a);
void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b);
uint32_t GDAPI godot_color_get_32(const godot_color *p_color);
godot_string GDAPI godot_color_as_string(const godot_color *p_self);
float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx);
godot_int GDAPI godot_color_to_32(const godot_color *p_self);
godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self);
godot_real GDAPI godot_color_gray(const godot_color *p_self);
godot_color GDAPI godot_color_inverted(const godot_color *p_self);
godot_color GDAPI godot_color_contrasted(const godot_color *p_self);
godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t);
godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over);
godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha);
godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b);
godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b);
#ifdef __cplusplus
}

View File

@ -28,109 +28,100 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_dictionary.h"
#include "core/variant.h"
#include "core/dictionary.h"
#include "core/os/memory.h"
#include "core/io/json.h"
#ifdef __cplusplus
extern "C" {
#endif
void _dictionary_api_anchor() {
void _dictionary_api_anchor() {}
void GDAPI godot_dictionary_new(godot_dictionary *r_dest) {
Dictionary *dest = (Dictionary *)r_dest;
memnew_placement(dest, Dictionary);
}
void GDAPI godot_dictionary_new(godot_dictionary *p_dict) {
Dictionary *dict = (Dictionary *)p_dict;
memnew_placement(dict, Dictionary);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) {
Dictionary *self = (Dictionary *)p_self;
self->~Dictionary();
}
void GDAPI godot_dictionary_clear(godot_dictionary *p_dict) {
Dictionary *dict = (Dictionary *)p_dict;
dict->clear();
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self) {
const Dictionary *self = (const Dictionary *)p_self;
return self->size();
}
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict) {
const Dictionary *dict = (const Dictionary *)p_dict;
return dict->empty();
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self) {
const Dictionary *self = (const Dictionary *)p_self;
return self->empty();
}
void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key) {
Dictionary *dict = (Dictionary *)p_dict;
Variant *key = (Variant *)p_key;
dict->erase(*key);
void GDAPI godot_dictionary_clear(godot_dictionary *p_self) {
Dictionary *self = (Dictionary *)p_self;
self->clear();
}
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key) {
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key) {
const Dictionary *self = (const Dictionary *)p_self;
const Variant *key = (const Variant *)p_key;
return self->has(*key);
}
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys) {
const Dictionary *self = (const Dictionary *)p_self;
const Array *keys = (const Array *)p_keys;
return self->has_all(*keys);
}
void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key) {
Dictionary *self = (Dictionary *)p_self;
const Variant *key = (const Variant *)p_key;
self->erase(*key);
}
godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self) {
const Dictionary *self = (const Dictionary *)p_self;
return self->hash();
}
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self) {
godot_array dest;
const Dictionary *self = (const Dictionary *)p_self;
memnew_placement(&dest, Array(self->keys()));
return dest;
}
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) {
godot_array dest;
const Dictionary *self = (const Dictionary *)p_self;
memnew_placement(&dest, Array(self->values()));
return dest;
}
godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
godot_variant raw_dest;
Variant *dest = (Variant *)&raw_dest;
const Dictionary *dict = (const Dictionary *)p_dict;
const Variant *key = (const Variant *)p_key;
return dict->has(*key);
*dest = dict->operator[](*key);
return raw_dest;
}
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys) {
const Dictionary *dict = (const Dictionary *)p_dict;
const Array *keys = (const Array *)p_keys;
return dict->has_all(*keys);
}
uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict) {
const Dictionary *dict = (const Dictionary *)p_dict;
return dict->hash();
}
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict) {
godot_array a;
godot_array_new(&a);
const Dictionary *dict = (const Dictionary *)p_dict;
Array *array = (Array *)&a;
*array = dict->keys();
return a;
}
godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json) {
Dictionary *dict = (Dictionary *)p_dict;
const String *json = (const String *)p_json;
Variant ret;
int err_line;
String err_str;
int err = (int)JSON::parse(*json, ret, err_str, err_line);
*dict = ret;
return err;
}
godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
Dictionary *dict = (Dictionary *)p_dict;
Variant *key = (Variant *)p_key;
return (godot_variant *)&dict->operator[](*key);
}
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict) {
const Dictionary *dict = (const Dictionary *)p_dict;
return dict->size();
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) {
const Dictionary *self = (const Dictionary *)p_self;
const Dictionary *b = (const Dictionary *)p_b;
return *self == *b;
}
godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict) {
godot_string raw_dest;
String *dest = (String *)&raw_dest;
const Dictionary *dict = (const Dictionary *)p_dict;
godot_string str;
godot_string_new(&str);
String *s = (String *)&str;
*s = JSON::print(Variant(*dict));
return str;
}
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict) {
godot_array a;
godot_array_new(&a);
const Dictionary *dict = (const Dictionary *)p_dict;
Array *array = (Array *)&a;
*array = dict->values();
return a;
}
void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict) {
((Dictionary *)p_dict)->~Dictionary();
memnew_placement(dest, String(JSON::print(Variant(*dict))));
return raw_dest;
}
#ifdef __cplusplus

View File

@ -36,43 +36,44 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED
#ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED
typedef struct godot_dictionary {
uint8_t _dont_touch_that[8];
} godot_dictionary;
#endif
#include "../godot.h"
#include "godot_array.h"
#include "godot_variant.h"
void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
void GDAPI godot_dictionary_new(godot_dictionary *r_dest);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_self);
void GDAPI godot_dictionary_clear(godot_dictionary *p_dict);
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self);
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict);
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self);
void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key);
void GDAPI godot_dictionary_clear(godot_dictionary *p_self);
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys);
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys);
uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key);
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict);
godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self);
godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json);
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self);
godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self);
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict);
godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);
godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
#ifdef __cplusplus
}
#endif

View File

@ -1,114 +0,0 @@
/*************************************************************************/
/* godot_image.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_image.h"
#include "image.h"
#ifdef __cplusplus
extern "C" {
#endif
void _image_api_anchor() {
}
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
void GDAPI godot_image_new(godot_image *p_img) {
Image *img = (Image *)p_img;
memnew_placement_custom(img, Image, Image());
}
void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len) {
Image *img = (Image *)p_img;
memnew_placement_custom(img, Image, Image(p_mem_png_jpg, p_len));
}
void GDAPI godot_image_new_with_xpm(godot_image *p_img, const char **p_xpm) {
Image *img = (Image *)p_img;
memnew_placement_custom(img, Image, Image(p_xpm));
}
void GDAPI godot_image_new_with_size_format(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format) {
Image *img = (Image *)p_img;
memnew_placement_custom(img, Image, Image(p_width, p_height, p_use_mipmaps, (Image::Format)p_format));
}
void GDAPI godot_image_new_with_size_format_data(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format, godot_pool_byte_array *p_data) {
Image *img = (Image *)p_img;
PoolVector<uint8_t> *data = (PoolVector<uint8_t> *)p_data;
memnew_placement_custom(img, Image, Image(p_width, p_height, p_use_mipmaps, (Image::Format)p_format, *data));
}
godot_pool_byte_array GDAPI godot_image_get_data(godot_image *p_img) {
Image *img = (Image *)p_img;
PoolVector<uint8_t> cpp_data = img->get_data();
godot_pool_byte_array *data = (godot_pool_byte_array *)&cpp_data;
return *data;
}
godot_error GDAPI godot_image_load(godot_image *p_img, const godot_string *p_path) {
Image *img = (Image *)p_img;
String *path = (String *)p_path;
return (godot_error)img->load(*path);
}
godot_error GDAPI godot_image_save_png(godot_image *p_img, const godot_string *p_path) {
Image *img = (Image *)p_img;
String *path = (String *)p_path;
return (godot_error)img->save_png(*path);
}
int GDAPI godot_image_get_width(const godot_image *p_img) {
Image *img = (Image *)p_img;
return img->get_width();
}
int GDAPI godot_image_get_height(const godot_image *p_img) {
Image *img = (Image *)p_img;
return img->get_height();
}
godot_bool GDAPI godot_image_has_mipmaps(const godot_image *p_img) {
Image *img = (Image *)p_img;
return img->has_mipmaps();
}
int GDAPI godot_image_get_mipmap_count(const godot_image *p_img) {
Image *img = (Image *)p_img;
return img->get_mipmap_count();
}
void GDAPI godot_image_destroy(godot_image *p_img) {
((Image *)p_img)->~Image();
}
#ifdef __cplusplus
}
#endif

View File

@ -1,124 +0,0 @@
/*************************************************************************/
/* godot_image.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_IMAGE_H
#define GODOT_IMAGE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_IMAGE_TYPE_DEFINED
typedef struct godot_image {
uint8_t _dont_touch_that[32];
} godot_image;
#endif
#include "godot_pool_arrays.h"
#include "../godot.h"
// This is a copypasta of the C++ enum inside the Image class
// There's no neat way of automatically updating the C enum / using the C++ enum directly
// if somebody knows a way feel free to open a PR or open an issue (or ask for Karroffel or bojidar-bg on IRC)
enum godot_image_format {
GODOT_IMAGE_FORMAT_L8, //luminance
GODOT_IMAGE_FORMAT_LA8, //luminance-alpha
GODOT_IMAGE_FORMAT_R8,
GODOT_IMAGE_FORMAT_RG8,
GODOT_IMAGE_FORMAT_RGB8,
GODOT_IMAGE_FORMAT_RGBA8,
GODOT_IMAGE_FORMAT_RGB565, //16 bit
GODOT_IMAGE_FORMAT_RGBA4444,
GODOT_IMAGE_FORMAT_RGBA5551,
GODOT_IMAGE_FORMAT_RF, //float
GODOT_IMAGE_FORMAT_RGF,
GODOT_IMAGE_FORMAT_RGBF,
GODOT_IMAGE_FORMAT_RGBAF,
GODOT_IMAGE_FORMAT_RH, //half float
GODOT_IMAGE_FORMAT_RGH,
GODOT_IMAGE_FORMAT_RGBH,
GODOT_IMAGE_FORMAT_RGBAH,
GODOT_IMAGE_FORMAT_DXT1, //s3tc bc1
GODOT_IMAGE_FORMAT_DXT3, //bc2
GODOT_IMAGE_FORMAT_DXT5, //bc3
GODOT_IMAGE_FORMAT_ATI1, //bc4
GODOT_IMAGE_FORMAT_ATI2, //bc5
GODOT_IMAGE_FORMAT_BPTC_RGBA, //btpc bc6h
GODOT_IMAGE_FORMAT_BPTC_RGBF, //float /
GODOT_IMAGE_FORMAT_BPTC_RGBFU, //unsigned float
GODOT_IMAGE_FORMAT_PVRTC2, //pvrtc
GODOT_IMAGE_FORMAT_PVRTC2A,
GODOT_IMAGE_FORMAT_PVRTC4,
GODOT_IMAGE_FORMAT_PVRTC4A,
GODOT_IMAGE_FORMAT_ETC, //etc1
GODOT_IMAGE_FORMAT_ETC2_R11, //etc2
GODOT_IMAGE_FORMAT_ETC2_R11S, //signed, NOT srgb.
GODOT_IMAGE_FORMAT_ETC2_RG11,
GODOT_IMAGE_FORMAT_ETC2_RG11S,
GODOT_IMAGE_FORMAT_ETC2_RGB8,
GODOT_IMAGE_FORMAT_ETC2_RGBA8,
GODOT_IMAGE_FORMAT_ETC2_RGB8A1,
GODOT_IMAGE_FORMAT_MAX
};
typedef enum godot_image_format godot_image_format;
void GDAPI godot_image_new(godot_image *p_img);
// p_len can be -1
void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len);
void GDAPI godot_image_new_with_xpm(godot_image *p_img, const char **p_xpm);
void GDAPI godot_image_new_with_size_format(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format);
void GDAPI godot_image_new_with_size_format_data(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format, godot_pool_byte_array *p_data);
godot_pool_byte_array GDAPI godot_image_get_data(godot_image *p_img);
godot_error GDAPI godot_image_load(godot_image *p_img, const godot_string *p_path);
godot_error GDAPI godot_image_save_png(godot_image *p_img, const godot_string *p_path);
int GDAPI godot_image_get_width(const godot_image *p_img);
int GDAPI godot_image_get_height(const godot_image *p_img);
godot_bool GDAPI godot_image_has_mipmaps(const godot_image *p_img);
int GDAPI godot_image_get_mipmap_count(const godot_image *p_img);
// @Incomplete
// I think it's too complex for the binding authors to implement the image class anew, so we should definitely
// export all methods here. That takes a while so it's on my @Todo list
void GDAPI godot_image_destroy(godot_image *p_img);
#ifdef __cplusplus
}
#endif
#endif // GODOT_IMAGE_H

View File

@ -1,309 +0,0 @@
/*************************************************************************/
/* godot_input_event.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_input_event.h"
#include "os/input_event.h"
#ifdef __cplusplus
extern "C" {
#endif
void _input_event_api_anchor() {
}
void GDAPI godot_input_event_new(godot_input_event *p_ie) {
InputEvent *ie = (InputEvent *)p_ie;
*ie = InputEvent();
}
godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie) {
const InputEvent *ie = (const InputEvent *)p_ie;
return ie->is_pressed();
}
godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action) {
const InputEvent *ie = (const InputEvent *)p_ie;
const String *action = (const String *)p_action;
return ie->is_action(*action);
}
godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action) {
const InputEvent *ie = (const InputEvent *)p_ie;
const String *action = (const String *)p_action;
return ie->is_action_pressed(*action);
}
godot_bool GDAPI godot_input_event_is_action_released(const godot_input_event *p_ie, const godot_string *p_action) {
const InputEvent *ie = (const InputEvent *)p_ie;
const String *action = (const String *)p_action;
return ie->is_action_released(*action);
}
godot_bool GDAPI godot_input_event_is_echo(const godot_input_event *p_ie) {
const InputEvent *ie = (const InputEvent *)p_ie;
return ie->is_echo();
}
void GDAPI godot_input_event_set_as_action(godot_input_event *p_ie, const godot_string *p_action, const godot_bool p_pressed) {
InputEvent *ie = (InputEvent *)p_ie;
const String *action = (const String *)p_action;
return ie->set_as_action(*action, p_pressed);
}
godot_string GDAPI godot_input_event_as_string(const godot_input_event *p_ie) {
const InputEvent *ie = (const InputEvent *)p_ie;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
*s = (String)*ie;
return str;
}
uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie) {
InputEvent *ie = (InputEvent *)p_ie;
return &ie->ID;
}
godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie) {
InputEvent *ie = (InputEvent *)p_ie;
return (godot_input_event_type *)&ie->type;
}
godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie) {
InputEvent *ie = (InputEvent *)p_ie;
return &ie->device;
}
static InputModifierState *_get_mod_for_type(InputEvent *ie) {
switch (ie->type) {
case InputEvent::MOUSE_BUTTON:
return &ie->mouse_button.mod;
case InputEvent::MOUSE_MOTION:
return &ie->mouse_motion.mod;
case InputEvent::KEY:
return &ie->key.mod;
default:
return 0;
}
}
godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
InputModifierState *mod = _get_mod_for_type(ie);
return &mod->alt;
}
godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
InputModifierState *mod = _get_mod_for_type(ie);
return &mod->control;
}
godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
InputModifierState *mod = _get_mod_for_type(ie);
return &mod->command;
}
godot_bool GDAPI *godot_input_event_mod_get_shift(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
InputModifierState *mod = _get_mod_for_type(ie);
return &mod->shift;
}
godot_bool GDAPI *godot_input_event_mod_get_meta(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
InputModifierState *mod = _get_mod_for_type(ie);
return &mod->meta;
}
uint32_t GDAPI *godot_input_event_key_get_scancode(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->key.scancode;
}
uint32_t GDAPI *godot_input_event_key_get_unicode(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->key.unicode;
}
godot_bool GDAPI *godot_input_event_key_get_pressed(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->key.pressed;
}
godot_bool GDAPI *godot_input_event_key_get_echo(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->key.echo;
}
float GDAPI *godot_input_event_mouse_get_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.x;
}
float GDAPI *godot_input_event_mouse_get_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.y;
}
float GDAPI *godot_input_event_mouse_get_global_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.global_x;
}
float GDAPI *godot_input_event_mouse_get_global_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.global_y;
}
godot_int GDAPI *godot_input_event_mouse_get_button_mask(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.button_mask;
}
godot_int GDAPI *godot_input_event_mouse_button_get_button_index(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.button_index;
}
godot_bool GDAPI *godot_input_event_mouse_button_get_pressed(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.pressed;
}
godot_bool GDAPI *godot_input_event_mouse_button_get_doubleclick(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_button.doubleclick;
}
float GDAPI *godot_input_event_mouse_motion_get_relative_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_motion.relative_x;
}
float GDAPI *godot_input_event_mouse_motion_get_relative_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_motion.relative_y;
}
float GDAPI *godot_input_event_mouse_motion_get_speed_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_motion.speed_x;
}
float GDAPI *godot_input_event_mouse_motion_get_speed_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->mouse_motion.speed_y;
}
godot_int GDAPI *godot_input_event_joypad_motion_get_axis(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->joy_motion.axis;
}
float GDAPI *godot_input_event_joypad_motion_get_axis_value(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->joy_motion.axis_value;
}
godot_int GDAPI *godot_input_event_joypad_button_get_button_index(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->joy_button.button_index;
}
godot_bool GDAPI *godot_input_event_joypad_button_get_pressed(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->joy_button.pressed;
}
float GDAPI *godot_input_event_joypad_button_get_pressure(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->joy_button.pressure;
}
godot_int GDAPI *godot_input_event_screen_touch_get_index(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_touch.index;
}
float GDAPI *godot_input_event_screen_touch_get_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_touch.x;
}
float GDAPI *godot_input_event_screen_touch_get_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_touch.y;
}
godot_bool GDAPI *godot_input_event_screen_touch_get_pressed(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_touch.pressed;
}
godot_int GDAPI *godot_input_event_screen_drag_get_index(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.index;
}
float GDAPI *godot_input_event_screen_drag_get_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.x;
}
float GDAPI *godot_input_event_screen_drag_get_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.y;
}
float GDAPI *godot_input_event_screen_drag_get_relative_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.relative_x;
}
float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.relative_y;
}
float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.speed_x;
}
float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event) {
InputEvent *ie = (InputEvent *)p_event;
return &ie->screen_drag.speed_y;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,235 +0,0 @@
/*************************************************************************/
/* godot_input_event.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_INPUT_EVENT_H
#define GODOT_INPUT_EVENT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_INPUT_EVENT_TYPE_DEFINED
typedef struct godot_input_event {
uint8_t _dont_touch_that[56];
} godot_input_event;
#endif
enum godot_input_event_type {
GODOT_INPUT_EVENT_TYPE_NONE,
GODOT_INPUT_EVENT_TYPE_KEY,
GODOT_INPUT_EVENT_TYPE_MOUSE_MOTION,
GODOT_INPUT_EVENT_TYPE_MOUSE_BUTTON,
GODOT_INPUT_EVENT_TYPE_JOYPAD_MOTION,
GODOT_INPUT_EVENT_TYPE_JOYPAD_BUTTON,
GODOT_INPUT_EVENT_TYPE_SCREEN_TOUCH,
GODOT_INPUT_EVENT_TYPE_SCREEN_DRAG,
GODOT_INPUT_EVENT_TYPE_ACTION,
GODOT_INPUT_EVENT_TYPE_TYPE_MAX
};
typedef enum godot_input_event_type godot_input_event_type;
enum {
GODOT_BUTTON_LEFT = 1,
GODOT_BUTTON_RIGHT = 2,
GODOT_BUTTON_MIDDLE = 3,
GODOT_BUTTON_WHEEL_UP = 4,
GODOT_BUTTON_WHEEL_DOWN = 5,
GODOT_BUTTON_WHEEL_LEFT = 6,
GODOT_BUTTON_WHEEL_RIGHT = 7,
GODOT_BUTTON_MASK_LEFT = (1 << (GODOT_BUTTON_LEFT - 1)),
GODOT_BUTTON_MASK_RIGHT = (1 << (GODOT_BUTTON_RIGHT - 1)),
GODOT_BUTTON_MASK_MIDDLE = (1 << (GODOT_BUTTON_MIDDLE - 1)),
};
enum {
GODOT_JOY_BUTTON_0 = 0,
GODOT_JOY_BUTTON_1 = 1,
GODOT_JOY_BUTTON_2 = 2,
GODOT_JOY_BUTTON_3 = 3,
GODOT_JOY_BUTTON_4 = 4,
GODOT_JOY_BUTTON_5 = 5,
GODOT_JOY_BUTTON_6 = 6,
GODOT_JOY_BUTTON_7 = 7,
GODOT_JOY_BUTTON_8 = 8,
GODOT_JOY_BUTTON_9 = 9,
GODOT_JOY_BUTTON_10 = 10,
GODOT_JOY_BUTTON_11 = 11,
GODOT_JOY_BUTTON_12 = 12,
GODOT_JOY_BUTTON_13 = 13,
GODOT_JOY_BUTTON_14 = 14,
GODOT_JOY_BUTTON_15 = 15,
GODOT_JOY_BUTTON_MAX = 16,
GODOT_JOY_L = GODOT_JOY_BUTTON_4,
GODOT_JOY_R = GODOT_JOY_BUTTON_5,
GODOT_JOY_L2 = GODOT_JOY_BUTTON_6,
GODOT_JOY_R2 = GODOT_JOY_BUTTON_7,
GODOT_JOY_L3 = GODOT_JOY_BUTTON_8,
GODOT_JOY_R3 = GODOT_JOY_BUTTON_9,
GODOT_JOY_SELECT = GODOT_JOY_BUTTON_10,
GODOT_JOY_START = GODOT_JOY_BUTTON_11,
GODOT_JOY_DPAD_UP = GODOT_JOY_BUTTON_12,
GODOT_JOY_DPAD_DOWN = GODOT_JOY_BUTTON_13,
GODOT_JOY_DPAD_LEFT = GODOT_JOY_BUTTON_14,
GODOT_JOY_DPAD_RIGHT = GODOT_JOY_BUTTON_15,
// a little history about game controllers (who copied who)
GODOT_JOY_SNES_B = GODOT_JOY_BUTTON_0,
GODOT_JOY_SNES_A = GODOT_JOY_BUTTON_1,
GODOT_JOY_SNES_Y = GODOT_JOY_BUTTON_2,
GODOT_JOY_SNES_X = GODOT_JOY_BUTTON_3,
GODOT_JOY_SONY_CIRCLE = GODOT_JOY_SNES_A,
GODOT_JOY_SONY_X = GODOT_JOY_SNES_B,
GODOT_JOY_SONY_SQUARE = GODOT_JOY_SNES_Y,
GODOT_JOY_SONY_TRIANGLE = GODOT_JOY_SNES_X,
GODOT_JOY_SEGA_B = GODOT_JOY_SNES_A,
GODOT_JOY_SEGA_A = GODOT_JOY_SNES_B,
GODOT_JOY_SEGA_X = GODOT_JOY_SNES_Y,
GODOT_JOY_SEGA_Y = GODOT_JOY_SNES_X,
GODOT_JOY_XBOX_B = GODOT_JOY_SEGA_B,
GODOT_JOY_XBOX_A = GODOT_JOY_SEGA_A,
GODOT_JOY_XBOX_X = GODOT_JOY_SEGA_X,
GODOT_JOY_XBOX_Y = GODOT_JOY_SEGA_Y,
GODOT_JOY_DS_A = GODOT_JOY_SNES_A,
GODOT_JOY_DS_B = GODOT_JOY_SNES_B,
GODOT_JOY_DS_X = GODOT_JOY_SNES_X,
GODOT_JOY_DS_Y = GODOT_JOY_SNES_Y,
GODOT_JOY_WII_C = GODOT_JOY_BUTTON_5,
GODOT_JOY_WII_Z = GODOT_JOY_BUTTON_6,
GODOT_JOY_WII_MINUS = GODOT_JOY_BUTTON_9,
GODOT_JOY_WII_PLUS = GODOT_JOY_BUTTON_10,
// end of history
GODOT_JOY_AXIS_0 = 0,
GODOT_JOY_AXIS_1 = 1,
GODOT_JOY_AXIS_2 = 2,
GODOT_JOY_AXIS_3 = 3,
GODOT_JOY_AXIS_4 = 4,
GODOT_JOY_AXIS_5 = 5,
GODOT_JOY_AXIS_6 = 6,
GODOT_JOY_AXIS_7 = 7,
GODOT_JOY_AXIS_MAX = 8,
GODOT_JOY_ANALOG_0_X = GODOT_JOY_AXIS_0,
GODOT_JOY_ANALOG_0_Y = GODOT_JOY_AXIS_1,
GODOT_JOY_ANALOG_1_X = GODOT_JOY_AXIS_2,
GODOT_JOY_ANALOG_1_Y = GODOT_JOY_AXIS_3,
GODOT_JOY_ANALOG_2_X = GODOT_JOY_AXIS_4,
GODOT_JOY_ANALOG_2_Y = GODOT_JOY_AXIS_5,
GODOT_JOY_ANALOG_L2 = GODOT_JOY_AXIS_6,
GODOT_JOY_ANALOG_R2 = GODOT_JOY_AXIS_7,
};
#include "../godot.h"
void GDAPI godot_input_event_new(godot_input_event *p_ie);
godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie);
godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action);
godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action);
godot_bool GDAPI godot_input_event_is_action_released(const godot_input_event *p_ie, const godot_string *p_action);
godot_bool GDAPI godot_input_event_is_echo(const godot_input_event *p_ie);
void GDAPI godot_input_event_set_as_action(godot_input_event *p_ie, const godot_string *p_action, const godot_bool p_pressed);
godot_string GDAPI godot_input_event_as_string(const godot_input_event *p_ie);
// Note:
// We're returning pointers to the fields in the unions.
// This is because I'm too lazy to write setter functions
uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie);
godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie);
godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie);
godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mod_get_shift(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mod_get_meta(godot_input_event *p_event);
uint32_t GDAPI *godot_input_event_key_get_scancode(godot_input_event *p_event);
uint32_t GDAPI *godot_input_event_key_get_unicode(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_key_get_pressed(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_key_get_echo(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_get_x(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_get_y(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_get_global_x(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_get_global_y(godot_input_event *p_event);
godot_int GDAPI *godot_input_event_mouse_get_button_mask(godot_input_event *p_event);
godot_int GDAPI *godot_input_event_mouse_button_get_button_index(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mouse_button_get_pressed(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mouse_button_get_doubleclick(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_motion_get_relative_x(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_motion_get_relative_y(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_motion_get_speed_x(godot_input_event *p_event);
float GDAPI *godot_input_event_mouse_motion_get_speed_y(godot_input_event *p_event);
godot_int GDAPI *godot_input_event_joypad_motion_get_axis(godot_input_event *p_event);
float GDAPI *godot_input_event_joypad_motion_get_axis_value(godot_input_event *p_event);
godot_int GDAPI *godot_input_event_joypad_button_get_button_index(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_joypad_button_get_pressed(godot_input_event *p_event);
float GDAPI *godot_input_event_joypad_button_get_pressure(godot_input_event *p_event);
godot_int GDAPI *godot_input_event_screen_touch_get_index(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_touch_get_x(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_touch_get_y(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_screen_touch_get_pressed(godot_input_event *p_event);
godot_int GDAPI *godot_input_event_screen_drag_get_index(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_x(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_y(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_relative_x(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event);
#ifdef __cplusplus
}
#endif
#endif // GODOT_INPUT_EVENT_H

View File

@ -28,91 +28,81 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_node_path.h"
#include "core/variant.h"
#include "path_db.h"
#include "core/path_db.h"
#ifdef __cplusplus
extern "C" {
#endif
void _node_path_api_anchor() {
void _node_path_api_anchor() {}
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) {
NodePath *dest = (NodePath *)r_dest;
const String *from = (const String *)p_from;
memnew_placement(dest, NodePath(*from));
}
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
// @Bug ?
// Do I need to memnew_placement when returning strings?
void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from) {
NodePath *np = (NodePath *)p_np;
String *from = (String *)p_from;
memnew_placement_custom(np, NodePath, NodePath(*from));
void GDAPI godot_node_path_destroy(godot_node_path *p_self) {
NodePath *self = (NodePath *)p_self;
self->~NodePath();
}
void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from) {
NodePath *np = (NodePath *)p_np;
NodePath *from = (NodePath *)p_from;
*np = *from;
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self) {
godot_string ret;
const NodePath *self = (const NodePath *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx) {
const NodePath *np = (const NodePath *)p_np;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
*s = np->get_name(p_idx);
return str;
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self) {
const NodePath *self = (const NodePath *)p_self;
return self->is_absolute();
}
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np) {
const NodePath *np = (const NodePath *)p_np;
return np->get_name_count();
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self) {
const NodePath *self = (const NodePath *)p_self;
return self->get_name_count();
}
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np) {
const NodePath *np = (const NodePath *)p_np;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
*s = np->get_property();
return str;
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx) {
godot_string dest;
const NodePath *self = (const NodePath *)p_self;
memnew_placement(&dest, String(self->get_name(p_idx)));
return dest;
}
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx) {
const NodePath *np = (const NodePath *)p_np;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
*s = np->get_subname(p_idx);
return str;
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self) {
const NodePath *self = (const NodePath *)p_self;
return self->get_subname_count();
}
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np) {
const NodePath *np = (const NodePath *)p_np;
return np->get_subname_count();
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx) {
godot_string dest;
const NodePath *self = (const NodePath *)p_self;
memnew_placement(&dest, String(self->get_subname(p_idx)));
return dest;
}
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np) {
const NodePath *np = (const NodePath *)p_np;
return np->is_absolute();
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_self) {
godot_string dest;
const NodePath *self = (const NodePath *)p_self;
memnew_placement(&dest, String(self->get_property()));
return dest;
}
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np) {
const NodePath *np = (const NodePath *)p_np;
return np->is_empty();
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self) {
const NodePath *self = (const NodePath *)p_self;
return self->is_empty();
}
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np) {
const NodePath *np = (const NodePath *)p_np;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
*s = *np;
return str;
}
void GDAPI godot_node_path_destroy(godot_node_path *p_np) {
((NodePath *)p_np)->~NodePath();
godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b) {
const NodePath *self = (const NodePath *)p_self;
const NodePath *b = (const NodePath *)p_b;
return *self == *b;
}
#ifdef __cplusplus

View File

@ -37,29 +37,35 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
typedef struct godot_node_path {
uint8_t _dont_touch_that[8];
} godot_node_path;
#endif
#include "../godot.h"
#include "godot_string.h"
void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from);
void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from);
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from);
void GDAPI godot_node_path_destroy(godot_node_path *p_self);
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx);
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self);
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx);
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np);
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self);
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np);
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np);
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self);
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx);
void GDAPI godot_node_path_destroy(godot_node_path *p_np);
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self);
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx);
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_self);
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self);
godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b);
#ifdef __cplusplus
}

View File

@ -28,48 +28,149 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_plane.h"
#include "core/variant.h"
#include "math/plane.h"
#include "core/math/plane.h"
#ifdef __cplusplus
extern "C" {
#endif
void _plane_api_anchor() {
void _plane_api_anchor() {}
void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) {
Plane *dest = (Plane *)r_dest;
*dest = Plane(p_a, p_b, p_c, p_d);
}
void GDAPI godot_plane_new(godot_plane *p_pl) {
Plane *pl = (Plane *)p_pl;
*pl = Plane();
void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3) {
const Vector3 *v1 = (const Vector3 *)p_v1;
const Vector3 *v2 = (const Vector3 *)p_v2;
const Vector3 *v3 = (const Vector3 *)p_v3;
Plane *dest = (Plane *)r_dest;
*dest = Plane(*v1, *v2, *v3);
}
void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) {
Plane *pl = (Plane *)p_pl;
void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d) {
const Vector3 *normal = (const Vector3 *)p_normal;
*pl = Plane(*normal, p_d);
Plane *dest = (Plane *)r_dest;
*dest = Plane(*normal, p_d);
}
void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) {
Plane *pl = (Plane *)p_pl;
godot_string GDAPI godot_plane_as_string(const godot_plane *p_self) {
godot_string ret;
const Plane *self = (const Plane *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self) {
godot_plane dest;
const Plane *self = (const Plane *)p_self;
*((Plane *)&dest) = self->normalized();
return dest;
}
godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self) {
godot_vector3 dest;
const Plane *self = (const Plane *)p_self;
*((Vector3 *)&dest) = self->center();
return dest;
}
godot_vector3 GDAPI godot_plane_get_any_point(const godot_plane *p_self) {
godot_vector3 dest;
const Plane *self = (const Plane *)p_self;
*((Vector3 *)&dest) = self->get_any_point();
return dest;
}
godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point) {
const Plane *self = (const Plane *)p_self;
const Vector3 *point = (const Vector3 *)p_point;
return self->is_point_over(*point);
}
godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point) {
const Plane *self = (const Plane *)p_self;
const Vector3 *point = (const Vector3 *)p_point;
return self->distance_to(*point);
}
godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon) {
const Plane *self = (const Plane *)p_self;
const Vector3 *point = (const Vector3 *)p_point;
return self->has_point(*point, p_epsilon);
}
godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point) {
godot_vector3 dest;
const Plane *self = (const Plane *)p_self;
const Vector3 *point = (const Vector3 *)p_point;
*((Vector3 *)&dest) = self->project(*point);
return dest;
}
godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c) {
const Plane *self = (const Plane *)p_self;
const Plane *b = (const Plane *)p_b;
const Plane *c = (const Plane *)p_c;
Vector3 *dest = (Vector3 *)r_dest;
return self->intersect_3(*b, *c, dest);
}
godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir) {
const Plane *self = (const Plane *)p_self;
const Vector3 *from = (const Vector3 *)p_from;
const Vector3 *dir = (const Vector3 *)p_dir;
Vector3 *dest = (Vector3 *)r_dest;
return self->intersects_ray(*from, *dir, dest);
}
godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end) {
const Plane *self = (const Plane *)p_self;
const Vector3 *begin = (const Vector3 *)p_begin;
const Vector3 *end = (const Vector3 *)p_end;
Vector3 *dest = (Vector3 *)r_dest;
return self->intersects_segment(*begin, *end, dest);
}
godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self) {
godot_plane raw_dest;
Plane *dest = (Plane *)&raw_dest;
const Plane *self = (const Plane *)p_self;
*dest = -(*self);
return raw_dest;
}
godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b) {
const Plane *self = (const Plane *)p_self;
const Plane *b = (const Plane *)p_b;
return *self == *b;
}
void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal) {
Plane *self = (Plane *)p_self;
const Vector3 *normal = (const Vector3 *)p_normal;
pl->set_normal(*normal);
self->set_normal(*normal);
}
godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) {
const Plane *pl = (const Plane *)p_pl;
const Vector3 normal = pl->get_normal();
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self) {
const Plane *self = (const Plane *)p_self;
const Vector3 normal = self->get_normal();
godot_vector3 *v3 = (godot_vector3 *)&normal;
return *v3;
}
void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) {
Plane *pl = (Plane *)p_pl;
pl->d = p_d;
godot_real GDAPI godot_plane_get_d(const godot_plane *p_self) {
const Plane *self = (const Plane *)p_self;
return self->d;
}
godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) {
const Plane *pl = (const Plane *)p_pl;
return pl->d;
void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d) {
Plane *self = (Plane *)p_self;
self->d = p_d;
}
#ifdef __cplusplus

View File

@ -37,27 +37,52 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
typedef struct godot_plane {
uint8_t _dont_touch_that[16];
} godot_plane;
#endif
#include "../godot.h"
#include "godot_vector3.h"
void GDAPI godot_plane_new(godot_plane *p_pl);
void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d);
void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d);
void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3);
void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d);
// @Incomplete
// These are additional valid constructors
// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal);
// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
godot_string GDAPI godot_plane_as_string(const godot_plane *p_self);
void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal);
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl);
godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self);
godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl);
void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d);
godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self);
godot_vector3 GDAPI godot_plane_get_any_point(const godot_plane *p_self);
godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point);
godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point);
godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon);
godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point);
godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c);
godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir);
godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end);
godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self);
godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b);
void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal);
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self);
godot_real GDAPI godot_plane_get_d(const godot_plane *p_self);
void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d);
#ifdef __cplusplus
}

View File

@ -101,13 +101,13 @@ void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_i
pba->set(p_idx, p_data);
}
uint8_t GDAPI godot_pool_byte_array_get(godot_pool_byte_array *p_pba, const godot_int p_idx) {
PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_pba, const godot_int p_idx) {
const PoolVector<uint8_t> *pba = (const PoolVector<uint8_t> *)p_pba;
return pba->get(p_idx);
}
godot_int GDAPI godot_pool_byte_array_size(godot_pool_byte_array *p_pba) {
PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_pba) {
const PoolVector<uint8_t> *pba = (const PoolVector<uint8_t> *)p_pba;
return pba->size();
}
@ -174,13 +174,13 @@ void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pba, const godot_int
pba->set(p_idx, p_data);
}
godot_int GDAPI godot_pool_int_array_get(godot_pool_int_array *p_pba, const godot_int p_idx) {
PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_pba, const godot_int p_idx) {
const PoolVector<godot_int> *pba = (const PoolVector<godot_int> *)p_pba;
return pba->get(p_idx);
}
godot_int GDAPI godot_pool_int_array_size(godot_pool_int_array *p_pba) {
PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_pba) {
const PoolVector<godot_int> *pba = (const PoolVector<godot_int> *)p_pba;
return pba->size();
}
@ -247,13 +247,13 @@ void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pba, const godot_i
pba->set(p_idx, p_data);
}
godot_real GDAPI godot_pool_real_array_get(godot_pool_real_array *p_pba, const godot_int p_idx) {
PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_pba, const godot_int p_idx) {
const PoolVector<godot_real> *pba = (const PoolVector<godot_real> *)p_pba;
return pba->get(p_idx);
}
godot_int GDAPI godot_pool_real_array_size(godot_pool_real_array *p_pba) {
PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_pba) {
const PoolVector<godot_real> *pba = (const PoolVector<godot_real> *)p_pba;
return pba->size();
}
@ -324,8 +324,8 @@ void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_pba, const god
pba->set(p_idx, s);
}
godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_pba, const godot_int p_idx) {
PoolVector<String> *pba = (PoolVector<String> *)p_pba;
godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_pba, const godot_int p_idx) {
const PoolVector<String> *pba = (const PoolVector<String> *)p_pba;
godot_string str;
String *s = (String *)&str;
memnew_placement(s, String);
@ -333,8 +333,8 @@ godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_pba, c
return str;
}
godot_int GDAPI godot_pool_string_array_size(godot_pool_string_array *p_pba) {
PoolVector<String> *pba = (PoolVector<String> *)p_pba;
godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_pba) {
const PoolVector<String> *pba = (const PoolVector<String> *)p_pba;
return pba->size();
}
@ -405,16 +405,16 @@ void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pba, const g
pba->set(p_idx, s);
}
godot_vector2 GDAPI godot_pool_vector2_array_get(godot_pool_vector2_array *p_pba, const godot_int p_idx) {
PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_pba, const godot_int p_idx) {
const PoolVector<Vector2> *pba = (const PoolVector<Vector2> *)p_pba;
godot_vector2 v;
Vector2 *s = (Vector2 *)&v;
*s = pba->get(p_idx);
return v;
}
godot_int GDAPI godot_pool_vector2_array_size(godot_pool_vector2_array *p_pba) {
PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_pba) {
const PoolVector<Vector2> *pba = (const PoolVector<Vector2> *)p_pba;
return pba->size();
}
@ -485,16 +485,16 @@ void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pba, const g
pba->set(p_idx, s);
}
godot_vector3 GDAPI godot_pool_vector3_array_get(godot_pool_vector3_array *p_pba, const godot_int p_idx) {
PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_pba, const godot_int p_idx) {
const PoolVector<Vector3> *pba = (const PoolVector<Vector3> *)p_pba;
godot_vector3 v;
Vector3 *s = (Vector3 *)&v;
*s = pba->get(p_idx);
return v;
}
godot_int GDAPI godot_pool_vector3_array_size(godot_pool_vector3_array *p_pba) {
PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_pba) {
const PoolVector<Vector3> *pba = (const PoolVector<Vector3> *)p_pba;
return pba->size();
}
@ -565,16 +565,16 @@ void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pba, const godot
pba->set(p_idx, s);
}
godot_color GDAPI godot_pool_color_array_get(godot_pool_color_array *p_pba, const godot_int p_idx) {
PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_pba, const godot_int p_idx) {
const PoolVector<Color> *pba = (const PoolVector<Color> *)p_pba;
godot_color v;
Color *s = (Color *)&v;
*s = pba->get(p_idx);
return v;
}
godot_int GDAPI godot_pool_color_array_size(godot_pool_color_array *p_pba) {
PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_pba) {
const PoolVector<Color> *pba = (const PoolVector<Color> *)p_pba;
return pba->size();
}

View File

@ -92,9 +92,12 @@ typedef struct godot_pool_color_array {
} godot_pool_color_array;
#endif
#include "../godot.h"
#include "godot_array.h"
#include "godot_color.h"
#include "godot_vector2.h"
#include "godot_vector3.h"
#include "../godot.h"
// byte
@ -116,9 +119,9 @@ void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godo
void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size);
void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
uint8_t GDAPI godot_pool_byte_array_get(godot_pool_byte_array *p_pba, const godot_int p_idx);
uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_pba, const godot_int p_idx);
godot_int GDAPI godot_pool_byte_array_size(godot_pool_byte_array *p_pba);
godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_pba);
void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba);
@ -142,9 +145,9 @@ void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pia, const godot_
void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pia, const godot_int p_size);
void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
godot_int GDAPI godot_pool_int_array_get(godot_pool_int_array *p_pia, const godot_int p_idx);
godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_pia, const godot_int p_idx);
godot_int GDAPI godot_pool_int_array_size(godot_pool_int_array *p_pia);
godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_pia);
void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pia);
@ -168,9 +171,9 @@ void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pra, const godo
void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pra, const godot_int p_size);
void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
godot_real GDAPI godot_pool_real_array_get(godot_pool_real_array *p_pra, const godot_int p_idx);
godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_pra, const godot_int p_idx);
godot_int GDAPI godot_pool_real_array_size(godot_pool_real_array *p_pra);
godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_pra);
void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pra);
@ -194,9 +197,9 @@ void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_psa, const
void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_psa, const godot_int p_size);
void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_psa, const godot_int p_idx);
godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_psa, const godot_int p_idx);
godot_int GDAPI godot_pool_string_array_size(godot_pool_string_array *p_psa);
godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_psa);
void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_psa);
@ -220,9 +223,9 @@ void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pv2a, con
void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pv2a, const godot_int p_size);
void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
godot_vector2 GDAPI godot_pool_vector2_array_get(godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
godot_int GDAPI godot_pool_vector2_array_size(godot_pool_vector2_array *p_pv2a);
godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_pv2a);
void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pv2a);
@ -246,9 +249,9 @@ void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pv3a, con
void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pv3a, const godot_int p_size);
void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
godot_vector3 GDAPI godot_pool_vector3_array_get(godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
godot_int GDAPI godot_pool_vector3_array_size(godot_pool_vector3_array *p_pv3a);
godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_pv3a);
void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pv3a);
@ -272,9 +275,9 @@ void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pca, const go
void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pca, const godot_int p_size);
void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
godot_color GDAPI godot_pool_color_array_get(godot_pool_color_array *p_pca, const godot_int p_idx);
godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_pca, const godot_int p_idx);
godot_int GDAPI godot_pool_color_array_size(godot_pool_color_array *p_pca);
godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_pca);
void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca);

View File

@ -28,77 +28,150 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_quat.h"
#include "core/variant.h"
#include "math/quat.h"
#include "core/math/quat.h"
#ifdef __cplusplus
extern "C" {
#endif
void _quat_api_anchor() {
void _quat_api_anchor() {}
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) {
Quat *dest = (Quat *)r_dest;
*dest = Quat(p_x, p_y, p_z, p_w);
}
void GDAPI godot_quat_new(godot_quat *p_quat) {
Quat *quat = (Quat *)p_quat;
*quat = Quat();
}
void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) {
Quat *quat = (Quat *)p_quat;
*quat = Quat(x, y, z, w);
}
void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) {
Quat *quat = (Quat *)p_quat;
void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle) {
const Vector3 *axis = (const Vector3 *)p_axis;
*quat = Quat(*axis, p_angle);
Quat *dest = (Quat *)r_dest;
*dest = Quat(*axis, p_angle);
}
void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) {
Quat *quat = (Quat *)p_quat;
const Vector3 *v0 = (const Vector3 *)p_v0;
const Vector3 *v1 = (const Vector3 *)p_v1;
*quat = Quat(*v0, *v1);
godot_string GDAPI godot_quat_as_string(const godot_quat *p_self) {
godot_string ret;
const Quat *self = (const Quat *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) {
Quat *quat = (Quat *)p_quat;
Vector3 euler = quat->get_euler();
return *(godot_vector3 *)&euler;
godot_real GDAPI godot_quat_length(const godot_quat *p_self) {
const Quat *self = (const Quat *)p_self;
return self->length();
}
void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) {
Quat *quat = (Quat *)p_quat;
const Vector3 *euler = (const Vector3 *)p_euler;
quat->set_euler(*euler);
godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self) {
const Quat *self = (const Quat *)p_self;
return self->length_squared();
}
godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) {
Quat *quat = (Quat *)p_quat;
switch (p_idx) {
case 0:
return &quat->x;
case 1:
return &quat->y;
case 2:
return &quat->z;
default:
return &quat->y;
}
godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self) {
godot_quat dest;
const Quat *self = (const Quat *)p_self;
*((Quat *)&dest) = self->normalized();
return dest;
}
godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) {
const Quat *quat = (const Quat *)p_quat;
switch (p_idx) {
case 0:
return quat->x;
case 1:
return quat->y;
case 2:
return quat->z;
default:
return quat->y;
}
godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self) {
const Quat *self = (const Quat *)p_self;
return self->is_normalized();
}
godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self) {
godot_quat dest;
const Quat *self = (const Quat *)p_self;
*((Quat *)&dest) = self->inverse();
return dest;
}
godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b) {
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
return self->dot(*b);
}
godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v) {
godot_vector3 dest;
const Quat *self = (const Quat *)p_self;
const Vector3 *v = (const Vector3 *)p_v;
*((Vector3 *)&dest) = self->xform(*v);
return dest;
}
godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) {
godot_quat dest;
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
*((Quat *)&dest) = self->slerp(*b, p_t);
return dest;
}
godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) {
godot_quat dest;
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
*((Quat *)&dest) = self->slerpni(*b, p_t);
return dest;
}
godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t) {
godot_quat dest;
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
const Quat *pre_a = (const Quat *)p_pre_a;
const Quat *post_b = (const Quat *)p_post_b;
*((Quat *)&dest) = self->cubic_slerp(*b, *pre_a, *post_b, p_t);
return dest;
}
godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
*dest = *self * p_b;
return raw_dest;
}
godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
*dest = *self + *b;
return raw_dest;
}
godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
*dest = *self - *b;
return raw_dest;
}
godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
*dest = *self / p_b;
return raw_dest;
}
godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b) {
const Quat *self = (const Quat *)p_self;
const Quat *b = (const Quat *)p_b;
return *self == *b;
}
godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
*dest = -(*self);
return raw_dest;
}
#ifdef __cplusplus

View File

@ -37,23 +37,51 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
typedef struct godot_quat {
uint8_t _dont_touch_that[16];
} godot_quat;
#endif
#include "../godot.h"
#include "godot_vector3.h"
void GDAPI godot_quat_new(godot_quat *p_quat);
void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w);
void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle);
void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1);
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w);
void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle);
godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat);
void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler);
godot_string GDAPI godot_quat_as_string(const godot_quat *p_self);
godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx);
godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx);
godot_real GDAPI godot_quat_length(const godot_quat *p_self);
godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self);
godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self);
godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self);
godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self);
godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b);
godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v);
godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t);
godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t);
godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t);
godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b);
godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b);
godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b);
godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b);
godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b);
godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self);
#ifdef __cplusplus
}

View File

@ -28,48 +28,128 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_rect2.h"
#include "core/variant.h"
#include "math/math_2d.h"
#include "core/math/math_2d.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rect2_api_anchor() {
}
void _rect2_api_anchor() {}
void GDAPI godot_rect2_new(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
*rect = Rect2();
}
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
Rect2 *rect = (Rect2 *)p_rect;
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
const Vector2 *pos = (const Vector2 *)p_pos;
const Vector2 *size = (const Vector2 *)p_size;
*rect = Rect2(*pos, *size);
Rect2 *dest = (Rect2 *)r_dest;
*dest = Rect2(*pos, *size);
}
godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
return (godot_vector2 *)&rect->pos;
void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height) {
Rect2 *dest = (Rect2 *)r_dest;
*dest = Rect2(p_x, p_y, p_width, p_height);
}
void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) {
Rect2 *rect = (Rect2 *)p_rect;
godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self) {
godot_string ret;
const Rect2 *self = (const Rect2 *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self) {
const Rect2 *self = (const Rect2 *)p_self;
return self->get_area();
}
godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b) {
const Rect2 *self = (const Rect2 *)p_self;
const Rect2 *b = (const Rect2 *)p_b;
return self->intersects(*b);
}
godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b) {
const Rect2 *self = (const Rect2 *)p_self;
const Rect2 *b = (const Rect2 *)p_b;
return self->encloses(*b);
}
godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self) {
const Rect2 *self = (const Rect2 *)p_self;
return self->has_no_area();
}
godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b) {
godot_rect2 dest;
const Rect2 *self = (const Rect2 *)p_self;
const Rect2 *b = (const Rect2 *)p_b;
*((Rect2 *)&dest) = self->clip(*b);
return dest;
}
godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b) {
godot_rect2 dest;
const Rect2 *self = (const Rect2 *)p_self;
const Rect2 *b = (const Rect2 *)p_b;
*((Rect2 *)&dest) = self->merge(*b);
return dest;
}
godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point) {
const Rect2 *self = (const Rect2 *)p_self;
const Vector2 *point = (const Vector2 *)p_point;
return self->has_point(*point);
}
godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by) {
godot_rect2 dest;
const Rect2 *self = (const Rect2 *)p_self;
*((Rect2 *)&dest) = self->grow(p_by);
return dest;
}
godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to) {
godot_rect2 dest;
const Rect2 *self = (const Rect2 *)p_self;
const Vector2 *to = (const Vector2 *)p_to;
*((Rect2 *)&dest) = self->expand(*to);
return dest;
}
godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b) {
const Rect2 *self = (const Rect2 *)p_self;
const Rect2 *b = (const Rect2 *)p_b;
return *self == *b;
}
godot_vector2 GDAPI godot_rect2_get_pos(const godot_rect2 *p_self) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Rect2 *self = (const Rect2 *)p_self;
*d = self->get_pos();
return dest;
}
godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Rect2 *self = (const Rect2 *)p_self;
*d = self->get_size();
return dest;
}
void GDAPI godot_rect2_set_pos(godot_rect2 *p_self, const godot_vector2 *p_pos) {
Rect2 *self = (Rect2 *)p_self;
const Vector2 *pos = (const Vector2 *)p_pos;
rect->pos = *pos;
self->set_pos(*pos);
}
godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
return (godot_vector2 *)&rect->size;
}
void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) {
Rect2 *rect = (Rect2 *)p_rect;
void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size) {
Rect2 *self = (Rect2 *)p_self;
const Vector2 *size = (const Vector2 *)p_size;
rect->size = *size;
self->set_size(*size);
}
#ifdef __cplusplus

View File

@ -37,24 +37,50 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
typedef struct godot_rect2 {
uint8_t _dont_touch_that[16];
} godot_rect2;
#endif
#include "../godot.h"
#include "godot_vector2.h"
void GDAPI godot_rect2_new(godot_rect2 *p_rect);
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size);
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size);
void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height);
godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect);
void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos);
godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self);
godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect);
void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size);
godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self);
godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b);
godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b);
godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self);
godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b);
godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b);
godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point);
godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by);
godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to);
godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b);
godot_vector2 GDAPI godot_rect2_get_pos(const godot_rect2 *p_self);
godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self);
void GDAPI godot_rect2_set_pos(godot_rect2 *p_self, const godot_vector2 *p_pos);
void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size);
#ifdef __cplusplus
}
#endif
#endif // GODOT_RECT3_H
#endif // GODOT_RECT2_H

View File

@ -28,48 +28,162 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_rect3.h"
#include "core/variant.h"
#include "math/rect3.h"
#include "core/math/rect3.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rect3_api_anchor() {
}
void _rect3_api_anchor() {}
void GDAPI godot_rect3_new(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
*rect = Rect3();
}
void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
Rect3 *rect = (Rect3 *)p_rect;
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
const Vector3 *pos = (const Vector3 *)p_pos;
const Vector3 *size = (const Vector3 *)p_size;
*rect = Rect3(*pos, *size);
Rect3 *dest = (Rect3 *)r_dest;
*dest = Rect3(*pos, *size);
}
godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
return (godot_vector3 *)&rect->pos;
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) {
godot_string ret;
const Rect3 *self = (const Rect3 *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *pos = (const Vector3 *)p_pos;
rect->pos = *pos;
godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->get_area();
}
godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
return (godot_vector3 *)&rect->size;
godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->has_no_area();
}
void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *size = (const Vector3 *)p_size;
rect->size = *size;
godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->has_no_surface();
}
godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with) {
const Rect3 *self = (const Rect3 *)p_self;
const Rect3 *with = (const Rect3 *)p_with;
return self->intersects(*with);
}
godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with) {
const Rect3 *self = (const Rect3 *)p_self;
const Rect3 *with = (const Rect3 *)p_with;
return self->encloses(*with);
}
godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with) {
godot_rect3 dest;
const Rect3 *self = (const Rect3 *)p_self;
const Rect3 *with = (const Rect3 *)p_with;
*((Rect3 *)&dest) = self->merge(*with);
return dest;
}
godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with) {
godot_rect3 dest;
const Rect3 *self = (const Rect3 *)p_self;
const Rect3 *with = (const Rect3 *)p_with;
*((Rect3 *)&dest) = self->intersection(*with);
return dest;
}
godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane) {
const Rect3 *self = (const Rect3 *)p_self;
const Plane *plane = (const Plane *)p_plane;
return self->intersects_plane(*plane);
}
godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
const Rect3 *self = (const Rect3 *)p_self;
const Vector3 *from = (const Vector3 *)p_from;
const Vector3 *to = (const Vector3 *)p_to;
return self->intersects_segment(*from, *to);
}
godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point) {
const Rect3 *self = (const Rect3 *)p_self;
const Vector3 *point = (const Vector3 *)p_point;
return self->has_point(*point);
}
godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir) {
godot_vector3 dest;
const Rect3 *self = (const Rect3 *)p_self;
const Vector3 *dir = (const Vector3 *)p_dir;
*((Vector3 *)&dest) = self->get_support(*dir);
return dest;
}
godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self) {
godot_vector3 dest;
const Rect3 *self = (const Rect3 *)p_self;
*((Vector3 *)&dest) = self->get_longest_axis();
return dest;
}
godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->get_longest_axis_index();
}
godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->get_longest_axis_size();
}
godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self) {
godot_vector3 dest;
const Rect3 *self = (const Rect3 *)p_self;
*((Vector3 *)&dest) = self->get_shortest_axis();
return dest;
}
godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->get_shortest_axis_index();
}
godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self) {
const Rect3 *self = (const Rect3 *)p_self;
return self->get_shortest_axis_size();
}
godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point) {
godot_rect3 dest;
const Rect3 *self = (const Rect3 *)p_self;
const Vector3 *to_point = (const Vector3 *)p_to_point;
*((Rect3 *)&dest) = self->expand(*to_point);
return dest;
}
godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by) {
godot_rect3 dest;
const Rect3 *self = (const Rect3 *)p_self;
*((Rect3 *)&dest) = self->grow(p_by);
return dest;
}
godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx) {
godot_vector3 dest;
const Rect3 *self = (const Rect3 *)p_self;
*((Vector3 *)&dest) = self->get_endpoint(p_idx);
return dest;
}
godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b) {
const Rect3 *self = (const Rect3 *)p_self;
const Rect3 *b = (const Rect3 *)p_b;
return *self == *b;
}
#ifdef __cplusplus

View File

@ -37,21 +37,61 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
typedef struct godot_rect3 {
uint8_t _dont_touch_that[24];
} godot_rect3;
#endif
#include "../godot.h"
#include "godot_plane.h"
#include "godot_vector3.h"
void GDAPI godot_rect3_new(godot_rect3 *p_rect);
void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size);
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect);
void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos);
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self);
godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect);
void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size);
godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self);
godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self);
godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self);
godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with);
godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with);
godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with);
godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with);
godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane);
godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point);
godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir);
godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self);
godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self);
godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self);
godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self);
godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self);
godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self);
godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point);
godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by);
godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx);
godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b);
#ifdef __cplusplus
}

View File

@ -28,36 +28,46 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_rid.h"
#include "core/variant.h"
#include "object.h"
#include "resource.h"
#include "core/resource.h"
#include "core/rid.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rid_api_anchor() {
void _rid_api_anchor() {}
void GDAPI godot_rid_new(godot_rid *r_dest) {
RID *dest = (RID *)r_dest;
memnew_placement(dest, RID);
}
void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) {
Resource *res_from = ((Object *)p_from)->cast_to<Resource>();
RID *rid = (RID *)p_rid;
memnew_placement(rid, RID);
godot_int GDAPI godot_rid_get_id(const godot_rid *p_self) {
const RID *self = (const RID *)p_self;
return self->get_id();
}
void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from) {
const Resource *res_from = ((const Object *)p_from)->cast_to<Resource>();
godot_rid_new(r_dest);
if (res_from) {
*rid = RID(res_from->get_rid());
RID *dest = (RID *)r_dest;
*dest = RID(res_from->get_rid());
}
}
uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) {
RID *rid = (RID *)p_rid;
return rid->get_id();
godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b) {
const RID *self = (const RID *)p_self;
const RID *b = (const RID *)p_b;
return *self == *b;
}
void GDAPI godot_rid_destroy(godot_rid *p_rid) {
((RID *)p_rid)->~RID();
godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b) {
const RID *self = (const RID *)p_self;
const RID *b = (const RID *)p_b;
return *self < *b;
}
#ifdef __cplusplus

View File

@ -37,6 +37,7 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
typedef struct godot_rid {
uint8_t _dont_touch_that[8];
} godot_rid;
@ -44,11 +45,15 @@ typedef struct godot_rid {
#include "../godot.h"
void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from);
void GDAPI godot_rid_new(godot_rid *r_dest);
uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
godot_int GDAPI godot_rid_get_id(const godot_rid *p_self);
void GDAPI godot_rid_destroy(godot_rid *p_rid);
void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from);
godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b);
godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b);
#ifdef __cplusplus
}

View File

@ -53,6 +53,12 @@ void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, co
*p = String::utf8(p_contents, p_size);
}
void GDAPI godot_string_new_unicode_data(godot_string *p_str, const wchar_t *p_contents, const int p_size) {
String *p = (String *)p_str;
memnew_placement(p, String);
*p = String(p_contents, p_size);
}
void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size) {
String *p = (String *)p_str;
if (p_size != NULL) {

View File

@ -47,6 +47,7 @@ typedef struct godot_string {
void GDAPI godot_string_new(godot_string *p_str);
void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
void GDAPI godot_string_new_unicode_data(godot_string *p_str, const wchar_t *p_contents, const int p_size);
void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size);

View File

@ -28,42 +28,168 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_transform.h"
#include "core/variant.h"
#include "math/transform.h"
#include "core/math/transform.h"
#ifdef __cplusplus
extern "C" {
#endif
void _transform_api_anchor() {
void _transform_api_anchor() {}
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) {
const Vector3 *x_axis = (const Vector3 *)p_x_axis;
const Vector3 *y_axis = (const Vector3 *)p_y_axis;
const Vector3 *z_axis = (const Vector3 *)p_z_axis;
const Vector3 *origin = (const Vector3 *)p_origin;
Transform *dest = (Transform *)r_dest;
dest->basis.set_axis(0, *x_axis);
dest->basis.set_axis(1, *y_axis);
dest->basis.set_axis(2, *z_axis);
dest->origin = *origin;
}
void GDAPI godot_transform_new(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
*trans = Transform();
}
void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) {
Transform *trans = (Transform *)p_trans;
const Basis *basis = (const Basis *)p_basis;
*trans = Transform(*basis);
}
void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) {
Transform *trans = (Transform *)p_trans;
void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin) {
const Basis *basis = (const Basis *)p_basis;
const Vector3 *origin = (const Vector3 *)p_origin;
*trans = Transform(*basis, *origin);
Transform *dest = (Transform *)r_dest;
*dest = Transform(*basis, *origin);
}
godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
return (godot_basis *)&trans->basis;
godot_string GDAPI godot_transform_as_string(const godot_transform *p_self) {
godot_string ret;
const Transform *self = (const Transform *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
return (godot_vector3 *)&trans->origin;
godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
*((Transform *)&dest) = self->inverse();
return dest;
}
godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
*((Transform *)&dest) = self->affine_inverse();
return dest;
}
godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
*((Transform *)&dest) = self->orthonormalized();
return dest;
}
godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
const Vector3 *axis = (const Vector3 *)p_axis;
*((Transform *)&dest) = self->rotated(*axis, p_phi);
return dest;
}
godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
const Vector3 *scale = (const Vector3 *)p_scale;
*((Transform *)&dest) = self->scaled(*scale);
return dest;
}
godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
const Vector3 *ofs = (const Vector3 *)p_ofs;
*((Transform *)&dest) = self->translated(*ofs);
return dest;
}
godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up) {
godot_transform dest;
const Transform *self = (const Transform *)p_self;
const Vector3 *target = (const Vector3 *)p_target;
const Vector3 *up = (const Vector3 *)p_up;
*((Transform *)&dest) = self->looking_at(*target, *up);
return dest;
}
godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v) {
godot_plane raw_dest;
Plane *dest = (Plane *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Plane *v = (const Plane *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v) {
godot_plane raw_dest;
Plane *dest = (Plane *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Plane *v = (const Plane *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
void GDAPI godot_transform_new_identity(godot_transform *r_dest) {
Transform *dest = (Transform *)r_dest;
*dest = Transform();
}
godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b) {
const Transform *self = (const Transform *)p_self;
const Transform *b = (const Transform *)p_b;
return *self == *b;
}
godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b) {
godot_transform raw_dest;
Transform *dest = (Transform *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Transform *b = (const Transform *)p_b;
*dest = *self * *b;
return raw_dest;
}
godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Vector3 *v = (const Vector3 *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Vector3 *v = (const Vector3 *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
godot_rect3 raw_dest;
Rect3 *dest = (Rect3 *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Rect3 *v = (const Rect3 *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
godot_rect3 raw_dest;
Rect3 *dest = (Rect3 *)&raw_dest;
const Transform *self = (const Transform *)p_self;
const Rect3 *v = (const Rect3 *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
#ifdef __cplusplus

View File

@ -37,19 +37,53 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
typedef struct godot_transform {
uint8_t _dont_touch_that[48];
} godot_transform;
#endif
#include "../godot.h"
#include "godot_basis.h"
#include "godot_variant.h"
#include "godot_vector3.h"
void GDAPI godot_transform_new(godot_transform *p_trans);
void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis);
void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin);
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin);
void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin);
godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans);
godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans);
godot_string GDAPI godot_transform_as_string(const godot_transform *p_self);
godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self);
godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self);
godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self);
godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi);
godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale);
godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs);
godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up);
godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v);
godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v);
void GDAPI godot_transform_new_identity(godot_transform *r_dest);
godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b);
godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b);
godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
#ifdef __cplusplus
}

View File

@ -28,60 +28,182 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_transform2d.h"
#include "core/variant.h"
#include "../godot.h"
#include "math/math_2d.h"
#include "core/math/math_2d.h"
#ifdef __cplusplus
extern "C" {
#endif
void _transform2d_api_anchor() {
void _transform2d_api_anchor() {}
void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) {
const Vector2 *pos = (const Vector2 *)p_pos;
Transform2D *dest = (Transform2D *)r_dest;
*dest = Transform2D(p_rot, *pos);
}
void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) {
Transform2D *t = (Transform2D *)p_t;
*t = Transform2D();
void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin) {
const Vector2 *x_axis = (const Vector2 *)p_x_axis;
const Vector2 *y_axis = (const Vector2 *)p_y_axis;
const Vector2 *origin = (const Vector2 *)p_origin;
Transform2D *dest = (Transform2D *)r_dest;
*dest = Transform2D(x_axis->x, x_axis->y, y_axis->x, y_axis->y, origin->x, origin->y);
}
void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *a = (Vector2 *)p_a;
Vector2 *b = (Vector2 *)p_b;
Vector2 *c = (Vector2 *)p_c;
*t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y);
godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self) {
godot_string ret;
const Transform2D *self = (const Transform2D *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *pos = (Vector2 *)p_pos;
*t = Transform2D(p_rot, *pos);
godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
*((Transform2D *)&dest) = self->inverse();
return dest;
}
godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) {
const Transform2D *t = (const Transform2D *)p_t;
const Vector2 *e = &t->operator[](p_idx);
return (godot_vector2 const *)e;
godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
*((Transform2D *)&dest) = self->affine_inverse();
return dest;
}
godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *e = &t->operator[](p_idx);
return (godot_vector2 *)e;
godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self) {
const Transform2D *self = (const Transform2D *)p_self;
return self->get_rotation();
}
godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) {
return *godot_transform2d_const_index(p_t, p_axis);
godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self) {
godot_vector2 dest;
const Transform2D *self = (const Transform2D *)p_self;
*((Vector2 *)&dest) = self->get_origin();
return dest;
}
void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) {
godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis);
*origin_v = *p_vec;
godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self) {
godot_vector2 dest;
const Transform2D *self = (const Transform2D *)p_self;
*((Vector2 *)&dest) = self->get_scale();
return dest;
}
// @Incomplete
// See header file
godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
*((Transform2D *)&dest) = self->orthonormalized();
return dest;
}
godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
*((Transform2D *)&dest) = self->rotated(p_phi);
return dest;
}
godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
const Vector2 *scale = (const Vector2 *)p_scale;
*((Transform2D *)&dest) = self->scaled(*scale);
return dest;
}
godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
const Vector2 *offset = (const Vector2 *)p_offset;
*((Transform2D *)&dest) = self->translated(*offset);
return dest;
}
godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Vector2 *v = (const Vector2 *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Vector2 *v = (const Vector2 *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Vector2 *v = (const Vector2 *)p_v;
*dest = self->basis_xform(*v);
return raw_dest;
}
godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Vector2 *v = (const Vector2 *)p_v;
*dest = self->basis_xform_inv(*v);
return raw_dest;
}
godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c) {
godot_transform2d dest;
const Transform2D *self = (const Transform2D *)p_self;
const Transform2D *m = (const Transform2D *)p_m;
*((Transform2D *)&dest) = self->interpolate_with(*m, p_c);
return dest;
}
godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b) {
const Transform2D *self = (const Transform2D *)p_self;
const Transform2D *b = (const Transform2D *)p_b;
return *self == *b;
}
godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b) {
godot_transform2d raw_dest;
Transform2D *dest = (Transform2D *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Transform2D *b = (const Transform2D *)p_b;
*dest = *self * *b;
return raw_dest;
}
void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest) {
Transform2D *dest = (Transform2D *)r_dest;
*dest = Transform2D();
}
godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v) {
godot_rect2 raw_dest;
Rect2 *dest = (Rect2 *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Rect2 *v = (const Rect2 *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v) {
godot_rect2 raw_dest;
Rect2 *dest = (Rect2 *)&raw_dest;
const Transform2D *self = (const Transform2D *)p_self;
const Rect2 *v = (const Rect2 *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
#ifdef __cplusplus
}

View File

@ -44,31 +44,51 @@ typedef struct godot_transform2d {
#endif
#include "../godot.h"
#include "godot_variant.h"
#include "godot_vector2.h"
void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t);
void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c);
void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos);
void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos);
void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin);
/*
godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v);
godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v);
*/
godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self);
godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx);
godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx);
godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self);
godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis);
void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec);
godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self);
/*
void GDAPI godot_transform2d_invert(godot_transform2d *p_t);
godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t);
*/
godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self);
// @Incomplete
// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings.
godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self);
godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self);
godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self);
godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi);
godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale);
godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset);
godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c);
godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b);
godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b);
void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest);
godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v);
godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v);
#ifdef __cplusplus
}

View File

@ -28,23 +28,21 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_variant.h"
#include "../godot.h"
#include "variant.h"
#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
#endif
void _variant_api_anchor() {
}
void _variant_api_anchor() {}
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
return (godot_variant_type)v->get_type();
// Constructors
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
return (godot_variant_type)self->get_type();
}
void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src) {
@ -53,461 +51,429 @@ void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src)
*dest = *src;
}
void GDAPI godot_variant_new_nil(godot_variant *p_v) {
Variant *v = (Variant *)p_v;
memnew_placement(v, Variant);
void GDAPI godot_variant_new_nil(godot_variant *r_dest) {
Variant *dest = (Variant *)r_dest;
memnew_placement(dest, Variant);
}
void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b) {
Variant *v = (Variant *)p_v;
memnew_placement_custom(v, Variant, Variant(p_b));
void GDAPI godot_variant_new_bool(godot_variant *r_dest, const godot_bool p_b) {
Variant *dest = (Variant *)r_dest;
memnew_placement_custom(dest, Variant, Variant(p_b));
}
void GDAPI godot_variant_new_uint(godot_variant *p_v, const uint64_t p_i) {
Variant *v = (Variant *)p_v;
memnew_placement_custom(v, Variant, Variant(p_i));
void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i) {
Variant *dest = (Variant *)r_dest;
memnew_placement_custom(dest, Variant, Variant(p_i));
}
void GDAPI godot_variant_new_int(godot_variant *p_v, const int64_t p_i) {
Variant *v = (Variant *)p_v;
memnew_placement_custom(v, Variant, Variant(p_i));
void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i) {
Variant *dest = (Variant *)r_dest;
memnew_placement_custom(dest, Variant, Variant(p_i));
}
void GDAPI godot_variant_new_real(godot_variant *p_v, const double p_r) {
Variant *v = (Variant *)p_v;
memnew_placement_custom(v, Variant, Variant(p_r));
void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r) {
Variant *dest = (Variant *)r_dest;
memnew_placement_custom(dest, Variant, Variant(p_r));
}
void GDAPI godot_variant_new_string(godot_variant *p_v, const godot_string *p_s) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s) {
Variant *dest = (Variant *)r_dest;
String *s = (String *)p_s;
memnew_placement_custom(v, Variant, Variant(*s));
memnew_placement_custom(dest, Variant, Variant(*s));
}
void GDAPI godot_variant_new_vector2(godot_variant *p_v, const godot_vector2 *p_v2) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2) {
Variant *dest = (Variant *)r_dest;
Vector2 *v2 = (Vector2 *)p_v2;
memnew_placement_custom(v, Variant, Variant(*v2));
memnew_placement_custom(dest, Variant, Variant(*v2));
}
void GDAPI godot_variant_new_rect2(godot_variant *p_v, const godot_rect2 *p_rect2) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2) {
Variant *dest = (Variant *)r_dest;
Rect2 *rect2 = (Rect2 *)p_rect2;
memnew_placement_custom(v, Variant, Variant(*rect2));
memnew_placement_custom(dest, Variant, Variant(*rect2));
}
void GDAPI godot_variant_new_vector3(godot_variant *p_v, const godot_vector3 *p_v3) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3) {
Variant *dest = (Variant *)r_dest;
Vector3 *v3 = (Vector3 *)p_v3;
memnew_placement_custom(v, Variant, Variant(*v3));
memnew_placement_custom(dest, Variant, Variant(*v3));
}
void GDAPI godot_variant_new_transform2d(godot_variant *p_v, const godot_transform2d *p_t2d) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d) {
Variant *dest = (Variant *)r_dest;
Transform2D *t2d = (Transform2D *)p_t2d;
memnew_placement_custom(v, Variant, Variant(*t2d));
memnew_placement_custom(dest, Variant, Variant(*t2d));
}
void GDAPI godot_variant_new_plane(godot_variant *p_v, const godot_plane *p_plane) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane) {
Variant *dest = (Variant *)r_dest;
Plane *plane = (Plane *)p_plane;
memnew_placement_custom(v, Variant, Variant(*plane));
memnew_placement_custom(dest, Variant, Variant(*plane));
}
void GDAPI godot_variant_new_quat(godot_variant *p_v, const godot_quat *p_quat) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat) {
Variant *dest = (Variant *)r_dest;
Quat *quat = (Quat *)p_quat;
memnew_placement_custom(v, Variant, Variant(*quat));
memnew_placement_custom(dest, Variant, Variant(*quat));
}
void GDAPI godot_variant_new_rect3(godot_variant *p_v, const godot_rect3 *p_rect3) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3) {
Variant *dest = (Variant *)r_dest;
Rect3 *rect3 = (Rect3 *)p_rect3;
memnew_placement_custom(v, Variant, Variant(*rect3));
memnew_placement_custom(dest, Variant, Variant(*rect3));
}
void GDAPI godot_variant_new_basis(godot_variant *p_v, const godot_basis *p_basis) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) {
Variant *dest = (Variant *)r_dest;
Basis *basis = (Basis *)p_basis;
memnew_placement_custom(v, Variant, Variant(*basis));
memnew_placement_custom(dest, Variant, Variant(*basis));
}
void GDAPI godot_variant_new_transform(godot_variant *p_v, const godot_transform *p_trans) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans) {
Variant *dest = (Variant *)r_dest;
Transform *trans = (Transform *)p_trans;
memnew_placement_custom(v, Variant, Variant(*trans));
memnew_placement_custom(dest, Variant, Variant(*trans));
}
void GDAPI godot_variant_new_color(godot_variant *p_v, const godot_color *p_color) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color) {
Variant *dest = (Variant *)r_dest;
Color *color = (Color *)p_color;
memnew_placement_custom(v, Variant, Variant(*color));
memnew_placement_custom(dest, Variant, Variant(*color));
}
void GDAPI godot_variant_new_image(godot_variant *p_v, const godot_image *p_img) {
Variant *v = (Variant *)p_v;
Image *img = (Image *)p_img;
memnew_placement_custom(v, Variant, Variant(*img));
}
void GDAPI godot_variant_new_node_path(godot_variant *p_v, const godot_node_path *p_np) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np) {
Variant *dest = (Variant *)r_dest;
NodePath *np = (NodePath *)p_np;
memnew_placement_custom(v, Variant, Variant(*np));
memnew_placement_custom(dest, Variant, Variant(*np));
}
void GDAPI godot_variant_new_rid(godot_variant *p_v, const godot_rid *p_rid) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid) {
Variant *dest = (Variant *)r_dest;
RID *rid = (RID *)p_rid;
memnew_placement_custom(v, Variant, Variant(*rid));
memnew_placement_custom(dest, Variant, Variant(*rid));
}
void GDAPI godot_variant_new_object(godot_variant *p_v, const godot_object *p_obj) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj) {
Variant *dest = (Variant *)r_dest;
Object *obj = (Object *)p_obj;
memnew_placement_custom(v, Variant, Variant(obj));
memnew_placement_custom(dest, Variant, Variant(obj));
}
void GDAPI godot_variant_new_input_event(godot_variant *p_v, const godot_input_event *p_event) {
Variant *v = (Variant *)p_v;
InputEvent *event = (InputEvent *)p_event;
memnew_placement_custom(v, Variant, Variant(*event));
}
void GDAPI godot_variant_new_dictionary(godot_variant *p_v, const godot_dictionary *p_dict) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict) {
Variant *dest = (Variant *)r_dest;
Dictionary *dict = (Dictionary *)p_dict;
memnew_placement_custom(v, Variant, Variant(*dict));
memnew_placement_custom(dest, Variant, Variant(*dict));
}
void GDAPI godot_variant_new_array(godot_variant *p_v, const godot_array *p_arr) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr) {
Variant *dest = (Variant *)r_dest;
Array *arr = (Array *)p_arr;
memnew_placement_custom(v, Variant, Variant(*arr));
memnew_placement_custom(dest, Variant, Variant(*arr));
}
void GDAPI godot_variant_new_pool_byte_array(godot_variant *p_v, const godot_pool_byte_array *p_pba) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba) {
Variant *dest = (Variant *)r_dest;
PoolByteArray *pba = (PoolByteArray *)p_pba;
memnew_placement_custom(v, Variant, Variant(*pba));
memnew_placement_custom(dest, Variant, Variant(*pba));
}
void GDAPI godot_variant_new_pool_int_array(godot_variant *p_v, const godot_pool_int_array *p_pia) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia) {
Variant *dest = (Variant *)r_dest;
PoolIntArray *pia = (PoolIntArray *)p_pia;
memnew_placement_custom(v, Variant, Variant(*pia));
memnew_placement_custom(dest, Variant, Variant(*pia));
}
void GDAPI godot_variant_new_pool_real_array(godot_variant *p_v, const godot_pool_real_array *p_pra) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra) {
Variant *dest = (Variant *)r_dest;
PoolRealArray *pra = (PoolRealArray *)p_pra;
memnew_placement_custom(v, Variant, Variant(*pra));
memnew_placement_custom(dest, Variant, Variant(*pra));
}
void GDAPI godot_variant_new_pool_string_array(godot_variant *p_v, const godot_pool_string_array *p_psa) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa) {
Variant *dest = (Variant *)r_dest;
PoolStringArray *psa = (PoolStringArray *)p_psa;
memnew_placement_custom(v, Variant, Variant(*psa));
memnew_placement_custom(dest, Variant, Variant(*psa));
}
void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_pool_vector2_array *p_pv2a) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a) {
Variant *dest = (Variant *)r_dest;
PoolVector2Array *pv2a = (PoolVector2Array *)p_pv2a;
memnew_placement_custom(v, Variant, Variant(*pv2a));
memnew_placement_custom(dest, Variant, Variant(*pv2a));
}
void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a) {
Variant *dest = (Variant *)r_dest;
PoolVector3Array *pv3a = (PoolVector3Array *)p_pv3a;
memnew_placement_custom(v, Variant, Variant(*pv3a));
memnew_placement_custom(dest, Variant, Variant(*pv3a));
}
void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca) {
Variant *v = (Variant *)p_v;
void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca) {
Variant *dest = (Variant *)r_dest;
PoolColorArray *pca = (PoolColorArray *)p_pca;
memnew_placement_custom(v, Variant, Variant(*pca));
memnew_placement_custom(dest, Variant, Variant(*pca));
}
godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
return v->operator bool();
godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
return self->operator bool();
}
uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
return v->operator uint64_t();
uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
return self->operator uint64_t();
}
int64_t GDAPI godot_variant_as_int(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
return v->operator int64_t();
int64_t GDAPI godot_variant_as_int(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
return self->operator int64_t();
}
double GDAPI godot_variant_as_real(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
return v->operator double();
double GDAPI godot_variant_as_real(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
return self->operator double();
}
godot_string GDAPI godot_variant_as_string(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_string s;
godot_string_new(&s);
String *str = (String *)&s;
*str = v->operator String();
return s;
godot_string GDAPI godot_variant_as_string(const godot_variant *p_self) {
godot_string raw_dest;
const Variant *self = (const Variant *)p_self;
String *dest = (String *)&raw_dest;
memnew_placement(dest, String(self->operator String())); // operator = is overloaded by String
return raw_dest;
}
godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_vector2 v2;
Vector2 *vec2 = (Vector2 *)&v2;
*vec2 = *v;
return v2;
godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self) {
godot_vector2 raw_dest;
const Variant *self = (const Variant *)p_self;
Vector2 *dest = (Vector2 *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_rect2 r2;
Rect2 *rect2 = (Rect2 *)&r2;
*rect2 = *v;
return r2;
godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self) {
godot_rect2 raw_dest;
const Variant *self = (const Variant *)p_self;
Rect2 *dest = (Rect2 *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_vector3 v3;
Vector3 *vec3 = (Vector3 *)&v3;
*vec3 = *v;
return v3;
godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self) {
godot_vector3 raw_dest;
const Variant *self = (const Variant *)p_self;
Vector3 *dest = (Vector3 *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_transform2d t2;
Transform2D *t = (Transform2D *)&t2;
*t = *v;
return t2;
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self) {
godot_transform2d raw_dest;
const Variant *self = (const Variant *)p_self;
Transform2D *dest = (Transform2D *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_plane p;
Plane *pl = (Plane *)&p;
*pl = *v;
return p;
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self) {
godot_plane raw_dest;
const Variant *self = (const Variant *)p_self;
Plane *dest = (Plane *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_quat q;
Quat *qt = (Quat *)&q;
*qt = *v;
return q;
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) {
godot_quat raw_dest;
const Variant *self = (const Variant *)p_self;
Quat *dest = (Quat *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_rect3 r;
Rect3 *r3 = (Rect3 *)&r;
*r3 = *v;
return r;
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self) {
godot_rect3 raw_dest;
const Variant *self = (const Variant *)p_self;
Rect3 *dest = (Rect3 *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_basis b;
Basis *bs = (Basis *)&b;
*bs = *v;
return b;
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) {
godot_basis raw_dest;
const Variant *self = (const Variant *)p_self;
Basis *dest = (Basis *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_transform t;
Transform *tr = (Transform *)&t;
*tr = *v;
return t;
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self) {
godot_transform raw_dest;
const Variant *self = (const Variant *)p_self;
Transform *dest = (Transform *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_color GDAPI godot_variant_as_color(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_color c;
Color *col = (Color *)&c;
*col = *v;
return c;
godot_color GDAPI godot_variant_as_color(const godot_variant *p_self) {
godot_color raw_dest;
const Variant *self = (const Variant *)p_self;
Color *dest = (Color *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_image GDAPI godot_variant_as_image(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_image img;
godot_image_new(&img);
Image *i = (Image *)&img;
*i = *v;
return img;
godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self) {
godot_node_path raw_dest;
const Variant *self = (const Variant *)p_self;
NodePath *dest = (NodePath *)&raw_dest;
memnew_placement(dest, NodePath(self->operator NodePath())); // operator = is overloaded by NodePath
return raw_dest;
}
godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_node_path np;
memnew_placement_custom((NodePath *)&np, NodePath, NodePath((String)*v));
return np;
godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self) {
godot_rid raw_dest;
const Variant *self = (const Variant *)p_self;
RID *dest = (RID *)&raw_dest;
*dest = *self;
return raw_dest;
}
godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_rid rid;
memnew_placement_custom((RID *)&rid, RID, RID(*v));
return rid;
godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self) {
const Variant *self = (const Variant *)p_self;
Object *dest;
dest = *self;
return (godot_object *)dest;
}
godot_object GDAPI *godot_variant_as_object(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_object *p = NULL;
Object **op = (Object **)&p;
*op = *v;
return p;
godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self) {
godot_dictionary raw_dest;
const Variant *self = (const Variant *)p_self;
Dictionary *dest = (Dictionary *)&raw_dest;
memnew_placement(dest, Dictionary(self->operator Dictionary())); // operator = is overloaded by Dictionary
return raw_dest;
}
godot_input_event GDAPI godot_variant_as_input_event(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_input_event ev;
InputEvent *event = (InputEvent *)&ev;
*event = *v;
return ev;
godot_array GDAPI godot_variant_as_array(const godot_variant *p_self) {
godot_array raw_dest;
const Variant *self = (const Variant *)p_self;
Array *dest = (Array *)&raw_dest;
memnew_placement(dest, Array(self->operator Array())); // operator = is overloaded by Array
return raw_dest;
}
godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_dictionary dict;
godot_dictionary_new(&dict);
Dictionary *d = (Dictionary *)&dict;
*d = *v;
return dict;
godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self) {
godot_pool_byte_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolByteArray *dest = (PoolByteArray *)&raw_dest;
memnew_placement(dest, PoolByteArray(self->operator PoolByteArray())); // operator = is overloaded by PoolByteArray
*dest = *self;
return raw_dest;
}
godot_array GDAPI godot_variant_as_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_array array;
godot_array_new(&array);
Array *a = (Array *)&array;
*a = *v;
return array;
godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self) {
godot_pool_int_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolIntArray *dest = (PoolIntArray *)&raw_dest;
memnew_placement(dest, PoolIntArray(self->operator PoolIntArray())); // operator = is overloaded by PoolIntArray
*dest = *self;
return raw_dest;
}
godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_byte_array pba;
godot_pool_byte_array_new(&pba);
PoolByteArray *p = (PoolByteArray *)&pba;
*p = *v;
return pba;
godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self) {
godot_pool_real_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolRealArray *dest = (PoolRealArray *)&raw_dest;
memnew_placement(dest, PoolRealArray(self->operator PoolRealArray())); // operator = is overloaded by PoolRealArray
*dest = *self;
return raw_dest;
}
godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_int_array pba;
godot_pool_int_array_new(&pba);
PoolIntArray *p = (PoolIntArray *)&pba;
*p = *v;
return pba;
godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self) {
godot_pool_string_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolStringArray *dest = (PoolStringArray *)&raw_dest;
memnew_placement(dest, PoolStringArray(self->operator PoolStringArray())); // operator = is overloaded by PoolStringArray
*dest = *self;
return raw_dest;
}
godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_real_array pba;
godot_pool_real_array_new(&pba);
PoolRealArray *p = (PoolRealArray *)&pba;
*p = *v;
return pba;
godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self) {
godot_pool_vector2_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolVector2Array *dest = (PoolVector2Array *)&raw_dest;
memnew_placement(dest, PoolVector2Array(self->operator PoolVector2Array())); // operator = is overloaded by PoolVector2Array
*dest = *self;
return raw_dest;
}
godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_string_array pba;
godot_pool_string_array_new(&pba);
PoolStringArray *p = (PoolStringArray *)&pba;
*p = *v;
return pba;
godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self) {
godot_pool_vector3_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolVector3Array *dest = (PoolVector3Array *)&raw_dest;
memnew_placement(dest, PoolVector3Array(self->operator PoolVector3Array())); // operator = is overloaded by PoolVector3Array
*dest = *self;
return raw_dest;
}
godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_vector2_array pba;
godot_pool_vector2_array_new(&pba);
PoolVector2Array *p = (PoolVector2Array *)&pba;
*p = *v;
return pba;
godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self) {
godot_pool_color_array raw_dest;
const Variant *self = (const Variant *)p_self;
PoolColorArray *dest = (PoolColorArray *)&raw_dest;
memnew_placement(dest, PoolColorArray(self->operator PoolColorArray())); // operator = is overloaded by PoolColorArray
*dest = *self;
return raw_dest;
}
godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_vector3_array pba;
godot_pool_vector3_array_new(&pba);
PoolVector3Array *p = (PoolVector3Array *)&pba;
*p = *v;
return pba;
}
godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v) {
const Variant *v = (const Variant *)p_v;
godot_pool_color_array pba;
godot_pool_color_array_new(&pba);
PoolColorArray *p = (PoolColorArray *)&pba;
*p = *v;
return pba;
}
godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *p_error) {
Variant *v = (Variant *)p_v;
godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error) {
Variant *self = (Variant *)p_self;
String *method = (String *)p_method;
const Variant **args = (const Variant **)p_args;
godot_variant res;
godot_variant_new_nil(&res);
Variant *ret_val = (Variant *)&res;
Variant::CallError r_error;
*ret_val = v->call(StringName(*method), args, p_argcount, r_error);
if (p_error) {
p_error->error = (godot_variant_call_error_error)r_error.error;
p_error->argument = r_error.argument;
p_error->expected = (godot_variant_type)r_error.expected;
godot_variant raw_dest;
Variant *dest = (Variant *)&raw_dest;
Variant::CallError error;
memnew_placement_custom(dest, Variant, Variant(self->call(*method, args, p_argcount, error)));
*dest = self->call(StringName(*method), args, p_argcount, r_error);
if (r_error) {
r_error->error = (godot_variant_call_error_error)error.error;
r_error->argument = error.argument;
r_error->expected = (godot_variant_type)error.expected;
}
return res;
return raw_dest;
}
godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method) {
Variant *v = (Variant *)p_v;
String *method = (String *)p_method;
return v->has_method(*method);
godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method) {
const Variant *self = (const Variant *)p_self;
const String *method = (const String *)p_method;
return self->has_method(*method);
}
godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b) {
const Variant *a = (const Variant *)p_a;
const Variant *b = (const Variant *)p_b;
return a->operator==(*b);
godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other) {
const Variant *self = (const Variant *)p_self;
const Variant *other = (const Variant *)p_other;
return self->operator==(*other);
}
godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b) {
const Variant *a = (const Variant *)p_a;
const Variant *b = (const Variant *)p_b;
return a->operator<(*b);
godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other) {
const Variant *self = (const Variant *)p_self;
const Variant *other = (const Variant *)p_other;
return self->operator<(*other);
}
godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_a, const godot_variant *p_b) {
const Variant *a = (const Variant *)p_a;
const Variant *b = (const Variant *)p_b;
return a->hash_compare(*b);
godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other) {
const Variant *self = (const Variant *)p_self;
const Variant *other = (const Variant *)p_other;
return self->hash_compare(*other);
}
godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *p_valid) {
const Variant *v = (const Variant *)p_v;
bool &valid = *p_valid;
return v->booleanize(valid);
godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self, godot_bool *r_valid) {
const Variant *self = (const Variant *)p_self;
bool &valid = *r_valid;
return self->booleanize(valid);
}
void GDAPI godot_variant_destroy(godot_variant *p_v) {
((Variant *)p_v)->~Variant();
void GDAPI godot_variant_destroy(godot_variant *p_self) {
Variant *self = (Variant *)p_self;
self->~Variant();
}
#ifdef __cplusplus

View File

@ -42,9 +42,6 @@ typedef struct godot_variant {
} godot_variant;
#endif
struct godot_transform2d;
typedef struct godot_transform2d godot_transform2d;
typedef enum godot_variant_type {
GODOT_VARIANT_TYPE_NIL,
@ -68,20 +65,19 @@ typedef enum godot_variant_type {
// misc types
GODOT_VARIANT_TYPE_COLOR,
GODOT_VARIANT_TYPE_IMAGE, // 15
GODOT_VARIANT_TYPE_NODE_PATH,
GODOT_VARIANT_TYPE_NODE_PATH, // 15
GODOT_VARIANT_TYPE_RID,
GODOT_VARIANT_TYPE_OBJECT,
GODOT_VARIANT_TYPE_INPUT_EVENT,
GODOT_VARIANT_TYPE_DICTIONARY, // 20
GODOT_VARIANT_TYPE_ARRAY,
GODOT_VARIANT_TYPE_INPUT_EVENT, // TODO: remove me once input_event is removed from main Godot codebase
GODOT_VARIANT_TYPE_DICTIONARY,
GODOT_VARIANT_TYPE_ARRAY, // 20
// arrays
GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY,
GODOT_VARIANT_TYPE_POOL_INT_ARRAY,
GODOT_VARIANT_TYPE_POOL_REAL_ARRAY,
GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, // 25
GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY,
GODOT_VARIANT_TYPE_POOL_STRING_ARRAY,
GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25
GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
} godot_variant_type;
@ -102,90 +98,99 @@ typedef struct godot_variant_call_error {
} godot_variant_call_error;
#include "godot_array.h"
#include "godot_basis.h"
#include "godot_color.h"
#include "godot_dictionary.h"
#include "godot_input_event.h"
#include "godot_node_path.h"
#include "godot_plane.h"
#include "godot_pool_arrays.h"
#include "godot_quat.h"
#include "godot_rect2.h"
#include "godot_rect3.h"
#include "godot_rid.h"
#include "godot_string.h"
#include "godot_transform.h"
#include "godot_transform2d.h"
#include "godot_variant.h"
#include "godot_vector2.h"
#include "godot_vector3.h"
#include "../godot.h"
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src);
void GDAPI godot_variant_copy(godot_variant *r_dest, const godot_variant *p_src);
void GDAPI godot_variant_new_nil(godot_variant *p_v);
void GDAPI godot_variant_new_nil(godot_variant *r_dest);
void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b);
void GDAPI godot_variant_new_uint(godot_variant *p_v, const uint64_t p_i);
void GDAPI godot_variant_new_int(godot_variant *p_v, const int64_t p_i);
void GDAPI godot_variant_new_real(godot_variant *p_v, const double p_r);
void GDAPI godot_variant_new_string(godot_variant *p_v, const godot_string *p_s);
void GDAPI godot_variant_new_vector2(godot_variant *p_v, const godot_vector2 *p_v2);
void GDAPI godot_variant_new_rect2(godot_variant *p_v, const godot_rect2 *p_rect2);
void GDAPI godot_variant_new_vector3(godot_variant *p_v, const godot_vector3 *p_v3);
void GDAPI godot_variant_new_transform2d(godot_variant *p_v, const godot_transform2d *p_t2d);
void GDAPI godot_variant_new_plane(godot_variant *p_v, const godot_plane *p_plane);
void GDAPI godot_variant_new_quat(godot_variant *p_v, const godot_quat *p_quat);
void GDAPI godot_variant_new_rect3(godot_variant *p_v, const godot_rect3 *p_rect3);
void GDAPI godot_variant_new_basis(godot_variant *p_v, const godot_basis *p_basis);
void GDAPI godot_variant_new_transform(godot_variant *p_v, const godot_transform *p_trans);
void GDAPI godot_variant_new_color(godot_variant *p_v, const godot_color *p_color);
void GDAPI godot_variant_new_image(godot_variant *p_v, const godot_image *p_img);
void GDAPI godot_variant_new_node_path(godot_variant *p_v, const godot_node_path *p_np);
void GDAPI godot_variant_new_rid(godot_variant *p_v, const godot_rid *p_rid);
void GDAPI godot_variant_new_object(godot_variant *p_v, const godot_object *p_obj);
void GDAPI godot_variant_new_input_event(godot_variant *p_v, const godot_input_event *p_event);
void GDAPI godot_variant_new_dictionary(godot_variant *p_v, const godot_dictionary *p_dict);
void GDAPI godot_variant_new_array(godot_variant *p_v, const godot_array *p_arr);
void GDAPI godot_variant_new_pool_byte_array(godot_variant *p_v, const godot_pool_byte_array *p_pba);
void GDAPI godot_variant_new_pool_int_array(godot_variant *p_v, const godot_pool_int_array *p_pia);
void GDAPI godot_variant_new_pool_real_array(godot_variant *p_v, const godot_pool_real_array *p_pra);
void GDAPI godot_variant_new_pool_string_array(godot_variant *p_v, const godot_pool_string_array *p_psa);
void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_pool_vector2_array *p_pv2a);
void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a);
void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca);
void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i);
void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i);
void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r);
void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s);
void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2);
void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2);
void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3);
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d);
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane);
void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3);
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans);
void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color);
void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np);
void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid);
void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj);
void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict);
void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr);
void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba);
void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia);
void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra);
void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa);
void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a);
void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a);
void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca);
godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v);
uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_v);
int64_t GDAPI godot_variant_as_int(const godot_variant *p_v);
double GDAPI godot_variant_as_real(const godot_variant *p_v);
godot_string GDAPI godot_variant_as_string(const godot_variant *p_v);
godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_v);
godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_v);
godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_v);
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_v);
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_v);
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_v);
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_v);
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_v);
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_v);
godot_color GDAPI godot_variant_as_color(const godot_variant *p_v);
godot_image GDAPI godot_variant_as_image(const godot_variant *p_v);
godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_v);
godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_v);
godot_object GDAPI *godot_variant_as_object(const godot_variant *p_v);
godot_input_event GDAPI godot_variant_as_input_event(const godot_variant *p_v);
godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_v);
godot_array GDAPI godot_variant_as_array(const godot_variant *p_v);
godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_v);
godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_v);
godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_v);
godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_v);
godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_v);
godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v);
godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v);
godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self);
uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self);
int64_t GDAPI godot_variant_as_int(const godot_variant *p_self);
double GDAPI godot_variant_as_real(const godot_variant *p_self);
godot_string GDAPI godot_variant_as_string(const godot_variant *p_self);
godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self);
godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self);
godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self);
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self);
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self);
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self);
godot_color GDAPI godot_variant_as_color(const godot_variant *p_self);
godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self);
godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self);
godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self);
godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self);
godot_array GDAPI godot_variant_as_array(const godot_variant *p_self);
godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self);
godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self);
godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self);
godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self);
godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self);
godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self);
godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self);
godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *p_error);
godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error);
godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method);
godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method);
godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b);
godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b);
godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other);
godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other);
godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_a, const godot_variant *p_b);
godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other);
godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *p_valid);
godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self, godot_bool *r_valid);
void GDAPI godot_variant_destroy(godot_variant *p_v);
void GDAPI godot_variant_destroy(godot_variant *p_self);
#ifdef __cplusplus
}

View File

@ -28,8 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_vector2.h"
#include "core/variant.h"
#include "math/math_2d.h"
#include "core/math/math_2d.h"
#ifdef __cplusplus
extern "C" {
@ -37,258 +38,258 @@ extern "C" {
void _vector2_api_anchor() {}
godot_vector2 GDAPI godot_vector2_new(const godot_real p_x, const godot_real p_y) {
godot_vector2 value;
Vector2 *v = (Vector2 *)&value;
v->x = p_x;
v->y = p_y;
return value;
void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) {
Vector2 *dest = (Vector2 *)r_dest;
*dest = Vector2(p_x, p_y);
}
void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x) {
Vector2 *v = (Vector2 *)p_v;
v->x = p_x;
godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self) {
godot_string ret;
const Vector2 *self = (const Vector2 *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y) {
Vector2 *v = (Vector2 *)p_v;
v->y = p_y;
}
godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v) {
const Vector2 *v = (Vector2 *)p_v;
return v->x;
}
godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v) {
const Vector2 *v = (Vector2 *)p_v;
return v->y;
}
void GDAPI godot_vector2_normalize(godot_vector2 *p_v) {
Vector2 *v = (Vector2 *)p_v;
v->normalize();
}
godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_v) {
godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self) {
godot_vector2 dest;
const Vector2 *v = (Vector2 *)p_v;
Vector2 *d = (Vector2 *)&dest;
*d = v->normalized();
const Vector2 *self = (const Vector2 *)p_self;
*((Vector2 *)&dest) = self->normalized();
return dest;
}
godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v) {
const Vector2 *v = (Vector2 *)p_v;
return v->length();
godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->length();
}
godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v) {
const Vector2 *v = (Vector2 *)p_v;
return v->length_squared();
godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->angle();
}
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_v, const godot_vector2 p_b) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
return v->distance_to(*b);
godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->length_squared();
}
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_v, const godot_vector2 p_b) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
return v->distance_squared_to(*b);
godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->is_normalized();
}
godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_v, const godot_vector2 p_b) {
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *to = (const Vector2 *)p_to;
return self->distance_to(*to);
}
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *to = (const Vector2 *)p_to;
return self->distance_squared_to(*to);
}
godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *to = (const Vector2 *)p_to;
return self->angle_to(*to);
}
godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *to = (const Vector2 *)p_to;
return self->angle_to_point(*to);
}
godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
*d = *v + *b;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
*((Vector2 *)&dest) = self->linear_interpolate(*b, p_t);
return dest;
}
godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_v, const godot_vector2 p_b) {
godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
*d = *v - *b;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
const Vector2 *pre_a = (const Vector2 *)p_pre_a;
const Vector2 *post_b = (const Vector2 *)p_post_b;
*((Vector2 *)&dest) = self->cubic_interpolate(*b, *pre_a, *post_b, p_t);
return dest;
}
godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_v, const godot_vector2 p_b) {
godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
*d = *v * *b;
const Vector2 *self = (const Vector2 *)p_self;
*((Vector2 *)&dest) = self->rotated(p_phi);
return dest;
}
godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_v, const godot_real p_b) {
godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = *v * p_b;
const Vector2 *self = (const Vector2 *)p_self;
*((Vector2 *)&dest) = self->tangent();
return dest;
}
godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_v, const godot_vector2 p_b) {
godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
*d = *v / *b;
const Vector2 *self = (const Vector2 *)p_self;
*((Vector2 *)&dest) = self->floor();
return dest;
}
godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_v, const godot_real p_b) {
godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = *v / p_b;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *by = (const Vector2 *)p_by;
*((Vector2 *)&dest) = self->snapped(*by);
return dest;
}
godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_v, const godot_vector2 p_b) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
return *v == *b;
godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->aspect();
}
godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_v, const godot_vector2 p_b) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
return *v < *b;
godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *with = (const Vector2 *)p_with;
return self->dot(*with);
}
godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_v) {
godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = v->abs();
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *n = (const Vector2 *)p_n;
*((Vector2 *)&dest) = self->slide(*n);
return dest;
}
godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_v) {
const Vector2 *v = (Vector2 *)p_v;
return v->angle();
}
godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_v, const godot_vector2 p_to) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *to = (Vector2 *)&p_to;
return v->angle_to(*to);
}
godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_v, const godot_vector2 p_to) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *to = (Vector2 *)&p_to;
return v->angle_to_point(*to);
}
godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_v, const godot_real length) {
godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = v->clamped(length);
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *n = (const Vector2 *)p_n;
*((Vector2 *)&dest) = self->bounce(*n);
return dest;
}
godot_vector2 GDAPI godot_vector2_cubic_interpolate(
const godot_vector2 *p_v, const godot_vector2 p_b, const godot_vector2 p_pre_a,
const godot_vector2 p_post_b, godot_real t) {
godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
const Vector2 *pre_a = (Vector2 *)&p_pre_a;
const Vector2 *post_b = (Vector2 *)&p_post_b;
*d = v->cubic_interpolate(*b, *pre_a, *post_b, t);
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *n = (const Vector2 *)p_n;
*((Vector2 *)&dest) = self->reflect(*n);
return dest;
}
godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_v, const godot_vector2 p_with) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *with = (Vector2 *)&p_with;
return v->dot(*with);
}
godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_v) {
godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = v->floor();
const Vector2 *self = (const Vector2 *)p_self;
*((Vector2 *)&dest) = self->abs();
return dest;
}
godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_v) {
const Vector2 *v = (Vector2 *)p_v;
return v->aspect();
}
godot_vector2 GDAPI godot_vector2_linear_interpolate(
const godot_vector2 *p_v,
const godot_vector2 p_b,
godot_real t) {
godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *b = (Vector2 *)&p_b;
*d = v->linear_interpolate(*b, t);
const Vector2 *self = (const Vector2 *)p_self;
*((Vector2 *)&dest) = self->clamped(p_length);
return dest;
}
godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_v, const godot_vector2 p_vec) {
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *vec = (Vector2 *)&p_vec;
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
*d = v->reflect(*vec);
return dest;
godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
*dest = *self + *b;
return raw_dest;
}
godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_v, godot_real phi) {
const Vector2 *v = (Vector2 *)p_v;
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
*d = v->rotated(phi);
return dest;
godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
*dest = *self - *b;
return raw_dest;
}
godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_v, godot_vector2 p_vec) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *vec = (Vector2 *)&p_vec;
*d = v->slide(*vec);
return dest;
godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
*dest = *self * *b;
return raw_dest;
}
godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_v, godot_vector2 p_by) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
const Vector2 *by = (Vector2 *)&p_by;
*d = v->snapped(*by);
return dest;
godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
*dest = *self * p_b;
return raw_dest;
}
godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_v) {
godot_vector2 dest;
Vector2 *d = (Vector2 *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = v->tangent();
return dest;
godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
*dest = *self / *b;
return raw_dest;
}
godot_string GDAPI godot_vector2_to_string(const godot_vector2 *p_v) {
godot_string dest;
String *d = (String *)&dest;
const Vector2 *v = (Vector2 *)p_v;
*d = "(" + *v + ")";
return dest;
godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
*dest = *self / p_b;
return raw_dest;
}
godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
return *self == *b;
}
godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b) {
const Vector2 *self = (const Vector2 *)p_self;
const Vector2 *b = (const Vector2 *)p_b;
return *self < *b;
}
godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
*dest = -(*self);
return raw_dest;
}
void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x) {
Vector2 *self = (Vector2 *)p_self;
self->x = p_x;
}
void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y) {
Vector2 *self = (Vector2 *)p_self;
self->y = p_y;
}
godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->x;
}
godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self) {
const Vector2 *self = (const Vector2 *)p_self;
return self->y;
}
#ifdef __cplusplus

View File

@ -45,51 +45,79 @@ typedef struct godot_vector2 {
#include "../godot.h"
godot_vector2 GDAPI godot_vector2_new(const godot_real p_x, const godot_real p_y);
void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y);
void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x);
void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y);
godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v);
godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self);
void GDAPI godot_vector2_normalize(godot_vector2 *p_v);
godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_v);
godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self);
godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self);
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self);
godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_v, const godot_vector2 p_to);
godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_v, const godot_vector2 p_to);
godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_v, godot_real length);
godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_v,
const godot_vector2 p_b, const godot_vector2 p_pre_a,
const godot_vector2 p_post_b, godot_real t);
godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_v, const godot_vector2 p_with);
godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_v);
godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_v,
const godot_vector2 p_b, godot_real t);
godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_v, const godot_vector2 p_vec);
godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_v, godot_real phi);
godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_v, godot_vector2 p_vec);
godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_v, godot_vector2 p_by);
godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_v);
godot_string GDAPI godot_vector2_to_string(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self);
godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_v, const godot_real p_b);
godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_v, const godot_real p_b);
godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self);
godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_v, const godot_vector2 p_b);
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to);
godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to);
godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t);
godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t);
godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi);
godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self);
godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self);
godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by);
godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self);
godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with);
godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n);
godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n);
godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n);
godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self);
godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length);
godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b);
godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b);
godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self);
void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x);
void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y);
godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self);
godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self);
#ifdef __cplusplus
}

View File

@ -28,313 +28,274 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "godot_vector3.h"
#include "core/variant.h"
#include "math/vector3.h"
#include "core/vector.h"
#ifdef __cplusplus
extern "C" {
#endif
void _vector3_api_anchor() {
void _vector3_api_anchor() {}
void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) {
Vector3 *dest = (Vector3 *)r_dest;
*dest = Vector3(p_x, p_y, p_z);
}
godot_vector3 GDAPI godot_vector3_new(const godot_real p_x, const godot_real p_y, const godot_real p_z) {
godot_vector3 value;
Vector3 *v = (Vector3 *)&value;
*v = Vector3(p_x, p_y, p_z);
return value;
godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self) {
godot_string ret;
const Vector3 *self = (const Vector3 *)p_self;
memnew_placement(&ret, String(*self));
return ret;
}
void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val) {
Vector3 *v = (Vector3 *)p_v;
v->set_axis(p_axis, p_val);
godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self) {
const Vector3 *self = (const Vector3 *)p_self;
return self->min_axis();
}
godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis) {
Vector3 *v = (Vector3 *)p_v;
return v->get_axis(p_axis);
godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self) {
const Vector3 *self = (const Vector3 *)p_self;
return self->max_axis();
}
godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v) {
Vector3 *v = (Vector3 *)p_v;
return v->min_axis();
godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self) {
const Vector3 *self = (const Vector3 *)p_self;
return self->length();
}
godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v) {
Vector3 *v = (Vector3 *)p_v;
return v->max_axis();
godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self) {
const Vector3 *self = (const Vector3 *)p_self;
return self->length_squared();
}
godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v) {
Vector3 *v = (Vector3 *)p_v;
return v->length();
godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self) {
const Vector3 *self = (const Vector3 *)p_self;
return self->is_normalized();
}
godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v) {
Vector3 *v = (Vector3 *)p_v;
return v->length_squared();
}
void GDAPI godot_vector3_normalize(godot_vector3 *p_v) {
Vector3 *v = (Vector3 *)p_v;
v->normalize();
}
godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_v) {
godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
*d = v->normalized();
const Vector3 *self = (const Vector3 *)p_self;
*((Vector3 *)&dest) = self->normalized();
return dest;
}
godot_vector3 godot_vector3_inverse(const godot_vector3 *p_v) {
godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = v->inverse();
const Vector3 *self = (const Vector3 *)p_self;
*((Vector3 *)&dest) = self->inverse();
return dest;
}
void godot_vector3_zero(godot_vector3 *p_v) {
Vector3 *v = (Vector3 *)p_v;
v->zero();
}
void godot_vector3_snap(godot_vector3 *p_v, const godot_real val) {
Vector3 *v = (Vector3 *)p_v;
v->snap(val);
}
godot_vector3 godot_vector3_snapped(const godot_vector3 *p_v, const godot_real val) {
godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_real p_by) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = v->snapped(val);
const Vector3 *self = (const Vector3 *)p_self;
*((Vector3 *)&dest) = self->snapped(p_by);
return dest;
}
void godot_vector3_rotate(godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi) {
Vector3 *v = (Vector3 *)p_v;
const Vector3 *axis = (Vector3 *)&p_axis;
v->rotate(*axis, phi);
}
godot_vector3 godot_vector3_rotated(const godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi) {
godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *axis = (Vector3 *)&p_axis;
*d = v->rotated(*axis, phi);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *axis = (const Vector3 *)p_axis;
*((Vector3 *)&dest) = self->rotated(*axis, p_phi);
return dest;
}
godot_vector3 godot_vector3_linear_interpolate(const godot_vector3 *p_v, const godot_vector3 p_b, const godot_real t) {
godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *b = (Vector3 *)&p_b;
*d = v->linear_interpolate(*b, t);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*((Vector3 *)&dest) = self->linear_interpolate(*b, p_t);
return dest;
}
godot_vector3 godot_vector3_cubic_interpolate(const godot_vector3 *p_v,
const godot_vector3 p_b, const godot_vector3 p_pre_a,
const godot_vector3 p_post_b, const godot_real t) {
godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *b = (Vector3 *)&p_b;
const Vector3 *pre_a = (Vector3 *)&p_pre_a;
const Vector3 *post_b = (Vector3 *)&p_post_b;
*d = v->cubic_interpolate(*b, *pre_a, *post_b, t);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
const Vector3 *pre_a = (const Vector3 *)p_pre_a;
const Vector3 *post_b = (const Vector3 *)p_post_b;
*((Vector3 *)&dest) = self->cubic_interpolate(*b, *pre_a, *post_b, p_t);
return dest;
}
godot_vector3 godot_vector3_cubic_interpolaten(const godot_vector3 *p_v,
const godot_vector3 p_b, const godot_vector3 p_pre_a,
const godot_vector3 p_post_b, const godot_real t) {
godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b) {
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
return self->dot(*b);
}
godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *b = (Vector3 *)&p_b;
const Vector3 *pre_a = (Vector3 *)&p_pre_a;
const Vector3 *post_b = (Vector3 *)&p_post_b;
*d = v->cubic_interpolaten(*b, *pre_a, *post_b, t);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*((Vector3 *)&dest) = self->cross(*b);
return dest;
}
godot_vector3 godot_vector3_cross(const godot_vector3 *p_v, const godot_vector3 p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *b = (Vector3 *)&p_b;
*d = v->cross(*b);
return dest;
}
godot_real godot_vector3_dot(const godot_vector3 *p_v, const godot_vector3 p_b) {
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *b = (Vector3 *)&p_b;
return v->dot(*b);
}
godot_basis godot_vector3_outer(const godot_vector3 *p_v, const godot_vector3 p_b) {
godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_basis dest;
Basis *d = (Basis *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *b = (Vector3 *)&p_b;
*d = v->outer(*b);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*((Basis *)&dest) = self->outer(*b);
return dest;
}
godot_basis godot_vector3_to_diagonal_matrix(const godot_vector3 *p_v) {
godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self) {
godot_basis dest;
Basis *d = (Basis *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = v->to_diagonal_matrix();
const Vector3 *self = (const Vector3 *)p_self;
*((Basis *)&dest) = self->to_diagonal_matrix();
return dest;
}
godot_vector3 godot_vector3_abs(const godot_vector3 *p_v) {
godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = v->abs();
const Vector3 *self = (const Vector3 *)p_self;
*((Vector3 *)&dest) = self->abs();
return dest;
}
godot_vector3 godot_vector3_floor(const godot_vector3 *p_v) {
godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = v->floor();
const Vector3 *self = (const Vector3 *)p_self;
*((Vector3 *)&dest) = self->floor();
return dest;
}
godot_vector3 godot_vector3_ceil(const godot_vector3 *p_v) {
godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = v->ceil();
const Vector3 *self = (const Vector3 *)p_self;
*((Vector3 *)&dest) = self->ceil();
return dest;
}
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_v, const godot_vector3 p_b) {
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
return v->distance_to(*b);
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b) {
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
return self->distance_to(*b);
}
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_v, const godot_vector3 p_b) {
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
return v->distance_squared_to(*b);
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b) {
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
return self->distance_squared_to(*b);
}
godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_v, const godot_vector3 p_b) {
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
return v->angle_to(*b);
godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to) {
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *to = (const Vector3 *)p_to;
return self->angle_to(*to);
}
godot_vector3 godot_vector3_slide(const godot_vector3 *p_v, const godot_vector3 p_vec) {
godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *vec = (Vector3 *)&p_vec;
*d = v->slide(*vec);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *n = (const Vector3 *)p_n;
*((Vector3 *)&dest) = self->slide(*n);
return dest;
}
godot_vector3 godot_vector3_bounce(const godot_vector3 *p_v, const godot_vector3 p_vec) {
godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *vec = (Vector3 *)&p_vec;
*d = v->bounce(*vec);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *n = (const Vector3 *)p_n;
*((Vector3 *)&dest) = self->bounce(*n);
return dest;
}
godot_vector3 godot_vector3_reflect(const godot_vector3 *p_v, const godot_vector3 p_vec) {
godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
const Vector3 *v = (Vector3 *)p_v;
const Vector3 *vec = (Vector3 *)&p_vec;
*d = v->reflect(*vec);
const Vector3 *self = (const Vector3 *)p_self;
const Vector3 *n = (const Vector3 *)p_n;
*((Vector3 *)&dest) = self->reflect(*n);
return dest;
}
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_v, const godot_vector3 p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
*d = *v + *b;
return dest;
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*dest = *self + *b;
return raw_dest;
}
godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_v, const godot_vector3 p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
*d = *v - *b;
return dest;
godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*dest = *self - *b;
return raw_dest;
}
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_v, const godot_vector3 p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
*d = *v * *b;
return dest;
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*dest = *self * *b;
return raw_dest;
}
godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_v, const godot_real p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
*d = *v * p_b;
return dest;
godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
*dest = *self * p_b;
return raw_dest;
}
godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_v, const godot_vector3 p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
*d = *v / *b;
return dest;
godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
*dest = *self / *b;
return raw_dest;
}
godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_v, const godot_real p_b) {
godot_vector3 dest;
Vector3 *d = (Vector3 *)&dest;
Vector3 *v = (Vector3 *)p_v;
*d = *v / p_b;
return dest;
godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
*dest = *self / p_b;
return raw_dest;
}
godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_v, const godot_vector3 p_b) {
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
return *v == *b;
godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b) {
Vector3 *self = (Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
return *self == *b;
}
godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_v, const godot_vector3 p_b) {
Vector3 *v = (Vector3 *)p_v;
Vector3 *b = (Vector3 *)&p_b;
return *v < *b;
godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b) {
Vector3 *self = (Vector3 *)p_self;
const Vector3 *b = (const Vector3 *)p_b;
return *self < *b;
}
godot_string GDAPI godot_vector3_to_string(const godot_vector3 *p_v) {
godot_string dest;
String *d = (String *)&dest;
const Vector3 *v = (Vector3 *)p_v;
*d = "(" + *v + ")";
return dest;
godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
const Vector3 *self = (const Vector3 *)p_self;
*dest = -(*self);
return raw_dest;
}
void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val) {
Vector3 *self = (Vector3 *)p_self;
self->set_axis(p_axis, p_val);
}
godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis) {
const Vector3 *self = (const Vector3 *)p_self;
return self->get_axis(p_axis);
}
#ifdef __cplusplus

View File

@ -37,74 +37,94 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
typedef struct godot_vector3 {
uint8_t _dont_touch_that[12];
} godot_vector3;
#endif
#define GODOT_VECTOR3_AXIX_X 0
#define GODOT_VECTOR3_AXIX_Y 1
#define GODOT_VECTOR3_AXIX_Z 2
#include "../godot.h"
#include "godot_basis.h"
godot_vector3 GDAPI godot_vector3_new(const godot_real p_x, const godot_real p_y, const godot_real p_z);
typedef enum {
GODOT_VECTOR3_AXIS_X,
GODOT_VECTOR3_AXIS_Y,
GODOT_VECTOR3_AXIS_Z,
} godot_vector3_axis;
void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val);
godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis);
void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z);
godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v);
godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v);
godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self);
godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v);
godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v);
godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self);
void GDAPI godot_vector3_normalize(godot_vector3 *p_v);
godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_v);
godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self);
godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_v);
void GDAPI godot_vector3_zero(godot_vector3 *p_v);
void GDAPI godot_vector3_snap(godot_vector3 *p_v, const godot_real val);
godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_v, const godot_real val);
void GDAPI godot_vector3_rotate(godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi);
godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_v,
const godot_vector3 p_axis, const godot_real phi);
godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_v,
const godot_vector3 p_b, const godot_real t);
godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_v,
const godot_vector3 p_b, const godot_vector3 p_pre_a,
const godot_vector3 p_post_b, const godot_real t);
godot_vector3 GDAPI godot_vector3_cubic_interpolaten(const godot_vector3 *p_v,
const godot_vector3 p_b, const godot_vector3 p_pre_a,
const godot_vector3 p_post_b, const godot_real t);
godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_v);
godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_v);
godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_v);
godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_v);
godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self);
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self);
godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_v, const godot_vector3 p_vec);
godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_v, const godot_vector3 p_vec);
godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_v, const godot_vector3 p_vec);
godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self);
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_v, const godot_real p_b);
godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_v, const godot_real p_b);
godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self);
godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_v, const godot_vector3 p_b);
godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self);
godot_string GDAPI godot_vector3_to_string(const godot_vector3 *p_v);
godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_real p_by);
godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi);
godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t);
godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t);
godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self);
godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self);
godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self);
godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self);
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to);
godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n);
godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n);
godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n);
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b);
godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b);
godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self);
void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val);
godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis);
#ifdef __cplusplus
}