Own legacy platform services on Web and Android
This commit is contained in:
@@ -1090,9 +1090,10 @@ void android_main(struct android_app* state) {
|
|||||||
// Make sure glue isn't stripped.
|
// Make sure glue isn't stripped.
|
||||||
// DON'T REMOVE, even if the compiler say it's deprecated
|
// DON'T REMOVE, even if the compiler say it's deprecated
|
||||||
app_dummy();
|
app_dummy();
|
||||||
|
auto platform_services = pp::platform::legacy::create_platform_services();
|
||||||
|
|
||||||
App::I = new App;
|
App::I = new App;
|
||||||
App::I->set_platform_services(&pp::platform::legacy::platform_services());
|
App::I->set_platform_services(platform_services.get());
|
||||||
|
|
||||||
memset(&g_engine, 0, sizeof(g_engine));
|
memset(&g_engine, 0, sizeof(g_engine));
|
||||||
state->userData = &g_engine;
|
state->userData = &g_engine;
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ What is already real:
|
|||||||
- `pp_app_core`
|
- `pp_app_core`
|
||||||
|
|
||||||
Latest slice:
|
Latest slice:
|
||||||
|
- `webgl/src/main.cpp` now owns a TU-local legacy `PlatformServices`
|
||||||
|
instance and binds that owned service into `App` during `StartApp()`.
|
||||||
|
- `android/src/cpp/main.cpp` now owns a function-lifetime legacy
|
||||||
|
`PlatformServices` instance in `android_main()` and binds that owned service
|
||||||
|
into `App` instead of binding the process-global fallback directly.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` now exposes an ownable
|
- `src/platform_legacy/legacy_platform_services.*` now exposes an ownable
|
||||||
`create_platform_services()` entrypoint alongside the legacy fallback
|
`create_platform_services()` entrypoint alongside the legacy fallback
|
||||||
accessor.
|
accessor.
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ Completed, blocked, and superseded task history moved to
|
|||||||
the queue is now ordered by code movement instead.
|
the queue is now ordered by code movement instead.
|
||||||
|
|
||||||
Current slice:
|
Current slice:
|
||||||
|
- `webgl/src/main.cpp` now binds an owned legacy `PlatformServices` instance
|
||||||
|
instead of reading the process-global fallback directly during `StartApp()`.
|
||||||
|
- `android/src/cpp/main.cpp` now binds a function-lifetime owned legacy
|
||||||
|
`PlatformServices` instance in `android_main()`, replacing the direct bind to
|
||||||
|
the process-global fallback accessor.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` now exposes an ownable
|
- `src/platform_legacy/legacy_platform_services.*` now exposes an ownable
|
||||||
`create_platform_services()` entrypoint while keeping the fallback singleton
|
`create_platform_services()` entrypoint while keeping the fallback singleton
|
||||||
for non-migrated platforms.
|
for non-migrated platforms.
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ App app;
|
|||||||
GLFWwindow* wnd;
|
GLFWwindow* wnd;
|
||||||
float theta = 0;
|
float theta = 0;
|
||||||
glm::vec2 g_cursor_pos;
|
glm::vec2 g_cursor_pos;
|
||||||
|
std::unique_ptr<pp::platform::PlatformServices> g_platform_services;
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
class TaskCallback
|
class TaskCallback
|
||||||
@@ -120,7 +121,7 @@ void StartApp()
|
|||||||
{
|
{
|
||||||
App::I = &app;
|
App::I = &app;
|
||||||
pp::platform::legacy::set_legacy_glfw_window(wnd);
|
pp::platform::legacy::set_legacy_glfw_window(wnd);
|
||||||
app.set_platform_services(&pp::platform::legacy::platform_services());
|
app.set_platform_services(g_platform_services.get());
|
||||||
app.initLog();
|
app.initLog();
|
||||||
app.create();
|
app.create();
|
||||||
app.width = 1024;
|
app.width = 1024;
|
||||||
@@ -197,6 +198,8 @@ void main_loop()
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
g_platform_services = pp::platform::legacy::create_platform_services();
|
||||||
|
|
||||||
if (glfwInit() != GL_TRUE)
|
if (glfwInit() != GL_TRUE)
|
||||||
printf("Failed to init GLFW");
|
printf("Failed to init GLFW");
|
||||||
wnd = glfwCreateWindow(1024, 768, "PanoPainter", nullptr, nullptr);
|
wnd = glfwCreateWindow(1024, 768, "PanoPainter", nullptr, nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user