summaryrefslogtreecommitdiffstats
path: root/src/core/GodotGlobal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/GodotGlobal.cpp')
-rw-r--r--src/core/GodotGlobal.cpp60
1 files changed, 25 insertions, 35 deletions
diff --git a/src/core/GodotGlobal.cpp b/src/core/GodotGlobal.cpp
index 37a8bf5..23054cf 100644
--- a/src/core/GodotGlobal.cpp
+++ b/src/core/GodotGlobal.cpp
@@ -4,20 +4,18 @@
#include "Wrapped.hpp"
-static GDCALLINGCONV void *wrapper_create(void *data, const void *type_tag, godot_object *instance)
-{
- godot::_Wrapped *wrapper_memory = (godot::_Wrapped *) godot::api->godot_alloc(sizeof(godot::_Wrapped));
+static GDCALLINGCONV void *wrapper_create(void *data, const void *type_tag, godot_object *instance) {
+ godot::_Wrapped *wrapper_memory = (godot::_Wrapped *)godot::api->godot_alloc(sizeof(godot::_Wrapped));
if (!wrapper_memory)
return NULL;
wrapper_memory->_owner = instance;
- wrapper_memory->_type_tag = (size_t) type_tag;
+ wrapper_memory->_type_tag = (size_t)type_tag;
- return (void *) wrapper_memory;
+ return (void *)wrapper_memory;
}
-static GDCALLINGCONV void wrapper_destroy(void *data, void *wrapper)
-{
+static GDCALLINGCONV void wrapper_destroy(void *data, void *wrapper) {
if (wrapper)
godot::api->godot_free(wrapper);
}
@@ -32,20 +30,18 @@ const godot_gdnative_ext_nativescript_1_1_api_struct *nativescript_1_1_api = nul
const void *gdnlib = NULL;
-void Godot::print(const String& message)
-{
- godot::api->godot_print((godot_string *) &message);
+void Godot::print(const String &message) {
+ godot::api->godot_print((godot_string *)&message);
}
-void Godot::print_warning(const String& description, const String& function, const String& file, int line)
-{
+void Godot::print_warning(const String &description, const String &function, const String &file, int line) {
int len;
- char * c_desc = description.alloc_c_string();
- char * c_func = function.alloc_c_string();
- char * c_file = file.alloc_c_string();
+ char *c_desc = description.alloc_c_string();
+ char *c_func = function.alloc_c_string();
+ char *c_file = file.alloc_c_string();
- if (c_desc != nullptr && c_func !=nullptr && c_file != nullptr) {
+ if (c_desc != nullptr && c_func != nullptr && c_file != nullptr) {
godot::api->godot_print_warning(c_desc, c_func, c_file, line);
};
@@ -54,15 +50,14 @@ void Godot::print_warning(const String& description, const String& function, con
if (c_file != nullptr) godot::api->godot_free(c_file);
}
-void Godot::print_error(const String& description, const String& function, const String& file, int line)
-{
+void Godot::print_error(const String &description, const String &function, const String &file, int line) {
int len;
- char * c_desc = description.alloc_c_string();
- char * c_func = function.alloc_c_string();
- char * c_file = file.alloc_c_string();
+ char *c_desc = description.alloc_c_string();
+ char *c_func = function.alloc_c_string();
+ char *c_file = file.alloc_c_string();
- if (c_desc != nullptr && c_func !=nullptr && c_file != nullptr) {
+ if (c_desc != nullptr && c_func != nullptr && c_file != nullptr) {
godot::api->godot_print_error(c_desc, c_func, c_file, line);
};
@@ -73,22 +68,21 @@ void Godot::print_error(const String& description, const String& function, const
void ___register_types();
-void Godot::gdnative_init(godot_gdnative_init_options *options)
-{
+void Godot::gdnative_init(godot_gdnative_init_options *options) {
godot::api = options->api_struct;
godot::gdnlib = options->gd_native_library;
// now find our extensions
for (int i = 0; i < godot::api->num_extensions; i++) {
switch (godot::api->extensions[i]->type) {
- case GDNATIVE_EXT_NATIVESCRIPT: {
- godot::nativescript_api = (const godot_gdnative_ext_nativescript_api_struct *)godot::api->extensions[i];
+ case GDNATIVE_EXT_NATIVESCRIPT: {
+ godot::nativescript_api = (const godot_gdnative_ext_nativescript_api_struct *)godot::api->extensions[i];
const godot_gdnative_api_struct *extension = godot::nativescript_api->next;
while (extension) {
if (extension->version.major == 1 && extension->version.minor == 1) {
- godot::nativescript_1_1_api = (const godot_gdnative_ext_nativescript_1_1_api_struct *) extension;
+ godot::nativescript_1_1_api = (const godot_gdnative_ext_nativescript_1_1_api_struct *)extension;
}
extension = extension->next;
@@ -97,16 +91,13 @@ void Godot::gdnative_init(godot_gdnative_init_options *options)
default: break;
}
}
-
}
-void Godot::gdnative_terminate(godot_gdnative_terminate_options *options)
-{
+void Godot::gdnative_terminate(godot_gdnative_terminate_options *options) {
// reserved for future use.
}
-void Godot::nativescript_init(void *handle)
-{
+void Godot::nativescript_init(void *handle) {
godot::_RegisterState::nativescript_handle = handle;
godot_instance_binding_functions binding_funcs = {};
@@ -118,9 +109,8 @@ void Godot::nativescript_init(void *handle)
___register_types();
}
-void Godot::nativescript_terminate(void *handle)
-{
+void Godot::nativescript_terminate(void *handle) {
godot::nativescript_1_1_api->godot_nativescript_unregister_instance_binding_data_functions(godot::_RegisterState::language_index);
}
-}
+} // namespace godot