本文整理汇总了C++中YamlNode::AsPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ YamlNode::AsPoint方法的具体用法?C++ YamlNode::AsPoint怎么用?C++ YamlNode::AsPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YamlNode
的用法示例。
在下文中一共展示了YamlNode::AsPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFromYamlNode
void UIScrollView::LoadFromYamlNode(YamlNode * node, UIYamlLoader * loader)
{
UIControl::LoadFromYamlNode(node, loader);
YamlNode *contentSizeNode = node->Get("contentSize");
SetContentSize(contentSizeNode->AsPoint());
}
示例2: res
RefPtr< PropertyLine<Vector2> > PropertyLineYamlReader::CreateVector2PropertyLineFromYamlNode( YamlNode * parentNode, const String & propertyName, RefPtr< PropertyLine<Vector2> > defaultPropertyLine /*= 0*/ )
{
YamlNode * node = parentNode->Get(propertyName);
if (!node)return defaultPropertyLine;
if (node->GetType() == YamlNode::TYPE_STRING)
{
float32 v = node->AsFloat();
return RefPtr< PropertyLine<Vector2> >(new PropertyLineValue<Vector2>(Vector2(v, v)));
}else if (node->GetType() == YamlNode::TYPE_ARRAY)
{
if (node->GetCount() == 2)
{
Vector2 res(1.0f, 1.0f);
res = node->AsPoint();
return RefPtr< PropertyLine<Vector2> >(new PropertyLineValue<Vector2>(res));
}
RefPtr< PropertyLineKeyframes<Vector2> > keyframes (new PropertyLineKeyframes<Vector2>());
for (int k = 0; k < node->GetCount() / 2; ++k)
{
YamlNode * time = node->Get(k * 2);
YamlNode * value = node->Get(k * 2 + 1);
if (time && value)
{
if (value->GetType() == YamlNode::TYPE_ARRAY)
{
keyframes->AddValue(time->AsFloat(), value->AsPoint());
}
else
{
float32 v = value->AsFloat();
keyframes->AddValue(time->AsFloat(), Vector2(v, v));
}
}
}
return keyframes;
}
return RefPtr< PropertyLine<Vector2> >();
}