casablanca/Release/tests/common/TestRunner/vs14.android/TestRunner.android.NativeActivity/main.cpp
static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
    struct engine* engine = (struct engine*)app->userData;
    switch (cmd) {
    case APP_CMD_SAVE_STATE:
        // The system has asked us to save our current state.  Do so.
        engine->app->savedState = malloc(sizeof(struct saved_state));
        *((struct saved_state*)engine->app->savedState) = engine->state;
        engine->app->savedStateSize = sizeof(struct saved_state);
        break;
    case APP_CMD_INIT_WINDOW:
        // The window is being shown, get it ready.
        if (engine->app->window != NULL) {
            engine_init_display(engine);
            engine_draw_frame(engine);
        }
        break;
    case APP_CMD_TERM_WINDOW:
        // The window is being hidden or closed, clean it up.
        engine_term_display(engine);
        break;
    case APP_CMD_GAINED_FOCUS:
        // When our app gains focus, we start monitoring the accelerometer.
        if (engine->accelerometerSensor != NULL) {
            ASensorEventQueue_enableSensor(engine->sensorEventQueue,
                engine->accelerometerSensor);
            // We'd like to get 60 events per second (in us).
            ASensorEventQueue_setEventRate(engine->sensorEventQueue,
                engine->accelerometerSensor, (1000L / 60) * 1000);
        }
        break;
    case APP_CMD_LOST_FOCUS:
        // When our app loses focus, we stop monitoring the accelerometer.
        // This is to avoid consuming battery while not being used.
        if (engine->accelerometerSensor != NULL) {
            ASensorEventQueue_disableSensor(engine->sensorEventQueue,
                engine->accelerometerSensor);
        }
        // Also stop animating.
        engine->animating = 0;
        engine_draw_frame(engine);
        break;
    }
}
/**
* Process the next main command.
*/
Process the next main command.
Process the next main command .
static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
    struct engine* engine = (struct engine*)app->userData;
    switch (cmd) {
    case APP_CMD_SAVE_STATE:
        engine->app->savedState = malloc(sizeof(struct saved_state));
        *((struct saved_state*)engine->app->savedState) = engine->state;
        engine->app->savedStateSize = sizeof(struct saved_state);
        break;
    case APP_CMD_INIT_WINDOW:
        if (engine->app->window != NULL) {
            engine_init_display(engine);
            engine_draw_frame(engine);
        }
        break;
    case APP_CMD_TERM_WINDOW:
        engine_term_display(engine);
        break;
    case APP_CMD_GAINED_FOCUS:
        if (engine->accelerometerSensor != NULL) {
            ASensorEventQueue_enableSensor(engine->sensorEventQueue,
                engine->accelerometerSensor);
            ASensorEventQueue_setEventRate(engine->sensorEventQueue,
                engine->accelerometerSensor, (1000L / 60) * 1000);
        }
        break;
    case APP_CMD_LOST_FOCUS:
        if (engine->accelerometerSensor != NULL) {
            ASensorEventQueue_disableSensor(engine->sensorEventQueue,
                engine->accelerometerSensor);
        }
        engine->animating = 0;
        engine_draw_frame(engine);
        break;
    }
}
static void engine_handle_cmd ( struct android_app * app , int32_t cmd ) { struct engine * engine = ( struct engine * ) app -> userData ; switch ( cmd ) { case APP_CMD_SAVE_STATE : engine -> app -> savedState = malloc ( sizeof ( struct saved_state ) ) ; * ( ( struct saved_state * ) engine -> app -> savedState ) = engine -> state ; engine -> app -> savedStateSize = sizeof ( struct saved_state ) ; break ; case APP_CMD_INIT_WINDOW : if ( engine -> app -> window != NULL ) { engine_init_display ( engine ) ; engine_draw_frame ( engine ) ; } break ; case APP_CMD_TERM_WINDOW : engine_term_display ( engine ) ; break ; case APP_CMD_GAINED_FOCUS : if ( engine -> accelerometerSensor != NULL ) { ASensorEventQueue_enableSensor ( engine -> sensorEventQueue , engine -> accelerometerSensor ) ; ASensorEventQueue_setEventRate ( engine -> sensorEventQueue , engine -> accelerometerSensor , ( 1000L / 60 ) * 1000 ) ; } break ; case APP_CMD_LOST_FOCUS : if ( engine -> accelerometerSensor != NULL ) { ASensorEventQueue_disableSensor ( engine -> sensorEventQueue , engine -> accelerometerSensor ) ; } engine -> animating = 0 ; engine_draw_frame ( engine ) ; break ; } }
Process the next main command.
Process the next main command .
// The system has asked us to save our current state.  Do so.
 // The window is being shown, get it ready.
 // The window is being hidden or closed, clean it up.
 // When our app gains focus, we start monitoring the accelerometer.
 // We'd like to get 60 events per second (in us).
 // When our app loses focus, we stop monitoring the accelerometer.
 // This is to avoid consuming battery while not being used.
 // Also stop animating.
