New: refeta la lògica d'eixir o apagar el sistema

This commit is contained in:
2025-06-12 20:25:59 +02:00
parent 6c707fa178
commit 99ffe9f7a7
6 changed files with 22 additions and 52 deletions

View File

@@ -122,10 +122,8 @@ void Director::close()
// Libera todos los recursos de SDL
SDL_Quit();
#ifdef ARCADE
// Si está en modo arcade, apaga el sistema si corresponde
shutdownSystem(section::options == section::Options::QUIT_WITH_CONTROLLER);
#endif
// Apaga el sistema
shutdownSystem(section::options == section::Options::SHUTDOWN);
}
// Carga los parametros
@@ -671,26 +669,9 @@ int Director::run()
}
}
std::string return_code;
switch (section::options)
{
case section::Options::QUIT_WITH_KEYBOARD:
return_code = "with keyboard";
break;
case section::Options::QUIT_WITH_CONTROLLER:
return_code = "with controller";
break;
default:
return_code = "from event";
break;
}
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\nGame end %s", return_code.c_str());
return (section::options == section::Options::QUIT_WITH_CONTROLLER) ? 1 : 0;
return 0;
}
#ifdef ARCADE
// Apaga el sistema
void Director::shutdownSystem(bool should_shutdown)
{
@@ -710,5 +691,4 @@ void Director::shutdownSystem(bool should_shutdown)
#error "Sistema operativo no soportado"
#endif
}
}
#endif // ARCADE
}