simpler yaml read
This commit is contained in:
parent
0f7f7827f5
commit
5616259feb
|
@ -30,8 +30,6 @@ void UIButtonSkin::load(const YAML::Node& node)
|
|||
{
|
||||
UIElementSkin::load(node);
|
||||
|
||||
std::string tmp;
|
||||
|
||||
m_buttonDownImage = loadImage(node["down state"]);
|
||||
|
||||
if(node["down state"].FindValue("text translate"))
|
||||
|
@ -40,8 +38,7 @@ void UIButtonSkin::load(const YAML::Node& node)
|
|||
if(node.FindValue("mouse over state"))
|
||||
m_buttonHoverImage = loadImage(node["mouse over state"]);
|
||||
|
||||
node["font"] >> tmp;
|
||||
m_font = g_fonts.get(tmp);
|
||||
m_font = g_fonts.get(node["font"].Read<std::string>());
|
||||
|
||||
node["text color"] >> m_textColor;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,10 @@
|
|||
void UILabelSkin::load(const YAML::Node& node)
|
||||
{
|
||||
UIElementSkin::load(node);
|
||||
std::string tmp;
|
||||
|
||||
if(node.FindValue("font")) {
|
||||
node["font"] >> tmp;
|
||||
m_font = g_fonts.get(tmp);
|
||||
} else
|
||||
if(node.FindValue("font"))
|
||||
m_font = g_fonts.get(node["font"].Read<std::string>());
|
||||
else
|
||||
m_font = g_fonts.getDefaultFont();
|
||||
|
||||
if(node.FindValue("text color"))
|
||||
|
|
|
@ -142,8 +142,6 @@ void UILoader::loadElements(const UIElementPtr& parent, const YAML::Node& node)
|
|||
|
||||
void UILoader::loadElement(const UIElementPtr& element, const YAML::Node& node)
|
||||
{
|
||||
std::string tmp;
|
||||
|
||||
if(node.FindValue("skin"))
|
||||
element->setSkin(g_uiSkins.getElementSkin(element->getElementType(), node["skin"]));
|
||||
|
||||
|
@ -195,18 +193,15 @@ void UILoader::loadElement(const UIElementPtr& element, const YAML::Node& node)
|
|||
// load specific element type
|
||||
if(element->getElementType() == UI::Button) {
|
||||
UIButtonPtr button = boost::static_pointer_cast<UIButton>(element);
|
||||
node["text"] >> tmp;
|
||||
button->setText(tmp);
|
||||
button->setText(node["text"].Read<std::string>());
|
||||
}
|
||||
else if(element->getElementType() == UI::Window) {
|
||||
UIWindowPtr window = boost::static_pointer_cast<UIWindow>(element);
|
||||
node["title"] >> tmp;
|
||||
window->setTitle(tmp);
|
||||
window->setTitle(node["title"].Read<std::string>());
|
||||
}
|
||||
else if(element->getElementType() == UI::Label) {
|
||||
UILabelPtr label = boost::static_pointer_cast<UILabel>(element);
|
||||
node["text"] >> tmp;
|
||||
label->setText(tmp);
|
||||
label->setText(node["text"].Read<std::string>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,9 @@
|
|||
void UITextEditSkin::load(const YAML::Node& node)
|
||||
{
|
||||
UIElementSkin::load(node);
|
||||
std::string tmp;
|
||||
|
||||
if(node.FindValue("font")) {
|
||||
node["font"] >> tmp;
|
||||
m_font = g_fonts.get(tmp);
|
||||
m_font = g_fonts.get(node["font"].Read<std::string>());
|
||||
} else
|
||||
m_font = g_fonts.getDefaultFont();
|
||||
|
||||
|
|
Loading…
Reference in New Issue