Polycode
|
Manages loading and unloading of resources from directories and archives. More...
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. | |
Resource * | getResource (int resourceType, const String &resourceName) const |
Request a loaded resource. | |
std::vector< Resource * > | getResources (int resourceType) |
Request a full set of loaded resources. |
Manages loading and unloading of resources from directories and archives.
Should only be accessed via the CoreServices singleton.
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.
dirPath | Path to directory to load resources from. |
recursive | If true, will recurse into subdirectories. |
void ResourceManager::addResource | ( | Resource * | resource | ) |
Adds a new resource.
resource | Resource to add. |
Request a loaded resource.
You need to manually cast it to its subclass based on its type.
resourceType | Type of resource. See Resource for available resource types. |
resourceName | Name of the resource to request. |