(Android) Workaround for an SDL issue where SDL_PollEvent() consumes all available CPU cycles when the application has been stopped

This commit is contained in:
Leon Styhre 2023-12-26 17:34:51 +01:00
parent 26ad7b9a7e
commit 45d885e2a9

View file

@ -494,6 +494,14 @@ void applicationLoop()
#if !defined(__EMSCRIPTEN__) #if !defined(__EMSCRIPTEN__)
while (true) { while (true) {
#endif #endif
#if defined(__ANDROID__)
// Workaround for an SDL issue where SDL_PollEvent() consumes all available CPU
// cycles when the application has been stopped.
while (AndroidVariables::sPaused)
SDL_Delay(10);
#endif
if (SDL_PollEvent(&event)) { if (SDL_PollEvent(&event)) {
do { do {
InputManager::getInstance().parseEvent(event); InputManager::getInstance().parseEvent(event);