本文整理汇总了C++中IResource::GetFileBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ IResource::GetFileBuffer方法的具体用法?C++ IResource::GetFileBuffer怎么用?C++ IResource::GetFileBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResource
的用法示例。
在下文中一共展示了IResource::GetFileBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileOpen
FMOD_RESULT F_CALLBACK SoundSystem::FileOpen( const char* name, int unicode, unsigned int* filesize, void** handle, void** userdata )
{
IResource* resource = Management::Get( )->GetResourceManager( )->GetResource( name );
resource->AddReference( );
*handle = resource;
*filesize = resource->GetFileBuffer( )->fileLength;
return FMOD_OK;
}
示例2: LoadScript
void ScriptComponent::LoadScript( const std::string& scriptPath )
{
IResource* resource = Management::Get( )->GetResourceManager( )->GetResource( scriptPath );
int result = luaL_loadbuffer( m_state, resource->GetFileBuffer( )->fileBytes, resource->GetFileBuffer( )->fileLength, resource->GetFileBuffer( )->filePath.c_str( ) );
if ( LUA_ERRSYNTAX == result )
{
std::stringstream errorMessage;
errorMessage << lua_tostring( m_state, -1 );
Logger::Get( )->Warn( errorMessage.str( ) );
lua_pop( m_state, 1 );
}
if ( LUA_ERRMEM == result )
{
ScriptException memE( "Script::Initialize - There is memory allocation error within the Script" );
Logger::Get( )->Fatal( memE.what( ) );
throw memE;
}
}
示例3: Load
void XMLSerializer::Load( const std::string& levelPath )
{
if ( !Management::Get( )->GetFileManager( )->FileExists( levelPath ) )
{
std::stringstream logMessage;
logMessage << "Unable to locate level file at path: " << levelPath;
Logger::Get( )->Warn( logMessage.str( ) );
return;
}
_loadProgress = 0;
_loadTotal = 0;
Management::Get( )->GetEventManager( )->QueueEvent( new ScriptEvent( "WORLD_LOADING_STARTED", levelPath ) );
IResource* resource = Management::Get( )->GetResourceManager( )->GetResource( levelPath );
Document levelFile( resource->GetFileBuffer()->fileBytes );
this->LoadElement( levelFile.FirstChildElement( ) );
}
示例4: LoadEntity
void XMLSerializer::LoadEntity( ticpp::Element* element )
{
std::string name;
element->GetAttribute( "name", &name );
IWorldEntity* entity = _world->CreateEntity( name );
std::string src;
element->GetAttribute( "src", &src, false );
NodePtrMap components;
if ( !src.empty( ) )
{
IResource* resource = Management::Get( )->GetResourceManager( )->GetResource( src );
Document externalFile( resource->GetFileBuffer( )->fileBytes );
for( Iterator< Element > child = externalFile.FirstChildElement( false ); child != child.end( ); child++ )
{
this->LoadEntityComponents( &*child, components );
}
}
this->LoadEntityComponents( element, components );
for( NodePtrMap::iterator i = components.begin( ); i != components.end( ); ++i )
{
if ( Management::Get( )->GetSystemManager( )->HasSystem( ( *i ).first ) )
{
IComponentSerializer* serializer = ComponentSerializerFactory::Create( ( *i ).first );
ISystemComponent* component = serializer->DeSerialize( name, ( *i ).second->ToElement( ), _world->GetSystemScenes( ) );
entity->AddComponent( component );
delete serializer;
}
delete ( *i ).second;
}
entity->Initialize( );
}