Files
Nuake-custom/Nuake/src/Core/TextureManager.cpp
2021-05-14 14:31:55 -04:00

27 lines
603 B
C++

#include "TextureManager.h"
#include "../Rendering/Textures/Texture.h"
std::map<std::string, Ref<Texture>> TextureManager::m_Registry;
TextureManager* TextureManager::s_Instance = nullptr;
bool TextureManager::IsTextureLoaded(const std::string path)
{
return m_Registry.find(path) != m_Registry.end();
}
Ref<Texture> TextureManager::GetTexture(const std::string path)
{
if (!IsTextureLoaded(path))
m_Registry.emplace(path, new Texture(path));
return m_Registry.at(path);
}
TextureManager* TextureManager::Get() { return s_Instance; }
TextureManager::TextureManager()
{
s_Instance = this;
}