Route render context lifecycle through platform services
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
|
||||
#ifdef __ANDROID__
|
||||
void displayKeyboard(bool pShow);
|
||||
void android_async_lock();
|
||||
void android_async_swap();
|
||||
void android_async_unlock();
|
||||
void android_attach_jni();
|
||||
void android_detach_jni();
|
||||
void android_pick_file(std::function<void(std::string)> callback);
|
||||
@@ -104,6 +107,43 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void acquire_render_context() override
|
||||
{
|
||||
#if __OSX__
|
||||
[App::I->osx_view async_lock];
|
||||
#elif __IOS__
|
||||
[App::I->ios_view async_lock];
|
||||
#elif __ANDROID__
|
||||
android_async_lock();
|
||||
#elif __LINUX__ || __WEB__
|
||||
glfwMakeContextCurrent(App::I->glfw_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
void release_render_context() override
|
||||
{
|
||||
#if __OSX__
|
||||
[App::I->osx_view async_unlock];
|
||||
#elif __IOS__
|
||||
[App::I->ios_view async_unlock];
|
||||
#elif __ANDROID__
|
||||
android_async_unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void present_render_context() override
|
||||
{
|
||||
#if __OSX__
|
||||
[App::I->osx_view async_swap];
|
||||
#elif __IOS__
|
||||
[App::I->ios_view async_swap];
|
||||
#elif __ANDROID__
|
||||
android_async_swap();
|
||||
#elif __LINUX__ || __WEB__
|
||||
glfwSwapBuffers(App::I->glfw_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
{
|
||||
(void)delta_time_seconds;
|
||||
|
||||
Reference in New Issue
Block a user