Use getThemedIcon instead of duplicated code

This commit is contained in:
QwertyChouskie 2021-10-30 15:15:34 -07:00 committed by Benau
parent 14c1f7b344
commit aee11c6de6
3 changed files with 1 additions and 18 deletions

View File

@ -2877,12 +2877,6 @@ void Skin::setSpriteBank (IGUISpriteBank *bank)
m_fallback_skin->setSpriteBank(bank);
} // setSpriteBank
// -----------------------------------------------------------------------------
const std::string& Skin::getDataPath() const
{
return SkinConfig::m_data_path;
} // getDataPath
// -----------------------------------------------------------------------------
/* All TTF list here are in absolute path. */
const std::vector<std::string>& Skin::getNormalTTF() const

View File

@ -424,8 +424,6 @@ namespace GUIEngine
gui::IGUISkin* getFallbackSkin() { return m_fallback_skin; }
const std::string& getDataPath() const;
bool hasIconTheme() const;
bool hasFont() const;

View File

@ -795,16 +795,7 @@ std::string FileManager::getAsset(FileManager::AssetType type,
{
if (type == GUI_ICON && GUIEngine::getSkin()->hasIconTheme())
{
// remove the extension to check both .svg and .png
const std::string test_path = StringUtils::removeExtension
(GUIEngine::getSkin()->getDataPath() + "data/gui/icons/" + name);
// first check if there is an SVG version
if (fileExists(test_path + ".svg"))
return test_path + ".svg";
else if (fileExists(test_path + ".png"))
return test_path + ".png";
else
return m_subdir_name[type] + name;
return GUIEngine::getSkin()->getThemedIcon("gui/icons/" + name);
}
return m_subdir_name[type] + name;
} // getAsset