本文整理汇总了C++中gd::SerializerElement类的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement类的具体用法?C++ SerializerElement怎么用?C++ SerializerElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SerializerElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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::UnserializeInstructionsFrom(
project, conditions, element.GetChild("conditions", 0, "Conditions"));
gd::EventsListSerialization::UnserializeInstructionsFrom(
project, actions, element.GetChild("actions", 0, "Actions"));
gd::EventsListSerialization::UnserializeEventsFrom(
project, events, element.GetChild("events", 0, "Events"));
}
示例2: DoUnserializeFrom
void ParticleEmitterObject::DoUnserializeFrom(
gd::Project& project, const gd::SerializerElement& element) {
ParticleEmitterBase::UnserializeParticleEmitterBaseFrom(element);
#if defined(GD_IDE_ONLY)
particleEditionSimpleMode =
element.GetBoolAttribute("particleEditionSimpleMode");
emissionEditionSimpleMode =
element.GetBoolAttribute("emissionEditionSimpleMode");
gravityEditionSimpleMode =
element.GetBoolAttribute("gravityEditionSimpleMode");
#endif
}
示例3: 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));
}
示例4: UnserializeFrom
void PlatformerObjectBehavior::UnserializeFrom(const gd::SerializerElement & element)
{
gravity = element.GetDoubleAttribute("gravity");
maxFallingSpeed = element.GetDoubleAttribute("maxFallingSpeed");
acceleration = element.GetDoubleAttribute("acceleration");
deceleration = element.GetDoubleAttribute("deceleration");
maxSpeed = element.GetDoubleAttribute("maxSpeed");
jumpSpeed = element.GetDoubleAttribute("jumpSpeed");
ignoreDefaultControls = element.GetBoolAttribute("ignoreDefaultControls");
SetSlopeMaxAngle(element.GetDoubleAttribute("slopeMaxAngle"));
canGrabPlatforms = element.GetBoolAttribute("canGrabPlatforms", false);
yGrabOffset = element.GetDoubleAttribute("yGrabOffset");
xGrabTolerance = element.GetDoubleAttribute("xGrabTolerance", 10);
}
示例5: SerializeTo
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);
}
示例6: SerializeTo
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);
}
示例7: SerializeTo
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);
}
示例8: SetTimeBetweenFrames
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);
}
};
示例9:
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();
}
示例10: SerializeTo
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);
}
示例11: 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"), '/', ';');
}
}
示例12: RuntimeBehavior
TopDownMovementRuntimeBehavior::TopDownMovementRuntimeBehavior(
const gd::SerializerElement& behaviorContent)
: RuntimeBehavior(behaviorContent),
allowDiagonals(true),
acceleration(400),
deceleration(800),
maxSpeed(200),
angularMaxSpeed(180),
rotateObject(true),
angleOffset(0),
xVelocity(0),
yVelocity(0),
angularSpeed(0),
angle(0),
ignoreDefaultControls(false),
leftKey(false),
rightKey(false),
upKey(false),
downKey(false) {
allowDiagonals = behaviorContent.GetBoolAttribute("allowDiagonals");
acceleration = behaviorContent.GetDoubleAttribute("acceleration");
deceleration = behaviorContent.GetDoubleAttribute("deceleration");
maxSpeed = behaviorContent.GetDoubleAttribute("maxSpeed");
angularMaxSpeed = behaviorContent.GetDoubleAttribute("angularMaxSpeed");
rotateObject = behaviorContent.GetBoolAttribute("rotateObject");
angleOffset = behaviorContent.GetDoubleAttribute("angleOffset");
ignoreDefaultControls =
behaviorContent.GetBoolAttribute("ignoreDefaultControls");
}
示例13: 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");
}
示例14: 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");
}
示例15: SerializeTo
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());
}