示例#1
0
/*!
 */
void pAcquisitionWindow::changeVisualizationMode(int mode)
{
  displayConfiguration(detectorConfiguration(m_lastVisualizationMode), mode);
  m_lastVisualizationMode = mode;
}
示例#2
0
// Main関数
void android_main(struct android_app* state) {
    struct engine engine;

    // glueが削除されないように
    app_dummy();

    memset(&engine, 0, sizeof(engine));
    // ユーザーデータの配置
    state->userData = &engine;
    // アプリケーションコマンド処理関数の設定
    state->onAppCmd = engine_handle_cmd;

    // 入力イベント処理関数の設定
    state->onInputEvent = engine_handle_input;
    engine.app = state;

    // センサーの初期化を行う
    init_sensors(&engine, state);

    if (state->savedState != NULL) {
        // 以前の状態に戻す
        engine.state = *(struct saved_state*) state->savedState;
    }

    // Configurationを表示
    displayConfiguration(&engine);


    engine.animating = 1;
    while (1) {

        int ident;
        int events;
        struct android_poll_source* source;

        // アプリケーションの状態にあわせてセンサー情報の処理を行う
        while ((ident = ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,
                                        (void**) &source)) >= 0) { /////-----(1)
            // 内部イベントを処理する
            if (source != NULL) {
                source->process(state, source);
            }

            // センサー情報取得キューのデータを処理する
            if (ident == LOOPER_ID_USER) {/////-----(2)
                ASensorEvent event[1];
                int count, i, j;
                while ((count = ASensorEventQueue_getEvents(engine.sensorEventQueue,
                                event, 1)) > 0) {
                    for (i = 0; i < count; i++) {
                        for (j = 0; j < SENSOR_MAX; j++) {
                            if ((engine.sensors[j].sensor != NULL)
                                    && (engine.sensors[j].type == event[i].type)) {
                                engine.sensors[j].value = event[i].vector; /////-----(3)
                            }
                        }
                    }
                }
            }
            // EGL情報を破棄する
            if (state->destroyRequested != 0) {
                engine_term_display(&engine);
                return;
            }
        }
        // 画面の描画
        engine_draw_frame(&engine);
    }

}