GDNative: New core API

This API now uses the discovery functions present in Variant instead of
wrapping every built-in function. Users now need to query for function
pointers and use those.
This commit is contained in:
George Marques
2020-12-30 14:05:05 -03:00
parent d39f6386ce
commit 030d1d6a17
50 changed files with 5929 additions and 17366 deletions
+4 -78
View File
@@ -31,24 +31,15 @@
#include "gdnative/node_path.h"
#include "core/string/node_path.h"
#include "core/variant/variant.h"
static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch");
#ifdef __cplusplus
extern "C" {
#endif
static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch");
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));
}
void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) {
NodePath *dest = (NodePath *)r_dest;
const NodePath *src = (const NodePath *)p_src;
memnew_placement(dest, NodePath(*src));
void GDAPI godot_node_path_new(godot_node_path *p_self) {
memnew_placement(p_self, NodePath);
}
void GDAPI godot_node_path_destroy(godot_node_path *p_self) {
@@ -56,71 +47,6 @@ void GDAPI godot_node_path_destroy(godot_node_path *p_self) {
self->~NodePath();
}
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_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_self) {
const NodePath *self = (const NodePath *)p_self;
return self->get_name_count();
}
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_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_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_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self) {
godot_string dest;
const NodePath *self = (const NodePath *)p_self;
memnew_placement(&dest, String(self->get_concatenated_subnames()));
return dest;
}
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_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;
}
godot_node_path godot_node_path_get_as_property_path(const godot_node_path *p_self) {
const NodePath *self = (const NodePath *)p_self;
godot_node_path res;
NodePath *val = (NodePath *)&res;
memnew_placement(val, NodePath);
*val = self->get_as_property_path();
return res;
}
#ifdef __cplusplus
}
#endif