skin coloring fixes
This commit is contained in:
parent
bc7fbcca16
commit
92ac4093a4
|
@ -49,7 +49,7 @@ panels:
|
||||||
labels:
|
labels:
|
||||||
default:
|
default:
|
||||||
font: tibia-10px-antialised
|
font: tibia-10px-antialised
|
||||||
text color: [238, 238, 238, 255]
|
text color: [191, 191, 191, 255]
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -44,7 +44,6 @@ void UIButtonSkin::load(const YAML::Node& node)
|
||||||
m_font = g_fonts.get(tmp);
|
m_font = g_fonts.get(tmp);
|
||||||
|
|
||||||
node["text color"] >> m_textColor;
|
node["text color"] >> m_textColor;
|
||||||
m_textColor = Color::white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIButtonSkin::draw(UIElement *element)
|
void UIButtonSkin::draw(UIElement *element)
|
||||||
|
|
|
@ -33,27 +33,11 @@
|
||||||
|
|
||||||
UISkins g_uiSkins;
|
UISkins g_uiSkins;
|
||||||
|
|
||||||
void UISkins::init()
|
void UISkins::load(const std::string& skinsFile)
|
||||||
{
|
{
|
||||||
// load default skin
|
std::string fileContents = g_resources.loadTextFile(skinsFile);
|
||||||
g_uiSkins.load("skins/tibiaskin.yml");
|
if(!fileContents.size())
|
||||||
|
logFatal("Could not load skin file \"%s", skinsFile.c_str());
|
||||||
}
|
|
||||||
|
|
||||||
void UISkins::terminate()
|
|
||||||
{
|
|
||||||
for(auto it = m_elementSkins.begin(); it != m_elementSkins.end(); ++it)
|
|
||||||
delete (*it);
|
|
||||||
m_elementSkins.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UISkins::load(const std::string& file)
|
|
||||||
{
|
|
||||||
std::string fileContents = g_resources.loadTextFile(file);
|
|
||||||
if(!fileContents.size()) {
|
|
||||||
logFatal("Could not load skin file \"%s", file.c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::istringstream fin(fileContents);
|
std::istringstream fin(fileContents);
|
||||||
|
|
||||||
|
@ -128,12 +112,18 @@ bool UISkins::load(const std::string& file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (YAML::Exception& e) {
|
} catch (YAML::Exception& e) {
|
||||||
logError("Malformed skin file \"%s\":\n %s", file.c_str(), e.what());
|
logFatal("Malformed skin file \"%s\":\n %s", skinsFile.c_str(), e.what());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UISkins::terminate()
|
||||||
|
{
|
||||||
|
for(auto it = m_elementSkins.begin(); it != m_elementSkins.end(); ++it)
|
||||||
|
delete (*it);
|
||||||
|
m_elementSkins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UIElementSkin* UISkins::getElementSkin(UI::EElementType elementType, const std::string& name)
|
UIElementSkin* UISkins::getElementSkin(UI::EElementType elementType, const std::string& name)
|
||||||
{
|
{
|
||||||
for(auto it = m_elementSkins.begin(); it != m_elementSkins.end(); ++it) {
|
for(auto it = m_elementSkins.begin(); it != m_elementSkins.end(); ++it) {
|
||||||
|
|
|
@ -36,11 +36,9 @@ class UISkins
|
||||||
public:
|
public:
|
||||||
UISkins() { }
|
UISkins() { }
|
||||||
|
|
||||||
void init();
|
void load(const std::string& skinsFile);
|
||||||
void terminate();
|
void terminate();
|
||||||
|
|
||||||
bool load(const std::string& file);
|
|
||||||
|
|
||||||
UIElementSkin *getElementSkin(UI::EElementType elementType, const std::string& name = "default");
|
UIElementSkin *getElementSkin(UI::EElementType elementType, const std::string& name = "default");
|
||||||
TexturePtr getDefaultTexture() { return m_defaultTexture; }
|
TexturePtr getDefaultTexture() { return m_defaultTexture; }
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,7 @@ int main(int argc, const char *argv[])
|
||||||
|
|
||||||
// init engine
|
// init engine
|
||||||
g_engine.init();
|
g_engine.init();
|
||||||
|
g_uiSkins.load("skins/tibiaskin.yml");
|
||||||
g_uiSkins.init();
|
|
||||||
|
|
||||||
// state scope
|
// state scope
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue