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


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

本文整理汇总了C++中gd::SerializerElement::GetChild方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement::GetChild方法的具体用法?C++ SerializerElement::GetChild怎么用?C++ SerializerElement::GetChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gd::SerializerElement的用法示例。


在下文中一共展示了SerializerElement::GetChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UnserializeFrom

void CppCodeEvent::UnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    functionToCall = element.GetStringAttribute("functionToCall", "", "FunctionToCall");
    functionNameAutogenerated = element.GetBoolAttribute("functionNameAutogenerated", false, "FunctionNameAutogenerated"),
    inlineCode = element.GetStringAttribute("inlineCode", "", "InlineCode");
    associatedGDManagedSourceFile = element.GetStringAttribute("associatedGDManagedSourceFile", "", "AssociatedGDManagedSourceFile");

    passSceneAsParameter = element.GetBoolAttribute("passSceneAsParameter", false, "PassSceneAsParameter");
    passObjectListAsParameter = element.GetBoolAttribute("passObjectListAsParameter", false, "PassObjectListAsParameter");
    objectToPassAsParameter = element.GetStringAttribute("objectToPassAsParameter", "", "ObjectToPassAsParameter");

    codeDisplayedInEditor = element.GetBoolAttribute("codeDisplayedInEditor", true, "CodeDisplayedInEditor");
    displayedName = element.GetStringAttribute("displayedName", "", "DisplayedName");
    lastChangeTimeStamp = element.GetIntAttribute("lastChangeTimeStamp");

    includeFiles.clear();
    gd::SerializerElement & includesElement = element.GetChild("includes", 0, "Includes");
    includesElement.ConsiderAsArrayOf("include", "Include");
    for ( std::size_t i = 0;i < includesElement.GetChildrenCount();++i)
        includeFiles.push_back(includesElement.GetChild(i).GetValue().GetString());

    dependencies.clear();
    gd::SerializerElement & dependenciesElement = element.GetChild("dependencies", 0, "Dependencies");
    dependenciesElement.ConsiderAsArrayOf("dependency", "Dependency");
    for ( std::size_t i = 0;i < dependenciesElement.GetChildrenCount();++i)
        dependencies.push_back(dependenciesElement.GetChild(i).GetStringAttribute("sourceFile"));
}
开发者ID:mateerladnam,项目名称:GD,代码行数:27,代码来源:CppCodeEvent.cpp

示例2: UnserializeFrom

void TimedEvent::UnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    name = element.GetChild("name", 0, "Name").GetValue().GetString();
    timeout = element.GetChild("timeout", 0, "Timeout").GetValue().GetString();
    gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
    gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
    gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
}
开发者ID:mateerladnam,项目名称:GD,代码行数:8,代码来源:TimedEvent.cpp

示例3: UnserializeFrom

void FunctionEvent::UnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    name = element.GetChild("name", 0, "Name").GetValue().GetString();
    objectsPassedAsArgument = element.GetChild("objectsPassedAsArgument").GetValue().GetString();
    gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
    gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
    gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:8,代码来源:FunctionEvent.cpp

示例4: DoUnserializeFrom

void TileMapObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    if(element.HasChild("tileSet"))
    {
        tileSet.Get().UnserializeFrom(element.GetChild("tileSet"));
    }
    if(element.HasChild("tileMap"))
    {
        tileMap.Get().UnserializeFrom(element.GetChild("tileMap"));
    }
}
开发者ID:HaoDrang,项目名称:GD,代码行数:11,代码来源:TileMapObject.cpp

示例5: DoUnserializeFrom

void TextObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    SetString(element.GetChild("string", 0,"String").GetValue().GetString());
    SetFontFilename(element.GetChild("font", 0,"Font").GetValue().GetString());
    SetCharacterSize(element.GetChild("characterSize", 0, "CharacterSize").GetValue().GetInt());
    SetColor(element.GetChild("color", 0,"Color").GetIntAttribute("r", 255),
        element.GetChild("color", 0,"Color").GetIntAttribute("g", 255),
        element.GetChild("color", 0,"Color").GetIntAttribute("b", 255));


    smoothed = element.GetBoolAttribute("smoothed");
    bold = element.GetBoolAttribute("bold");
    italic = element.GetBoolAttribute("italic");
    underlined = element.GetBoolAttribute("underlined");
}
开发者ID:HaoDrang,项目名称:GD,代码行数:15,代码来源:TextObject.cpp

