Gamedev Framework (gf)  0.3.0
A C++11 framework for 2D games
Public Member Functions | List of all members
gf::AssetManager Class Reference

An asset manager. More...

#include <gf/AssetManager.h>

Inheritance diagram for gf::AssetManager:
Inheritance graph
[legend]

Public Member Functions

void addSearchDir (Path path)
 Add a search directory. More...
 
Path getAbsolutePath (const Path &relativePath) const
 Search a file in the search directories. More...
 

Detailed Description

An asset manager.

gf::AssetManager is a base class for searching files in some seach directories. If you are looking for some more sophisticated manager, you should look at gf::ResourceManager.

See also
ResourceManager

Member Function Documentation

void gf::AssetManager::addSearchDir ( Path  path)

Add a search directory.

If the provided path is not a directory, it is not added to the current search directories.

Parameters
pathThe path of the directory
Path gf::AssetManager::getAbsolutePath ( const Path relativePath) const

Search a file in the search directories.

This function tries to build absolute paths by joining a search directory and the relative path to the file.

If the provided path is absolute, then it is returned without searching in the search directories.

Parameters
relativePathA path to the file, relative to a search directory
Returns
The absolute path to the file if it has been found or an empty path otherwise