|
|
@ -7,15 +7,9 @@ namespace LuaUi
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
|
|
|
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string normalizedPath = mVfs->normalizeFilename(data.mPath);
|
|
|
|
data.mPath = mVfs->normalizeFilename(data.mPath);
|
|
|
|
if (!mVfs->exists(normalizedPath))
|
|
|
|
|
|
|
|
{
|
|
|
|
TextureResources& list = mTextures[data.mPath];
|
|
|
|
auto error = Misc::StringUtils::format("Texture with path \"%s\" doesn't exist", data.mPath);
|
|
|
|
|
|
|
|
throw std::logic_error(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
data.mPath = normalizedPath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TextureResources& list = mTextures[normalizedPath];
|
|
|
|
|
|
|
|
list.push_back(std::make_shared<TextureResource>(data));
|
|
|
|
list.push_back(std::make_shared<TextureResource>(data));
|
|
|
|
return list.back();
|
|
|
|
return list.back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|