From 5394c20817231780b1a3acc191fbbbbc98205ac4 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 4 Jun 2024 17:53:49 +0200 Subject: [PATCH] background processing --- android/app/AndroidManifest.xml | 5 ++--- src/main.cpp | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/android/app/AndroidManifest.xml b/android/app/AndroidManifest.xml index 5360a3fe..a7dd9f2e 100644 --- a/android/app/AndroidManifest.xml +++ b/android/app/AndroidManifest.xml @@ -76,9 +76,8 @@ android:theme="@style/AppTheme" android:hardwareAccelerated="true" > - + + screen = std::make_unique(args, renderer.get(), theme); - + bool is_background = false; bool quit = false; while (!quit) { auto new_time = std::chrono::steady_clock::now(); @@ -131,6 +131,10 @@ int main(int argc, char** argv) { if (event.type == SDL_EVENT_QUIT) { quit = true; break; + } else if (event.type == SDL_EVENT_WILL_ENTER_BACKGROUND) { + is_background = true; + } else if (event.type == SDL_EVENT_DID_ENTER_FOREGROUND) { + is_background = false; } if (screen->handleEvent(event)) {