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]); }
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); } }
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")); }
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")); }
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); }
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); }
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); }
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); } } } }
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, '/', ';')); } }
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()); }
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()); }
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); } }
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")); } } }
void TileMapObject::DoSerializeTo(gd::SerializerElement & element) const { tileSet.Get().SerializeTo(element.AddChild("tileSet")); tileMap.Get().SerializeTo(element.AddChild("tileMap")); }
void Direction::SerializeTo(gd::SerializerElement & element) const { element.SetAttribute("looping", IsLooping()); element.SetAttribute("timeBetweenFrames", GetTimeBetweenFrames()); SaveSpritesDirection(sprites, element.AddChild("sprites")); }
void SavePointsSprites(const vector < Point > & points, gd::SerializerElement & element) { element.ConsiderAsArrayOf("point"); for (unsigned int i = 0;i<points.size();++i) SavePoint(points[i], element.AddChild("point")); }