diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-10-01 11:03:50 +0200 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-10-01 11:03:50 +0200 |
commit | 2d13805218eb34b6e06205c1b65c341ebcdad504 (patch) | |
tree | aeeb4d574defb3b68327adf38a02765ba4d3e20a /resource-manager/resource_manager.h | |
parent | a08f5acf483d5371ccab70ba75c39ac6a5f96ce7 (diff) |
changed resource manager to singleton
Diffstat (limited to 'resource-manager/resource_manager.h')
-rw-r--r-- | resource-manager/resource_manager.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/resource-manager/resource_manager.h b/resource-manager/resource_manager.h index ea9c80a..c155559 100644 --- a/resource-manager/resource_manager.h +++ b/resource-manager/resource_manager.h @@ -14,11 +14,29 @@ using namespace crepe; class ResourceManager{ -public: +private: + + static ResourceManager* m_single_resource_manager; + std::unordered_map<Constants::FILE_PATH, Resource*> m_resources; + + + +protected: ResourceManager(); ~ResourceManager(); - + +public: + ResourceManager(const ResourceManager &) = delete; + ResourceManager(ResourceManager &&) = delete; + ResourceManager &operator=(const ResourceManager &) = delete; + ResourceManager &operator=(ResourceManager &&) = delete; + + static ResourceManager* get_instance(); + + + +public: template<typename T> T* Load(const Constants::FILE_PATH& file_path){ @@ -35,8 +53,6 @@ public: void Unload(const Constants::FILE_PATH& file_path); -private: - std::unordered_map<Constants::FILE_PATH, Resource*> m_resources; }; |