示例6:

void Box3DObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    frontTextureName = element.GetChild("frontTexture").GetValue().GetString();
    topTextureName = element.GetChild("topTexture").GetValue().GetString();
    bottomTextureName = element.GetChild("bottomTexture").GetValue().GetString();
    leftTextureName = element.GetChild("leftTexture").GetValue().GetString();
    rightTextureName = element.GetChild("rightTexture").GetValue().GetString();
    backTextureName = element.GetChild("backTexture").GetValue().GetString();
    width = element.GetChild("width").GetValue().GetInt();
    height = element.GetChild("height").GetValue().GetInt();
    depth = element.GetChild("depth").GetValue().GetInt();
}
开发者ID:4ian,项目名称:GD-Extensions,代码行数:12,代码来源:Box3DObject.cpp

示例7: UnserializeFrom

void TileSet::UnserializeFrom(const gd::SerializerElement &element)
{
    int serializationVersion = element.GetIntAttribute("version", 1);

    textureName = element.GetStringAttribute("textureName", "");
    tileSize.x = element.GetIntAttribute("tileSizeX", 32);
    tileSize.y = element.GetIntAttribute("tileSizeY", 32);
    tileSpacing.x = element.GetIntAttribute("tileSpacingX", 0);
    tileSpacing.y = element.GetIntAttribute("tileSpacingY", 0);

    ResetHitboxes();
    m_collidable.clear();

    if(serializationVersion == 1)
    {
        if(element.HasChild("hitboxes"))
        {
            gd::SerializerElement &tilesElem = element.GetChild("hitboxes");
            tilesElem.ConsiderAsArrayOf("tileHitbox");
            for(int i = 0; i < tilesElem.GetChildrenCount("tileHitbox"); i++)
            {
                m_collidable.push_back(tilesElem.GetChild(i).GetBoolAttribute("collidable", true));
                TileHitbox newHitbox;
                newHitbox.UnserializeFrom(tilesElem.GetChild(i), tileSize);
                if(newHitbox != TileHitbox::Rectangle(tileSize))
                    m_hitboxes[i] = newHitbox;
            }
        }
    }
    else if(serializationVersion == 2)
    {
        gd::SerializerElement &collidableElem = element.GetChild("collidable");
        collidableElem.ConsiderAsArrayOf("tile");
        for(int i = 0; i < collidableElem.GetChildrenCount("tile"); i++)
        {
            m_collidable.push_back(collidableElem.GetChild(i).GetBoolAttribute("collidable", true));
        }

        gd::SerializerElement &hitboxesElem = element.GetChild("hitboxes");
        hitboxesElem.ConsiderAsArrayOf("tileHitbox");
        for(int i = 0; i < hitboxesElem.GetChildrenCount("tileHitbox"); i++)
        {
            m_hitboxes[hitboxesElem.GetChild(i).GetIntAttribute("tileId", -1)].UnserializeFrom(hitboxesElem.GetChild(i), tileSize);
        }
    }
}
开发者ID:HaoDrang,项目名称:GD,代码行数:46,代码来源:TileSet.cpp

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

示例9: UnserializeFrom

