diff options
author | Thomas Herzog <karroffel@users.noreply.github.com> | 2017-05-11 23:53:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-11 23:53:46 +0200 |
commit | 0f8a17b0cb70c6051963c9220c1ed2ba2ff31d66 (patch) | |
tree | c5044585aa484ec94a5277741469fbdf896d39e0 /modules/gdnative/godot.cpp | |
parent | a48b8bfab80b95eb14a869559a25f37e1e3a7adc (diff) | |
parent | d137e83c6013f895e8bfbacf65c0fe43443c4174 (diff) |
Merge pull request #8720 from karroffel/gdnative-methodbind-varcall
[GDNative] added varcall and print
Diffstat (limited to 'modules/gdnative/godot.cpp')
-rw-r--r-- | modules/gdnative/godot.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/gdnative/godot.cpp b/modules/gdnative/godot.cpp index 4b865966fd..bc53eb93f4 100644 --- a/modules/gdnative/godot.cpp +++ b/modules/gdnative/godot.cpp @@ -116,6 +116,28 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj mb->ptrcall(o, p_args, p_ret); } +godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error) { + MethodBind *mb = (MethodBind *)p_method_bind; + Object *o = (Object *)p_instance; + const Variant **args = (const Variant **)p_args; + + godot_variant ret; + godot_variant_new_nil(&ret); + + Variant *ret_val = (Variant *)&ret; + + Variant::CallError r_error; + *ret_val = mb->call(o, args, p_arg_count, r_error); + + if (p_call_error) { + p_call_error->error = (godot_variant_call_error_error)r_error.error; + p_call_error->argument = r_error.argument; + p_call_error->expected = (godot_variant_type)r_error.expected; + } + + return ret; +} + // @Todo /* void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind) @@ -224,6 +246,10 @@ void GDAPI godot_print_warning(const char *p_description, const char *p_function _err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_WARNING); } +void GDAPI godot_print(const godot_string *p_message) { + print_line(*(String *)p_message); +} + #ifdef __cplusplus } #endif |