GodotGlobal.hpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*************************************************************************/
  2. /* GodotGlobal.hpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef GODOT_GLOBAL_HPP
  31. #define GODOT_GLOBAL_HPP
  32. #include "Array.hpp"
  33. #include "String.hpp"
  34. #include <gdnative_api_struct.gen.h>
  35. namespace godot {
  36. extern "C" const godot_gdnative_core_api_struct *api;
  37. extern "C" const godot_gdnative_core_1_1_api_struct *core_1_1_api;
  38. extern "C" const godot_gdnative_core_1_2_api_struct *core_1_2_api;
  39. extern "C" const godot_gdnative_ext_nativescript_api_struct *nativescript_api;
  40. extern "C" const godot_gdnative_ext_nativescript_1_1_api_struct *nativescript_1_1_api;
  41. extern "C" const godot_gdnative_ext_pluginscript_api_struct *pluginscript_api;
  42. extern "C" const godot_gdnative_ext_android_api_struct *android_api;
  43. extern "C" const godot_gdnative_ext_arvr_api_struct *arvr_api;
  44. extern "C" const godot_gdnative_ext_videodecoder_api_struct *videodecoder_api;
  45. extern "C" const godot_gdnative_ext_net_api_struct *net_api;
  46. extern "C" const godot_gdnative_ext_net_3_2_api_struct *net_3_2_api;
  47. extern "C" const void *gdnlib;
  48. class Godot {
  49. public:
  50. static void print(const String &message);
  51. static void print_warning(const String &description, const String &function, const String &file, int line);
  52. static void print_error(const String &description, const String &function, const String &file, int line);
  53. static void gdnative_init(godot_gdnative_init_options *o);
  54. static void gdnative_terminate(godot_gdnative_terminate_options *o);
  55. static void nativescript_init(void *handle);
  56. static void nativescript_terminate(void *handle);
  57. static void gdnative_profiling_add_data(const char *p_signature, uint64_t p_time);
  58. template <class... Args>
  59. static void print(const String &fmt, Args... values) {
  60. print(fmt.format(Array::make(values...)));
  61. }
  62. };
  63. struct _RegisterState {
  64. static void *nativescript_handle;
  65. static int language_index;
  66. };
  67. } // namespace godot
  68. #endif