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


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

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


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

示例1: UnserializeFrom

void PhysicsBehavior::UnserializeFrom(const gd::SerializerElement & element)
{
    dynamic = element.GetBoolAttribute("dynamic");
    fixedRotation = element.GetBoolAttribute("fixedRotation");
    isBullet = element.GetBoolAttribute("isBullet");
    massDensity = element.GetDoubleAttribute("massDensity");
    averageFriction = element.GetDoubleAttribute("averageFriction");
    averageRestitution = element.GetDoubleAttribute("averageRestitution");

    linearDamping = element.GetDoubleAttribute("linearDamping");
    angularDamping = element.GetDoubleAttribute("angularDamping");

    gd::String shape = element.GetStringAttribute("shapeType");
    if ( shape == "Circle" )
        shapeType = Circle;
    else if (shape == "CustomPolygon")
        shapeType = CustomPolygon;
    else
        shapeType = Box;

    if(element.GetStringAttribute("positioning", "OnOrigin") == "OnOrigin")
        polygonPositioning = OnOrigin;
    else
        polygonPositioning = OnCenter;

    automaticResizing = element.GetBoolAttribute("autoResizing", false);
    polygonWidth = element.GetDoubleAttribute("polygonWidth");
    polygonHeight = element.GetDoubleAttribute("polygonHeight");

    gd::String coordsStr = element.GetStringAttribute("coordsList");
    SetPolygonCoords(PhysicsBehavior::GetCoordsVectorFromString(coordsStr, '/', ';'));
}
开发者ID:HaoDrang,项目名称:GD,代码行数:32,代码来源:PhysicsBehavior.cpp

示例2: 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

示例3: UnserializeFrom

void NetworkBehavior::UnserializeFrom(const gd::SerializerElement & element)
{
    sending = element.GetBoolAttribute("sending");
    xPosition = element.GetBoolAttribute("xPosition");
    yPosition = element.GetBoolAttribute("yPosition");
    angle = element.GetBoolAttribute("angle");
    width = element.GetBoolAttribute("width");
    height = element.GetBoolAttribute("height");
    dataPrefix = element.GetStringAttribute("dataPrefix");
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:10,代码来源:NetworkBehavior.cpp

示例4: 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

示例5: 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

示例6: UnserializeFrom

void TileSet::UnserializeFrom(const gd::SerializerElement &element)
{
    ResetHitboxes();

    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);

    if (element.HasChild("hitboxes"))
    {
        gd::SerializerElement &tilesElem = element.GetChild("hitboxes");
        tilesElem.ConsiderAsArrayOf("tileHitbox");
        for(int i = 0; i < tilesElem.GetChildrenCount("tileHitbox"); i++)
        {
            TileHitbox newHitbox;
            newHitbox.UnserializeFrom(tilesElem.GetChild(i), tileSize);
            m_hitboxes.push_back(newHitbox);
        }
    }

    m_dirty = true;
}
开发者ID:sakelestemur,项目名称:GD,代码行数:24,代码来源:TileSet.cpp

示例7: DoUnserializeFrom

void TiledSpriteObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
    textureName = element.GetStringAttribute("texture");
    width = element.GetDoubleAttribute("width", 128);
    height = element.GetDoubleAttribute("height", 128);
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:6,代码来源:TiledSpriteObject.cpp

示例8: UnserializeFrom

void PlatformBehavior::UnserializeFrom(const gd::SerializerElement & element)
{
    gd::String platformTypeStr = element.GetStringAttribute("platformType");
    platformType = platformTypeStr == "Ladder" ?  Ladder : (platformTypeStr == "Jumpthru" ?
        Jumpthru : NormalPlatform);
}
开发者ID:mateerladnam,项目名称:GD,代码行数:6,代码来源:PlatformBehavior.cpp

示例9: UnserializeParticleEmitterBaseFrom

