Path: blob/master/drivers/apple_embedded/os_apple_embedded.h
9898 views
/**************************************************************************/1/* os_apple_embedded.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#ifdef APPLE_EMBEDDED_ENABLED3334#import "apple_embedded.h"3536#import "drivers/apple/joypad_apple.h"37#import "drivers/coreaudio/audio_driver_coreaudio.h"38#include "drivers/unix/os_unix.h"39#include "servers/audio_server.h"40#include "servers/rendering/renderer_compositor.h"4142#if defined(RD_ENABLED)43#include "servers/rendering/rendering_device.h"4445#if defined(VULKAN_ENABLED)46#import "rendering_context_driver_vulkan_apple_embedded.h"47#endif48#endif4950class OS_AppleEmbedded : public OS_Unix {51private:52static HashMap<String, void *> dynamic_symbol_lookup_table;53friend void register_dynamic_symbol(char *name, void *address);5455AudioDriverCoreAudio audio_driver;5657AppleEmbedded *apple_embedded = nullptr;5859JoypadApple *joypad_apple = nullptr;6061MainLoop *main_loop = nullptr;6263virtual void initialize_core() override;64virtual void initialize() override;6566virtual void initialize_joypads() override;6768virtual void set_main_loop(MainLoop *p_main_loop) override;69virtual MainLoop *get_main_loop() const override;7071virtual void delete_main_loop() override;7273virtual void finalize() override;7475bool is_focused = false;7677CGFloat _weight_to_ct(int p_weight) const;78CGFloat _stretch_to_ct(int p_stretch) const;79String _get_default_fontname(const String &p_font_name) const;8081static _FORCE_INLINE_ String get_framework_executable(const String &p_path);8283void deinitialize_modules();8485mutable String remote_fs_dir;8687public:88static OS_AppleEmbedded *get_singleton();8990OS_AppleEmbedded();91~OS_AppleEmbedded();9293void initialize_modules();9495bool iterate();9697void start();9899virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override;100101virtual Vector<String> get_system_fonts() const override;102virtual 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;103virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override;104105virtual Error open_dynamic_library(const String &p_path, void *&p_library_handle, GDExtensionData *p_data = nullptr) override;106virtual Error close_dynamic_library(void *p_library_handle) override;107virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String &p_name, void *&p_symbol_handle, bool p_optional = false) override;108109virtual String get_distribution_name() const override;110virtual String get_version() const override;111virtual String get_model_name() const override;112113virtual Error shell_open(const String &p_uri) override;114115virtual String get_user_data_dir(const String &p_user_dir) const override;116117virtual String get_cache_path() const override;118virtual String get_temp_path() const override;119virtual String get_resource_dir() const override;120121virtual String get_locale() const override;122123virtual String get_unique_id() const override;124virtual String get_processor_name() const override;125126virtual void vibrate_handheld(int p_duration_ms = 500, float p_amplitude = -1.0) override;127128virtual bool _check_internal_feature_support(const String &p_feature) override;129130virtual Error setup_remote_filesystem(const String &p_server_host, int p_port, const String &p_password, String &r_project_path) override;131132void on_focus_out();133void on_focus_in();134135void on_enter_background();136void on_exit_background();137138virtual Rect2 calculate_boot_screen_rect(const Size2 &p_window_size, const Size2 &p_imgrect_size) const override;139140virtual bool request_permission(const String &p_name) override;141virtual Vector<String> get_granted_permissions() const override;142};143144#endif // APPLE_EMBEDDED_ENABLED145146147