18 std::string::size_type extensionPos = filename.find_last_of(
".");
19 if (extensionPos == std::string::npos) {
20 LUG_LOG.error(
"ResourceManager: Can't find extension of the filename {}", filename);
24 std::string extension = filename.substr(extensionPos + 1);
26 auto loader =
_loaders.find(extension);
28 LUG_LOG.error(
"ResourceManager: Can't find loader for extension {}", extension);
32 return loader->second->loadFile(filename);
std::unordered_map< std::string, std::unique_ptr< Loader > > _loaders
Dummy class for a shared pointer.
Resource::SharedPtr< Resource > loadFile(const std::string &filename)
Loads a resource from a file.
ResourceManager(Renderer &renderer)
Constructs a ResourceManager, from a Renderer instance.