aboutsummaryrefslogtreecommitdiff
path: root/resource-manager/resource_manager.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-01 11:03:50 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-01 11:03:50 +0200
commit2d13805218eb34b6e06205c1b65c341ebcdad504 (patch)
treeaeeb4d574defb3b68327adf38a02765ba4d3e20a /resource-manager/resource_manager.cpp
parenta08f5acf483d5371ccab70ba75c39ac6a5f96ce7 (diff)
changed resource manager to singleton
Diffstat (limited to 'resource-manager/resource_manager.cpp')
-rw-r--r--resource-manager/resource_manager.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/resource-manager/resource_manager.cpp b/resource-manager/resource_manager.cpp
index 1412592..aee0ce2 100644
--- a/resource-manager/resource_manager.cpp
+++ b/resource-manager/resource_manager.cpp
@@ -5,6 +5,15 @@
#include "resource.h"
#include <unordered_map>
+ResourceManager* ResourceManager::m_single_resource_manager = nullptr;
+
+ResourceManager* ResourceManager::get_instance(){
+ if (m_single_resource_manager == nullptr) {
+ m_single_resource_manager = new ResourceManager();
+ }
+ return m_single_resource_manager;
+}
+
ResourceManager::ResourceManager(){
}
@@ -14,6 +23,8 @@ ResourceManager::~ResourceManager(){
for(auto pair : m_resources){
delete pair.second;
}
+
+ delete m_single_resource_manager;
}