Split Apple platform target and move platform state ownership

This commit is contained in:
2026-06-17 01:03:01 +02:00
parent 5fdc9a9dd6
commit 90a55b86fe
18 changed files with 258 additions and 104 deletions

View File

@@ -2,8 +2,52 @@
#include "platform_api/platform_services.h"
#if __LINUX__ || __WEB__
struct GLFWwindow;
#endif
#if defined(__OBJC__) && defined(__IOS__)
@class GameViewController;
@class AppDelegate;
#endif
#if defined(__OBJC__) && defined(__OSX__)
@class View;
@class AppOSX;
#endif
namespace pp::platform::legacy {
#if defined(__LINUX__) || defined(__WEB__)
struct RetainedLegacyGlfwWindowHooks final {
std::function<void()> acquire_render_context;
std::function<void()> present_render_context;
std::function<void()> request_app_close;
};
struct RetainedLegacyGlfwWindowState final {
GLFWwindow* window = nullptr;
RetainedLegacyGlfwWindowHooks hooks;
};
[[nodiscard]] RetainedLegacyGlfwWindowState& active_legacy_glfw_window_state();
[[nodiscard]] RetainedLegacyGlfwWindowHooks& active_legacy_glfw_window_hooks();
#endif
#if defined(__IOS__) || defined(__OSX__)
struct RetainedLegacyAppleState final {
#ifdef __IOS__
GameViewController* ios_view = nullptr;
AppDelegate* ios_app = nullptr;
#elif defined(__OSX__)
View* osx_view = nullptr;
AppOSX* osx_app = nullptr;
#endif
};
[[nodiscard]] RetainedLegacyAppleState& active_legacy_apple_state();
#endif
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths();
}