本文整理汇总了C++中gd::SerializerElement::GetBoolAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement::GetBoolAttribute方法的具体用法?C++ SerializerElement::GetBoolAttribute怎么用?C++ SerializerElement::GetBoolAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::SerializerElement
的用法示例。
在下文中一共展示了SerializerElement::GetBoolAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
示例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"));
}
示例3: 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, '/', ';'));
}
示例4: 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");
}
示例5: 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
}
示例6: 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");
}
示例7: 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);
}
示例8: 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");
}
示例9: UnserializeFrom
void PathfindingBehavior::UnserializeFrom(const gd::SerializerElement & element)
{
allowDiagonals = element.GetBoolAttribute("allowDiagonals");
acceleration = element.GetDoubleAttribute("acceleration");
maxSpeed = element.GetDoubleAttribute("maxSpeed");
angularMaxSpeed = element.GetDoubleAttribute("angularMaxSpeed");
rotateObject = element.GetBoolAttribute("rotateObject");
angleOffset = element.GetDoubleAttribute("angleOffset");
extraBorder = element.GetDoubleAttribute("extraBorder");
{
int value = element.GetIntAttribute("cellWidth", 0);
if (value > 0) cellWidth = value;
}
{
int value = element.GetIntAttribute("cellHeight", 0);
if (value > 0) cellHeight = value;
}
}
示例10: UnserializeFrom
void PlatformerObjectAutomatism::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"));
}
示例11: UnserializeFrom
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);
}
};
示例12: UnserializeFrom
void TileHitbox::UnserializeFrom(const gd::SerializerElement &element, sf::Vector2f defaultTileSize)
{
collidable = element.GetBoolAttribute("collidable", true);
hitbox.vertices.clear();
gd::String defaultPolygonStr = "0;0|"
+ gd::String::From(defaultTileSize.x) + ";0|"
+ gd::String::From(defaultTileSize.x) + ";" + gd::String::From(defaultTileSize.y) + "|"
+ "0;" + gd::String::From(defaultTileSize.y);
gd::String polygonStr = element.GetStringAttribute("polygon", defaultPolygonStr);
std::vector<gd::String> vertices = polygonStr.Split(U'|');
for(std::vector<gd::String>::iterator vertexIt = vertices.begin(); vertexIt != vertices.end(); vertexIt++)
{
hitbox.vertices.push_back(sf::Vector2f(vertexIt->Split(U';')[0].To<float>(),
vertexIt->Split(U';')[1].To<float>()
));
}
}
示例13: DoUnserializeFrom
void LightObject::DoUnserializeFrom(gd::Project & project, const gd::SerializerElement & element)
{
SetIntensity(element.GetIntAttribute("intensity", 255));
SetRadius(element.GetIntAttribute("radius", 180));
SetQuality(element.GetIntAttribute("quality", 16));
{
int r = element.GetIntAttribute("colorR", 255);
int g = element.GetIntAttribute("colorG", 255);
int b = element.GetIntAttribute("colorB", 255);
SetColor(sf::Color(r,g,b));
}
globalLight = element.GetBoolAttribute("globalLight", false);
{
int r = element.GetIntAttribute("globalColorR", 255);
int g = element.GetIntAttribute("globalColorG", 255);
int b = element.GetIntAttribute("globalColorB", 255);
int a = element.GetIntAttribute("globalColorA", 255);
globalLightColor = sf::Color(r,g,b,a);
}
}
示例14: RuntimeBehavior
AnchorRuntimeBehavior::AnchorRuntimeBehavior(
const gd::SerializerElement& behaviorContent)
: RuntimeBehavior(behaviorContent),
m_relativeToOriginalWindowSize(true),
m_leftEdgeAnchor(ANCHOR_HORIZONTAL_NONE),
m_rightEdgeAnchor(ANCHOR_HORIZONTAL_NONE),
m_topEdgeAnchor(ANCHOR_VERTICAL_NONE),
m_bottomEdgeAnchor(ANCHOR_VERTICAL_NONE),
m_invalidDistances(true),
m_leftEdgeDistance(0.f),
m_rightEdgeDistance(0.f),
m_topEdgeDistance(0.f),
m_bottomEdgeDistance(0.f) {
m_relativeToOriginalWindowSize =
behaviorContent.GetBoolAttribute("relativeToOriginalWindowSize");
m_leftEdgeAnchor = static_cast<HorizontalAnchor>(
behaviorContent.GetIntAttribute("leftEdgeAnchor"));
m_rightEdgeAnchor = static_cast<HorizontalAnchor>(
behaviorContent.GetIntAttribute("rightEdgeAnchor"));
m_topEdgeAnchor = static_cast<VerticalAnchor>(
behaviorContent.GetIntAttribute("topEdgeAnchor"));
m_bottomEdgeAnchor = static_cast<VerticalAnchor>(
behaviorContent.GetIntAttribute("bottomEdgeAnchor"));
}
示例15: UnserializeFrom
void PathfindingObstacleAutomatism::UnserializeFrom(const gd::SerializerElement & element)
{
impassable = element.GetBoolAttribute("impassable");
cost = element.GetDoubleAttribute("cost");
}