mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-29 05:17:58 +03:00
23 lines
695 B
C++
23 lines
695 B
C++
#include "resources.hpp"
|
|
|
|
#include <components/vfs/manager.hpp>
|
|
|
|
namespace LuaUi
|
|
{
|
|
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
|
{
|
|
std::string normalizedPath = vfs()->normalizeFilename(data.mPath);
|
|
if (!vfs()->exists(normalizedPath))
|
|
{
|
|
std::string error("Texture with path \"");
|
|
error += data.mPath;
|
|
error += "\" doesn't exist";
|
|
throw std::logic_error(error);
|
|
}
|
|
data.mPath = normalizedPath;
|
|
|
|
TextureResources& list = mTextures[normalizedPath];
|
|
list.push_back(std::make_shared<TextureResource>(data));
|
|
return list.back();
|
|
}
|
|
}
|