mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-02 14:57:59 +03:00
MR feedack
This commit is contained in:
parent
a7bb87d8a1
commit
67879bac55
6 changed files with 30 additions and 35 deletions
|
@ -39,13 +39,12 @@ namespace LuaUi
|
|||
MyGUI::IntCoord atlasCoord;
|
||||
if (resource)
|
||||
{
|
||||
auto& data = resource->data();
|
||||
atlasCoord = MyGUI::IntCoord(
|
||||
static_cast<int>(data.mOffset.x()),
|
||||
static_cast<int>(data.mOffset.y()),
|
||||
static_cast<int>(data.mSize.x()),
|
||||
static_cast<int>(data.mSize.y()));
|
||||
setImageTexture(data.mPath);
|
||||
static_cast<int>(resource->mOffset.x()),
|
||||
static_cast<int>(resource->mOffset.y()),
|
||||
static_cast<int>(resource->mSize.x()),
|
||||
static_cast<int>(resource->mSize.y()));
|
||||
setImageTexture(resource->mPath);
|
||||
}
|
||||
|
||||
bool tileH = propertyValue("tileH", false);
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace LuaUi
|
|||
{
|
||||
std::shared_ptr<TextureResource> ResourceManager::registerTexture(TextureData data)
|
||||
{
|
||||
std::string normalizedPath = vfs()->normalizeFilename(data.mPath);
|
||||
if (!vfs()->exists(normalizedPath))
|
||||
std::string normalizedPath = mVfs->normalizeFilename(data.mPath);
|
||||
if (!mVfs->exists(normalizedPath))
|
||||
{
|
||||
auto error = Misc::StringUtils::format("Texture with path \"%s\" doesn't exist", data.mPath);
|
||||
throw std::logic_error(error);
|
||||
|
@ -19,4 +19,9 @@ namespace LuaUi
|
|||
list.push_back(std::make_shared<TextureResource>(data));
|
||||
return list.back();
|
||||
}
|
||||
|
||||
void ResourceManager::clear()
|
||||
{
|
||||
mTextures.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,18 +22,8 @@ namespace LuaUi
|
|||
osg::Vec2f mSize;
|
||||
};
|
||||
|
||||
class TextureResource
|
||||
{
|
||||
public:
|
||||
TextureResource(TextureData data)
|
||||
: mData(data)
|
||||
{}
|
||||
|
||||
const TextureData& data() { return mData; }
|
||||
|
||||
private:
|
||||
TextureData mData;
|
||||
};
|
||||
// will have more/different data when automated atlasing is supported
|
||||
using TextureResource = TextureData;
|
||||
|
||||
class ResourceManager
|
||||
{
|
||||
|
@ -43,10 +33,9 @@ namespace LuaUi
|
|||
{}
|
||||
|
||||
std::shared_ptr<TextureResource> registerTexture(TextureData data);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
const VFS::Manager* vfs() const { return mVfs; }
|
||||
|
||||
const VFS::Manager* mVfs;
|
||||
using TextureResources = std::vector<std::shared_ptr<TextureResource>>;
|
||||
std::unordered_map<std::string, TextureResources> mTextures;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue