aboutsummaryrefslogtreecommitdiff
path: root/modules/gdnative/godot/gdnative.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/gdnative/godot/gdnative.cpp (renamed from modules/gdnative/godot.cpp)70
1 files changed, 2 insertions, 68 deletions
diff --git a/modules/gdnative/godot.cpp b/modules/gdnative/godot/gdnative.cpp
index 764ce7c3e..7b94b75a5 100644
--- a/modules/gdnative/godot.cpp
+++ b/modules/gdnative/godot/gdnative.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* godot.cpp */
+/* gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "godot.h"
+#include "gdnative.h"
#include "class_db.h"
#include "error_macros.h"
@@ -79,13 +79,6 @@ void _api_anchor() {
_variant_api_anchor();
}
-extern "C++" {
-template <class a, class b>
-_FORCE_INLINE_ a memcast(b v) {
- return *((a *)&v);
-}
-}
-
void GDAPI godot_object_destroy(godot_object *p_o) {
memdelete((Object *)p_o);
}
@@ -142,65 +135,6 @@ void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind)
}
*/
-// Script API
-
-void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
- GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
- if (!library) {
- ERR_EXPLAIN("Attempt to register script after initializing library!");
- ERR_FAIL();
- }
- library->_register_script(p_name, p_base, p_create_func, p_destroy_func);
-}
-
-void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
- GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
- if (!library) {
- ERR_EXPLAIN("Attempt to register script after initializing library!");
- ERR_FAIL();
- }
- library->_register_tool_script(p_name, p_base, p_create_func, p_destroy_func);
-}
-
-void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) {
- GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
- if (!library) {
- ERR_EXPLAIN("Attempt to register script after initializing library!");
- ERR_FAIL();
- }
- library->_register_script_method(p_name, p_function_name, p_attr, p_method, MethodInfo());
-}
-
-void GDAPI godot_script_register_property(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) {
- GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
- if (!library) {
- ERR_EXPLAIN("Attempt to register script after initializing library!");
- ERR_FAIL();
- }
-
- library->_register_script_property(p_name, p_path, p_attr, p_set_func, p_get_func);
-}
-
-void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) {
- GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
- if (!library) {
- ERR_EXPLAIN("Attempt to register script after initializing library!");
- ERR_FAIL();
- }
-
- library->_register_script_signal(p_name, p_signal);
-}
-
-void GDAPI *godot_native_get_userdata(godot_object *p_instance) {
- Object *instance = (Object *)p_instance;
- if (!instance)
- return NULL;
- if (instance->get_script_instance() && instance->get_script_instance()->get_language() == GDNativeScriptLanguage::get_singleton()) {
- return ((GDNativeInstance *)instance->get_script_instance())->get_userdata();
- }
- return NULL;
-}
-
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)