-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhgdn.h
1919 lines (1733 loc) · 100 KB
/
hgdn.h
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/** @file
* hgdn.h -- High level GDNative C/C++ API
*
* Project URL: https://github.com/gilzoide/high-level-gdnative
*
* Do this:
* ```c
* #define HGDN_IMPLEMENTATION
* ```
* before you include this file in *one* C or C++ file to create the implementation.
*
* i.e.:
* ```c
* #include ...
* #include ...
* #define HGDN_IMPLEMENTATION
* #include "hgdn.h"
* ```
*
* Optionally provide the following defines with your own implementations:
*
* - HGDN_STATIC:
* If defined and HGDN_DECL is not defined, functions will be declared `static` instead of `extern`
* - HGDN_DECL:
* Function declaration prefix (default: `extern` or `static` depending on HGDN_STATIC)
* - HGDN_STRING_FORMAT_BUFFER_SIZE:
* Size of the global char buffer used for `hgdn_print*` functions. Defaults to 1024
* - HGDN_NO_CORE_1_1:
* - HGDN_NO_CORE_1_2:
* - HGDN_NO_CORE_1_3:
* - HGDN_NO_EXT_NATIVESCRIPT:
* - HGDN_NO_EXT_PLUGINSCRIPT:
* - HGDN_NO_EXT_ANDROID:
* - HGDN_NO_EXT_ARVR:
* - HGDN_NO_EXT_VIDEOCODER:
* - HGDN_NO_EXT_NET:
* Disable global pointers to extensions. If NativeScript is disabled, its helper functions will not be available as well.
*/
#ifndef __HGDN_H__
#define __HGDN_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HGDN_DECL
#ifdef HGDN_STATIC
#define HGDN_DECL static
#else
#define HGDN_DECL extern
#endif
#endif
#ifndef HGDN_STRING_FORMAT_BUFFER_SIZE
#define HGDN_STRING_FORMAT_BUFFER_SIZE 1024
#endif
#if defined(__cplusplus) && __cplusplus >= 201103L // `constexpr` is a C++11 feature
#define HGDN_CONSTEXPR constexpr
#else
#define HGDN_CONSTEXPR
#endif
#ifndef HGDN_METHOD_ARGUMENTS_INFO_MAX
#define HGDN_METHOD_ARGUMENTS_INFO_MAX 16
#endif
// Macro magic to get the number of variable arguments
// Ref: https://groups.google.com/g/comp.std.c/c/d-6Mj5Lko_s
#define HGDN__NARG(...) HGDN__NARG_(__VA_ARGS__, HGDN__NARG_RSEQ_N())
#define HGDN__NARG_(...) HGDN__NARG_N(__VA_ARGS__)
#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
#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
// Macro magic to apply a function macro to variadic arguments
// Ref: https://stackoverflow.com/questions/6707148/foreach-macro-on-macros-arguments/13459454#13459454
#define HGDN__EVAL0(...) __VA_ARGS__
#define HGDN__EVAL1(...) HGDN__EVAL0(HGDN__EVAL0(HGDN__EVAL0(__VA_ARGS__)))
#define HGDN__EVAL2(...) HGDN__EVAL1(HGDN__EVAL1(HGDN__EVAL1(__VA_ARGS__)))
#define HGDN__EVAL3(...) HGDN__EVAL2(HGDN__EVAL2(HGDN__EVAL2(__VA_ARGS__)))
#define HGDN__EVAL4(...) HGDN__EVAL3(HGDN__EVAL3(HGDN__EVAL3(__VA_ARGS__)))
#define HGDN__EVAL(...) HGDN__EVAL4(HGDN__EVAL4(HGDN__EVAL4(__VA_ARGS__)))
#define HGDN__MAP_END(...)
#define HGDN__MAP_OUT
#define HGDN__MAP_COMMA ,
#define HGDN__MAP_GET_END() 0, HGDN__MAP_END
#define HGDN__MAP_NEXT0(item, next, ...) next HGDN__MAP_OUT
#define HGDN__MAP_NEXT1(item, next) HGDN__MAP_NEXT0(item, HGDN__MAP_COMMA next, 0)
#define HGDN__MAP_NEXT(item, next) HGDN__MAP_NEXT1(HGDN__MAP_GET_END item, next)
#define HGDN__MAP0(f, x, peek, ...) f(x) HGDN__MAP_NEXT(peek, HGDN__MAP1)(f, peek, __VA_ARGS__)
#define HGDN__MAP1(f, x, peek, ...) f(x) HGDN__MAP_NEXT(peek, HGDN__MAP0)(f, peek, __VA_ARGS__)
#define HGDN__MAP(f, ...) HGDN__EVAL(HGDN__MAP1(f, __VA_ARGS__, (), 0))
/// @defgroup custom_math_types Custom math types
/// Useful definitions for Godot math types
/// @{
typedef union hgdn_vector2 {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[2])];
// float elements
float elements[2];
// xy
struct { float x, y; };
// rg
struct { float r, g; };
// st
struct { float s, t; };
// uv
struct { float u, v; };
// Size: width/height
struct { float width, height; };
} hgdn_vector2;
#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
typedef hgdn_vector2 godot_vector2;
#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
#endif
typedef union hgdn_vector3 {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[3])];
// float elements
float elements[3];
// xyz
struct { float x, y, z; };
struct { hgdn_vector2 xy; float _0; };
struct { float _1; hgdn_vector2 yz; };
// rgb
struct { float r, g, b; };
struct { hgdn_vector2 rg; float _2; };
struct { float _3; hgdn_vector2 gb; };
// stp
struct { float s, t, p; };
struct { hgdn_vector2 st; float _6; };
struct { float _7; hgdn_vector2 tp; };
// uv
struct { float u, v, _4; };
struct { hgdn_vector2 uv; float _5; };
// 3D Size: width/height/depth
struct { float width, height, depth; };
} hgdn_vector3;
#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
typedef hgdn_vector3 godot_vector3;
#define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
#endif
typedef union hgdn_vector4 {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[4])];
// float elements
float elements[4];
// xyzw
struct { float x, y, z, w; };
struct { hgdn_vector2 xy; hgdn_vector2 zw; };
struct { float _0; hgdn_vector2 yz; float _1; };
struct { hgdn_vector3 xyz; float _2; };
struct { float _3; hgdn_vector3 yzw; };
// rgba
struct { float r, g, b, a; };
struct { hgdn_vector2 rg; hgdn_vector2 ba; };
struct { float _4; hgdn_vector2 gb; float _5; };
struct { hgdn_vector3 rgb; float _6; };
struct { float _7; hgdn_vector3 gba; };
// stpq
struct { float s, t, p, q; };
struct { hgdn_vector2 st; hgdn_vector2 pq; };
struct { float _8; hgdn_vector2 tp; float _9; };
struct { hgdn_vector3 stp; float _10; };
struct { float _11; hgdn_vector3 tpq; };
// uv
struct { float u, v; float _12[2]; };
struct { hgdn_vector2 uv; float _13[2]; };
} hgdn_vector4;
#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
/// Color is present on Pool Arrays and as MultiMesh instance data, so it's convenient having a full vector4 definition for it
typedef hgdn_vector4 godot_color;
#define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
#endif
typedef union hgdn_rect2 {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[4])];
float elements[4];
struct { float x, y, width, height; };
struct { hgdn_vector2 position; hgdn_vector2 size; };
} hgdn_rect2;
#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
typedef hgdn_rect2 godot_rect2;
#define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
#endif
typedef union hgdn_plane {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[4])];
float elements[4];
struct { hgdn_vector3 normal; float d; };
} hgdn_plane;
#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
typedef hgdn_plane godot_plane;
#define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
#endif
typedef union hgdn_quat {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[4])];
float elements[4];
struct { float x, y, z, w; };
struct { hgdn_vector2 xy; hgdn_vector2 zw; };
struct { float _0; hgdn_vector2 yz; float _1; };
struct { hgdn_vector3 xyz; float _2; };
struct { float _3; hgdn_vector3 yzw; };
} hgdn_quat;
#define HGDN_QUAT_IDENTITY ((hgdn_quat){ .elements = {0, 0, 0, 1} })
#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
typedef hgdn_quat godot_quat;
#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
#endif
typedef union hgdn_basis {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[9])];
float elements[9];
hgdn_vector3 rows[3];
} hgdn_basis;
#define HGDN_BASIS_IDENTITY ((hgdn_basis){ .elements = {1, 0, 0, 0, 1, 0, 0, 0, 1} })
#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
typedef hgdn_basis godot_basis;
#define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
#endif
typedef union hgdn_aabb {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[6])];
float elements[6];
struct { hgdn_vector3 position, size; };
} hgdn_aabb;
#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
typedef hgdn_aabb godot_aabb;
#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
#endif
typedef union hgdn_transform2d {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[6])];
float elements[6];
hgdn_vector2 columns[3];
struct { hgdn_vector2 x, y, origin; };
} hgdn_transform2d;
#define HGDN_TRANSFORM2D_IDENTITY ((hgdn_transform2d){ .elements = {1, 0, 0, 1, 0, 0} })
#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
typedef hgdn_transform2d godot_transform2d;
#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
#endif
typedef union hgdn_transform {
// raw data, must be the first field for guaranteeing ABI compatibility with Godot
uint8_t data[sizeof(float[12])];
float elements[12];
struct { hgdn_basis basis; hgdn_vector3 origin; };
} hgdn_transform;
#define HGDN_TRANSFORM3D_IDENTITY ((hgdn_transform){ .elements = {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0} })
#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
typedef hgdn_transform godot_transform;
#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
#endif
/// @}
#include "gdnative_api_struct.gen.h"
/// @defgroup global Global GDNative pointers
/// Global API structs and GDNativeLibrary pointers
/// @{
extern const godot_gdnative_core_api_struct *hgdn_core_api;
#ifndef HGDN_NO_CORE_1_1
extern const godot_gdnative_core_1_1_api_struct *hgdn_core_1_1_api;
#endif
#ifndef HGDN_NO_CORE_1_2
extern const godot_gdnative_core_1_2_api_struct *hgdn_core_1_2_api;
#endif
#ifndef HGDN_NO_CORE_1_3
extern const godot_gdnative_core_1_3_api_struct *hgdn_core_1_3_api;
#endif
#ifndef HGDN_NO_EXT_NATIVESCRIPT
extern const godot_gdnative_ext_nativescript_api_struct *hgdn_nativescript_api;
extern const godot_gdnative_ext_nativescript_1_1_api_struct *hgdn_nativescript_1_1_api;
#endif
#ifndef HGDN_NO_EXT_PLUGINSCRIPT
extern const godot_gdnative_ext_pluginscript_api_struct *hgdn_pluginscript_api;
#endif
#ifndef HGDN_NO_EXT_ANDROID
extern const godot_gdnative_ext_android_api_struct *hgdn_android_api;
#endif
#ifndef HGDN_NO_EXT_ARVR
extern const godot_gdnative_ext_arvr_api_struct *hgdn_arvr_api;
extern const godot_gdnative_ext_arvr_1_2_api_struct *hgdn_arvr_1_2_api;
#endif
#ifndef HGDN_NO_EXT_VIDEOCODER
extern const godot_gdnative_ext_videodecoder_api_struct *hgdn_videodecoder_api;
#endif
#ifndef HGDN_NO_EXT_NET
extern const godot_gdnative_ext_net_api_struct *hgdn_net_api;
extern const godot_gdnative_ext_net_3_2_api_struct *hgdn_net_3_2_api;
#endif
extern godot_object *hgdn_library; ///< GDNativeLibrary object being initialized
extern godot_method_bind *hgdn_method_Object_callv;
/// @}
/// @defgroup init_deinit Initialization and deinitialization
/// Initialize and deinitialize library, to be called on your own `godot_gdnative_init` and `godot_gdnative_terminate` functions.
/// @{
HGDN_DECL void hgdn_gdnative_init(const godot_gdnative_init_options *options);
HGDN_DECL void hgdn_gdnative_terminate(const godot_gdnative_terminate_options *options);
/// @}
/// @defgroup memory Memory related functions
/// `stdlib.h` compatible functions that track memory usage when Godot is running in debug mode
/// @{
HGDN_DECL void *hgdn_alloc(size_t size); ///< Compatible with `malloc`
HGDN_DECL void *hgdn_realloc(void *ptr, size_t size); ///< Compatible with `realloc`
/// Compatible with `free`. It is safe to pass NULL without triggering an error message.
HGDN_DECL void hgdn_free(void *ptr);
/// @}
/// @defgroup print Printing functions
/// Functions that print a `printf` formatted message to Godot's output
/// @{
HGDN_DECL void hgdn_print(const char *fmt, ...);
HGDN_DECL void hgdn_print_warning(const char *funcname, const char *filename, int line, const char *fmt, ...);
HGDN_DECL void hgdn_print_error(const char *funcname, const char *filename, int line, const char *fmt, ...);
#ifdef _MSC_VER
#define HGDN_PRINT_WARNING(fmt, ...) (hgdn_print_warning(__FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
#define HGDN_PRINT_ERROR(fmt, ...) (hgdn_print_error(__FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
#else
#define HGDN_PRINT_WARNING(fmt, ...) (hgdn_print_warning(__PRETTY_FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
#define HGDN_PRINT_ERROR(fmt, ...) (hgdn_print_error(__PRETTY_FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__))
#endif
/// @}
/// @defgroup assert Runtime assertions
/// Macros that check for a condition, aborting current function if this condition is false
///
/// If condition is false, prints an error message and return a nil variant, so
/// they are meant to be used in GDNative functions that return `godot_variant`
/// like native calls or methods.
/// @{
#define HGDN_ASSERT(cond) HGDN_ASSERT_MSG((cond), "Assertion error: !(" #cond ")")
/// If `cond` is false, print formatted error message and return nil Variant
#define HGDN_ASSERT_MSG(cond, fmt, ...) if(!(cond)){ HGDN_PRINT_ERROR(fmt, ##__VA_ARGS__); return hgdn_new_nil_variant(); }
/// If `arr` doesn't have at least `min_size` elements, print error message and return nil Variant
#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)))
/// If `argc` isn't at least `min_size`, print error message and return nil Variant
#define HGDN_ASSERT_ARGS_SIZE(argc, min_size) HGDN_ASSERT_MSG((argc) >= (min_size), "Error: expected at least " #min_size " arguments, got %d", argc)
/// @}
/// @defgroup string_wrapper String wrapper
/// Wrapper around String/CharStrings with pointer and length
/// @{
typedef struct hgdn_string {
godot_char_string gd_char_string;
const char *ptr;
godot_int length;
} hgdn_string;
HGDN_DECL hgdn_string hgdn_string_get(const godot_string *str);
HGDN_DECL hgdn_string hgdn_string_get_own(godot_string str);
HGDN_DECL void hgdn_string_destroy(hgdn_string *str);
typedef struct hgdn_wide_string {
godot_string gd_string;
const wchar_t *ptr;
godot_int length;
} hgdn_wide_string;
HGDN_DECL hgdn_wide_string hgdn_wide_string_get(const godot_string *str);
HGDN_DECL hgdn_wide_string hgdn_wide_string_get_own(godot_string str);
HGDN_DECL void hgdn_wide_string_destroy(hgdn_wide_string *str);
/// @}
/// @defgroup pool_array_wrapper Pool*Array wrapper
/// Wrapper around Pool*Array types with pointer and array size
/// @{
typedef struct hgdn_byte_array {
godot_pool_byte_array_read_access *gd_read_access;
const uint8_t *ptr;
godot_int size;
} hgdn_byte_array;
HGDN_DECL hgdn_byte_array hgdn_byte_array_get(const godot_pool_byte_array *array);
HGDN_DECL hgdn_byte_array hgdn_byte_array_get_own(godot_pool_byte_array array);
HGDN_DECL void hgdn_byte_array_destroy(hgdn_byte_array *array);
typedef struct hgdn_int_array {
godot_pool_int_array_read_access *gd_read_access;
const godot_int *ptr;
godot_int size;
} hgdn_int_array;
HGDN_DECL hgdn_int_array hgdn_int_array_get(const godot_pool_int_array *array);
HGDN_DECL hgdn_int_array hgdn_int_array_get_own(godot_pool_int_array array);
HGDN_DECL void hgdn_int_array_destroy(hgdn_int_array *array);
typedef struct hgdn_real_array {
godot_pool_real_array_read_access *gd_read_access;
const godot_real *ptr;
godot_int size;
} hgdn_real_array;
HGDN_DECL hgdn_real_array hgdn_real_array_get(const godot_pool_real_array *array);
HGDN_DECL hgdn_real_array hgdn_real_array_get_own(godot_pool_real_array array);
HGDN_DECL void hgdn_real_array_destroy(hgdn_real_array *array);
typedef struct hgdn_vector2_array {
godot_pool_vector2_array_read_access *gd_read_access;
const godot_vector2 *ptr;
godot_int size;
} hgdn_vector2_array;
HGDN_DECL hgdn_vector2_array hgdn_vector2_array_get(const godot_pool_vector2_array *array);
HGDN_DECL hgdn_vector2_array hgdn_vector2_array_get_own(godot_pool_vector2_array array);
HGDN_DECL void hgdn_vector2_array_destroy(hgdn_vector2_array *array);
typedef struct hgdn_vector3_array {
godot_pool_vector3_array_read_access *gd_read_access;
const godot_vector3 *ptr;
godot_int size;
} hgdn_vector3_array;
HGDN_DECL hgdn_vector3_array hgdn_vector3_array_get(const godot_pool_vector3_array *array);
HGDN_DECL hgdn_vector3_array hgdn_vector3_array_get_own(godot_pool_vector3_array array);
HGDN_DECL void hgdn_vector3_array_destroy(hgdn_vector3_array *array);
typedef struct hgdn_color_array {
godot_pool_color_array_read_access *gd_read_access;
const godot_color *ptr;
godot_int size;
} hgdn_color_array;
HGDN_DECL hgdn_color_array hgdn_color_array_get(const godot_pool_color_array *array);
HGDN_DECL hgdn_color_array hgdn_color_array_get_own(godot_pool_color_array array);
HGDN_DECL void hgdn_color_array_destroy(hgdn_color_array *array);
typedef struct hgdn_string_array {
hgdn_string *strings;
const char **ptr;
godot_int size;
} hgdn_string_array;
HGDN_DECL hgdn_string_array hgdn_string_array_get(const godot_pool_string_array *array);
HGDN_DECL hgdn_string_array hgdn_string_array_get_own(godot_pool_string_array array);
HGDN_DECL void hgdn_string_array_destroy(hgdn_string_array *array);
/// @}
/// @defgroup variant_get Typed values from Variants
/// Helper functions to get values directly from a `godot_variant`
///
/// The `*_own` functions own the passed argument, destroying it.
/// @{
HGDN_DECL godot_bool hgdn_variant_get_bool(const godot_variant *var);
HGDN_DECL uint64_t hgdn_variant_get_uint(const godot_variant *var);
HGDN_DECL int64_t hgdn_variant_get_int(const godot_variant *var);
HGDN_DECL double hgdn_variant_get_real(const godot_variant *var);
HGDN_DECL godot_vector2 hgdn_variant_get_vector2(const godot_variant *var);
HGDN_DECL godot_vector3 hgdn_variant_get_vector3(const godot_variant *var);
HGDN_DECL godot_rect2 hgdn_variant_get_rect2(const godot_variant *var);
HGDN_DECL godot_plane hgdn_variant_get_plane(const godot_variant *var);
HGDN_DECL godot_quat hgdn_variant_get_quat(const godot_variant *var);
HGDN_DECL godot_aabb hgdn_variant_get_aabb(const godot_variant *var);
HGDN_DECL godot_basis hgdn_variant_get_basis(const godot_variant *var);
HGDN_DECL godot_transform2d hgdn_variant_get_transform2d(const godot_variant *var);
HGDN_DECL godot_transform hgdn_variant_get_transform(const godot_variant *var);
HGDN_DECL godot_color hgdn_variant_get_color(const godot_variant *var);
HGDN_DECL godot_node_path hgdn_variant_get_node_path(const godot_variant *var);
HGDN_DECL godot_rid hgdn_variant_get_rid(const godot_variant *var);
HGDN_DECL godot_object *hgdn_variant_get_object(const godot_variant *var);
HGDN_DECL godot_dictionary hgdn_variant_get_dictionary(const godot_variant *var);
HGDN_DECL godot_array hgdn_variant_get_array(const godot_variant *var);
HGDN_DECL hgdn_string hgdn_variant_get_string(const godot_variant *var);
HGDN_DECL hgdn_wide_string hgdn_variant_get_wide_string(const godot_variant *var);
HGDN_DECL hgdn_byte_array hgdn_variant_get_byte_array(const godot_variant *var);
HGDN_DECL hgdn_int_array hgdn_variant_get_int_array(const godot_variant *var);
HGDN_DECL hgdn_real_array hgdn_variant_get_real_array(const godot_variant *var);
HGDN_DECL hgdn_vector2_array hgdn_variant_get_vector2_array(const godot_variant *var);
HGDN_DECL hgdn_vector3_array hgdn_variant_get_vector3_array(const godot_variant *var);
HGDN_DECL hgdn_color_array hgdn_variant_get_color_array(const godot_variant *var);
HGDN_DECL hgdn_string_array hgdn_variant_get_string_array(const godot_variant *var);
HGDN_DECL godot_bool hgdn_variant_get_bool_own(godot_variant var);
HGDN_DECL uint64_t hgdn_variant_get_uint_own(godot_variant var);
HGDN_DECL int64_t hgdn_variant_get_int_own(godot_variant var);
HGDN_DECL double hgdn_variant_get_real_own(godot_variant var);
HGDN_DECL godot_vector2 hgdn_variant_get_vector2_own(godot_variant var);
HGDN_DECL godot_vector3 hgdn_variant_get_vector3_own(godot_variant var);
HGDN_DECL godot_rect2 hgdn_variant_get_rect2_own(godot_variant var);
HGDN_DECL godot_plane hgdn_variant_get_plane_own(godot_variant var);
HGDN_DECL godot_quat hgdn_variant_get_quat_own(godot_variant var);
HGDN_DECL godot_aabb hgdn_variant_get_aabb_own(godot_variant var);
HGDN_DECL godot_basis hgdn_variant_get_basis_own(godot_variant var);
HGDN_DECL godot_transform2d hgdn_variant_get_transform2d_own(godot_variant var);
HGDN_DECL godot_transform hgdn_variant_get_transform_own(godot_variant var);
HGDN_DECL godot_color hgdn_variant_get_color_own(godot_variant var);
HGDN_DECL godot_node_path hgdn_variant_get_node_path_own(godot_variant var);
HGDN_DECL godot_rid hgdn_variant_get_rid_own(godot_variant var);
HGDN_DECL godot_object *hgdn_variant_get_object_own(godot_variant var);
HGDN_DECL godot_dictionary hgdn_variant_get_dictionary_own(godot_variant var);
HGDN_DECL godot_array hgdn_variant_get_array_own(godot_variant var);
HGDN_DECL hgdn_string hgdn_variant_get_string_own(godot_variant var);
HGDN_DECL hgdn_wide_string hgdn_variant_get_wide_string_own(godot_variant var);
HGDN_DECL hgdn_byte_array hgdn_variant_get_byte_array_own(godot_variant var);
HGDN_DECL hgdn_int_array hgdn_variant_get_int_array_own(godot_variant var);
HGDN_DECL hgdn_real_array hgdn_variant_get_real_array_own(godot_variant var);
HGDN_DECL hgdn_vector2_array hgdn_variant_get_vector2_array_own(godot_variant var);
HGDN_DECL hgdn_vector3_array hgdn_variant_get_vector3_array_own(godot_variant var);
HGDN_DECL hgdn_color_array hgdn_variant_get_color_array_own(godot_variant var);
HGDN_DECL hgdn_string_array hgdn_variant_get_string_array_own(godot_variant var);
/// @}
/// @defgroup array_get Typed values from Arrays
/// Helper functions to get values directly from a `godot_array` position
/// @{
HGDN_DECL godot_bool hgdn_array_get_bool(const godot_array *array, const godot_int index);
HGDN_DECL uint64_t hgdn_array_get_uint(const godot_array *array, const godot_int index);
HGDN_DECL int64_t hgdn_array_get_int(const godot_array *array, const godot_int index);
HGDN_DECL double hgdn_array_get_real(const godot_array *array, const godot_int index);
HGDN_DECL godot_vector2 hgdn_array_get_vector2(const godot_array *array, const godot_int index);
HGDN_DECL godot_vector3 hgdn_array_get_vector3(const godot_array *array, const godot_int index);
HGDN_DECL godot_rect2 hgdn_array_get_rect2(const godot_array *array, const godot_int index);
HGDN_DECL godot_plane hgdn_array_get_plane(const godot_array *array, const godot_int index);
HGDN_DECL godot_quat hgdn_array_get_quat(const godot_array *array, const godot_int index);
HGDN_DECL godot_aabb hgdn_array_get_aabb(const godot_array *array, const godot_int index);
HGDN_DECL godot_basis hgdn_array_get_basis(const godot_array *array, const godot_int index);
HGDN_DECL godot_transform2d hgdn_array_get_transform2d(const godot_array *array, const godot_int index);
HGDN_DECL godot_transform hgdn_array_get_transform(const godot_array *array, const godot_int index);
HGDN_DECL godot_color hgdn_array_get_color(const godot_array *array, const godot_int index);
HGDN_DECL godot_node_path hgdn_array_get_node_path(const godot_array *array, const godot_int index);
HGDN_DECL godot_rid hgdn_array_get_rid(const godot_array *array, const godot_int index);
HGDN_DECL godot_object *hgdn_array_get_object(const godot_array *array, const godot_int index);
HGDN_DECL godot_dictionary hgdn_array_get_dictionary(const godot_array *array, const godot_int index);
HGDN_DECL godot_array hgdn_array_get_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_string hgdn_array_get_string(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_wide_string hgdn_array_get_wide_string(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_byte_array hgdn_array_get_byte_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_int_array hgdn_array_get_int_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_real_array hgdn_array_get_real_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_vector2_array hgdn_array_get_vector2_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_vector3_array hgdn_array_get_vector3_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_color_array hgdn_array_get_color_array(const godot_array *array, const godot_int index);
HGDN_DECL hgdn_string_array hgdn_array_get_string_array(const godot_array *array, const godot_int index);
/// @}
/// @defgroup args_get Typed values from method arguments
/// Helper functions to get values directly from method arguments
/// @{
HGDN_DECL godot_bool hgdn_args_get_bool(godot_variant **args, const godot_int index);
HGDN_DECL uint64_t hgdn_args_get_uint(godot_variant **args, const godot_int index);
HGDN_DECL int64_t hgdn_args_get_int(godot_variant **args, const godot_int index);
HGDN_DECL double hgdn_args_get_real(godot_variant **args, const godot_int index);
HGDN_DECL godot_vector2 hgdn_args_get_vector2(godot_variant **args, const godot_int index);
HGDN_DECL godot_vector3 hgdn_args_get_vector3(godot_variant **args, const godot_int index);
HGDN_DECL godot_rect2 hgdn_args_get_rect2(godot_variant **args, const godot_int index);
HGDN_DECL godot_plane hgdn_args_get_plane(godot_variant **args, const godot_int index);
HGDN_DECL godot_quat hgdn_args_get_quat(godot_variant **args, const godot_int index);
HGDN_DECL godot_aabb hgdn_args_get_aabb(godot_variant **args, const godot_int index);
HGDN_DECL godot_basis hgdn_args_get_basis(godot_variant **args, const godot_int index);
HGDN_DECL godot_transform2d hgdn_args_get_transform2d(godot_variant **args, const godot_int index);
HGDN_DECL godot_transform hgdn_args_get_transform(godot_variant **args, const godot_int index);
HGDN_DECL godot_color hgdn_args_get_color(godot_variant **args, const godot_int index);
HGDN_DECL godot_node_path hgdn_args_get_node_path(godot_variant **args, const godot_int index);
HGDN_DECL godot_rid hgdn_args_get_rid(godot_variant **args, const godot_int index);
HGDN_DECL godot_object *hgdn_args_get_object(godot_variant **args, const godot_int index);
HGDN_DECL godot_dictionary hgdn_args_get_dictionary(godot_variant **args, const godot_int index);
HGDN_DECL godot_array hgdn_args_get_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_string hgdn_args_get_string(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_wide_string hgdn_args_get_wide_string(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_byte_array hgdn_args_get_byte_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_int_array hgdn_args_get_int_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_real_array hgdn_args_get_real_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_vector2_array hgdn_args_get_vector2_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_vector3_array hgdn_args_get_vector3_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_color_array hgdn_args_get_color_array(godot_variant **args, const godot_int index);
HGDN_DECL hgdn_string_array hgdn_args_get_string_array(godot_variant **args, const godot_int index);
/// @}
/// @defgroup dictionary_get Typed values from Dictionaries
/// Helper functions to get values directly from a `godot_dictionary` with Variant or String key
/// @{
HGDN_DECL godot_bool hgdn_dictionary_get_bool(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL uint64_t hgdn_dictionary_get_uint(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL int64_t hgdn_dictionary_get_int(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL double hgdn_dictionary_get_real(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_vector2 hgdn_dictionary_get_vector2(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_vector3 hgdn_dictionary_get_vector3(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_rect2 hgdn_dictionary_get_rect2(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_plane hgdn_dictionary_get_plane(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_quat hgdn_dictionary_get_quat(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_aabb hgdn_dictionary_get_aabb(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_basis hgdn_dictionary_get_basis(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_transform2d hgdn_dictionary_get_transform2d(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_transform hgdn_dictionary_get_transform(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_color hgdn_dictionary_get_color(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_node_path hgdn_dictionary_get_node_path(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_rid hgdn_dictionary_get_rid(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_object *hgdn_dictionary_get_object(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_dictionary hgdn_dictionary_get_dictionary(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_array hgdn_dictionary_get_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_string hgdn_dictionary_get_string(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_wide_string hgdn_dictionary_get_wide_string(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_byte_array hgdn_dictionary_get_byte_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_int_array hgdn_dictionary_get_int_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_real_array hgdn_dictionary_get_real_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_vector2_array hgdn_dictionary_get_vector2_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_vector3_array hgdn_dictionary_get_vector3_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_color_array hgdn_dictionary_get_color_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL hgdn_string_array hgdn_dictionary_get_string_array(const godot_dictionary *dict, const godot_variant *key);
HGDN_DECL godot_bool hgdn_dictionary_string_get_bool(const godot_dictionary *dict, const char *key);
HGDN_DECL uint64_t hgdn_dictionary_string_get_uint(const godot_dictionary *dict, const char *key);
HGDN_DECL int64_t hgdn_dictionary_string_get_int(const godot_dictionary *dict, const char *key);
HGDN_DECL double hgdn_dictionary_string_get_real(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_vector2 hgdn_dictionary_string_get_vector2(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_vector3 hgdn_dictionary_string_get_vector3(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_rect2 hgdn_dictionary_string_get_rect2(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_plane hgdn_dictionary_string_get_plane(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_quat hgdn_dictionary_string_get_quat(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_aabb hgdn_dictionary_string_get_aabb(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_basis hgdn_dictionary_string_get_basis(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_transform2d hgdn_dictionary_string_get_transform2d(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_transform hgdn_dictionary_string_get_transform(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_color hgdn_dictionary_string_get_color(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_node_path hgdn_dictionary_string_get_node_path(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_rid hgdn_dictionary_string_get_rid(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_object *hgdn_dictionary_string_get_object(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_dictionary hgdn_dictionary_string_get_dictionary(const godot_dictionary *dict, const char *key);
HGDN_DECL godot_array hgdn_dictionary_string_get_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_string hgdn_dictionary_string_get_string(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_wide_string hgdn_dictionary_string_get_wide_string(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_byte_array hgdn_dictionary_string_get_byte_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_int_array hgdn_dictionary_string_get_int_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_real_array hgdn_dictionary_string_get_real_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_vector2_array hgdn_dictionary_string_get_vector2_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_vector3_array hgdn_dictionary_string_get_vector3_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_color_array hgdn_dictionary_string_get_color_array(const godot_dictionary *dict, const char *key);
HGDN_DECL hgdn_string_array hgdn_dictionary_string_get_string_array(const godot_dictionary *dict, const char *key);
/// @}
/// @defgroup new_variant Variant constructors
/// Helper functions to create Variant values
///
/// The `*_own` functions own the passed argument, destroying it. Useful
/// when you create the object just for creating a Variant of it, enabling
/// the idiom `hgdn_new_string_variant_own(hgdn_new_string("..."))`.
/// @{
HGDN_DECL godot_variant hgdn_new_variant_copy(const godot_variant *value);
HGDN_DECL godot_variant hgdn_new_nil_variant();
HGDN_DECL godot_variant hgdn_new_bool_variant(const godot_bool value);
HGDN_DECL godot_variant hgdn_new_uint_variant(const uint64_t value);
HGDN_DECL godot_variant hgdn_new_int_variant(const int64_t value);
HGDN_DECL godot_variant hgdn_new_real_variant(const double value);
HGDN_DECL godot_variant hgdn_new_string_variant(const godot_string *value);
HGDN_DECL godot_variant hgdn_new_cstring_variant(const char *value);
HGDN_DECL godot_variant hgdn_new_wide_string_variant(const wchar_t *value);
HGDN_DECL godot_variant hgdn_new_vector2_variant(const godot_vector2 value);
HGDN_DECL godot_variant hgdn_new_vector3_variant(const godot_vector3 value);
HGDN_DECL godot_variant hgdn_new_rect2_variant(const godot_rect2 value);
HGDN_DECL godot_variant hgdn_new_plane_variant(const godot_plane value);
HGDN_DECL godot_variant hgdn_new_quat_variant(const godot_quat value);
HGDN_DECL godot_variant hgdn_new_aabb_variant(const godot_aabb value);
HGDN_DECL godot_variant hgdn_new_basis_variant(const godot_basis value);
HGDN_DECL godot_variant hgdn_new_transform2d_variant(const godot_transform2d value);
HGDN_DECL godot_variant hgdn_new_transform_variant(const godot_transform value);
HGDN_DECL godot_variant hgdn_new_color_variant(const godot_color value);
HGDN_DECL godot_variant hgdn_new_node_path_variant(const godot_node_path *value);
HGDN_DECL godot_variant hgdn_new_rid_variant(const godot_rid *value);
HGDN_DECL godot_variant hgdn_new_object_variant(const godot_object *value);
HGDN_DECL godot_variant hgdn_new_dictionary_variant(const godot_dictionary *value);
HGDN_DECL godot_variant hgdn_new_array_variant(const godot_array *value);
HGDN_DECL godot_variant hgdn_new_pool_byte_array_variant(const godot_pool_byte_array *value);
HGDN_DECL godot_variant hgdn_new_pool_int_array_variant(const godot_pool_int_array *value);
HGDN_DECL godot_variant hgdn_new_pool_real_array_variant(const godot_pool_real_array *value);
HGDN_DECL godot_variant hgdn_new_pool_vector2_array_variant(const godot_pool_vector2_array *value);
HGDN_DECL godot_variant hgdn_new_pool_vector3_array_variant(const godot_pool_vector3_array *value);
HGDN_DECL godot_variant hgdn_new_pool_color_array_variant(const godot_pool_color_array *value);
HGDN_DECL godot_variant hgdn_new_pool_string_array_variant(const godot_pool_string_array *value);
HGDN_DECL godot_variant hgdn_new_string_variant_own(godot_string value);
HGDN_DECL godot_variant hgdn_new_node_path_variant_own(godot_node_path value);
HGDN_DECL godot_variant hgdn_new_dictionary_variant_own(godot_dictionary value);
HGDN_DECL godot_variant hgdn_new_array_variant_own(godot_array value);
HGDN_DECL godot_variant hgdn_new_pool_byte_array_variant_own(godot_pool_byte_array value);
HGDN_DECL godot_variant hgdn_new_pool_int_array_variant_own(godot_pool_int_array value);
HGDN_DECL godot_variant hgdn_new_pool_real_array_variant_own(godot_pool_real_array value);
HGDN_DECL godot_variant hgdn_new_pool_vector2_array_variant_own(godot_pool_vector2_array value);
HGDN_DECL godot_variant hgdn_new_pool_vector3_array_variant_own(godot_pool_vector3_array value);
HGDN_DECL godot_variant hgdn_new_pool_color_array_variant_own(godot_pool_color_array value);
HGDN_DECL godot_variant hgdn_new_pool_string_array_variant_own(godot_pool_string_array value);
#ifdef __cplusplus
extern "C++" {
HGDN_DECL godot_variant hgdn_new_variant(const godot_bool value);
HGDN_DECL godot_variant hgdn_new_variant(const unsigned int value);
HGDN_DECL godot_variant hgdn_new_variant(const uint64_t value);
HGDN_DECL godot_variant hgdn_new_variant(const int value);
HGDN_DECL godot_variant hgdn_new_variant(const int64_t value);
HGDN_DECL godot_variant hgdn_new_variant(const double value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_string *value);
HGDN_DECL godot_variant hgdn_new_variant(const char *value);
HGDN_DECL godot_variant hgdn_new_variant(const wchar_t *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_vector2 value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_vector3 value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_rect2 value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_plane value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_quat value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_aabb value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_basis value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_transform2d value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_transform value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_color value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_node_path *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_rid *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_object *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_dictionary *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_byte_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_int_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_real_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_vector2_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_vector3_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_color_array *value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_pool_string_array *value);
HGDN_DECL godot_variant hgdn_new_variant(godot_string value);
HGDN_DECL godot_variant hgdn_new_variant(godot_node_path value);
HGDN_DECL godot_variant hgdn_new_variant(godot_dictionary value);
HGDN_DECL godot_variant hgdn_new_variant(godot_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_byte_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_int_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_real_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_vector2_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_vector3_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_color_array value);
HGDN_DECL godot_variant hgdn_new_variant(godot_pool_string_array value);
HGDN_DECL godot_variant hgdn_new_variant(const godot_variant *value);
HGDN_DECL HGDN_CONSTEXPR godot_variant hgdn_new_variant(godot_variant value);
}
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L // C11
/// Overloaded function/macro for creating Variants from any values. Available in C++ and C11.
#define hgdn_new_variant(value) \
(_Generic((value), \
godot_bool: hgdn_new_bool_variant, \
unsigned int: hgdn_new_uint_variant, \
uint64_t: hgdn_new_uint_variant, \
int: hgdn_new_int_variant, \
int64_t: hgdn_new_int_variant, \
float: hgdn_new_real_variant, \
double: hgdn_new_real_variant, \
godot_string*: hgdn_new_string_variant, const godot_string*: hgdn_new_string_variant, \
char*: hgdn_new_cstring_variant, const char*: hgdn_new_cstring_variant, \
wchar_t*: hgdn_new_wide_string_variant, const wchar_t*: hgdn_new_wide_string_variant, \
godot_vector2: hgdn_new_vector2_variant, \
godot_vector3: hgdn_new_vector3_variant, \
godot_rect2: hgdn_new_rect2_variant, \
godot_plane: hgdn_new_plane_variant, \
godot_quat: hgdn_new_quat_variant, \
godot_aabb: hgdn_new_aabb_variant, \
godot_basis: hgdn_new_basis_variant, \
godot_transform2d: hgdn_new_transform2d_variant, \
godot_transform: hgdn_new_transform_variant, \
godot_color: hgdn_new_color_variant, \
godot_node_path*: hgdn_new_node_path_variant, const godot_node_path*: hgdn_new_node_path_variant, \
godot_rid*: hgdn_new_rid_variant, const godot_rid*: hgdn_new_rid_variant, \
godot_object*: hgdn_new_object_variant, const godot_object*: hgdn_new_object_variant, \
godot_dictionary*: hgdn_new_dictionary_variant, const godot_dictionary*: hgdn_new_dictionary_variant, \
godot_array*: hgdn_new_array_variant, const godot_array*: hgdn_new_array_variant, \
godot_pool_byte_array*: hgdn_new_pool_byte_array_variant, const godot_pool_byte_array*: hgdn_new_pool_byte_array_variant, \
godot_pool_int_array*: hgdn_new_pool_int_array_variant, const godot_pool_int_array*: hgdn_new_pool_int_array_variant, \
godot_pool_real_array*: hgdn_new_pool_real_array_variant, const godot_pool_real_array*: hgdn_new_pool_real_array_variant, \
godot_pool_vector2_array*: hgdn_new_pool_vector2_array_variant, const godot_pool_vector2_array*: hgdn_new_pool_vector2_array_variant, \
godot_pool_vector3_array*: hgdn_new_pool_vector3_array_variant, const godot_pool_vector3_array*: hgdn_new_pool_vector3_array_variant, \
godot_pool_color_array*: hgdn_new_pool_color_array_variant, const godot_pool_color_array*: hgdn_new_pool_color_array_variant, \
godot_pool_string_array*: hgdn_new_pool_string_array_variant, const godot_pool_string_array*: hgdn_new_pool_string_array_variant, \
godot_string: hgdn_new_string_variant_own, \
godot_node_path: hgdn_new_node_path_variant_own, \
godot_dictionary: hgdn_new_dictionary_variant_own, \
godot_array: hgdn_new_array_variant_own, \
godot_pool_byte_array: hgdn_new_pool_byte_array_variant_own, \
godot_pool_int_array: hgdn_new_pool_int_array_variant_own, \
godot_pool_real_array: hgdn_new_pool_real_array_variant_own, \
godot_pool_vector2_array: hgdn_new_pool_vector2_array_variant_own, \
godot_pool_vector3_array: hgdn_new_pool_vector3_array_variant_own, \
godot_pool_color_array: hgdn_new_pool_color_array_variant_own, \
godot_pool_string_array: hgdn_new_pool_string_array_variant_own, \
godot_variant*: hgdn_new_variant_copy, const godot_variant*: hgdn_new_variant_copy, \
godot_variant: hgdn__variant_return \
)(value))
HGDN_DECL godot_variant hgdn__variant_return(godot_variant value);
#else
#define hgdn_new_variant(value) (value) // No transformations in C without C11 support
#endif
/// @}
/// @defgroup string String creation
/// Helper functions to create Strings
/// @{
HGDN_DECL godot_string hgdn_new_string(const char *cstr);
HGDN_DECL godot_string hgdn_new_string_with_len(const char *cstr, const godot_int len);
/// @param fmt A `printf` compatible format
HGDN_DECL godot_string hgdn_new_formatted_string(const char *fmt, ...);
HGDN_DECL godot_string hgdn_new_wide_string(const wchar_t *wstr);
HGDN_DECL godot_string hgdn_new_wide_string_with_len(const wchar_t *wstr, const godot_int len);
/// @}
/// @defgroup array Pool*Array/Array creation
/// Helper functions to create Pool*Array/Array objects from sized buffers
///
/// The `*_args` variadic functions/macros construct a temporary array and call
/// the functions. On C++11 they are implemented using templates with parameter pack.
/// @{
HGDN_DECL godot_pool_byte_array hgdn_new_byte_array(const uint8_t *buffer, const godot_int size);
HGDN_DECL godot_pool_int_array hgdn_new_int_array(const godot_int *buffer, const godot_int size);
HGDN_DECL godot_pool_real_array hgdn_new_real_array(const godot_real *buffer, const godot_int size);
HGDN_DECL godot_pool_vector2_array hgdn_new_vector2_array(const godot_vector2 *buffer, const godot_int size);
HGDN_DECL godot_pool_vector3_array hgdn_new_vector3_array(const godot_vector3 *buffer, const godot_int size);
HGDN_DECL godot_pool_color_array hgdn_new_color_array(const godot_color *buffer, const godot_int size);
/// @note All strings must be NULL terminated.
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(const godot_variant *const *buffer, const godot_int size);
/// @note Variants in `buffer` will be destroyed, convenient if you create Variants only for constructing the Array
HGDN_DECL godot_array hgdn_new_array_own(godot_variant *buffer, const godot_int size);
#if defined(__cplusplus) && __cplusplus >= 201103L // Parameter pack is a C++11 feature
extern "C++" {
template<typename... Args> godot_pool_byte_array hgdn_new_byte_array_args(Args... args) {
uint8_t buffer[] = { args... };
return hgdn_new_byte_array(buffer, sizeof...(args));
}
template<typename... Args> godot_pool_int_array hgdn_new_int_array_args(Args... args) {
godot_int buffer[] = { args... };
return hgdn_new_int_array(buffer, sizeof...(args));
}
template<typename... Args> godot_pool_real_array hgdn_new_real_array_args(Args... args) {
godot_real buffer[] = { args... };
return hgdn_new_real_array(buffer, sizeof...(args));
}
template<typename... Args> godot_pool_vector2_array hgdn_new_vector2_array_args(Args... args) {
godot_vector2 buffer[] = { args... };
return hgdn_new_vector2_array(buffer, sizeof...(args));
}
template<typename... Args> godot_pool_vector3_array hgdn_new_vector3_array_args(Args... args) {
godot_vector3 buffer[] = { args... };
return hgdn_new_vector3_array(buffer, sizeof...(args));
}
template<typename... Args> godot_pool_color_array hgdn_new_color_array_args(Args... args) {
godot_color buffer[] = { args... };
return hgdn_new_color_array(buffer, sizeof...(args));
}
template<typename... Args> godot_pool_string_array hgdn_new_string_array_args(Args... args) {
const char *const buffer[] = { args... };
return hgdn_new_string_array(buffer, sizeof...(args));
}
template<typename... Args> godot_array hgdn_new_array_args(Args... args) {
godot_variant buffer[] = { hgdn_new_variant(args)... };
return hgdn_new_array_own(buffer, sizeof...(args));
}
}
#else
#define hgdn_new_byte_array_args(...) (hgdn_new_byte_array((const uint8_t[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_int_array_args(...) (hgdn_new_int_array((const godot_int[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_real_array_args(...) (hgdn_new_real_array((const godot_real[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_vector2_array_args(...) (hgdn_new_vector2_array((const godot_vector2[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_vector3_array_args(...) (hgdn_new_vector3_array((const godot_vector3[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_color_array_args(...) (hgdn_new_color_array((const godot_color[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_string_array_args(...) (hgdn_new_string_array((const char *const []){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
/// @note In C++ and C11 the arguments passed are transformed by `hgdn_new_variant`, so primitive C data can be passed directly
#define hgdn_new_array_args(...) (hgdn_new_array_own((godot_variant[]){ HGDN__MAP(hgdn_new_variant, __VA_ARGS__) }, HGDN__NARG(__VA_ARGS__)))
#endif
/// @}
/// @defgroup dictionary Dictionary creation
/// Helper functions to create Dictionaries
///
/// The `*_own` functions own the passed Variants, destroying them. Useful
/// when you create the Variants just for creating a Dictionary with them.
/// @{
typedef struct hgdn_dictionary_entry {
godot_variant *key, *value;
} hgdn_dictionary_entry;
typedef struct hgdn_dictionary_entry_own {
godot_variant key, value;
} hgdn_dictionary_entry_own;
typedef struct hgdn_dictionary_entry_string {
const char *key;
godot_variant *value;
} hgdn_dictionary_entry_string;
typedef struct hgdn_dictionary_entry_string_own {
const char *key;
godot_variant value;
} hgdn_dictionary_entry_string_own;
typedef struct hgdn_dictionary_entry_string_string {
const char *key, *value;
} hgdn_dictionary_entry_string_string;
typedef struct hgdn_dictionary_entry_string_int {
const char *key;
godot_int value;
} hgdn_dictionary_entry_string_int;
HGDN_DECL godot_dictionary hgdn_new_dictionary(const hgdn_dictionary_entry *buffer, const godot_int size);
HGDN_DECL godot_dictionary hgdn_new_dictionary_string(const hgdn_dictionary_entry_string *buffer, const godot_int size);
HGDN_DECL godot_dictionary hgdn_new_dictionary_string_int(const hgdn_dictionary_entry_string_int *buffer, const godot_int size);
HGDN_DECL godot_dictionary hgdn_new_dictionary_string_string(const hgdn_dictionary_entry_string_string *buffer, const godot_int size);
HGDN_DECL godot_dictionary hgdn_new_dictionary_own(hgdn_dictionary_entry_own *buffer, const godot_int size);
HGDN_DECL godot_dictionary hgdn_new_dictionary_string_own(hgdn_dictionary_entry_string_own *buffer, const godot_int size);
#define hgdn_new_dictionary_args(...) (hgdn_new_dictionary((const hgdn_dictionary_entry[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_dictionary_string_args(...) (hgdn_new_dictionary_string((const hgdn_dictionary_entry_string[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_dictionary_string_int_args(...) (hgdn_new_dictionary_string_int((const hgdn_dictionary_entry_string_int[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_dictionary_string_string_args(...) (hgdn_new_dictionary_string_string((const hgdn_dictionary_entry_string_string[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_dictionary_own_args(...) (hgdn_new_dictionary_own((hgdn_dictionary_entry_own[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
#define hgdn_new_dictionary_string_own_args(...) (hgdn_new_dictionary_string_own((hgdn_dictionary_entry_string_own[]){ __VA_ARGS__ }, HGDN__NARG(__VA_ARGS__)))
/// @}
/// @defgroup object Object functions
/// Helper functions to work with `godot_object` values
/// @{
HGDN_DECL godot_variant hgdn_object_callv(godot_object *instance, const char *method, const godot_array *args);
HGDN_DECL godot_variant hgdn_object_callv_own(godot_object *instance, const char *method, godot_array args);
#define hgdn_object_get(instance, property) (hgdn_object_call(instance, "get", property))
#define hgdn_object_set(instance, property, value) (hgdn_object_call(instance, "set", property, value))
#if defined(__cplusplus) && __cplusplus >= 201103L // Parameter pack is a C++11 feature
extern "C++" template<typename... Args> godot_variant hgdn_object_call(godot_object *instance, const char *method, Args... args) {
godot_array args_array = hgdn_new_array_args(args...);
return hgdn_object_callv_own(instance, method, args_array);
}
#else
/// @note In C++ and C11 the arguments passed are transformed by `hgdn_new_variant`, so primitive C data can be passed directly
#define hgdn_object_call(instance, method, ...) (hgdn_object_callv_own((instance), (method), hgdn_new_array_args(__VA_ARGS__)))
#endif
/// @}
/// @defgroup nativescript NativeScript helpers
/// Definitions that help registering classes in Godot, focusing on wrapping C structs
/// @{
#ifndef HGDN_NO_EXT_NATIVESCRIPT
typedef struct hgdn_property_info {
const char *path;
godot_property_set_func setter;
godot_property_get_func getter;
// godot_property_attributes
godot_int type;
godot_property_hint hint;
const char *hint_string;
godot_property_usage_flags usage;
godot_variant default_value;
godot_method_rpc_mode rset_type;
/// NativeScript 1.1 documentation
const char *documentation;
} hgdn_property_info;
typedef struct hgdn_method_argument_info {
const char *name;
godot_variant_type type;
godot_property_hint hint;
const char *hint_string;
} hgdn_method_argument_info;
typedef struct hgdn_method_info {
const char *name;
godot_instance_method method;
// godot_method_attributes
godot_method_rpc_mode rpc_type;
/// NativeScript 1.1 documentation