From bd9e05126e9d32a7488790d5ed2a33a341344142 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 23 May 2023 18:02:01 +0200 Subject: [PATCH] Added godot's gdnative module. --- LICENSE.txt | 21 + SCsub | 60 + android/android_gdn.cpp | 86 + arvr/SCsub | 6 + arvr/arvr_interface_gdnative.cpp | 450 ++ arvr/arvr_interface_gdnative.h | 89 + arvr/register_types.cpp | 39 + arvr/register_types.h | 37 + config.py | 26 + doc_classes/ARVRInterfaceGDNative.xml | 15 + doc_classes/GDNative.xml | 35 + doc_classes/GDNativeLibrary.xml | 50 + doc_classes/MultiplayerPeerGDNative.xml | 17 + doc_classes/NativeScript.xml | 57 + doc_classes/PacketPeerGDNative.xml | 13 + doc_classes/PluginScript.xml | 19 + doc_classes/StreamPeerGDNative.xml | 13 + doc_classes/VideoStreamGDNative.xml | 29 + doc_classes/WebRTCDataChannelGDNative.xml | 13 + doc_classes/WebRTCPeerConnectionGDNative.xml | 13 + gdnative.cpp | 581 ++ gdnative.h | 182 + gdnative/aabb.cpp | 220 + gdnative/array.cpp | 366 + gdnative/basis.cpp | 298 + gdnative/color.cpp | 222 + gdnative/dictionary.cpp | 199 + gdnative/gdnative.cpp | 193 + gdnative/node_path.cpp | 126 + gdnative/plane.cpp | 178 + gdnative/pool_arrays.cpp | 1075 +++ gdnative/quat.cpp | 237 + gdnative/rect2.cpp | 178 + gdnative/rid.cpp | 76 + gdnative/string.cpp | 1397 ++++ gdnative/string_name.cpp | 91 + gdnative/transform.cpp | 230 + gdnative/transform2d.cpp | 216 + gdnative/variant.cpp | 528 ++ gdnative/vector2.cpp | 313 + gdnative/vector3.cpp | 320 + gdnative_api.json | 6844 ++++++++++++++++++ gdnative_builders.py | 350 + gdnative_library_editor_plugin.cpp | 426 ++ gdnative_library_editor_plugin.h | 113 + gdnative_library_singleton_editor.cpp | 212 + gdnative_library_singleton_editor.h | 63 + icons/icon_g_d_native_library.svg | 5 + icons/icon_native_script.svg | 5 + include/android/godot_android.h | 56 + include/arvr/godot_arvr.h | 98 + include/gdnative/aabb.h | 118 + include/gdnative/array.h | 147 + include/gdnative/basis.h | 136 + include/gdnative/color.h | 120 + include/gdnative/dictionary.h | 113 + include/gdnative/gdnative.h | 304 + include/gdnative/node_path.h | 89 + include/gdnative/plane.h | 103 + include/gdnative/pool_arrays.h | 508 ++ include/gdnative/quat.h | 118 + include/gdnative/rect2.h | 102 + include/gdnative/rid.h | 74 + include/gdnative/string.h | 267 + include/gdnative/string_name.h | 78 + include/gdnative/transform.h | 111 + include/gdnative/transform2d.h | 111 + include/gdnative/variant.h | 255 + include/gdnative/vector2.h | 142 + include/gdnative/vector3.h | 149 + include/nativescript/godot_nativescript.h | 257 + include/net/godot_net.h | 120 + include/net/godot_webrtc.h | 129 + include/pluginscript/godot_pluginscript.h | 172 + include/videodecoder/godot_videodecoder.h | 75 + nativescript/SCsub | 9 + nativescript/api_generator.cpp | 528 ++ nativescript/api_generator.h | 39 + nativescript/godot_nativescript.cpp | 322 + nativescript/nativescript.cpp | 1829 +++++ nativescript/nativescript.h | 394 + nativescript/register_types.cpp | 71 + nativescript/register_types.h | 37 + net/SCsub | 12 + net/multiplayer_peer_gdnative.cpp | 125 + net/multiplayer_peer_gdnative.h | 77 + net/packet_peer_gdnative.cpp | 72 + net/packet_peer_gdnative.h | 59 + net/register_types.cpp | 43 + net/register_types.h | 37 + net/stream_peer_gdnative.cpp | 77 + net/stream_peer_gdnative.h | 60 + net/webrtc_gdnative.cpp | 60 + pluginscript/SCsub | 6 + pluginscript/pluginscript_instance.cpp | 139 + pluginscript/pluginscript_instance.h | 88 + pluginscript/pluginscript_language.cpp | 418 ++ pluginscript/pluginscript_language.h | 133 + pluginscript/pluginscript_loader.cpp | 114 + pluginscript/pluginscript_loader.h | 62 + pluginscript/pluginscript_script.cpp | 520 ++ pluginscript/pluginscript_script.h | 130 + pluginscript/register_types.cpp | 121 + pluginscript/register_types.h | 37 + register_types.cpp | 372 + register_types.h | 37 + videodecoder/SCsub | 9 + videodecoder/register_types.cpp | 48 + videodecoder/register_types.h | 37 + videodecoder/video_stream_gdnative.cpp | 400 + videodecoder/video_stream_gdnative.h | 207 + 111 files changed, 27013 insertions(+) create mode 100644 LICENSE.txt create mode 100644 SCsub create mode 100644 android/android_gdn.cpp create mode 100644 arvr/SCsub create mode 100644 arvr/arvr_interface_gdnative.cpp create mode 100644 arvr/arvr_interface_gdnative.h create mode 100644 arvr/register_types.cpp create mode 100644 arvr/register_types.h create mode 100644 config.py create mode 100644 doc_classes/ARVRInterfaceGDNative.xml create mode 100644 doc_classes/GDNative.xml create mode 100644 doc_classes/GDNativeLibrary.xml create mode 100644 doc_classes/MultiplayerPeerGDNative.xml create mode 100644 doc_classes/NativeScript.xml create mode 100644 doc_classes/PacketPeerGDNative.xml create mode 100644 doc_classes/PluginScript.xml create mode 100644 doc_classes/StreamPeerGDNative.xml create mode 100644 doc_classes/VideoStreamGDNative.xml create mode 100644 doc_classes/WebRTCDataChannelGDNative.xml create mode 100644 doc_classes/WebRTCPeerConnectionGDNative.xml create mode 100644 gdnative.cpp create mode 100644 gdnative.h create mode 100644 gdnative/aabb.cpp create mode 100644 gdnative/array.cpp create mode 100644 gdnative/basis.cpp create mode 100644 gdnative/color.cpp create mode 100644 gdnative/dictionary.cpp create mode 100644 gdnative/gdnative.cpp create mode 100644 gdnative/node_path.cpp create mode 100644 gdnative/plane.cpp create mode 100644 gdnative/pool_arrays.cpp create mode 100644 gdnative/quat.cpp create mode 100644 gdnative/rect2.cpp create mode 100644 gdnative/rid.cpp create mode 100644 gdnative/string.cpp create mode 100644 gdnative/string_name.cpp create mode 100644 gdnative/transform.cpp create mode 100644 gdnative/transform2d.cpp create mode 100644 gdnative/variant.cpp create mode 100644 gdnative/vector2.cpp create mode 100644 gdnative/vector3.cpp create mode 100644 gdnative_api.json create mode 100644 gdnative_builders.py create mode 100644 gdnative_library_editor_plugin.cpp create mode 100644 gdnative_library_editor_plugin.h create mode 100644 gdnative_library_singleton_editor.cpp create mode 100644 gdnative_library_singleton_editor.h create mode 100644 icons/icon_g_d_native_library.svg create mode 100644 icons/icon_native_script.svg create mode 100644 include/android/godot_android.h create mode 100644 include/arvr/godot_arvr.h create mode 100644 include/gdnative/aabb.h create mode 100644 include/gdnative/array.h create mode 100644 include/gdnative/basis.h create mode 100644 include/gdnative/color.h create mode 100644 include/gdnative/dictionary.h create mode 100644 include/gdnative/gdnative.h create mode 100644 include/gdnative/node_path.h create mode 100644 include/gdnative/plane.h create mode 100644 include/gdnative/pool_arrays.h create mode 100644 include/gdnative/quat.h create mode 100644 include/gdnative/rect2.h create mode 100644 include/gdnative/rid.h create mode 100644 include/gdnative/string.h create mode 100644 include/gdnative/string_name.h create mode 100644 include/gdnative/transform.h create mode 100644 include/gdnative/transform2d.h create mode 100644 include/gdnative/variant.h create mode 100644 include/gdnative/vector2.h create mode 100644 include/gdnative/vector3.h create mode 100644 include/nativescript/godot_nativescript.h create mode 100644 include/net/godot_net.h create mode 100644 include/net/godot_webrtc.h create mode 100644 include/pluginscript/godot_pluginscript.h create mode 100644 include/videodecoder/godot_videodecoder.h create mode 100644 nativescript/SCsub create mode 100644 nativescript/api_generator.cpp create mode 100644 nativescript/api_generator.h create mode 100644 nativescript/godot_nativescript.cpp create mode 100644 nativescript/nativescript.cpp create mode 100644 nativescript/nativescript.h create mode 100644 nativescript/register_types.cpp create mode 100644 nativescript/register_types.h create mode 100644 net/SCsub create mode 100644 net/multiplayer_peer_gdnative.cpp create mode 100644 net/multiplayer_peer_gdnative.h create mode 100644 net/packet_peer_gdnative.cpp create mode 100644 net/packet_peer_gdnative.h create mode 100644 net/register_types.cpp create mode 100644 net/register_types.h create mode 100644 net/stream_peer_gdnative.cpp create mode 100644 net/stream_peer_gdnative.h create mode 100644 net/webrtc_gdnative.cpp create mode 100644 pluginscript/SCsub create mode 100644 pluginscript/pluginscript_instance.cpp create mode 100644 pluginscript/pluginscript_instance.h create mode 100644 pluginscript/pluginscript_language.cpp create mode 100644 pluginscript/pluginscript_language.h create mode 100644 pluginscript/pluginscript_loader.cpp create mode 100644 pluginscript/pluginscript_loader.h create mode 100644 pluginscript/pluginscript_script.cpp create mode 100644 pluginscript/pluginscript_script.h create mode 100644 pluginscript/register_types.cpp create mode 100644 pluginscript/register_types.h create mode 100644 register_types.cpp create mode 100644 register_types.h create mode 100644 videodecoder/SCsub create mode 100644 videodecoder/register_types.cpp create mode 100644 videodecoder/register_types.h create mode 100644 videodecoder/video_stream_gdnative.cpp create mode 100644 videodecoder/video_stream_gdnative.h diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..c73b002 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +Copyright (c) 2023-present Péter Magyar. +Copyright (c) 2014-2023 Godot Engine contributors (cf. AUTHORS.md). +Copyright (c) 2007-2023 Juan Linietsky, Ariel Manzur. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SCsub b/SCsub new file mode 100644 index 0000000..bc88084 --- /dev/null +++ b/SCsub @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +Import("env") +Import("env_modules") + +env_gdnative = env_modules.Clone() +env_gdnative.add_source_files(env.modules_sources, "gdnative.cpp") +env_gdnative.add_source_files(env.modules_sources, "register_types.cpp") +env_gdnative.add_source_files(env.modules_sources, "android/*.cpp") +env_gdnative.add_source_files(env.modules_sources, "gdnative/*.cpp") +env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp") +env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp") +env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp") + +env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"]) + +Export("env_gdnative") + +SConscript("net/SCsub") +SConscript("arvr/SCsub") +SConscript("pluginscript/SCsub") +SConscript("videodecoder/SCsub") + + +from methods import get_cmdline_bool +from platform_methods import run_in_subprocess +import gdnative_builders + +_, gensource = env_gdnative.CommandNoCache( + ["include/gdnative_api_struct.gen.h", "gdnative_api_struct.gen.cpp"], + "gdnative_api.json", + run_in_subprocess(gdnative_builders.build_gdnative_api_struct), +) +env_gdnative.add_source_files(env.modules_sources, [gensource]) + +env.use_ptrcall = True + + +if get_cmdline_bool("gdnative_wrapper", False): + (gensource,) = env_gdnative.CommandNoCache( + "gdnative_wrapper_code.gen.cpp", + "gdnative_api.json", + run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code), + ) + + gd_wrapper_env = env.Clone() + gd_wrapper_env.Prepend(CPPPATH=["#modules/gdnative/include/"]) + + if gd_wrapper_env["use_lto"]: + if not env.msvc: + gd_wrapper_env.Append(CCFLAGS=["-fno-lto"]) + gd_wrapper_env.Append(LINKFLAGS=["-fno-lto"]) + else: + gd_wrapper_env.Append(CCFLAGS=["/GL-"]) + gd_wrapper_env.Append(LINKFLAGS=["/LTCG:OFF"]) + + if not env.msvc: + gd_wrapper_env.Append(CCFLAGS=["-fPIC"]) + + lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource]) diff --git a/android/android_gdn.cpp b/android/android_gdn.cpp new file mode 100644 index 0000000..ed39eaa --- /dev/null +++ b/android/android_gdn.cpp @@ -0,0 +1,86 @@ +/**************************************************************************/ +/* android_gdn.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "modules/gdnative/gdnative.h" + +// Code by Paritosh97 with minor tweaks by Mux213 +// These entry points are only for the android platform and are simple stubs in all others. + +#ifdef __ANDROID__ +#include "platform/android/java_godot_wrapper.h" +#include "platform/android/os_android.h" +#include "platform/android/thread_jandroid.h" +#else +#define JNIEnv void +#define jobject void * +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +JNIEnv *GDAPI godot_android_get_env() { +#ifdef __ANDROID__ + return get_jni_env(); +#else + return nullptr; +#endif +} + +jobject GDAPI godot_android_get_activity() { +#ifdef __ANDROID__ + OS_Android *os_android = (OS_Android *)OS::get_singleton(); + return os_android->get_godot_java()->get_activity(); +#else + return nullptr; +#endif +} + +jobject GDAPI godot_android_get_surface() { +#ifdef __ANDROID__ + OS_Android *os_android = (OS_Android *)OS::get_singleton(); + return os_android->get_godot_java()->get_surface(); +#else + return nullptr; +#endif +} + +bool GDAPI godot_android_is_activity_resumed() { +#ifdef __ANDROID__ + OS_Android *os_android = (OS_Android *)OS::get_singleton(); + return os_android->get_godot_java()->is_activity_resumed(); +#else + return false; +#endif +} + +#ifdef __cplusplus +} +#endif diff --git a/arvr/SCsub b/arvr/SCsub new file mode 100644 index 0000000..0b2db3b --- /dev/null +++ b/arvr/SCsub @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +Import("env") +Import("env_gdnative") + +env_gdnative.add_source_files(env.modules_sources, "*.cpp") diff --git a/arvr/arvr_interface_gdnative.cpp b/arvr/arvr_interface_gdnative.cpp new file mode 100644 index 0000000..aec17cf --- /dev/null +++ b/arvr/arvr_interface_gdnative.cpp @@ -0,0 +1,450 @@ +/**************************************************************************/ +/* arvr_interface_gdnative.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "arvr_interface_gdnative.h" +#include "main/input_default.h" +#include "servers/arvr/arvr_positional_tracker.h" +#include "servers/visual/visual_server_globals.h" + +void ARVRInterfaceGDNative::_bind_methods() { + ADD_PROPERTY_DEFAULT("interface_is_initialized", false); + ADD_PROPERTY_DEFAULT("ar_is_anchor_detection_enabled", false); +} + +ARVRInterfaceGDNative::ARVRInterfaceGDNative() { + print_verbose("Construct gdnative interface\n"); + + // we won't have our data pointer until our library gets set + data = nullptr; + + interface = nullptr; +} + +ARVRInterfaceGDNative::~ARVRInterfaceGDNative() { + print_verbose("Destruct gdnative interface\n"); + + if (interface != nullptr && is_initialized()) { + uninitialize(); + }; + + // cleanup after ourselves + cleanup(); +} + +void ARVRInterfaceGDNative::cleanup() { + if (interface != nullptr) { + interface->destructor(data); + data = nullptr; + interface = nullptr; + } +} + +void ARVRInterfaceGDNative::set_interface(const godot_arvr_interface_gdnative *p_interface) { + // this should only be called once, just being paranoid.. + if (interface) { + cleanup(); + } + + // bind to our interface + interface = p_interface; + + // Now we do our constructing... + data = interface->constructor((godot_object *)this); +} + +StringName ARVRInterfaceGDNative::get_name() const { + ERR_FAIL_COND_V(interface == nullptr, StringName()); + + godot_string result = interface->get_name(data); + + StringName name = *(String *)&result; + + godot_string_destroy(&result); + + return name; +} + +int ARVRInterfaceGDNative::get_capabilities() const { + int capabilities; + + ERR_FAIL_COND_V(interface == nullptr, 0); // 0 = None + + capabilities = interface->get_capabilities(data); + + return capabilities; +} + +bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const { + ERR_FAIL_COND_V(interface == nullptr, false); + + return interface->get_anchor_detection_is_enabled(data); +} + +void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) { + ERR_FAIL_COND(interface == nullptr); + + interface->set_anchor_detection_is_enabled(data, p_enable); +} + +int ARVRInterfaceGDNative::get_camera_feed_id() { + ERR_FAIL_COND_V(interface == nullptr, 0); + + if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) { + return (unsigned int)interface->get_camera_feed_id(data); + } else { + return 0; + } +} + +bool ARVRInterfaceGDNative::is_stereo() { + bool stereo; + + ERR_FAIL_COND_V(interface == nullptr, false); + + stereo = interface->is_stereo(data); + + return stereo; +} + +bool ARVRInterfaceGDNative::is_initialized() const { + ERR_FAIL_COND_V(interface == nullptr, false); + + return interface->is_initialized(data); +} + +bool ARVRInterfaceGDNative::initialize() { + ERR_FAIL_COND_V(interface == nullptr, false); + + bool initialized = interface->initialize(data); + + if (initialized) { + // if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface + + ARVRServer *arvr_server = ARVRServer::get_singleton(); + if ((arvr_server != nullptr) && (arvr_server->get_primary_interface() == nullptr)) { + arvr_server->set_primary_interface(this); + }; + }; + + return initialized; +} + +void ARVRInterfaceGDNative::uninitialize() { + ERR_FAIL_COND(interface == nullptr); + + ARVRServer *arvr_server = ARVRServer::get_singleton(); + if (arvr_server != nullptr) { + // Whatever happens, make sure this is no longer our primary interface + arvr_server->clear_primary_interface_if(this); + } + + interface->uninitialize(data); +} + +Size2 ARVRInterfaceGDNative::get_render_targetsize() { + ERR_FAIL_COND_V(interface == nullptr, Size2()); + + godot_vector2 result = interface->get_render_targetsize(data); + Vector2 *vec = (Vector2 *)&result; + + return *vec; +} + +Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) { + Transform *ret; + + ERR_FAIL_COND_V(interface == nullptr, Transform()); + + godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); + + ret = (Transform *)&t; + + return *ret; +} + +CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { + CameraMatrix cm; + + ERR_FAIL_COND_V(interface == nullptr, CameraMatrix()); + + interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far); + + return cm; +} + +unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::Eyes p_eye) { + ERR_FAIL_COND_V(interface == nullptr, 0); + + if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) { + return (unsigned int)interface->get_external_texture_for_eye(data, (godot_int)p_eye); + } else { + return 0; + } +} + +unsigned int ARVRInterfaceGDNative::get_external_depth_for_eye(ARVRInterface::Eyes p_eye) { + ERR_FAIL_COND_V(interface == nullptr, 0); + + if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 2))) { + return (unsigned int)interface->get_external_depth_for_eye(data, (godot_int)p_eye); + } else { + return 0; + } +} + +void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { + ERR_FAIL_COND(interface == nullptr); + + interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect); +} + +void ARVRInterfaceGDNative::process() { + ERR_FAIL_COND(interface == nullptr); + + interface->process(data); +} + +void ARVRInterfaceGDNative::notification(int p_what) { + ERR_FAIL_COND(interface == nullptr); + + // this is only available in interfaces that implement 1.1 or later + if ((interface->version.major > 1) || ((interface->version.major == 1) && (interface->version.minor > 0))) { + interface->notification(data, p_what); + } +} + +///////////////////////////////////////////////////////////////////////////////////// +// some helper callbacks + +extern "C" { + +void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) { + // If our major version is 0 or bigger then 10, we're likely looking at our constructor pointer from an older plugin + ERR_FAIL_COND_MSG((p_interface->version.major == 0) || (p_interface->version.major > 10), "GDNative ARVR interfaces build for Godot 3.0 are not supported."); + + Ref new_interface; + new_interface.instance(); + new_interface->set_interface((const godot_arvr_interface_gdnative *)p_interface); + ARVRServer::get_singleton()->add_interface(new_interface); +} + +godot_real GDAPI godot_arvr_get_worldscale() { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, 1.0); + + return arvr_server->get_world_scale(); +} + +godot_transform GDAPI godot_arvr_get_reference_frame() { + godot_transform reference_frame; + Transform *reference_frame_ptr = (Transform *)&reference_frame; + + ARVRServer *arvr_server = ARVRServer::get_singleton(); + if (arvr_server != nullptr) { + *reference_frame_ptr = arvr_server->get_reference_frame(); + } else { + godot_transform_new_identity(&reference_frame); + } + + return reference_frame; +} + +void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect) { + // blits out our texture as is, handy for preview display of one of the eyes that is already rendered with lens distortion on an external HMD + ARVRInterface::Eyes eye = (ARVRInterface::Eyes)p_eye; + RID *render_target = (RID *)p_render_target; + Rect2 screen_rect = *(Rect2 *)p_rect; + + if (eye == ARVRInterface::EYE_LEFT) { + screen_rect.size.x /= 2.0; + } else if (p_eye == ARVRInterface::EYE_RIGHT) { + screen_rect.size.x /= 2.0; + screen_rect.position.x += screen_rect.size.x; + } + + VSG::rasterizer->set_current_render_target(RID()); + VSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0); +} + +godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) { + // In order to send off our textures to display on our hardware we need the opengl texture ID instead of the render target RID + // This is a handy function to expose that. + RID *render_target = (RID *)p_render_target; + + RID eye_texture = VSG::storage->render_target_get_texture(*render_target); + uint32_t texid = VS::get_singleton()->texture_get_texid(eye_texture); + + return texid; +} + +godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, 0); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL_V(input, 0); + + Ref new_tracker; + new_tracker.instance(); + new_tracker->set_name(p_device_name); + new_tracker->set_type(ARVRServer::TRACKER_CONTROLLER); + if (p_hand == 1) { + new_tracker->set_hand(ARVRPositionalTracker::TRACKER_LEFT_HAND); + } else if (p_hand == 2) { + new_tracker->set_hand(ARVRPositionalTracker::TRACKER_RIGHT_HAND); + } + + // also register as joystick... + int joyid = input->get_unused_joy_id(); + if (joyid != -1) { + new_tracker->set_joy_id(joyid); + input->joy_connection_changed(joyid, true, p_device_name, ""); + } + + if (p_tracks_orientation) { + Basis orientation; + new_tracker->set_orientation(orientation); + } + if (p_tracks_position) { + Vector3 position; + new_tracker->set_position(position); + } + + // add our tracker to our server and remember its pointer + arvr_server->add_tracker(new_tracker); + + // note, this ID is only unique within controllers! + return new_tracker->get_tracker_id(); +} + +void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL(input); + + Ref remove_tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (remove_tracker.is_valid()) { + // unset our joystick if applicable + int joyid = remove_tracker->get_joy_id(); + if (joyid != -1) { + input->joy_connection_changed(joyid, false, "", ""); + remove_tracker->set_joy_id(-1); + } + + // remove our tracker from our server + arvr_server->remove_tracker(remove_tracker); + remove_tracker.unref(); + } +} + +void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker.is_valid()) { + Transform *transform = (Transform *)p_transform; + if (p_tracks_orientation) { + tracker->set_orientation(transform->basis); + } + if (p_tracks_position) { + tracker->set_rw_position(transform->origin); + } + } +} + +void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL(input); + + Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker.is_valid()) { + int joyid = tracker->get_joy_id(); + if (joyid != -1) { + input->joy_button(joyid, p_button, p_is_pressed); + } + } +} + +void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + InputDefault *input = (InputDefault *)Input::get_singleton(); + ERR_FAIL_NULL(input); + + Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker.is_valid()) { + int joyid = tracker->get_joy_id(); + if (joyid != -1) { + float value = p_value; + if (!p_can_be_negative) { + // Convert to a value between -1.0f and 1.0f. + value = p_value * 2.0f - 1.0f; + } + input->joy_axis(joyid, p_axis, value); + } + } +} + +godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id) { + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, 0.0); + + Ref tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id); + if (tracker.is_valid()) { + return tracker->get_rumble(); + } + + return 0.0; +} + +void GDAPI godot_arvr_set_interface(godot_object *p_arvr_interface, const godot_arvr_interface_gdnative *p_gdn_interface) { + // If our major version is 0 or bigger then 10, we're likely looking at our constructor pointer from an older plugin + ERR_FAIL_COND_MSG((p_gdn_interface->version.major == 0) || (p_gdn_interface->version.major > 10), "GDNative ARVR interfaces build for Godot 3.0 are not supported."); + + ARVRInterfaceGDNative *interface = (ARVRInterfaceGDNative *)p_arvr_interface; + interface->set_interface((const godot_arvr_interface_gdnative *)p_gdn_interface); +} + +godot_int GDAPI godot_arvr_get_depthid(godot_rid *p_render_target) { + // We also need to access our depth texture for reprojection. + RID *render_target = (RID *)p_render_target; + + uint32_t texid = VSG::storage->render_target_get_depth_texture_id(*render_target); + + return texid; +} +} diff --git a/arvr/arvr_interface_gdnative.h b/arvr/arvr_interface_gdnative.h new file mode 100644 index 0000000..74c777e --- /dev/null +++ b/arvr/arvr_interface_gdnative.h @@ -0,0 +1,89 @@ +/**************************************************************************/ +/* arvr_interface_gdnative.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef ARVR_INTERFACE_GDNATIVE_H +#define ARVR_INTERFACE_GDNATIVE_H + +#include "modules/gdnative/gdnative.h" +#include "servers/arvr/arvr_interface.h" + +/** + @authors Hinsbart & Karroffel & Mux213 + + This subclass of our AR/VR interface forms a bridge to GDNative. +*/ + +class ARVRInterfaceGDNative : public ARVRInterface { + GDCLASS(ARVRInterfaceGDNative, ARVRInterface); + + void cleanup(); + +protected: + const godot_arvr_interface_gdnative *interface; + void *data; + + static void _bind_methods(); + +public: + /** general interface information **/ + ARVRInterfaceGDNative(); + ~ARVRInterfaceGDNative(); + + void set_interface(const godot_arvr_interface_gdnative *p_interface); + + virtual StringName get_name() const; + virtual int get_capabilities() const; + + virtual bool is_initialized() const; + virtual bool initialize(); + virtual void uninitialize(); + + /** specific to AR **/ + virtual bool get_anchor_detection_is_enabled() const; + virtual void set_anchor_detection_is_enabled(bool p_enable); + virtual int get_camera_feed_id(); + + /** rendering and internal **/ + virtual Size2 get_render_targetsize(); + virtual bool is_stereo(); + virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform); + + // and a CameraMatrix version to ARVRServer + virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); + + virtual unsigned int get_external_texture_for_eye(ARVRInterface::Eyes p_eye); + virtual unsigned int get_external_depth_for_eye(ARVRInterface::Eyes p_eye); + virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect); + + virtual void process(); + virtual void notification(int p_what); +}; + +#endif // ARVR_INTERFACE_GDNATIVE_H diff --git a/arvr/register_types.cpp b/arvr/register_types.cpp new file mode 100644 index 0000000..6c647ce --- /dev/null +++ b/arvr/register_types.cpp @@ -0,0 +1,39 @@ +/**************************************************************************/ +/* register_types.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "register_types.h" +#include "arvr_interface_gdnative.h" + +void register_arvr_types() { + ClassDB::register_class(); +} + +void unregister_arvr_types() { +} diff --git a/arvr/register_types.h b/arvr/register_types.h new file mode 100644 index 0000000..1cb784b --- /dev/null +++ b/arvr/register_types.h @@ -0,0 +1,37 @@ +/**************************************************************************/ +/* register_types.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef ARVR_REGISTER_TYPES_H +#define ARVR_REGISTER_TYPES_H + +void register_arvr_types(); +void unregister_arvr_types(); + +#endif // ARVR_REGISTER_TYPES_H diff --git a/config.py b/config.py new file mode 100644 index 0000000..bf371ed --- /dev/null +++ b/config.py @@ -0,0 +1,26 @@ +def can_build(env, platform): + return True + + +def configure(env): + env.use_ptrcall = True + + +def get_doc_classes(): + return [ + "ARVRInterfaceGDNative", + "GDNative", + "GDNativeLibrary", + "MultiplayerPeerGDNative", + "NativeScript", + "PacketPeerGDNative", + "PluginScript", + "StreamPeerGDNative", + "VideoStreamGDNative", + "WebRTCPeerConnectionGDNative", + "WebRTCDataChannelGDNative", + ] + + +def get_doc_path(): + return "doc_classes" diff --git a/doc_classes/ARVRInterfaceGDNative.xml b/doc_classes/ARVRInterfaceGDNative.xml new file mode 100644 index 0000000..1598dba --- /dev/null +++ b/doc_classes/ARVRInterfaceGDNative.xml @@ -0,0 +1,15 @@ + + + + GDNative wrapper for an ARVR interface. + + + This is a wrapper class for GDNative implementations of the ARVR interface. To use a GDNative ARVR interface, simply instantiate this object and set your GDNative library containing the ARVR interface implementation. + + + + + + + + diff --git a/doc_classes/GDNative.xml b/doc_classes/GDNative.xml new file mode 100644 index 0000000..c983685 --- /dev/null +++ b/doc_classes/GDNative.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc_classes/GDNativeLibrary.xml b/doc_classes/GDNativeLibrary.xml new file mode 100644 index 0000000..2152321 --- /dev/null +++ b/doc_classes/GDNativeLibrary.xml @@ -0,0 +1,50 @@ + + + + An external library containing functions or script classes to use in Godot. + + + A GDNative library can implement [NativeScript]s, global functions to call with the [GDNative] class, or low-level engine extensions through interfaces such as [ARVRInterfaceGDNative]. The library must be compiled for each platform and architecture that the project will run on. + + + $DOCS_URL/tutorials/scripting/gdnative/gdnative_c_example.html + $DOCS_URL/tutorials/scripting/gdnative/gdnative_cpp_example.html + + + + + + Returns paths to all dependency libraries for the current platform and architecture. + + + + + + Returns the path to the dynamic library file for the current platform and architecture. + + + + + + This resource in INI-style [ConfigFile] format, as in [code].gdnlib[/code] files. + + + If [code]true[/code], Godot loads only one copy of the library and each script that references the library will share static data like static or global variables. + If [code]false[/code], Godot loads a separate copy of the library into memory for each script that references it. + + + If [code]true[/code], the editor will temporarily unload the library whenever the user switches away from the editor window, allowing the user to recompile the library without restarting Godot. + [b]Note:[/b] If the library defines tool scripts that run inside the editor, [code]reloadable[/code] must be [code]false[/code]. Otherwise, the editor will attempt to unload the tool scripts while they're in use and crash. + + + If [code]true[/code], Godot loads the library at startup rather than the first time a script uses the library, calling [code]{prefix}gdnative_singleton[/code] after initializing the library (where [code]{prefix}[/code] is the value of [member symbol_prefix]). The library remains loaded as long as Godot is running. + [b]Note:[/b] A singleton library cannot be [member reloadable]. + + + The prefix this library's entry point functions begin with. For example, a GDNativeLibrary would declare its [code]gdnative_init[/code] function as [code]godot_gdnative_init[/code] by default. + On platforms that require statically linking libraries (currently only iOS), each library must have a different [code]symbol_prefix[/code]. + + + + + diff --git a/doc_classes/MultiplayerPeerGDNative.xml b/doc_classes/MultiplayerPeerGDNative.xml new file mode 100644 index 0000000..bc530ad --- /dev/null +++ b/doc_classes/MultiplayerPeerGDNative.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/doc_classes/NativeScript.xml b/doc_classes/NativeScript.xml new file mode 100644 index 0000000..fda4ad2 --- /dev/null +++ b/doc_classes/NativeScript.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + Returns the documentation string that was previously set with [code]godot_nativescript_set_class_documentation[/code]. + + + + + + + Returns the documentation string that was previously set with [code]godot_nativescript_set_method_documentation[/code]. + + + + + + + Returns the documentation string that was previously set with [code]godot_nativescript_set_property_documentation[/code]. + + + + + + + Returns the documentation string that was previously set with [code]godot_nativescript_set_signal_documentation[/code]. + + + + + + Constructs a new object of the base type with a script of this type already attached. + [b]Note:[/b] Any arguments passed to this function will be ignored and not passed to the native constructor function. This will change with in a future API extension. + + + + + + + + + + + + + + + + diff --git a/doc_classes/PacketPeerGDNative.xml b/doc_classes/PacketPeerGDNative.xml new file mode 100644 index 0000000..9de40ce --- /dev/null +++ b/doc_classes/PacketPeerGDNative.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/doc_classes/PluginScript.xml b/doc_classes/PluginScript.xml new file mode 100644 index 0000000..10df68d --- /dev/null +++ b/doc_classes/PluginScript.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + Returns a new instance of the script. + + + + + + diff --git a/doc_classes/StreamPeerGDNative.xml b/doc_classes/StreamPeerGDNative.xml new file mode 100644 index 0000000..70fd3c0 --- /dev/null +++ b/doc_classes/StreamPeerGDNative.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/doc_classes/VideoStreamGDNative.xml b/doc_classes/VideoStreamGDNative.xml new file mode 100644 index 0000000..3952628 --- /dev/null +++ b/doc_classes/VideoStreamGDNative.xml @@ -0,0 +1,29 @@ + + + + [VideoStream] resource for video formats implemented via GDNative. + + + [VideoStream] resource for video formats implemented via GDNative. + It can be used via [url=https://github.com/KidRigger/godot-videodecoder]godot-videodecoder[/url] which uses the [url=https://ffmpeg.org]FFmpeg[/url] library. + + + + + + + + Returns the video file handled by this [VideoStreamGDNative]. + + + + + + + Sets the video file that this [VideoStreamGDNative] resource handles. The supported extensions depend on the GDNative plugins used to expose video formats. + + + + + + diff --git a/doc_classes/WebRTCDataChannelGDNative.xml b/doc_classes/WebRTCDataChannelGDNative.xml new file mode 100644 index 0000000..9a44ba5 --- /dev/null +++ b/doc_classes/WebRTCDataChannelGDNative.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/doc_classes/WebRTCPeerConnectionGDNative.xml b/doc_classes/WebRTCPeerConnectionGDNative.xml new file mode 100644 index 0000000..8d379b7 --- /dev/null +++ b/doc_classes/WebRTCPeerConnectionGDNative.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/gdnative.cpp b/gdnative.cpp new file mode 100644 index 0000000..291a286 --- /dev/null +++ b/gdnative.cpp @@ -0,0 +1,581 @@ +/**************************************************************************/ +/* gdnative.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative.h" + +#include "core/global_constants.h" +#include "core/io/file_access_encrypted.h" +#include "core/os/dir_access.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" + +#include "scene/main/scene_tree.h" + +static const String init_symbol = "gdnative_init"; +static const String terminate_symbol = "gdnative_terminate"; +static const String default_symbol_prefix = "godot_"; +static const bool default_singleton = false; +static const bool default_load_once = true; +static const bool default_reloadable = true; + +// Defined in gdnative_api_struct.gen.cpp +extern const godot_gdnative_core_api_struct api_struct; + +Map>> GDNativeLibrary::loaded_libraries; + +GDNativeLibrary::GDNativeLibrary() { + config_file.instance(); + + symbol_prefix = default_symbol_prefix; + load_once = default_load_once; + singleton = default_singleton; + reloadable = default_reloadable; +} + +GDNativeLibrary::~GDNativeLibrary() { +} + +bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_property) { + String name = p_name; + + if (name.begins_with("entry/")) { + String key = name.substr(6, name.length() - 6); + + config_file->set_value("entry", key, p_property); + + set_config_file(config_file); + + return true; + } + + if (name.begins_with("dependency/")) { + String key = name.substr(11, name.length() - 11); + + config_file->set_value("dependencies", key, p_property); + + set_config_file(config_file); + + return true; + } + + return false; +} + +bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_property) const { + String name = p_name; + + if (name.begins_with("entry/")) { + String key = name.substr(6, name.length() - 6); + + r_property = config_file->get_value("entry", key); + + return true; + } + + if (name.begins_with("dependency/")) { + String key = name.substr(11, name.length() - 11); + + r_property = config_file->get_value("dependencies", key); + + return true; + } + + return false; +} + +void GDNativeLibrary::_get_property_list(List *p_list) const { + // set entries + List entry_key_list; + + if (config_file->has_section("entry")) { + config_file->get_section_keys("entry", &entry_key_list); + } + + for (List::Element *E = entry_key_list.front(); E; E = E->next()) { + String key = E->get(); + + PropertyInfo prop; + + prop.type = Variant::STRING; + prop.name = "entry/" + key; + + p_list->push_back(prop); + } + + // set dependencies + List dependency_key_list; + + if (config_file->has_section("dependencies")) { + config_file->get_section_keys("dependencies", &dependency_key_list); + } + + for (List::Element *E = dependency_key_list.front(); E; E = E->next()) { + String key = E->get(); + + PropertyInfo prop; + + prop.type = Variant::STRING; + prop.name = "dependency/" + key; + + p_list->push_back(prop); + } +} + +void GDNativeLibrary::set_config_file(Ref p_config_file) { + ERR_FAIL_COND(p_config_file.is_null()); + + set_singleton(p_config_file->get_value("general", "singleton", default_singleton)); + set_load_once(p_config_file->get_value("general", "load_once", default_load_once)); + set_symbol_prefix(p_config_file->get_value("general", "symbol_prefix", default_symbol_prefix)); + set_reloadable(p_config_file->get_value("general", "reloadable", default_reloadable)); + + String entry_lib_path; + { + List entry_keys; + + if (p_config_file->has_section("entry")) { + p_config_file->get_section_keys("entry", &entry_keys); + } + + for (List::Element *E = entry_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector tags = key.split("."); + + bool skip = false; + for (int i = 0; i < tags.size(); i++) { + bool has_feature = OS::get_singleton()->has_feature(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + entry_lib_path = p_config_file->get_value("entry", key); + break; + } + } + + Vector dependency_paths; + { + List dependency_keys; + + if (p_config_file->has_section("dependencies")) { + p_config_file->get_section_keys("dependencies", &dependency_keys); + } + + for (List::Element *E = dependency_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector tags = key.split("."); + + bool skip = false; + for (int i = 0; i < tags.size(); i++) { + bool has_feature = OS::get_singleton()->has_feature(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + dependency_paths = p_config_file->get_value("dependencies", key); + break; + } + } + + current_library_path = entry_lib_path; + current_dependencies = dependency_paths; +} + +void GDNativeLibrary::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_config_file"), &GDNativeLibrary::get_config_file); + ClassDB::bind_method(D_METHOD("set_config_file", "config_file"), &GDNativeLibrary::set_config_file); + + ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path); + ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies); + + ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once); + ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton); + ClassDB::bind_method(D_METHOD("get_symbol_prefix"), &GDNativeLibrary::get_symbol_prefix); + ClassDB::bind_method(D_METHOD("is_reloadable"), &GDNativeLibrary::is_reloadable); + + ClassDB::bind_method(D_METHOD("set_load_once", "load_once"), &GDNativeLibrary::set_load_once); + ClassDB::bind_method(D_METHOD("set_singleton", "singleton"), &GDNativeLibrary::set_singleton); + ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix); + ClassDB::bind_method(D_METHOD("set_reloadable", "reloadable"), &GDNativeLibrary::set_reloadable); + + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "config_file", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile", 0), "set_config_file", "get_config_file"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "symbol_prefix"), "set_symbol_prefix", "get_symbol_prefix"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "reloadable"), "set_reloadable", "is_reloadable"); +} + +GDNative::GDNative() { + native_handle = nullptr; + initialized = false; +} + +GDNative::~GDNative() { +} + +void GDNative::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNative::set_library); + ClassDB::bind_method(D_METHOD("get_library"), &GDNative::get_library); + + ClassDB::bind_method(D_METHOD("initialize"), &GDNative::initialize); + ClassDB::bind_method(D_METHOD("terminate"), &GDNative::terminate); + + ClassDB::bind_method(D_METHOD("call_native", "calling_type", "procedure_name", "arguments"), &GDNative::call_native); + + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); +} + +void GDNative::set_library(Ref p_library) { + ERR_FAIL_COND_MSG(library.is_valid(), "Tried to change library of GDNative when it is already set."); + library = p_library; +} + +Ref GDNative::get_library() const { + return library; +} + +extern "C" void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have); +extern "C" void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what); + +bool GDNative::initialize() { + if (library.is_null()) { + ERR_PRINT("No library set, can't initialize GDNative object"); + return false; + } + + String lib_path = library->get_current_library_path(); + if (lib_path.empty()) { + ERR_PRINT("No library set for this platform"); + return false; + } +#ifdef IPHONE_ENABLED + // On iOS we use static linking by default. + String path = ""; + + // On iOS dylibs is not allowed, but can be replaced with .framework or .xcframework. + // If they are used, we can run dlopen on them. + // They should be located under Frameworks directory, so we need to replace library path. + if (!lib_path.ends_with(".a")) { + path = ProjectSettings::get_singleton()->globalize_path(lib_path); + + if (!FileAccess::exists(path)) { + String lib_name = lib_path.get_basename().get_file(); + String framework_path_format = "Frameworks/$name.framework/$name"; + + Dictionary format_dict; + format_dict["name"] = lib_name; + String framework_path = framework_path_format.format(format_dict, "$_"); + + path = OS::get_singleton()->get_executable_path().get_base_dir().plus_file(framework_path); + } + } +#elif defined(ANDROID_ENABLED) + // On Android dynamic libraries are located separately from resource assets, + // we should pass library name to dlopen(). The library name is flattened + // during export. + String path = lib_path.get_file(); +#elif defined(UWP_ENABLED) + // On UWP we use a relative path from the app + String path = lib_path.replace("res://", ""); +#elif defined(OSX_ENABLED) + // On OSX the exported libraries are located under the Frameworks directory. + // So we need to replace the library path. + String path = ProjectSettings::get_singleton()->globalize_path(lib_path); + DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + + if (!da->file_exists(path) && !da->dir_exists(path)) { + path = OS::get_singleton()->get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(lib_path.get_file()); + } + + if (da->dir_exists(path)) { // Target library is a ".framework", add library base name to the path. + path = path.plus_file(path.get_file().get_basename()); + } + + memdelete(da); + +#else + String path = ProjectSettings::get_singleton()->globalize_path(lib_path); +#endif + + if (library->should_load_once()) { + if (GDNativeLibrary::loaded_libraries.has(lib_path)) { + // already loaded. Don't load again. + // copy some of the stuff instead + this->native_handle = GDNativeLibrary::loaded_libraries[lib_path][0]->native_handle; + initialized = true; + return true; + } + } + + Error err = OS::get_singleton()->open_dynamic_library(path, native_handle, true); + if (err != OK) { + return false; + } + + void *library_init; + + // we cheat here a little bit. you saw nothing + initialized = true; + + err = get_symbol(library->get_symbol_prefix() + init_symbol, library_init, false); + + initialized = false; + + if (err || !library_init) { + OS::get_singleton()->close_dynamic_library(native_handle); + native_handle = nullptr; + ERR_PRINT("Failed to obtain " + library->get_symbol_prefix() + "gdnative_init symbol"); + return false; + } + + godot_gdnative_init_fn library_init_fpointer; + library_init_fpointer = (godot_gdnative_init_fn)library_init; + + static uint64_t core_api_hash = 0; + static uint64_t editor_api_hash = 0; + static uint64_t no_api_hash = 0; + + if (!(core_api_hash || editor_api_hash || no_api_hash)) { + core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE); + editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); + no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE); + } + + godot_gdnative_init_options options; + + options.api_struct = &api_struct; + options.in_editor = Engine::get_singleton()->is_editor_hint(); + options.core_api_hash = core_api_hash; + options.editor_api_hash = editor_api_hash; + options.no_api_hash = no_api_hash; + options.report_version_mismatch = &_gdnative_report_version_mismatch; + options.report_loading_error = &_gdnative_report_loading_error; + options.gd_native_library = (godot_object *)(get_library().ptr()); + options.active_library_path = (godot_string *)&path; + + library_init_fpointer(&options); + + initialized = true; + + if (library->should_load_once() && !GDNativeLibrary::loaded_libraries.has(lib_path)) { + Vector> gdnatives; + gdnatives.resize(1); + gdnatives.write[0] = Ref(this); + GDNativeLibrary::loaded_libraries.insert(lib_path, gdnatives); + } + + return true; +} + +bool GDNative::terminate() { + if (!initialized) { + ERR_PRINT("No valid library handle, can't terminate GDNative object"); + return false; + } + + if (library->should_load_once()) { + Vector> *gdnatives = &GDNativeLibrary::loaded_libraries[library->get_current_library_path()]; + if (gdnatives->size() > 1) { + // there are other GDNative's still using this library, so we actually don't terminate + gdnatives->erase(Ref(this)); + initialized = false; + return true; + } else if (gdnatives->size() == 1) { + // we're the last one, terminate! + gdnatives->clear(); + // whew this looks scary, but all it does is remove the entry completely + GDNativeLibrary::loaded_libraries.erase(GDNativeLibrary::loaded_libraries.find(library->get_current_library_path())); + } + } + + void *library_terminate; + Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate); + if (error || !library_terminate) { + OS::get_singleton()->close_dynamic_library(native_handle); + native_handle = nullptr; + initialized = false; + return true; + } + + godot_gdnative_terminate_fn library_terminate_pointer; + library_terminate_pointer = (godot_gdnative_terminate_fn)library_terminate; + + godot_gdnative_terminate_options options; + options.in_editor = Engine::get_singleton()->is_editor_hint(); + + library_terminate_pointer(&options); + + initialized = false; + + // GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); + + OS::get_singleton()->close_dynamic_library(native_handle); + native_handle = nullptr; + + return true; +} + +bool GDNative::is_initialized() const { + return initialized; +} + +void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, native_call_cb p_callback) { + native_calls.insert(p_call_type, p_callback); +} + +Vector GDNativeCallRegistry::get_native_call_types() { + Vector call_types; + call_types.resize(native_calls.size()); + + size_t idx = 0; + for (Map::Element *E = native_calls.front(); E; E = E->next(), idx++) { + call_types.write[idx] = E->key(); + } + + return call_types; +} + +Variant GDNative::call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments) { + Map::Element *E = GDNativeCallRegistry::singleton->native_calls.find(p_native_call_type); + if (!E) { + ERR_PRINT((String("No handler for native call type \"" + p_native_call_type) + "\" found").utf8().get_data()); + return Variant(); + } + + void *procedure_handle; + + Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( + native_handle, + p_procedure_name, + procedure_handle); + + if (err != OK || procedure_handle == nullptr) { + return Variant(); + } + + godot_variant result = E->get()(procedure_handle, (godot_array *)&p_arguments); + + Variant res = *(Variant *)&result; + godot_variant_destroy(&result); + return res; +} + +Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional) const { + if (!initialized) { + ERR_PRINT("No valid library handle, can't get symbol from GDNative object"); + return ERR_CANT_OPEN; + } + + Error result = OS::get_singleton()->get_dynamic_library_symbol_handle( + native_handle, + p_procedure_name, + r_handle, + p_optional); + + return result; +} + +RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { + Ref lib; + lib.instance(); + + Ref config = lib->get_config_file(); + + Error err = config->load(p_path); + + if (r_error) { + *r_error = err; + } + + lib->set_config_file(config); + + return lib; +} + +void GDNativeLibraryResourceLoader::get_recognized_extensions(List *p_extensions) const { + p_extensions->push_back("gdnlib"); +} + +bool GDNativeLibraryResourceLoader::handles_type(const String &p_type) const { + return p_type == "GDNativeLibrary"; +} + +String GDNativeLibraryResourceLoader::get_resource_type(const String &p_path) const { + String el = p_path.get_extension().to_lower(); + if (el == "gdnlib") { + return "GDNativeLibrary"; + } + return ""; +} + +Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { + Ref lib = p_resource; + + if (lib.is_null()) { + return ERR_INVALID_DATA; + } + + Ref config = lib->get_config_file(); + + config->set_value("general", "singleton", lib->is_singleton()); + config->set_value("general", "load_once", lib->should_load_once()); + config->set_value("general", "symbol_prefix", lib->get_symbol_prefix()); + config->set_value("general", "reloadable", lib->is_reloadable()); + + return config->save(p_path); +} + +bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const { + return Object::cast_to(*p_resource) != nullptr; +} + +void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { + if (Object::cast_to(*p_resource) != nullptr) { + p_extensions->push_back("gdnlib"); + } +} diff --git a/gdnative.h b/gdnative.h new file mode 100644 index 0000000..237048f --- /dev/null +++ b/gdnative.h @@ -0,0 +1,182 @@ +/**************************************************************************/ +/* gdnative.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_H +#define GDNATIVE_H + +#include "core/io/resource_loader.h" +#include "core/io/resource_saver.h" +#include "core/os/thread_safe.h" +#include "core/resource.h" + +#include "gdnative/gdnative.h" +#include "gdnative_api_struct.gen.h" + +#include "core/io/config_file.h" + +class GDNativeLibraryResourceLoader; +class GDNative; + +class GDNativeLibrary : public Resource { + GDCLASS(GDNativeLibrary, Resource); + + static Map>> loaded_libraries; + + friend class GDNativeLibraryResourceLoader; + friend class GDNative; + + Ref config_file; + + String current_library_path; + Vector current_dependencies; + + bool singleton; + bool load_once; + String symbol_prefix; + bool reloadable; + +public: + GDNativeLibrary(); + ~GDNativeLibrary(); + + virtual bool _set(const StringName &p_name, const Variant &p_property); + virtual bool _get(const StringName &p_name, Variant &r_property) const; + virtual void _get_property_list(List *p_list) const; + + _FORCE_INLINE_ Ref get_config_file() { return config_file; } + + void set_config_file(Ref p_config_file); + + // things that change per-platform + // so there are no setters for this + _FORCE_INLINE_ const String &get_current_library_path() const { + return current_library_path; + } + _FORCE_INLINE_ Vector get_current_dependencies() const { + return current_dependencies; + } + + // things that are a property of the library itself, not platform specific + _FORCE_INLINE_ bool should_load_once() const { + return load_once; + } + _FORCE_INLINE_ bool is_singleton() const { + return singleton; + } + _FORCE_INLINE_ String get_symbol_prefix() const { + return symbol_prefix; + } + + _FORCE_INLINE_ bool is_reloadable() const { + return reloadable; + } + + _FORCE_INLINE_ void set_load_once(bool p_load_once) { + config_file->set_value("general", "load_once", p_load_once); + load_once = p_load_once; + } + _FORCE_INLINE_ void set_singleton(bool p_singleton) { + config_file->set_value("general", "singleton", p_singleton); + singleton = p_singleton; + } + _FORCE_INLINE_ void set_symbol_prefix(String p_symbol_prefix) { + config_file->set_value("general", "symbol_prefix", p_symbol_prefix); + symbol_prefix = p_symbol_prefix; + } + + _FORCE_INLINE_ void set_reloadable(bool p_reloadable) { + config_file->set_value("general", "reloadable", p_reloadable); + reloadable = p_reloadable; + } + + static void _bind_methods(); +}; + +struct GDNativeCallRegistry { + static GDNativeCallRegistry *singleton; + + inline static GDNativeCallRegistry *get_singleton() { + return singleton; + } + + inline GDNativeCallRegistry() : + native_calls() {} + + Map native_calls; + + void register_native_call_type(StringName p_call_type, native_call_cb p_callback); + + Vector get_native_call_types(); +}; + +class GDNative : public Reference { + GDCLASS(GDNative, Reference); + + Ref library; + + void *native_handle; + + bool initialized; + +public: + GDNative(); + ~GDNative(); + + static void _bind_methods(); + + void set_library(Ref p_library); + Ref get_library() const; + + bool is_initialized() const; + + bool initialize(); + bool terminate(); + + Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array()); + + Error get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional = true) const; +}; + +class GDNativeLibraryResourceLoader : public ResourceFormatLoader { +public: + virtual RES load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache = false); + virtual void get_recognized_extensions(List *p_extensions) const; + virtual bool handles_type(const String &p_type) const; + virtual String get_resource_type(const String &p_path) const; +}; + +class GDNativeLibraryResourceSaver : public ResourceFormatSaver { +public: + virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags); + virtual bool recognize(const RES &p_resource) const; + virtual void get_recognized_extensions(const RES &p_resource, List *p_extensions) const; +}; + +#endif // GDNATIVE_H diff --git a/gdnative/aabb.cpp b/gdnative/aabb.cpp new file mode 100644 index 0000000..0d4dc8c --- /dev/null +++ b/gdnative/aabb.cpp @@ -0,0 +1,220 @@ +/**************************************************************************/ +/* aabb.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/aabb.h" + +#include "core/math/aabb.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_aabb) == sizeof(AABB), "AABB size mismatch"); + +void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) { + const Vector3 *pos = (const Vector3 *)p_pos; + const Vector3 *size = (const Vector3 *)p_size; + AABB *dest = (AABB *)r_dest; + *dest = AABB(*pos, *size); +} + +godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self) { + godot_vector3 raw_ret; + const AABB *self = (const AABB *)p_self; + Vector3 *ret = (Vector3 *)&raw_ret; + *ret = self->position; + return raw_ret; +} + +void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v) { + AABB *self = (AABB *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->position = *v; +} + +godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self) { + godot_vector3 raw_ret; + const AABB *self = (const AABB *)p_self; + Vector3 *ret = (Vector3 *)&raw_ret; + *ret = self->size; + return raw_ret; +} + +void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v) { + AABB *self = (AABB *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->size = *v; +} + +godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self) { + godot_string ret; + const AABB *self = (const AABB *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_area(); +} + +godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->has_no_area(); +} + +godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->has_no_surface(); +} + +godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with) { + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + return self->intersects(*with); +} + +godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with) { + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + return self->encloses(*with); +} + +godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + *((AABB *)&dest) = self->merge(*with); + return dest; +} + +godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + *((AABB *)&dest) = self->intersection(*with); + return dest; +} + +godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane) { + const AABB *self = (const AABB *)p_self; + const Plane *plane = (const Plane *)p_plane; + return self->intersects_plane(*plane); +} + +godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) { + const AABB *self = (const AABB *)p_self; + const Vector3 *from = (const Vector3 *)p_from; + const Vector3 *to = (const Vector3 *)p_to; + return self->intersects_segment(*from, *to); +} + +godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point) { + const AABB *self = (const AABB *)p_self; + const Vector3 *point = (const Vector3 *)p_point; + return self->has_point(*point); +} + +godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + const Vector3 *dir = (const Vector3 *)p_dir; + *((Vector3 *)&dest) = self->get_support(*dir); + return dest; +} + +godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + *((Vector3 *)&dest) = self->get_longest_axis(); + return dest; +} + +godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_longest_axis_index(); +} + +godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_longest_axis_size(); +} + +godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + *((Vector3 *)&dest) = self->get_shortest_axis(); + return dest; +} + +godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_shortest_axis_index(); +} + +godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_shortest_axis_size(); +} + +godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + const Vector3 *to_point = (const Vector3 *)p_to_point; + *((AABB *)&dest) = self->expand(*to_point); + return dest; +} + +godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + + *((AABB *)&dest) = self->grow(p_by); + return dest; +} + +godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + + *((Vector3 *)&dest) = self->get_endpoint(p_idx); + return dest; +} + +godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b) { + const AABB *self = (const AABB *)p_self; + const AABB *b = (const AABB *)p_b; + return *self == *b; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/array.cpp b/gdnative/array.cpp new file mode 100644 index 0000000..2f1109e --- /dev/null +++ b/gdnative/array.cpp @@ -0,0 +1,366 @@ +/**************************************************************************/ +/* array.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/array.h" + +#include "core/array.h" +#include "core/os/memory.h" + +#include "core/color.h" +#include "core/pool_vector.h" + +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_array) == sizeof(Array), "Array size mismatch"); + +void GDAPI godot_array_new(godot_array *r_dest) { + Array *dest = (Array *)r_dest; + memnew_placement(dest, Array); +} + +void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) { + Array *dest = (Array *)r_dest; + const Array *src = (const Array *)p_src; + memnew_placement(dest, Array(*src)); +} + +void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pca; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv3a; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv2a; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_psa; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pra; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pia; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pba; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value) { + Array *self = (Array *)p_self; + Variant *val = (Variant *)p_value; + self->operator[](p_idx) = *val; +} + +godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx) { + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + const Array *self = (const Array *)p_self; + memnew_placement(dest, Variant(self->operator[](p_idx))); + return raw_dest; +} + +godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx) { + Array *self = (Array *)p_self; + return (godot_variant *)&self->operator[](p_idx); +} + +const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx) { + const Array *self = (const Array *)p_self; + return (const godot_variant *)&self->operator[](p_idx); +} + +void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; + Variant *val = (Variant *)p_value; + self->append(*val); +} + +void GDAPI godot_array_clear(godot_array *p_self) { + Array *self = (Array *)p_self; + self->clear(); +} + +godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value) { + const Array *self = (const Array *)p_self; + const Variant *val = (const Variant *)p_value; + return self->count(*val); +} + +godot_bool GDAPI godot_array_empty(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + return self->empty(); +} + +void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; + const Variant *val = (const Variant *)p_value; + self->erase(*val); +} + +godot_variant GDAPI godot_array_front(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + godot_variant v; + Variant *val = (Variant *)&v; + memnew_placement(val, Variant); + *val = self->front(); + return v; +} + +godot_variant GDAPI godot_array_back(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + godot_variant v; + Variant *val = (Variant *)&v; + memnew_placement(val, Variant); + *val = self->back(); + return v; +} + +godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) { + const Array *self = (const Array *)p_self; + const Variant *val = (const Variant *)p_what; + return self->find(*val, p_from); +} + +godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what) { + const Array *self = (const Array *)p_self; + const Variant *val = (const Variant *)p_what; + return self->find_last(*val); +} + +godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value) { + const Array *self = (const Array *)p_self; + const Variant *val = (const Variant *)p_value; + return self->has(*val); +} + +godot_int GDAPI godot_array_hash(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + return self->hash(); +} + +void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value) { + Array *self = (Array *)p_self; + const Variant *val = (const Variant *)p_value; + self->insert(p_pos, *val); +} + +void GDAPI godot_array_invert(godot_array *p_self) { + Array *self = (Array *)p_self; + self->invert(); +} + +godot_variant GDAPI godot_array_pop_back(godot_array *p_self) { + Array *self = (Array *)p_self; + godot_variant v; + Variant *val = (Variant *)&v; + memnew_placement(val, Variant); + *val = self->pop_back(); + return v; +} + +godot_variant GDAPI godot_array_pop_front(godot_array *p_self) { + Array *self = (Array *)p_self; + godot_variant v; + Variant *val = (Variant *)&v; + memnew_placement(val, Variant); + *val = self->pop_front(); + return v; +} + +void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; + const Variant *val = (const Variant *)p_value; + self->push_back(*val); +} + +void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; + const Variant *val = (const Variant *)p_value; + self->push_front(*val); +} + +void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx) { + Array *self = (Array *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size) { + Array *self = (Array *)p_self; + self->resize(p_size); +} + +godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) { + const Array *self = (const Array *)p_self; + const Variant *val = (const Variant *)p_what; + return self->rfind(*val, p_from); +} + +godot_int GDAPI godot_array_size(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + return self->size(); +} + +void GDAPI godot_array_sort(godot_array *p_self) { + Array *self = (Array *)p_self; + self->sort(); +} + +void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func) { + Array *self = (Array *)p_self; + const String *func = (const String *)p_func; + self->sort_custom((Object *)p_obj, *func); +} + +godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before) { + Array *self = (Array *)p_self; + return self->bsearch(*(const Variant *)p_value, p_before); +} + +godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before) { + Array *self = (Array *)p_self; + const String *func = (const String *)p_func; + return self->bsearch_custom(*(const Variant *)p_value, (Object *)p_obj, *func, p_before); +} + +void GDAPI godot_array_destroy(godot_array *p_self) { + ((Array *)p_self)->~Array(); +} + +godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_bool p_deep) { + const Array *self = (const Array *)p_self; + godot_array res; + Array *val = (Array *)&res; + memnew_placement(val, Array); + *val = self->duplicate(p_deep); + return res; +} + +godot_array GDAPI godot_array_slice(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep) { + const Array *self = (const Array *)p_self; + godot_array res; + Array *val = (Array *)&res; + memnew_placement(val, Array); + *val = self->slice(p_begin, p_end, p_step, p_deep); + return res; +} + +godot_variant GDAPI godot_array_max(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + godot_variant v; + Variant *val = (Variant *)&v; + memnew_placement(val, Variant); + *val = self->max(); + return v; +} + +godot_variant GDAPI godot_array_min(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + godot_variant v; + Variant *val = (Variant *)&v; + memnew_placement(val, Variant); + *val = self->min(); + return v; +} + +void GDAPI godot_array_shuffle(godot_array *p_self) { + Array *self = (Array *)p_self; + self->shuffle(); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/basis.cpp b/gdnative/basis.cpp new file mode 100644 index 0000000..d7a31cc --- /dev/null +++ b/gdnative/basis.cpp @@ -0,0 +1,298 @@ +/**************************************************************************/ +/* basis.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/basis.h" + +#include "core/math/basis.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_basis) == sizeof(Basis), "Basis size mismatch"); + +void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) { + const Vector3 *x_axis = (const Vector3 *)p_x_axis; + const Vector3 *y_axis = (const Vector3 *)p_y_axis; + const Vector3 *z_axis = (const Vector3 *)p_z_axis; + Basis *dest = (Basis *)r_dest; + *dest = Basis(*x_axis, *y_axis, *z_axis); +} + +void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi) { + const Vector3 *axis = (const Vector3 *)p_axis; + Basis *dest = (Basis *)r_dest; + *dest = Basis(*axis, p_phi); +} + +void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler) { + const Vector3 *euler = (const Vector3 *)p_euler; + Basis *dest = (Basis *)r_dest; + *dest = Basis(*euler); +} + +godot_string GDAPI godot_basis_as_string(const godot_basis *p_self) { + godot_string ret; + const Basis *self = (const Basis *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self) { + godot_basis dest; + const Basis *self = (const Basis *)p_self; + *((Basis *)&dest) = self->inverse(); + return dest; +} + +godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self) { + godot_basis dest; + const Basis *self = (const Basis *)p_self; + *((Basis *)&dest) = self->transposed(); + return dest; +} + +godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self) { + godot_basis dest; + const Basis *self = (const Basis *)p_self; + *((Basis *)&dest) = self->orthonormalized(); + return dest; +} + +godot_real GDAPI godot_basis_determinant(const godot_basis *p_self) { + const Basis *self = (const Basis *)p_self; + return self->determinant(); +} + +godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi) { + godot_basis dest; + const Basis *self = (const Basis *)p_self; + const Vector3 *axis = (const Vector3 *)p_axis; + *((Basis *)&dest) = self->rotated(*axis, p_phi); + return dest; +} + +godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale) { + godot_basis dest; + const Basis *self = (const Basis *)p_self; + const Vector3 *scale = (const Vector3 *)p_scale; + *((Basis *)&dest) = self->scaled(*scale); + return dest; +} + +godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self) { + godot_vector3 dest; + const Basis *self = (const Basis *)p_self; + *((Vector3 *)&dest) = self->get_scale(); + return dest; +} + +godot_quat GDAPI godot_basis_get_quat(const godot_basis *p_self) { + godot_quat dest; + const Basis *self = (const Basis *)p_self; + *((Quat *)&dest) = self->get_quat(); + return dest; +} + +void GDAPI godot_basis_set_quat(godot_basis *p_self, const godot_quat *p_quat) { + Basis *self = (Basis *)p_self; + const Quat *quat = (const Quat *)p_quat; + self->set_quat(*quat); +} + +void GDAPI godot_basis_set_axis_angle_scale(godot_basis *p_self, const godot_vector3 *p_axis, godot_real p_phi, const godot_vector3 *p_scale) { + Basis *self = (Basis *)p_self; + const Vector3 *axis = (const Vector3 *)p_axis; + const Vector3 *scale = (const Vector3 *)p_scale; + self->set_axis_angle_scale(*axis, p_phi, *scale); +} + +void GDAPI godot_basis_set_euler_scale(godot_basis *p_self, const godot_vector3 *p_euler, const godot_vector3 *p_scale) { + Basis *self = (Basis *)p_self; + const Vector3 *euler = (const Vector3 *)p_euler; + const Vector3 *scale = (const Vector3 *)p_scale; + self->set_euler_scale(*euler, *scale); +} + +void GDAPI godot_basis_set_quat_scale(godot_basis *p_self, const godot_quat *p_quat, const godot_vector3 *p_scale) { + Basis *self = (Basis *)p_self; + const Quat *quat = (const Quat *)p_quat; + const Vector3 *scale = (const Vector3 *)p_scale; + self->set_quat_scale(*quat, *scale); +} + +godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self) { + godot_vector3 dest; + const Basis *self = (const Basis *)p_self; + *((Vector3 *)&dest) = self->get_euler(); + return dest; +} + +godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with) { + const Basis *self = (const Basis *)p_self; + const Vector3 *with = (const Vector3 *)p_with; + return self->tdotx(*with); +} + +godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with) { + const Basis *self = (const Basis *)p_self; + const Vector3 *with = (const Vector3 *)p_with; + return self->tdoty(*with); +} + +godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with) { + const Basis *self = (const Basis *)p_self; + const Vector3 *with = (const Vector3 *)p_with; + return self->tdotz(*with); +} + +godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v) { + godot_vector3 dest; + const Basis *self = (const Basis *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + *((Vector3 *)&dest) = self->xform(*v); + return dest; +} + +godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v) { + godot_vector3 dest; + const Basis *self = (const Basis *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + *((Vector3 *)&dest) = self->xform_inv(*v); + return dest; +} + +godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self) { + const Basis *self = (const Basis *)p_self; + return self->get_orthogonal_index(); +} + +void GDAPI godot_basis_new(godot_basis *r_dest) { + Basis *dest = (Basis *)r_dest; + *dest = Basis(); +} + +void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler) { + Basis *dest = (Basis *)r_dest; + const Quat *euler = (const Quat *)p_euler; + *dest = Basis(*euler); +} + +// p_elements is a pointer to an array of 3 (!!) vector3 +void GDAPI godot_basis_get_elements(const godot_basis *p_self, godot_vector3 *p_elements) { + const Basis *self = (const Basis *)p_self; + Vector3 *elements = (Vector3 *)p_elements; + elements[0] = self->elements[0]; + elements[1] = self->elements[1]; + elements[2] = self->elements[2]; +} + +godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *self = (const Basis *)p_self; + *d = self->get_axis(p_axis); + return dest; +} + +void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value) { + Basis *self = (Basis *)p_self; + const Vector3 *value = (const Vector3 *)p_value; + self->set_axis(p_axis, *value); +} + +godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *self = (const Basis *)p_self; + *d = self->get_row(p_row); + return dest; +} + +void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value) { + Basis *self = (Basis *)p_self; + const Vector3 *value = (const Vector3 *)p_value; + self->set_row(p_row, *value); +} + +godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b) { + const Basis *self = (const Basis *)p_self; + const Basis *b = (const Basis *)p_b; + return *self == *b; +} + +godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b) { + godot_basis raw_dest; + Basis *dest = (Basis *)&raw_dest; + const Basis *self = (const Basis *)p_self; + const Basis *b = (const Basis *)p_b; + *dest = *self + *b; + return raw_dest; +} + +godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b) { + godot_basis raw_dest; + Basis *dest = (Basis *)&raw_dest; + const Basis *self = (const Basis *)p_self; + const Basis *b = (const Basis *)p_b; + *dest = *self - *b; + return raw_dest; +} + +godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b) { + godot_basis raw_dest; + Basis *dest = (Basis *)&raw_dest; + const Basis *self = (const Basis *)p_self; + const Basis *b = (const Basis *)p_b; + *dest = *self * *b; + return raw_dest; +} + +godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b) { + godot_basis raw_dest; + Basis *dest = (Basis *)&raw_dest; + const Basis *self = (const Basis *)p_self; + *dest = *self * p_b; + return raw_dest; +} + +godot_basis GDAPI godot_basis_slerp(const godot_basis *p_self, const godot_basis *p_b, const godot_real p_t) { + godot_basis raw_dest; + Basis *dest = (Basis *)&raw_dest; + const Basis *self = (const Basis *)p_self; + const Basis *b = (const Basis *)p_b; + *dest = self->slerp(*b, p_t); + return raw_dest; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/color.cpp b/gdnative/color.cpp new file mode 100644 index 0000000..9b20165 --- /dev/null +++ b/gdnative/color.cpp @@ -0,0 +1,222 @@ +/**************************************************************************/ +/* color.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/color.h" + +#include "core/color.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_color) == sizeof(Color), "Color size mismatch"); + +void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) { + Color *dest = (Color *)r_dest; + *dest = Color(p_r, p_g, p_b, p_a); +} + +void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b) { + Color *dest = (Color *)r_dest; + *dest = Color(p_r, p_g, p_b); +} + +godot_real godot_color_get_r(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->r; +} + +void godot_color_set_r(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->r = val; +} + +godot_real godot_color_get_g(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->g; +} + +void godot_color_set_g(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->g = val; +} + +godot_real godot_color_get_b(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->b; +} + +void godot_color_set_b(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->b = val; +} + +godot_real godot_color_get_a(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->a; +} + +void godot_color_set_a(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->a = val; +} + +godot_real godot_color_get_h(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->get_h(); +} + +godot_real godot_color_get_s(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->get_s(); +} + +godot_real godot_color_get_v(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->get_v(); +} + +godot_string GDAPI godot_color_as_string(const godot_color *p_self) { + godot_string ret; + const Color *self = (const Color *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->to_rgba32(); +} + +godot_int GDAPI godot_color_to_abgr32(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->to_abgr32(); +} + +godot_int GDAPI godot_color_to_abgr64(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->to_abgr64(); +} + +godot_int GDAPI godot_color_to_argb64(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->to_argb64(); +} + +godot_int GDAPI godot_color_to_rgba64(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->to_rgba64(); +} + +godot_int GDAPI godot_color_to_argb32(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->to_argb32(); +} + +godot_real GDAPI godot_color_gray(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->gray(); +} + +godot_color GDAPI godot_color_inverted(const godot_color *p_self) { + godot_color dest; + const Color *self = (const Color *)p_self; + *((Color *)&dest) = self->inverted(); + return dest; +} + +godot_color GDAPI godot_color_contrasted(const godot_color *p_self) { + godot_color dest; + const Color *self = (const Color *)p_self; + *((Color *)&dest) = self->contrasted(); + return dest; +} + +godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) { + godot_color dest; + const Color *self = (const Color *)p_self; + const Color *b = (const Color *)p_b; + *((Color *)&dest) = self->linear_interpolate(*b, p_t); + return dest; +} + +godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over) { + godot_color dest; + const Color *self = (const Color *)p_self; + const Color *over = (const Color *)p_over; + *((Color *)&dest) = self->blend(*over); + return dest; +} + +godot_color GDAPI godot_color_darkened(const godot_color *p_self, const godot_real p_amount) { + godot_color dest; + const Color *self = (const Color *)p_self; + *((Color *)&dest) = self->darkened(p_amount); + return dest; +} + +godot_color GDAPI godot_color_from_hsv(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a) { + godot_color dest; + const Color *self = (const Color *)p_self; + *((Color *)&dest) = self->from_hsv(p_h, p_s, p_v, p_a); + return dest; +} + +godot_color GDAPI godot_color_lightened(const godot_color *p_self, const godot_real p_amount) { + godot_color dest; + const Color *self = (const Color *)p_self; + *((Color *)&dest) = self->lightened(p_amount); + return dest; +} + +godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha) { + godot_string dest; + const Color *self = (const Color *)p_self; + + memnew_placement(&dest, String(self->to_html(p_with_alpha))); + return dest; +} + +godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b) { + const Color *self = (const Color *)p_self; + const Color *b = (const Color *)p_b; + return *self == *b; +} + +godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b) { + const Color *self = (const Color *)p_self; + const Color *b = (const Color *)p_b; + return *self < *b; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/dictionary.cpp b/gdnative/dictionary.cpp new file mode 100644 index 0000000..fba09ff --- /dev/null +++ b/gdnative/dictionary.cpp @@ -0,0 +1,199 @@ +/**************************************************************************/ +/* dictionary.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/dictionary.h" + +#include "core/variant.h" +// core/variant.h before to avoid compile errors with MSVC +#include "core/dictionary.h" +#include "core/io/json.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_dictionary) == sizeof(Dictionary), "Dictionary size mismatch"); + +void GDAPI godot_dictionary_new(godot_dictionary *r_dest) { + Dictionary *dest = (Dictionary *)r_dest; + memnew_placement(dest, Dictionary); +} + +void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src) { + Dictionary *dest = (Dictionary *)r_dest; + const Dictionary *src = (const Dictionary *)p_src; + memnew_placement(dest, Dictionary(*src)); +} + +void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) { + Dictionary *self = (Dictionary *)p_self; + self->~Dictionary(); +} + +godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep) { + const Dictionary *self = (const Dictionary *)p_self; + godot_dictionary res; + Dictionary *val = (Dictionary *)&res; + memnew_placement(val, Dictionary); + *val = self->duplicate(p_deep); + return res; +} + +godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self) { + const Dictionary *self = (const Dictionary *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self) { + const Dictionary *self = (const Dictionary *)p_self; + return self->empty(); +} + +void GDAPI godot_dictionary_clear(godot_dictionary *p_self) { + Dictionary *self = (Dictionary *)p_self; + self->clear(); +} + +godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key) { + const Dictionary *self = (const Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + return self->has(*key); +} + +godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys) { + const Dictionary *self = (const Dictionary *)p_self; + const Array *keys = (const Array *)p_keys; + return self->has_all(*keys); +} + +void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key) { + Dictionary *self = (Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + self->erase(*key); +} + +godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self) { + const Dictionary *self = (const Dictionary *)p_self; + return self->hash(); +} + +godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self) { + godot_array dest; + const Dictionary *self = (const Dictionary *)p_self; + memnew_placement(&dest, Array(self->keys())); + return dest; +} + +godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) { + godot_array dest; + const Dictionary *self = (const Dictionary *)p_self; + memnew_placement(&dest, Array(self->values())); + return dest; +} + +godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key) { + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + const Dictionary *self = (const Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + memnew_placement(dest, Variant(self->operator[](*key))); + return raw_dest; +} + +void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value) { + Dictionary *self = (Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + const Variant *value = (const Variant *)p_value; + self->operator[](*key) = *value; +} + +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) { + Dictionary *self = (Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + return (godot_variant *)&self->operator[](*key); +} + +const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key) { + const Dictionary *self = (const Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + return (const godot_variant *)&self->operator[](*key); +} + +godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key) { + Dictionary *self = (Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + return (godot_variant *)self->next(key); +} + +godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) { + const Dictionary *self = (const Dictionary *)p_self; + const Dictionary *b = (const Dictionary *)p_b; + return *self == *b; +} + +godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self) { + godot_string raw_dest; + String *dest = (String *)&raw_dest; + const Dictionary *self = (const Dictionary *)p_self; + memnew_placement(dest, String(JSON::print(Variant(*self)))); + return raw_dest; +} + +// GDNative core 1.1 + +godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key) { + Dictionary *self = (Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + return self->erase(*key); +} + +godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default) { + const Dictionary *self = (const Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + const Variant *def = (const Variant *)p_default; + + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + memnew_placement(dest, Variant(self->get(*key, *def))); + + return raw_dest; +} + +// GDNative core 1.3 + +void GDAPI godot_dictionary_merge(godot_dictionary *p_self, const godot_dictionary *p_dictionary, const godot_bool p_overwrite) { + Dictionary *self = (Dictionary *)p_self; + const Dictionary *dictionary = (const Dictionary *)p_dictionary; + self->merge(*dictionary, p_overwrite); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/gdnative.cpp b/gdnative/gdnative.cpp new file mode 100644 index 0000000..e6ac47c --- /dev/null +++ b/gdnative/gdnative.cpp @@ -0,0 +1,193 @@ +/**************************************************************************/ +/* gdnative.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/gdnative.h" + +#include "core/class_db.h" +#include "core/engine.h" +#include "core/error_macros.h" +#include "core/global_constants.h" +#include "core/os/os.h" +#include "core/variant.h" + +#include "modules/gdnative/gdnative.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_object_destroy(godot_object *p_o) { + memdelete((Object *)p_o); +} + +// Singleton API + +godot_object GDAPI *godot_global_get_singleton(char *p_name) { + return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name)); +} // result shouldn't be freed + +// MethodBind API + +godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) { + MethodBind *mb = ClassDB::get_method(StringName(p_classname), StringName(p_methodname)); + // MethodBind *mb = ClassDB::get_method("Node", "get_name"); + return (godot_method_bind *)mb; +} + +void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret) { + MethodBind *mb = (MethodBind *)p_method_bind; + Object *o = (Object *)p_instance; + 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; +} + +godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) { + ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname)); + if (class_info) { + return (godot_class_constructor)class_info->creation_func; + } + return nullptr; +} + +godot_dictionary GDAPI godot_get_global_constants() { + godot_dictionary constants; + godot_dictionary_new(&constants); + Dictionary *p_constants = (Dictionary *)&constants; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + const char *name = GlobalConstants::get_global_constant_name(i); + int value = GlobalConstants::get_global_constant_value(i); + (*p_constants)[name] = value; + } + return constants; +} + +// System functions +void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback) { + GDNativeCallRegistry::get_singleton()->register_native_call_type(StringName(p_call_type), p_callback); +} + +void GDAPI *godot_alloc(int p_bytes) { + return memalloc(p_bytes); +} + +void GDAPI *godot_realloc(void *p_ptr, int p_bytes) { + return memrealloc(p_ptr, p_bytes); +} + +void GDAPI godot_free(void *p_ptr) { + memfree(p_ptr); +} + +void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line) { + _err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_ERROR); +} + +void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line) { + _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); +} + +void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have) { + String message = "Error loading GDNative file "; + GDNativeLibrary *library = (GDNativeLibrary *)p_library; + + message += library->get_current_library_path() + ": Extension \"" + p_ext + "\" can't be loaded.\n"; + + Dictionary versions; + versions["have_major"] = p_have.major; + versions["have_minor"] = p_have.minor; + versions["want_major"] = p_want.major; + versions["want_minor"] = p_want.minor; + + message += String("Got version {have_major}.{have_minor} but needs {want_major}.{want_minor}!").format(versions); + + _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr()); +} + +void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what) { + String message = "Error loading GDNative file "; + GDNativeLibrary *library = (GDNativeLibrary *)p_library; + + message += library->get_current_library_path() + ": " + p_what; + + _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr()); +} + +bool GDAPI godot_is_instance_valid(const godot_object *p_object) { + return ObjectDB::instance_validate((Object *)p_object); +} + +godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) { + return (godot_object *)ObjectDB::get_instance((ObjectID)p_instance_id); +} + +void *godot_get_class_tag(const godot_string_name *p_class) { + StringName class_name = *(StringName *)p_class; + ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(class_name); + return class_info ? class_info->class_ptr : nullptr; +} + +godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) { + if (!p_object) { + return nullptr; + } + Object *o = (Object *)p_object; + + return o->is_class_ptr(p_class_tag) ? (godot_object *)o : nullptr; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/node_path.cpp b/gdnative/node_path.cpp new file mode 100644 index 0000000..5223c1f --- /dev/null +++ b/gdnative/node_path.cpp @@ -0,0 +1,126 @@ +/**************************************************************************/ +/* node_path.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/node_path.h" + +#include "core/node_path.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch"); + +void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) { + NodePath *dest = (NodePath *)r_dest; + const String *from = (const String *)p_from; + memnew_placement(dest, NodePath(*from)); +} + +void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) { + NodePath *dest = (NodePath *)r_dest; + const NodePath *src = (const NodePath *)p_src; + memnew_placement(dest, NodePath(*src)); +} + +void GDAPI godot_node_path_destroy(godot_node_path *p_self) { + NodePath *self = (NodePath *)p_self; + self->~NodePath(); +} + +godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self) { + godot_string ret; + const NodePath *self = (const NodePath *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self) { + const NodePath *self = (const NodePath *)p_self; + return self->is_absolute(); +} + +godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self) { + const NodePath *self = (const NodePath *)p_self; + return self->get_name_count(); +} + +godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx) { + godot_string dest; + const NodePath *self = (const NodePath *)p_self; + + memnew_placement(&dest, String(self->get_name(p_idx))); + return dest; +} + +godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self) { + const NodePath *self = (const NodePath *)p_self; + return self->get_subname_count(); +} + +godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx) { + godot_string dest; + const NodePath *self = (const NodePath *)p_self; + + memnew_placement(&dest, String(self->get_subname(p_idx))); + return dest; +} + +godot_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self) { + godot_string dest; + const NodePath *self = (const NodePath *)p_self; + memnew_placement(&dest, String(self->get_concatenated_subnames())); + return dest; +} + +godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self) { + const NodePath *self = (const NodePath *)p_self; + return self->is_empty(); +} + +godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b) { + const NodePath *self = (const NodePath *)p_self; + const NodePath *b = (const NodePath *)p_b; + return *self == *b; +} + +godot_node_path godot_node_path_get_as_property_path(const godot_node_path *p_self) { + const NodePath *self = (const NodePath *)p_self; + godot_node_path res; + NodePath *val = (NodePath *)&res; + memnew_placement(val, NodePath); + *val = self->get_as_property_path(); + return res; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/plane.cpp b/gdnative/plane.cpp new file mode 100644 index 0000000..568bbc1 --- /dev/null +++ b/gdnative/plane.cpp @@ -0,0 +1,178 @@ +/**************************************************************************/ +/* plane.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/plane.h" + +#include "core/math/plane.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_plane) == sizeof(Plane), "Plane size mismatch"); + +void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) { + Plane *dest = (Plane *)r_dest; + *dest = Plane(p_a, p_b, p_c, p_d); +} + +void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3) { + const Vector3 *v1 = (const Vector3 *)p_v1; + const Vector3 *v2 = (const Vector3 *)p_v2; + const Vector3 *v3 = (const Vector3 *)p_v3; + Plane *dest = (Plane *)r_dest; + *dest = Plane(*v1, *v2, *v3); +} + +void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d) { + const Vector3 *normal = (const Vector3 *)p_normal; + Plane *dest = (Plane *)r_dest; + *dest = Plane(*normal, p_d); +} + +godot_string GDAPI godot_plane_as_string(const godot_plane *p_self) { + godot_string ret; + const Plane *self = (const Plane *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self) { + godot_plane dest; + const Plane *self = (const Plane *)p_self; + *((Plane *)&dest) = self->normalized(); + return dest; +} + +godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self) { + godot_vector3 dest; + const Plane *self = (const Plane *)p_self; + *((Vector3 *)&dest) = self->center(); + return dest; +} + +godot_vector3 GDAPI godot_plane_get_any_point(const godot_plane *p_self) { + godot_vector3 dest; + const Plane *self = (const Plane *)p_self; + *((Vector3 *)&dest) = self->get_any_point(); + return dest; +} + +godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point) { + const Plane *self = (const Plane *)p_self; + const Vector3 *point = (const Vector3 *)p_point; + return self->is_point_over(*point); +} + +godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point) { + const Plane *self = (const Plane *)p_self; + const Vector3 *point = (const Vector3 *)p_point; + return self->distance_to(*point); +} + +godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon) { + const Plane *self = (const Plane *)p_self; + const Vector3 *point = (const Vector3 *)p_point; + return self->has_point(*point, p_epsilon); +} + +godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point) { + godot_vector3 dest; + const Plane *self = (const Plane *)p_self; + const Vector3 *point = (const Vector3 *)p_point; + *((Vector3 *)&dest) = self->project(*point); + return dest; +} + +godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c) { + const Plane *self = (const Plane *)p_self; + const Plane *b = (const Plane *)p_b; + const Plane *c = (const Plane *)p_c; + Vector3 *dest = (Vector3 *)r_dest; + return self->intersect_3(*b, *c, dest); +} + +godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir) { + const Plane *self = (const Plane *)p_self; + const Vector3 *from = (const Vector3 *)p_from; + const Vector3 *dir = (const Vector3 *)p_dir; + Vector3 *dest = (Vector3 *)r_dest; + return self->intersects_ray(*from, *dir, dest); +} + +godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end) { + const Plane *self = (const Plane *)p_self; + const Vector3 *begin = (const Vector3 *)p_begin; + const Vector3 *end = (const Vector3 *)p_end; + Vector3 *dest = (Vector3 *)r_dest; + return self->intersects_segment(*begin, *end, dest); +} + +godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self) { + godot_plane raw_dest; + Plane *dest = (Plane *)&raw_dest; + const Plane *self = (const Plane *)p_self; + *dest = -(*self); + return raw_dest; +} + +godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b) { + const Plane *self = (const Plane *)p_self; + const Plane *b = (const Plane *)p_b; + return *self == *b; +} + +void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal) { + Plane *self = (Plane *)p_self; + const Vector3 *normal = (const Vector3 *)p_normal; + self->set_normal(*normal); +} + +godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self) { + const Plane *self = (const Plane *)p_self; + const Vector3 normal = self->get_normal(); + godot_vector3 *v3 = (godot_vector3 *)&normal; + return *v3; +} + +godot_real GDAPI godot_plane_get_d(const godot_plane *p_self) { + const Plane *self = (const Plane *)p_self; + return self->d; +} + +void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d) { + Plane *self = (Plane *)p_self; + self->d = p_d; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/pool_arrays.cpp b/gdnative/pool_arrays.cpp new file mode 100644 index 0000000..3f9af50 --- /dev/null +++ b/gdnative/pool_arrays.cpp @@ -0,0 +1,1075 @@ +/**************************************************************************/ +/* pool_arrays.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/pool_arrays.h" + +#include "core/array.h" +#include "core/pool_vector.h" +#include "core/variant.h" + +#include "core/color.h" +#include "core/math/vector2.h" +#include "core/math/vector3.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_pool_byte_array) == sizeof(PoolVector), "PoolVector size mismatch"); +static_assert(sizeof(godot_pool_int_array) == sizeof(PoolVector), "PoolVector size mismatch"); +static_assert(sizeof(godot_pool_real_array) == sizeof(PoolVector), "PoolVector size mismatch"); +static_assert(sizeof(godot_pool_string_array) == sizeof(PoolVector), "PoolVector size mismatch"); +static_assert(sizeof(godot_pool_vector2_array) == sizeof(PoolVector), "PoolVector size mismatch"); +static_assert(sizeof(godot_pool_vector3_array) == sizeof(PoolVector), "PoolVector size mismatch"); +static_assert(sizeof(godot_pool_color_array) == sizeof(PoolVector), "PoolVector size mismatch"); + +#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) + +// byte + +void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data) { + PoolVector *self = (PoolVector *)p_self; + self->append(p_data); +} + +void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { + PoolVector *self = (PoolVector *)p_self; + return (godot_error)self->insert(p_idx, p_data); +} + +void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data) { + PoolVector *self = (PoolVector *)p_self; + self->push_back(p_data); +} + +void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_byte_array_sort(godot_pool_byte_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_byte_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_byte_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { + PoolVector *self = (PoolVector *)p_self; + self->set(p_idx, p_data); +} + +uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + return self->get(p_idx); +} + +godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_byte_array_has(const godot_pool_byte_array *p_self, const uint8_t p_data) { + const PoolVector *self = (const PoolVector *)p_self; + return self->has(p_data); +} + +void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// int + +void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data) { + PoolVector *self = (PoolVector *)p_self; + self->append(p_data); +} + +void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { + PoolVector *self = (PoolVector *)p_self; + return (godot_error)self->insert(p_idx, p_data); +} + +void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data) { + PoolVector *self = (PoolVector *)p_self; + self->push_back(p_data); +} + +void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_int_array_sort(godot_pool_int_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_int_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_int_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { + PoolVector *self = (PoolVector *)p_self; + self->set(p_idx, p_data); +} + +godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + return self->get(p_idx); +} + +godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_int_array_has(const godot_pool_int_array *p_self, const godot_int p_data) { + const PoolVector *self = (const PoolVector *)p_self; + return self->has(p_data); +} + +void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// real + +void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data) { + PoolVector *self = (PoolVector *)p_self; + self->append(p_data); +} + +void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { + PoolVector *self = (PoolVector *)p_self; + return (godot_error)self->insert(p_idx, p_data); +} + +void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data) { + PoolVector *self = (PoolVector *)p_self; + self->push_back(p_data); +} + +void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_real_array_sort(godot_pool_real_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_real_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_int_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_real_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { + PoolVector *self = (PoolVector *)p_self; + self->set(p_idx, p_data); +} + +godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + return self->get(p_idx); +} + +godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_real_array_has(const godot_pool_real_array *p_self, const godot_real p_data) { + const PoolVector *self = (const PoolVector *)p_self; + return self->has(p_data); +} + +void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// string + +void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data) { + PoolVector *self = (PoolVector *)p_self; + String &s = *(String *)p_data; + self->append(s); +} + +void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { + PoolVector *self = (PoolVector *)p_self; + String &s = *(String *)p_data; + return (godot_error)self->insert(p_idx, s); +} + +void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +godot_string GDAPI godot_pool_string_array_join(const godot_pool_string_array *p_self, const godot_string *p_delimiter) { + const PoolVector *self = (PoolVector *)p_self; + String &delimiter = *(String *)p_delimiter; + + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = self->join(delimiter); + return str; +} + +void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data) { + PoolVector *self = (PoolVector *)p_self; + String &s = *(String *)p_data; + self->push_back(s); +} + +void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_string_array_sort(godot_pool_string_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_string_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_string_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { + PoolVector *self = (PoolVector *)p_self; + String &s = *(String *)p_data; + self->set(p_idx, s); +} + +godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = self->get(p_idx); + return str; +} + +godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_string_array_has(const godot_pool_string_array *p_self, const godot_string *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + String &s = *(String *)p_data; + return self->has(s); +} + +void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// vector2 + +void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector2 &s = *(Vector2 *)p_data; + self->append(s); +} + +void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector2 &s = *(Vector2 *)p_data; + return (godot_error)self->insert(p_idx, s); +} + +void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector2 &s = *(Vector2 *)p_data; + self->push_back(s); +} + +void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_vector2_array_sort(godot_pool_vector2_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_vector2_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_vector2_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector2 &s = *(Vector2 *)p_data; + self->set(p_idx, s); +} + +godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + godot_vector2 v; + Vector2 *s = (Vector2 *)&v; + *s = self->get(p_idx); + return v; +} + +godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_vector2_array_has(const godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + Vector2 &s = *(Vector2 *)p_data; + return self->has(s); +} + +void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// vector3 + +void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector3 &s = *(Vector3 *)p_data; + self->append(s); +} + +void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector3 &s = *(Vector3 *)p_data; + return (godot_error)self->insert(p_idx, s); +} + +void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector3 &s = *(Vector3 *)p_data; + self->push_back(s); +} + +void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_vector3_array_sort(godot_pool_vector3_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_vector3_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_vector3_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { + PoolVector *self = (PoolVector *)p_self; + Vector3 &s = *(Vector3 *)p_data; + self->set(p_idx, s); +} + +godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + godot_vector3 v; + Vector3 *s = (Vector3 *)&v; + *s = self->get(p_idx); + return v; +} + +godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_vector3_array_has(const godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + Vector3 &s = *(Vector3 *)p_data; + return self->has(s); +} + +void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// color + +void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest) { + PoolVector *dest = (PoolVector *)r_dest; + memnew_placement(dest, PoolVector); +} + +void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src) { + PoolVector *dest = (PoolVector *)r_dest; + const PoolVector *src = (const PoolVector *)p_src; + memnew_placement(dest, PoolVector(*src)); +} + +void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a) { + PoolVector *dest = (PoolVector *)r_dest; + Array *a = (Array *)p_a; + memnew_placement(dest, PoolVector); + + dest->resize(a->size()); + for (int i = 0; i < a->size(); i++) { + dest->set(i, (*a)[i]); + } +} + +void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data) { + PoolVector *self = (PoolVector *)p_self; + Color &s = *(Color *)p_data; + self->append(s); +} + +void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array) { + PoolVector *self = (PoolVector *)p_self; + PoolVector *array = (PoolVector *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { + PoolVector *self = (PoolVector *)p_self; + Color &s = *(Color *)p_data; + return (godot_error)self->insert(p_idx, s); +} + +void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->invert(); +} + +void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data) { + PoolVector *self = (PoolVector *)p_self; + Color &s = *(Color *)p_data; + self->push_back(s); +} + +void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx) { + PoolVector *self = (PoolVector *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size) { + PoolVector *self = (PoolVector *)p_self; + self->resize(p_size); +} + +void GDAPI godot_pool_color_array_sort(godot_pool_color_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_color_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_color_array_write_access *)memnew(PoolVector::Write(self->write())); +} + +void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { + PoolVector *self = (PoolVector *)p_self; + Color &s = *(Color *)p_data; + self->set(p_idx, s); +} + +godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx) { + const PoolVector *self = (const PoolVector *)p_self; + godot_color v; + Color *s = (Color *)&v; + *s = self->get(p_idx); + return v; +} + +godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return self->empty(); +} + +godot_bool GDAPI godot_pool_color_array_has(const godot_pool_color_array *p_self, const godot_color *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + Color &s = *(Color *)p_data; + return self->has(s); +} + +void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { + ((PoolVector *)p_self)->~PoolVector(); +} + +// +// read accessor functions +// + +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read_access_copy(const godot_pool_byte_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_byte_array_read_access *)memnew(PoolVector::Read(*other)); +} +const uint8_t GDAPI *godot_pool_byte_array_read_access_ptr(const godot_pool_byte_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return read->ptr(); +} +void GDAPI godot_pool_byte_array_read_access_operator_assign(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read_access_copy(const godot_pool_int_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_int_array_read_access *)memnew(PoolVector::Read(*other)); +} +const godot_int GDAPI *godot_pool_int_array_read_access_ptr(const godot_pool_int_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return read->ptr(); +} +void GDAPI godot_pool_int_array_read_access_operator_assign(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read_access_copy(const godot_pool_real_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_real_array_read_access *)memnew(PoolVector::Read(*other)); +} +const godot_real GDAPI *godot_pool_real_array_read_access_ptr(const godot_pool_real_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return read->ptr(); +} +void GDAPI godot_pool_real_array_read_access_operator_assign(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read_access_copy(const godot_pool_string_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_string_array_read_access *)memnew(PoolVector::Read(*other)); +} +const godot_string GDAPI *godot_pool_string_array_read_access_ptr(const godot_pool_string_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return (const godot_string *)read->ptr(); +} +void GDAPI godot_pool_string_array_read_access_operator_assign(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read_access_copy(const godot_pool_vector2_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_vector2_array_read_access *)memnew(PoolVector::Read(*other)); +} +const godot_vector2 GDAPI *godot_pool_vector2_array_read_access_ptr(const godot_pool_vector2_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return (const godot_vector2 *)read->ptr(); +} +void GDAPI godot_pool_vector2_array_read_access_operator_assign(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read_access_copy(const godot_pool_vector3_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_vector3_array_read_access *)memnew(PoolVector::Read(*other)); +} +const godot_vector3 GDAPI *godot_pool_vector3_array_read_access_ptr(const godot_pool_vector3_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return (const godot_vector3 *)read->ptr(); +} +void GDAPI godot_pool_vector3_array_read_access_operator_assign(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read_access_copy(const godot_pool_color_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_color_array_read_access *)memnew(PoolVector::Read(*other)); +} +const godot_color GDAPI *godot_pool_color_array_read_access_ptr(const godot_pool_color_array_read_access *p_read) { + const PoolVector::Read *read = (const PoolVector::Read *)p_read; + return (const godot_color *)read->ptr(); +} +void GDAPI godot_pool_color_array_read_access_operator_assign(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +// +// write accessor functions +// + +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write_access_copy(const godot_pool_byte_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_byte_array_write_access *)memnew(PoolVector::Write(*other)); +} +uint8_t GDAPI *godot_pool_byte_array_write_access_ptr(const godot_pool_byte_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return write->ptr(); +} +void GDAPI godot_pool_byte_array_write_access_operator_assign(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write_access_copy(const godot_pool_int_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_int_array_write_access *)memnew(PoolVector::Write(*other)); +} +godot_int GDAPI *godot_pool_int_array_write_access_ptr(const godot_pool_int_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return write->ptr(); +} +void GDAPI godot_pool_int_array_write_access_operator_assign(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write_access_copy(const godot_pool_real_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_real_array_write_access *)memnew(PoolVector::Write(*other)); +} +godot_real GDAPI *godot_pool_real_array_write_access_ptr(const godot_pool_real_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return write->ptr(); +} +void GDAPI godot_pool_real_array_write_access_operator_assign(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write_access_copy(const godot_pool_string_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_string_array_write_access *)memnew(PoolVector::Write(*other)); +} +godot_string GDAPI *godot_pool_string_array_write_access_ptr(const godot_pool_string_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return (godot_string *)write->ptr(); +} +void GDAPI godot_pool_string_array_write_access_operator_assign(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write_access_copy(const godot_pool_vector2_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_vector2_array_write_access *)memnew(PoolVector::Write(*other)); +} +godot_vector2 GDAPI *godot_pool_vector2_array_write_access_ptr(const godot_pool_vector2_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return (godot_vector2 *)write->ptr(); +} +void GDAPI godot_pool_vector2_array_write_access_operator_assign(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write_access_copy(const godot_pool_vector3_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_vector3_array_write_access *)memnew(PoolVector::Write(*other)); +} +godot_vector3 GDAPI *godot_pool_vector3_array_write_access_ptr(const godot_pool_vector3_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return (godot_vector3 *)write->ptr(); +} +void GDAPI godot_pool_vector3_array_write_access_operator_assign(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write_access_copy(const godot_pool_color_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_color_array_write_access *)memnew(PoolVector::Write(*other)); +} +godot_color GDAPI *godot_pool_color_array_write_access_ptr(const godot_pool_color_array_write_access *p_write) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + return (godot_color *)write->ptr(); +} +void GDAPI godot_pool_color_array_write_access_operator_assign(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_color_array_write_access_destroy(godot_pool_color_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/quat.cpp b/gdnative/quat.cpp new file mode 100644 index 0000000..1924513 --- /dev/null +++ b/gdnative/quat.cpp @@ -0,0 +1,237 @@ +/**************************************************************************/ +/* quat.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/quat.h" + +#include "core/math/quat.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_quat) == sizeof(Quat), "Quat size mismatch"); + +void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) { + Quat *dest = (Quat *)r_dest; + *dest = Quat(p_x, p_y, p_z, p_w); +} + +void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle) { + const Vector3 *axis = (const Vector3 *)p_axis; + Quat *dest = (Quat *)r_dest; + *dest = Quat(*axis, p_angle); +} + +void GDAPI godot_quat_new_with_basis(godot_quat *r_dest, const godot_basis *p_basis) { + const Basis *basis = (const Basis *)p_basis; + Quat *dest = (Quat *)r_dest; + *dest = Quat(*basis); +} + +void GDAPI godot_quat_new_with_euler(godot_quat *r_dest, const godot_vector3 *p_euler) { + const Vector3 *euler = (const Vector3 *)p_euler; + Quat *dest = (Quat *)r_dest; + *dest = Quat(*euler); +} + +godot_real GDAPI godot_quat_get_x(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->x; +} + +void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->x = val; +} + +godot_real GDAPI godot_quat_get_y(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->y; +} + +void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->y = val; +} + +godot_real GDAPI godot_quat_get_z(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->z; +} + +void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->z = val; +} + +godot_real GDAPI godot_quat_get_w(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->w; +} + +void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->w = val; +} + +godot_string GDAPI godot_quat_as_string(const godot_quat *p_self) { + godot_string ret; + const Quat *self = (const Quat *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_real GDAPI godot_quat_length(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->length(); +} + +godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->length_squared(); +} + +godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self) { + godot_quat dest; + const Quat *self = (const Quat *)p_self; + *((Quat *)&dest) = self->normalized(); + return dest; +} + +godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->is_normalized(); +} + +godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self) { + godot_quat dest; + const Quat *self = (const Quat *)p_self; + *((Quat *)&dest) = self->inverse(); + return dest; +} + +godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b) { + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + return self->dot(*b); +} + +godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v) { + godot_vector3 dest; + const Quat *self = (const Quat *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + *((Vector3 *)&dest) = self->xform(*v); + return dest; +} + +godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) { + godot_quat dest; + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + *((Quat *)&dest) = self->slerp(*b, p_t); + return dest; +} + +godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) { + godot_quat dest; + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + *((Quat *)&dest) = self->slerpni(*b, p_t); + return dest; +} + +godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t) { + godot_quat dest; + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + const Quat *pre_a = (const Quat *)p_pre_a; + const Quat *post_b = (const Quat *)p_post_b; + *((Quat *)&dest) = self->cubic_slerp(*b, *pre_a, *post_b, p_t); + return dest; +} + +godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b) { + godot_quat raw_dest; + Quat *dest = (Quat *)&raw_dest; + const Quat *self = (const Quat *)p_self; + *dest = *self * p_b; + return raw_dest; +} + +godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b) { + godot_quat raw_dest; + Quat *dest = (Quat *)&raw_dest; + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + *dest = *self + *b; + return raw_dest; +} + +godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b) { + godot_quat raw_dest; + Quat *dest = (Quat *)&raw_dest; + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + *dest = *self - *b; + return raw_dest; +} + +godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b) { + godot_quat raw_dest; + Quat *dest = (Quat *)&raw_dest; + const Quat *self = (const Quat *)p_self; + *dest = *self / p_b; + return raw_dest; +} + +godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b) { + const Quat *self = (const Quat *)p_self; + const Quat *b = (const Quat *)p_b; + return *self == *b; +} + +godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self) { + godot_quat raw_dest; + Quat *dest = (Quat *)&raw_dest; + const Quat *self = (const Quat *)p_self; + *dest = -(*self); + return raw_dest; +} + +void GDAPI godot_quat_set_axis_angle(godot_quat *p_self, const godot_vector3 *p_axis, const godot_real p_angle) { + Quat *self = (Quat *)p_self; + const Vector3 *axis = (const Vector3 *)p_axis; + self->set_axis_angle(*axis, p_angle); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/rect2.cpp b/gdnative/rect2.cpp new file mode 100644 index 0000000..7e16538 --- /dev/null +++ b/gdnative/rect2.cpp @@ -0,0 +1,178 @@ +/**************************************************************************/ +/* rect2.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/rect2.h" + +#include "core/math/transform_2d.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_rect2) == sizeof(Rect2), "Rect2 size mismatch"); + +void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) { + const Vector2 *position = (const Vector2 *)p_pos; + const Vector2 *size = (const Vector2 *)p_size; + Rect2 *dest = (Rect2 *)r_dest; + *dest = Rect2(*position, *size); +} + +void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height) { + Rect2 *dest = (Rect2 *)r_dest; + *dest = Rect2(p_x, p_y, p_width, p_height); +} + +godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self) { + godot_string ret; + const Rect2 *self = (const Rect2 *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self) { + const Rect2 *self = (const Rect2 *)p_self; + return self->get_area(); +} + +godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b) { + const Rect2 *self = (const Rect2 *)p_self; + const Rect2 *b = (const Rect2 *)p_b; + return self->intersects(*b); +} + +godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b) { + const Rect2 *self = (const Rect2 *)p_self; + const Rect2 *b = (const Rect2 *)p_b; + return self->encloses(*b); +} + +godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self) { + const Rect2 *self = (const Rect2 *)p_self; + return self->has_no_area(); +} + +godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + const Rect2 *b = (const Rect2 *)p_b; + *((Rect2 *)&dest) = self->clip(*b); + return dest; +} + +godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + const Rect2 *b = (const Rect2 *)p_b; + *((Rect2 *)&dest) = self->merge(*b); + return dest; +} + +godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point) { + const Rect2 *self = (const Rect2 *)p_self; + const Vector2 *point = (const Vector2 *)p_point; + return self->has_point(*point); +} + +godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + + *((Rect2 *)&dest) = self->grow(p_by); + return dest; +} + +godot_rect2 GDAPI godot_rect2_grow_individual(const godot_rect2 *p_self, const godot_real p_left, const godot_real p_top, const godot_real p_right, const godot_real p_bottom) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + *((Rect2 *)&dest) = self->grow_individual(p_left, p_top, p_right, p_bottom); + return dest; +} + +godot_rect2 GDAPI godot_rect2_grow_margin(const godot_rect2 *p_self, const godot_int p_margin, const godot_real p_by) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + *((Rect2 *)&dest) = self->grow_margin((Margin)p_margin, p_by); + return dest; +} + +godot_rect2 GDAPI godot_rect2_abs(const godot_rect2 *p_self) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + *((Rect2 *)&dest) = self->abs(); + return dest; +} + +godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to) { + godot_rect2 dest; + const Rect2 *self = (const Rect2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + *((Rect2 *)&dest) = self->expand(*to); + return dest; +} + +godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b) { + const Rect2 *self = (const Rect2 *)p_self; + const Rect2 *b = (const Rect2 *)p_b; + return *self == *b; +} + +godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Rect2 *self = (const Rect2 *)p_self; + *d = self->get_position(); + return dest; +} + +godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Rect2 *self = (const Rect2 *)p_self; + *d = self->get_size(); + return dest; +} + +void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos) { + Rect2 *self = (Rect2 *)p_self; + const Vector2 *position = (const Vector2 *)p_pos; + self->set_position(*position); +} + +void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size) { + Rect2 *self = (Rect2 *)p_self; + const Vector2 *size = (const Vector2 *)p_size; + self->set_size(*size); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/rid.cpp b/gdnative/rid.cpp new file mode 100644 index 0000000..ad62b33 --- /dev/null +++ b/gdnative/rid.cpp @@ -0,0 +1,76 @@ +/**************************************************************************/ +/* rid.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/rid.h" + +#include "core/resource.h" +#include "core/rid.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_rid) == sizeof(RID), "RID size mismatch"); + +void GDAPI godot_rid_new(godot_rid *r_dest) { + RID *dest = (RID *)r_dest; + memnew_placement(dest, RID); +} + +godot_int GDAPI godot_rid_get_id(const godot_rid *p_self) { + const RID *self = (const RID *)p_self; + return self->get_id(); +} + +void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from) { + const Resource *res_from = Object::cast_to((Object *)p_from); + godot_rid_new(r_dest); + if (res_from) { + RID *dest = (RID *)r_dest; + *dest = RID(res_from->get_rid()); + } +} + +godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b) { + const RID *self = (const RID *)p_self; + const RID *b = (const RID *)p_b; + return *self == *b; +} + +godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b) { + const RID *self = (const RID *)p_self; + const RID *b = (const RID *)p_b; + return *self < *b; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/string.cpp b/gdnative/string.cpp new file mode 100644 index 0000000..62b00e0 --- /dev/null +++ b/gdnative/string.cpp @@ -0,0 +1,1397 @@ +/**************************************************************************/ +/* string.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/string.h" + +#include "core/string_name.h" +#include "core/ustring.h" +#include "core/variant.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_char_string) == sizeof(CharString), "CharString size mismatch"); +static_assert(sizeof(godot_string) == sizeof(String), "String size mismatch"); +static_assert(sizeof(godot_char_type) == sizeof(CharType), "CharType size mismatch"); + +godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs) { + const CharString *cs = (const CharString *)p_cs; + + return cs->length(); +} + +const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs) { + const CharString *cs = (const CharString *)p_cs; + + return cs->get_data(); +} + +void GDAPI godot_char_string_destroy(godot_char_string *p_cs) { + CharString *cs = (CharString *)p_cs; + + cs->~CharString(); +} + +void GDAPI godot_string_new(godot_string *r_dest) { + String *dest = (String *)r_dest; + memnew_placement(dest, String); +} + +void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src) { + String *dest = (String *)r_dest; + const String *src = (const String *)p_src; + memnew_placement(dest, String(*src)); +} + +void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size) { + String *dest = (String *)r_dest; + memnew_placement(dest, String(p_contents, p_size)); +} + +const wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) { + String *self = (String *)p_self; + return &(self->operator[](p_idx)); +} + +wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx) { + const String *self = (const String *)p_self; + return self->operator[](p_idx); +} + +const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self) { + const String *self = (const String *)p_self; + return self->c_str(); +} + +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b) { + const String *self = (const String *)p_self; + const String *b = (const String *)p_b; + return *self == *b; +} + +godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b) { + const String *self = (const String *)p_self; + const String *b = (const String *)p_b; + return *self < *b; +} + +godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b) { + godot_string ret; + const String *self = (const String *)p_self; + const String *b = (const String *)p_b; + memnew_placement(&ret, String(*self + *b)); + return ret; +} + +void GDAPI godot_string_destroy(godot_string *p_self) { + String *self = (String *)p_self; + self->~String(); +} + +/* Standard size stuff */ + +godot_int GDAPI godot_string_length(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->length(); +} + +/* Helpers */ + +signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str) { + const String *self = (const String *)p_self; + const String *str = (const String *)p_str; + + return self->casecmp_to(*str); +} + +signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str) { + const String *self = (const String *)p_self; + const String *str = (const String *)p_str; + + return self->nocasecmp_to(*str); +} +signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str) { + const String *self = (const String *)p_self; + const String *str = (const String *)p_str; + + return self->naturalnocasecmp_to(*str); +} + +godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->begins_with(*string); +} + +godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array) { + const String *self = (const String *)p_self; + + return self->begins_with(p_char_array); +} + +godot_array GDAPI godot_string_bigrams(const godot_string *p_self) { + const String *self = (const String *)p_self; + Vector return_value = self->bigrams(); + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +}; + +godot_string GDAPI godot_string_chr(wchar_t p_character) { + godot_string result; + memnew_placement(&result, String(String::chr(p_character))); + + return result; +} + +godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->ends_with(*string); +} + +godot_int GDAPI godot_string_count(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->count(*what, p_from, p_to); +} + +godot_int GDAPI godot_string_countn(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->countn(*what, p_from, p_to); +} + +godot_int GDAPI godot_string_find(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->find(*what); +} + +godot_int GDAPI godot_string_find_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->find(*what, p_from); +} + +godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_array *p_keys) { + const String *self = (const String *)p_self; + + Vector keys; + Array *keys_proxy = (Array *)p_keys; + keys.resize(keys_proxy->size()); + for (int i = 0; i < keys_proxy->size(); i++) { + keys.write[i] = (*keys_proxy)[i]; + } + + return self->findmk(keys); +} + +godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_array *p_keys, godot_int p_from) { + const String *self = (const String *)p_self; + + Vector keys; + Array *keys_proxy = (Array *)p_keys; + keys.resize(keys_proxy->size()); + for (int i = 0; i < keys_proxy->size(); i++) { + keys.write[i] = (*keys_proxy)[i]; + } + + return self->findmk(keys, p_from); +} + +godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key) { + const String *self = (const String *)p_self; + + Vector keys; + Array *keys_proxy = (Array *)p_keys; + keys.resize(keys_proxy->size()); + for (int i = 0; i < keys_proxy->size(); i++) { + keys.write[i] = (*keys_proxy)[i]; + } + + return self->findmk(keys, p_from, r_key); +} + +godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->findn(*what); +} + +godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->findn(*what, p_from); +} + +godot_int GDAPI godot_string_find_last(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfind(*what); +} + +godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values) { + const String *self = (const String *)p_self; + const Variant *values = (const Variant *)p_values; + godot_string result; + memnew_placement(&result, String(self->format(*values))); + + return result; +} + +godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder) { + const String *self = (const String *)p_self; + const Variant *values = (const Variant *)p_values; + String placeholder = String(p_placeholder); + godot_string result; + memnew_placement(&result, String(self->format(*values, placeholder))); + + return result; +} + +godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len) { + godot_string result; + memnew_placement(&result, String(String::hex_encode_buffer(p_buffer, p_len))); + + return result; +} + +godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int(); +} + +godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int(true); +} + +godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, godot_string p_string) { + const String *self = (const String *)p_self; + String *content = (String *)&p_string; + godot_string result; + memnew_placement(&result, String(self->insert(p_at_pos, *content))); + + return result; +} + +godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_numeric(); +} + +godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->is_subsequence_of(*string); +} + +godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->is_subsequence_ofi(*string); +} + +godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->lpad(p_min_length))); + + return result; +} + +godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) { + const String *self = (const String *)p_self; + const String *character = (const String *)p_character; + godot_string result; + memnew_placement(&result, String(self->lpad(p_min_length, *character))); + + return result; +} + +godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard) { + const String *self = (const String *)p_self; + const String *wildcard = (const String *)p_wildcard; + + return self->match(*wildcard); +} + +godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard) { + const String *self = (const String *)p_self; + const String *wildcard = (const String *)p_wildcard; + + return self->matchn(*wildcard); +} + +godot_string GDAPI godot_string_md5(const uint8_t *p_md5) { + godot_string result; + memnew_placement(&result, String(String::md5(p_md5))); + + return result; +} + +godot_string GDAPI godot_string_num(double p_num) { + godot_string result; + memnew_placement(&result, String(String::num(p_num))); + + return result; +} + +godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base) { + godot_string result; + memnew_placement(&result, String(String::num_int64(p_num, p_base))); + + return result; +} + +godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex) { + godot_string result; + memnew_placement(&result, String(String::num_int64(p_num, p_base, p_capitalize_hex))); + + return result; +} + +godot_string GDAPI godot_string_num_uint64(uint64_t p_num, godot_int p_base) { + godot_string result; + memnew_placement(&result, String(String::num_uint64(p_num, p_base))); + + return result; +} + +godot_string GDAPI godot_string_num_uint64_capitalized(uint64_t p_num, godot_int p_base, godot_bool p_capitalize_hex) { + godot_string result; + memnew_placement(&result, String(String::num_uint64(p_num, p_base, p_capitalize_hex))); + + return result; +} + +godot_string GDAPI godot_string_num_real(double p_num) { + godot_string result; + memnew_placement(&result, String(String::num_real(p_num))); + + return result; +} + +godot_string GDAPI godot_string_num_scientific(double p_num) { + godot_string result; + memnew_placement(&result, String(String::num_scientific(p_num))); + + return result; +} + +godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals) { + godot_string result; + memnew_placement(&result, String(String::num(p_num, p_decimals))); + + return result; +} + +godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->pad_decimals(p_digits))); + + return result; +} + +godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->pad_zeros(p_digits))); + + return result; +} + +godot_string GDAPI godot_string_replace(const godot_string *p_self, godot_string p_key, godot_string p_with) { + const String *self = (const String *)p_self; + String *key = (String *)&p_key; + String *with = (String *)&p_with; + godot_string result; + memnew_placement(&result, String(self->replace(*key, *with))); + + return result; +} + +godot_string GDAPI godot_string_replacen(const godot_string *p_self, godot_string p_key, godot_string p_with) { + const String *self = (const String *)p_self; + String *key = (String *)&p_key; + String *with = (String *)&p_with; + godot_string result; + memnew_placement(&result, String(self->replacen(*key, *with))); + + return result; +} + +godot_int GDAPI godot_string_rfind(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfind(*what); +} + +godot_int GDAPI godot_string_rfindn(const godot_string *p_self, godot_string p_what) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfindn(*what); +} + +godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfind(*what, p_from); +} + +godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, godot_string p_what, godot_int p_from) { + const String *self = (const String *)p_self; + String *what = (String *)&p_what; + + return self->rfindn(*what, p_from); +} + +godot_string GDAPI godot_string_replace_first(const godot_string *p_self, godot_string p_key, godot_string p_with) { + const String *self = (const String *)p_self; + String *key = (String *)&p_key; + String *with = (String *)&p_with; + godot_string result; + memnew_placement(&result, String(self->replace_first(*key, *with))); + + return result; +} + +godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->rpad(p_min_length))); + + return result; +} + +godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) { + const String *self = (const String *)p_self; + const String *character = (const String *)p_character; + godot_string result; + memnew_placement(&result, String(self->rpad(p_min_length, *character))); + + return result; +} + +godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string) { + const String *self = (const String *)p_self; + const String *string = (const String *)p_string; + + return self->similarity(*string); +} + +godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error) { + const String *self = (const String *)p_self; + const Array *values = (const Array *)p_values; + + godot_string result; + String return_value = self->sprintf(*values, p_error); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->substr(p_from, p_chars))); + + return result; +} + +double GDAPI godot_string_to_double(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_double(); +} + +godot_real GDAPI godot_string_to_float(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_float(); +} + +godot_int GDAPI godot_string_to_int(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_int(); +} + +godot_string GDAPI godot_string_capitalize(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->capitalize())); + + return result; +} + +godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->camelcase_to_underscore(false))); + + return result; +} + +godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->camelcase_to_underscore())); + + return result; +} + +double GDAPI godot_string_char_to_double(const char *p_what) { + return String::to_double(p_what); +} + +godot_int GDAPI godot_string_char_to_int(const char *p_what) { + return String::to_int(p_what); +} + +int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str) { + return String::to_int(p_str); +} + +godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len) { + return String::to_int(p_what, p_len); +} + +int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len) { + return String::to_int(p_str, p_len); +} + +int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int64(false); +} + +int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hex_to_int64(); +} + +int64_t GDAPI godot_string_to_int64(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->to_int64(); +} + +double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end) { + return String::to_double(p_str, r_end); +} + +godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice) { + const String *self = (const String *)p_self; + String *splitter = (String *)&p_splitter; + godot_string result; + memnew_placement(&result, String(self->get_slice(*splitter, p_slice))); + + return result; +} + +godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->get_slicec(p_splitter, p_slice))); + + return result; +} + +godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split(*splitter, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split(*splitter); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_floats(*splitter, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_floats(*splitter); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters.write[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_floats_mk(splitters, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters.write[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_floats_mk(splitters); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_ints(*splitter, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter) { + const String *self = (const String *)p_self; + const String *splitter = (const String *)p_splitter; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_ints(*splitter); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters.write[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_ints_mk(splitters, false); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) { + const String *self = (const String *)p_self; + + Vector splitters; + Array *splitter_proxy = (Array *)p_splitters; + splitters.resize(splitter_proxy->size()); + for (int i = 0; i < splitter_proxy->size(); i++) { + splitters.write[i] = (*splitter_proxy)[i]; + } + + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_ints_mk(splitters); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_array result; + memnew_placement(&result, Array); + Array *proxy = (Array *)&result; + Vector return_value = self->split_spaces(); + + proxy->resize(return_value.size()); + for (int i = 0; i < return_value.size(); i++) { + (*proxy)[i] = return_value[i]; + } + + return result; +} + +godot_string GDAPI godot_string_join(const godot_string *p_self, const godot_array *p_parts) { + const String *self = (const String *)p_self; + + const Array *parts_proxy = (const Array *)p_parts; + Vector parts; + parts.resize(parts_proxy->size()); + for (int i = 0; i < parts_proxy->size(); i++) { + parts.write[i] = (*parts_proxy)[i]; + } + + godot_string str; + String *s = (String *)&str; + memnew_placement(s, String); + *s = self->join(parts); + return str; +} + +godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter) { + const String *self = (const String *)p_self; + String *splitter = (String *)&p_splitter; + + return self->get_slice_count(*splitter); +} + +wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char) { + return String::char_lowercase(p_char); +} + +wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char) { + return String::char_uppercase(p_char); +} + +godot_string GDAPI godot_string_to_lower(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->to_lower())); + + return result; +} + +godot_string GDAPI godot_string_to_upper(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->to_upper())); + + return result; +} + +godot_string GDAPI godot_string_get_basename(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->get_basename())); + + return result; +} + +godot_string GDAPI godot_string_get_extension(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->get_extension())); + + return result; +} + +godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->left(p_pos))); + + return result; +} + +wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx) { + const String *self = (const String *)p_self; + + return self->ord_at(p_idx); +} + +godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file) { + const String *self = (const String *)p_self; + const String *file = (const String *)p_file; + godot_string result; + memnew_placement(&result, String(self->plus_file(*file))); + + return result; +} + +godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->right(p_pos))); + + return result; +} + +godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->strip_edges(p_left, p_right))); + + return result; +} + +godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->strip_escapes())); + + return result; +} + +void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars) { + String *self = (String *)p_self; + + return self->erase(p_pos, p_chars); +} + +godot_char_string GDAPI godot_string_ascii(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_char_string result; + + memnew_placement(&result, CharString(self->ascii())); + + return result; +} + +godot_char_string GDAPI godot_string_ascii_extended(const godot_string *p_self) { + const String *self = (const String *)p_self; + + godot_char_string result; + + memnew_placement(&result, CharString(self->ascii(true))); + + return result; +} + +godot_char_string GDAPI godot_string_utf8(const godot_string *p_self) { + const String *self = (const String *)p_self; + + godot_char_string result; + + memnew_placement(&result, CharString(self->utf8())); + + return result; +} + +godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8) { + String *self = (String *)p_self; + + return self->parse_utf8(p_utf8); +} + +godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len) { + String *self = (String *)p_self; + + return self->parse_utf8(p_utf8, p_len); +} + +godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8) { + godot_string result; + memnew_placement(&result, String(String::utf8(p_utf8))); + + return result; +} + +godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len) { + godot_string result; + memnew_placement(&result, String(String::utf8(p_utf8, p_len))); + + return result; +} + +uint32_t GDAPI godot_string_hash(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hash(); +} + +uint64_t GDAPI godot_string_hash64(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->hash64(); +} + +uint32_t GDAPI godot_string_hash_chars(const char *p_cstr) { + return String::hash(p_cstr); +} + +uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len) { + return String::hash(p_cstr, p_len); +} + +uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str) { + return String::hash(p_str); +} + +uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len) { + return String::hash(p_str, p_len); +} + +godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) { + const String *self = (const String *)p_self; + Vector tmp_result = self->md5_buffer(); + + godot_pool_byte_array result; + memnew_placement(&result, PoolByteArray); + PoolByteArray *proxy = (PoolByteArray *)&result; + PoolByteArray::Write proxy_writer = proxy->write(); + proxy->resize(tmp_result.size()); + + for (int i = 0; i < tmp_result.size(); i++) { + proxy_writer[i] = tmp_result[i]; + } + + return result; +} + +godot_string GDAPI godot_string_md5_text(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->md5_text())); + + return result; +} + +godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) { + const String *self = (const String *)p_self; + Vector tmp_result = self->sha256_buffer(); + + godot_pool_byte_array result; + memnew_placement(&result, PoolByteArray); + PoolByteArray *proxy = (PoolByteArray *)&result; + PoolByteArray::Write proxy_writer = proxy->write(); + proxy->resize(tmp_result.size()); + + for (int i = 0; i < tmp_result.size(); i++) { + proxy_writer[i] = tmp_result[i]; + } + + return result; +} + +godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + memnew_placement(&result, String(self->sha256_text())); + + return result; +} + +godot_bool godot_string_empty(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->empty(); +} + +// path functions +godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->get_base_dir(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_get_file(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->get_file(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_humanize_size(uint64_t p_size) { + godot_string result; + String return_value = String::humanize_size(p_size); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_abs_path(); +} + +godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_rel_path(); +} + +godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_resource_file(); +} + +godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path) { + const String *self = (const String *)p_self; + String *path = (String *)p_path; + godot_string result; + String return_value = self->path_to(*path); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path) { + const String *self = (const String *)p_self; + String *path = (String *)p_path; + godot_string result; + String return_value = self->path_to_file(*path); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->simplify_path(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_c_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->c_escape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->c_escape_multiline(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->c_unescape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_http_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->http_escape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->http_unescape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_json_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->json_escape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->word_wrap(p_chars_per_line); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->xml_escape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->xml_escape(true); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->xml_unescape(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->percent_decode(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->percent_encode(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_float(); +} + +godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix) { + const String *self = (const String *)p_self; + + return self->is_valid_hex_number(p_with_prefix); +} + +godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_html_color(); +} + +godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_identifier(); +} + +godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_integer(); +} + +godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self) { + const String *self = (const String *)p_self; + + return self->is_valid_ip_address(); +} + +godot_string GDAPI godot_string_dedent(const godot_string *p_self) { + const String *self = (const String *)p_self; + godot_string result; + String return_value = self->dedent(); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_trim_prefix(const godot_string *p_self, const godot_string *p_prefix) { + const String *self = (const String *)p_self; + String *prefix = (String *)p_prefix; + godot_string result; + String return_value = self->trim_prefix(*prefix); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_trim_suffix(const godot_string *p_self, const godot_string *p_suffix) { + const String *self = (const String *)p_self; + String *suffix = (String *)p_suffix; + godot_string result; + String return_value = self->trim_suffix(*suffix); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_string GDAPI godot_string_rstrip(const godot_string *p_self, const godot_string *p_chars) { + const String *self = (const String *)p_self; + String *chars = (String *)p_chars; + godot_string result; + String return_value = self->rstrip(*chars); + memnew_placement(&result, String(return_value)); + + return result; +} + +godot_pool_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_divisor, + const godot_bool p_allow_empty, const godot_int p_maxsplit) { + const String *self = (const String *)p_self; + String *divisor = (String *)p_divisor; + + godot_pool_string_array result; + memnew_placement(&result, PoolStringArray); + PoolStringArray *proxy = (PoolStringArray *)&result; + PoolStringArray::Write proxy_writer = proxy->write(); + Vector tmp_result = self->rsplit(*divisor, p_allow_empty, p_maxsplit); + proxy->resize(tmp_result.size()); + + for (int i = 0; i < tmp_result.size(); i++) { + proxy_writer[i] = tmp_result[i]; + } + + return result; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/string_name.cpp b/gdnative/string_name.cpp new file mode 100644 index 0000000..90425e8 --- /dev/null +++ b/gdnative/string_name.cpp @@ -0,0 +1,91 @@ +/**************************************************************************/ +/* string_name.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/string_name.h" + +#include "core/string_name.h" +#include "core/ustring.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_string_name) == sizeof(StringName), "StringName size mismatch"); + +void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) { + StringName *dest = (StringName *)r_dest; + const String *name = (const String *)p_name; + memnew_placement(dest, StringName(*name)); +} + +void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name) { + StringName *dest = (StringName *)r_dest; + memnew_placement(dest, StringName(p_name)); +} + +godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self) { + godot_string ret; + const StringName *self = (const StringName *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self) { + const StringName *self = (const StringName *)p_self; + return self->hash(); +} + +const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self) { + const StringName *self = (const StringName *)p_self; + return self->data_unique_pointer(); +} + +godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other) { + const StringName *self = (const StringName *)p_self; + const StringName *other = (const StringName *)p_other; + return *self == *other; +} + +godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other) { + const StringName *self = (const StringName *)p_self; + const StringName *other = (const StringName *)p_other; + return *self < *other; +} + +void GDAPI godot_string_name_destroy(godot_string_name *p_self) { + StringName *self = (StringName *)p_self; + self->~StringName(); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/transform.cpp b/gdnative/transform.cpp new file mode 100644 index 0000000..2f51143 --- /dev/null +++ b/gdnative/transform.cpp @@ -0,0 +1,230 @@ +/**************************************************************************/ +/* transform.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/transform.h" + +#include "core/math/transform.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_transform) == sizeof(Transform), "Transform size mismatch"); + +void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) { + const Vector3 *x_axis = (const Vector3 *)p_x_axis; + const Vector3 *y_axis = (const Vector3 *)p_y_axis; + const Vector3 *z_axis = (const Vector3 *)p_z_axis; + const Vector3 *origin = (const Vector3 *)p_origin; + Transform *dest = (Transform *)r_dest; + dest->basis.set_axis(0, *x_axis); + dest->basis.set_axis(1, *y_axis); + dest->basis.set_axis(2, *z_axis); + dest->origin = *origin; +} + +void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin) { + const Basis *basis = (const Basis *)p_basis; + const Vector3 *origin = (const Vector3 *)p_origin; + Transform *dest = (Transform *)r_dest; + *dest = Transform(*basis, *origin); +} + +void GDAPI godot_transform_new_with_quat(godot_transform *r_dest, const godot_quat *p_quat) { + const Quat *quat = (const Quat *)p_quat; + Transform *dest = (Transform *)r_dest; + *dest = Transform(*quat); +} + +godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self) { + godot_basis dest; + const Transform *self = (const Transform *)p_self; + *((Basis *)&dest) = self->basis; + return dest; +} + +void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v) { + Transform *self = (Transform *)p_self; + const Basis *v = (const Basis *)p_v; + self->basis = *v; +} + +godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self) { + godot_vector3 dest; + const Transform *self = (const Transform *)p_self; + *((Vector3 *)&dest) = self->origin; + return dest; +} + +void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v) { + Transform *self = (Transform *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->origin = *v; +} + +godot_string GDAPI godot_transform_as_string(const godot_transform *p_self) { + godot_string ret; + const Transform *self = (const Transform *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + *((Transform *)&dest) = self->inverse(); + return dest; +} + +godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + *((Transform *)&dest) = self->affine_inverse(); + return dest; +} + +godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + *((Transform *)&dest) = self->orthonormalized(); + return dest; +} + +godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + const Vector3 *axis = (const Vector3 *)p_axis; + *((Transform *)&dest) = self->rotated(*axis, p_phi); + return dest; +} + +godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + const Vector3 *scale = (const Vector3 *)p_scale; + *((Transform *)&dest) = self->scaled(*scale); + return dest; +} + +godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + const Vector3 *ofs = (const Vector3 *)p_ofs; + *((Transform *)&dest) = self->translated(*ofs); + return dest; +} + +godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up) { + godot_transform dest; + const Transform *self = (const Transform *)p_self; + const Vector3 *target = (const Vector3 *)p_target; + const Vector3 *up = (const Vector3 *)p_up; + *((Transform *)&dest) = self->looking_at(*target, *up); + return dest; +} + +godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v) { + godot_plane raw_dest; + Plane *dest = (Plane *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const Plane *v = (const Plane *)p_v; + *dest = self->xform(*v); + return raw_dest; +} + +godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v) { + godot_plane raw_dest; + Plane *dest = (Plane *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const Plane *v = (const Plane *)p_v; + *dest = self->xform_inv(*v); + return raw_dest; +} + +void GDAPI godot_transform_new_identity(godot_transform *r_dest) { + Transform *dest = (Transform *)r_dest; + *dest = Transform(); +} + +godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b) { + const Transform *self = (const Transform *)p_self; + const Transform *b = (const Transform *)p_b; + return *self == *b; +} + +godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b) { + godot_transform raw_dest; + Transform *dest = (Transform *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const Transform *b = (const Transform *)p_b; + *dest = *self * *b; + return raw_dest; +} + +godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + *dest = self->xform(*v); + return raw_dest; +} + +godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + *dest = self->xform_inv(*v); + return raw_dest; +} + +godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v) { + godot_aabb raw_dest; + AABB *dest = (AABB *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const AABB *v = (const AABB *)p_v; + *dest = self->xform(*v); + return raw_dest; +} + +godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v) { + godot_aabb raw_dest; + AABB *dest = (AABB *)&raw_dest; + const Transform *self = (const Transform *)p_self; + const AABB *v = (const AABB *)p_v; + *dest = self->xform_inv(*v); + return raw_dest; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/transform2d.cpp b/gdnative/transform2d.cpp new file mode 100644 index 0000000..6b4bfd3 --- /dev/null +++ b/gdnative/transform2d.cpp @@ -0,0 +1,216 @@ +/**************************************************************************/ +/* transform2d.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/transform2d.h" + +#include "core/math/transform_2d.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_transform2d) == sizeof(Transform2D), "Transform2D size mismatch"); + +void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) { + const Vector2 *pos = (const Vector2 *)p_pos; + Transform2D *dest = (Transform2D *)r_dest; + *dest = Transform2D(p_rot, *pos); +} + +void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin) { + const Vector2 *x_axis = (const Vector2 *)p_x_axis; + const Vector2 *y_axis = (const Vector2 *)p_y_axis; + const Vector2 *origin = (const Vector2 *)p_origin; + Transform2D *dest = (Transform2D *)r_dest; + *dest = Transform2D(x_axis->x, x_axis->y, y_axis->x, y_axis->y, origin->x, origin->y); +} + +godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self) { + godot_string ret; + const Transform2D *self = (const Transform2D *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + *((Transform2D *)&dest) = self->inverse(); + return dest; +} + +godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + *((Transform2D *)&dest) = self->affine_inverse(); + return dest; +} + +godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self) { + const Transform2D *self = (const Transform2D *)p_self; + return self->get_rotation(); +} + +godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self) { + godot_vector2 dest; + const Transform2D *self = (const Transform2D *)p_self; + *((Vector2 *)&dest) = self->get_origin(); + return dest; +} + +godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self) { + godot_vector2 dest; + const Transform2D *self = (const Transform2D *)p_self; + *((Vector2 *)&dest) = self->get_scale(); + return dest; +} + +godot_real GDAPI godot_transform2d_determinant(const godot_transform2d *p_self) { + const Transform2D *self = (const Transform2D *)p_self; + return self->determinant(); +} + +godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + *((Transform2D *)&dest) = self->orthonormalized(); + return dest; +} + +godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + + *((Transform2D *)&dest) = self->rotated(p_phi); + return dest; +} + +godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + const Vector2 *scale = (const Vector2 *)p_scale; + *((Transform2D *)&dest) = self->scaled(*scale); + return dest; +} + +godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + const Vector2 *offset = (const Vector2 *)p_offset; + *((Transform2D *)&dest) = self->translated(*offset); + return dest; +} + +godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Vector2 *v = (const Vector2 *)p_v; + *dest = self->xform(*v); + return raw_dest; +} + +godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Vector2 *v = (const Vector2 *)p_v; + *dest = self->xform_inv(*v); + return raw_dest; +} + +godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Vector2 *v = (const Vector2 *)p_v; + *dest = self->basis_xform(*v); + return raw_dest; +} + +godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Vector2 *v = (const Vector2 *)p_v; + *dest = self->basis_xform_inv(*v); + return raw_dest; +} + +godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c) { + godot_transform2d dest; + const Transform2D *self = (const Transform2D *)p_self; + const Transform2D *m = (const Transform2D *)p_m; + *((Transform2D *)&dest) = self->interpolate_with(*m, p_c); + return dest; +} + +godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b) { + const Transform2D *self = (const Transform2D *)p_self; + const Transform2D *b = (const Transform2D *)p_b; + return *self == *b; +} + +godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b) { + godot_transform2d raw_dest; + Transform2D *dest = (Transform2D *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Transform2D *b = (const Transform2D *)p_b; + *dest = *self * *b; + return raw_dest; +} + +void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest) { + Transform2D *dest = (Transform2D *)r_dest; + *dest = Transform2D(); +} + +godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v) { + godot_rect2 raw_dest; + Rect2 *dest = (Rect2 *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Rect2 *v = (const Rect2 *)p_v; + *dest = self->xform(*v); + return raw_dest; +} + +godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v) { + godot_rect2 raw_dest; + Rect2 *dest = (Rect2 *)&raw_dest; + const Transform2D *self = (const Transform2D *)p_self; + const Rect2 *v = (const Rect2 *)p_v; + *dest = self->xform_inv(*v); + return raw_dest; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/variant.cpp b/gdnative/variant.cpp new file mode 100644 index 0000000..bb77595 --- /dev/null +++ b/gdnative/variant.cpp @@ -0,0 +1,528 @@ +/**************************************************************************/ +/* variant.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/variant.h" + +#include "core/reference.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_variant) == sizeof(Variant), "Variant size mismatch"); + +// Workaround GCC ICE on armv7hl which was affected GCC 6.0 up to 8.0 (GH-16100). +// It was fixed upstream in 8.1, and a fix was backported to 7.4. +// This can be removed once no supported distro ships with versions older than 7.4. +#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \ + (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1)) +#pragma GCC push_options +#pragma GCC optimize("-O0") +#endif + +#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) + +#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \ + (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1)) +#pragma GCC pop_options +#endif + +// Constructors + +godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return (godot_variant_type)self->get_type(); +} + +void GDAPI godot_variant_new_copy(godot_variant *p_dest, const godot_variant *p_src) { + Variant *dest = (Variant *)p_dest; + Variant *src = (Variant *)p_src; + memnew_placement(dest, Variant(*src)); +} + +void GDAPI godot_variant_new_nil(godot_variant *r_dest) { + Variant *dest = (Variant *)r_dest; + memnew_placement(dest, Variant); +} + +void GDAPI godot_variant_new_bool(godot_variant *r_dest, const godot_bool p_b) { + Variant *dest = (Variant *)r_dest; + memnew_placement_custom(dest, Variant, Variant(p_b)); +} + +void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i) { + Variant *dest = (Variant *)r_dest; + memnew_placement_custom(dest, Variant, Variant(p_i)); +} + +void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i) { + Variant *dest = (Variant *)r_dest; + memnew_placement_custom(dest, Variant, Variant(p_i)); +} + +void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r) { + Variant *dest = (Variant *)r_dest; + memnew_placement_custom(dest, Variant, Variant(p_r)); +} + +void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s) { + Variant *dest = (Variant *)r_dest; + String *s = (String *)p_s; + memnew_placement_custom(dest, Variant, Variant(*s)); +} + +void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2) { + Variant *dest = (Variant *)r_dest; + Vector2 *v2 = (Vector2 *)p_v2; + memnew_placement_custom(dest, Variant, Variant(*v2)); +} + +void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2) { + Variant *dest = (Variant *)r_dest; + Rect2 *rect2 = (Rect2 *)p_rect2; + memnew_placement_custom(dest, Variant, Variant(*rect2)); +} + +void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3) { + Variant *dest = (Variant *)r_dest; + Vector3 *v3 = (Vector3 *)p_v3; + memnew_placement_custom(dest, Variant, Variant(*v3)); +} + +void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d) { + Variant *dest = (Variant *)r_dest; + Transform2D *t2d = (Transform2D *)p_t2d; + memnew_placement_custom(dest, Variant, Variant(*t2d)); +} + +void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane) { + Variant *dest = (Variant *)r_dest; + Plane *plane = (Plane *)p_plane; + memnew_placement_custom(dest, Variant, Variant(*plane)); +} + +void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat) { + Variant *dest = (Variant *)r_dest; + Quat *quat = (Quat *)p_quat; + memnew_placement_custom(dest, Variant, Variant(*quat)); +} + +void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) { + Variant *dest = (Variant *)r_dest; + AABB *aabb = (AABB *)p_aabb; + memnew_placement_custom(dest, Variant, Variant(*aabb)); +} + +void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) { + Variant *dest = (Variant *)r_dest; + Basis *basis = (Basis *)p_basis; + memnew_placement_custom(dest, Variant, Variant(*basis)); +} + +void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans) { + Variant *dest = (Variant *)r_dest; + Transform *trans = (Transform *)p_trans; + memnew_placement_custom(dest, Variant, Variant(*trans)); +} + +void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color) { + Variant *dest = (Variant *)r_dest; + Color *color = (Color *)p_color; + memnew_placement_custom(dest, Variant, Variant(*color)); +} + +void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np) { + Variant *dest = (Variant *)r_dest; + NodePath *np = (NodePath *)p_np; + memnew_placement_custom(dest, Variant, Variant(*np)); +} + +void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid) { + Variant *dest = (Variant *)r_dest; + RID *rid = (RID *)p_rid; + memnew_placement_custom(dest, Variant, Variant(*rid)); +} + +void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj) { + Variant *dest = (Variant *)r_dest; + Object *obj = (Object *)p_obj; + Reference *reference = Object::cast_to(obj); + REF ref; + if (reference) { + ref = REF(reference); + } + if (!ref.is_null()) { + memnew_placement_custom(dest, Variant, Variant(ref.get_ref_ptr())); + } else { +#if defined(DEBUG_METHODS_ENABLED) + if (reference) { + ERR_PRINT("Reference object has 0 refcount in godot_variant_new_object - you lost it somewhere."); + } +#endif + memnew_placement_custom(dest, Variant, Variant(obj)); + } +} + +void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict) { + Variant *dest = (Variant *)r_dest; + Dictionary *dict = (Dictionary *)p_dict; + memnew_placement_custom(dest, Variant, Variant(*dict)); +} + +void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr) { + Variant *dest = (Variant *)r_dest; + Array *arr = (Array *)p_arr; + memnew_placement_custom(dest, Variant, Variant(*arr)); +} + +void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba) { + Variant *dest = (Variant *)r_dest; + PoolByteArray *pba = (PoolByteArray *)p_pba; + memnew_placement_custom(dest, Variant, Variant(*pba)); +} + +void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia) { + Variant *dest = (Variant *)r_dest; + PoolIntArray *pia = (PoolIntArray *)p_pia; + memnew_placement_custom(dest, Variant, Variant(*pia)); +} + +void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra) { + Variant *dest = (Variant *)r_dest; + PoolRealArray *pra = (PoolRealArray *)p_pra; + memnew_placement_custom(dest, Variant, Variant(*pra)); +} + +void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa) { + Variant *dest = (Variant *)r_dest; + PoolStringArray *psa = (PoolStringArray *)p_psa; + memnew_placement_custom(dest, Variant, Variant(*psa)); +} + +void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a) { + Variant *dest = (Variant *)r_dest; + PoolVector2Array *pv2a = (PoolVector2Array *)p_pv2a; + memnew_placement_custom(dest, Variant, Variant(*pv2a)); +} + +void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a) { + Variant *dest = (Variant *)r_dest; + PoolVector3Array *pv3a = (PoolVector3Array *)p_pv3a; + memnew_placement_custom(dest, Variant, Variant(*pv3a)); +} + +void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca) { + Variant *dest = (Variant *)r_dest; + PoolColorArray *pca = (PoolColorArray *)p_pca; + memnew_placement_custom(dest, Variant, Variant(*pca)); +} + +godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return self->operator bool(); +} + +uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return self->operator uint64_t(); +} + +int64_t GDAPI godot_variant_as_int(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return self->operator int64_t(); +} + +double GDAPI godot_variant_as_real(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return self->operator double(); +} + +godot_string GDAPI godot_variant_as_string(const godot_variant *p_self) { + godot_string raw_dest; + const Variant *self = (const Variant *)p_self; + String *dest = (String *)&raw_dest; + memnew_placement(dest, String(self->operator String())); // operator = is overloaded by String + return raw_dest; +} + +godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self) { + godot_vector2 raw_dest; + const Variant *self = (const Variant *)p_self; + Vector2 *dest = (Vector2 *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self) { + godot_rect2 raw_dest; + const Variant *self = (const Variant *)p_self; + Rect2 *dest = (Rect2 *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self) { + godot_vector3 raw_dest; + const Variant *self = (const Variant *)p_self; + Vector3 *dest = (Vector3 *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self) { + godot_transform2d raw_dest; + const Variant *self = (const Variant *)p_self; + Transform2D *dest = (Transform2D *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self) { + godot_plane raw_dest; + const Variant *self = (const Variant *)p_self; + Plane *dest = (Plane *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) { + godot_quat raw_dest; + const Variant *self = (const Variant *)p_self; + Quat *dest = (Quat *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self) { + godot_aabb raw_dest; + const Variant *self = (const Variant *)p_self; + AABB *dest = (AABB *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) { + godot_basis raw_dest; + const Variant *self = (const Variant *)p_self; + Basis *dest = (Basis *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self) { + godot_transform raw_dest; + const Variant *self = (const Variant *)p_self; + Transform *dest = (Transform *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_color GDAPI godot_variant_as_color(const godot_variant *p_self) { + godot_color raw_dest; + const Variant *self = (const Variant *)p_self; + Color *dest = (Color *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self) { + godot_node_path raw_dest; + const Variant *self = (const Variant *)p_self; + NodePath *dest = (NodePath *)&raw_dest; + memnew_placement(dest, NodePath(self->operator NodePath())); // operator = is overloaded by NodePath + return raw_dest; +} + +godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self) { + godot_rid raw_dest; + const Variant *self = (const Variant *)p_self; + RID *dest = (RID *)&raw_dest; + *dest = *self; + return raw_dest; +} + +godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + Object *dest; + dest = *self; + return (godot_object *)dest; +} + +godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self) { + godot_dictionary raw_dest; + const Variant *self = (const Variant *)p_self; + Dictionary *dest = (Dictionary *)&raw_dest; + memnew_placement(dest, Dictionary(self->operator Dictionary())); // operator = is overloaded by Dictionary + return raw_dest; +} + +godot_array GDAPI godot_variant_as_array(const godot_variant *p_self) { + godot_array raw_dest; + const Variant *self = (const Variant *)p_self; + Array *dest = (Array *)&raw_dest; + memnew_placement(dest, Array(self->operator Array())); // operator = is overloaded by Array + return raw_dest; +} + +godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self) { + godot_pool_byte_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolByteArray *dest = (PoolByteArray *)&raw_dest; + memnew_placement(dest, PoolByteArray(self->operator PoolByteArray())); // operator = is overloaded by PoolByteArray + *dest = *self; + return raw_dest; +} + +godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self) { + godot_pool_int_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolIntArray *dest = (PoolIntArray *)&raw_dest; + memnew_placement(dest, PoolIntArray(self->operator PoolIntArray())); // operator = is overloaded by PoolIntArray + *dest = *self; + return raw_dest; +} + +godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self) { + godot_pool_real_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolRealArray *dest = (PoolRealArray *)&raw_dest; + memnew_placement(dest, PoolRealArray(self->operator PoolRealArray())); // operator = is overloaded by PoolRealArray + *dest = *self; + return raw_dest; +} + +godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self) { + godot_pool_string_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolStringArray *dest = (PoolStringArray *)&raw_dest; + memnew_placement(dest, PoolStringArray(self->operator PoolStringArray())); // operator = is overloaded by PoolStringArray + *dest = *self; + return raw_dest; +} + +godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self) { + godot_pool_vector2_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolVector2Array *dest = (PoolVector2Array *)&raw_dest; + memnew_placement(dest, PoolVector2Array(self->operator PoolVector2Array())); // operator = is overloaded by PoolVector2Array + *dest = *self; + return raw_dest; +} + +godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self) { + godot_pool_vector3_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolVector3Array *dest = (PoolVector3Array *)&raw_dest; + memnew_placement(dest, PoolVector3Array(self->operator PoolVector3Array())); // operator = is overloaded by PoolVector3Array + *dest = *self; + return raw_dest; +} + +godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self) { + godot_pool_color_array raw_dest; + const Variant *self = (const Variant *)p_self; + PoolColorArray *dest = (PoolColorArray *)&raw_dest; + memnew_placement(dest, PoolColorArray(self->operator PoolColorArray())); // operator = is overloaded by PoolColorArray + *dest = *self; + return raw_dest; +} + +godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error) { + Variant *self = (Variant *)p_self; + String *method = (String *)p_method; + const Variant **args = (const Variant **)p_args; + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + Variant::CallError error; + memnew_placement_custom(dest, Variant, Variant(self->call(*method, args, p_argcount, error))); + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } + return raw_dest; +} + +godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method) { + const Variant *self = (const Variant *)p_self; + const String *method = (const String *)p_method; + return self->has_method(*method); +} + +godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other) { + const Variant *self = (const Variant *)p_self; + const Variant *other = (const Variant *)p_other; + return self->operator==(*other); +} + +godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other) { + const Variant *self = (const Variant *)p_self; + const Variant *other = (const Variant *)p_other; + return self->operator<(*other); +} + +godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other) { + const Variant *self = (const Variant *)p_self; + const Variant *other = (const Variant *)p_other; + return self->hash_compare(*other); +} + +godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return self->booleanize(); +} + +void GDAPI godot_variant_destroy(godot_variant *p_self) { + Variant *self = (Variant *)p_self; + self->~Variant(); +} + +// GDNative core 1.1 + +godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_op) { + Variant::Operator op = (Variant::Operator)p_op; + godot_string raw_dest; + String *dest = (String *)&raw_dest; + memnew_placement(dest, String(Variant::get_operator_name(op))); // operator = is overloaded by String + return raw_dest; +} + +void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid) { + Variant::Operator op = (Variant::Operator)p_op; + const Variant *a = (const Variant *)p_a; + const Variant *b = (const Variant *)p_b; + Variant *ret = (Variant *)r_ret; + Variant::evaluate(op, *a, *b, *ret, *r_valid); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/vector2.cpp b/gdnative/vector2.cpp new file mode 100644 index 0000000..d9d3d0f --- /dev/null +++ b/gdnative/vector2.cpp @@ -0,0 +1,313 @@ +/**************************************************************************/ +/* vector2.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/vector2.h" + +#include "core/math/vector2.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_vector2) == sizeof(Vector2), "Vector2 size mismatch"); + +void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) { + Vector2 *dest = (Vector2 *)r_dest; + *dest = Vector2(p_x, p_y); +} + +godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self) { + godot_string ret; + const Vector2 *self = (const Vector2 *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + *((Vector2 *)&dest) = self->normalized(); + return dest; +} + +godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->length(); +} + +godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->angle(); +} + +godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->length_squared(); +} + +godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->is_normalized(); +} + +godot_vector2 GDAPI godot_vector2_direction_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + *((Vector2 *)&dest) = self->direction_to(*to); + return dest; +} + +godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + return self->distance_to(*to); +} + +godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + return self->distance_squared_to(*to); +} + +godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + return self->angle_to(*to); +} + +godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + return self->angle_to_point(*to); +} + +godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + *((Vector2 *)&dest) = self->linear_interpolate(*b, p_t); + return dest; +} + +godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + const Vector2 *pre_a = (const Vector2 *)p_pre_a; + const Vector2 *post_b = (const Vector2 *)p_post_b; + *((Vector2 *)&dest) = self->cubic_interpolate(*b, *pre_a, *post_b, p_t); + return dest; +} + +godot_vector2 GDAPI godot_vector2_move_toward(const godot_vector2 *p_self, const godot_vector2 *p_to, const godot_real p_delta) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *to = (const Vector2 *)p_to; + *((Vector2 *)&dest) = self->move_toward(*to, p_delta); + return dest; +} + +godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + + *((Vector2 *)&dest) = self->rotated(p_phi); + return dest; +} + +godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + *((Vector2 *)&dest) = self->tangent(); + return dest; +} + +godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + *((Vector2 *)&dest) = self->floor(); + return dest; +} + +godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *by = (const Vector2 *)p_by; + *((Vector2 *)&dest) = self->snapped(*by); + return dest; +} + +godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->aspect(); +} + +godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *with = (const Vector2 *)p_with; + return self->dot(*with); +} + +godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *n = (const Vector2 *)p_n; + *((Vector2 *)&dest) = self->slide(*n); + return dest; +} + +godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *n = (const Vector2 *)p_n; + *((Vector2 *)&dest) = self->bounce(*n); + return dest; +} + +godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *n = (const Vector2 *)p_n; + *((Vector2 *)&dest) = self->reflect(*n); + return dest; +} + +godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + *((Vector2 *)&dest) = self->abs(); + return dest; +} + +godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length) { + godot_vector2 dest; + const Vector2 *self = (const Vector2 *)p_self; + + *((Vector2 *)&dest) = self->limit_length(p_length); + return dest; +} + +godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + *dest = *self + *b; + return raw_dest; +} + +godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + *dest = *self - *b; + return raw_dest; +} + +godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + *dest = *self * *b; + return raw_dest; +} + +godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + *dest = *self * p_b; + return raw_dest; +} + +godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + *dest = *self / *b; + return raw_dest; +} + +godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + *dest = *self / p_b; + return raw_dest; +} + +godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + return *self == *b; +} + +godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b) { + const Vector2 *self = (const Vector2 *)p_self; + const Vector2 *b = (const Vector2 *)p_b; + return *self < *b; +} + +godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self) { + godot_vector2 raw_dest; + Vector2 *dest = (Vector2 *)&raw_dest; + const Vector2 *self = (const Vector2 *)p_self; + *dest = -(*self); + return raw_dest; +} + +void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x) { + Vector2 *self = (Vector2 *)p_self; + self->x = p_x; +} + +void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y) { + Vector2 *self = (Vector2 *)p_self; + self->y = p_y; +} + +godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->x; +} + +godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self) { + const Vector2 *self = (const Vector2 *)p_self; + return self->y; +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative/vector3.cpp b/gdnative/vector3.cpp new file mode 100644 index 0000000..6973559 --- /dev/null +++ b/gdnative/vector3.cpp @@ -0,0 +1,320 @@ +/**************************************************************************/ +/* vector3.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "gdnative/vector3.h" + +#include "core/variant.h" +#include "core/vector.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_vector3) == sizeof(Vector3), "Vector3 size mismatch"); + +void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) { + Vector3 *dest = (Vector3 *)r_dest; + *dest = Vector3(p_x, p_y, p_z); +} + +godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self) { + godot_string ret; + const Vector3 *self = (const Vector3 *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self) { + const Vector3 *self = (const Vector3 *)p_self; + return self->min_axis(); +} + +godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self) { + const Vector3 *self = (const Vector3 *)p_self; + return self->max_axis(); +} + +godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self) { + const Vector3 *self = (const Vector3 *)p_self; + return self->length(); +} + +godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self) { + const Vector3 *self = (const Vector3 *)p_self; + return self->length_squared(); +} + +godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self) { + const Vector3 *self = (const Vector3 *)p_self; + return self->is_normalized(); +} + +godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + *((Vector3 *)&dest) = self->normalized(); + return dest; +} + +godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + *((Vector3 *)&dest) = self->inverse(); + return dest; +} + +godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_vector3 *p_by) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *snap_axis = (const Vector3 *)p_by; + + *((Vector3 *)&dest) = self->snapped(*snap_axis); + return dest; +} + +godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *axis = (const Vector3 *)p_axis; + *((Vector3 *)&dest) = self->rotated(*axis, p_phi); + return dest; +} + +godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *((Vector3 *)&dest) = self->linear_interpolate(*b, p_t); + return dest; +} + +godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + const Vector3 *pre_a = (const Vector3 *)p_pre_a; + const Vector3 *post_b = (const Vector3 *)p_post_b; + *((Vector3 *)&dest) = self->cubic_interpolate(*b, *pre_a, *post_b, p_t); + return dest; +} + +godot_vector3 GDAPI godot_vector3_move_toward(const godot_vector3 *p_self, const godot_vector3 *p_to, const godot_real p_delta) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *to = (const Vector3 *)p_to; + *((Vector3 *)&dest) = self->move_toward(*to, p_delta); + return dest; +} + +godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b) { + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + return self->dot(*b); +} + +godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *((Vector3 *)&dest) = self->cross(*b); + return dest; +} + +godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b) { + godot_basis dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *((Basis *)&dest) = self->outer(*b); + return dest; +} + +godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self) { + godot_basis dest; + const Vector3 *self = (const Vector3 *)p_self; + *((Basis *)&dest) = self->to_diagonal_matrix(); + return dest; +} + +godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + *((Vector3 *)&dest) = self->abs(); + return dest; +} + +godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + *((Vector3 *)&dest) = self->floor(); + return dest; +} + +godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + *((Vector3 *)&dest) = self->ceil(); + return dest; +} + +godot_vector3 GDAPI godot_vector3_direction_to(const godot_vector3 *p_self, const godot_vector3 *p_to) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *to = (const Vector3 *)p_to; + *((Vector3 *)&dest) = self->direction_to(*to); + return dest; +} + +godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b) { + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + return self->distance_to(*b); +} + +godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b) { + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + return self->distance_squared_to(*b); +} + +godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to) { + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *to = (const Vector3 *)p_to; + return self->angle_to(*to); +} + +godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *n = (const Vector3 *)p_n; + *((Vector3 *)&dest) = self->slide(*n); + return dest; +} + +godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *n = (const Vector3 *)p_n; + *((Vector3 *)&dest) = self->bounce(*n); + return dest; +} + +godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n) { + godot_vector3 dest; + const Vector3 *self = (const Vector3 *)p_self; + const Vector3 *n = (const Vector3 *)p_n; + *((Vector3 *)&dest) = self->reflect(*n); + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + Vector3 *self = (Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *dest = *self + *b; + return raw_dest; +} + +godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + Vector3 *self = (Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *dest = *self - *b; + return raw_dest; +} + +godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + Vector3 *self = (Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *dest = *self * *b; + return raw_dest; +} + +godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + Vector3 *self = (Vector3 *)p_self; + *dest = *self * p_b; + return raw_dest; +} + +godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + Vector3 *self = (Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + *dest = *self / *b; + return raw_dest; +} + +godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + Vector3 *self = (Vector3 *)p_self; + *dest = *self / p_b; + return raw_dest; +} + +godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b) { + Vector3 *self = (Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + return *self == *b; +} + +godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b) { + Vector3 *self = (Vector3 *)p_self; + const Vector3 *b = (const Vector3 *)p_b; + return *self < *b; +} + +godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self) { + godot_vector3 raw_dest; + Vector3 *dest = (Vector3 *)&raw_dest; + const Vector3 *self = (const Vector3 *)p_self; + *dest = -(*self); + return raw_dest; +} + +void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val) { + Vector3 *self = (Vector3 *)p_self; + self->set_axis(p_axis, p_val); +} + +godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis) { + const Vector3 *self = (const Vector3 *)p_self; + return self->get_axis(p_axis); +} + +#ifdef __cplusplus +} +#endif diff --git a/gdnative_api.json b/gdnative_api.json new file mode 100644 index 0000000..c8827a3 --- /dev/null +++ b/gdnative_api.json @@ -0,0 +1,6844 @@ +{ + "core": { + "type": "CORE", + "version": { + "major": 1, + "minor": 0 + }, + "next": { + "type": "CORE", + "version": { + "major": 1, + "minor": 1 + }, + "next": { + "type": "CORE", + "version": { + "major": 1, + "minor": 2 + }, + "next": { + "type": "CORE", + "version": { + "major": 1, + "minor": 3 + }, + "next": null, + "api": [ + { + "name": "godot_dictionary_merge", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_dictionary *", "p_dictionary"], + ["const godot_bool", "p_overwrite"] + ] + }, + { + "name": "godot_pool_byte_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"], + ["const uint8_t", "p_data"] + ] + }, + { + "name": "godot_pool_byte_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_int_array *", "p_self"], + ["const godot_int", "p_data"] + ] + }, + { + "name": "godot_pool_int_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_real_array *", "p_self"], + ["const godot_real", "p_data"] + ] + }, + { + "name": "godot_pool_real_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_string_array *", "p_self"], + ["const godot_string *", "p_data"] + ] + }, + { + "name": "godot_pool_string_array_join", + "return_type": "godot_string", + "arguments": [ + ["const godot_pool_string_array *", "p_self"], + ["const godot_string *", "p_delimiter"] + ] + }, + { + "name": "godot_pool_string_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"], + ["const godot_vector2 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector2_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"], + ["const godot_vector3 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector3_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_color_array *", "p_self"], + ["const godot_color *", "p_data"] + ] + }, + { + "name": "godot_pool_color_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_string_join", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_parts"] + ] + }, + { + "name": "godot_string_num_uint64", + "return_type": "godot_string", + "arguments": [ + ["uint64_t", "p_num"], + ["godot_int", "p_base"] + ] + }, + { + "name": "godot_string_num_uint64_capitalized", + "return_type": "godot_string", + "arguments": [ + ["uint64_t", "p_num"], + ["godot_int", "p_base"], + ["godot_bool", "p_capitalize_hex"] + ] + } + ] + }, + "api": [ + { + "name": "godot_dictionary_duplicate", + "return_type": "godot_dictionary", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_bool", "p_deep"] + ] + }, + { + "name": "godot_vector3_move_toward", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_to"], + ["const godot_real", "p_delta"] + ] + }, + { + "name": "godot_vector2_move_toward", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_to"], + ["const godot_real", "p_delta"] + ] + }, + { + "name": "godot_string_count", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"], + ["godot_int", "p_from"], + ["godot_int", "p_to"] + ] + }, + { + "name": "godot_string_countn", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"], + ["godot_int", "p_from"], + ["godot_int", "p_to"] + ] + }, + { + "name": "godot_vector3_direction_to", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_to"] + ] + }, + { + "name": "godot_vector2_direction_to", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_to"] + ] + }, + { + "name": "godot_array_slice", + "return_type": "godot_array", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_int", "p_begin"], + ["const godot_int", "p_end"], + ["const godot_int", "p_step"], + ["const godot_bool", "p_deep"] + ] + }, + { + "name": "godot_pool_byte_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_get_class_tag", + "return_type": "void *", + "arguments": [ + ["const godot_string_name *", "p_class"] + ] + }, + { + "name": "godot_object_cast_to", + "return_type": "godot_object *", + "arguments": [ + ["const godot_object *", "p_object"], + ["void *", "p_class_tag"] + ] + }, + { + "name": "godot_instance_from_id", + "return_type": "godot_object *", + "arguments": [ + ["godot_int", "p_instance_id"] + ] + } + ] + }, + "api": [ + { + "name": "godot_color_to_abgr32", + "return_type": "godot_int", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_to_abgr64", + "return_type": "godot_int", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_to_argb64", + "return_type": "godot_int", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_to_rgba64", + "return_type": "godot_int", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_darkened", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_real", "p_amount"] + ] + }, + { + "name": "godot_color_from_hsv", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_real", "p_h"], + ["const godot_real", "p_s"], + ["const godot_real", "p_v"], + ["const godot_real", "p_a"] + ] + }, + { + "name": "godot_color_lightened", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_real", "p_amount"] + ] + }, + { + "name": "godot_array_duplicate", + "return_type": "godot_array", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_bool", "p_deep"] + ] + }, + { + "name": "godot_array_max", + "return_type": "godot_variant", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_min", + "return_type": "godot_variant", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_shuffle", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_basis_slerp", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_basis *", "p_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_dictionary_get_with_default", + "return_type": "godot_variant", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"], + ["const godot_variant *", "p_default"] + ] + }, + { + "name": "godot_dictionary_erase_with_return", + "return_type": "bool", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_node_path_get_as_property_path", + "return_type": "godot_node_path", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_quat_set_axis_angle", + "return_type": "void", + "arguments": [ + ["godot_quat *", "p_self"], + ["const godot_vector3 *", "p_axis"], + ["const godot_real", "p_angle"] + ] + }, + { + "name": "godot_rect2_grow_individual", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_real", "p_left"], + ["const godot_real", "p_top"], + ["const godot_real", "p_right"], + ["const godot_real", "p_bottom"] + ] + }, + { + "name": "godot_rect2_grow_margin", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_int", "p_margin"], + ["const godot_real", "p_by"] + ] + }, + { + "name": "godot_rect2_abs", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"] + ] + }, + { + "name": "godot_string_dedent", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_trim_prefix", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_prefix"] + ] + }, + { + "name": "godot_string_trim_suffix", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_suffix"] + ] + }, + { + "name": "godot_string_rstrip", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_chars"] + ] + }, + { + "name": "godot_string_rsplit", + "return_type": "godot_pool_string_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_divisor"], + ["const godot_bool", "p_allow_empty"], + ["const godot_int", "p_maxsplit"] + ] + }, + { + "name": "godot_basis_get_quat", + "return_type": "godot_quat", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_set_quat", + "return_type": "void", + "arguments": [ + ["godot_basis *", "p_self"], + ["const godot_quat *", "p_quat"] + ] + }, + { + "name": "godot_basis_set_axis_angle_scale", + "return_type": "void", + "arguments": [ + ["godot_basis *", "p_self"], + ["const godot_vector3 *", "p_axis"], + ["godot_real", "p_phi"], + ["const godot_vector3 *", "p_scale"] + ] + }, + { + "name": "godot_basis_set_euler_scale", + "return_type": "void", + "arguments": [ + ["godot_basis *", "p_self"], + ["const godot_vector3 *", "p_euler"], + ["const godot_vector3 *", "p_scale"] + ] + }, + { + "name": "godot_basis_set_quat_scale", + "return_type": "void", + "arguments": [ + ["godot_basis *", "p_self"], + ["const godot_quat *", "p_quat"], + ["const godot_vector3 *", "p_scale"] + ] + }, + { + "name": "godot_is_instance_valid", + "return_type": "bool", + "arguments": [ + ["const godot_object *", "p_object"] + ] + }, + { + "name": "godot_quat_new_with_basis", + "return_type": "void", + "arguments": [ + ["godot_quat *", "r_dest"], + ["const godot_basis *", "p_basis"] + ] + }, + { + "name": "godot_quat_new_with_euler", + "return_type": "void", + "arguments": [ + ["godot_quat *", "r_dest"], + ["const godot_vector3 *", "p_euler"] + ] + }, + { + "name": "godot_transform_new_with_quat", + "return_type": "void", + "arguments": [ + ["godot_transform *", "r_dest"], + ["const godot_quat *", "p_quat"] + ] + }, + { + "name": "godot_variant_get_operator_name", + "return_type": "godot_string", + "arguments": [ + ["godot_variant_operator", "p_op"] + ] + }, + { + "name": "godot_variant_evaluate", + "return_type": "void", + "arguments": [ + ["godot_variant_operator", "p_op"], + ["const godot_variant *", "p_a"], + ["const godot_variant *", "p_b"], + ["godot_variant *", "r_ret"], + ["godot_bool *", "r_valid"] + ] + } + ] + }, + "api": [ + { + "name": "godot_color_new_rgba", + "return_type": "void", + "arguments": [ + ["godot_color *", "r_dest"], + ["const godot_real", "p_r"], + ["const godot_real", "p_g"], + ["const godot_real", "p_b"], + ["const godot_real", "p_a"] + ] + }, + { + "name": "godot_color_new_rgb", + "return_type": "void", + "arguments": [ + ["godot_color *", "r_dest"], + ["const godot_real", "p_r"], + ["const godot_real", "p_g"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_color_get_r", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_set_r", + "return_type": "void", + "arguments": [ + ["godot_color *", "p_self"], + ["const godot_real", "r"] + ] + }, + { + "name": "godot_color_get_g", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_set_g", + "return_type": "void", + "arguments": [ + ["godot_color *", "p_self"], + ["const godot_real", "g"] + ] + }, + { + "name": "godot_color_get_b", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_set_b", + "return_type": "void", + "arguments": [ + ["godot_color *", "p_self"], + ["const godot_real", "b"] + ] + }, + { + "name": "godot_color_get_a", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_set_a", + "return_type": "void", + "arguments": [ + ["godot_color *", "p_self"], + ["const godot_real", "a"] + ] + }, + { + "name": "godot_color_get_h", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_get_s", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_get_v", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_to_rgba32", + "return_type": "godot_int", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_to_argb32", + "return_type": "godot_int", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_gray", + "return_type": "godot_real", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_inverted", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_contrasted", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"] + ] + }, + { + "name": "godot_color_linear_interpolate", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_color *", "p_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_color_blend", + "return_type": "godot_color", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_color *", "p_over"] + ] + }, + { + "name": "godot_color_to_html", + "return_type": "godot_string", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_bool", "p_with_alpha"] + ] + }, + { + "name": "godot_color_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_color *", "p_b"] + ] + }, + { + "name": "godot_color_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_color *", "p_self"], + ["const godot_color *", "p_b"] + ] + }, + { + "name": "godot_vector2_new", + "return_type": "void", + "arguments": [ + ["godot_vector2 *", "r_dest"], + ["const godot_real", "p_x"], + ["const godot_real", "p_y"] + ] + }, + { + "name": "godot_vector2_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_normalized", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_length", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_angle", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_length_squared", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_is_normalized", + "return_type": "godot_bool", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_distance_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_to"] + ] + }, + { + "name": "godot_vector2_distance_squared_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_to"] + ] + }, + { + "name": "godot_vector2_angle_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_to"] + ] + }, + { + "name": "godot_vector2_angle_to_point", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_to"] + ] + }, + { + "name": "godot_vector2_linear_interpolate", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_vector2_cubic_interpolate", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"], + ["const godot_vector2 *", "p_pre_a"], + ["const godot_vector2 *", "p_post_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_vector2_rotated", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_real", "p_phi"] + ] + }, + { + "name": "godot_vector2_tangent", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_floor", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_snapped", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_by"] + ] + }, + { + "name": "godot_vector2_aspect", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_dot", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_with"] + ] + }, + { + "name": "godot_vector2_slide", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_n"] + ] + }, + { + "name": "godot_vector2_bounce", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_n"] + ] + }, + { + "name": "godot_vector2_reflect", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_n"] + ] + }, + { + "name": "godot_vector2_abs", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_clamped", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_real", "p_length"] + ] + }, + { + "name": "godot_vector2_operator_add", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_subtract", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_multiply_vector", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_multiply_scalar", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_divide_vector", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_divide_scalar", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_vector2 *", "p_self"], + ["const godot_vector2 *", "p_b"] + ] + }, + { + "name": "godot_vector2_operator_neg", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_set_x", + "return_type": "void", + "arguments": [ + ["godot_vector2 *", "p_self"], + ["const godot_real", "p_x"] + ] + }, + { + "name": "godot_vector2_set_y", + "return_type": "void", + "arguments": [ + ["godot_vector2 *", "p_self"], + ["const godot_real", "p_y"] + ] + }, + { + "name": "godot_vector2_get_x", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_vector2_get_y", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector2 *", "p_self"] + ] + }, + { + "name": "godot_quat_new", + "return_type": "void", + "arguments": [ + ["godot_quat *", "r_dest"], + ["const godot_real", "p_x"], + ["const godot_real", "p_y"], + ["const godot_real", "p_z"], + ["const godot_real", "p_w"] + ] + }, + { + "name": "godot_quat_new_with_axis_angle", + "return_type": "void", + "arguments": [ + ["godot_quat *", "r_dest"], + ["const godot_vector3 *", "p_axis"], + ["const godot_real", "p_angle"] + ] + }, + { + "name": "godot_quat_get_x", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_set_x", + "return_type": "void", + "arguments": [ + ["godot_quat *", "p_self"], + ["const godot_real", "val"] + ] + }, + { + "name": "godot_quat_get_y", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_set_y", + "return_type": "void", + "arguments": [ + ["godot_quat *", "p_self"], + ["const godot_real", "val"] + ] + }, + { + "name": "godot_quat_get_z", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_set_z", + "return_type": "void", + "arguments": [ + ["godot_quat *", "p_self"], + ["const godot_real", "val"] + ] + }, + { + "name": "godot_quat_get_w", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_set_w", + "return_type": "void", + "arguments": [ + ["godot_quat *", "p_self"], + ["const godot_real", "val"] + ] + }, + { + "name": "godot_quat_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_length", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_length_squared", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_normalized", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_is_normalized", + "return_type": "godot_bool", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_inverse", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_quat_dot", + "return_type": "godot_real", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"] + ] + }, + { + "name": "godot_quat_xform", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_quat_slerp", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_quat_slerpni", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_quat_cubic_slerp", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"], + ["const godot_quat *", "p_pre_a"], + ["const godot_quat *", "p_post_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_quat_operator_multiply", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_quat_operator_add", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"] + ] + }, + { + "name": "godot_quat_operator_subtract", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"] + ] + }, + { + "name": "godot_quat_operator_divide", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_quat_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_quat *", "p_self"], + ["const godot_quat *", "p_b"] + ] + }, + { + "name": "godot_quat_operator_neg", + "return_type": "godot_quat", + "arguments": [ + ["const godot_quat *", "p_self"] + ] + }, + { + "name": "godot_basis_new_with_rows", + "return_type": "void", + "arguments": [ + ["godot_basis *", "r_dest"], + ["const godot_vector3 *", "p_x_axis"], + ["const godot_vector3 *", "p_y_axis"], + ["const godot_vector3 *", "p_z_axis"] + ] + }, + { + "name": "godot_basis_new_with_axis_and_angle", + "return_type": "void", + "arguments": [ + ["godot_basis *", "r_dest"], + ["const godot_vector3 *", "p_axis"], + ["const godot_real", "p_phi"] + ] + }, + { + "name": "godot_basis_new_with_euler", + "return_type": "void", + "arguments": [ + ["godot_basis *", "r_dest"], + ["const godot_vector3 *", "p_euler"] + ] + }, + { + "name": "godot_basis_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_inverse", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_transposed", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_orthonormalized", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_determinant", + "return_type": "godot_real", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_rotated", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_axis"], + ["const godot_real", "p_phi"] + ] + }, + { + "name": "godot_basis_scaled", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_scale"] + ] + }, + { + "name": "godot_basis_get_scale", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_get_euler", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_tdotx", + "return_type": "godot_real", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_with"] + ] + }, + { + "name": "godot_basis_tdoty", + "return_type": "godot_real", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_with"] + ] + }, + { + "name": "godot_basis_tdotz", + "return_type": "godot_real", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_with"] + ] + }, + { + "name": "godot_basis_xform", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_basis_xform_inv", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_basis_get_orthogonal_index", + "return_type": "godot_int", + "arguments": [ + ["const godot_basis *", "p_self"] + ] + }, + { + "name": "godot_basis_new", + "return_type": "void", + "arguments": [ + ["godot_basis *", "r_dest"] + ] + }, + { + "name": "godot_basis_new_with_euler_quat", + "return_type": "void", + "arguments": [ + ["godot_basis *", "r_dest"], + ["const godot_quat *", "p_euler"] + ] + }, + { + "name": "godot_basis_get_elements", + "return_type": "void", + "arguments": [ + ["const godot_basis *", "p_self"], + ["godot_vector3 *", "p_elements"] + ] + }, + { + "name": "godot_basis_get_axis", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_int", "p_axis"] + ] + }, + { + "name": "godot_basis_set_axis", + "return_type": "void", + "arguments": [ + ["godot_basis *", "p_self"], + ["const godot_int", "p_axis"], + ["const godot_vector3 *", "p_value"] + ] + }, + { + "name": "godot_basis_get_row", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_int", "p_row"] + ] + }, + { + "name": "godot_basis_set_row", + "return_type": "void", + "arguments": [ + ["godot_basis *", "p_self"], + ["const godot_int", "p_row"], + ["const godot_vector3 *", "p_value"] + ] + }, + { + "name": "godot_basis_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_basis *", "p_b"] + ] + }, + { + "name": "godot_basis_operator_add", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_basis *", "p_b"] + ] + }, + { + "name": "godot_basis_operator_subtract", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_basis *", "p_b"] + ] + }, + { + "name": "godot_basis_operator_multiply_vector", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_basis *", "p_b"] + ] + }, + { + "name": "godot_basis_operator_multiply_scalar", + "return_type": "godot_basis", + "arguments": [ + ["const godot_basis *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_vector3_new", + "return_type": "void", + "arguments": [ + ["godot_vector3 *", "r_dest"], + ["const godot_real", "p_x"], + ["const godot_real", "p_y"], + ["const godot_real", "p_z"] + ] + }, + { + "name": "godot_vector3_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_min_axis", + "return_type": "godot_int", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_max_axis", + "return_type": "godot_int", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_length", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_length_squared", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_is_normalized", + "return_type": "godot_bool", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_normalized", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_inverse", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_snapped", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_by"] + ] + }, + { + "name": "godot_vector3_rotated", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_axis"], + ["const godot_real", "p_phi"] + ] + }, + { + "name": "godot_vector3_linear_interpolate", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_vector3_cubic_interpolate", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"], + ["const godot_vector3 *", "p_pre_a"], + ["const godot_vector3 *", "p_post_b"], + ["const godot_real", "p_t"] + ] + }, + { + "name": "godot_vector3_dot", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_cross", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_outer", + "return_type": "godot_basis", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_to_diagonal_matrix", + "return_type": "godot_basis", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_abs", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_floor", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_ceil", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_distance_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_distance_squared_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_angle_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_to"] + ] + }, + { + "name": "godot_vector3_slide", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_n"] + ] + }, + { + "name": "godot_vector3_bounce", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_n"] + ] + }, + { + "name": "godot_vector3_reflect", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_n"] + ] + }, + { + "name": "godot_vector3_operator_add", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_subtract", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_multiply_vector", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_multiply_scalar", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_divide_vector", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_divide_scalar", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_real", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3 *", "p_b"] + ] + }, + { + "name": "godot_vector3_operator_neg", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_vector3 *", "p_self"] + ] + }, + { + "name": "godot_vector3_set_axis", + "return_type": "void", + "arguments": [ + ["godot_vector3 *", "p_self"], + ["const godot_vector3_axis", "p_axis"], + ["const godot_real", "p_val"] + ] + }, + { + "name": "godot_vector3_get_axis", + "return_type": "godot_real", + "arguments": [ + ["const godot_vector3 *", "p_self"], + ["const godot_vector3_axis", "p_axis"] + ] + }, + { + "name": "godot_pool_byte_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_byte_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "r_dest"], + ["const godot_pool_byte_array *", "p_src"] + ] + }, + { + "name": "godot_pool_byte_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_byte_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const uint8_t", "p_data"] + ] + }, + { + "name": "godot_pool_byte_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const godot_pool_byte_array *", "p_array"] + ] + }, + { + "name": "godot_pool_byte_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const uint8_t", "p_data"] + ] + }, + { + "name": "godot_pool_byte_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_byte_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const uint8_t", "p_data"] + ] + }, + { + "name": "godot_pool_byte_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_byte_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_byte_array_read", + "return_type": "godot_pool_byte_array_read_access *", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_byte_array_write", + "return_type": "godot_pool_byte_array_write_access *", + "arguments": [ + ["godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_byte_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const uint8_t", "p_data"] + ] + }, + { + "name": "godot_pool_byte_array_get", + "return_type": "uint8_t", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_byte_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_byte_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_int_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "r_dest"], + ["const godot_pool_int_array *", "p_src"] + ] + }, + { + "name": "godot_pool_int_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_int_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_data"] + ] + }, + { + "name": "godot_pool_int_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_pool_int_array *", "p_array"] + ] + }, + { + "name": "godot_pool_int_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_int", "p_data"] + ] + }, + { + "name": "godot_pool_int_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_data"] + ] + }, + { + "name": "godot_pool_int_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_int_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_int_array_read", + "return_type": "godot_pool_int_array_read_access *", + "arguments": [ + ["const godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_write", + "return_type": "godot_pool_int_array_write_access *", + "arguments": [ + ["godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_int", "p_data"] + ] + }, + { + "name": "godot_pool_int_array_get", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_int_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_int_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_real_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "r_dest"], + ["const godot_pool_real_array *", "p_src"] + ] + }, + { + "name": "godot_pool_real_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_real_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_real", "p_data"] + ] + }, + { + "name": "godot_pool_real_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_pool_real_array *", "p_array"] + ] + }, + { + "name": "godot_pool_real_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_real", "p_data"] + ] + }, + { + "name": "godot_pool_real_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_real", "p_data"] + ] + }, + { + "name": "godot_pool_real_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_real_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_real_array_read", + "return_type": "godot_pool_real_array_read_access *", + "arguments": [ + ["const godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_write", + "return_type": "godot_pool_real_array_write_access *", + "arguments": [ + ["godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_real", "p_data"] + ] + }, + { + "name": "godot_pool_real_array_get", + "return_type": "godot_real", + "arguments": [ + ["const godot_pool_real_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_real_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_string_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "r_dest"], + ["const godot_pool_string_array *", "p_src"] + ] + }, + { + "name": "godot_pool_string_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_string_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_string *", "p_data"] + ] + }, + { + "name": "godot_pool_string_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_pool_string_array *", "p_array"] + ] + }, + { + "name": "godot_pool_string_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_string *", "p_data"] + ] + }, + { + "name": "godot_pool_string_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_string *", "p_data"] + ] + }, + { + "name": "godot_pool_string_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_string_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_string_array_read", + "return_type": "godot_pool_string_array_read_access *", + "arguments": [ + ["const godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_write", + "return_type": "godot_pool_string_array_write_access *", + "arguments": [ + ["godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_string *", "p_data"] + ] + }, + { + "name": "godot_pool_string_array_get", + "return_type": "godot_string", + "arguments": [ + ["const godot_pool_string_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_string_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_vector2_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "r_dest"], + ["const godot_pool_vector2_array *", "p_src"] + ] + }, + { + "name": "godot_pool_vector2_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_vector2_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_vector2 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector2_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_pool_vector2_array *", "p_array"] + ] + }, + { + "name": "godot_pool_vector2_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_vector2 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector2_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_vector2 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector2_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_vector2_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_vector2_array_read", + "return_type": "godot_pool_vector2_array_read_access *", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_write", + "return_type": "godot_pool_vector2_array_write_access *", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_vector2 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector2_array_get", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_vector2_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_vector3_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "r_dest"], + ["const godot_pool_vector3_array *", "p_src"] + ] + }, + { + "name": "godot_pool_vector3_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_vector3_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_vector3 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector3_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_pool_vector3_array *", "p_array"] + ] + }, + { + "name": "godot_pool_vector3_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_vector3 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector3_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_vector3 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector3_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_vector3_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_vector3_array_read", + "return_type": "godot_pool_vector3_array_read_access *", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_write", + "return_type": "godot_pool_vector3_array_write_access *", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_vector3 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector3_array_get", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_vector3_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_new", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "r_dest"] + ] + }, + { + "name": "godot_pool_color_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "r_dest"], + ["const godot_pool_color_array *", "p_src"] + ] + }, + { + "name": "godot_pool_color_array_new_with_array", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "r_dest"], + ["const godot_array *", "p_a"] + ] + }, + { + "name": "godot_pool_color_array_append", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_color *", "p_data"] + ] + }, + { + "name": "godot_pool_color_array_append_array", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_pool_color_array *", "p_array"] + ] + }, + { + "name": "godot_pool_color_array_insert", + "return_type": "godot_error", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_color *", "p_data"] + ] + }, + { + "name": "godot_pool_color_array_invert", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_color *", "p_data"] + ] + }, + { + "name": "godot_pool_color_array_remove", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_color_array_resize", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_pool_color_array_read", + "return_type": "godot_pool_color_array_read_access *", + "arguments": [ + ["const godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_write", + "return_type": "godot_pool_color_array_write_access *", + "arguments": [ + ["godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_set", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_color *", "p_data"] + ] + }, + { + "name": "godot_pool_color_array_get", + "return_type": "godot_color", + "arguments": [ + ["const godot_pool_color_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_pool_color_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_pool_byte_array_read_access_copy", + "return_type": "godot_pool_byte_array_read_access *", + "arguments": [ + ["const godot_pool_byte_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_byte_array_read_access_ptr", + "return_type": "const uint8_t *", + "arguments": [ + ["const godot_pool_byte_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_byte_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_read_access *", "p_read"], + ["godot_pool_byte_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_byte_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_int_array_read_access_copy", + "return_type": "godot_pool_int_array_read_access *", + "arguments": [ + ["const godot_pool_int_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_int_array_read_access_ptr", + "return_type": "const godot_int *", + "arguments": [ + ["const godot_pool_int_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_int_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_read_access *", "p_read"], + ["godot_pool_int_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_int_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_real_array_read_access_copy", + "return_type": "godot_pool_real_array_read_access *", + "arguments": [ + ["const godot_pool_real_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_real_array_read_access_ptr", + "return_type": "const godot_real *", + "arguments": [ + ["const godot_pool_real_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_real_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_read_access *", "p_read"], + ["godot_pool_real_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_real_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_string_array_read_access_copy", + "return_type": "godot_pool_string_array_read_access *", + "arguments": [ + ["const godot_pool_string_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_string_array_read_access_ptr", + "return_type": "const godot_string *", + "arguments": [ + ["const godot_pool_string_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_string_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_read_access *", "p_read"], + ["godot_pool_string_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_string_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_copy", + "return_type": "godot_pool_vector2_array_read_access *", + "arguments": [ + ["const godot_pool_vector2_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_ptr", + "return_type": "const godot_vector2 *", + "arguments": [ + ["const godot_pool_vector2_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_read_access *", "p_read"], + ["godot_pool_vector2_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_copy", + "return_type": "godot_pool_vector3_array_read_access *", + "arguments": [ + ["const godot_pool_vector3_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_ptr", + "return_type": "const godot_vector3 *", + "arguments": [ + ["const godot_pool_vector3_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_read_access *", "p_read"], + ["godot_pool_vector3_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_color_array_read_access_copy", + "return_type": "godot_pool_color_array_read_access *", + "arguments": [ + ["const godot_pool_color_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_color_array_read_access_ptr", + "return_type": "const godot_color *", + "arguments": [ + ["const godot_pool_color_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_color_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_read_access *", "p_read"], + ["godot_pool_color_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_color_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_copy", + "return_type": "godot_pool_byte_array_write_access *", + "arguments": [ + ["const godot_pool_byte_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_ptr", + "return_type": "uint8_t *", + "arguments": [ + ["const godot_pool_byte_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_write_access *", "p_write"], + ["godot_pool_byte_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_int_array_write_access_copy", + "return_type": "godot_pool_int_array_write_access *", + "arguments": [ + ["const godot_pool_int_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_int_array_write_access_ptr", + "return_type": "godot_int *", + "arguments": [ + ["const godot_pool_int_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_int_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_write_access *", "p_write"], + ["godot_pool_int_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_int_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_real_array_write_access_copy", + "return_type": "godot_pool_real_array_write_access *", + "arguments": [ + ["const godot_pool_real_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_real_array_write_access_ptr", + "return_type": "godot_real *", + "arguments": [ + ["const godot_pool_real_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_real_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_write_access *", "p_write"], + ["godot_pool_real_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_real_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_string_array_write_access_copy", + "return_type": "godot_pool_string_array_write_access *", + "arguments": [ + ["const godot_pool_string_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_string_array_write_access_ptr", + "return_type": "godot_string *", + "arguments": [ + ["const godot_pool_string_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_string_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_write_access *", "p_write"], + ["godot_pool_string_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_string_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_copy", + "return_type": "godot_pool_vector2_array_write_access *", + "arguments": [ + ["const godot_pool_vector2_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_ptr", + "return_type": "godot_vector2 *", + "arguments": [ + ["const godot_pool_vector2_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_write_access *", "p_write"], + ["godot_pool_vector2_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_copy", + "return_type": "godot_pool_vector3_array_write_access *", + "arguments": [ + ["const godot_pool_vector3_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_ptr", + "return_type": "godot_vector3 *", + "arguments": [ + ["const godot_pool_vector3_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_write_access *", "p_write"], + ["godot_pool_vector3_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_color_array_write_access_copy", + "return_type": "godot_pool_color_array_write_access *", + "arguments": [ + ["const godot_pool_color_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_color_array_write_access_ptr", + "return_type": "godot_color *", + "arguments": [ + ["const godot_pool_color_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_color_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_write_access *", "p_write"], + ["godot_pool_color_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_color_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_array_new", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"] + ] + }, + { + "name": "godot_array_new_copy", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_array *", "p_src"] + ] + }, + { + "name": "godot_array_new_pool_color_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_color_array *", "p_pca"] + ] + }, + { + "name": "godot_array_new_pool_vector3_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_vector3_array *", "p_pv3a"] + ] + }, + { + "name": "godot_array_new_pool_vector2_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_vector2_array *", "p_pv2a"] + ] + }, + { + "name": "godot_array_new_pool_string_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_string_array *", "p_psa"] + ] + }, + { + "name": "godot_array_new_pool_real_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_real_array *", "p_pra"] + ] + }, + { + "name": "godot_array_new_pool_int_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_int_array *", "p_pia"] + ] + }, + { + "name": "godot_array_new_pool_byte_array", + "return_type": "void", + "arguments": [ + ["godot_array *", "r_dest"], + ["const godot_pool_byte_array *", "p_pba"] + ] + }, + { + "name": "godot_array_set", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_int", "p_idx"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_get", + "return_type": "godot_variant", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_array_operator_index", + "return_type": "godot_variant *", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_array_operator_index_const", + "return_type": "const godot_variant *", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_array_append", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_clear", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_count", + "return_type": "godot_int", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_erase", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_front", + "return_type": "godot_variant", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_back", + "return_type": "godot_variant", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_find", + "return_type": "godot_int", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_variant *", "p_what"], + ["const godot_int", "p_from"] + ] + }, + { + "name": "godot_array_find_last", + "return_type": "godot_int", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_variant *", "p_what"] + ] + }, + { + "name": "godot_array_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_hash", + "return_type": "godot_int", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_insert", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_int", "p_pos"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_invert", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_pop_back", + "return_type": "godot_variant", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_pop_front", + "return_type": "godot_variant", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_push_back", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_push_front", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_array_remove", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_array_resize", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_int", "p_size"] + ] + }, + { + "name": "godot_array_rfind", + "return_type": "godot_int", + "arguments": [ + ["const godot_array *", "p_self"], + ["const godot_variant *", "p_what"], + ["const godot_int", "p_from"] + ] + }, + { + "name": "godot_array_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_sort", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_array_sort_custom", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"], + ["godot_object *", "p_obj"], + ["const godot_string *", "p_func"] + ] + }, + { + "name": "godot_array_bsearch", + "return_type": "godot_int", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_variant *", "p_value"], + ["const godot_bool", "p_before"] + ] + }, + { + "name": "godot_array_bsearch_custom", + "return_type": "godot_int", + "arguments": [ + ["godot_array *", "p_self"], + ["const godot_variant *", "p_value"], + ["godot_object *", "p_obj"], + ["const godot_string *", "p_func"], + ["const godot_bool", "p_before"] + ] + }, + { + "name": "godot_array_destroy", + "return_type": "void", + "arguments": [ + ["godot_array *", "p_self"] + ] + }, + { + "name": "godot_dictionary_new", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "r_dest"] + ] + }, + { + "name": "godot_dictionary_new_copy", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "r_dest"], + ["const godot_dictionary *", "p_src"] + ] + }, + { + "name": "godot_dictionary_destroy", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_size", + "return_type": "godot_int", + "arguments": [ + ["const godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_clear", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_has", + "return_type": "godot_bool", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_dictionary_has_all", + "return_type": "godot_bool", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_array *", "p_keys"] + ] + }, + { + "name": "godot_dictionary_erase", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_dictionary_hash", + "return_type": "godot_int", + "arguments": [ + ["const godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_keys", + "return_type": "godot_array", + "arguments": [ + ["const godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_values", + "return_type": "godot_array", + "arguments": [ + ["const godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_dictionary_get", + "return_type": "godot_variant", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_dictionary_set", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"], + ["const godot_variant *", "p_value"] + ] + }, + { + "name": "godot_dictionary_operator_index", + "return_type": "godot_variant *", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_dictionary_operator_index_const", + "return_type": "const godot_variant *", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_dictionary_next", + "return_type": "godot_variant *", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_variant *", "p_key"] + ] + }, + { + "name": "godot_dictionary_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_dictionary *", "p_b"] + ] + }, + { + "name": "godot_dictionary_to_json", + "return_type": "godot_string", + "arguments": [ + ["const godot_dictionary *", "p_self"] + ] + }, + { + "name": "godot_node_path_new", + "return_type": "void", + "arguments": [ + ["godot_node_path *", "r_dest"], + ["const godot_string *", "p_from"] + ] + }, + { + "name": "godot_node_path_new_copy", + "return_type": "void", + "arguments": [ + ["godot_node_path *", "r_dest"], + ["const godot_node_path *", "p_src"] + ] + }, + { + "name": "godot_node_path_destroy", + "return_type": "void", + "arguments": [ + ["godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_is_absolute", + "return_type": "godot_bool", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_get_name_count", + "return_type": "godot_int", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_get_name", + "return_type": "godot_string", + "arguments": [ + ["const godot_node_path *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_node_path_get_subname_count", + "return_type": "godot_int", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_get_subname", + "return_type": "godot_string", + "arguments": [ + ["const godot_node_path *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_node_path_get_concatenated_subnames", + "return_type": "godot_string", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_is_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_node_path *", "p_self"] + ] + }, + { + "name": "godot_node_path_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_node_path *", "p_self"], + ["const godot_node_path *", "p_b"] + ] + }, + { + "name": "godot_plane_new_with_reals", + "return_type": "void", + "arguments": [ + ["godot_plane *", "r_dest"], + ["const godot_real", "p_a"], + ["const godot_real", "p_b"], + ["const godot_real", "p_c"], + ["const godot_real", "p_d"] + ] + }, + { + "name": "godot_plane_new_with_vectors", + "return_type": "void", + "arguments": [ + ["godot_plane *", "r_dest"], + ["const godot_vector3 *", "p_v1"], + ["const godot_vector3 *", "p_v2"], + ["const godot_vector3 *", "p_v3"] + ] + }, + { + "name": "godot_plane_new_with_normal", + "return_type": "void", + "arguments": [ + ["godot_plane *", "r_dest"], + ["const godot_vector3 *", "p_normal"], + ["const godot_real", "p_d"] + ] + }, + { + "name": "godot_plane_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_normalized", + "return_type": "godot_plane", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_center", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_get_any_point", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_is_point_over", + "return_type": "godot_bool", + "arguments": [ + ["const godot_plane *", "p_self"], + ["const godot_vector3 *", "p_point"] + ] + }, + { + "name": "godot_plane_distance_to", + "return_type": "godot_real", + "arguments": [ + ["const godot_plane *", "p_self"], + ["const godot_vector3 *", "p_point"] + ] + }, + { + "name": "godot_plane_has_point", + "return_type": "godot_bool", + "arguments": [ + ["const godot_plane *", "p_self"], + ["const godot_vector3 *", "p_point"], + ["const godot_real", "p_epsilon"] + ] + }, + { + "name": "godot_plane_project", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_plane *", "p_self"], + ["const godot_vector3 *", "p_point"] + ] + }, + { + "name": "godot_plane_intersect_3", + "return_type": "godot_bool", + "arguments": [ + ["const godot_plane *", "p_self"], + ["godot_vector3 *", "r_dest"], + ["const godot_plane *", "p_b"], + ["const godot_plane *", "p_c"] + ] + }, + { + "name": "godot_plane_intersects_ray", + "return_type": "godot_bool", + "arguments": [ + ["const godot_plane *", "p_self"], + ["godot_vector3 *", "r_dest"], + ["const godot_vector3 *", "p_from"], + ["const godot_vector3 *", "p_dir"] + ] + }, + { + "name": "godot_plane_intersects_segment", + "return_type": "godot_bool", + "arguments": [ + ["const godot_plane *", "p_self"], + ["godot_vector3 *", "r_dest"], + ["const godot_vector3 *", "p_begin"], + ["const godot_vector3 *", "p_end"] + ] + }, + { + "name": "godot_plane_operator_neg", + "return_type": "godot_plane", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_plane *", "p_self"], + ["const godot_plane *", "p_b"] + ] + }, + { + "name": "godot_plane_set_normal", + "return_type": "void", + "arguments": [ + ["godot_plane *", "p_self"], + ["const godot_vector3 *", "p_normal"] + ] + }, + { + "name": "godot_plane_get_normal", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_get_d", + "return_type": "godot_real", + "arguments": [ + ["const godot_plane *", "p_self"] + ] + }, + { + "name": "godot_plane_set_d", + "return_type": "void", + "arguments": [ + ["godot_plane *", "p_self"], + ["const godot_real", "p_d"] + ] + }, + { + "name": "godot_rect2_new_with_position_and_size", + "return_type": "void", + "arguments": [ + ["godot_rect2 *", "r_dest"], + ["const godot_vector2 *", "p_pos"], + ["const godot_vector2 *", "p_size"] + ] + }, + { + "name": "godot_rect2_new", + "return_type": "void", + "arguments": [ + ["godot_rect2 *", "r_dest"], + ["const godot_real", "p_x"], + ["const godot_real", "p_y"], + ["const godot_real", "p_width"], + ["const godot_real", "p_height"] + ] + }, + { + "name": "godot_rect2_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_rect2 *", "p_self"] + ] + }, + { + "name": "godot_rect2_get_area", + "return_type": "godot_real", + "arguments": [ + ["const godot_rect2 *", "p_self"] + ] + }, + { + "name": "godot_rect2_intersects", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_rect2 *", "p_b"] + ] + }, + { + "name": "godot_rect2_encloses", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_rect2 *", "p_b"] + ] + }, + { + "name": "godot_rect2_has_no_area", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rect2 *", "p_self"] + ] + }, + { + "name": "godot_rect2_clip", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_rect2 *", "p_b"] + ] + }, + { + "name": "godot_rect2_merge", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_rect2 *", "p_b"] + ] + }, + { + "name": "godot_rect2_has_point", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_vector2 *", "p_point"] + ] + }, + { + "name": "godot_rect2_grow", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_real", "p_by"] + ] + }, + { + "name": "godot_rect2_expand", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_vector2 *", "p_to"] + ] + }, + { + "name": "godot_rect2_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rect2 *", "p_self"], + ["const godot_rect2 *", "p_b"] + ] + }, + { + "name": "godot_rect2_get_position", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_rect2 *", "p_self"] + ] + }, + { + "name": "godot_rect2_get_size", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_rect2 *", "p_self"] + ] + }, + { + "name": "godot_rect2_set_position", + "return_type": "void", + "arguments": [ + ["godot_rect2 *", "p_self"], + ["const godot_vector2 *", "p_pos"] + ] + }, + { + "name": "godot_rect2_set_size", + "return_type": "void", + "arguments": [ + ["godot_rect2 *", "p_self"], + ["const godot_vector2 *", "p_size"] + ] + }, + { + "name": "godot_aabb_new", + "return_type": "void", + "arguments": [ + ["godot_aabb *", "r_dest"], + ["const godot_vector3 *", "p_pos"], + ["const godot_vector3 *", "p_size"] + ] + }, + { + "name": "godot_aabb_get_position", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_set_position", + "return_type": "void", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_aabb_get_size", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_set_size", + "return_type": "void", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_aabb_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_get_area", + "return_type": "godot_real", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_has_no_area", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_has_no_surface", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_intersects", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] + ] + }, + { + "name": "godot_aabb_encloses", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] + ] + }, + { + "name": "godot_aabb_merge", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] + ] + }, + { + "name": "godot_aabb_intersection", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] + ] + }, + { + "name": "godot_aabb_intersects_plane", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_plane *", "p_plane"] + ] + }, + { + "name": "godot_aabb_intersects_segment", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_vector3 *", "p_from"], + ["const godot_vector3 *", "p_to"] + ] + }, + { + "name": "godot_aabb_has_point", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_vector3 *", "p_point"] + ] + }, + { + "name": "godot_aabb_get_support", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_vector3 *", "p_dir"] + ] + }, + { + "name": "godot_aabb_get_longest_axis", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_get_longest_axis_index", + "return_type": "godot_int", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_get_longest_axis_size", + "return_type": "godot_real", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_get_shortest_axis", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_get_shortest_axis_index", + "return_type": "godot_int", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_get_shortest_axis_size", + "return_type": "godot_real", + "arguments": [ + ["const godot_aabb *", "p_self"] + ] + }, + { + "name": "godot_aabb_expand", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_vector3 *", "p_to_point"] + ] + }, + { + "name": "godot_aabb_grow", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_real", "p_by"] + ] + }, + { + "name": "godot_aabb_get_endpoint", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_aabb_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_b"] + ] + }, + { + "name": "godot_rid_new", + "return_type": "void", + "arguments": [ + ["godot_rid *", "r_dest"] + ] + }, + { + "name": "godot_rid_get_id", + "return_type": "godot_int", + "arguments": [ + ["const godot_rid *", "p_self"] + ] + }, + { + "name": "godot_rid_new_with_resource", + "return_type": "void", + "arguments": [ + ["godot_rid *", "r_dest"], + ["const godot_object *", "p_from"] + ] + }, + { + "name": "godot_rid_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rid *", "p_self"], + ["const godot_rid *", "p_b"] + ] + }, + { + "name": "godot_rid_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_rid *", "p_self"], + ["const godot_rid *", "p_b"] + ] + }, + { + "name": "godot_transform_new_with_axis_origin", + "return_type": "void", + "arguments": [ + ["godot_transform *", "r_dest"], + ["const godot_vector3 *", "p_x_axis"], + ["const godot_vector3 *", "p_y_axis"], + ["const godot_vector3 *", "p_z_axis"], + ["const godot_vector3 *", "p_origin"] + ] + }, + { + "name": "godot_transform_new", + "return_type": "void", + "arguments": [ + ["godot_transform *", "r_dest"], + ["const godot_basis *", "p_basis"], + ["const godot_vector3 *", "p_origin"] + ] + }, + { + "name": "godot_transform_get_basis", + "return_type": "godot_basis", + "arguments": [ + ["const godot_transform *", "p_self"] + ] + }, + { + "name": "godot_transform_set_basis", + "return_type": "void", + "arguments": [ + ["godot_transform *", "p_self"], + ["const godot_basis *", "p_v"] + ] + }, + { + "name": "godot_transform_get_origin", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_transform *", "p_self"] + ] + }, + { + "name": "godot_transform_set_origin", + "return_type": "void", + "arguments": [ + ["godot_transform *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_transform_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_transform *", "p_self"] + ] + }, + { + "name": "godot_transform_inverse", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"] + ] + }, + { + "name": "godot_transform_affine_inverse", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"] + ] + }, + { + "name": "godot_transform_orthonormalized", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"] + ] + }, + { + "name": "godot_transform_rotated", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_vector3 *", "p_axis"], + ["const godot_real", "p_phi"] + ] + }, + { + "name": "godot_transform_scaled", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_vector3 *", "p_scale"] + ] + }, + { + "name": "godot_transform_translated", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_vector3 *", "p_ofs"] + ] + }, + { + "name": "godot_transform_looking_at", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_vector3 *", "p_target"], + ["const godot_vector3 *", "p_up"] + ] + }, + { + "name": "godot_transform_xform_plane", + "return_type": "godot_plane", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_plane *", "p_v"] + ] + }, + { + "name": "godot_transform_xform_inv_plane", + "return_type": "godot_plane", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_plane *", "p_v"] + ] + }, + { + "name": "godot_transform_new_identity", + "return_type": "void", + "arguments": [ + ["godot_transform *", "r_dest"] + ] + }, + { + "name": "godot_transform_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_transform *", "p_b"] + ] + }, + { + "name": "godot_transform_operator_multiply", + "return_type": "godot_transform", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_transform *", "p_b"] + ] + }, + { + "name": "godot_transform_xform_vector3", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_transform_xform_inv_vector3", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_vector3 *", "p_v"] + ] + }, + { + "name": "godot_transform_xform_aabb", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_aabb *", "p_v"] + ] + }, + { + "name": "godot_transform_xform_inv_aabb", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_transform *", "p_self"], + ["const godot_aabb *", "p_v"] + ] + }, + { + "name": "godot_transform2d_new", + "return_type": "void", + "arguments": [ + ["godot_transform2d *", "r_dest"], + ["const godot_real", "p_rot"], + ["const godot_vector2 *", "p_pos"] + ] + }, + { + "name": "godot_transform2d_new_axis_origin", + "return_type": "void", + "arguments": [ + ["godot_transform2d *", "r_dest"], + ["const godot_vector2 *", "p_x_axis"], + ["const godot_vector2 *", "p_y_axis"], + ["const godot_vector2 *", "p_origin"] + ] + }, + { + "name": "godot_transform2d_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_inverse", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_affine_inverse", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_get_rotation", + "return_type": "godot_real", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_get_origin", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_get_scale", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_determinant", + "return_type": "godot_real", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_orthonormalized", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"] + ] + }, + { + "name": "godot_transform2d_rotated", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_real", "p_phi"] + ] + }, + { + "name": "godot_transform2d_scaled", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_vector2 *", "p_scale"] + ] + }, + { + "name": "godot_transform2d_translated", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_vector2 *", "p_offset"] + ] + }, + { + "name": "godot_transform2d_xform_vector2", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_vector2 *", "p_v"] + ] + }, + { + "name": "godot_transform2d_xform_inv_vector2", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_vector2 *", "p_v"] + ] + }, + { + "name": "godot_transform2d_basis_xform_vector2", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_vector2 *", "p_v"] + ] + }, + { + "name": "godot_transform2d_basis_xform_inv_vector2", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_vector2 *", "p_v"] + ] + }, + { + "name": "godot_transform2d_interpolate_with", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_transform2d *", "p_m"], + ["const godot_real", "p_c"] + ] + }, + { + "name": "godot_transform2d_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_transform2d *", "p_b"] + ] + }, + { + "name": "godot_transform2d_operator_multiply", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_transform2d *", "p_b"] + ] + }, + { + "name": "godot_transform2d_new_identity", + "return_type": "void", + "arguments": [ + ["godot_transform2d *", "r_dest"] + ] + }, + { + "name": "godot_transform2d_xform_rect2", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_rect2 *", "p_v"] + ] + }, + { + "name": "godot_transform2d_xform_inv_rect2", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_transform2d *", "p_self"], + ["const godot_rect2 *", "p_v"] + ] + }, + { + "name": "godot_variant_get_type", + "return_type": "godot_variant_type", + "arguments": [ + ["const godot_variant *", "p_v"] + ] + }, + { + "name": "godot_variant_new_copy", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_variant *", "p_src"] + ] + }, + { + "name": "godot_variant_new_nil", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"] + ] + }, + { + "name": "godot_variant_new_bool", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_bool", "p_b"] + ] + }, + { + "name": "godot_variant_new_uint", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const uint64_t", "p_i"] + ] + }, + { + "name": "godot_variant_new_int", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const int64_t", "p_i"] + ] + }, + { + "name": "godot_variant_new_real", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const double", "p_r"] + ] + }, + { + "name": "godot_variant_new_string", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_string *", "p_s"] + ] + }, + { + "name": "godot_variant_new_vector2", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_vector2 *", "p_v2"] + ] + }, + { + "name": "godot_variant_new_rect2", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_rect2 *", "p_rect2"] + ] + }, + { + "name": "godot_variant_new_vector3", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_vector3 *", "p_v3"] + ] + }, + { + "name": "godot_variant_new_transform2d", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_transform2d *", "p_t2d"] + ] + }, + { + "name": "godot_variant_new_plane", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_plane *", "p_plane"] + ] + }, + { + "name": "godot_variant_new_quat", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_quat *", "p_quat"] + ] + }, + { + "name": "godot_variant_new_aabb", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_aabb *", "p_aabb"] + ] + }, + { + "name": "godot_variant_new_basis", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_basis *", "p_basis"] + ] + }, + { + "name": "godot_variant_new_transform", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_transform *", "p_trans"] + ] + }, + { + "name": "godot_variant_new_color", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_color *", "p_color"] + ] + }, + { + "name": "godot_variant_new_node_path", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_node_path *", "p_np"] + ] + }, + { + "name": "godot_variant_new_rid", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_rid *", "p_rid"] + ] + }, + { + "name": "godot_variant_new_object", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_object *", "p_obj"] + ] + }, + { + "name": "godot_variant_new_dictionary", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_dictionary *", "p_dict"] + ] + }, + { + "name": "godot_variant_new_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_array *", "p_arr"] + ] + }, + { + "name": "godot_variant_new_pool_byte_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_byte_array *", "p_pba"] + ] + }, + { + "name": "godot_variant_new_pool_int_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_int_array *", "p_pia"] + ] + }, + { + "name": "godot_variant_new_pool_real_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_real_array *", "p_pra"] + ] + }, + { + "name": "godot_variant_new_pool_string_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_string_array *", "p_psa"] + ] + }, + { + "name": "godot_variant_new_pool_vector2_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_vector2_array *", "p_pv2a"] + ] + }, + { + "name": "godot_variant_new_pool_vector3_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_vector3_array *", "p_pv3a"] + ] + }, + { + "name": "godot_variant_new_pool_color_array", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_pool_color_array *", "p_pca"] + ] + }, + { + "name": "godot_variant_as_bool", + "return_type": "godot_bool", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_uint", + "return_type": "uint64_t", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_int", + "return_type": "int64_t", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_real", + "return_type": "double", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_string", + "return_type": "godot_string", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_vector2", + "return_type": "godot_vector2", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_rect2", + "return_type": "godot_rect2", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_vector3", + "return_type": "godot_vector3", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_transform2d", + "return_type": "godot_transform2d", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_plane", + "return_type": "godot_plane", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_quat", + "return_type": "godot_quat", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_aabb", + "return_type": "godot_aabb", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_basis", + "return_type": "godot_basis", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_transform", + "return_type": "godot_transform", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_color", + "return_type": "godot_color", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_node_path", + "return_type": "godot_node_path", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_rid", + "return_type": "godot_rid", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_object", + "return_type": "godot_object *", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_dictionary", + "return_type": "godot_dictionary", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_array", + "return_type": "godot_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_byte_array", + "return_type": "godot_pool_byte_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_int_array", + "return_type": "godot_pool_int_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_real_array", + "return_type": "godot_pool_real_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_string_array", + "return_type": "godot_pool_string_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_vector2_array", + "return_type": "godot_pool_vector2_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_vector3_array", + "return_type": "godot_pool_vector3_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_as_pool_color_array", + "return_type": "godot_pool_color_array", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_call", + "return_type": "godot_variant", + "arguments": [ + ["godot_variant *", "p_self"], + ["const godot_string *", "p_method"], + ["const godot_variant **", "p_args"], + ["const godot_int", "p_argcount"], + ["godot_variant_call_error *", "r_error"] + ] + }, + { + "name": "godot_variant_has_method", + "return_type": "godot_bool", + "arguments": [ + ["const godot_variant *", "p_self"], + ["const godot_string *", "p_method"] + ] + }, + { + "name": "godot_variant_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_variant *", "p_self"], + ["const godot_variant *", "p_other"] + ] + }, + { + "name": "godot_variant_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_variant *", "p_self"], + ["const godot_variant *", "p_other"] + ] + }, + { + "name": "godot_variant_hash_compare", + "return_type": "godot_bool", + "arguments": [ + ["const godot_variant *", "p_self"], + ["const godot_variant *", "p_other"] + ] + }, + { + "name": "godot_variant_booleanize", + "return_type": "godot_bool", + "arguments": [ + ["const godot_variant *", "p_self"] + ] + }, + { + "name": "godot_variant_destroy", + "return_type": "void", + "arguments": [ + ["godot_variant *", "p_self"] + ] + }, + { + "name": "godot_char_string_length", + "return_type": "godot_int", + "arguments": [ + ["const godot_char_string *", "p_cs"] + ] + }, + { + "name": "godot_char_string_get_data", + "return_type": "const char *", + "arguments": [ + ["const godot_char_string *", "p_cs"] + ] + }, + { + "name": "godot_char_string_destroy", + "return_type": "void", + "arguments": [ + ["godot_char_string *", "p_cs"] + ] + }, + { + "name": "godot_string_new", + "return_type": "void", + "arguments": [ + ["godot_string *", "r_dest"] + ] + }, + { + "name": "godot_string_new_copy", + "return_type": "void", + "arguments": [ + ["godot_string *", "r_dest"], + ["const godot_string *", "p_src"] + ] + }, + { + "name": "godot_string_new_with_wide_string", + "return_type": "void", + "arguments": [ + ["godot_string *", "r_dest"], + ["const wchar_t *", "p_contents"], + ["const int", "p_size"] + ] + }, + { + "name": "godot_string_operator_index", + "return_type": "const wchar_t *", + "arguments": [ + ["godot_string *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_string_operator_index_const", + "return_type": "wchar_t", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_int", "p_idx"] + ] + }, + { + "name": "godot_string_wide_str", + "return_type": "const wchar_t *", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_b"] + ] + }, + { + "name": "godot_string_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_b"] + ] + }, + { + "name": "godot_string_operator_plus", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_b"] + ] + }, + { + "name": "godot_string_length", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_casecmp_to", + "return_type": "signed char", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_str"] + ] + }, + { + "name": "godot_string_nocasecmp_to", + "return_type": "signed char", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_str"] + ] + }, + { + "name": "godot_string_naturalnocasecmp_to", + "return_type": "signed char", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_str"] + ] + }, + { + "name": "godot_string_begins_with", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_string"] + ] + }, + { + "name": "godot_string_begins_with_char_array", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const char *", "p_char_array"] + ] + }, + { + "name": "godot_string_bigrams", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_chr", + "return_type": "godot_string", + "arguments": [ + ["wchar_t", "p_character"] + ] + }, + { + "name": "godot_string_ends_with", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_string"] + ] + }, + { + "name": "godot_string_find", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"] + ] + }, + { + "name": "godot_string_find_from", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"], + ["godot_int", "p_from"] + ] + }, + { + "name": "godot_string_findmk", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_keys"] + ] + }, + { + "name": "godot_string_findmk_from", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_keys"], + ["godot_int", "p_from"] + ] + }, + { + "name": "godot_string_findmk_from_in_place", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_keys"], + ["godot_int", "p_from"], + ["godot_int *", "r_key"] + ] + }, + { + "name": "godot_string_findn", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"] + ] + }, + { + "name": "godot_string_findn_from", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"], + ["godot_int", "p_from"] + ] + }, + { + "name": "godot_string_find_last", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"] + ] + }, + { + "name": "godot_string_format", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_variant *", "p_values"] + ] + }, + { + "name": "godot_string_format_with_custom_placeholder", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_variant *", "p_values"], + ["const char *", "p_placeholder"] + ] + }, + { + "name": "godot_string_hex_encode_buffer", + "return_type": "godot_string", + "arguments": [ + ["const uint8_t *", "p_buffer"], + ["godot_int", "p_len"] + ] + }, + { + "name": "godot_string_hex_to_int", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_hex_to_int_without_prefix", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_insert", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_at_pos"], + ["godot_string", "p_string"] + ] + }, + { + "name": "godot_string_is_numeric", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_subsequence_of", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_string"] + ] + }, + { + "name": "godot_string_is_subsequence_ofi", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_string"] + ] + }, + { + "name": "godot_string_lpad", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_min_length"] + ] + }, + { + "name": "godot_string_lpad_with_custom_character", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_min_length"], + ["const godot_string *", "p_character"] + ] + }, + { + "name": "godot_string_match", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_wildcard"] + ] + }, + { + "name": "godot_string_matchn", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_wildcard"] + ] + }, + { + "name": "godot_string_md5", + "return_type": "godot_string", + "arguments": [ + ["const uint8_t *", "p_md5"] + ] + }, + { + "name": "godot_string_num", + "return_type": "godot_string", + "arguments": [ + ["double", "p_num"] + ] + }, + { + "name": "godot_string_num_int64", + "return_type": "godot_string", + "arguments": [ + ["int64_t", "p_num"], + ["godot_int", "p_base"] + ] + }, + { + "name": "godot_string_num_int64_capitalized", + "return_type": "godot_string", + "arguments": [ + ["int64_t", "p_num"], + ["godot_int", "p_base"], + ["godot_bool", "p_capitalize_hex"] + ] + }, + { + "name": "godot_string_num_real", + "return_type": "godot_string", + "arguments": [ + ["double", "p_num"] + ] + }, + { + "name": "godot_string_num_scientific", + "return_type": "godot_string", + "arguments": [ + ["double", "p_num"] + ] + }, + { + "name": "godot_string_num_with_decimals", + "return_type": "godot_string", + "arguments": [ + ["double", "p_num"], + ["godot_int", "p_decimals"] + ] + }, + { + "name": "godot_string_pad_decimals", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_digits"] + ] + }, + { + "name": "godot_string_pad_zeros", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_digits"] + ] + }, + { + "name": "godot_string_replace_first", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_key"], + ["godot_string", "p_with"] + ] + }, + { + "name": "godot_string_replace", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_key"], + ["godot_string", "p_with"] + ] + }, + { + "name": "godot_string_replacen", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_key"], + ["godot_string", "p_with"] + ] + }, + { + "name": "godot_string_rfind", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"] + ] + }, + { + "name": "godot_string_rfindn", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"] + ] + }, + { + "name": "godot_string_rfind_from", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"], + ["godot_int", "p_from"] + ] + }, + { + "name": "godot_string_rfindn_from", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_what"], + ["godot_int", "p_from"] + ] + }, + { + "name": "godot_string_rpad", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_min_length"] + ] + }, + { + "name": "godot_string_rpad_with_custom_character", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_min_length"], + ["const godot_string *", "p_character"] + ] + }, + { + "name": "godot_string_similarity", + "return_type": "godot_real", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_string"] + ] + }, + { + "name": "godot_string_sprintf", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_values"], + ["godot_bool *", "p_error"] + ] + }, + { + "name": "godot_string_substr", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_from"], + ["godot_int", "p_chars"] + ] + }, + { + "name": "godot_string_to_double", + "return_type": "double", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_to_float", + "return_type": "godot_real", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_to_int", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_camelcase_to_underscore", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_camelcase_to_underscore_lowercased", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_capitalize", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_char_to_double", + "return_type": "double", + "arguments": [ + ["const char *", "p_what"] + ] + }, + { + "name": "godot_string_char_to_int", + "return_type": "godot_int", + "arguments": [ + ["const char *", "p_what"] + ] + }, + { + "name": "godot_string_wchar_to_int", + "return_type": "int64_t", + "arguments": [ + ["const wchar_t *", "p_str"] + ] + }, + { + "name": "godot_string_char_to_int_with_len", + "return_type": "godot_int", + "arguments": [ + ["const char *", "p_what"], + ["godot_int", "p_len"] + ] + }, + { + "name": "godot_string_char_to_int64_with_len", + "return_type": "int64_t", + "arguments": [ + ["const wchar_t *", "p_str"], + ["int", "p_len"] + ] + }, + { + "name": "godot_string_hex_to_int64", + "return_type": "int64_t", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_hex_to_int64_with_prefix", + "return_type": "int64_t", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_to_int64", + "return_type": "int64_t", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_unicode_char_to_double", + "return_type": "double", + "arguments": [ + ["const wchar_t *", "p_str"], + ["const wchar_t **", "r_end"] + ] + }, + { + "name": "godot_string_get_slice_count", + "return_type": "godot_int", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_splitter"] + ] + }, + { + "name": "godot_string_get_slice", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_string", "p_splitter"], + ["godot_int", "p_slice"] + ] + }, + { + "name": "godot_string_get_slicec", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["wchar_t", "p_splitter"], + ["godot_int", "p_slice"] + ] + }, + { + "name": "godot_string_split", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_splitter"] + ] + }, + { + "name": "godot_string_split_allow_empty", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_splitter"] + ] + }, + { + "name": "godot_string_split_floats", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_splitter"] + ] + }, + { + "name": "godot_string_split_floats_allows_empty", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_splitter"] + ] + }, + { + "name": "godot_string_split_floats_mk", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_splitters"] + ] + }, + { + "name": "godot_string_split_floats_mk_allows_empty", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_splitters"] + ] + }, + { + "name": "godot_string_split_ints", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_splitter"] + ] + }, + { + "name": "godot_string_split_ints_allows_empty", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_splitter"] + ] + }, + { + "name": "godot_string_split_ints_mk", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_splitters"] + ] + }, + { + "name": "godot_string_split_ints_mk_allows_empty", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_array *", "p_splitters"] + ] + }, + { + "name": "godot_string_split_spaces", + "return_type": "godot_array", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_char_lowercase", + "return_type": "wchar_t", + "arguments": [ + ["wchar_t", "p_char"] + ] + }, + { + "name": "godot_string_char_uppercase", + "return_type": "wchar_t", + "arguments": [ + ["wchar_t", "p_char"] + ] + }, + { + "name": "godot_string_to_lower", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_to_upper", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_get_basename", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_get_extension", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_left", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_pos"] + ] + }, + { + "name": "godot_string_ord_at", + "return_type": "wchar_t", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_idx"] + ] + }, + { + "name": "godot_string_plus_file", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_file"] + ] + }, + { + "name": "godot_string_right", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_pos"] + ] + }, + { + "name": "godot_string_strip_edges", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_bool", "p_left"], + ["godot_bool", "p_right"] + ] + }, + { + "name": "godot_string_strip_escapes", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_erase", + "return_type": "void", + "arguments": [ + ["godot_string *", "p_self"], + ["godot_int", "p_pos"], + ["godot_int", "p_chars"] + ] + }, + { + "name": "godot_string_ascii", + "return_type": "godot_char_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_ascii_extended", + "return_type": "godot_char_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_utf8", + "return_type": "godot_char_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_parse_utf8", + "return_type": "godot_bool", + "arguments": [ + ["godot_string *", "p_self"], + ["const char *", "p_utf8"] + ] + }, + { + "name": "godot_string_parse_utf8_with_len", + "return_type": "godot_bool", + "arguments": [ + ["godot_string *", "p_self"], + ["const char *", "p_utf8"], + ["godot_int", "p_len"] + ] + }, + { + "name": "godot_string_chars_to_utf8", + "return_type": "godot_string", + "arguments": [ + ["const char *", "p_utf8"] + ] + }, + { + "name": "godot_string_chars_to_utf8_with_len", + "return_type": "godot_string", + "arguments": [ + ["const char *", "p_utf8"], + ["godot_int", "p_len"] + ] + }, + { + "name": "godot_string_hash", + "return_type": "uint32_t", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_hash64", + "return_type": "uint64_t", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_hash_chars", + "return_type": "uint32_t", + "arguments": [ + ["const char *", "p_cstr"] + ] + }, + { + "name": "godot_string_hash_chars_with_len", + "return_type": "uint32_t", + "arguments": [ + ["const char *", "p_cstr"], + ["godot_int", "p_len"] + ] + }, + { + "name": "godot_string_hash_utf8_chars", + "return_type": "uint32_t", + "arguments": [ + ["const wchar_t *", "p_str"] + ] + }, + { + "name": "godot_string_hash_utf8_chars_with_len", + "return_type": "uint32_t", + "arguments": [ + ["const wchar_t *", "p_str"], + ["godot_int", "p_len"] + ] + }, + { + "name": "godot_string_md5_buffer", + "return_type": "godot_pool_byte_array", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_md5_text", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_sha256_buffer", + "return_type": "godot_pool_byte_array", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_sha256_text", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_get_base_dir", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_get_file", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_humanize_size", + "return_type": "godot_string", + "arguments": [ + ["uint64_t", "p_size"] + ] + }, + { + "name": "godot_string_is_abs_path", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_rel_path", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_resource_file", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_path_to", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_path"] + ] + }, + { + "name": "godot_string_path_to_file", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["const godot_string *", "p_path"] + ] + }, + { + "name": "godot_string_simplify_path", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_c_escape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_c_escape_multiline", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_c_unescape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_http_escape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_http_unescape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_json_escape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_word_wrap", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_int", "p_chars_per_line"] + ] + }, + { + "name": "godot_string_xml_escape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_xml_escape_with_quotes", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_xml_unescape", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_percent_decode", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_percent_encode", + "return_type": "godot_string", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_valid_float", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_valid_hex_number", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"], + ["godot_bool", "p_with_prefix"] + ] + }, + { + "name": "godot_string_is_valid_html_color", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_valid_identifier", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_valid_integer", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_is_valid_ip_address", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_destroy", + "return_type": "void", + "arguments": [ + ["godot_string *", "p_self"] + ] + }, + { + "name": "godot_string_name_new", + "return_type": "void", + "arguments": [ + ["godot_string_name *", "r_dest"], + ["const godot_string *", "p_name"] + ] + }, + { + "name": "godot_string_name_new_data", + "return_type": "void", + "arguments": [ + ["godot_string_name *", "r_dest"], + ["const char *", "p_name"] + ] + }, + { + "name": "godot_string_name_get_name", + "return_type": "godot_string", + "arguments": [ + ["const godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_string_name_get_hash", + "return_type": "uint32_t", + "arguments": [ + ["const godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_string_name_get_data_unique_pointer", + "return_type": "const void *", + "arguments": [ + ["const godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_string_name_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string_name *", "p_self"], + ["const godot_string_name *", "p_other"] + ] + }, + { + "name": "godot_string_name_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string_name *", "p_self"], + ["const godot_string_name *", "p_other"] + ] + }, + { + "name": "godot_string_name_destroy", + "return_type": "void", + "arguments": [ + ["godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_object_destroy", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_o"] + ] + }, + { + "name": "godot_global_get_singleton", + "return_type": "godot_object *", + "arguments": [ + ["char *", "p_name"] + ] + }, + { + "name": "godot_method_bind_get_method", + "return_type": "godot_method_bind *", + "arguments": [ + ["const char *", "p_classname"], + ["const char *", "p_methodname"] + ] + }, + { + "name": "godot_method_bind_ptrcall", + "return_type": "void", + "arguments": [ + ["godot_method_bind *", "p_method_bind"], + ["godot_object *", "p_instance"], + ["const void **", "p_args"], + ["void *", "p_ret"] + ] + }, + { + "name": "godot_method_bind_call", + "return_type": "godot_variant", + "arguments": [ + ["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"] + ] + }, + { + "name": "godot_get_class_constructor", + "return_type": "godot_class_constructor", + "arguments": [ + ["const char *", "p_classname"] + ] + }, + { + "name": "godot_get_global_constants", + "return_type": "godot_dictionary", + "arguments": [ + ] + }, + { + "name": "godot_register_native_call_type", + "return_type": "void", + "arguments": [ + ["const char *", "call_type"], + ["native_call_cb", "p_callback"] + ] + }, + { + "name": "godot_alloc", + "return_type": "void *", + "arguments": [ + ["int", "p_bytes"] + ] + }, + { + "name": "godot_realloc", + "return_type": "void *", + "arguments": [ + ["void *", "p_ptr"], + ["int", "p_bytes"] + ] + }, + { + "name": "godot_free", + "return_type": "void", + "arguments": [ + ["void *", "p_ptr"] + ] + }, + { + "name": "godot_print_error", + "return_type": "void", + "arguments": [ + ["const char *", "p_description"], + ["const char *", "p_function"], + ["const char *", "p_file"], + ["int", "p_line"] + ] + }, + { + "name": "godot_print_warning", + "return_type": "void", + "arguments": [ + ["const char *", "p_description"], + ["const char *", "p_function"], + ["const char *", "p_file"], + ["int", "p_line"] + ] + }, + { + "name": "godot_print", + "return_type": "void", + "arguments": [ + ["const godot_string *", "p_message"] + ] + } + ] + }, + "extensions": [ + { + "name": "nativescript", + "type": "NATIVESCRIPT", + "version": { + "major": 1, + "minor": 0 + }, + "next": { + "type": "NATIVESCRIPT", + "version": { + "major": 1, + "minor": 1 + }, + "next": null, + "api": [ + { + "name": "godot_nativescript_set_method_argument_information", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_function_name"], + ["int", "p_num_args"], + ["const godot_method_arg *", "p_args"] + ] + }, + { + "name": "godot_nativescript_set_class_documentation", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["godot_string", "p_documentation"] + ] + }, + { + "name": "godot_nativescript_set_method_documentation", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_function_name"], + ["godot_string", "p_documentation"] + ] + }, + { + "name": "godot_nativescript_set_property_documentation", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_path"], + ["godot_string", "p_documentation"] + ] + }, + { + "name": "godot_nativescript_set_signal_documentation", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_signal_name"], + ["godot_string", "p_documentation"] + ] + }, + { + "name": "godot_nativescript_set_global_type_tag", + "return_type": "void", + "arguments": [ + ["int", "p_idx"], + ["const char *", "p_name"], + ["const void *", "p_type_tag"] + ] + }, + { + "name": "godot_nativescript_get_global_type_tag", + "return_type": "const void *", + "arguments": [ + ["int", "p_idx"], + ["const char *", "p_name"] + ] + }, + { + "name": "godot_nativescript_set_type_tag", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const void *", "p_type_tag"] + ] + }, + { + "name": "godot_nativescript_get_type_tag", + "return_type": "const void *", + "arguments": [ + ["const godot_object *", "p_object"] + ] + }, + { + "name": "godot_nativescript_register_instance_binding_data_functions", + "return_type": "int", + "arguments": [ + ["godot_instance_binding_functions", "p_binding_functions"] + ] + }, + { + "name": "godot_nativescript_unregister_instance_binding_data_functions", + "return_type": "void", + "arguments": [ + ["int", "p_idx"] + ] + }, + { + "name": "godot_nativescript_get_instance_binding_data", + "return_type": "void *", + "arguments": [ + ["int", "p_idx"], + ["godot_object *", "p_object"] + ] + }, + { + "name": "godot_nativescript_profiling_add_data", + "return_type": "void", + "arguments": [ + ["const char *", "p_signature"], + ["uint64_t", "p_line"] + ] + } + ] + }, + "api": [ + { + "name": "godot_nativescript_register_class", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_base"], + ["godot_instance_create_func", "p_create_func"], + ["godot_instance_destroy_func", "p_destroy_func"] + ] + }, + { + "name": "godot_nativescript_register_tool_class", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_base"], + ["godot_instance_create_func", "p_create_func"], + ["godot_instance_destroy_func", "p_destroy_func"] + ] + }, + { + "name": "godot_nativescript_register_method", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_function_name"], + ["godot_method_attributes", "p_attr"], + ["godot_instance_method", "p_method"] + ] + }, + { + "name": "godot_nativescript_register_property", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const char *", "p_path"], + ["godot_property_attributes *", "p_attr"], + ["godot_property_set_func", "p_set_func"], + ["godot_property_get_func", "p_get_func"] + ] + }, + { + "name": "godot_nativescript_register_signal", + "return_type": "void", + "arguments": [ + ["void *", "p_gdnative_handle"], + ["const char *", "p_name"], + ["const godot_signal *", "p_signal"] + ] + }, + { + "name": "godot_nativescript_get_userdata", + "return_type": "void *", + "arguments": [ + ["godot_object *", "p_instance"] + ] + } + ] + }, + { + "name": "pluginscript", + "type": "PLUGINSCRIPT", + "version": { + "major": 1, + "minor": 0 + }, + "next": null, + "api": [ + { + "name": "godot_pluginscript_register_language", + "return_type": "void", + "arguments": [ + ["const godot_pluginscript_language_desc *", "language_desc"] + ] + } + ] + }, + { + "name": "android", + "type": "ANDROID", + "version": { + "major": 1, + "minor": 1 + }, + "next": null, + "api": [ + { + "name": "godot_android_get_env", + "return_type": "JNIEnv*", + "arguments": [ + ] + }, + { + "name": "godot_android_get_activity", + "return_type": "jobject", + "arguments": [ + ] + }, + { + "name": "godot_android_get_surface", + "return_type": "jobject", + "arguments": [ + ] + }, + { + "name": "godot_android_is_activity_resumed", + "return_type": "bool", + "arguments": [ + ] + } + ] + }, + { + "name": "arvr", + "type": "ARVR", + "version": { + "major": 1, + "minor": 1 + }, + "next": { + "name": "arvr", + "type": "ARVR", + "version": { + "major": 1, + "minor": 2 + }, + "next": null, + "api": [ + { + "name": "godot_arvr_set_interface", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_arvr_interface"], + ["const godot_arvr_interface_gdnative *", "p_gdn_interface"] + ] + }, + { + "name": "godot_arvr_get_depthid", + "return_type": "godot_int", + "arguments": [ + ["godot_rid *", "p_render_target"] + ] + } + ] + }, + "api": [ + { + "name": "godot_arvr_register_interface", + "return_type": "void", + "arguments": [ + ["const godot_arvr_interface_gdnative *", "p_interface"] + ] + }, + { + "name": "godot_arvr_get_worldscale", + "return_type": "godot_real", + "arguments": [] + }, + { + "name": "godot_arvr_get_reference_frame", + "return_type": "godot_transform", + "arguments": [] + }, + { + "name": "godot_arvr_blit", + "return_type": "void", + "arguments": [ + ["int", "p_eye"], + ["godot_rid *", "p_render_target"], + ["godot_rect2 *", "p_screen_rect"] + ] + }, + { + "name": "godot_arvr_get_texid", + "return_type": "godot_int", + "arguments": [ + ["godot_rid *", "p_render_target"] + ] + }, + { + "name": "godot_arvr_add_controller", + "return_type": "godot_int", + "arguments": [ + ["char *", "p_device_name"], + ["godot_int", "p_hand"], + ["godot_bool", "p_tracks_orientation"], + ["godot_bool", "p_tracks_position"] + ] + }, + { + "name": "godot_arvr_remove_controller", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"] + ] + }, + { + "name": "godot_arvr_set_controller_transform", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"], + ["godot_transform *", "p_transform"], + ["godot_bool", "p_tracks_orientation"], + ["godot_bool", "p_tracks_position"] + ] + }, + { + "name": "godot_arvr_set_controller_button", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"], + ["godot_int", "p_button"], + ["godot_bool", "p_is_pressed"] + ] + }, + { + "name": "godot_arvr_set_controller_axis", + "return_type": "void", + "arguments": [ + ["godot_int", "p_controller_id"], + ["godot_int", "p_exis"], + ["godot_real", "p_value"], + ["godot_bool", "p_can_be_negative"] + ] + }, + { + "name": "godot_arvr_get_controller_rumble", + "return_type": "godot_real", + "arguments": [ + ["godot_int", "p_controller_id"] + ] + } + ] + }, + { + "name": "videodecoder", + "type": "VIDEODECODER", + "version": { + "major": 0, + "minor": 1 + }, + "next": null, + "api": [ + { + "name": "godot_videodecoder_file_read", + "return_type": "godot_int", + "arguments": [ + ["void *", "file_ptr"], + ["uint8_t *", "buf"], + ["int", "buf_size"] + ] + }, + { + "name": "godot_videodecoder_file_seek", + "return_type": "int64_t", + "arguments": [ + [ "void *", "file_ptr"], + ["int64_t", "pos"], + ["int", "whence"] + ] + }, + { + "name": "godot_videodecoder_register_decoder", + "return_type": "void", + "arguments": [ + ["const godot_videodecoder_interface_gdnative *", "p_interface"] + ] + } + ] + }, + { + "name": "net", + "type": "NET", + "version": { + "major": 3, + "minor": 1 + }, + "next": { + "type": "NET", + "version": { + "major": 3, + "minor": 2 + }, + "next": null, + "api": [ + { + "name": "godot_net_set_webrtc_library", + "return_type": "godot_error", + "arguments": [ + ["const godot_net_webrtc_library *", "p_library"] + ] + }, + { + "name": "godot_net_bind_webrtc_peer_connection", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_obj"], + ["const godot_net_webrtc_peer_connection *", "p_interface"] + ] + }, + { + "name": "godot_net_bind_webrtc_data_channel", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_obj"], + ["const godot_net_webrtc_data_channel *", "p_interface"] + ] + } + ] + }, + "api": [ + { + "name": "godot_net_bind_stream_peer", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_obj"], + ["const godot_net_stream_peer *", "p_interface"] + ] + }, + { + "name": "godot_net_bind_packet_peer", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_obj"], + ["const godot_net_packet_peer *", "p_interface"] + ] + }, + { + "name": "godot_net_bind_multiplayer_peer", + "return_type": "void", + "arguments": [ + ["godot_object *", "p_obj"], + ["const godot_net_multiplayer_peer *", "p_interface"] + ] + } + ] + } + ] +} diff --git a/gdnative_builders.py b/gdnative_builders.py new file mode 100644 index 0000000..d44bf45 --- /dev/null +++ b/gdnative_builders.py @@ -0,0 +1,350 @@ +"""Functions used to generate source files during build time + +All such functions are invoked in a subprocess on Windows to prevent build flakiness. + +""" +import json +from platform_methods import subprocess_main + + +def _spaced(e): + return e if e[-1] == "*" else e + " " + + +def _build_gdnative_api_struct_header(api): + gdnative_api_init_macro = ["\textern const godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct;"] + + for ext in api["extensions"]: + name = ext["name"] + gdnative_api_init_macro.append( + "\textern const godot_gdnative_ext_{0}_api_struct *_gdnative_wrapper_{0}_api_struct;".format(name) + ) + + gdnative_api_init_macro.append("\t_gdnative_wrapper_api_struct = options->api_struct;") + gdnative_api_init_macro.append( + "\tfor (unsigned int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { " + ) + gdnative_api_init_macro.append("\t\tswitch (_gdnative_wrapper_api_struct->extensions[i]->type) {") + + for ext in api["extensions"]: + name = ext["name"] + gdnative_api_init_macro.append("\t\t\tcase GDNATIVE_EXT_%s:" % ext["type"]) + gdnative_api_init_macro.append( + "\t\t\t\t_gdnative_wrapper_{0}_api_struct = (godot_gdnative_ext_{0}_api_struct *)" + " _gdnative_wrapper_api_struct->extensions[i];".format(name) + ) + gdnative_api_init_macro.append("\t\t\t\tbreak;") + gdnative_api_init_macro.append("\t\t}") + gdnative_api_init_macro.append("\t}") + + out = [ + "/* THIS FILE IS GENERATED DO NOT EDIT */", + "#ifndef GODOT_GDNATIVE_API_STRUCT_H", + "#define GODOT_GDNATIVE_API_STRUCT_H", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#define GDNATIVE_API_INIT(options) do { \\\n" + " \\\n".join(gdnative_api_init_macro) + " \\\n } while (0)", + "", + "#ifdef __cplusplus", + 'extern "C" {', + "#endif", + "", + "enum GDNATIVE_API_TYPES {", + "\tGDNATIVE_" + api["core"]["type"] + ",", + ] + + for ext in api["extensions"]: + out += ["\tGDNATIVE_EXT_" + ext["type"] + ","] + + out += ["};", ""] + + def generate_extension_struct(name, ext, include_version=True): + ret_val = [] + if ext["next"]: + ret_val += generate_extension_struct(name, ext["next"]) + + ret_val += [ + "typedef struct godot_gdnative_ext_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_api_struct {", + "\tunsigned int type;", + "\tgodot_gdnative_api_version version;", + "\tconst godot_gdnative_api_struct *next;", + ] + + for funcdef in ext["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) + + ret_val += [ + "} godot_gdnative_ext_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_api_struct;", + "", + ] + + return ret_val + + def generate_core_extension_struct(core): + ret_val = [] + if core["next"]: + ret_val += generate_core_extension_struct(core["next"]) + + ret_val += [ + "typedef struct godot_gdnative_core_" + + ("{0}_{1}".format(core["version"]["major"], core["version"]["minor"])) + + "_api_struct {", + "\tunsigned int type;", + "\tgodot_gdnative_api_version version;", + "\tconst godot_gdnative_api_struct *next;", + ] + + for funcdef in core["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) + + ret_val += [ + "} godot_gdnative_core_" + + "{0}_{1}".format(core["version"]["major"], core["version"]["minor"]) + + "_api_struct;", + "", + ] + + return ret_val + + for ext in api["extensions"]: + name = ext["name"] + out += generate_extension_struct(name, ext, False) + + if api["core"]["next"]: + out += generate_core_extension_struct(api["core"]["next"]) + + out += [ + "typedef struct godot_gdnative_core_api_struct {", + "\tunsigned int type;", + "\tgodot_gdnative_api_version version;", + "\tconst godot_gdnative_api_struct *next;", + "\tunsigned int num_extensions;", + "\tconst godot_gdnative_api_struct **extensions;", + ] + + for funcdef in api["core"]["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + out.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) + + out += [ + "} godot_gdnative_core_api_struct;", + "", + "#ifdef __cplusplus", + "}", + "#endif", + "", + "#endif // GODOT_GDNATIVE_API_STRUCT_H", + "", + ] + return "\n".join(out) + + +def _build_gdnative_api_struct_source(api): + out = ["/* THIS FILE IS GENERATED DO NOT EDIT */", "", "#include ", ""] + + def get_extension_struct_name(name, ext, include_version=True): + return ( + "godot_gdnative_ext_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_api_struct" + ) + + def get_extension_struct_instance_name(name, ext, include_version=True): + return ( + "api_extension_" + + name + + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) + + "_struct" + ) + + def get_extension_struct_definition(name, ext, include_version=True): + + ret_val = [] + + if ext["next"]: + ret_val += get_extension_struct_definition(name, ext["next"]) + + ret_val += [ + "extern const " + + get_extension_struct_name(name, ext, include_version) + + " " + + get_extension_struct_instance_name(name, ext, include_version) + + " = {", + "\tGDNATIVE_EXT_" + ext["type"] + ",", + "\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},", + "\t" + + ( + "NULL" + if not ext["next"] + else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"])) + ) + + ",", + ] + + for funcdef in ext["api"]: + ret_val.append("\t%s," % funcdef["name"]) + + ret_val += ["};\n"] + + return ret_val + + def get_core_struct_definition(core): + ret_val = [] + + if core["next"]: + ret_val += get_core_struct_definition(core["next"]) + + ret_val += [ + "extern const godot_gdnative_core_" + + ("{0}_{1}_api_struct api_{0}_{1}".format(core["version"]["major"], core["version"]["minor"])) + + " = {", + "\tGDNATIVE_" + core["type"] + ",", + "\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},", + "\t" + + ( + "NULL" + if not core["next"] + else ( + "(const godot_gdnative_api_struct *)& api_{0}_{1}".format( + core["next"]["version"]["major"], core["next"]["version"]["minor"] + ) + ) + ) + + ",", + ] + + for funcdef in core["api"]: + ret_val.append("\t%s," % funcdef["name"]) + + ret_val += ["};\n"] + + return ret_val + + for ext in api["extensions"]: + name = ext["name"] + out += get_extension_struct_definition(name, ext, False) + + out += ["", "const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {"] + + for ext in api["extensions"]: + name = ext["name"] + out += ["\t(godot_gdnative_api_struct *)&api_extension_" + name + "_struct,"] + + out += ["};\n"] + + if api["core"]["next"]: + out += get_core_struct_definition(api["core"]["next"]) + + out += [ + "extern const godot_gdnative_core_api_struct api_struct = {", + "\tGDNATIVE_" + api["core"]["type"] + ",", + "\t{" + str(api["core"]["version"]["major"]) + ", " + str(api["core"]["version"]["minor"]) + "},", + "\t(const godot_gdnative_api_struct *)&api_1_1,", + "\t" + str(len(api["extensions"])) + ",", + "\tgdnative_extensions_pointers,", + ] + + for funcdef in api["core"]["api"]: + out.append("\t%s," % funcdef["name"]) + out.append("};\n") + + return "\n".join(out) + + +def build_gdnative_api_struct(target, source, env): + + with open(source[0], "r") as fd: + api = json.load(fd) + + header, source = target + with open(header, "w") as fd: + fd.write(_build_gdnative_api_struct_header(api)) + with open(source, "w") as fd: + fd.write(_build_gdnative_api_struct_source(api)) + + +def _build_gdnative_wrapper_code(api): + out = [ + "/* THIS FILE IS GENERATED DO NOT EDIT */", + "", + "#include ", + "#include ", + "#include ", + "#include ", + "#include ", + "", + "#include ", + "", + "#ifdef __cplusplus", + 'extern "C" {', + "#endif", + "", + "godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct = 0;", + ] + + for ext in api["extensions"]: + name = ext["name"] + out.append("godot_gdnative_ext_" + name + "_api_struct *_gdnative_wrapper_" + name + "_api_struct = 0;") + + out += [""] + + for funcdef in api["core"]["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + out.append("%s%s(%s) {" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) + + args = ", ".join(["%s" % n for t, n in funcdef["arguments"]]) + + return_line = "\treturn " if funcdef["return_type"] != "void" else "\t" + return_line += "_gdnative_wrapper_api_struct->" + funcdef["name"] + "(" + args + ");" + + out.append(return_line) + out.append("}") + out.append("") + + for ext in api["extensions"]: + name = ext["name"] + for funcdef in ext["api"]: + args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) + out.append("%s%s(%s) {" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) + + args = ", ".join(["%s" % n for t, n in funcdef["arguments"]]) + + return_line = "\treturn " if funcdef["return_type"] != "void" else "\t" + return_line += "_gdnative_wrapper_" + name + "_api_struct->" + funcdef["name"] + "(" + args + ");" + + out.append(return_line) + out.append("}") + out.append("") + + out += ["#ifdef __cplusplus", "}", "#endif"] + + return "\n".join(out) + + +def build_gdnative_wrapper_code(target, source, env): + with open(source[0], "r") as fd: + api = json.load(fd) + + wrapper_file = target[0] + with open(wrapper_file, "w") as fd: + fd.write(_build_gdnative_wrapper_code(api)) + + +if __name__ == "__main__": + subprocess_main(globals()) diff --git a/gdnative_library_editor_plugin.cpp b/gdnative_library_editor_plugin.cpp new file mode 100644 index 0000000..77a9c28 --- /dev/null +++ b/gdnative_library_editor_plugin.cpp @@ -0,0 +1,426 @@ +/**************************************************************************/ +/* gdnative_library_editor_plugin.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifdef TOOLS_ENABLED +#include "gdnative_library_editor_plugin.h" +#include "gdnative.h" + +#include "editor/editor_scale.h" + +void GDNativeLibraryEditor::edit(Ref p_library) { + library = p_library; + Ref config = p_library->get_config_file(); + + for (Map::Element *E = platforms.front(); E; E = E->next()) { + for (List::Element *it = E->value().entries.front(); it; it = it->next()) { + String target = E->key() + "." + it->get(); + TargetConfig ecfg; + ecfg.library = config->get_value("entry", target, ""); + ecfg.dependencies = config->get_value("dependencies", target, Array()); + entry_configs[target] = ecfg; + } + } + + _update_tree(); +} + +void GDNativeLibraryEditor::_bind_methods() { + ClassDB::bind_method("_on_item_button", &GDNativeLibraryEditor::_on_item_button); + ClassDB::bind_method("_on_library_selected", &GDNativeLibraryEditor::_on_library_selected); + ClassDB::bind_method("_on_dependencies_selected", &GDNativeLibraryEditor::_on_dependencies_selected); + ClassDB::bind_method("_on_filter_selected", &GDNativeLibraryEditor::_on_filter_selected); + ClassDB::bind_method("_on_item_collapsed", &GDNativeLibraryEditor::_on_item_collapsed); + ClassDB::bind_method("_on_item_activated", &GDNativeLibraryEditor::_on_item_activated); + ClassDB::bind_method("_on_create_new_entry", &GDNativeLibraryEditor::_on_create_new_entry); +} + +void GDNativeLibraryEditor::_update_tree() { + tree->clear(); + TreeItem *root = tree->create_item(); + + PopupMenu *filter_list = filter->get_popup(); + String text = ""; + for (int i = 0; i < filter_list->get_item_count(); i++) { + if (!filter_list->is_item_checked(i)) { + continue; + } + Map::Element *E = platforms.find(filter_list->get_item_metadata(i)); + if (!text.empty()) { + text += ", "; + } + text += E->get().name; + + TreeItem *platform = tree->create_item(root); + platform->set_text(0, E->get().name); + platform->set_metadata(0, E->get().library_extension); + + platform->set_custom_bg_color(0, get_color("prop_category", "Editor")); + platform->set_custom_bg_color(1, get_color("prop_category", "Editor")); + platform->set_custom_bg_color(2, get_color("prop_category", "Editor")); + platform->set_selectable(0, false); + platform->set_expand_right(0, true); + + for (List::Element *it = E->value().entries.front(); it; it = it->next()) { + String target = E->key() + "." + it->get(); + TreeItem *bit = tree->create_item(platform); + + bit->set_text(0, it->get()); + bit->set_metadata(0, target); + bit->set_selectable(0, false); + bit->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); + + bit->add_button(1, get_icon("Folder", "EditorIcons"), BUTTON_SELECT_LIBRARY, false, TTR("Select the dynamic library for this entry")); + String file = entry_configs[target].library; + if (!file.empty()) { + bit->add_button(1, get_icon("Clear", "EditorIcons"), BUTTON_CLEAR_LIBRARY, false, TTR("Clear")); + } + bit->set_text(1, file); + + bit->add_button(2, get_icon("Folder", "EditorIcons"), BUTTON_SELECT_DEPENDENCES, false, TTR("Select dependencies of the library for this entry")); + Array files = entry_configs[target].dependencies; + if (files.size()) { + bit->add_button(2, get_icon("Clear", "EditorIcons"), BUTTON_CLEAR_DEPENDENCES, false, TTR("Clear")); + } + bit->set_text(2, Variant(files)); + + bit->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP, false, TTR("Move Up")); + bit->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN, false, TTR("Move Down")); + bit->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_ERASE_ENTRY, false, TTR("Remove current entry")); + } + + TreeItem *new_arch = tree->create_item(platform); + new_arch->set_text(0, TTR("Double click to create a new entry")); + new_arch->set_text_align(0, TreeItem::ALIGN_CENTER); + new_arch->set_custom_color(0, get_color("accent_color", "Editor")); + new_arch->set_expand_right(0, true); + new_arch->set_metadata(1, E->key()); + + platform->set_collapsed(collapsed_items.find(E->get().name) != nullptr); + } + filter->set_text(text); +} + +void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) { + String target = Object::cast_to(item)->get_metadata(0); + String platform = target.substr(0, target.find(".")); + String entry = target.substr(platform.length() + 1, target.length()); + String section = (id == BUTTON_SELECT_DEPENDENCES || id == BUTTON_CLEAR_DEPENDENCES) ? "dependencies" : "entry"; + + if (id == BUTTON_SELECT_LIBRARY || id == BUTTON_SELECT_DEPENDENCES) { + TreeItem *treeItem = Object::cast_to(item)->get_parent(); + EditorFileDialog::Mode mode = EditorFileDialog::MODE_OPEN_FILE; + + if (id == BUTTON_SELECT_DEPENDENCES) { + mode = EditorFileDialog::MODE_OPEN_FILES; + } else if (treeItem->get_text(0) == "iOS" || treeItem->get_text(0) == "macOS") { + mode = EditorFileDialog::MODE_OPEN_ANY; + } + + file_dialog->set_meta("target", target); + file_dialog->set_meta("section", section); + file_dialog->clear_filters(); + + String filter_string = treeItem->get_metadata(0); + Vector filters = filter_string.split(",", false, 0); + for (int i = 0; i < filters.size(); i++) { + file_dialog->add_filter(filters[i]); + } + + file_dialog->set_mode(mode); + file_dialog->popup_centered_ratio(); + + } else if (id == BUTTON_CLEAR_LIBRARY) { + _set_target_value(section, target, ""); + } else if (id == BUTTON_CLEAR_DEPENDENCES) { + _set_target_value(section, target, Array()); + } else if (id == BUTTON_ERASE_ENTRY) { + _erase_entry(platform, entry); + } else if (id == BUTTON_MOVE_UP || id == BUTTON_MOVE_DOWN) { + _move_entry(platform, entry, id); + } +} + +void GDNativeLibraryEditor::_on_library_selected(const String &file) { + _set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), file); +} + +void GDNativeLibraryEditor::_on_dependencies_selected(const PoolStringArray &files) { + _set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), files); +} + +void GDNativeLibraryEditor::_on_filter_selected(int index) { + PopupMenu *filter_list = filter->get_popup(); + filter_list->set_item_checked(index, !filter_list->is_item_checked(index)); + _update_tree(); +} + +void GDNativeLibraryEditor::_on_item_collapsed(Object *p_item) { + TreeItem *item = Object::cast_to(p_item); + String name = item->get_text(0); + + if (item->is_collapsed()) { + collapsed_items.insert(name); + } else if (Set::Element *e = collapsed_items.find(name)) { + collapsed_items.erase(e); + } +} + +void GDNativeLibraryEditor::_on_item_activated() { + TreeItem *item = tree->get_selected(); + if (item && tree->get_selected_column() == 0 && item->get_metadata(0).get_type() == Variant::NIL) { + new_architecture_dialog->set_meta("platform", item->get_metadata(1)); + new_architecture_dialog->popup_centered(); + } +} + +void GDNativeLibraryEditor::_on_create_new_entry() { + String platform = new_architecture_dialog->get_meta("platform"); + String entry = new_architecture_input->get_text().strip_edges(); + if (!entry.empty()) { + platforms[platform].entries.push_back(entry); + _update_tree(); + } +} + +void GDNativeLibraryEditor::_set_target_value(const String §ion, const String &target, Variant file) { + if (section == "entry") { + entry_configs[target].library = file; + } else if (section == "dependencies") { + entry_configs[target].dependencies = file; + } + _translate_to_config_file(); + _update_tree(); +} + +void GDNativeLibraryEditor::_erase_entry(const String &platform, const String &entry) { + if (platforms.has(platform)) { + if (List::Element *E = platforms[platform].entries.find(entry)) { + String target = platform + "." + entry; + + platforms[platform].entries.erase(E); + _set_target_value("entry", target, ""); + _set_target_value("dependencies", target, Array()); + _translate_to_config_file(); + _update_tree(); + } + } +} + +void GDNativeLibraryEditor::_move_entry(const String &platform, const String &entry, int dir) { + if (List::Element *E = platforms[platform].entries.find(entry)) { + if (E->prev() && dir == BUTTON_MOVE_UP) { + platforms[platform].entries.insert_before(E->prev(), E->get()); + platforms[platform].entries.erase(E); + } else if (E->next() && dir == BUTTON_MOVE_DOWN) { + platforms[platform].entries.insert_after(E->next(), E->get()); + platforms[platform].entries.erase(E); + } + _translate_to_config_file(); + _update_tree(); + } +} + +void GDNativeLibraryEditor::_translate_to_config_file() { + if (!library.is_null()) { + Ref config = library->get_config_file(); + config->erase_section("entry"); + config->erase_section("dependencies"); + + for (Map::Element *E = platforms.front(); E; E = E->next()) { + for (List::Element *it = E->value().entries.front(); it; it = it->next()) { + String target = E->key() + "." + it->get(); + if (entry_configs[target].library.empty() && entry_configs[target].dependencies.empty()) { + continue; + } + + config->set_value("entry", target, entry_configs[target].library); + config->set_value("dependencies", target, entry_configs[target].dependencies); + } + } + + library->_change_notify(); + } +} + +GDNativeLibraryEditor::GDNativeLibraryEditor() { + { // Define platforms + NativePlatformConfig platform_windows; + platform_windows.name = "Windows"; + platform_windows.entries.push_back("64"); + platform_windows.entries.push_back("32"); + platform_windows.library_extension = "*.dll"; + platforms["Windows"] = platform_windows; + + NativePlatformConfig platform_linux; + platform_linux.name = "Linux/X11"; + platform_linux.entries.push_back("64"); + platform_linux.entries.push_back("32"); + platform_linux.library_extension = "*.so"; + platforms["X11"] = platform_linux; + + NativePlatformConfig platform_osx; + platform_osx.name = "macOS"; + platform_osx.entries.push_back("64"); + platform_osx.library_extension = "*.framework; Framework, *.dylib; Dynamic Library"; + platforms["OSX"] = platform_osx; + + NativePlatformConfig platform_haiku; + platform_haiku.name = "Haiku"; + platform_haiku.entries.push_back("64"); + platform_haiku.entries.push_back("32"); + platform_haiku.library_extension = "*.so"; + platforms["Haiku"] = platform_haiku; + + NativePlatformConfig platform_uwp; + platform_uwp.name = "UWP"; + platform_uwp.entries.push_back("arm"); + platform_uwp.entries.push_back("32"); + platform_uwp.entries.push_back("64"); + platform_uwp.library_extension = "*.dll"; + platforms["UWP"] = platform_uwp; + + NativePlatformConfig platform_android; + platform_android.name = "Android"; + platform_android.entries.push_back("armeabi-v7a"); + platform_android.entries.push_back("arm64-v8a"); + platform_android.entries.push_back("x86"); + platform_android.entries.push_back("x86_64"); + platform_android.library_extension = "*.so"; + platforms["Android"] = platform_android; + + NativePlatformConfig platform_html5; + platform_html5.name = "HTML5"; + platform_html5.entries.push_back("wasm32"); + platform_html5.library_extension = "*.wasm"; + platforms["HTML5"] = platform_html5; + + NativePlatformConfig platform_ios; + platform_ios.name = "iOS"; + platform_ios.entries.push_back("armv7"); + platform_ios.entries.push_back("arm64"); + platform_ios.entries.push_back("x86_64"); + // iOS can use both Static and Dynamic libraries. + // Frameworks is actually a folder with files. + platform_ios.library_extension = "*.framework; Framework, *.xcframework; Binary Framework, *.a; Static Library, *.dylib; Dynamic Library"; + platforms["iOS"] = platform_ios; + } + + VBoxContainer *container = memnew(VBoxContainer); + add_child(container); + container->set_anchors_and_margins_preset(PRESET_WIDE); + + HBoxContainer *hbox = memnew(HBoxContainer); + container->add_child(hbox); + Label *label = memnew(Label); + label->set_text(TTR("Platform:")); + hbox->add_child(label); + filter = memnew(MenuButton); + filter->set_h_size_flags(SIZE_EXPAND_FILL); + filter->set_text_align(filter->ALIGN_LEFT); + hbox->add_child(filter); + PopupMenu *filter_list = filter->get_popup(); + filter_list->set_hide_on_checkable_item_selection(false); + + int idx = 0; + for (Map::Element *E = platforms.front(); E; E = E->next()) { + filter_list->add_check_item(E->get().name, idx); + filter_list->set_item_metadata(idx, E->key()); + filter_list->set_item_checked(idx, true); + idx += 1; + } + filter_list->connect("index_pressed", this, "_on_filter_selected"); + + tree = memnew(Tree); + container->add_child(tree); + tree->set_v_size_flags(SIZE_EXPAND_FILL); + tree->set_hide_root(true); + tree->set_column_titles_visible(true); + tree->set_columns(4); + tree->set_column_expand(0, false); + tree->set_column_min_width(0, int(200 * EDSCALE)); + tree->set_column_title(0, TTR("Platform")); + tree->set_column_title(1, TTR("Dynamic Library")); + tree->set_column_title(2, TTR("Dependencies")); + tree->set_column_expand(3, false); + tree->set_column_min_width(3, int(110 * EDSCALE)); + tree->connect("button_pressed", this, "_on_item_button"); + tree->connect("item_collapsed", this, "_on_item_collapsed"); + tree->connect("item_activated", this, "_on_item_activated"); + + file_dialog = memnew(EditorFileDialog); + file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); + file_dialog->set_resizable(true); + add_child(file_dialog); + file_dialog->connect("file_selected", this, "_on_library_selected"); + file_dialog->connect("dir_selected", this, "_on_library_selected"); + file_dialog->connect("files_selected", this, "_on_dependencies_selected"); + + new_architecture_dialog = memnew(ConfirmationDialog); + add_child(new_architecture_dialog); + new_architecture_dialog->set_title(TTR("Add an architecture entry")); + new_architecture_input = memnew(LineEdit); + new_architecture_dialog->add_child(new_architecture_input); + new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE); + new_architecture_input->set_anchors_and_margins_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE); + new_architecture_dialog->get_ok()->connect("pressed", this, "_on_create_new_entry"); +} + +void GDNativeLibraryEditorPlugin::edit(Object *p_node) { + Ref new_library = Object::cast_to(p_node); + if (new_library.is_valid()) { + library_editor->edit(new_library); + } +} + +bool GDNativeLibraryEditorPlugin::handles(Object *p_node) const { + return p_node->is_class("GDNativeLibrary"); +} + +void GDNativeLibraryEditorPlugin::make_visible(bool p_visible) { + if (p_visible) { + button->show(); + EditorNode::get_singleton()->make_bottom_panel_item_visible(library_editor); + + } else { + if (library_editor->is_visible_in_tree()) { + EditorNode::get_singleton()->hide_bottom_panel(); + } + button->hide(); + } +} + +GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin(EditorNode *p_node) { + library_editor = memnew(GDNativeLibraryEditor); + library_editor->set_custom_minimum_size(Size2(0, 250 * EDSCALE)); + button = p_node->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor); + button->hide(); +} + +#endif diff --git a/gdnative_library_editor_plugin.h b/gdnative_library_editor_plugin.h new file mode 100644 index 0000000..e6e3116 --- /dev/null +++ b/gdnative_library_editor_plugin.h @@ -0,0 +1,113 @@ +/**************************************************************************/ +/* gdnative_library_editor_plugin.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_LIBRARY_EDITOR_PLUGIN_H +#define GDNATIVE_LIBRARY_EDITOR_PLUGIN_H + +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#include "gdnative.h" + +class GDNativeLibraryEditor : public Control { + GDCLASS(GDNativeLibraryEditor, Control); + + struct NativePlatformConfig { + String name; + String library_extension; + List entries; + }; + + struct TargetConfig { + String library; + Array dependencies; + }; + + enum ItemButton { + BUTTON_SELECT_LIBRARY, + BUTTON_CLEAR_LIBRARY, + BUTTON_SELECT_DEPENDENCES, + BUTTON_CLEAR_DEPENDENCES, + BUTTON_ERASE_ENTRY, + BUTTON_MOVE_UP, + BUTTON_MOVE_DOWN, + }; + + Tree *tree; + MenuButton *filter; + EditorFileDialog *file_dialog; + ConfirmationDialog *new_architecture_dialog; + LineEdit *new_architecture_input; + Set collapsed_items; + + String showing_platform; + Ref library; + Map platforms; + Map entry_configs; + +protected: + static void _bind_methods(); + void _update_tree(); + void _on_item_button(Object *item, int column, int id); + void _on_library_selected(const String &file); + void _on_dependencies_selected(const PoolStringArray &files); + void _on_filter_selected(int id); + void _on_item_collapsed(Object *p_item); + void _on_item_activated(); + void _on_create_new_entry(); + void _set_target_value(const String §ion, const String &target, Variant file); + void _erase_entry(const String &platform, const String &entry); + void _move_entry(const String &platform, const String &entry, int dir); + void _translate_to_config_file(); + +public: + void edit(Ref p_library); + + GDNativeLibraryEditor(); +}; + +class GDNativeLibraryEditorPlugin : public EditorPlugin { + GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin); + + GDNativeLibraryEditor *library_editor; + EditorNode *editor; + Button *button; + +public: + virtual String get_name() const { return "GDNativeLibrary"; } + bool has_main_screen() const { return false; } + virtual void edit(Object *p_node); + virtual bool handles(Object *p_node) const; + virtual void make_visible(bool p_visible); + + GDNativeLibraryEditorPlugin(EditorNode *p_node); +}; +#endif + +#endif // GDNATIVE_LIBRARY_EDITOR_PLUGIN_H diff --git a/gdnative_library_singleton_editor.cpp b/gdnative_library_singleton_editor.cpp new file mode 100644 index 0000000..8b257a7 --- /dev/null +++ b/gdnative_library_singleton_editor.cpp @@ -0,0 +1,212 @@ +/**************************************************************************/ +/* gdnative_library_singleton_editor.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifdef TOOLS_ENABLED +#include "gdnative_library_singleton_editor.h" +#include "gdnative.h" + +#include "editor/editor_node.h" + +Set GDNativeLibrarySingletonEditor::_find_singletons_recursive(EditorFileSystemDirectory *p_dir) { + Set file_paths; + + // check children + + for (int i = 0; i < p_dir->get_file_count(); i++) { + String file_name = p_dir->get_file(i); + String file_type = p_dir->get_file_type(i); + + if (file_type != "GDNativeLibrary") { + continue; + } + + Ref lib = ResourceLoader::load(p_dir->get_file_path(i)); + if (lib.is_valid() && lib->is_singleton()) { + file_paths.insert(p_dir->get_file_path(i)); + } + } + + // check subdirectories + for (int i = 0; i < p_dir->get_subdir_count(); i++) { + Set paths = _find_singletons_recursive(p_dir->get_subdir(i)); + + for (Set::Element *E = paths.front(); E; E = E->next()) { + file_paths.insert(E->get()); + } + } + + return file_paths; +} + +void GDNativeLibrarySingletonEditor::_discover_singletons() { + EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem(); + + Set file_paths = _find_singletons_recursive(dir); + + bool changed = false; + Array current_files; + if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) { + current_files = ProjectSettings::get_singleton()->get("gdnative/singletons"); + } + Array files; + for (Set::Element *E = file_paths.front(); E; E = E->next()) { + if (!current_files.has(E->get())) { + changed = true; + } + files.append(E->get()); + } + + // Check for removed files + if (!changed) { + // Removed singleton + for (int j = 0; j < current_files.size(); j++) { + if (!files.has(current_files[j])) { + changed = true; + break; + } + } + } + + if (changed) { + ProjectSettings::get_singleton()->set("gdnative/singletons", files); + _update_libraries(); // So singleton options (i.e. disabled) updates too + ProjectSettings::get_singleton()->save(); + } +} + +void GDNativeLibrarySingletonEditor::_update_libraries() { + updating = true; + libraries->clear(); + libraries->create_item(); // root item + + Array singletons; + if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) { + singletons = ProjectSettings::get_singleton()->get("gdnative/singletons"); + } + Array singletons_disabled; + if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) { + singletons_disabled = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled"); + } + + Array updated_disabled; + for (int i = 0; i < singletons.size(); i++) { + bool enabled = true; + String path = singletons[i]; + if (singletons_disabled.has(path)) { + enabled = false; + updated_disabled.push_back(path); + } + TreeItem *ti = libraries->create_item(libraries->get_root()); + ti->set_text(0, path.get_file()); + ti->set_tooltip(0, path); + ti->set_metadata(0, path); + ti->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); + ti->set_text(1, "Disabled,Enabled"); + ti->set_range(1, enabled ? 1 : 0); + ti->set_custom_color(1, enabled ? Color(0, 1, 0) : Color(1, 0, 0)); + ti->set_editable(1, true); + } + + // The singletons list changed, we must update the settings + if (updated_disabled.size() != singletons_disabled.size()) { + ProjectSettings::get_singleton()->set("gdnative/singletons_disabled", updated_disabled); + } + + updating = false; +} + +void GDNativeLibrarySingletonEditor::_item_edited() { + if (updating) { + return; + } + + TreeItem *item = libraries->get_edited(); + if (!item) { + return; + } + + bool enabled = item->get_range(1); + String path = item->get_metadata(0); + + Array disabled_paths; + Array undo_paths; + if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) { + disabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled"); + // Duplicate so redo works (not a reference) + disabled_paths = disabled_paths.duplicate(); + // For undo, so we can reset the property. + undo_paths = disabled_paths.duplicate(); + } + + if (enabled) { + disabled_paths.erase(path); + } else { + if (disabled_paths.find(path) == -1) { + disabled_paths.push_back(path); + } + } + + undo_redo->create_action(enabled ? TTR("Enabled GDNative Singleton") : TTR("Disabled GDNative Singleton")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "gdnative/singletons_disabled", disabled_paths); + undo_redo->add_do_method(this, "_update_libraries"); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "gdnative/singletons_disabled", undo_paths); + undo_redo->add_undo_method(this, "_update_libraries"); + undo_redo->commit_action(); +} + +void GDNativeLibrarySingletonEditor::_notification(int p_what) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + if (is_visible_in_tree()) { + _update_libraries(); + } + } +} + +void GDNativeLibrarySingletonEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_item_edited"), &GDNativeLibrarySingletonEditor::_item_edited); + ClassDB::bind_method(D_METHOD("_discover_singletons"), &GDNativeLibrarySingletonEditor::_discover_singletons); + ClassDB::bind_method(D_METHOD("_update_libraries"), &GDNativeLibrarySingletonEditor::_update_libraries); +} + +GDNativeLibrarySingletonEditor::GDNativeLibrarySingletonEditor() { + undo_redo = EditorNode::get_singleton()->get_undo_redo(); + libraries = memnew(Tree); + libraries->set_columns(2); + libraries->set_column_titles_visible(true); + libraries->set_column_title(0, TTR("Library")); + libraries->set_column_title(1, TTR("Status")); + libraries->set_hide_root(true); + add_margin_child(TTR("Libraries:"), libraries, true); + updating = false; + libraries->connect("item_edited", this, "_item_edited"); + EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_discover_singletons"); +} + +#endif // TOOLS_ENABLED diff --git a/gdnative_library_singleton_editor.h b/gdnative_library_singleton_editor.h new file mode 100644 index 0000000..1402f9e --- /dev/null +++ b/gdnative_library_singleton_editor.h @@ -0,0 +1,63 @@ +/**************************************************************************/ +/* gdnative_library_singleton_editor.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_LIBRARY_SINGLETON_EDITOR_H +#define GDNATIVE_LIBRARY_SINGLETON_EDITOR_H + +#ifdef TOOLS_ENABLED +#include "editor/editor_file_system.h" +#include "editor/project_settings_editor.h" + +class GDNativeLibrarySingletonEditor : public VBoxContainer { + GDCLASS(GDNativeLibrarySingletonEditor, VBoxContainer); + +private: + Tree *libraries; + UndoRedo *undo_redo; + + bool updating; + + static Set _find_singletons_recursive(EditorFileSystemDirectory *p_dir); + +protected: + void _notification(int p_what); + static void _bind_methods(); + + void _discover_singletons(); + void _item_edited(); + void _update_libraries(); + +public: + GDNativeLibrarySingletonEditor(); +}; + +#endif + +#endif // GDNATIVE_LIBRARY_SINGLETON_EDITOR_H diff --git a/icons/icon_g_d_native_library.svg b/icons/icon_g_d_native_library.svg new file mode 100644 index 0000000..b494c7a --- /dev/null +++ b/icons/icon_g_d_native_library.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/icons/icon_native_script.svg b/icons/icon_native_script.svg new file mode 100644 index 0000000..fb9e135 --- /dev/null +++ b/icons/icon_native_script.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/include/android/godot_android.h b/include/android/godot_android.h new file mode 100644 index 0000000..c018f39 --- /dev/null +++ b/include/android/godot_android.h @@ -0,0 +1,56 @@ +/**************************************************************************/ +/* godot_android.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_ANDROID_H +#define GODOT_ANDROID_H + +#include + +#ifdef __ANDROID__ +#include +#else +#define JNIEnv void +#define jobject void * +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +JNIEnv *GDAPI godot_android_get_env(); +jobject GDAPI godot_android_get_activity(); +jobject GDAPI godot_android_get_surface(); +bool GDAPI godot_android_is_activity_resumed(); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_ANDROID_H diff --git a/include/arvr/godot_arvr.h b/include/arvr/godot_arvr.h new file mode 100644 index 0000000..7165cce --- /dev/null +++ b/include/arvr/godot_arvr.h @@ -0,0 +1,98 @@ +/**************************************************************************/ +/* godot_arvr.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_ARVR_H +#define GODOT_ARVR_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// For future versions of the API we should only add new functions at the end of the structure and use the +// version info to detect whether a call is available + +// Use these to populate version in your plugin +#define GODOTVR_API_MAJOR 1 +#define GODOTVR_API_MINOR 2 + +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + void *(*constructor)(godot_object *); + void (*destructor)(void *); + godot_string (*get_name)(const void *); + godot_int (*get_capabilities)(const void *); + godot_bool (*get_anchor_detection_is_enabled)(const void *); + void (*set_anchor_detection_is_enabled)(void *, godot_bool); + godot_bool (*is_stereo)(const void *); + godot_bool (*is_initialized)(const void *); + godot_bool (*initialize)(void *); + void (*uninitialize)(void *); + godot_vector2 (*get_render_targetsize)(const void *); + godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *); + void (*fill_projection_for_eye)(void *, godot_real *, godot_int, godot_real, godot_real, godot_real); + void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *); + void (*process)(void *); + // only in 1.1 onwards + godot_int (*get_external_texture_for_eye)(void *, godot_int); + void (*notification)(void *, godot_int); + godot_int (*get_camera_feed_id)(void *); + // only in 1.2 onwards + godot_int (*get_external_depth_for_eye)(void *, godot_int); +} godot_arvr_interface_gdnative; + +void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface); + +// helper functions to access ARVRServer data +godot_real GDAPI godot_arvr_get_worldscale(); +godot_transform GDAPI godot_arvr_get_reference_frame(); + +// helper functions for rendering +void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect); +godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target); + +// helper functions for updating ARVR controllers +godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position); +void GDAPI godot_arvr_remove_controller(godot_int p_controller_id); +void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position); +void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed); +void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative); +godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id); + +// ARVR 1.2 functions +void GDAPI godot_arvr_set_interface(godot_object *p_arvr_interface, const godot_arvr_interface_gdnative *p_gdn_interface); +godot_int GDAPI godot_arvr_get_depthid(godot_rid *p_render_target); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_ARVR_H diff --git a/include/gdnative/aabb.h b/include/gdnative/aabb.h new file mode 100644 index 0000000..7c77b15 --- /dev/null +++ b/include/gdnative/aabb.h @@ -0,0 +1,118 @@ +/**************************************************************************/ +/* aabb.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_AABB_H +#define GDNATIVE_AABB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_AABB_SIZE 24 + +#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_AABB_SIZE]; +} godot_aabb; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); + +godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self); +void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v); + +godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self); +void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v); + +godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self); + +godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self); + +godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self); + +godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self); + +godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane); + +godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); + +godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point); + +godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir); + +godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self); + +godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self); + +godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self); + +godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self); + +godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self); + +godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self); + +godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point); + +godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by); + +godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx); + +godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_AABB_H diff --git a/include/gdnative/array.h b/include/gdnative/array.h new file mode 100644 index 0000000..b25cb2a --- /dev/null +++ b/include/gdnative/array.h @@ -0,0 +1,147 @@ +/**************************************************************************/ +/* array.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_ARRAY_H +#define GDNATIVE_ARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_ARRAY_SIZE]; +} godot_array; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_array_new(godot_array *r_dest); +void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src); +void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca); +void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a); +void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a); +void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa); +void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra); +void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia); +void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba); + +void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); + +godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx); + +godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx); + +const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx); + +void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value); + +void GDAPI godot_array_clear(godot_array *p_self); + +godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value); + +godot_bool GDAPI godot_array_empty(const godot_array *p_self); + +void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value); + +godot_variant GDAPI godot_array_front(const godot_array *p_self); + +godot_variant GDAPI godot_array_back(const godot_array *p_self); + +godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); + +godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what); + +godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value); + +godot_int GDAPI godot_array_hash(const godot_array *p_self); + +void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value); + +void GDAPI godot_array_invert(godot_array *p_self); + +godot_variant GDAPI godot_array_pop_back(godot_array *p_self); + +godot_variant GDAPI godot_array_pop_front(godot_array *p_self); + +void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value); + +void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value); + +void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx); + +void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size); + +godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); + +godot_int GDAPI godot_array_size(const godot_array *p_self); + +void GDAPI godot_array_sort(godot_array *p_self); + +void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func); + +godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before); + +godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before); + +void GDAPI godot_array_destroy(godot_array *p_self); + +godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_bool p_deep); + +godot_array GDAPI godot_array_slice(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep); + +godot_variant GDAPI godot_array_max(const godot_array *p_self); + +godot_variant GDAPI godot_array_min(const godot_array *p_self); + +void GDAPI godot_array_shuffle(godot_array *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_ARRAY_H diff --git a/include/gdnative/basis.h b/include/gdnative/basis.h new file mode 100644 index 0000000..f3ef388 --- /dev/null +++ b/include/gdnative/basis.h @@ -0,0 +1,136 @@ +/**************************************************************************/ +/* basis.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_BASIS_H +#define GDNATIVE_BASIS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_BASIS_SIZE 36 + +#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_BASIS_SIZE]; +} godot_basis; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis); +void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi); +void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler); +void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler); + +godot_string GDAPI godot_basis_as_string(const godot_basis *p_self); + +godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self); + +godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self); + +godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self); + +godot_real GDAPI godot_basis_determinant(const godot_basis *p_self); + +godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi); + +godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale); + +godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self); + +godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self); + +godot_quat GDAPI godot_basis_get_quat(const godot_basis *p_self); + +void GDAPI godot_basis_set_quat(godot_basis *p_self, const godot_quat *p_quat); + +void GDAPI godot_basis_set_axis_angle_scale(godot_basis *p_self, const godot_vector3 *p_axis, godot_real p_phi, const godot_vector3 *p_scale); + +void GDAPI godot_basis_set_euler_scale(godot_basis *p_self, const godot_vector3 *p_euler, const godot_vector3 *p_scale); + +void GDAPI godot_basis_set_quat_scale(godot_basis *p_self, const godot_quat *p_quat, const godot_vector3 *p_scale); + +godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with); + +godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with); + +godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with); + +godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v); + +godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v); + +godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self); + +void GDAPI godot_basis_new(godot_basis *r_dest); + +// p_elements is a pointer to an array of 3 (!!) vector3 +void GDAPI godot_basis_get_elements(const godot_basis *p_self, godot_vector3 *p_elements); + +godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis); + +void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value); + +godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row); + +void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value); + +godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b); + +godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b); + +godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b); + +godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b); + +godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b); + +godot_basis GDAPI godot_basis_slerp(const godot_basis *p_self, const godot_basis *p_b, const godot_real p_t); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_BASIS_H diff --git a/include/gdnative/color.h b/include/gdnative/color.h new file mode 100644 index 0000000..aff6d81 --- /dev/null +++ b/include/gdnative/color.h @@ -0,0 +1,120 @@ +/**************************************************************************/ +/* color.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_COLOR_H +#define GDNATIVE_COLOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_COLOR_SIZE 16 + +#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_COLOR_SIZE]; +} godot_color; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a); +void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b); + +godot_real godot_color_get_r(const godot_color *p_self); +void godot_color_set_r(godot_color *p_self, const godot_real r); + +godot_real godot_color_get_g(const godot_color *p_self); +void godot_color_set_g(godot_color *p_self, const godot_real g); + +godot_real godot_color_get_b(const godot_color *p_self); +void godot_color_set_b(godot_color *p_self, const godot_real b); + +godot_real godot_color_get_a(const godot_color *p_self); +void godot_color_set_a(godot_color *p_self, const godot_real a); + +godot_real godot_color_get_h(const godot_color *p_self); +godot_real godot_color_get_s(const godot_color *p_self); +godot_real godot_color_get_v(const godot_color *p_self); + +godot_string GDAPI godot_color_as_string(const godot_color *p_self); + +godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self); + +godot_int GDAPI godot_color_to_abgr32(const godot_color *p_self); + +godot_int GDAPI godot_color_to_abgr64(const godot_color *p_self); + +godot_int GDAPI godot_color_to_argb64(const godot_color *p_self); + +godot_int GDAPI godot_color_to_rgba64(const godot_color *p_self); + +godot_int GDAPI godot_color_to_argb32(const godot_color *p_self); + +godot_real GDAPI godot_color_gray(const godot_color *p_self); + +godot_color GDAPI godot_color_inverted(const godot_color *p_self); + +godot_color GDAPI godot_color_contrasted(const godot_color *p_self); + +godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t); + +godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over); + +godot_color GDAPI godot_color_darkened(const godot_color *p_self, const godot_real p_amount); + +godot_color GDAPI godot_color_from_hsv(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a); + +godot_color GDAPI godot_color_lightened(const godot_color *p_self, const godot_real p_amount); + +godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha); + +godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b); + +godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_COLOR_H diff --git a/include/gdnative/dictionary.h b/include/gdnative/dictionary.h new file mode 100644 index 0000000..18a7a7b --- /dev/null +++ b/include/gdnative/dictionary.h @@ -0,0 +1,113 @@ +/**************************************************************************/ +/* dictionary.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_DICTIONARY_H +#define GDNATIVE_DICTIONARY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_DICTIONARY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_DICTIONARY_SIZE]; +} godot_dictionary; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_dictionary_new(godot_dictionary *r_dest); +void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src); +void GDAPI godot_dictionary_destroy(godot_dictionary *p_self); + +godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep); + +godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self); + +godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self); + +void GDAPI godot_dictionary_clear(godot_dictionary *p_self); + +godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key); + +godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys); + +void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key); + +godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self); + +godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self); + +godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self); + +godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key); +void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value); + +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key); + +const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key); + +godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key); + +godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b); + +godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self); + +// GDNative core 1.1 + +godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key); + +godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default); + +// GDNative core 1.3 + +void GDAPI godot_dictionary_merge(godot_dictionary *p_self, const godot_dictionary *p_dictionary, const godot_bool p_overwrite); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_DICTIONARY_H diff --git a/include/gdnative/gdnative.h b/include/gdnative/gdnative.h new file mode 100644 index 0000000..c0573d2 --- /dev/null +++ b/include/gdnative/gdnative.h @@ -0,0 +1,304 @@ +/**************************************************************************/ +/* gdnative.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_GDNATIVE_H +#define GDNATIVE_GDNATIVE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) || defined(__ANDROID__) +#define GDCALLINGCONV +#define GDAPI GDCALLINGCONV +#elif defined(__APPLE__) +#include "TargetConditionals.h" +#if TARGET_OS_IPHONE +#define GDCALLINGCONV __attribute__((visibility("default"))) +#define GDAPI GDCALLINGCONV +#elif TARGET_OS_MAC +#define GDCALLINGCONV __attribute__((sysv_abi)) +#define GDAPI GDCALLINGCONV +#endif +#else // !_WIN32 && !__APPLE__ +#define GDCALLINGCONV __attribute__((sysv_abi)) +#define GDAPI GDCALLINGCONV +#endif + +// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! +#if !defined(GDN_EXPORT) +#if defined(_WIN32) +#define GDN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) +#define GDN_EXPORT __attribute__((visibility("default"))) +#else +#define GDN_EXPORT +#endif +#endif + +#include +#include + +#define GODOT_API_VERSION 1 + +////// Error + +typedef enum { + GODOT_OK, // (0) + GODOT_FAILED, ///< Generic fail error + GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable + GODOT_ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet + GODOT_ERR_UNAUTHORIZED, ///< Missing credentials for requested resource + GODOT_ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5) + GODOT_ERR_OUT_OF_MEMORY, ///< Out of memory + GODOT_ERR_FILE_NOT_FOUND, + GODOT_ERR_FILE_BAD_DRIVE, + GODOT_ERR_FILE_BAD_PATH, + GODOT_ERR_FILE_NO_PERMISSION, // (10) + GODOT_ERR_FILE_ALREADY_IN_USE, + GODOT_ERR_FILE_CANT_OPEN, + GODOT_ERR_FILE_CANT_WRITE, + GODOT_ERR_FILE_CANT_READ, + GODOT_ERR_FILE_UNRECOGNIZED, // (15) + GODOT_ERR_FILE_CORRUPT, + GODOT_ERR_FILE_MISSING_DEPENDENCIES, + GODOT_ERR_FILE_EOF, + GODOT_ERR_CANT_OPEN, ///< Can't open a resource/socket/file + GODOT_ERR_CANT_CREATE, // (20) + GODOT_ERR_QUERY_FAILED, + GODOT_ERR_ALREADY_IN_USE, + GODOT_ERR_LOCKED, ///< resource is locked + GODOT_ERR_TIMEOUT, + GODOT_ERR_CANT_CONNECT, // (25) + GODOT_ERR_CANT_RESOLVE, + GODOT_ERR_CONNECTION_ERROR, + GODOT_ERR_CANT_ACQUIRE_RESOURCE, + GODOT_ERR_CANT_FORK, + GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30) + GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid + GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists + GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist + GODOT_ERR_DATABASE_CANT_READ, ///< database is full + GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35) + GODOT_ERR_COMPILATION_FAILED, + GODOT_ERR_METHOD_NOT_FOUND, + GODOT_ERR_LINK_FAILED, + GODOT_ERR_SCRIPT_FAILED, + GODOT_ERR_CYCLIC_LINK, // (40) + GODOT_ERR_INVALID_DECLARATION, + GODOT_ERR_DUPLICATE_SYMBOL, + GODOT_ERR_PARSE_ERROR, + GODOT_ERR_BUSY, + GODOT_ERR_SKIP, // (45) + GODOT_ERR_HELP, ///< user requested help!! + GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior. + GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames +} godot_error; + +////// bool + +typedef bool godot_bool; + +#define GODOT_TRUE 1 +#define GODOT_FALSE 0 + +/////// int + +typedef int godot_int; + +/////// real + +typedef float godot_real; + +/////// Object (forward declared) +typedef void godot_object; + +/////// String + +#include + +/////// String name + +#include + +////// Vector2 + +#include + +////// Rect2 + +#include + +////// Vector3 + +#include + +////// Transform2D + +#include + +/////// Plane + +#include + +/////// Quat + +#include + +/////// AABB + +#include + +/////// Basis + +#include + +/////// Transform + +#include + +/////// Color + +#include + +/////// NodePath + +#include + +/////// RID + +#include + +/////// Dictionary + +#include + +/////// Array + +#include + +// single API file for Pool*Array +#include + +void GDAPI godot_object_destroy(godot_object *p_o); + +////// Variant + +#include + +////// Singleton API + +godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed + +////// MethodBind API + +typedef struct { + uint8_t _dont_touch_that[1]; // TODO +} godot_method_bind; + +godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname); +void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *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); +////// Script API + +typedef struct godot_gdnative_api_version { + unsigned int major; + unsigned int minor; +} godot_gdnative_api_version; + +typedef struct godot_gdnative_api_struct godot_gdnative_api_struct; + +struct godot_gdnative_api_struct { + unsigned int type; + godot_gdnative_api_version version; + const godot_gdnative_api_struct *next; +}; + +#define GDNATIVE_VERSION_COMPATIBLE(want, have) (want.major == have.major && want.minor <= have.minor) + +typedef struct { + godot_bool in_editor; + uint64_t core_api_hash; + uint64_t editor_api_hash; + uint64_t no_api_hash; + void (*report_version_mismatch)(const godot_object *p_library, const char *p_what, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have); + void (*report_loading_error)(const godot_object *p_library, const char *p_what); + godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized + const struct godot_gdnative_core_api_struct *api_struct; + const godot_string *active_library_path; +} godot_gdnative_init_options; + +typedef struct { + godot_bool in_editor; +} godot_gdnative_terminate_options; + +// Calling convention? +typedef godot_object *(*godot_class_constructor)(); + +godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname); + +godot_dictionary GDAPI godot_get_global_constants(); + +////// GDNative procedure types +typedef void (*godot_gdnative_init_fn)(godot_gdnative_init_options *); +typedef void (*godot_gdnative_terminate_fn)(godot_gdnative_terminate_options *); +typedef godot_variant (*godot_gdnative_procedure_fn)(godot_array *); + +////// System Functions + +typedef godot_variant (*native_call_cb)(void *, godot_array *); +void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback); + +//using these will help Godot track how much memory is in use in debug mode +void GDAPI *godot_alloc(int p_bytes); +void GDAPI *godot_realloc(void *p_ptr, int p_bytes); +void GDAPI godot_free(void *p_ptr); + +//print using Godot's error handler list +void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line); +void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line); +void GDAPI godot_print(const godot_string *p_message); + +// GDNATIVE CORE 1.0.1 + +bool GDAPI godot_is_instance_valid(const godot_object *p_object); + +//tags used for safe dynamic casting +void GDAPI *godot_get_class_tag(const godot_string_name *p_class); +godot_object GDAPI *godot_object_cast_to(const godot_object *p_object, void *p_class_tag); + +// equivalent of GDScript's instance_from_id +godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_GDNATIVE_H diff --git a/include/gdnative/node_path.h b/include/gdnative/node_path.h new file mode 100644 index 0000000..9d9f679 --- /dev/null +++ b/include/gdnative/node_path.h @@ -0,0 +1,89 @@ +/**************************************************************************/ +/* node_path.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_NODE_PATH_H +#define GDNATIVE_NODE_PATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_NODE_PATH_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_NODE_PATH_SIZE]; +} godot_node_path; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from); +void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src); +void GDAPI godot_node_path_destroy(godot_node_path *p_self); + +godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self); + +godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self); + +godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self); + +godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx); + +godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self); + +godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx); + +godot_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self); + +godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self); + +godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b); + +godot_node_path godot_node_path_get_as_property_path(const godot_node_path *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_NODE_PATH_H diff --git a/include/gdnative/plane.h b/include/gdnative/plane.h new file mode 100644 index 0000000..b66c87b --- /dev/null +++ b/include/gdnative/plane.h @@ -0,0 +1,103 @@ +/**************************************************************************/ +/* plane.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_PLANE_H +#define GDNATIVE_PLANE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_PLANE_SIZE 16 + +#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_PLANE_SIZE]; +} godot_plane; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d); +void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3); +void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d); + +godot_string GDAPI godot_plane_as_string(const godot_plane *p_self); + +godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self); + +godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self); + +godot_vector3 GDAPI godot_plane_get_any_point(const godot_plane *p_self); + +godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point); + +godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point); + +godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon); + +godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point); + +godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c); + +godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir); + +godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end); + +godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self); + +godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b); + +void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal); + +godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self); + +godot_real GDAPI godot_plane_get_d(const godot_plane *p_self); + +void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_PLANE_H diff --git a/include/gdnative/pool_arrays.h b/include/gdnative/pool_arrays.h new file mode 100644 index 0000000..32c539a --- /dev/null +++ b/include/gdnative/pool_arrays.h @@ -0,0 +1,508 @@ +/**************************************************************************/ +/* pool_arrays.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_POOL_ARRAYS_H +#define GDNATIVE_POOL_ARRAYS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/////// Read Access + +#define GODOT_POOL_ARRAY_READ_ACCESS_SIZE 1 + +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_ARRAY_READ_ACCESS_SIZE]; +} godot_pool_array_read_access; + +typedef godot_pool_array_read_access godot_pool_byte_array_read_access; +typedef godot_pool_array_read_access godot_pool_int_array_read_access; +typedef godot_pool_array_read_access godot_pool_real_array_read_access; +typedef godot_pool_array_read_access godot_pool_string_array_read_access; +typedef godot_pool_array_read_access godot_pool_vector2_array_read_access; +typedef godot_pool_array_read_access godot_pool_vector3_array_read_access; +typedef godot_pool_array_read_access godot_pool_color_array_read_access; + +/////// Write Access + +#define GODOT_POOL_ARRAY_WRITE_ACCESS_SIZE 1 + +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_ARRAY_WRITE_ACCESS_SIZE]; +} godot_pool_array_write_access; + +typedef godot_pool_array_write_access godot_pool_byte_array_write_access; +typedef godot_pool_array_write_access godot_pool_int_array_write_access; +typedef godot_pool_array_write_access godot_pool_real_array_write_access; +typedef godot_pool_array_write_access godot_pool_string_array_write_access; +typedef godot_pool_array_write_access godot_pool_vector2_array_write_access; +typedef godot_pool_array_write_access godot_pool_vector3_array_write_access; +typedef godot_pool_array_write_access godot_pool_color_array_write_access; + +/////// PoolByteArray + +#define GODOT_POOL_BYTE_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_BYTE_ARRAY_SIZE]; +} godot_pool_byte_array; +#endif + +/////// PoolIntArray + +#define GODOT_POOL_INT_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_INT_ARRAY_SIZE]; +} godot_pool_int_array; +#endif + +/////// PoolRealArray + +#define GODOT_POOL_REAL_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_REAL_ARRAY_SIZE]; +} godot_pool_real_array; +#endif + +/////// PoolStringArray + +#define GODOT_POOL_STRING_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_STRING_ARRAY_SIZE]; +} godot_pool_string_array; +#endif + +/////// PoolVector2Array + +#define GODOT_POOL_VECTOR2_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_VECTOR2_ARRAY_SIZE]; +} godot_pool_vector2_array; +#endif + +/////// PoolVector3Array + +#define GODOT_POOL_VECTOR3_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_VECTOR3_ARRAY_SIZE]; +} godot_pool_vector3_array; +#endif + +/////// PoolColorArray + +#define GODOT_POOL_COLOR_ARRAY_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_COLOR_ARRAY_SIZE]; +} godot_pool_color_array; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// byte + +void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest); +void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src); +void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data); + +void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array); + +godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); + +void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self); + +void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data); + +void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_byte_array_sort(godot_pool_byte_array *p_self); + +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self); + +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self); + +void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); +uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self); + +godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self); + +godot_bool GDAPI godot_pool_byte_array_has(const godot_pool_byte_array *p_self, const uint8_t p_data); + +void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self); + +// int + +void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest); +void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src); +void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data); + +void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array); + +godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); + +void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self); + +void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data); + +void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_int_array_sort(godot_pool_int_array *p_self); + +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self); + +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self); + +void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); +godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self); + +godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self); + +godot_bool GDAPI godot_pool_int_array_has(const godot_pool_int_array *p_self, const godot_int p_data); + +void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self); + +// real + +void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest); +void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src); +void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data); + +void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array); + +godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); + +void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self); + +void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data); + +void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_real_array_sort(godot_pool_real_array *p_self); + +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self); + +godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self); + +void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); +godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self); + +godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self); + +godot_bool GDAPI godot_pool_real_array_has(const godot_pool_real_array *p_self, const godot_real p_data); + +void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self); + +// string + +void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest); +void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src); +void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data); + +void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array); + +godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); + +void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self); + +godot_string GDAPI godot_pool_string_array_join(const godot_pool_string_array *p_self, const godot_string *p_delimiter); + +void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data); + +void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_string_array_sort(godot_pool_string_array *p_self); + +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self); + +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self); + +void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); +godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self); + +godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self); + +godot_bool GDAPI godot_pool_string_array_has(const godot_pool_string_array *p_self, const godot_string *p_data); + +void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self); + +// vector2 + +void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest); +void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src); +void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); + +void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array); + +godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); + +void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self); + +void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); + +void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_vector2_array_sort(godot_pool_vector2_array *p_self); + +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self); + +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self); + +void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); +godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self); + +godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self); + +godot_bool GDAPI godot_pool_vector2_array_has(const godot_pool_vector2_array *p_self, const godot_vector2 *p_data); + +void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self); + +// vector3 + +void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest); +void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src); +void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); + +void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array); + +godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); + +void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self); + +void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); + +void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_vector3_array_sort(godot_pool_vector3_array *p_self); + +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self); + +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self); + +void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); +godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self); + +godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self); + +godot_bool GDAPI godot_pool_vector3_array_has(const godot_pool_vector3_array *p_self, const godot_vector3 *p_data); + +void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self); + +// color + +void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest); +void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src); +void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a); + +void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data); + +void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array); + +godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); + +void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self); + +void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data); + +void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx); + +void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size); + +void GDAPI godot_pool_color_array_sort(godot_pool_color_array *p_self); + +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self); + +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self); + +void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); +godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self); + +godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self); + +godot_bool GDAPI godot_pool_color_array_has(const godot_pool_color_array *p_self, const godot_color *p_data); + +void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); + +// +// read accessor functions +// + +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read_access_copy(const godot_pool_byte_array_read_access *p_other); +const uint8_t GDAPI *godot_pool_byte_array_read_access_ptr(const godot_pool_byte_array_read_access *p_read); +void GDAPI godot_pool_byte_array_read_access_operator_assign(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other); +void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_access *p_read); + +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read_access_copy(const godot_pool_int_array_read_access *p_other); +const godot_int GDAPI *godot_pool_int_array_read_access_ptr(const godot_pool_int_array_read_access *p_read); +void GDAPI godot_pool_int_array_read_access_operator_assign(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other); +void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_access *p_read); + +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read_access_copy(const godot_pool_real_array_read_access *p_other); +const godot_real GDAPI *godot_pool_real_array_read_access_ptr(const godot_pool_real_array_read_access *p_read); +void GDAPI godot_pool_real_array_read_access_operator_assign(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other); +void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_access *p_read); + +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read_access_copy(const godot_pool_string_array_read_access *p_other); +const godot_string GDAPI *godot_pool_string_array_read_access_ptr(const godot_pool_string_array_read_access *p_read); +void GDAPI godot_pool_string_array_read_access_operator_assign(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other); +void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_read_access *p_read); + +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read_access_copy(const godot_pool_vector2_array_read_access *p_other); +const godot_vector2 GDAPI *godot_pool_vector2_array_read_access_ptr(const godot_pool_vector2_array_read_access *p_read); +void GDAPI godot_pool_vector2_array_read_access_operator_assign(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other); +void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array_read_access *p_read); + +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read_access_copy(const godot_pool_vector3_array_read_access *p_other); +const godot_vector3 GDAPI *godot_pool_vector3_array_read_access_ptr(const godot_pool_vector3_array_read_access *p_read); +void GDAPI godot_pool_vector3_array_read_access_operator_assign(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other); +void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array_read_access *p_read); + +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read_access_copy(const godot_pool_color_array_read_access *p_other); +const godot_color GDAPI *godot_pool_color_array_read_access_ptr(const godot_pool_color_array_read_access *p_read); +void GDAPI godot_pool_color_array_read_access_operator_assign(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other); +void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_read_access *p_read); + +// +// write accessor functions +// + +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write_access_copy(const godot_pool_byte_array_write_access *p_other); +uint8_t GDAPI *godot_pool_byte_array_write_access_ptr(const godot_pool_byte_array_write_access *p_write); +void GDAPI godot_pool_byte_array_write_access_operator_assign(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other); +void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_write_access *p_write); + +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write_access_copy(const godot_pool_int_array_write_access *p_other); +godot_int GDAPI *godot_pool_int_array_write_access_ptr(const godot_pool_int_array_write_access *p_write); +void GDAPI godot_pool_int_array_write_access_operator_assign(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other); +void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_access *p_write); + +godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write_access_copy(const godot_pool_real_array_write_access *p_other); +godot_real GDAPI *godot_pool_real_array_write_access_ptr(const godot_pool_real_array_write_access *p_write); +void GDAPI godot_pool_real_array_write_access_operator_assign(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other); +void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_write_access *p_write); + +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write_access_copy(const godot_pool_string_array_write_access *p_other); +godot_string GDAPI *godot_pool_string_array_write_access_ptr(const godot_pool_string_array_write_access *p_write); +void GDAPI godot_pool_string_array_write_access_operator_assign(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other); +void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_write_access *p_write); + +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write_access_copy(const godot_pool_vector2_array_write_access *p_other); +godot_vector2 GDAPI *godot_pool_vector2_array_write_access_ptr(const godot_pool_vector2_array_write_access *p_write); +void GDAPI godot_pool_vector2_array_write_access_operator_assign(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other); +void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_array_write_access *p_write); + +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write_access_copy(const godot_pool_vector3_array_write_access *p_other); +godot_vector3 GDAPI *godot_pool_vector3_array_write_access_ptr(const godot_pool_vector3_array_write_access *p_write); +void GDAPI godot_pool_vector3_array_write_access_operator_assign(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other); +void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_array_write_access *p_write); + +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write_access_copy(const godot_pool_color_array_write_access *p_other); +godot_color GDAPI *godot_pool_color_array_write_access_ptr(const godot_pool_color_array_write_access *p_write); +void GDAPI godot_pool_color_array_write_access_operator_assign(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other); +void GDAPI godot_pool_color_array_write_access_destroy(godot_pool_color_array_write_access *p_write); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_POOL_ARRAYS_H diff --git a/include/gdnative/quat.h b/include/gdnative/quat.h new file mode 100644 index 0000000..c6e906e --- /dev/null +++ b/include/gdnative/quat.h @@ -0,0 +1,118 @@ +/**************************************************************************/ +/* quat.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_QUAT_H +#define GDNATIVE_QUAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_QUAT_SIZE 16 + +#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_QUAT_SIZE]; +} godot_quat; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w); +void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle); +void GDAPI godot_quat_new_with_basis(godot_quat *r_dest, const godot_basis *p_basis); +void GDAPI godot_quat_new_with_euler(godot_quat *r_dest, const godot_vector3 *p_euler); + +godot_real GDAPI godot_quat_get_x(const godot_quat *p_self); +void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val); + +godot_real GDAPI godot_quat_get_y(const godot_quat *p_self); +void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val); + +godot_real GDAPI godot_quat_get_z(const godot_quat *p_self); +void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val); + +godot_real GDAPI godot_quat_get_w(const godot_quat *p_self); +void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val); + +godot_string GDAPI godot_quat_as_string(const godot_quat *p_self); + +godot_real GDAPI godot_quat_length(const godot_quat *p_self); + +godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self); + +godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self); + +godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self); + +godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self); + +godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b); + +godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v); + +godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); + +godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); + +godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t); + +godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b); + +godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b); + +godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b); + +godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b); + +godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b); + +godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self); + +void GDAPI godot_quat_set_axis_angle(godot_quat *p_self, const godot_vector3 *p_axis, const godot_real p_angle); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_QUAT_H diff --git a/include/gdnative/rect2.h b/include/gdnative/rect2.h new file mode 100644 index 0000000..14fbf55 --- /dev/null +++ b/include/gdnative/rect2.h @@ -0,0 +1,102 @@ +/**************************************************************************/ +/* rect2.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_RECT2_H +#define GDNATIVE_RECT2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED +typedef struct godot_rect2 { + uint8_t _dont_touch_that[16]; +} godot_rect2; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); +void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height); + +godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self); + +godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self); + +godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b); + +godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b); + +godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self); + +godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b); + +godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b); + +godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point); + +godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by); + +godot_rect2 GDAPI godot_rect2_grow_individual(const godot_rect2 *p_self, const godot_real p_left, const godot_real p_top, const godot_real p_right, const godot_real p_bottom); + +godot_rect2 GDAPI godot_rect2_grow_margin(const godot_rect2 *p_self, const godot_int p_margin, const godot_real p_by); + +godot_rect2 GDAPI godot_rect2_abs(const godot_rect2 *p_self); + +godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to); + +godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b); + +godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self); + +godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self); + +void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos); + +void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_RECT2_H diff --git a/include/gdnative/rid.h b/include/gdnative/rid.h new file mode 100644 index 0000000..fedc4c1 --- /dev/null +++ b/include/gdnative/rid.h @@ -0,0 +1,74 @@ +/**************************************************************************/ +/* rid.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_RID_H +#define GDNATIVE_RID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_RID_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_RID_SIZE]; +} godot_rid; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_rid_new(godot_rid *r_dest); + +godot_int GDAPI godot_rid_get_id(const godot_rid *p_self); + +void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from); + +godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b); + +godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_RID_H diff --git a/include/gdnative/string.h b/include/gdnative/string.h new file mode 100644 index 0000000..2d96d17 --- /dev/null +++ b/include/gdnative/string.h @@ -0,0 +1,267 @@ +/**************************************************************************/ +/* string.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_STRING_H +#define GDNATIVE_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef wchar_t godot_char_type; + +#define GODOT_STRING_SIZE sizeof(void *) +#define GODOT_CHAR_STRING_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_STRING_SIZE]; +} godot_string; + +#endif + +#ifndef GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_CHAR_STRING_SIZE]; +} godot_char_string; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs); +const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs); +void GDAPI godot_char_string_destroy(godot_char_string *p_cs); + +void GDAPI godot_string_new(godot_string *r_dest); +void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); +void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size); + +const wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx); +wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx); +const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self); + +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b); +godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b); +godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b); + +/* Standard size stuff */ + +godot_int GDAPI godot_string_length(const godot_string *p_self); + +/* Helpers */ + +signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str); +signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str); +signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str); + +godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string); +godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array); +godot_array GDAPI godot_string_bigrams(const godot_string *p_self); +godot_string GDAPI godot_string_chr(wchar_t p_character); +godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string); +godot_int GDAPI godot_string_count(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to); +godot_int GDAPI godot_string_countn(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to); +godot_int GDAPI godot_string_find(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_find_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_array *p_keys); +godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_array *p_keys, godot_int p_from); +godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key); +godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_find_last(const godot_string *p_self, godot_string p_what); +godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values); +godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder); +godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len); +godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self); +godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self); +godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, godot_string p_string); +godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self); +godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string); +godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string); +godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length); +godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); +godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard); +godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard); +godot_string GDAPI godot_string_md5(const uint8_t *p_md5); +godot_string GDAPI godot_string_num(double p_num); +godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base); +godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); +godot_string GDAPI godot_string_num_uint64(uint64_t p_num, godot_int p_base); +godot_string GDAPI godot_string_num_uint64_capitalized(uint64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); +godot_string GDAPI godot_string_num_real(double p_num); +godot_string GDAPI godot_string_num_scientific(double p_num); +godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals); +godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits); +godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits); +godot_string GDAPI godot_string_replace_first(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_string GDAPI godot_string_replace(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_string GDAPI godot_string_replacen(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_int GDAPI godot_string_rfind(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_rfindn(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length); +godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); +godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string); +godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); +godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars); +double GDAPI godot_string_to_double(const godot_string *p_self); +godot_real GDAPI godot_string_to_float(const godot_string *p_self); +godot_int GDAPI godot_string_to_int(const godot_string *p_self); + +godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self); +godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self); +godot_string GDAPI godot_string_capitalize(const godot_string *p_self); +double GDAPI godot_string_char_to_double(const char *p_what); +godot_int GDAPI godot_string_char_to_int(const char *p_what); +int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str); +godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len); +int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len); +int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self); +int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self); +int64_t GDAPI godot_string_to_int64(const godot_string *p_self); +double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end); + +godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter); +godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice); +godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice); + +godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_spaces(const godot_string *p_self); + +godot_string GDAPI godot_string_join(const godot_string *p_self, const godot_array *p_parts); + +wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char); +wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char); +godot_string GDAPI godot_string_to_lower(const godot_string *p_self); +godot_string GDAPI godot_string_to_upper(const godot_string *p_self); + +godot_string GDAPI godot_string_get_basename(const godot_string *p_self); +godot_string GDAPI godot_string_get_extension(const godot_string *p_self); +godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos); +wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx); +godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file); +godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos); +godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right); +godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self); + +void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars); + +godot_char_string GDAPI godot_string_ascii(const godot_string *p_self); +godot_char_string GDAPI godot_string_ascii_extended(const godot_string *p_self); +godot_char_string GDAPI godot_string_utf8(const godot_string *p_self); +godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8); +godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len); +godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8); +godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len); + +uint32_t GDAPI godot_string_hash(const godot_string *p_self); +uint64_t GDAPI godot_string_hash64(const godot_string *p_self); +uint32_t GDAPI godot_string_hash_chars(const char *p_cstr); +uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len); +uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str); +uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len); +godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self); +godot_string GDAPI godot_string_md5_text(const godot_string *p_self); +godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self); +godot_string GDAPI godot_string_sha256_text(const godot_string *p_self); + +godot_bool godot_string_empty(const godot_string *p_self); + +// path functions +godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self); +godot_string GDAPI godot_string_get_file(const godot_string *p_self); +godot_string GDAPI godot_string_humanize_size(uint64_t p_size); +godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self); +godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self); +godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self); +godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path); +godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path); +godot_string GDAPI godot_string_simplify_path(const godot_string *p_self); + +godot_string GDAPI godot_string_c_escape(const godot_string *p_self); +godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self); +godot_string GDAPI godot_string_c_unescape(const godot_string *p_self); +godot_string GDAPI godot_string_http_escape(const godot_string *p_self); +godot_string GDAPI godot_string_http_unescape(const godot_string *p_self); +godot_string GDAPI godot_string_json_escape(const godot_string *p_self); +godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line); +godot_string GDAPI godot_string_xml_escape(const godot_string *p_self); +godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self); +godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self); + +godot_string GDAPI godot_string_percent_decode(const godot_string *p_self); +godot_string GDAPI godot_string_percent_encode(const godot_string *p_self); + +godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix); +godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self); + +godot_string GDAPI godot_string_dedent(const godot_string *p_self); +godot_string GDAPI godot_string_trim_prefix(const godot_string *p_self, const godot_string *p_prefix); +godot_string GDAPI godot_string_trim_suffix(const godot_string *p_self, const godot_string *p_suffix); +godot_string GDAPI godot_string_rstrip(const godot_string *p_self, const godot_string *p_chars); +godot_pool_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_divisor, const godot_bool p_allow_empty, const godot_int p_maxsplit); + +void GDAPI godot_string_destroy(godot_string *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_STRING_H diff --git a/include/gdnative/string_name.h b/include/gdnative/string_name.h new file mode 100644 index 0000000..e8d7d06 --- /dev/null +++ b/include/gdnative/string_name.h @@ -0,0 +1,78 @@ +/**************************************************************************/ +/* string_name.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_STRING_NAME_H +#define GDNATIVE_STRING_NAME_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define GODOT_STRING_NAME_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_STRING_NAME_SIZE]; +} godot_string_name; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name); +void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name); + +godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self); + +uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self); +const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self); + +godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other); +godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other); + +void GDAPI godot_string_name_destroy(godot_string_name *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_STRING_NAME_H diff --git a/include/gdnative/transform.h b/include/gdnative/transform.h new file mode 100644 index 0000000..f3b9951 --- /dev/null +++ b/include/gdnative/transform.h @@ -0,0 +1,111 @@ +/**************************************************************************/ +/* transform.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_TRANSFORM_H +#define GDNATIVE_TRANSFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_TRANSFORM_SIZE 48 + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_TRANSFORM_SIZE]; +} godot_transform; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin); +void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); +void GDAPI godot_transform_new_with_quat(godot_transform *r_dest, const godot_quat *p_quat); + +godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self); +void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v); + +godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self); +void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v); + +godot_string GDAPI godot_transform_as_string(const godot_transform *p_self); + +godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self); + +godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self); + +godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self); + +godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi); + +godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale); + +godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs); + +godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up); + +godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v); + +godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v); + +void GDAPI godot_transform_new_identity(godot_transform *r_dest); + +godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b); + +godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b); + +godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v); + +godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v); + +godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v); + +godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_TRANSFORM_H diff --git a/include/gdnative/transform2d.h b/include/gdnative/transform2d.h new file mode 100644 index 0000000..4b997fb --- /dev/null +++ b/include/gdnative/transform2d.h @@ -0,0 +1,111 @@ +/**************************************************************************/ +/* transform2d.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_TRANSFORM2D_H +#define GDNATIVE_TRANSFORM2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_TRANSFORM2D_SIZE 24 + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_TRANSFORM2D_SIZE]; +} godot_transform2d; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos); +void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin); + +godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self); + +godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self); + +godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self); + +godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self); + +godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self); + +godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self); + +godot_real GDAPI godot_transform2d_determinant(const godot_transform2d *p_self); + +godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self); + +godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi); + +godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale); + +godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset); + +godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); + +godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); + +godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); + +godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); + +godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c); + +godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b); + +godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b); + +void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest); + +godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v); + +godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_TRANSFORM2D_H diff --git a/include/gdnative/variant.h b/include/gdnative/variant.h new file mode 100644 index 0000000..78e623f --- /dev/null +++ b/include/gdnative/variant.h @@ -0,0 +1,255 @@ +/**************************************************************************/ +/* variant.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_VARIANT_H +#define GDNATIVE_VARIANT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_VARIANT_SIZE (16 + sizeof(int64_t)) + +#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_VARIANT_SIZE]; +} godot_variant; +#endif + +typedef enum godot_variant_type { + GODOT_VARIANT_TYPE_NIL, + + // atomic types + GODOT_VARIANT_TYPE_BOOL, + GODOT_VARIANT_TYPE_INT, + GODOT_VARIANT_TYPE_REAL, + GODOT_VARIANT_TYPE_STRING, + + // math types + + GODOT_VARIANT_TYPE_VECTOR2, // 5 + GODOT_VARIANT_TYPE_RECT2, + GODOT_VARIANT_TYPE_VECTOR3, + GODOT_VARIANT_TYPE_TRANSFORM2D, + GODOT_VARIANT_TYPE_PLANE, + GODOT_VARIANT_TYPE_QUAT, // 10 + GODOT_VARIANT_TYPE_AABB, + GODOT_VARIANT_TYPE_BASIS, + GODOT_VARIANT_TYPE_TRANSFORM, + + // misc types + GODOT_VARIANT_TYPE_COLOR, + GODOT_VARIANT_TYPE_NODE_PATH, // 15 + GODOT_VARIANT_TYPE_RID, + GODOT_VARIANT_TYPE_OBJECT, + GODOT_VARIANT_TYPE_DICTIONARY, + GODOT_VARIANT_TYPE_ARRAY, // 20 + + // arrays + GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY, + GODOT_VARIANT_TYPE_POOL_INT_ARRAY, + GODOT_VARIANT_TYPE_POOL_REAL_ARRAY, + GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, + GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25 + GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, + GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, +} godot_variant_type; + +typedef enum godot_variant_call_error_error { + GODOT_CALL_ERROR_CALL_OK, + GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD, + GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT, + GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS, + GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS, + GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL, +} godot_variant_call_error_error; + +typedef struct godot_variant_call_error { + godot_variant_call_error_error error; + int argument; + godot_variant_type expected; +} godot_variant_call_error; + +typedef enum godot_variant_operator { + // comparison + GODOT_VARIANT_OP_EQUAL, + GODOT_VARIANT_OP_NOT_EQUAL, + GODOT_VARIANT_OP_LESS, + GODOT_VARIANT_OP_LESS_EQUAL, + GODOT_VARIANT_OP_GREATER, + GODOT_VARIANT_OP_GREATER_EQUAL, + + // mathematic + GODOT_VARIANT_OP_ADD, + GODOT_VARIANT_OP_SUBTRACT, + GODOT_VARIANT_OP_MULTIPLY, + GODOT_VARIANT_OP_DIVIDE, + GODOT_VARIANT_OP_NEGATE, + GODOT_VARIANT_OP_POSITIVE, + GODOT_VARIANT_OP_MODULE, + GODOT_VARIANT_OP_STRING_CONCAT, + + // bitwise + GODOT_VARIANT_OP_SHIFT_LEFT, + GODOT_VARIANT_OP_SHIFT_RIGHT, + GODOT_VARIANT_OP_BIT_AND, + GODOT_VARIANT_OP_BIT_OR, + GODOT_VARIANT_OP_BIT_XOR, + GODOT_VARIANT_OP_BIT_NEGATE, + + // logic + GODOT_VARIANT_OP_AND, + GODOT_VARIANT_OP_OR, + GODOT_VARIANT_OP_XOR, + GODOT_VARIANT_OP_NOT, + + // containment + GODOT_VARIANT_OP_IN, + + GODOT_VARIANT_OP_MAX, +} godot_variant_operator; + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v); + +void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src); + +void GDAPI godot_variant_new_nil(godot_variant *r_dest); + +void GDAPI godot_variant_new_bool(godot_variant *r_dest, const godot_bool p_b); +void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i); +void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i); +void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r); +void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s); +void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2); +void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2); +void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3); +void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d); +void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane); +void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat); +void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb); +void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis); +void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans); +void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color); +void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np); +void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid); +void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj); +void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict); +void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr); +void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba); +void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia); +void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra); +void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa); +void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a); +void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a); +void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca); + +godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self); +uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self); +int64_t GDAPI godot_variant_as_int(const godot_variant *p_self); +double GDAPI godot_variant_as_real(const godot_variant *p_self); +godot_string GDAPI godot_variant_as_string(const godot_variant *p_self); +godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self); +godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self); +godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self); +godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self); +godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self); +godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self); +godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self); +godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self); +godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self); +godot_color GDAPI godot_variant_as_color(const godot_variant *p_self); +godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self); +godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self); +godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self); +godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self); +godot_array GDAPI godot_variant_as_array(const godot_variant *p_self); +godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self); +godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self); +godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self); +godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self); +godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self); +godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self); +godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self); + +godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error); + +godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method); + +godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other); +godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other); + +godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other); + +godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self); + +void GDAPI godot_variant_destroy(godot_variant *p_self); + +// GDNative core 1.1 + +godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_op); +void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_VARIANT_H diff --git a/include/gdnative/vector2.h b/include/gdnative/vector2.h new file mode 100644 index 0000000..7853f2e --- /dev/null +++ b/include/gdnative/vector2.h @@ -0,0 +1,142 @@ +/**************************************************************************/ +/* vector2.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_VECTOR2_H +#define GDNATIVE_VECTOR2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_VECTOR2_SIZE 8 + +#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_VECTOR2_SIZE]; +} godot_vector2; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y); + +godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self); + +godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self); + +godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self); + +godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self); + +godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self); + +godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self); + +godot_vector2 GDAPI godot_vector2_direction_to(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to); + +godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to); + +godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to); + +godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to); + +godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t); + +godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t); + +godot_vector2 GDAPI godot_vector2_move_toward(const godot_vector2 *p_self, const godot_vector2 *p_to, const godot_real p_delta); + +godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi); + +godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self); + +godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self); + +godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by); + +godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self); + +godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with); + +godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n); + +godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n); + +godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n); + +godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self); + +godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length); + +godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b); + +godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b); + +godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b); + +godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self); + +void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x); + +void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y); + +godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self); + +godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_VECTOR2_H diff --git a/include/gdnative/vector3.h b/include/gdnative/vector3.h new file mode 100644 index 0000000..a66d7cf --- /dev/null +++ b/include/gdnative/vector3.h @@ -0,0 +1,149 @@ +/**************************************************************************/ +/* vector3.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GDNATIVE_VECTOR3_H +#define GDNATIVE_VECTOR3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_VECTOR3_SIZE 12 + +#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_VECTOR3_SIZE]; +} godot_vector3; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + GODOT_VECTOR3_AXIS_X, + GODOT_VECTOR3_AXIS_Y, + GODOT_VECTOR3_AXIS_Z, +} godot_vector3_axis; + +void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z); + +godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self); + +godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self); + +godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self); + +godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self); + +godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self); + +godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_vector3 *p_by); + +godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi); + +godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t); + +godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t); + +godot_vector3 GDAPI godot_vector3_move_toward(const godot_vector3 *p_self, const godot_vector3 *p_to, const godot_real p_delta); + +godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self); + +godot_vector3 GDAPI godot_vector3_direction_to(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to); + +godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n); + +godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n); + +godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n); + +godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b); + +godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b); + +godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b); + +godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self); + +void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val); + +godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis); + +#ifdef __cplusplus +} +#endif + +#endif // GDNATIVE_VECTOR3_H diff --git a/include/nativescript/godot_nativescript.h b/include/nativescript/godot_nativescript.h new file mode 100644 index 0000000..29aac06 --- /dev/null +++ b/include/nativescript/godot_nativescript.h @@ -0,0 +1,257 @@ +/**************************************************************************/ +/* godot_nativescript.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_NATIVESCRIPT_H +#define GODOT_NATIVESCRIPT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + GODOT_METHOD_RPC_MODE_DISABLED, + GODOT_METHOD_RPC_MODE_REMOTE, + GODOT_METHOD_RPC_MODE_MASTER, + GODOT_METHOD_RPC_MODE_PUPPET, + GODOT_METHOD_RPC_MODE_SLAVE = GODOT_METHOD_RPC_MODE_PUPPET, + GODOT_METHOD_RPC_MODE_REMOTESYNC, + GODOT_METHOD_RPC_MODE_SYNC = GODOT_METHOD_RPC_MODE_REMOTESYNC, + GODOT_METHOD_RPC_MODE_MASTERSYNC, + GODOT_METHOD_RPC_MODE_PUPPETSYNC, +} godot_method_rpc_mode; + +typedef enum { + GODOT_PROPERTY_HINT_NONE, ///< no hint provided. + GODOT_PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional" + GODOT_PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit + GODOT_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" + GODOT_PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) + GODOT_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer) + GODOT_PROPERTY_HINT_SPRITE_FRAME, // FIXME: Obsolete: drop whenever we can break compat + GODOT_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer) + GODOT_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) + GODOT_PROPERTY_HINT_LAYERS_2D_RENDER, + GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS, + GODOT_PROPERTY_HINT_LAYERS_2D_NAVIGATION, + GODOT_PROPERTY_HINT_LAYERS_3D_RENDER, + GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS, + GODOT_PROPERTY_HINT_LAYERS_3D_NAVIGATION, + GODOT_PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," + GODOT_PROPERTY_HINT_DIR, ///< a directory path must be passed + GODOT_PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," + GODOT_PROPERTY_HINT_GLOBAL_DIR, ///< a directory path must be passed + GODOT_PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type + GODOT_PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines + GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT, ///< used to set a placeholder text for string properties + GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color + GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY, + GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS, + GODOT_PROPERTY_HINT_OBJECT_ID, + GODOT_PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose + GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts) + GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type + GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type + GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance + GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base + GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type + GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type + GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance + GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base + GODOT_PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send + GODOT_PROPERTY_HINT_NODE_PATH_VALID_TYPES, + GODOT_PROPERTY_HINT_SAVE_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,". This opens a save dialog + GODOT_PROPERTY_HINT_ENUM_SUGGESTION, ///< hint_text= "val1,val2,val3,etc" + GODOT_PROPERTY_HINT_LOCALE_ID, + GODOT_PROPERTY_HINT_MAX, +} godot_property_hint; + +typedef enum { + + GODOT_PROPERTY_USAGE_STORAGE = 1, + GODOT_PROPERTY_USAGE_EDITOR = 2, + GODOT_PROPERTY_USAGE_NETWORK = 4, + GODOT_PROPERTY_USAGE_EDITOR_HELPER = 8, + GODOT_PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables + GODOT_PROPERTY_USAGE_CHECKED = 32, //used for editing global variables + GODOT_PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings + GODOT_PROPERTY_USAGE_GROUP = 128, //used for grouping props in the editor + GODOT_PROPERTY_USAGE_CATEGORY = 256, + GODOT_PROPERTY_USAGE_STORE_IF_NONZERO = 512, // FIXME: Obsolete: drop whenever we can break compat + GODOT_PROPERTY_USAGE_STORE_IF_NONONE = 1024, // FIXME: Obsolete: drop whenever we can break compat + GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE = 2048, + GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED = 4096, + GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE = 8192, + GODOT_PROPERTY_USAGE_STORE_IF_NULL = 16384, + GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768, + GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536, + + GODOT_PROPERTY_USAGE_DEFAULT = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK, + GODOT_PROPERTY_USAGE_DEFAULT_INTL = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED, + GODOT_PROPERTY_USAGE_NOEDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK, +} godot_property_usage_flags; + +typedef struct { + godot_method_rpc_mode rset_type; + + godot_int type; + godot_property_hint hint; + godot_string hint_string; + godot_property_usage_flags usage; + godot_variant default_value; +} godot_property_attributes; + +typedef struct { + // instance pointer, method_data - return user data + GDCALLINGCONV void *(*create_func)(godot_object *, void *); + void *method_data; + GDCALLINGCONV void (*free_func)(void *); +} godot_instance_create_func; + +typedef struct { + // instance pointer, method data, user data + GDCALLINGCONV void (*destroy_func)(godot_object *, void *, void *); + void *method_data; + GDCALLINGCONV void (*free_func)(void *); +} godot_instance_destroy_func; + +void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func); + +void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func); + +typedef struct { + godot_method_rpc_mode rpc_type; +} godot_method_attributes; + +typedef struct { + // instance pointer, method data, user data, num args, args - return result as variant + GDCALLINGCONV godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **); + void *method_data; + GDCALLINGCONV void (*free_func)(void *); +} godot_instance_method; + +void GDAPI godot_nativescript_register_method(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method); + +typedef struct { + // instance pointer, method data, user data, value + GDCALLINGCONV void (*set_func)(godot_object *, void *, void *, godot_variant *); + void *method_data; + GDCALLINGCONV void (*free_func)(void *); +} godot_property_set_func; + +typedef struct { + // instance pointer, method data, user data, value + GDCALLINGCONV godot_variant (*get_func)(godot_object *, void *, void *); + void *method_data; + GDCALLINGCONV void (*free_func)(void *); +} godot_property_get_func; + +void GDAPI godot_nativescript_register_property(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func); + +typedef struct { + godot_string name; + godot_int type; + godot_property_hint hint; + godot_string hint_string; + godot_property_usage_flags usage; + godot_variant default_value; +} godot_signal_argument; + +typedef struct { + godot_string name; + int num_args; + godot_signal_argument *args; + int num_default_args; + godot_variant *default_args; +} godot_signal; + +void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_signal *p_signal); + +void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance); + +/* + * + * + * NativeScript 1.1 + * + * + */ + +// method registering with argument names + +typedef struct { + godot_string name; + + godot_variant_type type; + godot_property_hint hint; + godot_string hint_string; +} godot_method_arg; + +void GDAPI godot_nativescript_set_method_argument_information(void *p_gdnative_handle, const char *p_name, const char *p_function_name, int p_num_args, const godot_method_arg *p_args); + +// documentation + +void GDAPI godot_nativescript_set_class_documentation(void *p_gdnative_handle, const char *p_name, godot_string p_documentation); +void GDAPI godot_nativescript_set_method_documentation(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_string p_documentation); +void GDAPI godot_nativescript_set_property_documentation(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_string p_documentation); +void GDAPI godot_nativescript_set_signal_documentation(void *p_gdnative_handle, const char *p_name, const char *p_signal_name, godot_string p_documentation); + +// type tag API + +void GDAPI godot_nativescript_set_global_type_tag(int p_idx, const char *p_name, const void *p_type_tag); +const void GDAPI *godot_nativescript_get_global_type_tag(int p_idx, const char *p_name); + +void GDAPI godot_nativescript_set_type_tag(void *p_gdnative_handle, const char *p_name, const void *p_type_tag); +const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object); + +// instance binding API + +typedef struct { + GDCALLINGCONV void *(*alloc_instance_binding_data)(void *, const void *, godot_object *); + GDCALLINGCONV void (*free_instance_binding_data)(void *, void *); + GDCALLINGCONV void (*refcount_incremented_instance_binding)(void *, godot_object *); + GDCALLINGCONV bool (*refcount_decremented_instance_binding)(void *, godot_object *); + void *data; + GDCALLINGCONV void (*free_func)(void *); +} godot_instance_binding_functions; + +int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions); +void GDAPI godot_nativescript_unregister_instance_binding_data_functions(int p_idx); + +void GDAPI *godot_nativescript_get_instance_binding_data(int p_idx, godot_object *p_object); + +void GDAPI godot_nativescript_profiling_add_data(const char *p_signature, uint64_t p_time); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_NATIVESCRIPT_H diff --git a/include/net/godot_net.h b/include/net/godot_net.h new file mode 100644 index 0000000..eccc31a --- /dev/null +++ b/include/net/godot_net.h @@ -0,0 +1,120 @@ +/**************************************************************************/ +/* godot_net.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_NET_H +#define GODOT_NET_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// For future versions of the API we should only add new functions at the end of the structure and use the +// version info to detect whether a call is available + +// Use these to populate version in your plugin +#define GODOT_NET_API_MAJOR 3 +#define GODOT_NET_API_MINOR 1 + +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + godot_object *data; /* User reference */ + + /* This is StreamPeer */ + godot_error (*get_data)(void *user, uint8_t *p_buffer, int p_bytes); + godot_error (*get_partial_data)(void *user, uint8_t *p_buffer, int p_bytes, int *r_received); + godot_error (*put_data)(void *user, const uint8_t *p_data, int p_bytes); + godot_error (*put_partial_data)(void *user, const uint8_t *p_data, int p_bytes, int *r_sent); + + int (*get_available_bytes)(const void *user); + + void *next; /* For extension? */ +} godot_net_stream_peer; + +/* Binds a StreamPeerGDNative to the provided interface */ +void godot_net_bind_stream_peer(godot_object *p_obj, const godot_net_stream_peer *p_interface); + +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + + godot_object *data; /* User reference */ + + /* This is PacketPeer */ + godot_error (*get_packet)(void *, const uint8_t **, int *); + godot_error (*put_packet)(void *, const uint8_t *, int); + godot_int (*get_available_packet_count)(const void *); + godot_int (*get_max_packet_size)(const void *); + + void *next; /* For extension? */ +} godot_net_packet_peer; + +/* Binds a PacketPeerGDNative to the provided interface */ +void GDAPI godot_net_bind_packet_peer(godot_object *p_obj, const godot_net_packet_peer *); + +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + + godot_object *data; /* User reference */ + + /* This is PacketPeer */ + godot_error (*get_packet)(void *, const uint8_t **, int *); + godot_error (*put_packet)(void *, const uint8_t *, int); + godot_int (*get_available_packet_count)(const void *); + godot_int (*get_max_packet_size)(const void *); + + /* This is NetworkedMultiplayerPeer */ + void (*set_transfer_mode)(void *, godot_int); + godot_int (*get_transfer_mode)(const void *); + // 0 = broadcast, 1 = server, <0 = all but abs(value) + void (*set_target_peer)(void *, godot_int); + godot_int (*get_packet_peer)(const void *); + godot_bool (*is_server)(const void *); + void (*poll)(void *); + // Must be > 0, 1 is for server + int32_t (*get_unique_id)(const void *); + void (*set_refuse_new_connections)(void *, godot_bool); + godot_bool (*is_refusing_new_connections)(const void *); + godot_int (*get_connection_status)(const void *); + + void *next; /* For extension? Or maybe not... */ +} godot_net_multiplayer_peer; + +/* Binds a MultiplayerPeerGDNative to the provided interface */ +void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_multiplayer_peer *); + +#ifdef __cplusplus +} +#endif + +// WebRTC Bindings +#include "net/godot_webrtc.h" + +#endif // GODOT_NET_H diff --git a/include/net/godot_webrtc.h b/include/net/godot_webrtc.h new file mode 100644 index 0000000..3984585 --- /dev/null +++ b/include/net/godot_webrtc.h @@ -0,0 +1,129 @@ +/**************************************************************************/ +/* godot_webrtc.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_WEBRTC_H +#define GODOT_WEBRTC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define GODOT_NET_WEBRTC_API_MAJOR 3 +#define GODOT_NET_WEBRTC_API_MINOR 4 + +/* Library Interface (used to set default GDNative WebRTC implementation */ +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + + /* Called when the library is unset as default interface via godot_net_set_webrtc_library */ + void (*unregistered)(); + + /* Used by WebRTCPeerConnection create when GDNative is the default implementation. */ + /* Takes a pointer to WebRTCPeerConnectionGDNative, should bind and return OK, failure if binding was unsuccessful. */ + godot_error (*create_peer_connection)(godot_object *); + + void *next; /* For extension */ +} godot_net_webrtc_library; + +/* WebRTCPeerConnection interface */ +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + + godot_object *data; /* User reference */ + + /* This is WebRTCPeerConnection */ + godot_int (*get_connection_state)(const void *); + + godot_error (*initialize)(void *, const godot_dictionary *); + godot_object *(*create_data_channel)(void *, const char *p_channel_name, const godot_dictionary *); + godot_error (*create_offer)(void *); + godot_error (*create_answer)(void *); /* unused for now, should be done automatically on set_local_description */ + godot_error (*set_remote_description)(void *, const char *, const char *); + godot_error (*set_local_description)(void *, const char *, const char *); + godot_error (*add_ice_candidate)(void *, const char *, int, const char *); + godot_error (*poll)(void *); + void (*close)(void *); + + void *next; /* For extension? */ +} godot_net_webrtc_peer_connection; + +/* WebRTCDataChannel interface */ +typedef struct { + godot_gdnative_api_version version; /* version of our API */ + + godot_object *data; /* User reference */ + + /* This is PacketPeer */ + godot_error (*get_packet)(void *, const uint8_t **, int *); + godot_error (*put_packet)(void *, const uint8_t *, int); + godot_int (*get_available_packet_count)(const void *); + godot_int (*get_max_packet_size)(const void *); + + /* This is WebRTCDataChannel */ + void (*set_write_mode)(void *, godot_int); + godot_int (*get_write_mode)(const void *); + bool (*was_string_packet)(const void *); + + godot_int (*get_ready_state)(const void *); + const char *(*get_label)(const void *); + bool (*is_ordered)(const void *); + int (*get_id)(const void *); + int (*get_max_packet_life_time)(const void *); + int (*get_max_retransmits)(const void *); + const char *(*get_protocol)(const void *); + bool (*is_negotiated)(const void *); + + godot_error (*poll)(void *); + void (*close)(void *); + + void *next; /* For extension? */ +} godot_net_webrtc_data_channel; + +/* Extensions to WebRTCDataChannel */ +typedef struct { + int (*get_buffered_amount)(const void *); + + void *next; /* For extension? */ +} godot_net_webrtc_data_channel_ext; + +/* Set the default GDNative library */ +godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *); +/* Binds a WebRTCPeerConnectionGDNative to the provided interface */ +void GDAPI godot_net_bind_webrtc_peer_connection(godot_object *p_obj, const godot_net_webrtc_peer_connection *); +/* Binds a WebRTCDataChannelGDNative to the provided interface */ +void GDAPI godot_net_bind_webrtc_data_channel(godot_object *p_obj, const godot_net_webrtc_data_channel *); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_WEBRTC_H diff --git a/include/pluginscript/godot_pluginscript.h b/include/pluginscript/godot_pluginscript.h new file mode 100644 index 0000000..dba274f --- /dev/null +++ b/include/pluginscript/godot_pluginscript.h @@ -0,0 +1,172 @@ +/**************************************************************************/ +/* godot_pluginscript.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_PLUGINSCRIPT_H +#define GODOT_PLUGINSCRIPT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void godot_pluginscript_instance_data; +typedef void godot_pluginscript_script_data; +typedef void godot_pluginscript_language_data; + +// --- Instance --- + +// TODO: use godot_string_name for faster lookup ? +typedef struct { + godot_pluginscript_instance_data *(*init)(godot_pluginscript_script_data *p_data, godot_object *p_owner); + void (*finish)(godot_pluginscript_instance_data *p_data); + + godot_bool (*set_prop)(godot_pluginscript_instance_data *p_data, const godot_string *p_name, const godot_variant *p_value); + godot_bool (*get_prop)(godot_pluginscript_instance_data *p_data, const godot_string *p_name, godot_variant *r_ret); + + godot_variant (*call_method)(godot_pluginscript_instance_data *p_data, + const godot_string_name *p_method, const godot_variant **p_args, + int p_argcount, godot_variant_call_error *r_error); + + void (*notification)(godot_pluginscript_instance_data *p_data, int p_notification); + // TODO: could this rpc mode stuff be moved to the godot_pluginscript_script_manifest ? + godot_method_rpc_mode (*get_rpc_mode)(godot_pluginscript_instance_data *p_data, const godot_string *p_method); + godot_method_rpc_mode (*get_rset_mode)(godot_pluginscript_instance_data *p_data, const godot_string *p_variable); + + //this is used by script languages that keep a reference counter of their own + //you can make make Ref<> not die when it reaches zero, so deleting the reference + //depends entirely from the script. + // Note: You can set those function pointer to NULL if not needed. + void (*refcount_incremented)(godot_pluginscript_instance_data *p_data); + bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die +} godot_pluginscript_instance_desc; + +// --- Script --- + +typedef struct { + godot_pluginscript_script_data *data; + godot_string_name name; + godot_bool is_tool; + godot_string_name base; + + // Member lines format: {: } + godot_dictionary member_lines; + // Method info dictionary format + // { + // name: + // args: [] + // default_args: [] + // return: + // flags: + // rpc_mode: + // } + godot_array methods; + // Same format than for methods + godot_array signals; + // Property info dictionary format + // { + // name: + // type: + // hint: + // hint_string: + // usage: + // default_value: + // rset_mode: + // } + godot_array properties; +} godot_pluginscript_script_manifest; + +typedef struct { + godot_pluginscript_script_manifest (*init)(godot_pluginscript_language_data *p_data, const godot_string *p_path, const godot_string *p_source, godot_error *r_error); + void (*finish)(godot_pluginscript_script_data *p_data); + godot_pluginscript_instance_desc instance_desc; +} godot_pluginscript_script_desc; + +// --- Language --- + +typedef struct { + godot_string_name signature; + godot_int call_count; + godot_int total_time; // In microseconds + godot_int self_time; // In microseconds +} godot_pluginscript_profiling_data; + +typedef struct { + const char *name; + const char *type; + const char *extension; + const char **recognized_extensions; // NULL terminated array + godot_pluginscript_language_data *(*init)(); + void (*finish)(godot_pluginscript_language_data *p_data); + const char **reserved_words; // NULL terminated array + const char **comment_delimiters; // NULL terminated array + const char **string_delimiters; // NULL terminated array + godot_bool has_named_classes; + godot_bool supports_builtin_mode; + + godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name); + godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_pool_string_array *r_functions); + int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL + godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_pool_string_array *p_args); + godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint); + void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line); + + void (*add_global_constant)(godot_pluginscript_language_data *p_data, const godot_string *p_variable, const godot_variant *p_value); + godot_string (*debug_get_error)(godot_pluginscript_language_data *p_data); + int (*debug_get_stack_level_count)(godot_pluginscript_language_data *p_data); + int (*debug_get_stack_level_line)(godot_pluginscript_language_data *p_data, int p_level); + godot_string (*debug_get_stack_level_function)(godot_pluginscript_language_data *p_data, int p_level); + godot_string (*debug_get_stack_level_source)(godot_pluginscript_language_data *p_data, int p_level); + void (*debug_get_stack_level_locals)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_stack_level_members)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_globals)(godot_pluginscript_language_data *p_data, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); + godot_string (*debug_parse_stack_level_expression)(godot_pluginscript_language_data *p_data, int p_level, const godot_string *p_expression, int p_max_subitems, int p_max_depth); + + // TODO: could this stuff be moved to the godot_pluginscript_language_desc ? + void (*get_public_functions)(godot_pluginscript_language_data *p_data, godot_array *r_functions); + void (*get_public_constants)(godot_pluginscript_language_data *p_data, godot_dictionary *r_constants); + + void (*profiling_start)(godot_pluginscript_language_data *p_data); + void (*profiling_stop)(godot_pluginscript_language_data *p_data); + int (*profiling_get_accumulated_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); + int (*profiling_get_frame_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); + void (*profiling_frame)(godot_pluginscript_language_data *p_data); + + godot_pluginscript_script_desc script_desc; +} godot_pluginscript_language_desc; + +void GDAPI godot_pluginscript_register_language(const godot_pluginscript_language_desc *language_desc); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_PLUGINSCRIPT_H diff --git a/include/videodecoder/godot_videodecoder.h b/include/videodecoder/godot_videodecoder.h new file mode 100644 index 0000000..1dbb3d0 --- /dev/null +++ b/include/videodecoder/godot_videodecoder.h @@ -0,0 +1,75 @@ +/**************************************************************************/ +/* godot_videodecoder.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef GODOT_VIDEODECODER_H +#define GODOT_VIDEODECODER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define GODOTAV_API_MAJOR 0 +#define GODOTAV_API_MINOR 1 + +typedef struct +{ + godot_gdnative_api_version version; + void *next; + void *(*constructor)(godot_object *); + void (*destructor)(void *); + const char *(*get_plugin_name)(); + const char **(*get_supported_extensions)(int *count); + godot_bool (*open_file)(void *, void *); // data struct, and a FileAccess pointer + godot_real (*get_length)(const void *); + godot_real (*get_playback_position)(const void *); + void (*seek)(void *, godot_real); + void (*set_audio_track)(void *, godot_int); + void (*update)(void *, godot_real); + godot_pool_byte_array *(*get_videoframe)(void *); + godot_int (*get_audioframe)(void *, float *, int); + godot_int (*get_channels)(const void *); + godot_int (*get_mix_rate)(const void *); + godot_vector2 (*get_texture_size)(const void *); +} godot_videodecoder_interface_gdnative; + +typedef int (*GDNativeAudioMixCallback)(void *, const float *, int); + +// FileAccess wrappers for custom FFmpeg IO +godot_int GDAPI godot_videodecoder_file_read(void *file_ptr, uint8_t *buf, int buf_size); +int64_t GDAPI godot_videodecoder_file_seek(void *file_ptr, int64_t pos, int whence); +void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interface_gdnative *p_interface); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_VIDEODECODER_H diff --git a/nativescript/SCsub b/nativescript/SCsub new file mode 100644 index 0000000..b1ddb24 --- /dev/null +++ b/nativescript/SCsub @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +Import("env") +Import("env_gdnative") + +env_gdnative.add_source_files(env.modules_sources, "*.cpp") + +if "platform" in env and env["platform"] in ["x11", "iphone"]: + env.Append(LINKFLAGS=["-rdynamic"]) diff --git a/nativescript/api_generator.cpp b/nativescript/api_generator.cpp new file mode 100644 index 0000000..f5955ef --- /dev/null +++ b/nativescript/api_generator.cpp @@ -0,0 +1,528 @@ +/**************************************************************************/ +/* api_generator.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "api_generator.h" + +#ifdef TOOLS_ENABLED + +#include "core/class_db.h" +#include "core/engine.h" +#include "core/global_constants.h" +#include "core/os/file_access.h" +#include "core/pair.h" + +// helper stuff + +static Error save_file(const String &p_path, const List &p_content) { + FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE); + + ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE); + + for (const List::Element *e = p_content.front(); e != nullptr; e = e->next()) { + file->store_string(e->get()); + } + + file->close(); + + return OK; +} + +// helper stuff end + +struct MethodAPI { + String method_name; + String return_type; + + List argument_types; + List argument_names; + + Map default_arguments; + + int argument_count; + bool has_varargs; + bool is_editor; + bool is_noscript; + bool is_const; + bool is_reverse; + bool is_virtual; + bool is_from_script; +}; + +struct PropertyAPI { + String name; + String getter; + String setter; + String type; + int index; +}; + +struct ConstantAPI { + String constant_name; + int constant_value; +}; + +struct SignalAPI { + String name; + List argument_types; + List argument_names; + Map default_arguments; +}; + +struct EnumAPI { + String name; + List> values; +}; + +struct ClassAPI { + String class_name; + String super_class_name; + + ClassDB::APIType api_type; + + bool is_singleton; + String singleton_name; + bool is_instanciable; + // @Unclear + bool is_reference; + + List methods; + List properties; + List constants; + List signals_; + List enums; +}; + +static String get_type_name(const PropertyInfo &info) { + if (info.type == Variant::INT && (info.usage & PROPERTY_USAGE_CLASS_IS_ENUM)) { + return String("enum.") + String(info.class_name).replace(".", "::"); + } + if (info.class_name != StringName()) { + return info.class_name; + } + if (info.hint == PROPERTY_HINT_RESOURCE_TYPE) { + return info.hint_string; + } + if (info.type == Variant::NIL && (info.usage & PROPERTY_USAGE_NIL_IS_VARIANT)) { + return "Variant"; + } + if (info.type == Variant::NIL) { + return "void"; + } + return Variant::get_type_name(info.type); +} + +/* + * Some comparison helper functions we need + */ + +struct MethodInfoComparator { + StringName::AlphCompare compare; + bool operator()(const MethodInfo &p_a, const MethodInfo &p_b) const { + return compare(p_a.name, p_b.name); + } +}; + +struct PropertyInfoComparator { + StringName::AlphCompare compare; + bool operator()(const PropertyInfo &p_a, const PropertyInfo &p_b) const { + return compare(p_a.name, p_b.name); + } +}; + +struct ConstantAPIComparator { + NoCaseComparator compare; + bool operator()(const ConstantAPI &p_a, const ConstantAPI &p_b) const { + return compare(p_a.constant_name, p_b.constant_name); + } +}; + +/* + * Reads the entire Godot API to a list + */ +List generate_c_api_classes() { + List api; + + List classes; + ClassDB::get_class_list(&classes); + classes.sort_custom(); + + // Register global constants as a fake GlobalConstants singleton class + { + ClassAPI global_constants_api; + global_constants_api.class_name = L"GlobalConstants"; + global_constants_api.api_type = ClassDB::API_CORE; + global_constants_api.is_singleton = true; + global_constants_api.singleton_name = L"GlobalConstants"; + global_constants_api.is_instanciable = false; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + ConstantAPI constant_api; + constant_api.constant_name = GlobalConstants::get_global_constant_name(i); + constant_api.constant_value = GlobalConstants::get_global_constant_value(i); + global_constants_api.constants.push_back(constant_api); + } + global_constants_api.constants.sort_custom(); + api.push_back(global_constants_api); + } + + for (List::Element *e = classes.front(); e != nullptr; e = e->next()) { + StringName class_name = e->get(); + + ClassAPI class_api; + class_api.api_type = ClassDB::get_api_type(e->get()); + class_api.class_name = class_name; + class_api.super_class_name = ClassDB::get_parent_class(class_name); + { + String name = class_name; + if (name.begins_with("_")) { + name.remove(0); + } + class_api.is_singleton = Engine::get_singleton()->has_singleton(name); + if (class_api.is_singleton) { + class_api.singleton_name = name; + } + } + class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name); + + { + List inheriters; + ClassDB::get_inheriters_from_class("Reference", &inheriters); + bool is_reference = !!inheriters.find(class_name) || class_name == "Reference"; + // @Unclear + class_api.is_reference = !class_api.is_singleton && is_reference; + } + + // constants + { + List constant; + ClassDB::get_integer_constant_list(class_name, &constant, true); + constant.sort_custom(); + for (List::Element *c = constant.front(); c != nullptr; c = c->next()) { + ConstantAPI constant_api; + constant_api.constant_name = c->get(); + constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get()); + + class_api.constants.push_back(constant_api); + } + } + + // signals + { + List signals_; + ClassDB::get_signal_list(class_name, &signals_, true); + signals_.sort_custom(); + + for (int i = 0; i < signals_.size(); i++) { + SignalAPI signal; + + MethodInfo method_info = signals_[i]; + signal.name = method_info.name; + + for (int j = 0; j < method_info.arguments.size(); j++) { + PropertyInfo argument = method_info.arguments[j]; + String type; + String name = argument.name; + + if (argument.name.find(":") != -1) { + type = argument.name.get_slice(":", 1); + name = argument.name.get_slice(":", 0); + } else { + type = get_type_name(argument); + } + + signal.argument_names.push_back(name); + signal.argument_types.push_back(type); + } + + Vector default_arguments = method_info.default_arguments; + + int default_start = signal.argument_names.size() - default_arguments.size(); + + for (int j = 0; j < default_arguments.size(); j++) { + signal.default_arguments[default_start + j] = default_arguments[j]; + } + + class_api.signals_.push_back(signal); + } + } + + //properties + { + List properties; + ClassDB::get_property_list(class_name, &properties, true); + properties.sort_custom(); + + for (List::Element *p = properties.front(); p != nullptr; p = p->next()) { + PropertyAPI property_api; + + property_api.name = p->get().name; + property_api.getter = ClassDB::get_property_getter(class_name, p->get().name); + property_api.setter = ClassDB::get_property_setter(class_name, p->get().name); + + if (p->get().name.find(":") != -1) { + property_api.type = p->get().name.get_slice(":", 1); + property_api.name = p->get().name.get_slice(":", 0); + } else { + property_api.type = get_type_name(p->get()); + } + + property_api.index = ClassDB::get_property_index(class_name, p->get().name); + + if (!property_api.setter.empty() || !property_api.getter.empty()) { + class_api.properties.push_back(property_api); + } + } + } + + //methods + { + List methods; + ClassDB::get_method_list(class_name, &methods, true); + methods.sort_custom(); + + for (List::Element *m = methods.front(); m != nullptr; m = m->next()) { + MethodAPI method_api; + MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name); + MethodInfo &method_info = m->get(); + + //method name + method_api.method_name = method_info.name; + //method return type + if (method_api.method_name.find(":") != -1) { + method_api.return_type = method_api.method_name.get_slice(":", 1); + method_api.method_name = method_api.method_name.get_slice(":", 0); + } else { + method_api.return_type = get_type_name(m->get().return_val); + } + + method_api.argument_count = method_info.arguments.size(); + method_api.has_varargs = method_bind && method_bind->is_vararg(); + + // Method flags + method_api.is_virtual = false; + if (method_info.flags) { + const uint32_t flags = method_info.flags; + method_api.is_editor = flags & METHOD_FLAG_EDITOR; + method_api.is_noscript = flags & METHOD_FLAG_NOSCRIPT; + method_api.is_const = flags & METHOD_FLAG_CONST; + method_api.is_reverse = flags & METHOD_FLAG_REVERSE; + method_api.is_virtual = flags & METHOD_FLAG_VIRTUAL; + method_api.is_from_script = flags & METHOD_FLAG_FROM_SCRIPT; + } + + method_api.is_virtual = method_api.is_virtual || method_api.method_name[0] == '_'; + + // method argument name and type + + for (int i = 0; i < method_api.argument_count; i++) { + String arg_name; + String arg_type; + PropertyInfo arg_info = method_info.arguments[i]; + + arg_name = arg_info.name; + + if (arg_info.name.find(":") != -1) { + arg_type = arg_info.name.get_slice(":", 1); + arg_name = arg_info.name.get_slice(":", 0); + } else if (arg_info.hint == PROPERTY_HINT_RESOURCE_TYPE) { + arg_type = arg_info.hint_string; + } else if (arg_info.type == Variant::NIL) { + arg_type = "Variant"; + } else if (arg_info.type == Variant::OBJECT) { + arg_type = arg_info.class_name; + if (arg_type == "") { + arg_type = Variant::get_type_name(arg_info.type); + } + } else { + arg_type = Variant::get_type_name(arg_info.type); + } + + method_api.argument_names.push_back(arg_name); + method_api.argument_types.push_back(arg_type); + + if (method_bind && method_bind->has_default_argument(i)) { + method_api.default_arguments[i] = method_bind->get_default_argument(i); + } + } + + class_api.methods.push_back(method_api); + } + } + + // enums + { + List enums; + List enum_names; + ClassDB::get_enum_list(class_name, &enum_names, true); + for (List::Element *E = enum_names.front(); E; E = E->next()) { + List value_names; + EnumAPI enum_api; + enum_api.name = E->get(); + ClassDB::get_enum_constants(class_name, E->get(), &value_names, true); + for (List::Element *val_e = value_names.front(); val_e; val_e = val_e->next()) { + int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), nullptr); + enum_api.values.push_back(Pair(int_val, val_e->get())); + } + enum_api.values.sort_custom>(); + class_api.enums.push_back(enum_api); + } + } + + api.push_back(class_api); + } + + return api; +} + +/* + * Generates the JSON source from the API in p_api + */ +static List generate_c_api_json(const List &p_api) { + // I'm sorry for the \t mess + + List source; + + source.push_back("[\n"); + + for (const List::Element *c = p_api.front(); c != nullptr; c = c->next()) { + ClassAPI api = c->get(); + + source.push_back("\t{\n"); + + source.push_back("\t\t\"name\": \"" + api.class_name + "\",\n"); + source.push_back("\t\t\"base_class\": \"" + api.super_class_name + "\",\n"); + source.push_back(String("\t\t\"api_type\": \"") + (api.api_type == ClassDB::API_CORE ? "core" : (api.api_type == ClassDB::API_EDITOR ? "tools" : "none")) + "\",\n"); + source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n"); + source.push_back("\t\t\"singleton_name\": \"" + api.singleton_name + "\",\n"); + source.push_back(String("\t\t\"instanciable\": ") + (api.is_instanciable ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\"is_reference\": ") + (api.is_reference ? "true" : "false") + ",\n"); + // @Unclear + + source.push_back("\t\t\"constants\": {\n"); + for (List::Element *e = api.constants.front(); e; e = e->next()) { + source.push_back("\t\t\t\"" + e->get().constant_name + "\": " + String::num_int64(e->get().constant_value) + (e->next() ? "," : "") + "\n"); + } + source.push_back("\t\t},\n"); + + source.push_back("\t\t\"properties\": [\n"); + for (List::Element *e = api.properties.front(); e; e = e->next()) { + source.push_back("\t\t\t{\n"); + source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); + source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n"); + source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n"); + source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\",\n"); + source.push_back(String("\t\t\t\t\"index\": ") + itos(e->get().index) + "\n"); + source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); + } + source.push_back("\t\t],\n"); + + source.push_back("\t\t\"signals\": [\n"); + for (List::Element *e = api.signals_.front(); e; e = e->next()) { + source.push_back("\t\t\t{\n"); + source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); + source.push_back("\t\t\t\t\"arguments\": [\n"); + for (int i = 0; i < e->get().argument_names.size(); i++) { + source.push_back("\t\t\t\t\t{\n"); + source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n"); + source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n"); + source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n"); + source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n"); + source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n"); + } + source.push_back("\t\t\t\t]\n"); + source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); + } + source.push_back("\t\t],\n"); + + source.push_back("\t\t\"methods\": [\n"); + for (List::Element *e = api.methods.front(); e; e = e->next()) { + source.push_back("\t\t\t{\n"); + source.push_back("\t\t\t\t\"name\": \"" + e->get().method_name + "\",\n"); + source.push_back("\t\t\t\t\"return_type\": \"" + e->get().return_type + "\",\n"); + source.push_back(String("\t\t\t\t\"is_editor\": ") + (e->get().is_editor ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"is_noscript\": ") + (e->get().is_noscript ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"is_const\": ") + (e->get().is_const ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"is_reverse\": ") + (e->get().is_reverse ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"is_virtual\": ") + (e->get().is_virtual ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"has_varargs\": ") + (e->get().has_varargs ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\t\t\"is_from_script\": ") + (e->get().is_from_script ? "true" : "false") + ",\n"); + source.push_back("\t\t\t\t\"arguments\": [\n"); + for (int i = 0; i < e->get().argument_names.size(); i++) { + source.push_back("\t\t\t\t\t{\n"); + source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n"); + source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n"); + source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n"); + source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n"); + source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n"); + } + source.push_back("\t\t\t\t]\n"); + source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); + } + source.push_back("\t\t],\n"); + + source.push_back("\t\t\"enums\": [\n"); + for (List::Element *e = api.enums.front(); e; e = e->next()) { + source.push_back("\t\t\t{\n"); + source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); + source.push_back("\t\t\t\t\"values\": {\n"); + for (List>::Element *val_e = e->get().values.front(); val_e; val_e = val_e->next()) { + source.push_back("\t\t\t\t\t\"" + val_e->get().second + "\": " + itos(val_e->get().first)); + source.push_back(String((val_e->next() ? "," : "")) + "\n"); + } + source.push_back("\t\t\t\t}\n"); + source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); + } + source.push_back("\t\t]\n"); + + source.push_back(String("\t}") + (c->next() ? "," : "") + "\n"); + } + source.push_back("]"); + + return source; +} + +#endif + +/* + * Saves the whole Godot API to a JSON file located at + * p_path + */ +Error generate_c_api(const String &p_path) { +#ifndef TOOLS_ENABLED + return ERR_BUG; +#else + + List api = generate_c_api_classes(); + + List json_source = generate_c_api_json(api); + + return save_file(p_path, json_source); +#endif +} diff --git a/nativescript/api_generator.h b/nativescript/api_generator.h new file mode 100644 index 0000000..a262565 --- /dev/null +++ b/nativescript/api_generator.h @@ -0,0 +1,39 @@ +/**************************************************************************/ +/* api_generator.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef API_GENERATOR_H +#define API_GENERATOR_H + +#include "core/typedefs.h" +#include "core/ustring.h" + +Error generate_c_api(const String &p_path); + +#endif // API_GENERATOR_H diff --git a/nativescript/godot_nativescript.cpp b/nativescript/godot_nativescript.cpp new file mode 100644 index 0000000..63c3be8 --- /dev/null +++ b/nativescript/godot_nativescript.cpp @@ -0,0 +1,322 @@ +/**************************************************************************/ +/* godot_nativescript.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "nativescript/godot_nativescript.h" + +#include "core/class_db.h" +#include "core/error_macros.h" +#include "core/global_constants.h" +#include "core/project_settings.h" +#include "core/variant.h" +#include "gdnative/gdnative.h" + +#include "nativescript.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern "C" void _native_script_hook() { +} + +#define NSL NativeScriptLanguage::get_singleton() + +// Script API + +void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) { + String *s = (String *)p_gdnative_handle; + + Map *classes = &NSL->library_classes[*s]; + + NativeScriptDesc desc; + + desc.create_func = p_create_func; + desc.destroy_func = p_destroy_func; + desc.is_tool = false; + + desc.base = p_base; + + if (classes->has(p_base)) { + desc.base_data = &(*classes)[p_base]; + desc.base_native_type = desc.base_data->base_native_type; + } else { + desc.base_data = nullptr; + desc.base_native_type = p_base; + } + + classes->insert(p_name, desc); +} + +void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) { + String *s = (String *)p_gdnative_handle; + + Map *classes = &NSL->library_classes[*s]; + + NativeScriptDesc desc; + + desc.create_func = p_create_func; + desc.destroy_func = p_destroy_func; + desc.is_tool = true; + desc.base = p_base; + + if (classes->has(p_base)) { + desc.base_data = &(*classes)[p_base]; + desc.base_native_type = desc.base_data->base_native_type; + } else { + desc.base_data = nullptr; + desc.base_native_type = p_base; + } + + classes->insert(p_name, desc); +} + +void GDAPI godot_nativescript_register_method(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to register method on non-existent class."); + + NativeScriptDesc::Method method; + method.method = p_method; + method.rpc_mode = p_attr.rpc_type; + method.info = MethodInfo(p_function_name); + + E->get().methods.insert(p_function_name, method); +} + +void GDAPI godot_nativescript_register_property(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to register method on non-existent class."); + + NativeScriptDesc::Property property; + property.default_value = *(Variant *)&p_attr->default_value; + property.getter = p_get_func; + property.rset_mode = p_attr->rset_type; + property.setter = p_set_func; + property.info = PropertyInfo((Variant::Type)p_attr->type, + p_path, + (PropertyHint)p_attr->hint, + *(String *)&p_attr->hint_string, + (PropertyUsageFlags)p_attr->usage); + + E->get().properties.insert(p_path, property); +} + +void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_signal *p_signal) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to register method on non-existent class."); + + List args; + Vector default_args; + + for (int i = 0; i < p_signal->num_args; i++) { + PropertyInfo info; + + godot_signal_argument arg = p_signal->args[i]; + + info.hint = (PropertyHint)arg.hint; + info.hint_string = *(String *)&arg.hint_string; + info.name = *(String *)&arg.name; + info.type = (Variant::Type)arg.type; + info.usage = (PropertyUsageFlags)arg.usage; + + args.push_back(info); + } + + for (int i = 0; i < p_signal->num_default_args; i++) { + Variant *v; + godot_signal_argument attrib = p_signal->args[i]; + + v = (Variant *)&attrib.default_value; + + default_args.push_back(*v); + } + + MethodInfo method_info; + method_info.name = *(String *)&p_signal->name; + method_info.arguments = args; + method_info.default_arguments = default_args; + + NativeScriptDesc::Signal signal; + signal.signal = method_info; + + E->get().signals_.insert(*(String *)&p_signal->name, signal); +} + +void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance) { + Object *instance = (Object *)p_instance; + if (!instance) { + return nullptr; + } + if (instance->get_script_instance() && instance->get_script_instance()->get_language() == NativeScriptLanguage::get_singleton()) { + return ((NativeScriptInstance *)instance->get_script_instance())->userdata; + } + return nullptr; +} + +/* + * + * + * NativeScript 1.1 + * + * + */ + +void GDAPI godot_nativescript_set_method_argument_information(void *p_gdnative_handle, const char *p_name, const char *p_function_name, int p_num_args, const godot_method_arg *p_args) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to add argument information for a method on a non-existent class."); + + Map::Element *method = E->get().methods.find(p_function_name); + ERR_FAIL_COND_MSG(!method, "Attempted to add argument information to non-existent method."); + + MethodInfo *method_information = &method->get().info; + + List args; + + for (int i = 0; i < p_num_args; i++) { + godot_method_arg arg = p_args[i]; + String name = *(String *)&arg.name; + String hint_string = *(String *)&arg.hint_string; + + Variant::Type type = (Variant::Type)arg.type; + PropertyHint hint = (PropertyHint)arg.hint; + + args.push_back(PropertyInfo(type, p_name, hint, hint_string)); + } + + method_information->arguments = args; +} + +void GDAPI godot_nativescript_set_class_documentation(void *p_gdnative_handle, const char *p_name, godot_string p_documentation) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a non-existent class."); + + E->get().documentation = *(String *)&p_documentation; +} + +void GDAPI godot_nativescript_set_method_documentation(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_string p_documentation) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a method on a non-existent class."); + + Map::Element *method = E->get().methods.find(p_function_name); + ERR_FAIL_COND_MSG(!method, "Attempted to add documentation to non-existent method."); + + method->get().documentation = *(String *)&p_documentation; +} + +void GDAPI godot_nativescript_set_property_documentation(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_string p_documentation) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a property on a non-existent class."); + + OrderedHashMap::Element property = E->get().properties.find(p_path); + ERR_FAIL_COND_MSG(!property, "Attempted to add documentation to non-existent property."); + + property.get().documentation = *(String *)&p_documentation; +} + +void GDAPI godot_nativescript_set_signal_documentation(void *p_gdnative_handle, const char *p_name, const char *p_signal_name, godot_string p_documentation) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a signal on a non-existent class."); + + Map::Element *signal = E->get().signals_.find(p_signal_name); + ERR_FAIL_COND_MSG(!signal, "Attempted to add documentation to non-existent signal."); + + signal->get().documentation = *(String *)&p_documentation; +} + +void GDAPI godot_nativescript_set_global_type_tag(int p_idx, const char *p_name, const void *p_type_tag) { + NativeScriptLanguage::get_singleton()->set_global_type_tag(p_idx, StringName(p_name), p_type_tag); +} + +const void GDAPI *godot_nativescript_get_global_type_tag(int p_idx, const char *p_name) { + return NativeScriptLanguage::get_singleton()->get_global_type_tag(p_idx, StringName(p_name)); +} + +void GDAPI godot_nativescript_set_type_tag(void *p_gdnative_handle, const char *p_name, const void *p_type_tag) { + String *s = (String *)p_gdnative_handle; + + Map::Element *E = NSL->library_classes[*s].find(p_name); + ERR_FAIL_COND_MSG(!E, "Attempted to set type tag on a non-existent class."); + + E->get().type_tag = p_type_tag; +} + +const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object) { + const Object *o = (Object *)p_object; + + if (!o->get_script_instance()) { + return nullptr; + } else { + NativeScript *script = Object::cast_to(o->get_script_instance()->get_script().ptr()); + if (!script) { + return nullptr; + } + + if (script->get_script_desc()) { + return script->get_script_desc()->type_tag; + } + } + + return nullptr; +} + +int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions) { + return NativeScriptLanguage::get_singleton()->register_binding_functions(p_binding_functions); +} + +void GDAPI godot_nativescript_unregister_instance_binding_data_functions(int p_idx) { + NativeScriptLanguage::get_singleton()->unregister_binding_functions(p_idx); +} + +void GDAPI *godot_nativescript_get_instance_binding_data(int p_idx, godot_object *p_object) { + return NativeScriptLanguage::get_singleton()->get_instance_binding_data(p_idx, (Object *)p_object); +} + +void GDAPI godot_nativescript_profiling_add_data(const char *p_signature, uint64_t p_time) { + NativeScriptLanguage::get_singleton()->profiling_add_data(StringName(p_signature), p_time); +} + +#ifdef __cplusplus +} +#endif diff --git a/nativescript/nativescript.cpp b/nativescript/nativescript.cpp new file mode 100644 index 0000000..3341b31 --- /dev/null +++ b/nativescript/nativescript.cpp @@ -0,0 +1,1829 @@ +/**************************************************************************/ +/* nativescript.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "nativescript.h" + +#include "gdnative/gdnative.h" + +#include "core/core_string_names.h" +#include "core/global_constants.h" +#include "core/io/file_access_encrypted.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" + +#include "main/main.h" + +#include "scene/main/scene_tree.h" +#include "scene/resources/resource_format_text.h" + +#include + +#ifndef NO_THREADS +#include "core/os/thread.h" +#endif + +#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) +#include "api_generator.h" +#endif + +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#endif + +void NativeScript::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name); + ClassDB::bind_method(D_METHOD("get_class_name"), &NativeScript::get_class_name); + + ClassDB::bind_method(D_METHOD("set_library", "library"), &NativeScript::set_library); + ClassDB::bind_method(D_METHOD("get_library"), &NativeScript::get_library); + + ClassDB::bind_method(D_METHOD("set_script_class_name", "class_name"), &NativeScript::set_script_class_name); + ClassDB::bind_method(D_METHOD("get_script_class_name"), &NativeScript::get_script_class_name); + ClassDB::bind_method(D_METHOD("set_script_class_icon_path", "icon_path"), &NativeScript::set_script_class_icon_path); + ClassDB::bind_method(D_METHOD("get_script_class_icon_path"), &NativeScript::get_script_class_icon_path); + + ClassDB::bind_method(D_METHOD("get_class_documentation"), &NativeScript::get_class_documentation); + ClassDB::bind_method(D_METHOD("get_method_documentation", "method"), &NativeScript::get_method_documentation); + ClassDB::bind_method(D_METHOD("get_signal_documentation", "signal_name"), &NativeScript::get_signal_documentation); + ClassDB::bind_method(D_METHOD("get_property_documentation", "path"), &NativeScript::get_property_documentation); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "class_name"), "set_class_name", "get_class_name"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); + ADD_GROUP("Script Class", "script_class_"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "script_class_name"), "set_script_class_name", "get_script_class_name"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "script_class_icon_path", PROPERTY_HINT_FILE), "set_script_class_icon_path", "get_script_class_icon_path"); + + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &NativeScript::_new, MethodInfo("new")); +} + +#define NSL NativeScriptLanguage::get_singleton() + +#ifdef TOOLS_ENABLED + +void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { + NativeScriptDesc *script_data = get_script_desc(); + + ERR_FAIL_COND(!script_data); + + List info; + get_script_property_list(&info); + Map values; + for (List::Element *E = info.front(); E; E = E->next()) { + Variant value; + get_property_default_value(E->get().name, value); + values[E->get().name] = value; + } + + p_placeholder->update(info, values); +} + +void NativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { + placeholders.erase(p_placeholder); +} + +#endif + +bool NativeScript::inherits_script(const Ref