High level GDNative
Single header GDNative high level API for C/C++
|
Macros that check for a condition, aborting current function if this condition is false. More...
Macros | |
#define | HGDN_ASSERT(cond) HGDN_ASSERT_MSG((cond), "Assertion error: !(" #cond ")") |
#define | HGDN_ASSERT_MSG(cond, fmt, ...) if(!(cond)){ HGDN_PRINT_ERROR(fmt, ##__VA_ARGS__); return hgdn_new_nil_variant(); } |
If cond is false, print formatted 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 arr doesn't have at least min_size elements, 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) |
If argc isn't at least min_size , print error message and return nil Variant. | |
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.