* Process the next main command. */
| 253 | * Process the next main command. |
| 254 | */ |
| 255 | void Engine::HandleCmd(struct android_app* app, int32_t cmd) { |
| 256 | Engine* eng = (Engine*)app->userData; |
| 257 | switch (cmd) { |
| 258 | case APP_CMD_SAVE_STATE: |
| 259 | break; |
| 260 | case APP_CMD_INIT_WINDOW: |
| 261 | // The window is being shown, get it ready. |
| 262 | if (app->window != NULL) { |
| 263 | eng->InitDisplay(app); |
| 264 | eng->has_focus_ = true; |
| 265 | eng->DrawFrame(); |
| 266 | } |
| 267 | break; |
| 268 | case APP_CMD_TERM_WINDOW: |
| 269 | // The window is being hidden or closed, clean it up. |
| 270 | eng->TermDisplay(); |
| 271 | eng->has_focus_ = false; |
| 272 | break; |
| 273 | case APP_CMD_STOP: |
| 274 | break; |
| 275 | case APP_CMD_GAINED_FOCUS: |
| 276 | eng->ResumeSensors(); |
| 277 | // Start animation |
| 278 | eng->has_focus_ = true; |
| 279 | break; |
| 280 | case APP_CMD_LOST_FOCUS: |
| 281 | eng->SuspendSensors(); |
| 282 | // Also stop animating. |
| 283 | eng->has_focus_ = false; |
| 284 | eng->DrawFrame(); |
| 285 | break; |
| 286 | case APP_CMD_LOW_MEMORY: |
| 287 | // Free up GL resources |
| 288 | eng->TrimMemory(); |
| 289 | break; |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | //------------------------------------------------------------------------- |
| 294 | // Sensor handlers |
nothing calls this directly
no test coverage detected