mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #113297 from shiena/feature/lifecycle-callbacks
Add platform lifecycle callbacks to CameraServer base class
This commit is contained in:
commit
cd8a292324
8 changed files with 44 additions and 30 deletions
|
|
@ -53,12 +53,7 @@
|
|||
#include "main/main.h"
|
||||
#include "servers/rendering/rendering_server.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h" // For camera.
|
||||
|
||||
#ifdef MODULE_CAMERA_ENABLED
|
||||
#include "modules/camera/camera_android.h"
|
||||
#include "servers/camera/camera_server.h"
|
||||
#endif
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
#include "servers/xr/xr_server.h"
|
||||
|
|
@ -607,12 +602,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererResumed(JNI
|
|||
|
||||
// We force redraw to ensure we render at least once when resuming the app.
|
||||
Main::force_redraw();
|
||||
#ifdef MODULE_CAMERA_ENABLED
|
||||
CameraAndroid *camera_android = Object::cast_to<CameraAndroid>(CameraServer::get_singleton());
|
||||
if (camera_android) {
|
||||
camera_android->handle_resume();
|
||||
CameraServer *camera_server = CameraServer::get_singleton();
|
||||
if (camera_server) {
|
||||
camera_server->handle_application_resume();
|
||||
}
|
||||
#endif // MODULE_CAMERA_ENABLED
|
||||
if (os_android->get_main_loop()) {
|
||||
os_android->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_RESUMED);
|
||||
}
|
||||
|
|
@ -623,29 +616,25 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererPaused(JNIE
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MODULE_CAMERA_ENABLED
|
||||
CameraAndroid *camera_android = Object::cast_to<CameraAndroid>(CameraServer::get_singleton());
|
||||
if (camera_android) {
|
||||
camera_android->handle_pause();
|
||||
CameraServer *camera_server = CameraServer::get_singleton();
|
||||
if (camera_server) {
|
||||
camera_server->handle_application_pause();
|
||||
}
|
||||
#endif // MODULE_CAMERA_ENABLED
|
||||
|
||||
if (os_android->get_main_loop()) {
|
||||
os_android->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_PAUSED);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onScreenRotationChange(JNIEnv *env, jclass clazz) {
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onScreenRotationChange(JNIEnv *env, jclass clazz, jint p_orientation) {
|
||||
if (step.get() <= STEP_SETUP) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MODULE_CAMERA_ENABLED
|
||||
CameraAndroid *camera_android = Object::cast_to<CameraAndroid>(CameraServer::get_singleton());
|
||||
if (camera_android) {
|
||||
camera_android->handle_rotation_change();
|
||||
CameraServer *camera_server = CameraServer::get_singleton();
|
||||
if (camera_server) {
|
||||
camera_server->handle_display_rotation_change(p_orientation);
|
||||
}
|
||||
#endif // MODULE_CAMERA_ENABLED
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_shouldDispatchInputToRenderThread(JNIEnv *env, jclass clazz) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue