本文整理汇总了C++中gd::SerializerElement::ConsiderAsArrayOf方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement::ConsiderAsArrayOf方法的具体用法?C++ SerializerElement::ConsiderAsArrayOf怎么用?C++ SerializerElement::ConsiderAsArrayOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::SerializerElement
的用法示例。
在下文中一共展示了SerializerElement::ConsiderAsArrayOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveSpritesDirection
void SaveSpritesDirection(const vector < Sprite > & sprites, gd::SerializerElement & element)
{
element.ConsiderAsArrayOf("sprite");
for (unsigned int i = 0;i<sprites.size();++i)
{
gd::SerializerElement & spriteElement = element.AddChild("sprite");
spriteElement.SetAttribute("image", sprites[i].GetImageName());
SavePointsSprites(sprites[i].GetAllNonDefaultPoints(), spriteElement.AddChild("points"));
SavePoint(sprites[i].GetOrigin(), spriteElement.AddChild("originPoint"));
SavePoint(sprites[i].GetCenter(), spriteElement.AddChild("centerPoint"));
spriteElement.GetChild("centerPoint").SetAttribute("automatic", sprites[i].IsDefaultCenterPoint());
spriteElement.SetAttribute("hasCustomCollisionMask", !sprites[i].IsCollisionMaskAutomatic());
gd::SerializerElement & collisionMaskElement = spriteElement.AddChild("customCollisionMask");
collisionMaskElement.ConsiderAsArrayOf("polygon");
std::vector<Polygon2d> polygons = sprites[i].GetCollisionMask();
for (unsigned int j = 0;j<polygons.size();++j)
{
gd::SerializerElement & polygonElement = collisionMaskElement.AddChild("polygon");
polygonElement.ConsiderAsArrayOf("vertice");
for (unsigned int k = 0;k<polygons[j].vertices.size();++k)
{
polygonElement.AddChild("vertice")
.SetAttribute("x", polygons[j].vertices[k].x)
.SetAttribute("y", polygons[j].vertices[k].y);
}
}
}
}
示例2: SerializePathsTo
void PathBehavior::SerializePathsTo(gd::SerializerElement & element) const
{
element.ConsiderAsArrayOf("path");
for(std::map<gd::String, std::vector<sf::Vector2f> >::const_iterator it = localePaths.begin(); it != localePaths.end(); it++)
{
gd::SerializerElement & pathElement = element.AddChild("path");
pathElement.SetAttribute("name", it->first);
pathElement.SetAttribute("coords", GetStringFromCoordsVector(it->second, '/', ';'));
}
}
示例3: OpenPointsSprites
void OpenPointsSprites(vector < Point > & points, const gd::SerializerElement & element)
{
element.ConsiderAsArrayOf("point", "Point");
for (unsigned int i = 0; i < element.GetChildrenCount(); ++i)
{
Point point("");
OpenPoint(point, element.GetChild(i));
points.push_back(point);
}
}
示例4: UnserializePathsFrom
void PathBehavior::UnserializePathsFrom(const gd::SerializerElement & element)
{
localePaths.clear();
element.ConsiderAsArrayOf("path", "Path");
for(std::size_t i = 0;i<element.GetChildrenCount();++i)
{
const gd::SerializerElement & pathElement = element.GetChild(i);
localePaths[pathElement.GetStringAttribute("name")] = GetCoordsVectorFromString(pathElement.GetStringAttribute("coords"), '/', ';');
}
if(localePaths.empty())
localePaths["Object main path"] = std::vector<sf::Vector2f>(1, sf::Vector2f(0,0));
}
示例5: SavePointsSprites
void SavePointsSprites(const vector < Point > & points, gd::SerializerElement & element)
{
element.ConsiderAsArrayOf("point");
for (unsigned int i = 0;i<points.size();++i)
SavePoint(points[i], element.AddChild("point"));
}