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

A resource manager. More...

#include <gf/ResourceManager.h>

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

Public Member Functions

 ResourceManager ()
 Default constructor. More...
 
 ResourceManager (std::initializer_list< Path > paths)
 Constructor with a list of search directories. More...
 
ImagegetImage (const Path &path)
 Get an image. More...
 
TexturegetTexture (const Path &path)
 Get a texture. More...
 
FontgetFont (const Path &path)
 Get a font. More...
 
- Public Member Functions inherited from gf::AssetManager
void addSearchDir (Path path)
 Add a search directory. More...
 
Path getAbsolutePath (const Path &relativePath) const
 Search a file in the search directories. More...
 
Path getRelativePath (const Path &absolutePath) const
 Search a file in the search directories. More...
 

Detailed Description

A resource manager.

See also
gf::ResourceCache

Constructor & Destructor Documentation

◆ ResourceManager() [1/2]

gf::ResourceManager::ResourceManager ( )

Default constructor.

◆ ResourceManager() [2/2]

gf::ResourceManager::ResourceManager ( std::initializer_list< Path paths)

Constructor with a list of search directories.

Member Function Documentation

◆ getFont()

Font& gf::ResourceManager::getFont ( const Path path)
inline

Get a font.

Parameters
pathA path to the font
Returns
A reference to the font
Exceptions
std::runtime_errorIf the font is not found

◆ getImage()

Image& gf::ResourceManager::getImage ( const Path path)
inline

Get an image.

Parameters
pathA path to the image
Returns
A reference to the image
Exceptions
std::runtime_errorIf the font is not found

◆ getTexture()

Texture& gf::ResourceManager::getTexture ( const Path path)
inline

Get a texture.

Parameters
pathA path to the texture
Returns
A reference to the texture
Exceptions
std::runtime_errorIf the texture is not found