aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/AssetManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/AssetManager.h')
-rw-r--r--src/crepe/api/AssetManager.h30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/crepe/api/AssetManager.h b/src/crepe/api/AssetManager.h
index 1b8b86f..f3f1307 100644
--- a/src/crepe/api/AssetManager.h
+++ b/src/crepe/api/AssetManager.h
@@ -1,22 +1,18 @@
#pragma once
-
-
#include <any>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
+namespace crepe::api {
-namespace crepe::api{
-
-class AssetManager{
-
+class AssetManager {
private:
- std::unordered_map< std::string, std::any> asset_cache;
-
+ std::unordered_map<std::string, std::any> asset_cache;
+
private:
AssetManager();
virtual ~AssetManager();
@@ -24,27 +20,27 @@ private:
public:
AssetManager(const AssetManager &) = delete;
AssetManager(AssetManager &&) = delete;
- AssetManager &operator=(const AssetManager &) = delete;
- AssetManager &operator=(AssetManager &&) = delete;
-
-
- static AssetManager& get_instance();
+ AssetManager & operator=(const AssetManager &) = delete;
+ AssetManager & operator=(AssetManager &&) = delete;
+ static AssetManager & get_instance();
public:
- template<typename asset>
- std::shared_ptr<asset> cache(const std::string& file_path, bool reload = false){
+ template <typename asset>
+ std::shared_ptr<asset> cache(const std::string & file_path,
+ bool reload = false) {
auto it = asset_cache.find(file_path);
if (!reload && it != asset_cache.end()) {
return std::any_cast<std::shared_ptr<asset>>(it->second);
}
- std::shared_ptr<asset> new_asset = std::make_shared<asset>(file_path.c_str());
+ std::shared_ptr<asset> new_asset
+ = std::make_shared<asset>(file_path.c_str());
asset_cache[file_path] = new_asset;
return new_asset;
}
};
-}
+} // namespace crepe::api