Practical Tools for Simple Design
Loading...
Searching...
No Matches
AssetStore.inl
1#include "Util/AssetStore.hpp"
2
3namespace Util {
4template <typename T>
5void AssetStore<T>::Load(const std::string &filepath) {
6 m_Map[filepath] = m_Loader(filepath);
7}
8
9template <typename T>
10T AssetStore<T>::Get(const std::string &filepath) {
11 auto result = m_Map.find(filepath);
12 if (result != m_Map.end()) {
13 return result->second;
14 }
15
16 Load(filepath);
17
18 return m_Map[filepath];
19}
20
21template <typename T>
22void AssetStore<T>::Remove(const std::string &filepath) {
23 m_Map.erase(filepath);
24}
25} // namespace Util
void Remove(const std::string &filepath)
Removes the asset associated with the specified filepath from the store.
Definition AssetStore.inl:22
void Load(const std::string &filepath)
Preload resources for future use.
Definition AssetStore.inl:5
T Get(const std::string &filepath)
Retrieves the asset associated with the specified filepath.
Definition AssetStore.inl:10
Useful tools for development.
Definition Animation.hpp:12