| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#ifdef APPLE_EMBEDDED_ENABLED |
| 34 |
|
| 35 |
#import "apple_embedded.h" |
| 36 |
|
| 37 |
#import "drivers/apple/joypad_apple.h" |
| 38 |
#import "drivers/coreaudio/audio_driver_coreaudio.h" |
| 39 |
#include "drivers/unix/os_unix.h" |
| 40 |
#include "servers/audio/audio_server.h" |
| 41 |
#include "servers/rendering/renderer_compositor.h" |
| 42 |
|
| 43 |
#if defined(RD_ENABLED) |
| 44 |
#include "servers/rendering/rendering_device.h" |
| 45 |
|
| 46 |
#if defined(VULKAN_ENABLED) |
| 47 |
#import "rendering_context_driver_vulkan_apple_embedded.h" |
| 48 |
#endif |
| 49 |
#endif |
| 50 |
|
| 51 |
class OS_AppleEmbedded : public OS_Unix { |
| 52 |
private: |
| 53 |
static HashMap<String, void *> dynamic_symbol_lookup_table; |
| 54 |
friend void register_dynamic_symbol(char *name, void *address); |
| 55 |
|
| 56 |
AudioDriverCoreAudio audio_driver; |
| 57 |
|
| 58 |
AppleEmbedded *apple_embedded = nullptr; |
| 59 |
|
| 60 |
JoypadApple *joypad_apple = nullptr; |
| 61 |
|
| 62 |
MainLoop *main_loop = nullptr; |
| 63 |
|
| 64 |
virtual void initialize_core() override; |
| 65 |
virtual void initialize() override; |
| 66 |
|
| 67 |
virtual void initialize_joypads() override; |
| 68 |
|
| 69 |
virtual void set_main_loop(MainLoop *p_main_loop) override; |
| 70 |
virtual MainLoop *get_main_loop() const override; |
| 71 |
|
| 72 |
virtual void delete_main_loop() override; |
| 73 |
|
| 74 |
virtual void finalize() override; |
| 75 |
|
| 76 |
bool is_focused = false; |
| 77 |
|
| 78 |
CGFloat _weight_to_ct(int p_weight) const; |
| 79 |
CGFloat _stretch_to_ct(int p_stretch) const; |
| 80 |
String _get_default_fontname(const String &p_font_name) const; |
| 81 |
|
| 82 |
static _FORCE_INLINE_ String get_framework_executable(const String &p_path); |
| 83 |
|
| 84 |
void deinitialize_modules(); |
| 85 |
|
| 86 |
mutable String remote_fs_dir; |
| 87 |
|
| 88 |
public: |
| 89 |
static OS_AppleEmbedded *get_singleton(); |
| 90 |
|
| 91 |
OS_AppleEmbedded(); |
| 92 |
~OS_AppleEmbedded(); |
| 93 |
|
| 94 |
void initialize_modules(); |
| 95 |
|
| 96 |
bool iterate(); |
| 97 |
|
| 98 |
void start(); |
| 99 |
|
| 100 |
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override; |
| 101 |
|
| 102 |
virtual Vector<String> get_system_fonts() const override; |
| 103 |
virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; |
| 104 |
virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; |
| 105 |
|
| 106 |
virtual Error open_dynamic_library(const String &p_path, void *&p_library_handle, GDExtensionData *p_data = nullptr) override; |
| 107 |
virtual Error close_dynamic_library(void *p_library_handle) override; |
| 108 |
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String &p_name, void *&p_symbol_handle, bool p_optional = false) override; |
| 109 |
|
| 110 |
virtual String get_distribution_name() const override; |
| 111 |
virtual String get_version() const override; |
| 112 |
virtual String get_model_name() const override; |
| 113 |
|
| 114 |
virtual Error shell_open(const String &p_uri) override; |
| 115 |
|
| 116 |
virtual String get_user_data_dir(const String &p_user_dir) const override; |
| 117 |
|
| 118 |
virtual String get_cache_path() const override; |
| 119 |
virtual String get_temp_path() const override; |
| 120 |
virtual String get_resource_dir() const override; |
| 121 |
virtual String get_bundle_resource_dir() const override; |
| 122 |
|
| 123 |
virtual String get_locale() const override; |
| 124 |
|
| 125 |
virtual String get_unique_id() const override; |
| 126 |
virtual String get_processor_name() const override; |
| 127 |
|
| 128 |
virtual void vibrate_handheld(int p_duration_ms = 500, float p_amplitude = -1.0) override; |
| 129 |
|
| 130 |
virtual bool _check_internal_feature_support(const String &p_feature) override; |
| 131 |
|
| 132 |
virtual Error setup_remote_filesystem(const String &p_server_host, int p_port, const String &p_password, String &r_project_path) override; |
| 133 |
|
| 134 |
void on_focus_out(); |
| 135 |
void on_focus_in(); |
| 136 |
|
| 137 |
void on_enter_background(); |
| 138 |
void on_exit_background(); |
| 139 |
|
| 140 |
virtual Rect2 calculate_boot_screen_rect(const Size2 &p_window_size, const Size2 &p_imgrect_size) const override; |
| 141 |
|
| 142 |
virtual bool request_permission(const String &p_name) override; |
| 143 |
virtual Vector<String> get_granted_permissions() const override; |
| 144 |
}; |
| 145 |
|
| 146 |
#endif |