34 std::map<std::string, Resource *>::iterator it;
35 for (it = m_resources.begin(); it != m_resources.end(); ++it)
42 std::vector<Resource *>::iterator cloneIt;
43 for (cloneIt = m_clones.begin(); cloneIt != m_clones.end(); ++cloneIt)
58 T *
Load(
const std::string &path,
const bool cache =
true,
const bool appendContentPath =
true)
60 if (m_resources.find(path) != m_resources.end())
62 T *pResource =
dynamic_cast<T *
>(m_resources[path]);
64 if (pResource->IsCloneable())
66 T *pClone =
dynamic_cast<T*
>(pResource->Clone());
68 pClone->m_id = m_nextResourceID;
71 m_clones.push_back(pClone);
81 pT->m_pResourceManager =
this;
85 if (appendContentPath)
87 fullPath = m_contentPath;
88 fullPath.append(path);
92 if (pT->Load(fullPath,
this))
94 if (cache) m_resources[path] = pT;
96 pT->m_id = m_nextResourceID;
108 std::map<std::string, Resource *> m_resources;
110 std::vector<Resource *> m_clones;
112 std::string m_contentPath;
114 unsigned short m_nextResourceID;
Base class for all resource types to be managed by the ResourceManager class.
Loads and manages the lifespan of objects from external files.
void SetContentPath(const std::string &path)
Sets the location of the folder where game resources are stored.
T * Load(const std::string &path, const bool cache=true, const bool appendContentPath=true)
Load and manage a resource.
void UnloadAllResources()
Unloads all game resources.
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...