#include "texture_manager.h"

namespace Halley {
	shared_ptr<ResourceManager<Texture> > ResourceManager<Texture>::manager;
	std::map<int, weak_ptr<Texture> > TextureManager::ids;

	TextureManager::TextureManager(String basePath)
		: ResourceManager(basePath)
	{
	}

	shared_ptr<Texture> TextureManager::load(String name) {
		auto result = shared_ptr<Texture>(new ConcreteTexture(name));
		ids[result->GetId()] = result;
		return result;
	}

	shared_ptr<Texture> TextureManager::getById(int id) {
		return ids[id].lock();
	}
}
