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


C++ IEntitySystem::GetAll方法代码示例

本文整理汇总了C++中IEntitySystem::GetAll方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntitySystem::GetAll方法的具体用法?C++ IEntitySystem::GetAll怎么用?C++ IEntitySystem::GetAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntitySystem的用法示例。


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

示例1: MainLoop

void Game::MainLoop()
{
    ITimeSystem *pTimeSystem = m_pEnv->sys->pTimeSystem;

    // Time in userspace, ignoring frametime and whether we are paused, compiling, etc.
    // That seems most appropriate to the filechangenotifier
    double fSessionTimeNow = pTimeSystem->GetSessionTimeNow();
    float fSessionTimeDelta = (float)(fSessionTimeNow - m_fLastUpdateSessionTime);
    float fClampedDelta = (std::min)( fSessionTimeDelta*m_GameSpeed, 0.1f ); // used for IObject updates
    m_fLastUpdateSessionTime = fSessionTimeNow;

    float fFrameTimeDelta = (float)pTimeSystem->GetSmoothFrameDuration();

    m_pEnv->sys->pFileChangeNotifier->Update(fSessionTimeDelta);

    //check status of any compile
    bool bLoadModule = false;
    if( m_pEnv->sys->pRuntimeObjectSystem->GetIsCompiledComplete() )
    {
        bLoadModule = true; //we load module after update/display, to get notification on screen correct
    }

    pTimeSystem->StartFrame();

    if( !m_bHaveProgramError )
    {
        AUDynArray<AUEntityId> entities;
        IEntitySystem* pEntitySystem = m_pEnv->sys->pEntitySystem;
        pEntitySystem->GetAll(entities);

        if (!ProtectedUpdate(entities, fClampedDelta))
        {
            m_bHaveProgramError = true;
            m_pEnv->sys->pLogSystem->Log(eLV_ERRORS, "Have caught an exception in main entity Update loop, code will not be run until new compile - please fix.\n");
        }
    }

    if (!m_pCameraControl || !m_pLightingControl)
    {
        if (!m_bRenderError)
        {
            m_bRenderError = true;
            m_pEnv->sys->pLogSystem->Log(eLV_ERRORS, "Missing Camera and/or Lighting control. Can't render world.\n");
        }
    }
    else
    {
        m_bRenderError = false;
        RenderWorld();
    }

    RocketLibUpdate();

    if( bLoadModule )
    {
        // load module when compile complete, and notify console - TODO replace with event system
        bool bSuccess = m_pEnv->sys->pRuntimeObjectSystem->LoadCompiledModule();
        m_pConsole->OnCompileDone(bSuccess);
        if( bSuccess )
        {
            // reset program error status
            m_bHaveProgramError = false;
        }
    }

    // Limit frame rate
    double dTimeTaken = pTimeSystem->GetFrameTimeNow();
    const double dIdealTime = 1.0 / 60.0;
    if ( dTimeTaken < dIdealTime)
    {
        Sleep( (DWORD) ((dIdealTime - dTimeTaken) * 1000.0) );
    }

    pTimeSystem->EndFrame();
}
开发者ID:jdduke,项目名称:RuntimeCompiledCPlusPlus,代码行数:75,代码来源:Game.cpp


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