mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-05 12:23:22 +00:00
GDNative add new core types.
This commit is contained in:
@@ -102,9 +102,9 @@ void GDAPI godot_array_new_packed_string_array(godot_array *r_dest, const godot_
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_array_new_packed_real_array(godot_array *r_dest, const godot_packed_real_array *p_pra) {
|
||||
void GDAPI godot_array_new_packed_float32_array(godot_array *r_dest, const godot_packed_float32_array *p_pra) {
|
||||
Array *dest = (Array *)r_dest;
|
||||
Vector<godot_real> *pca = (Vector<godot_real> *)p_pra;
|
||||
Vector<float> *pca = (Vector<float> *)p_pra;
|
||||
memnew_placement(dest, Array);
|
||||
dest->resize(pca->size());
|
||||
|
||||
@@ -114,9 +114,33 @@ void GDAPI godot_array_new_packed_real_array(godot_array *r_dest, const godot_pa
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_array_new_packed_int_array(godot_array *r_dest, const godot_packed_int_array *p_pia) {
|
||||
void GDAPI godot_array_new_packed_float64_array(godot_array *r_dest, const godot_packed_float64_array *p_pra) {
|
||||
Array *dest = (Array *)r_dest;
|
||||
Vector<godot_int> *pca = (Vector<godot_int> *)p_pia;
|
||||
Vector<double> *pca = (Vector<double> *)p_pra;
|
||||
memnew_placement(dest, Array);
|
||||
dest->resize(pca->size());
|
||||
|
||||
for (int i = 0; i < dest->size(); i++) {
|
||||
Variant v = pca->operator[](i);
|
||||
dest->operator[](i) = v;
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_array_new_packed_int32_array(godot_array *r_dest, const godot_packed_int32_array *p_pia) {
|
||||
Array *dest = (Array *)r_dest;
|
||||
Vector<int32_t> *pca = (Vector<int32_t> *)p_pia;
|
||||
memnew_placement(dest, Array);
|
||||
dest->resize(pca->size());
|
||||
|
||||
for (int i = 0; i < dest->size(); i++) {
|
||||
Variant v = pca->operator[](i);
|
||||
dest->operator[](i) = v;
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_array_new_packed_int64_array(godot_array *r_dest, const godot_packed_int64_array *p_pia) {
|
||||
Array *dest = (Array *)r_dest;
|
||||
Vector<int64_t> *pca = (Vector<int64_t> *)p_pia;
|
||||
memnew_placement(dest, Array);
|
||||
dest->resize(pca->size());
|
||||
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
/*************************************************************************/
|
||||
/* callable.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 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 "gdnative/callable.h"
|
||||
|
||||
#include "core/callable.h"
|
||||
#include "core/resource.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(godot_callable) == sizeof(Callable), "Callable size mismatch");
|
||||
static_assert(sizeof(godot_signal) == sizeof(Signal), "Signal size mismatch");
|
||||
|
||||
// Callable
|
||||
|
||||
void GDAPI godot_callable_new_with_object(godot_callable *r_dest, const godot_object *p_object, const godot_string_name *p_method) {
|
||||
Callable *dest = (Callable *)r_dest;
|
||||
const Object *object = (const Object *)p_object;
|
||||
const StringName *method = (const StringName *)p_method;
|
||||
memnew_placement(dest, Callable(object, *method));
|
||||
}
|
||||
|
||||
void GDAPI godot_callable_new_with_object_id(godot_callable *r_dest, uint64_t p_objectid, const godot_string_name *p_method) {
|
||||
Callable *dest = (Callable *)r_dest;
|
||||
const StringName *method = (const StringName *)p_method;
|
||||
memnew_placement(dest, Callable(ObjectID(p_objectid), *method));
|
||||
}
|
||||
|
||||
void GDAPI godot_callable_new_copy(godot_callable *r_dest, const godot_callable *p_src) {
|
||||
Callable *dest = (Callable *)r_dest;
|
||||
const Callable *src = (const Callable *)p_src;
|
||||
memnew_placement(dest, Callable(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_callable_destroy(godot_callable *p_self) {
|
||||
Callable *self = (Callable *)p_self;
|
||||
self->~Callable();
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_callable_call(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount, godot_variant *r_return_value) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
const Variant **arguments = (const Variant **)p_arguments;
|
||||
Variant *return_value = (Variant *)r_return_value;
|
||||
Variant ret;
|
||||
Callable::CallError err;
|
||||
self->call(arguments, p_argcount, ret, err);
|
||||
if (return_value)
|
||||
(*return_value) = ret;
|
||||
return (godot_int)err.error;
|
||||
}
|
||||
|
||||
void GDAPI godot_callable_call_deferred(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
const Variant **arguments = (const Variant **)p_arguments;
|
||||
self->call_deferred(arguments, p_argcount);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_callable_is_null(const godot_callable *p_self) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
return self->is_null();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_callable_is_custom(const godot_callable *p_self) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
return self->is_custom();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_callable_is_standard(const godot_callable *p_self) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
return self->is_standard();
|
||||
}
|
||||
|
||||
godot_object GDAPI *godot_callable_get_object(const godot_callable *p_self) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
return (godot_object *)self->get_object();
|
||||
}
|
||||
|
||||
uint64_t GDAPI godot_callable_get_object_id(const godot_callable *p_self) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
return (uint64_t)self->get_object_id();
|
||||
}
|
||||
|
||||
godot_string_name GDAPI godot_callable_get_method(const godot_callable *p_self) {
|
||||
godot_string_name raw_dest;
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
StringName *dest = (StringName *)&raw_dest;
|
||||
memnew_placement(dest, StringName(self->get_method()));
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_callable_hash(const godot_callable *p_self) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
return self->hash();
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_callable_as_string(const godot_callable *p_self) {
|
||||
godot_string ret;
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_callable_operator_equal(const godot_callable *p_self, const godot_callable *p_other) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
const Callable *other = (const Callable *)p_other;
|
||||
return *self == *other;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_callable_operator_less(const godot_callable *p_self, const godot_callable *p_other) {
|
||||
const Callable *self = (const Callable *)p_self;
|
||||
const Callable *other = (const Callable *)p_other;
|
||||
return *self < *other;
|
||||
}
|
||||
|
||||
// Signal
|
||||
|
||||
void GDAPI godot_signal_new_with_object(godot_signal *r_dest, const godot_object *p_object, const godot_string_name *p_name) {
|
||||
Signal *dest = (Signal *)r_dest;
|
||||
const Object *object = (const Object *)p_object;
|
||||
const StringName *name = (const StringName *)p_name;
|
||||
memnew_placement(dest, Signal(object, *name));
|
||||
}
|
||||
|
||||
void GDAPI godot_signal_new_with_object_id(godot_signal *r_dest, uint64_t p_objectid, const godot_string_name *p_name) {
|
||||
Signal *dest = (Signal *)r_dest;
|
||||
const StringName *name = (const StringName *)p_name;
|
||||
memnew_placement(dest, Signal(ObjectID(p_objectid), *name));
|
||||
}
|
||||
|
||||
void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src) {
|
||||
Signal *dest = (Signal *)r_dest;
|
||||
const Signal *src = (const Signal *)p_src;
|
||||
memnew_placement(dest, Signal(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_signal_destroy(godot_signal *p_self) {
|
||||
Signal *self = (Signal *)p_self;
|
||||
self->~Signal();
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_signal_emit(const godot_signal *p_self, const godot_variant **p_arguments, godot_int p_argcount) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
const Variant **arguments = (const Variant **)p_arguments;
|
||||
return (godot_int)self->emit(arguments, p_argcount);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_signal_connect(godot_signal *p_self, const godot_callable *p_callable, const godot_array *p_binds, uint32_t p_flags) {
|
||||
Signal *self = (Signal *)p_self;
|
||||
const Callable *callable = (const Callable *)p_callable;
|
||||
const Array *binds_ar = (const Array *)p_binds;
|
||||
Vector<Variant> binds;
|
||||
for (int i = 0; i < binds_ar->size(); i++) {
|
||||
binds.push_back(binds_ar->get(i));
|
||||
}
|
||||
return (godot_int)self->connect(*callable, binds, p_flags);
|
||||
}
|
||||
|
||||
void GDAPI godot_signal_disconnect(godot_signal *p_self, const godot_callable *p_callable) {
|
||||
Signal *self = (Signal *)p_self;
|
||||
const Callable *callable = (const Callable *)p_callable;
|
||||
self->disconnect(*callable);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_signal_is_null(const godot_signal *p_self) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
return self->is_null();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_signal_is_connected(const godot_signal *p_self, const godot_callable *p_callable) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
const Callable *callable = (const Callable *)p_callable;
|
||||
return self->is_connected(*callable);
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_signal_get_connections(const godot_signal *p_self) {
|
||||
godot_array raw_dest;
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
Array *dest = (Array *)&raw_dest;
|
||||
memnew_placement(dest, Array(self->get_connections()));
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_object GDAPI *godot_signal_get_object(const godot_signal *p_self) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
return (godot_object *)self->get_object();
|
||||
}
|
||||
|
||||
uint64_t GDAPI godot_signal_get_object_id(const godot_signal *p_self) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
return (uint64_t)self->get_object_id();
|
||||
}
|
||||
|
||||
godot_string_name GDAPI godot_signal_get_name(const godot_signal *p_self) {
|
||||
godot_string_name raw_dest;
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
StringName *dest = (StringName *)&raw_dest;
|
||||
memnew_placement(dest, StringName(self->get_name()));
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_signal_as_string(const godot_signal *p_self) {
|
||||
godot_string ret;
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_signal_operator_equal(const godot_signal *p_self, const godot_signal *p_other) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
const Signal *other = (const Signal *)p_other;
|
||||
return *self == *other;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_signal_operator_less(const godot_signal *p_self, const godot_signal *p_other) {
|
||||
const Signal *self = (const Signal *)p_self;
|
||||
const Signal *other = (const Signal *)p_other;
|
||||
return *self < *other;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -165,7 +165,7 @@ void _gdnative_report_loading_error(const godot_object *p_library, const char *p
|
||||
_err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr());
|
||||
}
|
||||
|
||||
godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) {
|
||||
godot_object GDAPI *godot_instance_from_id(uint64_t p_instance_id) {
|
||||
return (godot_object *)ObjectDB::get_instance(ObjectID(p_instance_id));
|
||||
}
|
||||
|
||||
@@ -184,6 +184,11 @@ godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_t
|
||||
return o->is_class_ptr(p_class_tag) ? (godot_object *)o : nullptr;
|
||||
}
|
||||
|
||||
uint64_t GDAPI godot_object_get_instance_id(const godot_object *p_object) {
|
||||
const Object *o = (const Object *)p_object;
|
||||
return (uint64_t)o->get_instance_id();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+246
-76
@@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* pool_arrays.cpp */
|
||||
/* packed_arrays.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "gdnative/pool_arrays.h"
|
||||
#include "gdnative/packed_arrays.h"
|
||||
|
||||
#include "core/array.h"
|
||||
|
||||
@@ -43,8 +43,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(godot_packed_byte_array) == sizeof(Vector<uint8_t>), "Vector<uint8_t> size mismatch");
|
||||
static_assert(sizeof(godot_packed_int_array) == sizeof(Vector<godot_int>), "Vector<godot_int> size mismatch");
|
||||
static_assert(sizeof(godot_packed_real_array) == sizeof(Vector<godot_real>), "Vector<godot_real> size mismatch");
|
||||
static_assert(sizeof(godot_packed_int32_array) == sizeof(Vector<int32_t>), "Vector<int32_t> size mismatch");
|
||||
static_assert(sizeof(godot_packed_int64_array) == sizeof(Vector<int64_t>), "Vector<int64_t> size mismatch");
|
||||
static_assert(sizeof(godot_packed_float32_array) == sizeof(Vector<float>), "Vector<float> size mismatch");
|
||||
static_assert(sizeof(godot_packed_float64_array) == sizeof(Vector<double>), "Vector<double> size mismatch");
|
||||
static_assert(sizeof(godot_packed_string_array) == sizeof(Vector<String>), "Vector<String> size mismatch");
|
||||
static_assert(sizeof(godot_packed_vector2_array) == sizeof(Vector<Vector2>), "Vector<Vector2> size mismatch");
|
||||
static_assert(sizeof(godot_packed_vector3_array) == sizeof(Vector<Vector3>), "Vector<Vector3> size mismatch");
|
||||
@@ -136,23 +138,23 @@ void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) {
|
||||
((Vector<uint8_t> *)p_self)->~Vector();
|
||||
}
|
||||
|
||||
// int
|
||||
// int32
|
||||
|
||||
void GDAPI godot_packed_int_array_new(godot_packed_int_array *r_dest) {
|
||||
Vector<godot_int> *dest = (Vector<godot_int> *)r_dest;
|
||||
memnew_placement(dest, Vector<godot_int>);
|
||||
void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *r_dest) {
|
||||
Vector<int32_t> *dest = (Vector<int32_t> *)r_dest;
|
||||
memnew_placement(dest, Vector<int32_t>);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_new_copy(godot_packed_int_array *r_dest, const godot_packed_int_array *p_src) {
|
||||
Vector<godot_int> *dest = (Vector<godot_int> *)r_dest;
|
||||
const Vector<godot_int> *src = (const Vector<godot_int> *)p_src;
|
||||
memnew_placement(dest, Vector<godot_int>(*src));
|
||||
void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src) {
|
||||
Vector<int32_t> *dest = (Vector<int32_t> *)r_dest;
|
||||
const Vector<int32_t> *src = (const Vector<int32_t> *)p_src;
|
||||
memnew_placement(dest, Vector<int32_t>(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_new_with_array(godot_packed_int_array *r_dest, const godot_array *p_a) {
|
||||
Vector<godot_int> *dest = (Vector<godot_int> *)r_dest;
|
||||
void GDAPI godot_packed_int32_array_new_with_array(godot_packed_int32_array *r_dest, const godot_array *p_a) {
|
||||
Vector<int32_t> *dest = (Vector<int32_t> *)r_dest;
|
||||
Array *a = (Array *)p_a;
|
||||
memnew_placement(dest, Vector<godot_int>);
|
||||
memnew_placement(dest, Vector<int32_t>);
|
||||
|
||||
dest->resize(a->size());
|
||||
for (int i = 0; i < a->size(); i++) {
|
||||
@@ -160,83 +162,83 @@ void GDAPI godot_packed_int_array_new_with_array(godot_packed_int_array *r_dest,
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_append(godot_packed_int_array *p_self, const godot_int p_data) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
void GDAPI godot_packed_int32_array_append(godot_packed_int32_array *p_self, const int32_t p_data) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_append_array(godot_packed_int_array *p_self, const godot_packed_int_array *p_array) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
Vector<godot_int> *array = (Vector<godot_int> *)p_array;
|
||||
void GDAPI godot_packed_int32_array_append_array(godot_packed_int32_array *p_self, const godot_packed_int32_array *p_array) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
Vector<int32_t> *array = (Vector<int32_t> *)p_array;
|
||||
self->append_array(*array);
|
||||
}
|
||||
|
||||
godot_error GDAPI godot_packed_int_array_insert(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
godot_error GDAPI godot_packed_int32_array_insert(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
return (godot_error)self->insert(p_idx, p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_invert(godot_packed_int_array *p_self) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
void GDAPI godot_packed_int32_array_invert(godot_packed_int32_array *p_self) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
self->invert();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_push_back(godot_packed_int_array *p_self, const godot_int p_data) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
void GDAPI godot_packed_int32_array_push_back(godot_packed_int32_array *p_self, const int32_t p_data) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_remove(godot_packed_int_array *p_self, const godot_int p_idx) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
void GDAPI godot_packed_int32_array_remove(godot_packed_int32_array *p_self, const godot_int p_idx) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
self->remove(p_idx);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_resize(godot_packed_int_array *p_self, const godot_int p_size) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
void GDAPI godot_packed_int32_array_resize(godot_packed_int32_array *p_self, const godot_int p_size) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
self->resize(p_size);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_set(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data) {
|
||||
Vector<godot_int> *self = (Vector<godot_int> *)p_self;
|
||||
void GDAPI godot_packed_int32_array_set(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data) {
|
||||
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
|
||||
self->set(p_idx, p_data);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_packed_int_array_get(const godot_packed_int_array *p_self, const godot_int p_idx) {
|
||||
const Vector<godot_int> *self = (const Vector<godot_int> *)p_self;
|
||||
int32_t GDAPI godot_packed_int32_array_get(const godot_packed_int32_array *p_self, const godot_int p_idx) {
|
||||
const Vector<int32_t> *self = (const Vector<int32_t> *)p_self;
|
||||
return self->get(p_idx);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_packed_int_array_size(const godot_packed_int_array *p_self) {
|
||||
const Vector<godot_int> *self = (const Vector<godot_int> *)p_self;
|
||||
godot_int GDAPI godot_packed_int32_array_size(const godot_packed_int32_array *p_self) {
|
||||
const Vector<int32_t> *self = (const Vector<int32_t> *)p_self;
|
||||
return self->size();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_packed_int_array_empty(const godot_packed_int_array *p_self) {
|
||||
const Vector<godot_int> *self = (const Vector<godot_int> *)p_self;
|
||||
godot_bool GDAPI godot_packed_int32_array_empty(const godot_packed_int32_array *p_self) {
|
||||
const Vector<int32_t> *self = (const Vector<int32_t> *)p_self;
|
||||
return self->empty();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_int_array_destroy(godot_packed_int_array *p_self) {
|
||||
((Vector<godot_int> *)p_self)->~Vector();
|
||||
void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self) {
|
||||
((Vector<int32_t> *)p_self)->~Vector();
|
||||
}
|
||||
|
||||
// real
|
||||
// int64
|
||||
|
||||
void GDAPI godot_packed_real_array_new(godot_packed_real_array *r_dest) {
|
||||
Vector<godot_real> *dest = (Vector<godot_real> *)r_dest;
|
||||
memnew_placement(dest, Vector<godot_real>);
|
||||
void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *r_dest) {
|
||||
Vector<int64_t> *dest = (Vector<int64_t> *)r_dest;
|
||||
memnew_placement(dest, Vector<int64_t>);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_new_copy(godot_packed_real_array *r_dest, const godot_packed_real_array *p_src) {
|
||||
Vector<godot_real> *dest = (Vector<godot_real> *)r_dest;
|
||||
const Vector<godot_real> *src = (const Vector<godot_real> *)p_src;
|
||||
memnew_placement(dest, Vector<godot_real>(*src));
|
||||
void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src) {
|
||||
Vector<int64_t> *dest = (Vector<int64_t> *)r_dest;
|
||||
const Vector<int64_t> *src = (const Vector<int64_t> *)p_src;
|
||||
memnew_placement(dest, Vector<int64_t>(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_new_with_array(godot_packed_real_array *r_dest, const godot_array *p_a) {
|
||||
Vector<godot_real> *dest = (Vector<godot_real> *)r_dest;
|
||||
void GDAPI godot_packed_int64_array_new_with_array(godot_packed_int64_array *r_dest, const godot_array *p_a) {
|
||||
Vector<int64_t> *dest = (Vector<int64_t> *)r_dest;
|
||||
Array *a = (Array *)p_a;
|
||||
memnew_placement(dest, Vector<godot_real>);
|
||||
memnew_placement(dest, Vector<int64_t>);
|
||||
|
||||
dest->resize(a->size());
|
||||
for (int i = 0; i < a->size(); i++) {
|
||||
@@ -244,64 +246,232 @@ void GDAPI godot_packed_real_array_new_with_array(godot_packed_real_array *r_des
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_append(godot_packed_real_array *p_self, const godot_real p_data) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
void GDAPI godot_packed_int64_array_append(godot_packed_int64_array *p_self, const int64_t p_data) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_append_array(godot_packed_real_array *p_self, const godot_packed_real_array *p_array) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
Vector<godot_real> *array = (Vector<godot_real> *)p_array;
|
||||
void GDAPI godot_packed_int64_array_append_array(godot_packed_int64_array *p_self, const godot_packed_int64_array *p_array) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
Vector<int64_t> *array = (Vector<int64_t> *)p_array;
|
||||
self->append_array(*array);
|
||||
}
|
||||
|
||||
godot_error GDAPI godot_packed_real_array_insert(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
godot_error GDAPI godot_packed_int64_array_insert(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
return (godot_error)self->insert(p_idx, p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_invert(godot_packed_real_array *p_self) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
void GDAPI godot_packed_int64_array_invert(godot_packed_int64_array *p_self) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
self->invert();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_push_back(godot_packed_real_array *p_self, const godot_real p_data) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
void GDAPI godot_packed_int64_array_push_back(godot_packed_int64_array *p_self, const int64_t p_data) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_remove(godot_packed_real_array *p_self, const godot_int p_idx) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
void GDAPI godot_packed_int64_array_remove(godot_packed_int64_array *p_self, const godot_int p_idx) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
self->remove(p_idx);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_resize(godot_packed_real_array *p_self, const godot_int p_size) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
void GDAPI godot_packed_int64_array_resize(godot_packed_int64_array *p_self, const godot_int p_size) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
self->resize(p_size);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_set(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data) {
|
||||
Vector<godot_real> *self = (Vector<godot_real> *)p_self;
|
||||
void GDAPI godot_packed_int64_array_set(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data) {
|
||||
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
|
||||
self->set(p_idx, p_data);
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_packed_real_array_get(const godot_packed_real_array *p_self, const godot_int p_idx) {
|
||||
const Vector<godot_real> *self = (const Vector<godot_real> *)p_self;
|
||||
int64_t GDAPI godot_packed_int64_array_get(const godot_packed_int64_array *p_self, const godot_int p_idx) {
|
||||
const Vector<int64_t> *self = (const Vector<int64_t> *)p_self;
|
||||
return self->get(p_idx);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_packed_real_array_size(const godot_packed_real_array *p_self) {
|
||||
const Vector<godot_real> *self = (const Vector<godot_real> *)p_self;
|
||||
godot_int GDAPI godot_packed_int64_array_size(const godot_packed_int64_array *p_self) {
|
||||
const Vector<int64_t> *self = (const Vector<int64_t> *)p_self;
|
||||
return self->size();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_packed_real_array_empty(const godot_packed_real_array *p_self) {
|
||||
const Vector<godot_real> *self = (const Vector<godot_real> *)p_self;
|
||||
godot_bool GDAPI godot_packed_int64_array_empty(const godot_packed_int64_array *p_self) {
|
||||
const Vector<int64_t> *self = (const Vector<int64_t> *)p_self;
|
||||
return self->empty();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_real_array_destroy(godot_packed_real_array *p_self) {
|
||||
((Vector<godot_real> *)p_self)->~Vector();
|
||||
void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self) {
|
||||
((Vector<int64_t> *)p_self)->~Vector();
|
||||
}
|
||||
|
||||
// float32
|
||||
|
||||
void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *r_dest) {
|
||||
Vector<float> *dest = (Vector<float> *)r_dest;
|
||||
memnew_placement(dest, Vector<float>);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src) {
|
||||
Vector<float> *dest = (Vector<float> *)r_dest;
|
||||
const Vector<float> *src = (const Vector<float> *)p_src;
|
||||
memnew_placement(dest, Vector<float>(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_new_with_array(godot_packed_float32_array *r_dest, const godot_array *p_a) {
|
||||
Vector<float> *dest = (Vector<float> *)r_dest;
|
||||
Array *a = (Array *)p_a;
|
||||
memnew_placement(dest, Vector<float>);
|
||||
|
||||
dest->resize(a->size());
|
||||
for (int i = 0; i < a->size(); i++) {
|
||||
dest->set(i, (*a)[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_append(godot_packed_float32_array *p_self, const float p_data) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_append_array(godot_packed_float32_array *p_self, const godot_packed_float32_array *p_array) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
Vector<float> *array = (Vector<float> *)p_array;
|
||||
self->append_array(*array);
|
||||
}
|
||||
|
||||
godot_error GDAPI godot_packed_float32_array_insert(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
return (godot_error)self->insert(p_idx, p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_invert(godot_packed_float32_array *p_self) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
self->invert();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_push_back(godot_packed_float32_array *p_self, const float p_data) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_remove(godot_packed_float32_array *p_self, const godot_int p_idx) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
self->remove(p_idx);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_resize(godot_packed_float32_array *p_self, const godot_int p_size) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
self->resize(p_size);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_set(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data) {
|
||||
Vector<float> *self = (Vector<float> *)p_self;
|
||||
self->set(p_idx, p_data);
|
||||
}
|
||||
|
||||
float GDAPI godot_packed_float32_array_get(const godot_packed_float32_array *p_self, const godot_int p_idx) {
|
||||
const Vector<float> *self = (const Vector<float> *)p_self;
|
||||
return self->get(p_idx);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_packed_float32_array_size(const godot_packed_float32_array *p_self) {
|
||||
const Vector<float> *self = (const Vector<float> *)p_self;
|
||||
return self->size();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_packed_float32_array_empty(const godot_packed_float32_array *p_self) {
|
||||
const Vector<float> *self = (const Vector<float> *)p_self;
|
||||
return self->empty();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self) {
|
||||
((Vector<float> *)p_self)->~Vector();
|
||||
}
|
||||
|
||||
// float64
|
||||
|
||||
void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *r_dest) {
|
||||
Vector<double> *dest = (Vector<double> *)r_dest;
|
||||
memnew_placement(dest, Vector<double>);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src) {
|
||||
Vector<double> *dest = (Vector<double> *)r_dest;
|
||||
const Vector<double> *src = (const Vector<double> *)p_src;
|
||||
memnew_placement(dest, Vector<double>(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_new_with_array(godot_packed_float64_array *r_dest, const godot_array *p_a) {
|
||||
Vector<double> *dest = (Vector<double> *)r_dest;
|
||||
Array *a = (Array *)p_a;
|
||||
memnew_placement(dest, Vector<double>);
|
||||
|
||||
dest->resize(a->size());
|
||||
for (int i = 0; i < a->size(); i++) {
|
||||
dest->set(i, (*a)[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_append(godot_packed_float64_array *p_self, const double p_data) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_append_array(godot_packed_float64_array *p_self, const godot_packed_float64_array *p_array) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
Vector<double> *array = (Vector<double> *)p_array;
|
||||
self->append_array(*array);
|
||||
}
|
||||
|
||||
godot_error GDAPI godot_packed_float64_array_insert(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
return (godot_error)self->insert(p_idx, p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_invert(godot_packed_float64_array *p_self) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
self->invert();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_push_back(godot_packed_float64_array *p_self, const double p_data) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
self->push_back(p_data);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_remove(godot_packed_float64_array *p_self, const godot_int p_idx) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
self->remove(p_idx);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_resize(godot_packed_float64_array *p_self, const godot_int p_size) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
self->resize(p_size);
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_set(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data) {
|
||||
Vector<double> *self = (Vector<double> *)p_self;
|
||||
self->set(p_idx, p_data);
|
||||
}
|
||||
|
||||
double GDAPI godot_packed_float64_array_get(const godot_packed_float64_array *p_self, const godot_int p_idx) {
|
||||
const Vector<double> *self = (const Vector<double> *)p_self;
|
||||
return self->get(p_idx);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_packed_float64_array_size(const godot_packed_float64_array *p_self) {
|
||||
const Vector<double> *self = (const Vector<double> *)p_self;
|
||||
return self->size();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_packed_float64_array_empty(const godot_packed_float64_array *p_self) {
|
||||
const Vector<double> *self = (const Vector<double> *)p_self;
|
||||
return self->empty();
|
||||
}
|
||||
|
||||
void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self) {
|
||||
((Vector<double> *)p_self)->~Vector();
|
||||
}
|
||||
|
||||
// string
|
||||
@@ -38,6 +38,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(godot_rect2) == sizeof(Rect2), "Rect2 size mismatch");
|
||||
static_assert(sizeof(godot_rect2i) == sizeof(Rect2i), "Rect2i size mismatch");
|
||||
|
||||
// Rect2
|
||||
|
||||
void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
|
||||
const Vector2 *position = (const Vector2 *)p_pos;
|
||||
@@ -58,6 +61,13 @@ godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2_as_rect2i(const godot_rect2 *p_self) {
|
||||
godot_rect2i dest;
|
||||
const Rect2 *self = (const Rect2 *)p_self;
|
||||
*((Rect2i *)&dest) = Rect2i(*self);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self) {
|
||||
const Rect2 *self = (const Rect2 *)p_self;
|
||||
return self->get_area();
|
||||
@@ -173,6 +183,149 @@ void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size
|
||||
self->set_size(*size);
|
||||
}
|
||||
|
||||
// Rect2i
|
||||
|
||||
void GDAPI godot_rect2i_new_with_position_and_size(godot_rect2i *r_dest, const godot_vector2i *p_pos, const godot_vector2i *p_size) {
|
||||
const Vector2i *position = (const Vector2i *)p_pos;
|
||||
const Vector2i *size = (const Vector2i *)p_size;
|
||||
Rect2i *dest = (Rect2i *)r_dest;
|
||||
*dest = Rect2i(*position, *size);
|
||||
}
|
||||
|
||||
void GDAPI godot_rect2i_new(godot_rect2i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_width, const godot_int p_height) {
|
||||
Rect2i *dest = (Rect2i *)r_dest;
|
||||
*dest = Rect2i(p_x, p_y, p_width, p_height);
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_rect2i_as_string(const godot_rect2i *p_self) {
|
||||
godot_string ret;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_rect2 GDAPI godot_rect2i_as_rect2(const godot_rect2i *p_self) {
|
||||
godot_rect2 dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
*((Rect2 *)&dest) = Rect2(*self);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_rect2i_get_area(const godot_rect2i *p_self) {
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
return self->get_area();
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect2i_intersects(const godot_rect2i *p_self, const godot_rect2i *p_b) {
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Rect2i *b = (const Rect2i *)p_b;
|
||||
return self->intersects(*b);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect2i_encloses(const godot_rect2i *p_self, const godot_rect2i *p_b) {
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Rect2i *b = (const Rect2i *)p_b;
|
||||
return self->encloses(*b);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect2i_has_no_area(const godot_rect2i *p_self) {
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
return self->has_no_area();
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_clip(const godot_rect2i *p_self, const godot_rect2i *p_b) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Rect2i *b = (const Rect2i *)p_b;
|
||||
*((Rect2i *)&dest) = self->clip(*b);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_merge(const godot_rect2i *p_self, const godot_rect2i *p_b) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Rect2i *b = (const Rect2i *)p_b;
|
||||
*((Rect2i *)&dest) = self->merge(*b);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect2i_has_point(const godot_rect2i *p_self, const godot_vector2i *p_point) {
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Vector2i *point = (const Vector2i *)p_point;
|
||||
return self->has_point(*point);
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_grow(const godot_rect2i *p_self, const godot_int p_by) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
|
||||
*((Rect2i *)&dest) = self->grow(p_by);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_grow_individual(const godot_rect2i *p_self, const godot_int p_left, const godot_int p_top, const godot_int p_right, const godot_int p_bottom) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
*((Rect2i *)&dest) = self->grow_individual(p_left, p_top, p_right, p_bottom);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_grow_margin(const godot_rect2i *p_self, const godot_int p_margin, const godot_int p_by) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
*((Rect2i *)&dest) = self->grow_margin((Margin)p_margin, p_by);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_abs(const godot_rect2i *p_self) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
*((Rect2i *)&dest) = self->abs();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_rect2i_expand(const godot_rect2i *p_self, const godot_vector2i *p_to) {
|
||||
godot_rect2i dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Vector2i *to = (const Vector2i *)p_to;
|
||||
*((Rect2i *)&dest) = self->expand(*to);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_rect2i_operator_equal(const godot_rect2i *p_self, const godot_rect2i *p_b) {
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
const Rect2i *b = (const Rect2i *)p_b;
|
||||
return *self == *b;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_rect2i_get_position(const godot_rect2i *p_self) {
|
||||
godot_vector2i dest;
|
||||
Vector2i *d = (Vector2i *)&dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
*d = self->get_position();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_rect2i_get_size(const godot_rect2i *p_self) {
|
||||
godot_vector2i dest;
|
||||
Vector2i *d = (Vector2i *)&dest;
|
||||
const Rect2i *self = (const Rect2i *)p_self;
|
||||
*d = self->get_size();
|
||||
return dest;
|
||||
}
|
||||
|
||||
void GDAPI godot_rect2i_set_position(godot_rect2i *p_self, const godot_vector2i *p_pos) {
|
||||
Rect2i *self = (Rect2i *)p_self;
|
||||
const Vector2i *position = (const Vector2i *)p_pos;
|
||||
self->set_position(*position);
|
||||
}
|
||||
|
||||
void GDAPI godot_rect2i_set_size(godot_rect2i *p_self, const godot_vector2i *p_size) {
|
||||
Rect2i *self = (Rect2i *)p_self;
|
||||
const Vector2i *size = (const Vector2i *)p_size;
|
||||
self->set_size(*size);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -99,24 +99,48 @@ void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p
|
||||
memnew_placement_custom(dest, Variant, Variant(*s));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_string_name(godot_variant *r_dest, const godot_string_name *p_s) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
StringName *s = (StringName *)p_s;
|
||||
memnew_placement_custom(dest, Variant, Variant(*s));
|
||||
}
|
||||
|
||||
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(dest, Variant, Variant(*v2));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_vector2i(godot_variant *r_dest, const godot_vector2i *p_v2) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
Vector2i *v2 = (Vector2i *)p_v2;
|
||||
memnew_placement_custom(dest, Variant, Variant(*v2));
|
||||
}
|
||||
|
||||
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(dest, Variant, Variant(*rect2));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_rect2i(godot_variant *r_dest, const godot_rect2i *p_rect2) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
Rect2i *rect2 = (Rect2i *)p_rect2;
|
||||
memnew_placement_custom(dest, Variant, Variant(*rect2));
|
||||
}
|
||||
|
||||
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(dest, Variant, Variant(*v3));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_vector3i(godot_variant *r_dest, const godot_vector3i *p_v3) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
Vector3i *v3 = (Vector3i *)p_v3;
|
||||
memnew_placement_custom(dest, Variant, Variant(*v3));
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -171,6 +195,18 @@ void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid)
|
||||
memnew_placement_custom(dest, Variant, Variant(*rid));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_callable(godot_variant *r_dest, const godot_callable *p_cb) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
Callable *cb = (Callable *)p_cb;
|
||||
memnew_placement_custom(dest, Variant, Variant(*cb));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_signal(godot_variant *r_dest, const godot_signal *p_signal) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
Signal *signal = (Signal *)p_signal;
|
||||
memnew_placement_custom(dest, Variant, Variant(*signal));
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -209,18 +245,30 @@ void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godo
|
||||
memnew_placement_custom(dest, Variant, Variant(*pba));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_packed_int_array(godot_variant *r_dest, const godot_packed_int_array *p_pia) {
|
||||
void GDAPI godot_variant_new_packed_int32_array(godot_variant *r_dest, const godot_packed_int32_array *p_pia) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
PackedInt32Array *pia = (PackedInt32Array *)p_pia;
|
||||
memnew_placement_custom(dest, Variant, Variant(*pia));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_packed_real_array(godot_variant *r_dest, const godot_packed_real_array *p_pra) {
|
||||
void GDAPI godot_variant_new_packed_int64_array(godot_variant *r_dest, const godot_packed_int64_array *p_pia) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
PackedInt64Array *pia = (PackedInt64Array *)p_pia;
|
||||
memnew_placement_custom(dest, Variant, Variant(*pia));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_packed_float32_array(godot_variant *r_dest, const godot_packed_float32_array *p_pra) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
PackedFloat32Array *pra = (PackedFloat32Array *)p_pra;
|
||||
memnew_placement_custom(dest, Variant, Variant(*pra));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_packed_float64_array(godot_variant *r_dest, const godot_packed_float64_array *p_pra) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
PackedFloat64Array *pra = (PackedFloat64Array *)p_pra;
|
||||
memnew_placement_custom(dest, Variant, Variant(*pra));
|
||||
}
|
||||
|
||||
void GDAPI godot_variant_new_packed_string_array(godot_variant *r_dest, const godot_packed_string_array *p_psa) {
|
||||
Variant *dest = (Variant *)r_dest;
|
||||
PackedStringArray *psa = (PackedStringArray *)p_psa;
|
||||
@@ -273,6 +321,14 @@ godot_string GDAPI godot_variant_as_string(const godot_variant *p_self) {
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self) {
|
||||
godot_string_name raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
StringName *dest = (StringName *)&raw_dest;
|
||||
memnew_placement(dest, StringName(self->operator StringName())); // operator = is overloaded by StringName
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self) {
|
||||
godot_vector2 raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
@@ -281,6 +337,14 @@ godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self) {
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_variant_as_vector2i(const godot_variant *p_self) {
|
||||
godot_vector2i raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self) {
|
||||
godot_rect2 raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
@@ -289,6 +353,14 @@ godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self) {
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_rect2i GDAPI godot_variant_as_rect2i(const godot_variant *p_self) {
|
||||
godot_rect2i raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Rect2i *dest = (Rect2i *)&raw_dest;
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self) {
|
||||
godot_vector3 raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
@@ -297,6 +369,14 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self) {
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_variant_as_vector3i(const godot_variant *p_self) {
|
||||
godot_vector3i raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self) {
|
||||
godot_transform2d raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
@@ -369,6 +449,22 @@ godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self) {
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_callable GDAPI godot_variant_as_callable(const godot_variant *p_self) {
|
||||
godot_callable raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Callable *dest = (Callable *)&raw_dest;
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_signal GDAPI godot_variant_as_signal(const godot_variant *p_self) {
|
||||
godot_signal raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Signal *dest = (Signal *)&raw_dest;
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self) {
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
Object *dest;
|
||||
@@ -401,8 +497,8 @@ godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_var
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_variant *p_self) {
|
||||
godot_packed_int_array raw_dest;
|
||||
godot_packed_int32_array GDAPI godot_variant_as_packed_int32_array(const godot_variant *p_self) {
|
||||
godot_packed_int32_array raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
PackedInt32Array *dest = (PackedInt32Array *)&raw_dest;
|
||||
memnew_placement(dest, PackedInt32Array(self->operator PackedInt32Array())); // operator = is overloaded by PackedInt32Array
|
||||
@@ -410,8 +506,17 @@ godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_varia
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_variant *p_self) {
|
||||
godot_packed_real_array raw_dest;
|
||||
godot_packed_int64_array GDAPI godot_variant_as_packed_int64_array(const godot_variant *p_self) {
|
||||
godot_packed_int64_array raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
PackedInt64Array *dest = (PackedInt64Array *)&raw_dest;
|
||||
memnew_placement(dest, PackedInt64Array(self->operator PackedInt64Array())); // operator = is overloaded by PackedInt64Array
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_packed_float32_array GDAPI godot_variant_as_packed_float32_array(const godot_variant *p_self) {
|
||||
godot_packed_float32_array raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
PackedFloat32Array *dest = (PackedFloat32Array *)&raw_dest;
|
||||
memnew_placement(dest, PackedFloat32Array(self->operator PackedFloat32Array())); // operator = is overloaded by PackedFloat32Array
|
||||
@@ -419,6 +524,15 @@ godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_var
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_packed_float64_array GDAPI godot_variant_as_packed_float64_array(const godot_variant *p_self) {
|
||||
godot_packed_float64_array raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
PackedFloat64Array *dest = (PackedFloat64Array *)&raw_dest;
|
||||
memnew_placement(dest, PackedFloat64Array(self->operator PackedFloat64Array())); // operator = is overloaded by PackedFloat64Array
|
||||
*dest = *self;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_packed_string_array GDAPI godot_variant_as_packed_string_array(const godot_variant *p_self) {
|
||||
godot_packed_string_array raw_dest;
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
@@ -489,6 +603,11 @@ godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const
|
||||
return self->operator<(*other);
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_variant_hash(const godot_variant *p_self) {
|
||||
const Variant *self = (const Variant *)p_self;
|
||||
return self->hash();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -38,6 +38,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(godot_vector2) == sizeof(Vector2), "Vector2 size mismatch");
|
||||
static_assert(sizeof(godot_vector2i) == sizeof(Vector2i), "Vector2i size mismatch");
|
||||
|
||||
// Vector2
|
||||
|
||||
void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) {
|
||||
Vector2 *dest = (Vector2 *)r_dest;
|
||||
@@ -51,6 +54,13 @@ godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2_as_vector2i(const godot_vector2 *p_self) {
|
||||
godot_vector2i dest;
|
||||
const Vector2 *self = (const Vector2 *)p_self;
|
||||
*((Vector2i *)&dest) = Vector2i(*self);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self) {
|
||||
godot_vector2 dest;
|
||||
const Vector2 *self = (const Vector2 *)p_self;
|
||||
@@ -158,6 +168,13 @@ godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector2 GDAPI godot_vector2_sign(const godot_vector2 *p_self) {
|
||||
godot_vector2 dest;
|
||||
const Vector2 *self = (const Vector2 *)p_self;
|
||||
*((Vector2 *)&dest) = self->sign();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by) {
|
||||
godot_vector2 dest;
|
||||
const Vector2 *self = (const Vector2 *)p_self;
|
||||
@@ -308,6 +325,138 @@ godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self) {
|
||||
return self->y;
|
||||
}
|
||||
|
||||
// Vector2i
|
||||
|
||||
void GDAPI godot_vector2i_new(godot_vector2i *r_dest, const godot_int p_x, const godot_int p_y) {
|
||||
Vector2i *dest = (Vector2i *)r_dest;
|
||||
*dest = Vector2i(p_x, p_y);
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_vector2i_as_string(const godot_vector2i *p_self) {
|
||||
godot_string ret;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_vector2 GDAPI godot_vector2i_as_vector2(const godot_vector2i *p_self) {
|
||||
godot_vector2 dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
*((Vector2 *)&dest) = Vector2(*self);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_real GDAPI godot_vector2i_aspect(const godot_vector2i *p_self) {
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
return self->aspect();
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_abs(const godot_vector2i *p_self) {
|
||||
godot_vector2i dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
*((Vector2i *)&dest) = self->abs();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_sign(const godot_vector2i *p_self) {
|
||||
godot_vector2i dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
*((Vector2i *)&dest) = self->sign();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_add(const godot_vector2i *p_self, const godot_vector2i *p_b) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
const Vector2i *b = (const Vector2i *)p_b;
|
||||
*dest = *self + *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_subtract(const godot_vector2i *p_self, const godot_vector2i *p_b) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
const Vector2i *b = (const Vector2i *)p_b;
|
||||
*dest = *self - *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_multiply_vector(const godot_vector2i *p_self, const godot_vector2i *p_b) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
const Vector2i *b = (const Vector2i *)p_b;
|
||||
*dest = *self * *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_multiply_scalar(const godot_vector2i *p_self, const godot_int p_b) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
*dest = *self * p_b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_divide_vector(const godot_vector2i *p_self, const godot_vector2i *p_b) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
const Vector2i *b = (const Vector2i *)p_b;
|
||||
*dest = *self / *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_divide_scalar(const godot_vector2i *p_self, const godot_int p_b) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
*dest = *self / p_b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_vector2i_operator_equal(const godot_vector2i *p_self, const godot_vector2i *p_b) {
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
const Vector2i *b = (const Vector2i *)p_b;
|
||||
return *self == *b;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_vector2i_operator_less(const godot_vector2i *p_self, const godot_vector2i *p_b) {
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
const Vector2i *b = (const Vector2i *)p_b;
|
||||
return *self < *b;
|
||||
}
|
||||
|
||||
godot_vector2i GDAPI godot_vector2i_operator_neg(const godot_vector2i *p_self) {
|
||||
godot_vector2i raw_dest;
|
||||
Vector2i *dest = (Vector2i *)&raw_dest;
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
*dest = -(*self);
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
void GDAPI godot_vector2i_set_x(godot_vector2i *p_self, const godot_int p_x) {
|
||||
Vector2i *self = (Vector2i *)p_self;
|
||||
self->x = p_x;
|
||||
}
|
||||
|
||||
void GDAPI godot_vector2i_set_y(godot_vector2i *p_self, const godot_int p_y) {
|
||||
Vector2i *self = (Vector2i *)p_self;
|
||||
self->y = p_y;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_vector2i_get_x(const godot_vector2i *p_self) {
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
return self->x;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_vector2i_get_y(const godot_vector2i *p_self) {
|
||||
const Vector2i *self = (const Vector2i *)p_self;
|
||||
return self->y;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
static_assert(sizeof(godot_vector3) == sizeof(Vector3), "Vector3 size mismatch");
|
||||
static_assert(sizeof(godot_vector3i) == sizeof(Vector3i), "Vector3i size mismatch");
|
||||
|
||||
// Vector3
|
||||
|
||||
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;
|
||||
@@ -51,6 +54,13 @@ godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3_as_vector3i(const godot_vector3 *p_self) {
|
||||
godot_vector3i dest;
|
||||
const Vector3 *self = (const Vector3 *)p_self;
|
||||
*((Vector3i *)&dest) = Vector3i(*self);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self) {
|
||||
const Vector3 *self = (const Vector3 *)p_self;
|
||||
return self->min_axis();
|
||||
@@ -169,6 +179,13 @@ godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_vector3_sign(const godot_vector3 *p_self) {
|
||||
godot_vector3 dest;
|
||||
const Vector3 *self = (const Vector3 *)p_self;
|
||||
*((Vector3 *)&dest) = self->sign();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self) {
|
||||
godot_vector3 dest;
|
||||
const Vector3 *self = (const Vector3 *)p_self;
|
||||
@@ -315,6 +332,133 @@ godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot
|
||||
return self->get_axis(p_axis);
|
||||
}
|
||||
|
||||
// Vector3i
|
||||
|
||||
void GDAPI godot_vector3i_new(godot_vector3i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_z) {
|
||||
Vector3i *dest = (Vector3i *)r_dest;
|
||||
*dest = Vector3i(p_x, p_y, p_z);
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_vector3i_as_string(const godot_vector3i *p_self) {
|
||||
godot_string ret;
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
memnew_placement(&ret, String(*self));
|
||||
return ret;
|
||||
}
|
||||
|
||||
godot_vector3 GDAPI godot_vector3i_as_vector3(const godot_vector3i *p_self) {
|
||||
godot_vector3 dest;
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
*((Vector3 *)&dest) = Vector3(*self);
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_vector3i_min_axis(const godot_vector3i *p_self) {
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
return self->min_axis();
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_vector3i_max_axis(const godot_vector3i *p_self) {
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
return self->max_axis();
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_abs(const godot_vector3i *p_self) {
|
||||
godot_vector3i dest;
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
*((Vector3i *)&dest) = self->abs();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_sign(const godot_vector3i *p_self) {
|
||||
godot_vector3i dest;
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
*((Vector3i *)&dest) = self->sign();
|
||||
return dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_add(const godot_vector3i *p_self, const godot_vector3i *p_b) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
const Vector3i *b = (const Vector3i *)p_b;
|
||||
*dest = *self + *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_subtract(const godot_vector3i *p_self, const godot_vector3i *p_b) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
const Vector3i *b = (const Vector3i *)p_b;
|
||||
*dest = *self - *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_multiply_vector(const godot_vector3i *p_self, const godot_vector3i *p_b) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
const Vector3i *b = (const Vector3i *)p_b;
|
||||
*dest = *self * *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_multiply_scalar(const godot_vector3i *p_self, const godot_int p_b) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
*dest = *self * p_b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_divide_vector(const godot_vector3i *p_self, const godot_vector3i *p_b) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
const Vector3i *b = (const Vector3i *)p_b;
|
||||
*dest = *self / *b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_divide_scalar(const godot_vector3i *p_self, const godot_int p_b) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
*dest = *self / p_b;
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_vector3i_operator_equal(const godot_vector3i *p_self, const godot_vector3i *p_b) {
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
const Vector3i *b = (const Vector3i *)p_b;
|
||||
return *self == *b;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_vector3i_operator_less(const godot_vector3i *p_self, const godot_vector3i *p_b) {
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
const Vector3i *b = (const Vector3i *)p_b;
|
||||
return *self < *b;
|
||||
}
|
||||
|
||||
godot_vector3i GDAPI godot_vector3i_operator_neg(const godot_vector3i *p_self) {
|
||||
godot_vector3i raw_dest;
|
||||
Vector3i *dest = (Vector3i *)&raw_dest;
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
*dest = -(*self);
|
||||
return raw_dest;
|
||||
}
|
||||
|
||||
void GDAPI godot_vector3i_set_axis(godot_vector3i *p_self, const godot_vector3_axis p_axis, const godot_int p_val) {
|
||||
Vector3i *self = (Vector3i *)p_self;
|
||||
self->set_axis(p_axis, p_val);
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_vector3i_get_axis(const godot_vector3i *p_self, const godot_vector3_axis p_axis) {
|
||||
const Vector3i *self = (const Vector3i *)p_self;
|
||||
return self->get_axis(p_axis);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user