aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api')
-rw-r--r--src/crepe/api/ResourceManager.cpp13
-rw-r--r--src/crepe/api/ResourceManager.h13
2 files changed, 20 insertions, 6 deletions
diff --git a/src/crepe/api/ResourceManager.cpp b/src/crepe/api/ResourceManager.cpp
index 17fbd9b..6eb4afd 100644
--- a/src/crepe/api/ResourceManager.cpp
+++ b/src/crepe/api/ResourceManager.cpp
@@ -2,6 +2,9 @@
#include "ResourceManager.h"
+// default resource cache functions
+#include "../facade/Sound.h"
+
using namespace crepe;
ResourceManager & ResourceManager::get_instance() {
@@ -11,3 +14,13 @@ ResourceManager & ResourceManager::get_instance() {
ResourceManager::~ResourceManager() { dbg_trace(); }
ResourceManager::ResourceManager() { dbg_trace(); }
+
+void ResourceManager::clear() {
+ this->resources.clear();
+}
+
+template <>
+Sound & ResourceManager::cache<Sound>(const Asset & asset) {
+ return this->cache<Sound>(asset);
+}
+
diff --git a/src/crepe/api/ResourceManager.h b/src/crepe/api/ResourceManager.h
index a69a9fa..468af16 100644
--- a/src/crepe/api/ResourceManager.h
+++ b/src/crepe/api/ResourceManager.h
@@ -51,22 +51,23 @@ public:
* it is already cached.
* \tparam T The type of asset to cache (e.g., texture, sound, etc.).
*
- * \return A shared pointer to the cached asset.
+ * \return A reference to the resource
*
* This template function caches the asset at the given file path. If the
- * asset is already cached and `reload` is false, the existing cached version
- * will be returned. Otherwise, the asset will be reloaded and added to the
+ * asset is already cached, the existing instance will be returned.
+ * Otherwise, the concrete resource will be instantiated and added to the
* cache.
*/
template <typename T>
T & cache(const Asset & asset);
- /**
- * \brief Clear the resource cache
- */
+ //! Clear the resource cache
void clear();
};
+template <>
+Sound & ResourceManager::cache<Sound>(const Asset & asset);
+
} // namespace crepe
#include "ResourceManager.hpp"