* Teamplate function for NativeActivity derived applications * Create/Delete camera object with * INIT_WINDOW/TERM_WINDOW command, ignoring other event. */
| 33 | * INIT_WINDOW/TERM_WINDOW command, ignoring other event. |
| 34 | */ |
| 35 | static void ProcessAndroidCmd(struct android_app* app, int32_t cmd) { |
| 36 | CameraEngine* engine = reinterpret_cast<CameraEngine*>(app->userData); |
| 37 | switch (cmd) { |
| 38 | case APP_CMD_INIT_WINDOW: |
| 39 | if (engine->AndroidApp()->window != NULL) { |
| 40 | engine->SaveNativeWinRes(ANativeWindow_getWidth(app->window), |
| 41 | ANativeWindow_getHeight(app->window), |
| 42 | ANativeWindow_getFormat(app->window)); |
| 43 | engine->OnAppInitWindow(); |
| 44 | } |
| 45 | break; |
| 46 | case APP_CMD_TERM_WINDOW: |
| 47 | engine->OnAppTermWindow(); |
| 48 | ANativeWindow_setBuffersGeometry( |
| 49 | app->window, engine->GetSavedNativeWinWidth(), |
| 50 | engine->GetSavedNativeWinHeight(), engine->GetSavedNativeWinFormat()); |
| 51 | break; |
| 52 | case APP_CMD_CONFIG_CHANGED: |
| 53 | engine->OnAppConfigChange(); |
| 54 | break; |
| 55 | case APP_CMD_LOST_FOCUS: |
| 56 | break; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | extern "C" void android_main(struct android_app* state) { |
| 61 | CameraEngine engine(state); |
nothing calls this directly
no test coverage detected