You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/components/lua_ui/resources.cpp

23 lines
713 B
C++

#include "resources.hpp"
#include <components/vfs/manager.hpp>
#include <components/misc/stringops.hpp>
namespace LuaUi
{
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
{
std::string normalizedPath = vfs()->normalizeFilename(data.mPath);
if (!vfs()->exists(normalizedPath))
{
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));
return list.back();
}
}