当前位置: 首页>>代码示例>>C++>>正文


C++ engine_draw_frame函数代码示例

本文整理汇总了C++中engine_draw_frame函数的典型用法代码示例。如果您正苦于以下问题:C++ engine_draw_frame函数的具体用法?C++ engine_draw_frame怎么用?C++ engine_draw_frame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了engine_draw_frame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: engine_handle_cmd

/**
 * 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:
            // 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) {
                cocos_dimensions d = engine_init_display(engine);
                if ((d.w > 0) &&
                    (d.h > 0)) {
                    cocos2d::JniHelper::setJavaVM(app->activity->vm);
                    cocos2d::JniHelper::setClassLoaderFrom(app->activity->clazz);

                    // call Cocos2dxHelper.init()
                    cocos2d::JniMethodInfo ccxhelperInit;
                    if (!cocos2d::JniHelper::getStaticMethodInfo(ccxhelperInit,
                                                                 "org/cocos2dx/lib/Cocos2dxHelper",
                                                                 "init",
                                                                 "(Landroid/app/Activity;)V")) {
                        LOGI("cocos2d::JniHelper::getStaticMethodInfo(ccxhelperInit) FAILED");
                    }
                    ccxhelperInit.env->CallStaticVoidMethod(ccxhelperInit.classID,
                                                            ccxhelperInit.methodID,
                                                            app->activity->clazz);

                    cocos_init(d, app);
                }
                engine->animating = 1;
                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:
            if (cocos2d::Director::getInstance()->getOpenGLView()) {
                cocos2d::Application::getInstance()->applicationWillEnterForeground();
                engine->animating = 1;
            }

            break;
        case APP_CMD_LOST_FOCUS:
            {
                cocos2d::Application::getInstance()->applicationDidEnterBackground();
                cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND);
                cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent);
                // Also stop animating.
                engine->animating = 0;
                engine_draw_frame(engine);
            }
            break;
    }
}
开发者ID:Zaka,项目名称:yap,代码行数:63,代码来源:nativeactivity.cpp

示例2: engine_handle_cmd

/**
 * 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:
            // 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:
            break;
        case APP_CMD_LOST_FOCUS:
            engine_draw_frame(engine);
            break;
    }
}
开发者ID:sawillms,项目名称:BigAndroidBBQ2013,代码行数:30,代码来源:main.cpp

示例3: engine_handle_cmd

/**
 * 繝。繧、繝ウ繧ウ繝槭Φ繝峨�蜃ヲ逅� */
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;
    }
}
开发者ID:venkatarajasekhar,项目名称:ssa,代码行数:37,代码来源:main.c

示例4: engine_handle_cmd

// メインコマンドの処理
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: // ウィンドウを破棄するとき
        // EGL情報を破棄する
        engine_term_display(engine);
        break;
    case APP_CMD_GAINED_FOCUS: // アプリがフォーカスを取得したとき
        enable_sensors(engine);
        break;

    case APP_CMD_LOST_FOCUS: // フォーカスが消失したとき
        disable_sensors(engine);
        // アニメーション停止
        engine->animating = 0;
        // 画面を表示
        engine_draw_frame(engine);
        break;
    }
}
开发者ID:hongwd75,项目名称:NDKBook_2nd,代码行数:36,代码来源:main.c

示例5: engine_handle_cmd

