本文整理汇总了C++中gd::SerializerElement::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement::AddChild方法的具体用法?C++ SerializerElement::AddChild怎么用?C++ SerializerElement::AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::SerializerElement
的用法示例。
在下文中一共展示了SerializerElement::AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SerializeTo
void CppCodeEvent::SerializeTo(gd::SerializerElement& element) const {
element.SetAttribute("functionToCall", functionToCall);
element.SetAttribute("functionNameAutogenerated", functionNameAutogenerated);
element.SetAttribute("inlineCode", inlineCode);
element.SetAttribute("associatedGDManagedSourceFile",
associatedGDManagedSourceFile);
element.SetAttribute("passSceneAsParameter", passSceneAsParameter);
element.SetAttribute("passObjectListAsParameter", passObjectListAsParameter);
element.SetAttribute("objectToPassAsParameter", objectToPassAsParameter);
element.SetAttribute("codeDisplayedInEditor", codeDisplayedInEditor);
element.SetAttribute("displayedName", displayedName);
element.SetAttribute("lastChangeTimeStamp", (int)lastChangeTimeStamp);
gd::SerializerElement& includesElement = element.AddChild("includes");
includesElement.ConsiderAsArrayOf("include");
for (std::size_t i = 0; i < includeFiles.size(); ++i)
includesElement.AddChild("include").SetValue(includeFiles[i]);
gd::SerializerElement& dependenciesElement = element.AddChild("dependencies");
dependenciesElement.ConsiderAsArrayOf("dependency");
for (std::size_t i = 0; i < dependencies.size(); ++i)
dependenciesElement.AddChild("dependency")
.SetAttribute("sourceFile", dependencies[i]);
}
示例2: SerializeTo
void TileSet::SerializeTo(gd::SerializerElement &element) const
{
element.SetAttribute("version", 2);
element.SetAttribute("textureName", textureName);
element.SetAttribute("tileSizeX", tileSize.x);
element.SetAttribute("tileSizeY", tileSize.y);
element.SetAttribute("tileSpacingX", tileSpacing.x);
element.SetAttribute("tileSpacingY", tileSpacing.y);
//Save if it is collidable or not
gd::SerializerElement &collidableElem = element.AddChild("collidable");
for(auto it = m_collidable.begin(); it != m_collidable.end(); ++it)
{
gd::SerializerElement &tileElem = collidableElem.AddChild("tile");
tileElem.SetAttribute("collidable", *it);
}
//Save polygons hitboxes
gd::SerializerElement &tilesElem = element.AddChild("hitboxes");
for(auto it = m_hitboxes.begin(); it != m_hitboxes.end(); ++it)
{
gd::SerializerElement &hitboxElem = tilesElem.AddChild("tileHitbox");
hitboxElem.SetAttribute("tileId", it->first);
it->second.SerializeTo(hitboxElem);
}
}
示例3: SerializeTo
void TimedEvent::SerializeTo(gd::SerializerElement & element) const
{
element.AddChild("name").SetValue(name);
element.AddChild("timeout").SetValue(timeout.GetPlainString());
gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
}
示例4: SerializeTo
void FunctionEvent::SerializeTo(gd::SerializerElement & element) const
{
element.AddChild("name").SetValue(name);
element.AddChild("objectsPassedAsArgument").SetValue(objectsPassedAsArgument);
gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
}
示例5: DoSerializeTo
void TextObject::DoSerializeTo(gd::SerializerElement & element) const
{
element.AddChild("string").SetValue(GetString());
element.AddChild("font").SetValue(GetFontFilename());
element.AddChild("characterSize").SetValue(GetCharacterSize());
element.AddChild("color").SetAttribute("r", (int)GetColorR())
.SetAttribute("g", (int)GetColorG())
.SetAttribute("b", (int)GetColorB());
element.SetAttribute("smoothed", smoothed);
element.SetAttribute("bold", bold);
element.SetAttribute("italic", italic);
element.SetAttribute("underlined", underlined);
}
示例6: SerializeTo
void ShapePainterObjectBase::SerializeTo(gd::SerializerElement & element) const
{
element.AddChild("fillOpacity").SetValue(fillOpacity);
element.AddChild("outlineSize").SetValue(outlineSize);
element.AddChild("outlineOpacity").SetValue(outlineOpacity);
element.AddChild("fillColor")
.SetAttribute("r", (int)fillColorR)
.SetAttribute("g", (int)fillColorG)
.SetAttribute("b", (int)fillColorB);
element.AddChild("outlineColor")
.SetAttribute("r", (int)outlineColorR)
.SetAttribute("g", (int)outlineColorG)
.SetAttribute("b", (int)outlineColorB);
element.AddChild("absoluteCoordinates").SetValue(absoluteCoordinates);
}
示例7:
void Box3DObject::DoSerializeTo(gd::SerializerElement & element) const
{
element.AddChild("frontTexture").SetValue(frontTextureName);
element.AddChild("topTexture").SetValue(topTextureName);
element.AddChild("bottomTexture").SetValue(bottomTextureName);
element.AddChild("leftTexture").SetValue(leftTextureName);
element.AddChild("rightTexture").SetValue(rightTextureName);
element.AddChild("backTexture").SetValue(backTextureName);
element.AddChild("width").SetValue(width);
element.AddChild("height").SetValue(height);
element.AddChild("depth").SetValue(depth);
}
示例8: 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);
}
}
}
}
示例9: 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, '/', ';'));
}
}
示例10: SerializeTo
void PathBehavior::SerializeTo(gd::SerializerElement & element) const
{
SerializePathsTo(element.AddChild("paths"));
element.SetAttribute("currentPath", GetCurrentPathName());
element.SetAttribute("speed", GetSpeed());
element.SetAttribute("offsetX", GetOffsetX());
element.SetAttribute("offsetY", GetOffsetY());
element.SetAttribute("angleOffset", angleOffset);
element.SetAttribute("reverseAtEnd", ReverseAtEnd());
element.SetAttribute("stopAtEnd", StopAtEnd());
element.SetAttribute("followAngle", FollowAngle());
}
示例11: DoSerializeTo
void SoundObject::DoSerializeTo(gd::SerializerElement & element) const
{
element.AddChild("type").SetValue(type);
element.AddChild("filename").SetValue(fileName);
element.AddChild("loop").SetValue(IsLooping());
element.AddChild("volume").SetValue(GetVolume());
element.AddChild("pitch").SetValue(GetPitch());
element.AddChild("attenuation").SetValue(GetAttenuation());
element.AddChild("minDistance").SetValue(GetMinDistance());
element.AddChild("zPos").SetValue(GetZPos());
}
示例12: SerializeTo
void TileSet::SerializeTo(gd::SerializerElement &element) const
{
element.SetAttribute("textureName", textureName);
element.SetAttribute("tileSizeX", tileSize.x);
element.SetAttribute("tileSizeY", tileSize.y);
element.SetAttribute("tileSpacingX", tileSpacing.x);
element.SetAttribute("tileSpacingY", tileSpacing.y);
gd::SerializerElement &tilesElem = element.AddChild("hitboxes");
//Save polygons
for(std::vector<TileHitbox>::const_iterator it = m_hitboxes.begin(); it != m_hitboxes.end(); it++)
{
gd::SerializerElement &hitboxElem = tilesElem.AddChild("tileHitbox");
it->SerializeTo(hitboxElem);
}
}
示例13: DoSerializeTo
void SpriteObject::DoSerializeTo(gd::SerializerElement & element) const
{
//Animations
gd::SerializerElement & animationsElement = element.AddChild("animations");
animationsElement.ConsiderAsArrayOf("animation");
for ( std::size_t k = 0;k < GetAnimationsCount();k++ )
{
gd::SerializerElement & animationElement = animationsElement.AddChild("animation");
animationElement.SetAttribute( "useMultipleDirections", GetAnimation(k).useMultipleDirections);
gd::SerializerElement & directionsElement = animationElement.AddChild("directions");
directionsElement.ConsiderAsArrayOf("direction");
for ( std::size_t l = 0;l < GetAnimation(k).GetDirectionsCount();l++ )
{
GetAnimation(k).GetDirection(l).SerializeTo(directionsElement.AddChild("direction"));
}
}
}
示例14: DoSerializeTo
void TileMapObject::DoSerializeTo(gd::SerializerElement & element) const
{
tileSet.Get().SerializeTo(element.AddChild("tileSet"));
tileMap.Get().SerializeTo(element.AddChild("tileMap"));
}
示例15: SerializeTo
void Direction::SerializeTo(gd::SerializerElement & element) const
{
element.SetAttribute("looping", IsLooping());
element.SetAttribute("timeBetweenFrames", GetTimeBetweenFrames());
SaveSpritesDirection(sprites, element.AddChild("sprites"));
}