31 std::map<std::string, Resource *>::iterator it;
32 for (it = m_resources.begin(); it != m_resources.end(); ++it)
39 std::vector<Resource *>::iterator cloneIt;
40 for (cloneIt = m_clones.begin(); cloneIt != m_clones.end(); ++cloneIt)
55 T *
Load(
const std::string &path,
const bool cache =
true,
const bool appendContentPath =
true)
57 if (m_resources.find(path) != m_resources.end())
59 T *pResource =
dynamic_cast<T *
>(m_resources[path]);
61 if (pResource->IsCloneable())
63 T *pClone =
dynamic_cast<T*
>(pResource->Clone());
65 pClone->m_id = m_nextResourceID;
68 m_clones.push_back(pClone);
78 pT->m_pResourceManager =
this;
82 if (appendContentPath)
84 fullPath = m_contentPath;
85 fullPath.append(path);
89 if (pT->Load(fullPath,
this))
91 if (cache) m_resources[path] = pT;
93 pT->m_id = m_nextResourceID;
105 std::map<std::string, Resource *> m_resources;
107 std::vector<Resource *> m_clones;
109 std::string m_contentPath;
111 unsigned short m_nextResourceID;
void SetContentPath(const std::string &path)
Sets the location of the folder where game resources are stored.
Definition: ResourceManager.h:26
void UnloadAllResources()
Unloads all game resources.
Definition: ResourceManager.h:29
Base class for all resource types to be managed by the ResourceManager class.
Definition: Resource.h:19
T * Load(const std::string &path, const bool cache=true, const bool appendContentPath=true)
Load and manage a resource.
Definition: ResourceManager.h:55
Loads and manages the lifespan of objects from external files.
Definition: ResourceManager.h:17
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition: Animation.cpp:14