void ParticleEmitterBase::UnserializeParticleEmitterBaseFrom(
    const gd::SerializerElement& element) {
  tank = element.GetDoubleAttribute("tank");
  flow = element.GetDoubleAttribute("flow");
  emitterForceMin = element.GetDoubleAttribute("emitterForceMin");
  emitterForceMax = element.GetDoubleAttribute("emitterForceMax");
  emitterXDirection = element.GetDoubleAttribute("emitterXDirection");
  emitterYDirection = element.GetDoubleAttribute("emitterYDirection");
  emitterZDirection = element.GetDoubleAttribute("emitterZDirection");
  emitterAngleA = element.GetDoubleAttribute("emitterAngleA");
  emitterAngleB = element.GetDoubleAttribute("emitterAngleB");
  zoneRadius = element.GetDoubleAttribute("zoneRadius");
  particleGravityX = element.GetDoubleAttribute("particleGravityX");
  particleGravityY = element.GetDoubleAttribute("particleGravityY");
  particleGravityZ = element.GetDoubleAttribute("particleGravityZ");
  friction = element.GetDoubleAttribute("friction");
  particleLifeTimeMin = element.GetDoubleAttribute("particleLifeTimeMin");
  particleLifeTimeMax = element.GetDoubleAttribute("particleLifeTimeMax");
  particleRed1 = element.GetDoubleAttribute("particleRed1");
  particleRed2 = element.GetDoubleAttribute("particleRed2");
  particleGreen1 = element.GetDoubleAttribute("particleGreen1");
  particleGreen2 = element.GetDoubleAttribute("particleGreen2");
  particleBlue1 = element.GetDoubleAttribute("particleBlue1");
  particleBlue2 = element.GetDoubleAttribute("particleBlue2");
  particleAlpha1 = element.GetDoubleAttribute("particleAlpha1");
  particleAlpha2 = element.GetDoubleAttribute("particleAlpha2");
  rendererParam1 = element.GetDoubleAttribute("rendererParam1");
  rendererParam2 = element.GetDoubleAttribute("rendererParam2");
  particleSize1 = element.GetDoubleAttribute("particleSize1");
  particleSize2 = element.GetDoubleAttribute("particleSize2");
  particleAngle1 = element.GetDoubleAttribute("particleAngle1");
  particleAngle2 = element.GetDoubleAttribute("particleAngle2");
  particleAlphaRandomness1 =
      element.GetDoubleAttribute("particleAlphaRandomness1");
  particleAlphaRandomness2 =
      element.GetDoubleAttribute("particleAlphaRandomness2");
  particleSizeRandomness1 =
      element.GetDoubleAttribute("particleSizeRandomness1");
  particleSizeRandomness2 =
      element.GetDoubleAttribute("particleSizeRandomness2");
  particleAngleRandomness1 =
      element.GetDoubleAttribute("particleAngleRandomness1");
  particleAngleRandomness2 =
      element.GetDoubleAttribute("particleAngleRandomness2");
  additive = element.GetBoolAttribute("additive");
  destroyWhenNoParticles =
      element.GetBoolAttribute("destroyWhenNoParticles", false);
  textureParticleName = element.GetStringAttribute("textureParticleName");
  maxParticleNb = element.GetIntAttribute("maxParticleNb", 5000);

  {
    gd::String result = element.GetStringAttribute("rendererType");
    if (result == "Line")
      rendererType = Line;
    else if (result == "Quad")
      rendererType = Quad;
    else
      rendererType = Point;
  }
  {
    gd::String result = element.GetStringAttribute("redParam");
    if (result == "Mutable")
      redParam = Mutable;
    else if (result == "Random")
      redParam = Random;
    else
      redParam = Enabled;
  }
  {
    gd::String result = element.GetStringAttribute("greenParam");
    if (result == "Mutable")
      greenParam = Mutable;
    else if (result == "Random")
      greenParam = Random;
    else
      greenParam = Enabled;
  }
  {
    gd::String result = element.GetStringAttribute("blueParam");
    if (result == "Mutable")
      blueParam = Mutable;
    else if (result == "Random")
      blueParam = Random;
    else
      blueParam = Enabled;
  }
  {
    gd::String result = element.GetStringAttribute("alphaParam");
    if (result == "Mutable")
      alphaParam = Mutable;
    else if (result == "Random")
      alphaParam = Random;
    else
      alphaParam = Enabled;
  }
  {
    gd::String result = element.GetStringAttribute("sizeParam");
    if (result == "Mutable")
      sizeParam = Mutable;
    else if (result == "Random")
//.........这里部分代码省略.........
开发者ID:Lizard-13,项目名称:GD,代码行数:101,代码来源:ParticleEmitterObject.cpp

示例10: OpenPoint

void OpenPoint(Point & point, const gd::SerializerElement & element)
{
    point.SetName(element.GetStringAttribute("name", "", "nom"));
    point.SetX(element.GetDoubleAttribute("x", 0, "X"));
    point.SetY(element.GetDoubleAttribute("y", 0, "Y"));
}
开发者ID:heyuqi,项目名称:GD,代码行数:6,代码来源:Direction.cpp


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