/**
  * 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:
      // 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);

        nuiAndroidBridge::androidResize(ANativeWindow_getWidth(app->window), ANativeWindow_getHeight(app->window));
        nuiButton* pButton = new nuiButton("Prout!");
//        pButton->SetPosition(nuiCenter);
        gpBridge->AddChild(pButton);

        engine_draw_frame(engine);
        engine->animating = 1;
      }
      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 = 1;
      engine_draw_frame(engine);
      break;
  }
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:57,代码来源:my_native_code.cpp

示例6: engine_handle_cmd

/**
 * 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:
            LOGI("from APP_CMD_SAVE_STATE\n");
            saveState(app);
            break;
        case APP_CMD_INIT_WINDOW:
            LOGI("from APP_CMD_INIT_WINDOW\n");
            // The window is being shown, get it ready.
            if (engine->app->window != NULL) {
                engine_init_display(engine);
                engine_init_shaders(engine);
                engine_draw_frame(engine);
            }
            break;
        case APP_CMD_TERM_WINDOW:
            LOGI("from APP_CMD_TERM_WINDOW\n");
            // The window is being hidden or closed, clean it up.
            cleanup(engine);
            break;
        case APP_CMD_GAINED_FOCUS:
            saveState(app);
#if 0
            // 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);
            }
#endif
            LOGI("from APP_CMD_GAINED_FOCUS\n");
            break;
        case APP_CMD_LOST_FOCUS:
            LOGI("from APP_CMD_LOST_FOCUS\n");
            // 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;
    }
}
开发者ID:olegzil,项目名称:NativeCrawler,代码行数:52,代码来源:main.c

示例7: engine_handle_cmd

/**
 * 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:
            // 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:
            if (app->window != NULL) {
                int32_t width = ANativeWindow_getWidth(app->window);
                int32_t height = ANativeWindow_getHeight(app->window);
                ANativeWindow_setBuffersGeometry(app->window, width, height, 1);
                LOGI("Window format is now %d",ANativeWindow_getFormat(app->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;
    }
}
开发者ID:Nom1vk,项目名称:VES,代码行数:52,代码来源:main.cpp

示例8: engine_handle_cmd

/**
 * 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_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;

    }

}
开发者ID:AVarfolomeev,项目名称:picasso-graphic,代码行数:33,代码来源:test_android.cpp

示例9: cmdHandler

static void cmdHandler(struct android_app* app, int32_t cmd) {
    switch (cmd) {
    case APP_CMD_SAVE_STATE:
        break;
    case APP_CMD_INIT_WINDOW:
        // The window is being shown, get it ready.
        if (GlobalData::getInstance()->app->window != NULL) {
            ContextControllerEGL::getInstance()->startDisplay();
            init_resources();
            engine_draw_frame();
            running = true;
        }
        break;
    case APP_CMD_TERM_WINDOW:
        // The window is being hidden or closed, clean it up.
        free_resources();
        ContextControllerEGL::getInstance()->endDisplay();
        break;
    case APP_CMD_GAINED_FOCUS:
        // When our app gains focus, we start monitoring the accelerometer.
        break;
    case APP_CMD_LOST_FOCUS:
        logInf("APP_CMD_LOST_FOCUS");
        free_resources();
        ContextControllerEGL::getInstance()->endDisplay();
        break;
    }
}
开发者ID:Yercko,项目名称:AndroidSamples,代码行数:28,代码来源:main.cpp

示例10: android_main

void android_main(struct android_app* state) {
    struct engine engine;

    // Make sure glue isn't stripped.
    app_dummy();

    memset(&engine, 0, sizeof(engine));
    state->userData = &engine;
    state->onAppCmd = engine_handle_cmd;
    state->onInputEvent = engine_handle_input;
    engine.app = state;
	PlatfromInit();

	//_InitSensor();
	//InitSensor();
	
	ANativeActivity_setWindowFlags(state->activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0);

    if (state->savedState != NULL) {
        // We are starting with a previous saved state; restore from it.
        engine.state = *(struct saved_state*)state->savedState;
    }

    // loop waiting for stuff to do.

    while (1) {
        // Read all pending events.
        int ident;
        int events;
        struct android_poll_source* source;

        // If not animating, we will block forever waiting for events.
        // If animating, we loop until all events are read, then continue
        // to draw the next frame of animation.
        while ((ident = ALooper_pollAll(engine.animating ? 0 : -1, 
			NULL, &events,  (void**)&source)) >= 0) {

            // Process this event.
            if (source != NULL) {
                source->process(state, source);
            }

			//_ProcessSensorData(ident);

            // Check if we are exiting.
            if (state->destroyRequested != 0) {
                engine_term_display(&engine);
				PlatfromShutDown();
                return;
            }
        }

        if (engine.animating) {

            // Drawing is throttled to the screen update rate, so there
            // is no need to do timing here.
            engine_draw_frame(&engine);
        }
    }
}
开发者ID:garudaxc,项目名称:AndroidGL,代码行数:60,代码来源:main.cpp

示例11: engine_handle_cmd

void engine_handle_cmd(struct android_app *app, int32_t cmd)
{
	switch(cmd)
	{
		case APP_CMD_SAVE_STATE:
			break;

		case APP_CMD_INIT_WINDOW:
			if(app->window!=NULL)
			{
				engine_init_display();
				engine_draw_frame();
			}
			break;

		case APP_CMD_TERM_WINDOW:
			engine_term_display();
			break;

		case APP_CMD_GAINED_FOCUS:
			break;

		case APP_CMD_LOST_FOCUS:
			break;
	}
}
开发者ID:seishuku,项目名称:gauges,代码行数:26,代码来源:main.c

示例12: engine_handle_cmd

static void engine_handle_cmd(
	struct android_app* app,
	int32_t cmd)
{
	struct engine* engine = (struct engine*)app->userData;

	if(cmd == 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);
        }
	else if(cmd == 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);
		}
	}
        else if(cmd == APP_CMD_TERM_WINDOW)
	{
		// The window is being hidden or closed, clean it up.
		engine_term_display(engine);
	}
        else if(cmd == 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);
		}*/
	}
	else if(cmd == 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);*/
	}
}
开发者ID:wormsparty,项目名称:beautiful-absurd-subtle,代码行数:59,代码来源:android_main.cpp

