///////////////////////////////////////////////////////
| 297 | |
| 298 | //////////////////////////////////////////////////////////// |
| 299 | void onDestroy(ANativeActivity* activity) |
| 300 | { |
| 301 | // Retrieve our activity states from the activity instance |
| 302 | sf::priv::ActivityStates& states = retrieveStates(*activity); |
| 303 | |
| 304 | // Send an event to warn people the activity is being destroyed |
| 305 | { |
| 306 | const std::lock_guard lock(states.mutex); |
| 307 | |
| 308 | // If the main thread hasn't yet finished, send the event and wait for |
| 309 | // it to finish. |
| 310 | if (!states.mainOver) |
| 311 | states.forwardEvent(sf::Event::Closed{}); |
| 312 | } |
| 313 | |
| 314 | // Wait for the main thread to be terminated |
| 315 | states.mutex.lock(); |
| 316 | |
| 317 | while (!states.terminated) |
| 318 | { |
| 319 | states.mutex.unlock(); |
| 320 | sf::sleep(sf::milliseconds(20)); |
| 321 | states.mutex.lock(); |
| 322 | } |
| 323 | |
| 324 | states.mutex.unlock(); |
| 325 | |
| 326 | // Delete our allocated states |
| 327 | delete &states; |
| 328 | |
| 329 | // Reset the activity pointer for all modules |
| 330 | sf::priv::resetActivity(nullptr); |
| 331 | |
| 332 | // The application should now terminate |
| 333 | } |
| 334 | |
| 335 | //////////////////////////////////////////////////////////// |
| 336 | void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window) |
nothing calls this directly
no test coverage detected