Class for resource manager. The ResourceManager allows the user to load resources and store them. There should be at most one resource manager at any time, it is usually created by the Graphics instance, and retrievable by #Graphics::getResourceManager()
More...
#include <ResourceManager.hpp>
Class for resource manager. The ResourceManager allows the user to load resources and store them. There should be at most one resource manager at any time, it is usually created by the Graphics instance, and retrievable by #Graphics::getResourceManager()
Definition at line 23 of file ResourceManager.hpp.
◆ ResourceManager() [1/3]
lug::Graphics::ResourceManager::ResourceManager |
( |
Renderer & |
renderer | ) |
|
◆ ResourceManager() [2/3]
lug::Graphics::ResourceManager::ResourceManager |
( |
const ResourceManager & |
| ) |
|
|
delete |
◆ ResourceManager() [3/3]
◆ ~ResourceManager()
lug::Graphics::ResourceManager::~ResourceManager |
( |
| ) |
|
|
default |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ get() [1/2]
template<typename T = Resource>
Retrieve a resource from the ResourceManager.
- Parameters
-
[in] | handle | The handle of the resource. |
- Template Parameters
-
T | The type of the resource. |
- Returns
- The resource, as a custom SharedPtr<T>, which will allow us to do reference counting later.
◆ add() [1/2]
template<typename T = Resource>
Add a resource to the ResourceManager.
- Parameters
-
[in] | resource | The resource to add resource. |
- Template Parameters
-
T | The type of the resource. |
- Returns
- The resource, as a custom SharedPtr<T>, which will allow us to do reference counting later.
◆ loadFile()
Loads a resource from a file.
- Parameters
-
[in] | filename | The filename of the file to load the resource from. The used Loader is determined by the extension of the file, so it must be present! |
- Returns
- A pointer to the resulting resource.
Definition at line 17 of file ResourceManager.cpp.
◆ get() [2/2]
◆ add() [2/2]
◆ _renderer
Renderer& lug::Graphics::ResourceManager::_renderer |
|
private |
◆ _resources
std::vector<std::unique_ptr<Resource> > lug::Graphics::ResourceManager::_resources |
|
private |
◆ _loaders
std::unordered_map<std::string, std::unique_ptr<Loader> > lug::Graphics::ResourceManager::_loaders |
|
private |
The list of the available loaders. The string is the extension of the file, and the pointer is the corresponding loader. The implementation will determine which loader to call in loadFile thanks to this map.
Definition at line 78 of file ResourceManager.hpp.
◆ _mutex
std::mutex lug::Graphics::ResourceManager::_mutex |
|
private |
The documentation for this class was generated from the following files: