Пример #1
0
int main(int argc, char** argv) {

    struct Engine *e;
    if((e = initEngine(argc, argv)) == NULL){
        releaseEngine(e); //OK if called twice by NULL check
        return(EXIT_FAILURE);
    }
        
    engineRun(e);
    
    releaseEngine(e);
    return (EXIT_SUCCESS);
}
Пример #2
0
void AREngine::enginePlay()
{
    bool vStarted = true;
    mARState = 2;

    while (vStarted) {
        switch (mARState) {
        case 0: // destroy
            LOGI("AR Engine state 0 -> 1");
            engineEnd();
            mARState = 1;
            this_thread::sleep_for(chrono::milliseconds(40));
            break;
        case 1: // off
            vStarted = false;
            this_thread::sleep_for(chrono::milliseconds(40));
            break;
        case 2: // create
            if (w->mARState != 2 && w->mARSurface == 2) {
                LOGI("AR Engine state 2 -> 3");
                engineEnable(w->mSurface, w->mSurfaceWidth, w->mSurfaceHeight);
                mARSurface = w->mARSurface;
                mARState = 3;
            }
            if (w->mARState == 0) {
                LOGI("AR Engine state 2 -> 0");
                mARState = 0;
            }
            this_thread::sleep_for(chrono::milliseconds(40));
            break;
        case 3: // resume
            LOGI("AR Engine state 3 -> 4");
            engineResume();
            mARState = 4;

            if (w->mARState != 3) {
                LOGI("AR Engine state 3 -> 5");
                mARState = 5;
            }
            this_thread::sleep_for(chrono::milliseconds(40));
            break;
        case 4: // run
            engineRun();

            if (w->mARState != 3) {
                LOGI("AR Engine state 4 -> 5");
                mARState = 5;
            }
            break;
        case 5: // pause
            engineSleep();

            if (w->mARState < 3) {
                LOGI("AR Engine state 5 -> 0");
                mARState = 0;
            }
            if (w->mARState == 3) {
                LOGI("AR Engine state 5 -> 3");
                mARState = 3;
            }
            this_thread::sleep_for(chrono::milliseconds(40));
            break;
        default: // bad state
            LOGE("AR Engine BAD state");
            mARState = 0;
            this_thread::sleep_for(chrono::milliseconds(40));
            break;
        }
        this_thread::sleep_for(chrono::milliseconds(10));
    }
}
Пример #3
0
int main() {
	engineInit();
	engineRun();
	engineDestroy();
	return 0;
}