예제 #1
0
파일: TileSet.cpp 프로젝트: HaoDrang/GD
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);
    }
}
예제 #2
0
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]);
}
예제 #3
0
void ParticleEmitterObject::DoSerializeTo(
    gd::SerializerElement& element) const {
  element.SetAttribute("particleEditionSimpleMode", particleEditionSimpleMode);
  element.SetAttribute("emissionEditionSimpleMode", emissionEditionSimpleMode);
  element.SetAttribute("gravityEditionSimpleMode", gravityEditionSimpleMode);

  ParticleEmitterBase::SerializeParticleEmitterBaseTo(element);
}
예제 #4
0
void PlatformBehavior::SerializeTo(gd::SerializerElement & element) const
{
    if ( platformType == Ladder)
        element.SetAttribute("platformType", "Ladder");
    else if ( platformType == Jumpthru )
        element.SetAttribute("platformType", "Jumpthru");
    else
        element.SetAttribute("platformType", "NormalPlatform");
}
예제 #5
0
void NetworkBehavior::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("sending", sending);
    element.SetAttribute("xPosition", xPosition);
    element.SetAttribute("yPosition", yPosition);
    element.SetAttribute("angle", angle);
    element.SetAttribute("width", width);
    element.SetAttribute("height", height);
    element.SetAttribute("dataPrefix", dataPrefix);
}
예제 #6
0
void PlatformerObjectBehavior::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("gravity", gravity);
    element.SetAttribute("maxFallingSpeed", maxFallingSpeed);
    element.SetAttribute("acceleration", acceleration);
    element.SetAttribute("deceleration", deceleration);
    element.SetAttribute("maxSpeed", maxSpeed);
    element.SetAttribute("jumpSpeed", jumpSpeed);
    element.SetAttribute("ignoreDefaultControls", ignoreDefaultControls);
    element.SetAttribute("slopeMaxAngle", slopeMaxAngle);
    element.SetAttribute("canGrabPlatforms", canGrabPlatforms);
    element.SetAttribute("yGrabOffset", yGrabOffset);
    element.SetAttribute("xGrabTolerance", xGrabTolerance);
}
예제 #7
0
파일: TextObject.cpp 프로젝트: HaoDrang/GD
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);
}
예제 #8
0
파일: TileSet.cpp 프로젝트: sakelestemur/GD
void TileHitbox::SerializeTo(gd::SerializerElement &element) const
{
    element.SetAttribute("collidable", collidable);

    //Serialize the polygon
    gd::String polygonStr;
    for(std::vector<sf::Vector2f>::const_iterator vertexIt = hitbox.vertices.begin(); vertexIt != hitbox.vertices.end(); vertexIt++)
    {
        if(vertexIt != hitbox.vertices.begin())
            polygonStr += "|";

        polygonStr += gd::String::From(vertexIt->x) + ";" + gd::String::From(vertexIt->y);
    }
    element.SetAttribute("polygon", polygonStr);
}
예제 #9
0
void PathfindingBehavior::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("allowDiagonals", allowDiagonals);
    element.SetAttribute("acceleration", acceleration);
    element.SetAttribute("maxSpeed", maxSpeed);
    element.SetAttribute("angularMaxSpeed", angularMaxSpeed);
    element.SetAttribute("rotateObject", rotateObject);
    element.SetAttribute("angleOffset", angleOffset);
    element.SetAttribute("cellWidth", (int)cellWidth);
    element.SetAttribute("cellHeight", (int)cellHeight);
    element.SetAttribute("extraBorder", extraBorder);
}
예제 #10
0
파일: TileSet.cpp 프로젝트: sakelestemur/GD
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);
    }
}
예제 #11
0
void PlatformerObjectAutomatism::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("gravity", gravity);
    element.SetAttribute("maxFallingSpeed", maxFallingSpeed);
    element.SetAttribute("acceleration", acceleration);
    element.SetAttribute("deceleration", deceleration);
    element.SetAttribute("maxSpeed", maxSpeed);
    element.SetAttribute("jumpSpeed", jumpSpeed);
    element.SetAttribute("ignoreDefaultControls", ignoreDefaultControls);
    element.SetAttribute("slopeMaxAngle", slopeMaxAngle);

}
예제 #12
0
void LightObject::DoSerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("intensity", GetIntensity());
    element.SetAttribute("radius", GetRadius());
    element.SetAttribute("quality", GetQuality());

    element.SetAttribute("colorR", GetColor().r);
    element.SetAttribute("colorG", GetColor().g);
    element.SetAttribute("colorB", GetColor().b);

    element.SetAttribute("globalLight", globalLight);
    element.SetAttribute("globalColorR", globalLightColor.r);
    element.SetAttribute("globalColorG", globalLightColor.g);
    element.SetAttribute("globalColorB", globalLightColor.b);
    element.SetAttribute("globalColorA", globalLightColor.a);
}
예제 #13
0
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());
}
예제 #14
0
void PhysicsBehavior::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("dynamic", dynamic);
    element.SetAttribute("fixedRotation", fixedRotation);
    element.SetAttribute("isBullet", isBullet);
    element.SetAttribute("massDensity", massDensity);
    element.SetAttribute("averageFriction", averageFriction);
    element.SetAttribute("linearDamping", linearDamping);
    element.SetAttribute("angularDamping", angularDamping);
    if ( shapeType == Circle)
        element.SetAttribute("shapeType", "Circle");
    else if( shapeType == CustomPolygon )
        element.SetAttribute("shapeType", "CustomPolygon");
    else
        element.SetAttribute("shapeType", "Box");

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

    element.SetAttribute("autoResizing", automaticResizing);
    element.SetAttribute("polygonWidth", polygonWidth);
    element.SetAttribute("polygonHeight", polygonHeight);

    element.SetAttribute("coordsList", PhysicsBehavior::GetStringFromCoordsVector(GetPolygonCoords(), '/', ';'));
    element.SetAttribute("averageRestitution", averageRestitution);
}
예제 #15
0
파일: Direction.cpp 프로젝트: heyuqi/GD
void SavePoint(const Point & point, gd::SerializerElement & element)
{
    element.SetAttribute("name", point.GetName());
    element.SetAttribute("x", point.GetX());
    element.SetAttribute("y", point.GetY());
}
예제 #16
0
파일: Direction.cpp 프로젝트: heyuqi/GD
void Direction::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("looping", IsLooping());
    element.SetAttribute("timeBetweenFrames", GetTimeBetweenFrames());
    SaveSpritesDirection(sprites, element.AddChild("sprites"));
}
예제 #17
0
void ParticleEmitterBase::SerializeParticleEmitterBaseTo(
    gd::SerializerElement& element) const {
  element.SetAttribute("tank", tank);
  element.SetAttribute("flow", flow);
  element.SetAttribute("emitterForceMin", emitterForceMin);
  element.SetAttribute("emitterForceMax", emitterForceMax);
  element.SetAttribute("emitterXDirection", emitterXDirection);
  element.SetAttribute("emitterYDirection", emitterYDirection);
  element.SetAttribute("emitterZDirection", emitterZDirection);
  element.SetAttribute("emitterAngleA", emitterAngleA);
  element.SetAttribute("emitterAngleB", emitterAngleB);
  element.SetAttribute("zoneRadius", zoneRadius);
  element.SetAttribute("particleGravityX", particleGravityX);
  element.SetAttribute("particleGravityY", particleGravityY);
  element.SetAttribute("particleGravityZ", particleGravityZ);
  element.SetAttribute("friction", friction);
  element.SetAttribute("particleLifeTimeMin", particleLifeTimeMin);
  element.SetAttribute("particleLifeTimeMax", particleLifeTimeMax);
  element.SetAttribute("particleRed1", particleRed1);
  element.SetAttribute("particleRed2", particleRed2);
  element.SetAttribute("particleGreen1", particleGreen1);
  element.SetAttribute("particleGreen2", particleGreen2);
  element.SetAttribute("particleBlue1", particleBlue1);
  element.SetAttribute("particleBlue2", particleBlue2);
  element.SetAttribute("particleAlpha1", particleAlpha1);
  element.SetAttribute("particleAlpha2", particleAlpha2);
  element.SetAttribute("particleSize1", particleSize1);
  element.SetAttribute("particleSize2", particleSize2);
  element.SetAttribute("particleAngle1", particleAngle1);
  element.SetAttribute("particleAngle2", particleAngle2);
  element.SetAttribute("rendererParam1", rendererParam1);
  element.SetAttribute("rendererParam2", rendererParam2);
  element.SetAttribute("particleAlphaRandomness1", particleAlphaRandomness1);
  element.SetAttribute("particleAlphaRandomness2", particleAlphaRandomness2);
  element.SetAttribute("particleSizeRandomness1", particleSizeRandomness1);
  element.SetAttribute("particleSizeRandomness2", particleSizeRandomness2);
  element.SetAttribute("particleAngleRandomness1", particleAngleRandomness1);
  element.SetAttribute("particleAngleRandomness2", particleAngleRandomness2);
  element.SetAttribute("additive", additive);
  element.SetAttribute("destroyWhenNoParticles", destroyWhenNoParticles);
  element.SetAttribute("textureParticleName", textureParticleName);
  element.SetAttribute("maxParticleNb", (int)maxParticleNb);

  gd::String rendererTypeStr = "Point";
  if (rendererType == Line)
    rendererTypeStr = "Line";
  else if (rendererType == Quad)
    rendererTypeStr = "Quad";
  element.SetAttribute("rendererType", rendererTypeStr);

  gd::String redParamStr = "Enabled";
  if (redParam == Mutable)
    redParamStr = "Mutable";
  else if (redParam == Random)
    redParamStr = "Random";
  element.SetAttribute("redParam", redParamStr);

  gd::String greenParamStr = "Enabled";
  if (greenParam == Mutable)
    greenParamStr = "Mutable";
  else if (greenParam == Random)
    greenParamStr = "Random";
  element.SetAttribute("greenParam", greenParamStr);

  gd::String blueParamStr = "Enabled";
  if (blueParam == Mutable)
    blueParamStr = "Mutable";
  else if (blueParam == Random)
    blueParamStr = "Random";
  element.SetAttribute("blueParam", blueParamStr);

  gd::String alphaParamStr = "Enabled";
  if (alphaParam == Mutable)
    alphaParamStr = "Mutable";
  else if (alphaParam == Random)
    alphaParamStr = "Random";
  element.SetAttribute("alphaParam", alphaParamStr);

  gd::String sizeParamStr = "Nothing";
  if (sizeParam == Mutable)
    sizeParamStr = "Mutable";
  else if (sizeParam == Random)
    sizeParamStr = "Random";
  element.SetAttribute("sizeParam", sizeParamStr);

  gd::String angleParamStr = "Nothing";
  if (angleParam == Mutable)
    angleParamStr = "Mutable";
  else if (angleParam == Random)
    angleParamStr = "Random";
  element.SetAttribute("angleParam", angleParamStr);
}
예제 #18
0
void DestroyOutsideBehavior::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("extraBorder", extraBorder);
}
예제 #19
0
void PathfindingObstacleAutomatism::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("impassable", impassable);
    element.SetAttribute("cost", cost);
}
예제 #20
0
void TiledSpriteObject::DoSerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("texture", textureName);
    element.SetAttribute("width", width);
    element.SetAttribute("height", height);
}
예제 #21
0
void ScenePhysicsDatas::SerializeTo(gd::SerializerElement& element) const {
  element.SetAttribute("gravityX", gravityX);
  element.SetAttribute("gravityY", gravityY);
  element.SetAttribute("scaleX", scaleX);
  element.SetAttribute("scaleY", scaleY);
}