summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/core/builtin_ptrcall.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/godot_cpp/core/builtin_ptrcall.hpp')
-rw-r--r--include/godot_cpp/core/builtin_ptrcall.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/godot_cpp/core/builtin_ptrcall.hpp b/include/godot_cpp/core/builtin_ptrcall.hpp
index 87311b8..19250d8 100644
--- a/include/godot_cpp/core/builtin_ptrcall.hpp
+++ b/include/godot_cpp/core/builtin_ptrcall.hpp
@@ -32,6 +32,7 @@
#define GODOT_BUILTIN_PTRCALL_HPP
#include <gdextension_interface.h>
+#include <godot_cpp/core/object.hpp>
#include <array>
@@ -39,6 +40,17 @@ namespace godot {
namespace internal {
+template <class O, class... Args>
+O *_call_builtin_method_ptr_ret_obj(const GDExtensionPtrBuiltInMethod method, GDExtensionTypePtr base, const Args &...args) {
+ GodotObject *ret = nullptr;
+ std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } };
+ method(base, call_args.data(), &ret, sizeof...(Args));
+ if (ret == nullptr) {
+ return nullptr;
+ }
+ return reinterpret_cast<O *>(internal::get_object_instance_binding(ret));
+}
+
template <class... Args>
void _call_builtin_constructor(const GDExtensionPtrConstructor constructor, GDExtensionTypePtr base, Args... args) {
std::array<GDExtensionConstTypePtr, sizeof...(Args)> call_args = { { (GDExtensionConstTypePtr)args... } };