void PathBehavior::UnserializeFrom(const gd::SerializerElement & element)
{
    UnserializePathsFrom(element.GetChild("paths", 0, "Paths"));

    ChangeCurrentPath(element.GetStringAttribute("currentPath"));
    speed = element.GetDoubleAttribute("speed");
    offset.x = element.GetDoubleAttribute("offsetX");
    offset.y = element.GetDoubleAttribute("offsetY");
    angleOffset = element.GetDoubleAttribute("angleOffset");
    reverseAtEnd = element.GetBoolAttribute("reverseAtEnd");
    stopAtEnd = element.GetBoolAttribute("stopAtEnd");
    followAngle = element.GetBoolAttribute("followAngle");
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:13,代码来源:PathBehavior.cpp

示例10: DoUnserializeFrom

void SoundObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    SetSoundType(element.GetChild("type", 0, "Type").GetValue().GetString());
    SetSoundFileName(element.GetChild("filename", 0, "Filename").GetValue().GetString());
    SetPitch(element.GetChild("volume", 0, "Volume").GetValue().GetDouble());
    SetPitch(element.GetChild("pitch", 0, "Pitch").GetValue().GetDouble());
    SetMinDistance(element.GetChild("minDistance", 0, "MinDistance").GetValue().GetDouble());
    SetAttenuation(element.GetChild("attenuation", 0, "Attenuation").GetValue().GetDouble());
    SetLooping(element.GetChild("loop", 0, "Loop").GetValue().GetBool());
    SetZPos(element.GetChild("zPos", 0, "ZPos").GetValue().GetDouble());
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:11,代码来源:SoundObject.cpp

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

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

示例13: UnserializeFrom

void ScenePathDatas::UnserializeFrom(const gd::SerializerElement & element)
{
    globalPaths.clear();

    if (!element.HasChild("paths", "Paths")) return;

    const gd::SerializerElement & pathsElement = element.GetChild("paths", 0, "Paths");
    pathsElement.ConsiderAsArrayOf("path", "Path");
    for (int i = 0; i < pathsElement.GetChildrenCount(); ++i)
    {
        const gd::SerializerElement & pathElement = pathsElement.GetChild(i);

        globalPaths[pathElement.GetStringAttribute("name")] = PathBehavior::GetCoordsVectorFromString(pathElement.GetStringAttribute("coords"), '/', ';');
    }

}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:16,代码来源:ScenePathDatas.cpp

示例14: UnserializeFrom

void ShapePainterObjectBase::UnserializeFrom(const gd::SerializerElement & element)
{
    fillOpacity = element.GetChild("fillOpacity", 0, "FillOpacity").GetValue().GetInt();
    outlineSize = element.GetChild("outlineSize", 0, "OutlineSize").GetValue().GetInt();
    outlineOpacity = element.GetChild("outlineOpacity", 0, "OutlineOpacity").GetValue().GetInt();

    fillColorR = element.GetChild("fillColor", 0, "FillColor").GetIntAttribute("r");
    fillColorG = element.GetChild("fillColor", 0, "FillColor").GetIntAttribute("g");
    fillColorB = element.GetChild("fillColor", 0, "FillColor").GetIntAttribute("b");

    outlineColorR = element.GetChild("outlineColor", 0, "OutlineColor").GetIntAttribute("r");
    outlineColorG = element.GetChild("outlineColor", 0, "OutlineColor").GetIntAttribute("g");
    outlineColorB = element.GetChild("outlineColor", 0, "OutlineColor").GetIntAttribute("b");

    absoluteCoordinates = element.GetChild("absoluteCoordinates", 0, "AbsoluteCoordinates").GetValue().GetBool();
}
开发者ID:sanyaade-teachings,项目名称:GD,代码行数:16,代码来源:ShapePainterObject.cpp

示例15: DoUnserializeFrom

void SpriteObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    const gd::SerializerElement & animationsElement = element.GetChild("animations", 0, "Animations");
    animationsElement.ConsiderAsArrayOf("animation", "Animation");
    for (std::size_t i = 0; i < animationsElement.GetChildrenCount(); ++i)
    {
        const gd::SerializerElement & animationElement = animationsElement.GetChild(i);
        Animation newAnimation;

        newAnimation.useMultipleDirections = animationElement.GetBoolAttribute("useMultipleDirections", false, "typeNormal");

        //Compatibility with GD <= 3.3
        if (animationElement.HasChild("Direction"))
        {
            for (std::size_t j = 0; j < animationElement.GetChildrenCount("Direction"); ++j)
            {
                Direction direction;
                direction.UnserializeFrom(animationElement.GetChild("Direction", j));

                newAnimation.SetDirectionsCount(newAnimation.GetDirectionsCount()+1);
                newAnimation.SetDirection(direction, newAnimation.GetDirectionsCount()-1);
            }
        }
        //End of compatibility code
        else
        {
            const gd::SerializerElement & directionsElement = animationElement.GetChild("directions");
            directionsElement.ConsiderAsArrayOf("direction");
            for (std::size_t j = 0; j < directionsElement.GetChildrenCount(); ++j)
            {
                Direction direction;
                direction.UnserializeFrom(directionsElement.GetChild(j));

                newAnimation.SetDirectionsCount(newAnimation.GetDirectionsCount()+1);
                newAnimation.SetDirection(direction, newAnimation.GetDirectionsCount()-1);
            }
        }

        AddAnimation( newAnimation );
    }
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:41,代码来源:SpriteObject.cpp


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