本文整理汇总了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;
}