本文整理汇总了C++中Sprite::GetAllNonDefaultPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::GetAllNonDefaultPoints方法的具体用法?C++ Sprite::GetAllNonDefaultPoints怎么用?C++ Sprite::GetAllNonDefaultPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite::GetAllNonDefaultPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnserializeFrom
void Direction::UnserializeFrom(const gd::SerializerElement & element)
{
SetTimeBetweenFrames(element.GetDoubleAttribute("timeBetweenFrames", 1, "tempsEntre"));
SetLoop(element.GetBoolAttribute("looping", false, "boucle"));
const gd::SerializerElement & spritesElement = element.GetChild("sprites", 0, "Sprites");
spritesElement.ConsiderAsArrayOf("sprite", "Sprite");
for (unsigned int i = 0; i < spritesElement.GetChildrenCount(); ++i)
{
const gd::SerializerElement & spriteElement = spritesElement.GetChild(i);
Sprite sprite;
sprite.SetImageName(spriteElement.GetStringAttribute("image"));
OpenPointsSprites(sprite.GetAllNonDefaultPoints(), spriteElement.GetChild("points", 0, "Points"));
OpenPoint(sprite.GetOrigin(), spriteElement.GetChild("originPoint" , 0, "PointOrigine"));
OpenPoint(sprite.GetCenter(), spriteElement.GetChild("centerPoint" , 0, "PointCentre"));
sprite.SetDefaultCenterPoint(spriteElement.GetChild("centerPoint" , 0, "PointCentre").GetBoolAttribute("automatic", true));
if (spriteElement.HasChild("CustomCollisionMask"))
sprite.SetCollisionMaskAutomatic(!spriteElement.GetChild("CustomCollisionMask").GetBoolAttribute("custom", false));
else
sprite.SetCollisionMaskAutomatic(!spriteElement.GetBoolAttribute("hasCustomCollisionMask", false));
std::vector<Polygon2d> mask;
const gd::SerializerElement & collisionMaskElement = spriteElement.GetChild("customCollisionMask", 0, "CustomCollisionMask");
collisionMaskElement.ConsiderAsArrayOf("polygon", "Polygon");
for (unsigned int j = 0; j < collisionMaskElement.GetChildrenCount(); ++j)
{
Polygon2d polygon;
const gd::SerializerElement & polygonElement = collisionMaskElement.GetChild(j);
polygonElement.ConsiderAsArrayOf("vertice", "Point");
for (unsigned int k = 0; k < polygonElement.GetChildrenCount(); ++k)
{
const gd::SerializerElement & verticeElement = polygonElement.GetChild(k);
polygon.vertices.push_back(sf::Vector2f(verticeElement.GetDoubleAttribute("x"),
verticeElement.GetDoubleAttribute("y")));
}
mask.push_back(polygon);
}
sprite.SetCustomCollisionMask(mask);
sprites.push_back(sprite);
}
};