51 #define HGDN_DECL static
53 #define HGDN_DECL extern
57#ifndef HGDN_STRING_FORMAT_BUFFER_SIZE
58 #define HGDN_STRING_FORMAT_BUFFER_SIZE 1024
61#if defined(__cplusplus) && __cplusplus >= 201103L
62 #define HGDN_CONSTEXPR constexpr
64 #define HGDN_CONSTEXPR
67#ifndef HGDN_METHOD_ARGUMENTS_INFO_MAX
68 #define HGDN_METHOD_ARGUMENTS_INFO_MAX 16
73#define HGDN__NARG(...) HGDN__NARG_(__VA_ARGS__, HGDN__NARG_RSEQ_N())
74#define HGDN__NARG_(...) HGDN__NARG_N(__VA_ARGS__)
75#define HGDN__NARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,N,...) N
76#define HGDN__NARG_RSEQ_N() 63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
80#define HGDN__EVAL0(...) __VA_ARGS__
81#define HGDN__EVAL1(...) HGDN__EVAL0(HGDN__EVAL0(HGDN__EVAL0(__VA_ARGS__)))
82#define HGDN__EVAL2(...) HGDN__EVAL1(HGDN__EVAL1(HGDN__EVAL1(__VA_ARGS__)))
83#define HGDN__EVAL3(...) HGDN__EVAL2(HGDN__EVAL2(HGDN__EVAL2(__VA_ARGS__)))
84#define HGDN__EVAL4(...) HGDN__EVAL3(HGDN__EVAL3(HGDN__EVAL3(__VA_ARGS__)))
85#define HGDN__EVAL(...) HGDN__EVAL4(HGDN__EVAL4(HGDN__EVAL4(__VA_ARGS__)))
86#define HGDN__MAP_END(...)
88#define HGDN__MAP_COMMA ,
89#define HGDN__MAP_GET_END() 0, HGDN__MAP_END
90#define HGDN__MAP_NEXT0(item, next, ...) next HGDN__MAP_OUT
91#define HGDN__MAP_NEXT1(item, next) HGDN__MAP_NEXT0(item, HGDN__MAP_COMMA next, 0)
92#define HGDN__MAP_NEXT(item, next) HGDN__MAP_NEXT1(HGDN__MAP_GET_END item, next)
93#define HGDN__MAP0(f, x, peek, ...) f(x) HGDN__MAP_NEXT(peek, HGDN__MAP1)(f, peek, __VA_ARGS__)
94#define HGDN__MAP1(f, x, peek, ...) f(x) HGDN__MAP_NEXT(peek, HGDN__MAP0)(f, peek, __VA_ARGS__)
95#define HGDN__MAP(f, ...) HGDN__EVAL(HGDN__MAP1(f, __VA_ARGS__, (), 0))
104 uint8_t data[
sizeof(
float[2])];
108 struct {
float x, y; };
110 struct {
float r, g; };
112 struct {
float s, t; };
114 struct {
float u, v; };
116 struct {
float width, height; };
119#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
121#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
126 uint8_t data[
sizeof(
float[3])];
130 struct {
float x, y, z; };
134 struct {
float r, g, b; };
138 struct {
float s, t, p; };
142 struct {
float u, v, _4; };
145 struct {
float width, height, depth; };
148#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
150#define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
155 uint8_t data[
sizeof(
float[4])];
159 struct {
float x, y, z, w; };
165 struct {
float r, g, b, a; };
171 struct {
float s, t, p, q; };
177 struct {
float u, v;
float _12[2]; };
181#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
184#define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
189 uint8_t data[
sizeof(
float[4])];
191 struct {
float x, y, width, height; };
195#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
197#define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
202 uint8_t data[
sizeof(
float[4])];
207#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
209#define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
214 uint8_t data[
sizeof(
float[4])];
216 struct {
float x, y, z, w; };
222#define HGDN_QUAT_IDENTITY ((hgdn_quat){ .elements = {0, 0, 0, 1} })
224#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
226#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
231 uint8_t data[
sizeof(
float[9])];
235#define HGDN_BASIS_IDENTITY ((hgdn_basis){ .elements = {1, 0, 0, 0, 1, 0, 0, 0, 1} })
237#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
239#define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
244 uint8_t data[
sizeof(
float[6])];
249#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
251#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
256 uint8_t data[
sizeof(
float[6])];
261#define HGDN_TRANSFORM2D_IDENTITY ((hgdn_transform2d){ .elements = {1, 0, 0, 1, 0, 0} })
263#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
265#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
270 uint8_t data[
sizeof(
float[12])];
274#define HGDN_TRANSFORM3D_IDENTITY ((hgdn_transform){ .elements = {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0} })
276#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
278#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
282#include "gdnative_api_struct.gen.h"
287extern const godot_gdnative_core_api_struct *hgdn_core_api;
288#ifndef HGDN_NO_CORE_1_1
289extern const godot_gdnative_core_1_1_api_struct *hgdn_core_1_1_api;
291#ifndef HGDN_NO_CORE_1_2
292extern const godot_gdnative_core_1_2_api_struct *hgdn_core_1_2_api;
294#ifndef HGDN_NO_CORE_1_3
295extern const godot_gdnative_core_1_3_api_struct *hgdn_core_1_3_api;
297#ifndef HGDN_NO_EXT_NATIVESCRIPT
298extern const godot_gdnative_ext_nativescript_api_struct *hgdn_nativescript_api;
299extern const godot_gdnative_ext_nativescript_1_1_api_struct *hgdn_nativescript_1_1_api;
301#ifndef HGDN_NO_EXT_PLUGINSCRIPT
302extern const godot_gdnative_ext_pluginscript_api_struct *hgdn_pluginscript_api;
304#ifndef HGDN_NO_EXT_ANDROID
305extern const godot_gdnative_ext_android_api_struct *hgdn_android_api;
307#ifndef HGDN_NO_EXT_ARVR
308extern const godot_gdnative_ext_arvr_api_struct *hgdn_arvr_api;
309extern const godot_gdnative_ext_arvr_1_2_api_struct *hgdn_arvr_1_2_api;
311#ifndef HGDN_NO_EXT_VIDEOCODER
312extern const godot_gdnative_ext_videodecoder_api_struct *hgdn_videodecoder_api;
314#ifndef HGDN_NO_EXT_NET
315extern const godot_gdnative_ext_net_api_struct *hgdn_net_api;
316extern const godot_gdnative_ext_net_3_2_api_struct *hgdn_net_3_2_api;
319extern godot_method_bind *hgdn_method_Object_callv;
326HGDN_DECL
void hgdn_gdnative_init(
const godot_gdnative_init_options *options);
327HGDN_DECL
void hgdn_gdnative_terminate(
const godot_gdnative_terminate_options *options);
344HGDN_DECL
void hgdn_print(
const char *fmt, ...);
345HGDN_DECL
void hgdn_print_warning(
const char *funcname,
const char *filename,
int line,
const char *fmt, ...);
346HGDN_DECL
void hgdn_print_error(
const char *funcname,
const char *filename,
int line,
const char *fmt, ...);
348#define HGDN_PRINT_WARNING(fmt, ...) (hgdn_print_warning(__FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
349#define HGDN_PRINT_ERROR(fmt, ...) (hgdn_print_error(__FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
351#define HGDN_PRINT_WARNING(fmt, ...) (hgdn_print_warning(__PRETTY_FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
352#define HGDN_PRINT_ERROR(fmt, ...) (hgdn_print_error(__PRETTY_FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
363#define HGDN_ASSERT(cond) HGDN_ASSERT_MSG((cond), "Assertion error: !(" #cond ")")
365#define HGDN_ASSERT_MSG(cond, fmt, ...) if(!(cond)){ HGDN_PRINT_ERROR(fmt, ##__VA_ARGS__); return hgdn_new_nil_variant(); }
367#define HGDN_ASSERT_ARRAY_SIZE(arr, min_size) HGDN_ASSERT_MSG(hgdn_core_api->godot_array_size((arr)) >= (min_size), "Error: array should have size of at least " #min_size ", got %d", hgdn_core_api->godot_array_size((arr)))
369#define HGDN_ASSERT_ARGS_SIZE(argc, min_size) HGDN_ASSERT_MSG((argc) >= (min_size), "Error: expected at least " #min_size " arguments, got %d", argc)
376 godot_char_string gd_char_string;
380HGDN_DECL
hgdn_string hgdn_string_get(
const godot_string *str);
381HGDN_DECL
hgdn_string hgdn_string_get_own(godot_string str);
382HGDN_DECL
void hgdn_string_destroy(
hgdn_string *str);
385 godot_string gd_string;
399 godot_pool_byte_array_read_access *gd_read_access;
403HGDN_DECL
hgdn_byte_array hgdn_byte_array_get(
const godot_pool_byte_array *array);
404HGDN_DECL
hgdn_byte_array hgdn_byte_array_get_own(godot_pool_byte_array array);
408 godot_pool_int_array_read_access *gd_read_access;
409 const godot_int *ptr;
412HGDN_DECL
hgdn_int_array hgdn_int_array_get(
const godot_pool_int_array *array);
413HGDN_DECL
hgdn_int_array hgdn_int_array_get_own(godot_pool_int_array array);
417 godot_pool_real_array_read_access *gd_read_access;
418 const godot_real *ptr;
421HGDN_DECL
hgdn_real_array hgdn_real_array_get(
const godot_pool_real_array *array);
422HGDN_DECL
hgdn_real_array hgdn_real_array_get_own(godot_pool_real_array array);
426 godot_pool_vector2_array_read_access *gd_read_access;
430HGDN_DECL
hgdn_vector2_array hgdn_vector2_array_get(
const godot_pool_vector2_array *array);
431HGDN_DECL
hgdn_vector2_array hgdn_vector2_array_get_own(godot_pool_vector2_array array);
435 godot_pool_vector3_array_read_access *gd_read_access;
439HGDN_DECL
hgdn_vector3_array hgdn_vector3_array_get(
const godot_pool_vector3_array *array);
440HGDN_DECL
hgdn_vector3_array hgdn_vector3_array_get_own(godot_pool_vector3_array array);
444 godot_pool_color_array_read_access *gd_read_access;
448HGDN_DECL
hgdn_color_array hgdn_color_array_get(
const godot_pool_color_array *array);
449HGDN_DECL
hgdn_color_array hgdn_color_array_get_own(godot_pool_color_array array);
457HGDN_DECL
hgdn_string_array hgdn_string_array_get(
const godot_pool_string_array *array);
458HGDN_DECL
hgdn_string_array hgdn_string_array_get_own(godot_pool_string_array array);
468HGDN_DECL godot_bool hgdn_variant_get_bool(
const godot_variant *var);
469HGDN_DECL uint64_t hgdn_variant_get_uint(
const godot_variant *var);
470HGDN_DECL int64_t hgdn_variant_get_int(
const godot_variant *var);
471HGDN_DECL
double hgdn_variant_get_real(
const godot_variant *var);
472HGDN_DECL
godot_vector2 hgdn_variant_get_vector2(
const godot_variant *var);
473HGDN_DECL
godot_vector3 hgdn_variant_get_vector3(
const godot_variant *var);
474HGDN_DECL
godot_rect2 hgdn_variant_get_rect2(
const godot_variant *var);
475HGDN_DECL
godot_plane hgdn_variant_get_plane(
const godot_variant *var);
476HGDN_DECL
godot_quat hgdn_variant_get_quat(
const godot_variant *var);
477HGDN_DECL
godot_aabb hgdn_variant_get_aabb(
const godot_variant *var);
478HGDN_DECL
godot_basis hgdn_variant_get_basis(
const godot_variant *var);
479HGDN_DECL
godot_transform2d hgdn_variant_get_transform2d(
const godot_variant *var);
480HGDN_DECL
godot_transform hgdn_variant_get_transform(
const godot_variant *var);
481HGDN_DECL
godot_color hgdn_variant_get_color(
const godot_variant *var);
482HGDN_DECL godot_node_path hgdn_variant_get_node_path(
const godot_variant *var);
483HGDN_DECL godot_rid hgdn_variant_get_rid(
const godot_variant *var);
484HGDN_DECL godot_object *hgdn_variant_get_object(
const godot_variant *var);
485HGDN_DECL godot_dictionary hgdn_variant_get_dictionary(
const godot_variant *var);
486HGDN_DECL godot_array hgdn_variant_get_array(
const godot_variant *var);
488HGDN_DECL
hgdn_string hgdn_variant_get_string(
const godot_variant *var);
489HGDN_DECL
hgdn_wide_string hgdn_variant_get_wide_string(
const godot_variant *var);
490HGDN_DECL
hgdn_byte_array hgdn_variant_get_byte_array(
const godot_variant *var);
491HGDN_DECL
hgdn_int_array hgdn_variant_get_int_array(
const godot_variant *var);
492HGDN_DECL
hgdn_real_array hgdn_variant_get_real_array(
const godot_variant *var);
495HGDN_DECL
hgdn_color_array hgdn_variant_get_color_array(
const godot_variant *var);
496HGDN_DECL
hgdn_string_array hgdn_variant_get_string_array(
const godot_variant *var);
498HGDN_DECL godot_bool hgdn_variant_get_bool_own(godot_variant var);
499HGDN_DECL uint64_t hgdn_variant_get_uint_own(godot_variant var);
500HGDN_DECL int64_t hgdn_variant_get_int_own(godot_variant var);
501HGDN_DECL
double hgdn_variant_get_real_own(godot_variant var);
502HGDN_DECL
godot_vector2 hgdn_variant_get_vector2_own(godot_variant var);
503HGDN_DECL
godot_vector3 hgdn_variant_get_vector3_own(godot_variant var);
504HGDN_DECL
godot_rect2 hgdn_variant_get_rect2_own(godot_variant var);
505HGDN_DECL
godot_plane hgdn_variant_get_plane_own(godot_variant var);
506HGDN_DECL
godot_quat hgdn_variant_get_quat_own(godot_variant var);
507HGDN_DECL
godot_aabb hgdn_variant_get_aabb_own(godot_variant var);
508HGDN_DECL
godot_basis hgdn_variant_get_basis_own(godot_variant var);
510HGDN_DECL
godot_transform hgdn_variant_get_transform_own(godot_variant var);
511HGDN_DECL
godot_color hgdn_variant_get_color_own(godot_variant var);
512HGDN_DECL godot_node_path hgdn_variant_get_node_path_own(godot_variant var);
513HGDN_DECL godot_rid hgdn_variant_get_rid_own(godot_variant var);
514HGDN_DECL godot_object *hgdn_variant_get_object_own(godot_variant var);
515HGDN_DECL godot_dictionary hgdn_variant_get_dictionary_own(godot_variant var);
516HGDN_DECL godot_array hgdn_variant_get_array_own(godot_variant var);
518HGDN_DECL
hgdn_string hgdn_variant_get_string_own(godot_variant var);
519HGDN_DECL
hgdn_wide_string hgdn_variant_get_wide_string_own(godot_variant var);
520HGDN_DECL
hgdn_byte_array hgdn_variant_get_byte_array_own(godot_variant var);
521HGDN_DECL
hgdn_int_array hgdn_variant_get_int_array_own(godot_variant var);
522HGDN_DECL
hgdn_real_array hgdn_variant_get_real_array_own(godot_variant var);
525HGDN_DECL
hgdn_color_array hgdn_variant_get_color_array_own(godot_variant var);
533HGDN_DECL godot_bool hgdn_array_get_bool(
const godot_array *array,
const godot_int index);
534HGDN_DECL uint64_t hgdn_array_get_uint(
const godot_array *array,
const godot_int index);
535HGDN_DECL int64_t hgdn_array_get_int(
const godot_array *array,
const godot_int index);
536HGDN_DECL
double hgdn_array_get_real(
const godot_array *array,
const godot_int index);
537HGDN_DECL
godot_vector2 hgdn_array_get_vector2(
const godot_array *array,
const godot_int index);
538HGDN_DECL
godot_vector3 hgdn_array_get_vector3(
const godot_array *array,
const godot_int index);
539HGDN_DECL
godot_rect2 hgdn_array_get_rect2(
const godot_array *array,
const godot_int index);
540HGDN_DECL
godot_plane hgdn_array_get_plane(
const godot_array *array,
const godot_int index);
541HGDN_DECL
godot_quat hgdn_array_get_quat(
const godot_array *array,
const godot_int index);
542HGDN_DECL
godot_aabb hgdn_array_get_aabb(
const godot_array *array,
const godot_int index);
543HGDN_DECL
godot_basis hgdn_array_get_basis(
const godot_array *array,
const godot_int index);
544HGDN_DECL
godot_transform2d hgdn_array_get_transform2d(
const godot_array *array,
const godot_int index);
545HGDN_DECL
godot_transform hgdn_array_get_transform(
const godot_array *array,
const godot_int index);
546HGDN_DECL
godot_color hgdn_array_get_color(
const godot_array *array,
const godot_int index);
547HGDN_DECL godot_node_path hgdn_array_get_node_path(
const godot_array *array,
const godot_int index);
548HGDN_DECL godot_rid hgdn_array_get_rid(
const godot_array *array,
const godot_int index);
549HGDN_DECL godot_object *hgdn_array_get_object(
const godot_array *array,
const godot_int index);
550HGDN_DECL godot_dictionary hgdn_array_get_dictionary(
const godot_array *array,
const godot_int index);
551HGDN_DECL godot_array hgdn_array_get_array(
const godot_array *array,
const godot_int index);
553HGDN_DECL
hgdn_string hgdn_array_get_string(
const godot_array *array,
const godot_int index);
554HGDN_DECL
hgdn_wide_string hgdn_array_get_wide_string(
const godot_array *array,
const godot_int index);
555HGDN_DECL
hgdn_byte_array hgdn_array_get_byte_array(
const godot_array *array,
const godot_int index);
556HGDN_DECL
hgdn_int_array hgdn_array_get_int_array(
const godot_array *array,
const godot_int index);
557HGDN_DECL
hgdn_real_array hgdn_array_get_real_array(
const godot_array *array,
const godot_int index);
558HGDN_DECL
hgdn_vector2_array hgdn_array_get_vector2_array(
const godot_array *array,
const godot_int index);
559HGDN_DECL
hgdn_vector3_array hgdn_array_get_vector3_array(
const godot_array *array,
const godot_int index);
560HGDN_DECL
hgdn_color_array hgdn_array_get_color_array(
const godot_array *array,
const godot_int index);
561HGDN_DECL
hgdn_string_array hgdn_array_get_string_array(
const godot_array *array,
const godot_int index);
568HGDN_DECL godot_bool hgdn_args_get_bool(godot_variant **args,
const godot_int index);
569HGDN_DECL uint64_t hgdn_args_get_uint(godot_variant **args,
const godot_int index);
570HGDN_DECL int64_t hgdn_args_get_int(godot_variant **args,
const godot_int index);
571HGDN_DECL
double hgdn_args_get_real(godot_variant **args,
const godot_int index);
572HGDN_DECL
godot_vector2 hgdn_args_get_vector2(godot_variant **args,
const godot_int index);
573HGDN_DECL
godot_vector3 hgdn_args_get_vector3(godot_variant **args,
const godot_int index);
574HGDN_DECL
godot_rect2 hgdn_args_get_rect2(godot_variant **args,
const godot_int index);
575HGDN_DECL
godot_plane hgdn_args_get_plane(godot_variant **args,
const godot_int index);
576HGDN_DECL
godot_quat hgdn_args_get_quat(godot_variant **args,
const godot_int index);
577HGDN_DECL
godot_aabb hgdn_args_get_aabb(godot_variant **args,
const godot_int index);
578HGDN_DECL
godot_basis hgdn_args_get_basis(godot_variant **args,
const godot_int index);
579HGDN_DECL
godot_transform2d hgdn_args_get_transform2d(godot_variant **args,
const godot_int index);
580HGDN_DECL
godot_transform hgdn_args_get_transform(godot_variant **args,
const godot_int index);
581HGDN_DECL
godot_color hgdn_args_get_color(godot_variant **args,
const godot_int index);
582HGDN_DECL godot_node_path hgdn_args_get_node_path(godot_variant **args,
const godot_int index);
583HGDN_DECL godot_rid hgdn_args_get_rid(godot_variant **args,
const godot_int index);
584HGDN_DECL godot_object *hgdn_args_get_object(godot_variant **args,
const godot_int index);
585HGDN_DECL godot_dictionary hgdn_args_get_dictionary(godot_variant **args,
const godot_int index);
586HGDN_DECL godot_array hgdn_args_get_array(godot_variant **args,
const godot_int index);
588HGDN_DECL
hgdn_string hgdn_args_get_string(godot_variant **args,
const godot_int index);
589HGDN_DECL
hgdn_wide_string hgdn_args_get_wide_string(godot_variant **args,
const godot_int index);
590HGDN_DECL
hgdn_byte_array hgdn_args_get_byte_array(godot_variant **args,
const godot_int index);
591HGDN_DECL
hgdn_int_array hgdn_args_get_int_array(godot_variant **args,
const godot_int index);
592HGDN_DECL
hgdn_real_array hgdn_args_get_real_array(godot_variant **args,
const godot_int index);
593HGDN_DECL
hgdn_vector2_array hgdn_args_get_vector2_array(godot_variant **args,
const godot_int index);
594HGDN_DECL
hgdn_vector3_array hgdn_args_get_vector3_array(godot_variant **args,
const godot_int index);
595HGDN_DECL
hgdn_color_array hgdn_args_get_color_array(godot_variant **args,
const godot_int index);
596HGDN_DECL
hgdn_string_array hgdn_args_get_string_array(godot_variant **args,
const godot_int index);
603HGDN_DECL godot_bool hgdn_dictionary_get_bool(
const godot_dictionary *dict,
const godot_variant *key);
604HGDN_DECL uint64_t hgdn_dictionary_get_uint(
const godot_dictionary *dict,
const godot_variant *key);
605HGDN_DECL int64_t hgdn_dictionary_get_int(
const godot_dictionary *dict,
const godot_variant *key);
606HGDN_DECL
double hgdn_dictionary_get_real(
const godot_dictionary *dict,
const godot_variant *key);
607HGDN_DECL
godot_vector2 hgdn_dictionary_get_vector2(
const godot_dictionary *dict,
const godot_variant *key);
608HGDN_DECL
godot_vector3 hgdn_dictionary_get_vector3(
const godot_dictionary *dict,
const godot_variant *key);
609HGDN_DECL
godot_rect2 hgdn_dictionary_get_rect2(
const godot_dictionary *dict,
const godot_variant *key);
610HGDN_DECL
godot_plane hgdn_dictionary_get_plane(
const godot_dictionary *dict,
const godot_variant *key);
611HGDN_DECL
godot_quat hgdn_dictionary_get_quat(
const godot_dictionary *dict,
const godot_variant *key);
612HGDN_DECL
godot_aabb hgdn_dictionary_get_aabb(
const godot_dictionary *dict,
const godot_variant *key);
613HGDN_DECL
godot_basis hgdn_dictionary_get_basis(
const godot_dictionary *dict,
const godot_variant *key);
614HGDN_DECL
godot_transform2d hgdn_dictionary_get_transform2d(
const godot_dictionary *dict,
const godot_variant *key);
615HGDN_DECL
godot_transform hgdn_dictionary_get_transform(
const godot_dictionary *dict,
const godot_variant *key);
616HGDN_DECL
godot_color hgdn_dictionary_get_color(
const godot_dictionary *dict,
const godot_variant *key);
617HGDN_DECL godot_node_path hgdn_dictionary_get_node_path(
const godot_dictionary *dict,
const godot_variant *key);
618HGDN_DECL godot_rid hgdn_dictionary_get_rid(
const godot_dictionary *dict,
const godot_variant *key);
619HGDN_DECL godot_object *hgdn_dictionary_get_object(
const godot_dictionary *dict,
const godot_variant *key);
620HGDN_DECL godot_dictionary hgdn_dictionary_get_dictionary(
const godot_dictionary *dict,
const godot_variant *key);
621HGDN_DECL godot_array hgdn_dictionary_get_array(
const godot_dictionary *dict,
const godot_variant *key);
623HGDN_DECL
hgdn_string hgdn_dictionary_get_string(
const godot_dictionary *dict,
const godot_variant *key);
624HGDN_DECL
hgdn_wide_string hgdn_dictionary_get_wide_string(
const godot_dictionary *dict,
const godot_variant *key);
625HGDN_DECL
hgdn_byte_array hgdn_dictionary_get_byte_array(
const godot_dictionary *dict,
const godot_variant *key);
626HGDN_DECL
hgdn_int_array hgdn_dictionary_get_int_array(
const godot_dictionary *dict,
const godot_variant *key);
627HGDN_DECL
hgdn_real_array hgdn_dictionary_get_real_array(
const godot_dictionary *dict,
const godot_variant *key);
628HGDN_DECL
hgdn_vector2_array hgdn_dictionary_get_vector2_array(
const godot_dictionary *dict,
const godot_variant *key);
629HGDN_DECL
hgdn_vector3_array hgdn_dictionary_get_vector3_array(
const godot_dictionary *dict,
const godot_variant *key);
630HGDN_DECL
hgdn_color_array hgdn_dictionary_get_color_array(
const godot_dictionary *dict,
const godot_variant *key);
631HGDN_DECL
hgdn_string_array hgdn_dictionary_get_string_array(
const godot_dictionary *dict,
const godot_variant *key);
633HGDN_DECL godot_bool hgdn_dictionary_string_get_bool(
const godot_dictionary *dict,
const char *key);
634HGDN_DECL uint64_t hgdn_dictionary_string_get_uint(
const godot_dictionary *dict,
const char *key);
635HGDN_DECL int64_t hgdn_dictionary_string_get_int(
const godot_dictionary *dict,
const char *key);
636HGDN_DECL
double hgdn_dictionary_string_get_real(
const godot_dictionary *dict,
const char *key);
637HGDN_DECL
godot_vector2 hgdn_dictionary_string_get_vector2(
const godot_dictionary *dict,
const char *key);
638HGDN_DECL
godot_vector3 hgdn_dictionary_string_get_vector3(
const godot_dictionary *dict,
const char *key);
639HGDN_DECL
godot_rect2 hgdn_dictionary_string_get_rect2(
const godot_dictionary *dict,
const char *key);
640HGDN_DECL
godot_plane hgdn_dictionary_string_get_plane(
const godot_dictionary *dict,
const char *key);
641HGDN_DECL
godot_quat hgdn_dictionary_string_get_quat(
const godot_dictionary *dict,
const char *key);
642HGDN_DECL
godot_aabb hgdn_dictionary_string_get_aabb(
const godot_dictionary *dict,
const char *key);
643HGDN_DECL
godot_basis hgdn_dictionary_string_get_basis(
const godot_dictionary *dict,
const char *key);
644HGDN_DECL
godot_transform2d hgdn_dictionary_string_get_transform2d(
const godot_dictionary *dict,
const char *key);
645HGDN_DECL
godot_transform hgdn_dictionary_string_get_transform(
const godot_dictionary *dict,
const char *key);
646HGDN_DECL
godot_color hgdn_dictionary_string_get_color(
const godot_dictionary *dict,
const char *key);
647HGDN_DECL godot_node_path hgdn_dictionary_string_get_node_path(
const godot_dictionary *dict,
const char *key);
648HGDN_DECL godot_rid hgdn_dictionary_string_get_rid(
const godot_dictionary *dict,
const char *key);
649HGDN_DECL godot_object *hgdn_dictionary_string_get_object(
const godot_dictionary *dict,
const char *key);
650HGDN_DECL godot_dictionary hgdn_dictionary_string_get_dictionary(
const godot_dictionary *dict,
const char *key);
651HGDN_DECL godot_array hgdn_dictionary_string_get_array(
const godot_dictionary *dict,
const char *key);
653HGDN_DECL
hgdn_string hgdn_dictionary_string_get_string(
const godot_dictionary *dict,
const char *key);
654HGDN_DECL
hgdn_wide_string hgdn_dictionary_string_get_wide_string(
const godot_dictionary *dict,
const char *key);
655HGDN_DECL
hgdn_byte_array hgdn_dictionary_string_get_byte_array(
const godot_dictionary *dict,
const char *key);
656HGDN_DECL
hgdn_int_array hgdn_dictionary_string_get_int_array(
const godot_dictionary *dict,
const char *key);
657HGDN_DECL
hgdn_real_array hgdn_dictionary_string_get_real_array(
const godot_dictionary *dict,
const char *key);
658HGDN_DECL
hgdn_vector2_array hgdn_dictionary_string_get_vector2_array(
const godot_dictionary *dict,
const char *key);
659HGDN_DECL
hgdn_vector3_array hgdn_dictionary_string_get_vector3_array(
const godot_dictionary *dict,
const char *key);
660HGDN_DECL
hgdn_color_array hgdn_dictionary_string_get_color_array(
const godot_dictionary *dict,
const char *key);
661HGDN_DECL
hgdn_string_array hgdn_dictionary_string_get_string_array(
const godot_dictionary *dict,
const char *key);
672HGDN_DECL godot_variant hgdn_new_variant_copy(
const godot_variant *value);
673HGDN_DECL godot_variant hgdn_new_nil_variant();
674HGDN_DECL godot_variant hgdn_new_bool_variant(
const godot_bool value);
675HGDN_DECL godot_variant hgdn_new_uint_variant(
const uint64_t value);
676HGDN_DECL godot_variant hgdn_new_int_variant(
const int64_t value);
677HGDN_DECL godot_variant hgdn_new_real_variant(
const double value);
678HGDN_DECL godot_variant hgdn_new_string_variant(
const godot_string *value);
679HGDN_DECL godot_variant hgdn_new_cstring_variant(
const char *value);
680HGDN_DECL godot_variant hgdn_new_wide_string_variant(
const wchar_t *value);
681HGDN_DECL godot_variant hgdn_new_vector2_variant(
const godot_vector2 value);
682HGDN_DECL godot_variant hgdn_new_vector3_variant(
const godot_vector3 value);
683HGDN_DECL godot_variant hgdn_new_rect2_variant(
const godot_rect2 value);
684HGDN_DECL godot_variant hgdn_new_plane_variant(
const godot_plane value);
685HGDN_DECL godot_variant hgdn_new_quat_variant(
const godot_quat value);
686HGDN_DECL godot_variant hgdn_new_aabb_variant(
const godot_aabb value);
687HGDN_DECL godot_variant hgdn_new_basis_variant(
const godot_basis value);
688HGDN_DECL godot_variant hgdn_new_transform2d_variant(
const godot_transform2d value);
689HGDN_DECL godot_variant hgdn_new_transform_variant(
const godot_transform value);
690HGDN_DECL godot_variant hgdn_new_color_variant(
const godot_color value);
691HGDN_DECL godot_variant hgdn_new_node_path_variant(
const godot_node_path *value);
692HGDN_DECL godot_variant hgdn_new_rid_variant(
const godot_rid *value);
693HGDN_DECL godot_variant hgdn_new_object_variant(
const godot_object *value);
694HGDN_DECL godot_variant hgdn_new_dictionary_variant(
const godot_dictionary *value);
695HGDN_DECL godot_variant hgdn_new_array_variant(
const godot_array *value);
696HGDN_DECL godot_variant hgdn_new_pool_byte_array_variant(
const godot_pool_byte_array *value);
697HGDN_DECL godot_variant hgdn_new_pool_int_array_variant(
const godot_pool_int_array *value);
698HGDN_DECL godot_variant hgdn_new_pool_real_array_variant(
const godot_pool_real_array *value);
699HGDN_DECL godot_variant hgdn_new_pool_vector2_array_variant(
const godot_pool_vector2_array *value);
700HGDN_DECL godot_variant hgdn_new_pool_vector3_array_variant(
const godot_pool_vector3_array *value);
701HGDN_DECL godot_variant hgdn_new_pool_color_array_variant(
const godot_pool_color_array *value);
702HGDN_DECL godot_variant hgdn_new_pool_string_array_variant(
const godot_pool_string_array *value);
704HGDN_DECL godot_variant hgdn_new_string_variant_own(godot_string value);
705HGDN_DECL godot_variant hgdn_new_node_path_variant_own(godot_node_path value);
706HGDN_DECL godot_variant hgdn_new_dictionary_variant_own(godot_dictionary value);
707HGDN_DECL godot_variant hgdn_new_array_variant_own(godot_array value);
708HGDN_DECL godot_variant hgdn_new_pool_byte_array_variant_own(godot_pool_byte_array value);
709HGDN_DECL godot_variant hgdn_new_pool_int_array_variant_own(godot_pool_int_array value);
710HGDN_DECL godot_variant hgdn_new_pool_real_array_variant_own(godot_pool_real_array value);
711HGDN_DECL godot_variant hgdn_new_pool_vector2_array_variant_own(godot_pool_vector2_array value);
712HGDN_DECL godot_variant hgdn_new_pool_vector3_array_variant_own(godot_pool_vector3_array value);
713HGDN_DECL godot_variant hgdn_new_pool_color_array_variant_own(godot_pool_color_array value);
714HGDN_DECL godot_variant hgdn_new_pool_string_array_variant_own(godot_pool_string_array value);
742 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_byte_array *value);
743 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_int_array *value);
744 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_real_array *value);
745 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_vector2_array *value);
746 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_vector3_array *value);
747 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_color_array *value);
748 HGDN_DECL godot_variant
hgdn_new_variant(
const godot_pool_string_array *value);
761 HGDN_DECL HGDN_CONSTEXPR godot_variant
hgdn_new_variant(godot_variant value);
763#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
765#define hgdn_new_variant(value) \
767 godot_bool: hgdn_new_bool_variant, \
768 unsigned int: hgdn_new_uint_variant, \
769 uint64_t: hgdn_new_uint_variant, \
770 int: hgdn_new_int_variant, \
771 int64_t: hgdn_new_int_variant, \
772 float: hgdn_new_real_variant, \
773 double: hgdn_new_real_variant, \
774 godot_string*: hgdn_new_string_variant, const godot_string*: hgdn_new_string_variant, \
775 char*: hgdn_new_cstring_variant, const char*: hgdn_new_cstring_variant, \
776 wchar_t*: hgdn_new_wide_string_variant, const wchar_t*: hgdn_new_wide_string_variant, \
777 godot_vector2: hgdn_new_vector2_variant, \
778 godot_vector3: hgdn_new_vector3_variant, \
779 godot_rect2: hgdn_new_rect2_variant, \
780 godot_plane: hgdn_new_plane_variant, \
781 godot_quat: hgdn_new_quat_variant, \
782 godot_aabb: hgdn_new_aabb_variant, \
783 godot_basis: hgdn_new_basis_variant, \
784 godot_transform2d: hgdn_new_transform2d_variant, \
785 godot_transform: hgdn_new_transform_variant, \
786 godot_color: hgdn_new_color_variant, \
787 godot_node_path*: hgdn_new_node_path_variant, const godot_node_path*: hgdn_new_node_path_variant, \
788 godot_rid*: hgdn_new_rid_variant, const godot_rid*: hgdn_new_rid_variant, \
789 godot_object*: hgdn_new_object_variant, const godot_object*: hgdn_new_object_variant, \
790 godot_dictionary*: hgdn_new_dictionary_variant, const godot_dictionary*: hgdn_new_dictionary_variant, \
791 godot_array*: hgdn_new_array_variant, const godot_array*: hgdn_new_array_variant, \
792 godot_pool_byte_array*: hgdn_new_pool_byte_array_variant, const godot_pool_byte_array*: hgdn_new_pool_byte_array_variant, \
793 godot_pool_int_array*: hgdn_new_pool_int_array_variant, const godot_pool_int_array*: hgdn_new_pool_int_array_variant, \
794 godot_pool_real_array*: hgdn_new_pool_real_array_variant, const godot_pool_real_array*: hgdn_new_pool_real_array_variant, \
795 godot_pool_vector2_array*: hgdn_new_pool_vector2_array_variant, const godot_pool_vector2_array*: hgdn_new_pool_vector2_array_variant, \
796 godot_pool_vector3_array*: hgdn_new_pool_vector3_array_variant, const godot_pool_vector3_array*: hgdn_new_pool_vector3_array_variant, \
797 godot_pool_color_array*: hgdn_new_pool_color_array_variant, const godot_pool_color_array*: hgdn_new_pool_color_array_variant, \
798 godot_pool_string_array*: hgdn_new_pool_string_array_variant, const godot_pool_string_array*: hgdn_new_pool_string_array_variant, \
799 godot_string: hgdn_new_string_variant_own, \
800 godot_node_path: hgdn_new_node_path_variant_own, \
801 godot_dictionary: hgdn_new_dictionary_variant_own, \
802 godot_array: hgdn_new_array_variant_own, \
803 godot_pool_byte_array: hgdn_new_pool_byte_array_variant_own, \
804 godot_pool_int_array: hgdn_new_pool_int_array_variant_own, \
805 godot_pool_real_array: hgdn_new_pool_real_array_variant_own, \
806 godot_pool_vector2_array: hgdn_new_pool_vector2_array_variant_own, \
807 godot_pool_vector3_array: hgdn_new_pool_vector3_array_variant_own, \
808 godot_pool_color_array: hgdn_new_pool_color_array_variant_own, \
809 godot_pool_string_array: hgdn_new_pool_string_array_variant_own, \
810 godot_variant*: hgdn_new_variant_copy, const godot_variant*: hgdn_new_variant_copy, \
811 godot_variant: hgdn__variant_return \
813HGDN_DECL godot_variant hgdn__variant_return(godot_variant value);
815#define hgdn_new_variant(value) (value)
823HGDN_DECL godot_string hgdn_new_string(
const char *cstr);
824HGDN_DECL godot_string hgdn_new_string_with_len(
const char *cstr,
const godot_int len);
828HGDN_DECL godot_string hgdn_new_wide_string(
const wchar_t *wstr);
829HGDN_DECL godot_string hgdn_new_wide_string_with_len(
const wchar_t *wstr,
const godot_int len);
839HGDN_DECL godot_pool_byte_array hgdn_new_byte_array(
const uint8_t *buffer,
const godot_int size);
840HGDN_DECL godot_pool_int_array hgdn_new_int_array(
const godot_int *buffer,
const godot_int size);
841HGDN_DECL godot_pool_real_array hgdn_new_real_array(
const godot_real *buffer,
const godot_int size);
842HGDN_DECL godot_pool_vector2_array hgdn_new_vector2_array(
const godot_vector2 *buffer,
const godot_int size);
843HGDN_DECL godot_pool_vector3_array hgdn_new_vector3_array(
const godot_vector3 *buffer,
const godot_int size);
844HGDN_DECL godot_pool_color_array hgdn_new_color_array(
const godot_color *buffer,
const godot_int size);
847HGDN_DECL godot_array hgdn_new_array(
const godot_variant *
const *buffer,
const godot_int size);
851#if defined(__cplusplus) && __cplusplus >= 201103L
853 template<
typename... Args> godot_pool_byte_array hgdn_new_byte_array_args(Args... args) {
854 uint8_t buffer[] = { args... };
855 return hgdn_new_byte_array(buffer,
sizeof...(args));
857 template<
typename... Args> godot_pool_int_array hgdn_new_int_array_args(Args... args) {
858 godot_int buffer[] = { args... };
859 return hgdn_new_int_array(buffer,
sizeof...(args));
861 template<
typename... Args> godot_pool_real_array hgdn_new_real_array_args(Args... args) {
862 godot_real buffer[] = { args... };
863 return hgdn_new_real_array(buffer,
sizeof...(args));
865 template<
typename... Args> godot_pool_vector2_array hgdn_new_vector2_array_args(Args... args) {
867 return hgdn_new_vector2_array(buffer,
sizeof...(args));
869 template<
typename... Args> godot_pool_vector3_array hgdn_new_vector3_array_args(Args... args) {
871 return hgdn_new_vector3_array(buffer,
sizeof...(args));
873 template<
typename... Args> godot_pool_color_array hgdn_new_color_array_args(Args... args) {
875 return hgdn_new_color_array(buffer,
sizeof...(args));
877 template<
typename... Args> godot_pool_string_array hgdn_new_string_array_args(Args... args) {
878 const char *
const buffer[] = { args... };
887 #define hgdn_new_byte_array_args(...) (hgdn_new_byte_array((const uint8_t[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
888 #define hgdn_new_int_array_args(...) (hgdn_new_int_array((const godot_int[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
889 #define hgdn_new_real_array_args(...) (hgdn_new_real_array((const godot_real[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
890 #define hgdn_new_vector2_array_args(...) (hgdn_new_vector2_array((const godot_vector2[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
891 #define hgdn_new_vector3_array_args(...) (hgdn_new_vector3_array((const godot_vector3[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
892 #define hgdn_new_color_array_args(...) (hgdn_new_color_array((const godot_color[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
893 #define hgdn_new_string_array_args(...) (hgdn_new_string_array((const char *const []){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
895 #define hgdn_new_array_args(...) (hgdn_new_array_own((godot_variant[]){ HGDN__MAP(hgdn_new_variant, __VA_ARGS__) }, HGDN__NARG(__VA_ARGS__)))
907 godot_variant *key, *value;
911 godot_variant key, value;
916 godot_variant *value;
925 const char *key, *value;
933HGDN_DECL godot_dictionary hgdn_new_dictionary(
const hgdn_dictionary_entry *buffer,
const godot_int size);
940#define hgdn_new_dictionary_args(...) (hgdn_new_dictionary((const hgdn_dictionary_entry[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
941#define hgdn_new_dictionary_string_args(...) (hgdn_new_dictionary_string((const hgdn_dictionary_entry_string[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
942#define hgdn_new_dictionary_string_int_args(...) (hgdn_new_dictionary_string_int((const hgdn_dictionary_entry_string_int[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
943#define hgdn_new_dictionary_string_string_args(...) (hgdn_new_dictionary_string_string((const hgdn_dictionary_entry_string_string[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
944#define hgdn_new_dictionary_own_args(...) (hgdn_new_dictionary_own((hgdn_dictionary_entry_own[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
945#define hgdn_new_dictionary_string_own_args(...) (hgdn_new_dictionary_string_own((hgdn_dictionary_entry_string_own[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
952HGDN_DECL godot_variant hgdn_object_callv(godot_object *instance,
const char *method,
const godot_array *args);
953HGDN_DECL godot_variant hgdn_object_callv_own(godot_object *instance,
const char *method, godot_array args);
954#define hgdn_object_get(instance, property) (hgdn_object_call(instance, "get", property))
955#define hgdn_object_set(instance, property, value) (hgdn_object_call(instance, "set", property, value))
957#if defined(__cplusplus) && __cplusplus >= 201103L
958extern "C++" template<
typename... Args> godot_variant
hgdn_object_call(godot_object *instance,
const char *method, Args... args) {
960 return hgdn_object_callv_own(instance, method, args_array);
964#define hgdn_object_call(instance, method, ...) (hgdn_object_callv_own((instance), (method), hgdn_new_array_args(__VA_ARGS__)))
972#ifndef HGDN_NO_EXT_NATIVESCRIPT
975 godot_property_set_func setter;
976 godot_property_get_func getter;
979 godot_property_hint hint;
980 const char *hint_string;
981 godot_property_usage_flags usage;
982 godot_variant default_value;
983 godot_method_rpc_mode rset_type;
990 godot_variant_type type;
991 godot_property_hint hint;
992 const char *hint_string;
997 godot_instance_method method;
999 godot_method_rpc_mode rpc_type;
1011 godot_property_hint hint;
1012 const char *hint_string;
1013 godot_variant default_value;
1019 int num_default_args;
1027 godot_instance_create_func create;
1028 godot_instance_destroy_func destroy;
1047#define hgdn_properties(...) ((hgdn_property_info[]){ __VA_ARGS__, {} })
1049#define hgdn_methods(...) ((hgdn_method_info[]){ __VA_ARGS__, {} })
1051#define hgdn_method_arguments(...) ((hgdn_method_argument_info[]){ __VA_ARGS__, {} })
1053#define hgdn_signals(...) ((hgdn_signal_info[]){ __VA_ARGS__, {} })
1055#define hgdn_signal_arguments(...) ((hgdn_signal_argument_info[]){ __VA_ARGS__, {} })
1057HGDN_DECL
void hgdn_register_class(
void *gdnative_handle,
const hgdn_class_info *class_info);
1062#define hgdn_instance_create_func_alloc(ctype) ((const godot_instance_create_func){ &hgdn_instance_alloc, (void *) sizeof(ctype) })
1066#define hgdn_instance_destroy_func_free() ((const godot_instance_destroy_func){ &hgdn_instance_free })
1068HGDN_DECL godot_variant *hgdn_property_constant_alloc(godot_variant value);
1069HGDN_DECL
void hgdn_property_constant_free(
void *value);
1070HGDN_DECL godot_variant hgdn_property_constant_get(godot_object *instance,
void *value,
void *data);
1072#define hgdn_property_constant(value) ((const godot_property_get_func){ &hgdn_property_constant_get, (void *) hgdn_property_constant_alloc(hgdn_new_variant((value))), &hgdn_property_constant_free })
1084#ifdef HGDN_IMPLEMENTATION
1090const godot_gdnative_core_api_struct *hgdn_core_api;
1091#ifndef HGDN_NO_CORE_1_1
1092const godot_gdnative_core_1_1_api_struct *hgdn_core_1_1_api;
1094#ifndef HGDN_NO_CORE_1_2
1095const godot_gdnative_core_1_2_api_struct *hgdn_core_1_2_api;
1097#ifndef HGDN_NO_CORE_1_3
1098const godot_gdnative_core_1_3_api_struct *hgdn_core_1_3_api;
1100#ifndef HGDN_NO_EXT_NATIVESCRIPT
1101const godot_gdnative_ext_nativescript_api_struct *hgdn_nativescript_api;
1102const godot_gdnative_ext_nativescript_1_1_api_struct *hgdn_nativescript_1_1_api;
1104#ifndef HGDN_NO_EXT_PLUGINSCRIPT
1105const godot_gdnative_ext_pluginscript_api_struct *hgdn_pluginscript_api;
1107#ifndef HGDN_NO_EXT_ANDROID
1108const godot_gdnative_ext_android_api_struct *hgdn_android_api;
1110#ifndef HGDN_NO_EXT_ARVR
1111const godot_gdnative_ext_arvr_api_struct *hgdn_arvr_api;
1112const godot_gdnative_ext_arvr_1_2_api_struct *hgdn_arvr_1_2_api;
1114#ifndef HGDN_NO_EXT_VIDEOCODER
1115const godot_gdnative_ext_videodecoder_api_struct *hgdn_videodecoder_api;
1117#ifndef HGDN_NO_EXT_NET
1118const godot_gdnative_ext_net_api_struct *hgdn_net_api;
1119const godot_gdnative_ext_net_3_2_api_struct *hgdn_net_3_2_api;
1122godot_method_bind *hgdn_method_Object_callv;
1124static char hgdn__format_string_buffer[HGDN_STRING_FORMAT_BUFFER_SIZE];
1125#define HGDN__FILL_FORMAT_BUFFER(fmt, ...) \
1127 va_start(args, fmt); \
1128 godot_int size = vsnprintf(hgdn__format_string_buffer, HGDN_STRING_FORMAT_BUFFER_SIZE, fmt, args); \
1129 if (size > HGDN_STRING_FORMAT_BUFFER_SIZE) { \
1130 size = HGDN_STRING_FORMAT_BUFFER_SIZE; \
1134static godot_array hgdn__empty_array;
1137void hgdn_gdnative_init(
const godot_gdnative_init_options *options) {
1139 hgdn_core_api = options->api_struct;
1140 for (
const godot_gdnative_api_struct *ext = hgdn_core_api->next; ext; ext = ext->next) {
1141#ifndef HGDN_NO_CORE_1_1
1142 if (ext->version.major == 1 && ext->version.minor == 1) {
1143 hgdn_core_1_1_api = (
const godot_gdnative_core_1_1_api_struct *) ext;
1146#ifndef HGDN_NO_CORE_1_2
1147 if (ext->version.major == 1 && ext->version.minor == 2) {
1148 hgdn_core_1_2_api = (
const godot_gdnative_core_1_2_api_struct *) ext;
1151#ifndef HGDN_NO_CORE_1_3
1152 if (ext->version.major == 1 && ext->version.minor == 3) {
1153 hgdn_core_1_3_api = (
const godot_gdnative_core_1_3_api_struct *) ext;
1158 for (
unsigned int i = 0; i < hgdn_core_api->num_extensions; i++) {
1159 switch(hgdn_core_api->extensions[i]->type) {
1160#ifndef HGDN_NO_EXT_NATIVESCRIPT
1161 case GDNATIVE_EXT_NATIVESCRIPT:
1162 hgdn_nativescript_api = (
const godot_gdnative_ext_nativescript_api_struct *) hgdn_core_api->extensions[i];
1163 for (
const godot_gdnative_api_struct *ext = hgdn_nativescript_api->next; ext; ext = ext->next) {
1164 if (ext->version.major == 1 && ext->version.minor == 1) {
1165 hgdn_nativescript_1_1_api = (
const godot_gdnative_ext_nativescript_1_1_api_struct *) ext;
1170#ifndef HGDN_NO_EXT_PLUGINSCRIPT
1171 case GDNATIVE_EXT_PLUGINSCRIPT:
1172 hgdn_pluginscript_api = (
const godot_gdnative_ext_pluginscript_api_struct *) hgdn_core_api->extensions[i];
1175#ifndef HGDN_NO_EXT_ANDROID
1176 case GDNATIVE_EXT_ANDROID:
1177 hgdn_android_api = (
const godot_gdnative_ext_android_api_struct *) hgdn_core_api->extensions[i];
1180#ifndef HGDN_NO_EXT_ARVR
1181 case GDNATIVE_EXT_ARVR:
1182 hgdn_arvr_api = (
const godot_gdnative_ext_arvr_api_struct *) hgdn_core_api->extensions[i];
1183 for (
const godot_gdnative_api_struct *ext = hgdn_arvr_api->next; ext; ext = ext->next) {
1184 if (ext->version.major == 1 && ext->version.minor == 2) {
1185 hgdn_arvr_1_2_api = (
const godot_gdnative_ext_arvr_1_2_api_struct *) ext;
1190#ifndef HGDN_NO_EXT_VIDEOCODER
1191 case GDNATIVE_EXT_VIDEODECODER:
1192 hgdn_videodecoder_api = (
const godot_gdnative_ext_videodecoder_api_struct *) hgdn_core_api->extensions[i];
1195#ifndef HGDN_NO_EXT_NET
1196 case GDNATIVE_EXT_NET:
1197 hgdn_net_api = (
const godot_gdnative_ext_net_api_struct *) hgdn_core_api->extensions[i];
1198 for (
const godot_gdnative_api_struct *ext = hgdn_net_api->next; ext; ext = ext->next) {
1199 if (ext->version.major == 3 && ext->version.minor == 2) {
1200 hgdn_net_3_2_api = (
const godot_gdnative_ext_net_3_2_api_struct *) ext;
1210 hgdn_method_Object_callv = hgdn_core_api->godot_method_bind_get_method(
"Object",
"callv");
1211 hgdn_core_api->godot_array_new(&hgdn__empty_array);
1214void hgdn_gdnative_terminate(
const godot_gdnative_terminate_options *options) {
1215 hgdn_core_api->godot_array_destroy(&hgdn__empty_array);
1220 return hgdn_core_api->godot_alloc(size);
1224 return hgdn_core_api->godot_realloc(ptr, size);
1229 hgdn_core_api->godot_free(ptr);
1234void hgdn_print(
const char *fmt, ...) {
1235 HGDN__FILL_FORMAT_BUFFER(fmt, ...);
1236 godot_string str = hgdn_new_string_with_len(hgdn__format_string_buffer, size);
1237 hgdn_core_api->godot_print(&str);
1238 hgdn_core_api->godot_string_destroy(&str);
1241void hgdn_print_warning(
const char *funcname,
const char *filename,
int line,
const char *fmt, ...) {
1242 HGDN__FILL_FORMAT_BUFFER(fmt, ...);
1243 hgdn_core_api->godot_print_warning(hgdn__format_string_buffer, funcname, filename, line);
1246void hgdn_print_error(
const char *funcname,
const char *filename,
int line,
const char *fmt, ...) {
1247 HGDN__FILL_FORMAT_BUFFER(fmt, ...);
1248 hgdn_core_api->godot_print_error(hgdn__format_string_buffer, funcname, filename, line);
1252godot_string hgdn_new_wide_string(
const wchar_t *wstr) {
1254 hgdn_core_api->godot_string_new_with_wide_string(&str, wstr, -1);
1258godot_string hgdn_new_wide_string_with_len(
const wchar_t *wstr,
const godot_int len) {
1260 hgdn_core_api->godot_string_new_with_wide_string(&str, wstr, len);
1264godot_string hgdn_new_string(
const char *cstr) {
1265 return hgdn_core_api->godot_string_chars_to_utf8(cstr);
1268godot_string hgdn_new_string_with_len(
const char *cstr,
const godot_int len) {
1269 return hgdn_core_api->godot_string_chars_to_utf8_with_len(cstr, len);
1273 HGDN__FILL_FORMAT_BUFFER(fmt, ...);
1274 return hgdn_new_string_with_len(hgdn__format_string_buffer, size);
1278#define HGDN_DECLARE_NEW_POOL_ARRAY_FUNC(kind, ctype) \
1279 godot_pool_##kind##_array hgdn_new_##kind##_array(const ctype *buffer, const godot_int size) { \
1280 godot_pool_##kind##_array array; \
1281 hgdn_core_api->godot_pool_##kind##_array_new(&array); \
1282 hgdn_core_api->godot_pool_##kind##_array_resize(&array, size); \
1283 godot_pool_##kind##_array_write_access *write = hgdn_core_api->godot_pool_##kind##_array_write(&array); \
1284 memcpy(hgdn_core_api->godot_pool_##kind##_array_write_access_ptr(write), buffer, size * sizeof(ctype)); \
1285 hgdn_core_api->godot_pool_##kind##_array_write_access_destroy(write); \
1289HGDN_DECLARE_NEW_POOL_ARRAY_FUNC(
byte, uint8_t)
1290HGDN_DECLARE_NEW_POOL_ARRAY_FUNC(
int, godot_int)
1291HGDN_DECLARE_NEW_POOL_ARRAY_FUNC(real, godot_real)
1294HGDN_DECLARE_NEW_POOL_ARRAY_FUNC(color,
godot_color)
1297 godot_pool_string_array array;
1298 hgdn_core_api->godot_pool_string_array_new(&array);
1299 hgdn_core_api->godot_pool_string_array_resize(&array, size);
1300 for (godot_int i = 0; i < size; i++) {
1301 godot_string str = hgdn_core_api->godot_string_chars_to_utf8(buffer[i]);
1302 hgdn_core_api->godot_pool_string_array_set(&array, i, &str);
1303 hgdn_core_api->godot_string_destroy(&str);
1308#undef HGDN_DECLARE_NEW_POOL_ARRAY_FUNC
1310godot_array hgdn_new_array(
const godot_variant *
const *buffer,
const godot_int size) {
1312 hgdn_core_api->godot_array_new(&array);
1313 hgdn_core_api->godot_array_resize(&array, size);
1314 for (godot_int i = 0; i < size; i++) {
1315 hgdn_core_api->godot_array_set(&array, i, buffer[i]);
1322 hgdn_core_api->godot_array_new(&array);
1323 hgdn_core_api->godot_array_resize(&array, size);
1324 for (godot_int i = 0; i < size; i++) {
1325 godot_variant *var = &buffer[i];
1326 hgdn_core_api->godot_array_set(&array, i, var);
1327 hgdn_core_api->godot_variant_destroy(var);
1334 godot_dictionary dict;
1335 hgdn_core_api->godot_dictionary_new(&dict);
1336 for (godot_int i = 0; i < size; i++) {
1337 hgdn_core_api->godot_dictionary_set(&dict, buffer[i].key, buffer[i].value);
1343 godot_dictionary dict;
1344 hgdn_core_api->godot_dictionary_new(&dict);
1345 for (godot_int i = 0; i < size; i++) {
1346 godot_variant key = hgdn_new_string_variant_own(hgdn_new_string(buffer[i].key));
1347 hgdn_core_api->godot_dictionary_set(&dict, &key, buffer[i].value);
1348 hgdn_core_api->godot_variant_destroy(&key);
1354 godot_dictionary dict;
1355 hgdn_core_api->godot_dictionary_new(&dict);
1356 for (godot_int i = 0; i < size; i++) {
1357 godot_variant key = hgdn_new_string_variant_own(hgdn_new_string(buffer[i].key));
1358 godot_variant value = hgdn_new_int_variant(buffer[i].value);
1359 hgdn_core_api->godot_dictionary_set(&dict, &key, &value);
1360 hgdn_core_api->godot_variant_destroy(&key);
1361 hgdn_core_api->godot_variant_destroy(&value);
1367 godot_dictionary dict;
1368 hgdn_core_api->godot_dictionary_new(&dict);
1369 for (godot_int i = 0; i < size; i++) {
1370 godot_variant key = hgdn_new_string_variant_own(hgdn_new_string(buffer[i].key));
1371 godot_variant value = hgdn_new_string_variant_own(hgdn_new_string(buffer[i].value));
1372 hgdn_core_api->godot_dictionary_set(&dict, &key, &value);
1373 hgdn_core_api->godot_variant_destroy(&key);
1374 hgdn_core_api->godot_variant_destroy(&value);
1380 godot_dictionary dict;
1381 hgdn_core_api->godot_dictionary_new(&dict);
1382 for (godot_int i = 0; i < size; i++) {
1383 hgdn_core_api->godot_dictionary_set(&dict, &buffer[i].key, &buffer[i].value);
1384 hgdn_core_api->godot_variant_destroy(&buffer[i].key);
1385 hgdn_core_api->godot_variant_destroy(&buffer[i].value);
1391 godot_dictionary dict;
1392 hgdn_core_api->godot_dictionary_new(&dict);
1393 for (godot_int i = 0; i < size; i++) {
1394 godot_variant key = hgdn_new_string_variant_own(hgdn_new_string(buffer[i].key));
1395 hgdn_core_api->godot_dictionary_set(&dict, &key, &buffer[i].value);
1396 hgdn_core_api->godot_variant_destroy(&key);
1397 hgdn_core_api->godot_variant_destroy(&buffer[i].value);
1404 godot_string new_str;
1405 hgdn_core_api->godot_string_new_copy(&new_str, str);
1406 return hgdn_wide_string_get_own(new_str);
1412 hgdn_core_api->godot_string_wide_str(&str),
1413 hgdn_core_api->godot_string_length(&str),
1419 hgdn_core_api->godot_string_destroy(&str->gd_string);
1422hgdn_string hgdn_string_get(
const godot_string *str) {
1423 godot_char_string char_string = hgdn_core_api->godot_string_utf8(str);
1426 hgdn_core_api->godot_char_string_get_data(&char_string),
1427 hgdn_core_api->godot_char_string_length(&char_string),
1432hgdn_string hgdn_string_get_own(godot_string str) {
1434 hgdn_core_api->godot_string_destroy(&str);
1439 hgdn_core_api->godot_char_string_destroy(&str->gd_char_string);
1443#define HGDN_DECLARE_POOL_ARRAY_API(kind, ctype) \
1444 hgdn_##kind##_array hgdn_##kind##_array_get(const godot_pool_##kind##_array *array) { \
1445 godot_pool_##kind##_array_read_access *access = hgdn_core_api->godot_pool_##kind##_array_read(array); \
1446 hgdn_##kind##_array wrapper = { \
1448 hgdn_core_api->godot_pool_##kind##_array_read_access_ptr(access), \
1449 hgdn_core_api->godot_pool_##kind##_array_size(array), \
1453 hgdn_##kind##_array hgdn_##kind##_array_get_own(godot_pool_##kind##_array array) { \
1454 hgdn_##kind##_array result = hgdn_##kind##_array_get(&array); \
1455 hgdn_core_api->godot_pool_##kind##_array_destroy(&array); \
1458 void hgdn_##kind##_array_destroy(hgdn_##kind##_array *array) { \
1459 hgdn_core_api->godot_pool_##kind##_array_read_access_destroy(array->gd_read_access); \
1462HGDN_DECLARE_POOL_ARRAY_API(
byte, uint8_t)
1463HGDN_DECLARE_POOL_ARRAY_API(
int, godot_int)
1464HGDN_DECLARE_POOL_ARRAY_API(real, godot_real)
1469#undef HGDN_DECLARE_POOL_ARRAY_API
1472 godot_int size = hgdn_core_api->godot_pool_string_array_size(array);
1473 godot_pool_string_array_read_access *access = hgdn_core_api->godot_pool_string_array_read(array);
1478 if ((wrapper.ptr = (
const char **)
hgdn_alloc(size *
sizeof(
char *))) == NULL) {
1482 wrapper.size = size;
1483 const godot_string *gd_strings = hgdn_core_api->godot_pool_string_array_read_access_ptr(access);
1484 for (godot_int i = 0; i < size; i++) {
1485 hgdn_string str = hgdn_string_get(&gd_strings[i]);
1486 wrapper.strings[i] = str;
1487 wrapper.ptr[i] = str.ptr;
1489 hgdn_core_api->godot_pool_string_array_read_access_destroy(access);
1495 hgdn_core_api->godot_pool_string_array_destroy(&array);
1500 for (godot_int i = 0; i < array->size; i++) {
1501 hgdn_string_destroy(&array->strings[i]);
1508#define HGDN_DECLARE_VARIANT_GET(kind, ctype) \
1509 ctype hgdn_variant_get_##kind(const godot_variant *var) { \
1510 return hgdn_core_api->godot_variant_as_##kind(var); \
1512#define HGDN_DECLARE_VARIANT_GET_OWN(kind, ctype) \
1513 ctype hgdn_variant_get_##kind##_own(godot_variant var) { \
1514 ctype result = hgdn_variant_get_##kind(&var); \
1515 hgdn_core_api->godot_variant_destroy(&var); \
1518#define HGDN_DECLARE_ARRAY_GET(kind, ctype) \
1519 ctype hgdn_array_get_##kind(const godot_array *array, const godot_int index) { \
1520 return hgdn_variant_get_##kind(hgdn_core_api->godot_array_operator_index_const(array, index)); \
1522#define HGDN_DECLARE_ARGS_GET(kind, ctype) \
1523 ctype hgdn_args_get_##kind(godot_variant **args, const godot_int index) { \
1524 return hgdn_variant_get_##kind(args[index]); \
1526#define HGDN_DECLARE_DICTIONARY_GET(kind, ctype) \
1527 ctype hgdn_dictionary_get_##kind(const godot_dictionary *dict, const godot_variant *key) { \
1528 return hgdn_variant_get_##kind(hgdn_core_api->godot_dictionary_operator_index_const(dict, key)); \
1530 ctype hgdn_dictionary_string_get_##kind(const godot_dictionary *dict, const char *key) { \
1531 godot_variant key_var = hgdn_new_cstring_variant(key); \
1532 ctype value = hgdn_dictionary_get_##kind(dict, &key_var); \
1533 hgdn_core_api->godot_variant_destroy(&key_var); \
1537HGDN_DECLARE_VARIANT_GET(
bool, godot_bool)
1538HGDN_DECLARE_VARIANT_GET_OWN(
bool, godot_bool)
1539HGDN_DECLARE_ARRAY_GET(
bool, godot_bool)
1540HGDN_DECLARE_ARGS_GET(
bool, godot_bool)
1541HGDN_DECLARE_DICTIONARY_GET(
bool, godot_bool)
1543#define HGDN_DECLARE_VARIANT_API(kind, ctype) \
1544 HGDN_DECLARE_VARIANT_GET(kind, ctype) \
1545 HGDN_DECLARE_VARIANT_GET_OWN(kind, ctype) \
1546 HGDN_DECLARE_ARRAY_GET(kind, ctype) \
1547 HGDN_DECLARE_ARGS_GET(kind, ctype) \
1548 HGDN_DECLARE_DICTIONARY_GET(kind, ctype)
1550HGDN_DECLARE_VARIANT_API(uint, uint64_t)
1551HGDN_DECLARE_VARIANT_API(
int, int64_t)
1552HGDN_DECLARE_VARIANT_API(real,
double)
1563HGDN_DECLARE_VARIANT_API(node_path, godot_node_path)
1564HGDN_DECLARE_VARIANT_API(rid, godot_rid)
1565HGDN_DECLARE_VARIANT_API(
object, godot_object *)
1566HGDN_DECLARE_VARIANT_API(dictionary, godot_dictionary)
1567HGDN_DECLARE_VARIANT_API(array, godot_array)
1569#undef HGDN_DECLARE_VARIANT_GET
1571hgdn_string hgdn_variant_get_string(
const godot_variant *var) {
1572 return hgdn_string_get_own(hgdn_core_api->godot_variant_as_string(var));
1580 return hgdn_wide_string_get_own(hgdn_core_api->godot_variant_as_string(var));
1587#define HGDN_DECLARE_VARIANT_GET_POOL_ARRAY(kind, ctype) \
1588 ctype hgdn_variant_get_##kind(const godot_variant *var) { \
1589 return hgdn_##kind##_get_own(hgdn_core_api->godot_variant_as_pool_##kind(var)); \
1591 HGDN_DECLARE_VARIANT_GET_OWN(kind, ctype) \
1592 HGDN_DECLARE_ARRAY_GET(kind, ctype) \
1593 HGDN_DECLARE_ARGS_GET(kind, ctype) \
1594 HGDN_DECLARE_DICTIONARY_GET(kind, ctype)
1604#undef HGDN_DECLARE_VARIANT_GET_POOL_ARRAY
1606#undef HGDN_DECLARE_DICTIONARY_GET
1607#undef HGDN_DECLARE_ARGS_GET
1608#undef HGDN_DECLARE_ARRAY_GET
1609#undef HGDN_DECLARE_VARIANT_GET_OWN
1612godot_variant hgdn_object_callv(godot_object *instance,
const char *method,
const godot_array *args_array) {
1614 args_array = &hgdn__empty_array;
1616 godot_variant result;
1617 godot_string method_str = hgdn_new_string(method);
1618 const void *args[] = { &method_str, args_array };
1619 hgdn_core_api->godot_method_bind_ptrcall(hgdn_method_Object_callv, instance, args, &result);
1620 hgdn_core_api->godot_string_destroy(&method_str);
1624godot_variant hgdn_object_callv_own(godot_object *instance,
const char *method, godot_array args) {
1625 godot_variant result = hgdn_object_callv(instance, method, &args);
1626 hgdn_core_api->godot_array_destroy(&args);
1631godot_variant hgdn_new_variant_copy(
const godot_variant *value) {
1633 hgdn_core_api->godot_variant_new_copy(&var, value);
1637godot_variant hgdn_new_nil_variant() {
1639 hgdn_core_api->godot_variant_new_nil(&var);
1643#define HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(kind, ctype) \
1644 godot_variant hgdn_new_##kind##_variant(const ctype value) { \
1645 godot_variant var; \
1646 hgdn_core_api->godot_variant_new_##kind(&var, value); \
1650HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(
bool, godot_bool)
1651HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(uint, uint64_t)
1652HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(
int, int64_t)
1653HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(real,
double)
1654HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(
string, godot_string *)
1655HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(dictionary, godot_dictionary *)
1656HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(array, godot_array *)
1657HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_byte_array, godot_pool_byte_array *)
1658HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_int_array, godot_pool_int_array *)
1659HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_real_array, godot_pool_real_array *)
1660HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_vector2_array, godot_pool_vector2_array *)
1661HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_vector3_array, godot_pool_vector3_array *)
1662HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_color_array, godot_pool_color_array *)
1663HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(pool_string_array, godot_pool_string_array *)
1664HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(node_path, godot_node_path *)
1665HGDN_DECLARE_NEW_PRIMITIVE_VARIANT(rid, godot_rid *)
1667#undef HGDN_DECLARE_NEW_PRIMITIVE_VARIANT
1669godot_variant hgdn_new_object_variant(
const godot_object *value) {
1672 hgdn_core_api->godot_variant_new_object(&var, value);
1675 hgdn_core_api->godot_variant_new_nil(&var);
1680godot_variant hgdn_new_cstring_variant(
const char *value) {
1681 return hgdn_new_string_variant_own(hgdn_new_string(value));
1684godot_variant hgdn_new_wide_string_variant(
const wchar_t *value) {
1685 return hgdn_new_string_variant_own(hgdn_new_wide_string(value));
1688#define HGDN_DECLARE_NEW_COMPOUND_VARIANT(kind, ctype) \
1689 godot_variant hgdn_new_##kind##_variant(const ctype value) { \
1690 godot_variant var; \
1691 hgdn_core_api->godot_variant_new_##kind(&var, &value); \
1697HGDN_DECLARE_NEW_COMPOUND_VARIANT(rect2,
godot_rect2)
1698HGDN_DECLARE_NEW_COMPOUND_VARIANT(plane,
godot_plane)
1699HGDN_DECLARE_NEW_COMPOUND_VARIANT(quat,
godot_quat)
1700HGDN_DECLARE_NEW_COMPOUND_VARIANT(aabb,
godot_aabb)
1701HGDN_DECLARE_NEW_COMPOUND_VARIANT(basis,
godot_basis)
1704HGDN_DECLARE_NEW_COMPOUND_VARIANT(color,
godot_color)
1706#undef HGDN_DECLARE_NEW_COMPOUND_VARIANT
1708#define HGDN_DECLARE_NEW_OWNED_VARIANT(kind, ctype) \
1709 godot_variant hgdn_new_##kind##_variant_own(ctype value) { \
1710 godot_variant var; \
1711 hgdn_core_api->godot_variant_new_##kind(&var, &value); \
1712 hgdn_core_api->ctype##_destroy(&value); \
1716HGDN_DECLARE_NEW_OWNED_VARIANT(
string, godot_string)
1717HGDN_DECLARE_NEW_OWNED_VARIANT(dictionary, godot_dictionary)
1718HGDN_DECLARE_NEW_OWNED_VARIANT(array, godot_array)
1719HGDN_DECLARE_NEW_OWNED_VARIANT(pool_byte_array, godot_pool_byte_array)
1720HGDN_DECLARE_NEW_OWNED_VARIANT(pool_int_array, godot_pool_int_array)
1721HGDN_DECLARE_NEW_OWNED_VARIANT(pool_real_array, godot_pool_real_array)
1722HGDN_DECLARE_NEW_OWNED_VARIANT(pool_vector2_array, godot_pool_vector2_array)
1723HGDN_DECLARE_NEW_OWNED_VARIANT(pool_vector3_array, godot_pool_vector3_array)
1724HGDN_DECLARE_NEW_OWNED_VARIANT(pool_color_array, godot_pool_color_array)
1725HGDN_DECLARE_NEW_OWNED_VARIANT(pool_string_array, godot_pool_string_array)
1726HGDN_DECLARE_NEW_OWNED_VARIANT(node_path, godot_node_path)
1728#undef HGDN_DECLARE_NEW_OWNED_VARIANT
1731godot_variant
hgdn_new_variant(
const godot_bool value) {
return hgdn_new_bool_variant(value); }
1732godot_variant
hgdn_new_variant(
const unsigned int value) {
return hgdn_new_uint_variant(value); }
1733godot_variant
hgdn_new_variant(
const uint64_t value) {
return hgdn_new_uint_variant(value); }
1734godot_variant
hgdn_new_variant(
const int value) {
return hgdn_new_int_variant(value); }
1735godot_variant
hgdn_new_variant(
const int64_t value) {
return hgdn_new_int_variant(value); }
1736godot_variant
hgdn_new_variant(
const double value) {
return hgdn_new_real_variant(value); }
1737godot_variant
hgdn_new_variant(
const godot_string *value) {
return hgdn_new_string_variant(value); }
1738godot_variant
hgdn_new_variant(
const char *value) {
return hgdn_new_cstring_variant(value); }
1739godot_variant
hgdn_new_variant(
const wchar_t *value) {
return hgdn_new_wide_string_variant(value); }
1750godot_variant
hgdn_new_variant(
const godot_node_path *value) {
return hgdn_new_node_path_variant(value); }
1751godot_variant
hgdn_new_variant(
const godot_rid *value) {
return hgdn_new_rid_variant(value); }
1752godot_variant
hgdn_new_variant(
const godot_object *value) {
return hgdn_new_object_variant(value); }
1753godot_variant
hgdn_new_variant(
const godot_dictionary *value) {
return hgdn_new_dictionary_variant(value); }
1754godot_variant
hgdn_new_variant(
const godot_array *value) {
return hgdn_new_array_variant(value); }
1755godot_variant
hgdn_new_variant(
const godot_pool_byte_array *value) {
return hgdn_new_pool_byte_array_variant(value); }
1756godot_variant
hgdn_new_variant(
const godot_pool_int_array *value) {
return hgdn_new_pool_int_array_variant(value); }
1757godot_variant
hgdn_new_variant(
const godot_pool_real_array *value) {
return hgdn_new_pool_real_array_variant(value); }
1758godot_variant
hgdn_new_variant(
const godot_pool_vector2_array *value) {
return hgdn_new_pool_vector2_array_variant(value); }
1759godot_variant
hgdn_new_variant(
const godot_pool_vector3_array *value) {
return hgdn_new_pool_vector3_array_variant(value); }
1760godot_variant
hgdn_new_variant(
const godot_pool_color_array *value) {
return hgdn_new_pool_color_array_variant(value); }
1761godot_variant
hgdn_new_variant(
const godot_pool_string_array *value) {
return hgdn_new_pool_string_array_variant(value); }
1762godot_variant
hgdn_new_variant(godot_string value) {
return hgdn_new_string_variant_own(value); }
1763godot_variant
hgdn_new_variant(godot_node_path value) {
return hgdn_new_node_path_variant_own(value); }
1764godot_variant
hgdn_new_variant(godot_dictionary value) {
return hgdn_new_dictionary_variant_own(value); }
1765godot_variant
hgdn_new_variant(godot_array value) {
return hgdn_new_array_variant_own(value); }
1766godot_variant
hgdn_new_variant(godot_pool_byte_array value) {
return hgdn_new_pool_byte_array_variant_own(value); }
1767godot_variant
hgdn_new_variant(godot_pool_int_array value) {
return hgdn_new_pool_int_array_variant_own(value); }
1768godot_variant
hgdn_new_variant(godot_pool_real_array value) {
return hgdn_new_pool_real_array_variant_own(value); }
1769godot_variant
hgdn_new_variant(godot_pool_vector2_array value) {
return hgdn_new_pool_vector2_array_variant_own(value); }
1770godot_variant
hgdn_new_variant(godot_pool_vector3_array value) {
return hgdn_new_pool_vector3_array_variant_own(value); }
1771godot_variant
hgdn_new_variant(godot_pool_color_array value) {
return hgdn_new_pool_color_array_variant_own(value); }
1772godot_variant
hgdn_new_variant(godot_pool_string_array value) {
return hgdn_new_pool_string_array_variant_own(value); }
1773godot_variant
hgdn_new_variant(
const godot_variant *value) {
return hgdn_new_variant_copy(value); }
1774HGDN_CONSTEXPR godot_variant
hgdn_new_variant(godot_variant value) {
return value; }
1775#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1776godot_variant hgdn__variant_return(godot_variant value) {
return value; }
1780#ifndef HGDN_NO_EXT_NATIVESCRIPT
1781void hgdn_register_class(
void *handle,
const hgdn_class_info *class_info) {
1782 if (class_info->tool) {
1783 hgdn_nativescript_api->godot_nativescript_register_tool_class(handle, class_info->name, class_info->base, class_info->create, class_info->destroy);
1786 hgdn_nativescript_api->godot_nativescript_register_class(handle, class_info->name, class_info->base, class_info->create, class_info->destroy);
1789 if (hgdn_nativescript_1_1_api && class_info->
documentation) {
1790 godot_string documentation = hgdn_new_string(class_info->
documentation);
1791 hgdn_nativescript_1_1_api->godot_nativescript_set_class_documentation(handle, class_info->name, documentation);
1792 hgdn_core_api->godot_string_destroy(&documentation);
1797 godot_property_attributes attr = {
1798 property->rset_type,
1801 hgdn_new_string(property->hint_string),
1803 property->default_value,
1805 hgdn_nativescript_api->godot_nativescript_register_property(handle, class_info->name, property->path, &attr, property->setter, property->getter);
1806 hgdn_core_api->godot_string_destroy(&attr.hint_string);
1807 if (hgdn_nativescript_1_1_api && property->documentation) {
1808 godot_string documentation = hgdn_new_string(property->documentation);
1809 hgdn_nativescript_1_1_api->godot_nativescript_set_property_documentation(handle, class_info->name, property->path, documentation);
1810 hgdn_core_api->godot_string_destroy(&documentation);
1817 godot_method_attributes attr = { method->rpc_type };
1818 hgdn_nativescript_api->godot_nativescript_register_method(handle, class_info->name, method->name, attr, method->method);
1819 if (hgdn_nativescript_1_1_api) {
1820 if (method->documentation) {
1821 godot_string documentation = hgdn_new_string(method->documentation);
1822 hgdn_nativescript_1_1_api->godot_nativescript_set_method_documentation(handle, class_info->name, method->name, documentation);
1823 hgdn_core_api->godot_string_destroy(&documentation);
1825 if (method->arguments_info) {
1826 godot_method_arg gd_args[HGDN_METHOD_ARGUMENTS_INFO_MAX];
1829 gd_args[num_args] = (godot_method_arg){
1830 hgdn_new_string(argument->name),
1833 hgdn_new_string(argument->hint_string),
1837 hgdn_nativescript_1_1_api->godot_nativescript_set_method_argument_information(handle, class_info->name, method->name, num_args, gd_args);
1838 for (
int i = 0; i < num_args; i++) {
1839 hgdn_core_api->godot_string_destroy(&gd_args[i].name);
1840 hgdn_core_api->godot_string_destroy(&gd_args[i].hint_string);
1849 godot_signal_argument gd_args[HGDN_METHOD_ARGUMENTS_INFO_MAX];
1852 gd_args[num_args] = (godot_signal_argument){
1853 hgdn_new_string(argument->name),
1856 hgdn_new_string(argument->hint_string),
1857 (godot_property_usage_flags) 0,
1858 argument->default_value,
1862 godot_string signal_name = hgdn_new_string(signal->name);
1863 godot_signal gd_signal = {
1867 signal->num_default_args,
1870 hgdn_nativescript_api->godot_nativescript_register_signal(handle, class_info->name, &gd_signal);
1871 hgdn_core_api->godot_string_destroy(&signal_name);
1872 for (
int i = 0; i < num_args; i++) {
1873 hgdn_core_api->godot_string_destroy(&gd_args[i].name);
1874 hgdn_core_api->godot_string_destroy(&gd_args[i].hint_string);
1876 if (hgdn_nativescript_1_1_api && signal->documentation) {
1877 godot_string documentation = hgdn_new_string(signal->documentation);
1878 hgdn_nativescript_1_1_api->godot_nativescript_set_signal_documentation(handle, class_info->name, signal->name, documentation);
1879 hgdn_core_api->godot_string_destroy(&documentation);
1886 void *buffer =
hgdn_alloc((uintptr_t) alloc_size);
1888 memset(buffer, 0, (uintptr_t) alloc_size);
1897godot_variant *hgdn_property_constant_alloc(godot_variant value) {
1898 godot_variant *buffer = (godot_variant *)
hgdn_alloc(
sizeof(godot_variant));
1905void hgdn_property_constant_free(
void *value) {
1907 hgdn_core_api->godot_variant_destroy((godot_variant *) value);
1908 hgdn_core_api->godot_free(value);
1912godot_variant hgdn_property_constant_get(godot_object *instance,
void *value,
void *data) {
1913 return hgdn_new_variant_copy((
const godot_variant *) value);
1917#undef HGDN__FILL_FORMAT_BUFFER
#define hgdn_new_array_args(...)
Definition: hgdn.h:895
HGDN_DECL godot_pool_string_array hgdn_new_string_array(const char *const *buffer, const godot_int size)
HGDN_DECL godot_array hgdn_new_array_own(godot_variant *buffer, const godot_int size)
hgdn_vector4 godot_color
Color is present on Pool Arrays and as MultiMesh instance data, so it's convenient having a full vect...
Definition: hgdn.h:183
godot_object * hgdn_library
GDNativeLibrary object being initialized.
HGDN_DECL void hgdn_free(void *ptr)
Compatible with free. It is safe to pass NULL without triggering an error message.
HGDN_DECL void * hgdn_alloc(size_t size)
Compatible with malloc
HGDN_DECL void * hgdn_realloc(void *ptr, size_t size)
Compatible with realloc
HGDN_DECL void * hgdn_instance_alloc(godot_object *instance, void *alloc_size)
Function that allocates and returns zero-initialized alloc_size bytes, to be used as instance create ...
HGDN_DECL void hgdn_instance_free(godot_object *instance, void *method_data, void *data)
Function that frees data with hgdn_free, to be used as instance destroy function.
#define hgdn_new_variant(value)
Overloaded function/macro for creating Variants from any values. Available in C++ and C11.
Definition: hgdn.h:765
#define hgdn_object_call(instance, method,...)
Definition: hgdn.h:964
HGDN_DECL godot_string hgdn_new_formatted_string(const char *fmt,...)
hgdn_method_info * methods
NULL-terminated array of methods.
Definition: hgdn.h:1036
hgdn_property_info * properties
NULL-terminated array of properties.
Definition: hgdn.h:1032
const char * documentation
NativeScript 1.1 documentation.
Definition: hgdn.h:1043
hgdn_signal_info * signals
NULL-terminated array of signals.
Definition: hgdn.h:1040
hgdn_method_argument_info * arguments_info
NULL-terminated array of argument info.
Definition: hgdn.h:1005
const char * documentation
NativeScript 1.1 documentation.
Definition: hgdn.h:1001
const char * documentation
NativeScript 1.1 documentation.
Definition: hgdn.h:985
const char * documentation
NativeScript 1.1 documentation.
Definition: hgdn.h:1021