GodotGlobal.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "GodotGlobal.hpp"
  2. #include "String.hpp"
  3. namespace godot {
  4. void *_RegisterState::nativescript_handle;
  5. const godot_gdnative_api_struct *api = NULL;
  6. void Godot::print(const String& message)
  7. {
  8. godot::api->godot_print((godot_string *) &message);
  9. }
  10. void Godot::print_warning(const String& description, const String& function, const String& file, int line)
  11. {
  12. godot::api->godot_print_warning(description.c_string(), function.c_string(), file.c_string(), line);
  13. }
  14. void Godot::print_error(const String& description, const String& function, const String& file, int line)
  15. {
  16. godot::api->godot_print_error(description.c_string(), function.c_string(), file.c_string(), line);
  17. }
  18. };
  19. void gdnative_init(godot_gdnative_init_options *options);
  20. extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *options)
  21. {
  22. godot::api = options->api_struct;
  23. gdnative_init(options);
  24. }
  25. void gdnative_terminate(godot_gdnative_terminate_options *options);
  26. extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *options)
  27. {
  28. gdnative_terminate(options);
  29. }
  30. void nativescript_init();
  31. extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
  32. {
  33. godot::_RegisterState::nativescript_handle = handle;
  34. nativescript_init();
  35. }