mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 03:51:47 +01:00
29 lines
663 B
C++
29 lines
663 B
C++
#include "pch.h"
|
|
#include "TextureManager.h"
|
|
|
|
#include <iostream>
|
|
TextureManager* TextureManager::m_pInstance = nullptr;
|
|
|
|
TextureManager * TextureManager::GetInstance() {
|
|
if (m_pInstance == nullptr) {
|
|
m_pInstance = new TextureManager();
|
|
}
|
|
return m_pInstance;
|
|
}
|
|
void TextureManager::DestroyInstance() {
|
|
delete 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() {
|
|
for (const auto& p : m_Textures) {
|
|
delete p.second;
|
|
}
|
|
}
|