os_ios.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*************************************************************************/
  2. /* os_ios.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 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 OS_IOS_H
  31. #define OS_IOS_H
  32. #ifdef IOS_ENABLED
  33. #include "drivers/coreaudio/audio_driver_coreaudio.h"
  34. #include "drivers/unix/os_unix.h"
  35. #include "ios.h"
  36. #include "joypad_ios.h"
  37. #include "servers/audio_server.h"
  38. #include "servers/rendering/renderer_compositor.h"
  39. #if defined(VULKAN_ENABLED)
  40. #include "drivers/vulkan/rendering_device_vulkan.h"
  41. #include "platform/ios/vulkan_context_ios.h"
  42. #endif
  43. class OS_IOS : public OS_Unix {
  44. private:
  45. static HashMap<String, void *> dynamic_symbol_lookup_table;
  46. friend void register_dynamic_symbol(char *name, void *address);
  47. AudioDriverCoreAudio audio_driver;
  48. iOS *ios = nullptr;
  49. JoypadIOS *joypad_ios = nullptr;
  50. MainLoop *main_loop = nullptr;
  51. virtual void initialize_core() override;
  52. virtual void initialize() override;
  53. virtual void initialize_joypads() override {
  54. }
  55. virtual void set_main_loop(MainLoop *p_main_loop) override;
  56. virtual MainLoop *get_main_loop() const override;
  57. virtual void delete_main_loop() override;
  58. virtual void finalize() override;
  59. String user_data_dir;
  60. String cache_dir;
  61. bool is_focused = false;
  62. void deinitialize_modules();
  63. public:
  64. static OS_IOS *get_singleton();
  65. OS_IOS(String p_data_dir, String p_cache_dir);
  66. ~OS_IOS();
  67. void initialize_modules();
  68. bool iterate();
  69. void start();
  70. virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override;
  71. virtual Vector<String> get_system_fonts() const override;
  72. virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override;
  73. virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
  74. virtual Error close_dynamic_library(void *p_library_handle) override;
  75. virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override;
  76. virtual String get_name() const override;
  77. virtual String get_distribution_name() const override;
  78. virtual String get_version() const override;
  79. virtual String get_model_name() const override;
  80. virtual Error shell_open(String p_uri) override;
  81. void set_user_data_dir(String p_dir);
  82. virtual String get_user_data_dir() const override;
  83. virtual String get_cache_path() const override;
  84. virtual String get_locale() const override;
  85. virtual String get_unique_id() const override;
  86. virtual String get_processor_name() const override;
  87. virtual void vibrate_handheld(int p_duration_ms = 500) override;
  88. virtual bool _check_internal_feature_support(const String &p_feature) override;
  89. void on_focus_out();
  90. void on_focus_in();
  91. };
  92. #endif // IOS_ENABLED
  93. #endif // OS_IOS_H