示例13: android_main

void android_main(struct android_app* state)
{
    struct engine engine;

    // Make sure glue isn't stripped.
    app_dummy();


    AndroidAssetManager::Inst(state->activity->assetManager);
    AndroidAssetManager::Inst()->openDir((char*)"");

    memset(&engine, 0, sizeof(engine));
    state->userData = &engine;
    state->onAppCmd = engine_handle_cmd;
    state->onInputEvent = engine_handle_input;
    engine.app = state;


    if (state->savedState != NULL)
    {
        // We are starting with a previous saved state; restore from it.
        engine.state = *(struct saved_state*)state->savedState;
    }

    // loop waiting for stuff to do.

    while (1) 
    {
        // Read all pending events.
        int ident;
        int events;
        struct android_poll_source* source;

        while ((ident=ALooper_pollAll(0, NULL, &events,
                (void**)&source)) >= 0) 
                {

            // Process this event.
            if (source != NULL) 
            {
                source->process(state, source);
            }

            // Check if we are exiting.
            if (state->destroyRequested != 0) 
            {
                engine_term_display(&engine);
                return;
            }
        }

        getDeltaTime();
        engine_draw_frame(&engine);

    }
}
开发者ID:jiayu1016,项目名称:nativeactivity-es2,代码行数:56,代码来源:main.cpp

示例14: engine_handle_cmd

/**
*处理下一主命令。
*/
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);
                //我们想要每秒获得 60 个事件(在美国)。
                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;
    }
}
开发者ID:tangyiyang,项目名称:seal2d,代码行数:46,代码来源:main.c

示例15: engine_handle_command

static void engine_handle_command(struct android_app* app, int32_t cmd)
{
	struct engine* engine = (struct engine*)app->userData;
	switch (cmd)
	{
		case APP_CMD_SAVE_STATE:
			app_save_state_callback();
			break;

		case APP_CMD_INIT_WINDOW:
			if (engine->app->window != nullptr)
			{
				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 != nullptr)
			{
				ASensorEventQueue_enableSensor(engine->sensorEventQueue, engine->accelerometerSensor);
				ASensorEventQueue_setEventRate(engine->sensorEventQueue, engine->accelerometerSensor, (1000L/60)*1000);

				accelerometer_enable_callback();
			}
			break;

		case APP_CMD_LOST_FOCUS:
			if (engine->accelerometerSensor != nullptr)
			{
				ASensorEventQueue_disableSensor(engine->sensorEventQueue, engine->accelerometerSensor);
				accelerometer_disable_callback();
			}
			engine_draw_frame(engine);
			break;
	}
}
开发者ID:ColinGilbert,项目名称:noobEngine,代码行数:41,代码来源:main.cpp


注:本文中的engine_draw_frame函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。