当前位置: 首页>>代码示例>>C++>>正文


C++ SerializerElement::AddChild方法代码示例

本文整理汇总了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]);
}
开发者ID:Lizard-13,项目名称:GD,代码行数:26,代码来源:CppCodeEvent.cpp

示例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);
    }
}
开发者ID:HaoDrang,项目名称:GD,代码行数:26,代码来源:TileSet.cpp

示例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"));
}
开发者ID:mateerladnam,项目名称:GD,代码行数:8,代码来源:TimedEvent.cpp

示例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"));
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:8,代码来源:FunctionEvent.cpp

示例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);
}
开发者ID:HaoDrang,项目名称:GD,代码行数:14,代码来源:TextObject.cpp

示例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);
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:15,代码来源:ShapePainterObject.cpp

示例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);
}
开发者ID:4ian,项目名称:GD-Extensions,代码行数:12,代码来源:Box3DObject.cpp

示例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);
            }
        }
    }
}
开发者ID:heyuqi,项目名称:GD,代码行数:32,代码来源:Direction.cpp

示例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, '/', ';'));
    }
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:11,代码来源:PathBehavior.cpp

示例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());
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:13,代码来源:PathBehavior.cpp

示例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());
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:11,代码来源:SoundObject.cpp

示例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);
    }
}
开发者ID:sakelestemur,项目名称:GD,代码行数:17,代码来源:TileSet.cpp

示例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"));
        }
    }
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:19,代码来源:SpriteObject.cpp

示例14: DoSerializeTo

void TileMapObject::DoSerializeTo(gd::SerializerElement & element) const
{
    tileSet.Get().SerializeTo(element.AddChild("tileSet"));
    tileMap.Get().SerializeTo(element.AddChild("tileMap"));
}
开发者ID:HaoDrang,项目名称:GD,代码行数:5,代码来源:TileMapObject.cpp

示例15: SerializeTo

void Direction::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("looping", IsLooping());
    element.SetAttribute("timeBetweenFrames", GetTimeBetweenFrames());
    SaveSpritesDirection(sprites, element.AddChild("sprites"));
}
开发者ID:heyuqi,项目名称:GD,代码行数:6,代码来源:Direction.cpp


注:本文中的gd::SerializerElement::AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。