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


C++ LayerPtr::BindPackage方法代码示例

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


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

示例1: Initialize


//.........这里部分代码省略.........
        bool bVsync = spGraphicsConfig->GetVsync();

        Window::Parameters windowParameters;
        windowParameters.pTitle = TXT( "Lunar" );
        windowParameters.width = displayWidth;
        windowParameters.height = displayHeight;
        windowParameters.bFullscreen = bFullscreen;

        m_pMainWindow = pWindowManager->Create( windowParameters );
        HELIUM_ASSERT( m_pMainWindow );
        if( !m_pMainWindow )
        {
            HELIUM_TRACE( TRACE_ERROR, TXT( "Failed to create main application window.\n" ) );

            return false;
        }

        m_pMainWindow->SetOnDestroyed( boost::bind( &GameSystem::OnMainWindowDestroyed, this, _1 ) );

        Renderer::ContextInitParameters contextInitParams;
        contextInitParams.pWindow = m_pMainWindow->GetHandle();
        contextInitParams.displayWidth = displayWidth;
        contextInitParams.displayHeight = displayHeight;
        contextInitParams.bFullscreen = bFullscreen;
        contextInitParams.bVsync = bVsync;

        bool bContextCreateResult = pRenderer->CreateMainContext( contextInitParams );
        HELIUM_ASSERT( bContextCreateResult );
        if( !bContextCreateResult )
        {
            HELIUM_TRACE( TRACE_ERROR, TXT( "Failed to create main renderer context.\n" ) );

            return false;
        }

        // Create and initialize the render resource manager.
        RenderResourceManager& rRenderResourceManager = RenderResourceManager::GetStaticInstance();
        rRenderResourceManager.Initialize();

        // Create and initialize the dynamic drawing interface.
        DynamicDrawer& rDynamicDrawer = DynamicDrawer::GetStaticInstance();
        if( !rDynamicDrawer.Initialize() )
        {
            HELIUM_TRACE( TRACE_ERROR, TXT( "Failed to initialize dynamic drawing support.\n" ) );

            return false;
        }
    }

    // Initialize the world manager and main game world.
    WorldManager& rWorldManager = WorldManager::GetStaticInstance();
    bool bWorldManagerInitSuccess = rWorldManager.Initialize();
    HELIUM_ASSERT( bWorldManagerInitSuccess );
    if( !bWorldManagerInitSuccess )
    {
        HELIUM_TRACE( TRACE_ERROR, TXT( "World manager initialization failed.\n" ) );

        return false;
    }

    if( !pWorldType )
    {
        pWorldType = World::GetStaticType();
        HELIUM_ASSERT( pWorldType );
    }

    WorldPtr spDefaultWorld( rWorldManager.CreateDefaultWorld( pWorldType ) );
    HELIUM_ASSERT( spDefaultWorld );
    if( !spDefaultWorld )
    {
        HELIUM_TRACE( TRACE_ERROR, TXT( "Failed to create the default world.\n" ) );

        return false;
    }

    HELIUM_TRACE( TRACE_INFO, TXT( "Created default world \"%s\".\n" ), *spDefaultWorld->GetPath().ToString() );

    bool bWorldInitSuccess = spDefaultWorld->Initialize();
    HELIUM_ASSERT( bWorldInitSuccess );
    if( !bWorldInitSuccess )
    {
        HELIUM_TRACE( TRACE_ERROR, TXT( "Failed to initialize default world.\n" ) );

        return false;
    }

    PackagePtr spLayerPackage;
    HELIUM_VERIFY( GameObject::Create< Package >( spLayerPackage, Name( TXT( "DefaultLayerPackage" ) ), NULL ) );
    HELIUM_ASSERT( spLayerPackage );

    LayerPtr spLayer;
    HELIUM_VERIFY( GameObject::Create< Layer >( spLayer, Name( TXT( "Layer" ) ), spLayerPackage ) );
    HELIUM_ASSERT( spLayer );
    spLayer->BindPackage( spLayerPackage );

    HELIUM_VERIFY( spDefaultWorld->AddLayer( spLayer ) );

    // Initialization complete.
    return true;
}
开发者ID:,项目名称:,代码行数:101,代码来源:


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