Files
dae16-VerhulstBram-GameProject/Game/TextureManager.cpp
Bram Verhulst 5477b8a7f2 Fix digging
2024-04-20 20:20:54 +02:00

25 lines
630 B
C++

#include "pch.h"
#include "TextureManager.h"
TextureManager* TextureManager::m_pInstance = nullptr;
TextureManager * TextureManager::GetInstance() {
if (m_pInstance == nullptr) {
m_pInstance = new TextureManager();
}
return m_pInstance;
}
Texture * TextureManager::GetTexture(const std::string& name) {
if (m_Textures.find(name) != m_Textures.end()) {
return m_Textures[name];
}
Texture* pTexture = new Texture(name);
m_Textures[name] = pTexture;
return pTexture;
}
TextureManager::~TextureManager() {
//TODO: Loop over the m_Textures to delete them
for ( const auto &p : m_Textures ) {
delete p.second;
}
}