cocos2dx中帧循环的伪代码实现

1.在游戏开发中,帧率很大程度上体现了游戏的流畅度,帧循环是游戏中一个很重要的概念

2.下面用伪代码实现了cocos2dx中的帧循环

/*main函数调用*/
    CCApplication::sharedApplication()->run();

    /*游戏真正的入口,完成精灵的布置和场景的初始化*/
    applicationDidFinishLaunching();

    /*帧循环开始*/
    while (1)
    {
        CCDirector::sharedDirector()->mainLoop();

            /*绘制场景*/
            drawScene();

                /*处理定时器事件*/
                m_pScheduler->update(m_fDeltaTime);
                /*完成图片的渲染*/
                m_pRunningScene->visit();

            /*完成本帧的内存清理工作*/
            CCPoolManager::sharedPoolManager()->pop();

        /*处理触摸消息及触摸事件*/
        TranslateMessage(&msg);
        DispatchMessage(&msg);

    }
原文地址:https://www.cnblogs.com/ttss/p/4054434.html