Polycode::ResourceManager Class Reference

Manages loading and unloading of resources from directories and archives. More...

List of all members.

Public Member Functions

void addResource (Resource *resource)
 Adds a new resource.
void addDirResource (const String &dirPath, bool recursive=true)
 Loads resources from a directory.
void addArchive (const String &zipPath)
 Adds a zip as a readable source.
ResourcegetResource (int resourceType, const String &resourceName) const
 Request a loaded resource.
std::vector< Resource * > getResources (int resourceType)
 Request a full set of loaded resources.

Detailed Description

Manages loading and unloading of resources from directories and archives.

Should only be accessed via the CoreServices singleton.


Member Function Documentation

void ResourceManager::addArchive ( const String zipPath  ) 

Adds a zip as a readable source.

This doesn't actually load resources from it, just mounts it as a readable source, so you can call addDirResource on the folders inside of it like you would on regular folders. Most other disk IO in the engine (loading images, etc.) will actually check mounted archive files as well.

void ResourceManager::addDirResource ( const String dirPath,
bool  recursive = true 
)

Loads resources from a directory.

Parameters:
dirPath Path to directory to load resources from.
recursive If true, will recurse into subdirectories.
void ResourceManager::addResource ( Resource resource  ) 

Adds a new resource.

Parameters:
resource Resource to add.
Resource * ResourceManager::getResource ( int  resourceType,
const String resourceName 
) const

Request a loaded resource.

You need to manually cast it to its subclass based on its type.

Parameters:
resourceType Type of resource. See Resource for available resource types.
resourceName Name of the resource to request.
vector< Resource * > ResourceManager::getResources ( int  resourceType  ) 

Request a full set of loaded resources.

You need to manually cast them to their subclasses based on their type.

Parameters:
resourceType Type of resource. See Resource for available resource types.
Generated on Sat Aug 11 18:04:11 2012 for Polycode by  doxygen 1.6.3