Example #1
0
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);
    }
}
Example #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]);
}
Example #3
0
void ParticleEmitterObject::DoSerializeTo(
    gd::SerializerElement& element) const {
  element.SetAttribute("particleEditionSimpleMode", particleEditionSimpleMode);
  element.SetAttribute("emissionEditionSimpleMode", emissionEditionSimpleMode);
  element.SetAttribute("gravityEditionSimpleMode", gravityEditionSimpleMode);

  ParticleEmitterBase::SerializeParticleEmitterBaseTo(element);
}
Example #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");
}
Example #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);
}
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);
}
Example #7
0
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);
}
Example #8
0
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);
}
Example #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);
}
Example #10
0
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);
    }
}
Example #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);

}
Example #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);
}
Example #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());
}
Example #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);
}
Example #15
0
void SavePoint(const Point & point, gd::SerializerElement & element)
{
    element.SetAttribute("name", point.GetName());
    element.SetAttribute("x", point.GetX());
    element.SetAttribute("y", point.GetY());
}
Example #16
0
void Direction::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("looping", IsLooping());
    element.SetAttribute("timeBetweenFrames", GetTimeBetweenFrames());
    SaveSpritesDirection(sprites, element.AddChild("sprites"));
}
Example #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);
}
Example #18
0
void DestroyOutsideBehavior::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("extraBorder", extraBorder);
}
void PathfindingObstacleAutomatism::SerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("impassable", impassable);
    element.SetAttribute("cost", cost);
}
Example #20
0
void TiledSpriteObject::DoSerializeTo(gd::SerializerElement & element) const
{
    element.SetAttribute("texture", textureName);
    element.SetAttribute("width", width);
    element.SetAttribute("height", height);
}
Example #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);
}