本文整理汇总了C++中TMXObjectGroup::getProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXObjectGroup::getProperties方法的具体用法?C++ TMXObjectGroup::getProperties怎么用?C++ TMXObjectGroup::getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXObjectGroup
的用法示例。
在下文中一共展示了TMXObjectGroup::getProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
//.........这里部分代码省略.........
// Y
int y = attributeDict["y"].asInt();
Vec2 p(x + objectGroup->getPositionOffset().x, _mapSize.height * _tileSize.height - y - objectGroup->getPositionOffset().y - attributeDict["height"].asInt());
p = CC_POINT_PIXELS_TO_POINTS(p);
dict["x"] = Value(p.x);
dict["y"] = Value(p.y);
int width = attributeDict["width"].asInt();
int height = attributeDict["height"].asInt();
Size s(width, height);
s = CC_SIZE_PIXELS_TO_POINTS(s);
dict["width"] = Value(s.width);
dict["height"] = Value(s.height);
// Add the object to the objectGroup
objectGroup->getObjects().push_back(Value(dict));
// The parent element is now "object"
tmxMapInfo->setParentElement(TMXPropertyObject);
}
else if (elementName == "property")
{
if ( tmxMapInfo->getParentElement() == TMXPropertyNone )
{
CCLOG( "TMX tile map: Parent element is unsupported. Cannot add property named '%s' with value '%s'",
attributeDict["name"].asString().c_str(), attributeDict["value"].asString().c_str() );
}
else if ( tmxMapInfo->getParentElement() == TMXPropertyMap )
{
// The parent element is the map
Value value = attributeDict["value"];
std::string key = attributeDict["name"].asString();
tmxMapInfo->getProperties().insert(std::make_pair(key, value));
}
else if ( tmxMapInfo->getParentElement() == TMXPropertyLayer )
{
// The parent element is the last layer
TMXLayerInfo* layer = tmxMapInfo->getLayers().back();
Value value = attributeDict["value"];
std::string key = attributeDict["name"].asString();
// Add the property to the layer
layer->getProperties().insert(std::make_pair(key, value));
}
else if ( tmxMapInfo->getParentElement() == TMXPropertyObjectGroup )
{
// The parent element is the last object group
TMXObjectGroup* objectGroup = tmxMapInfo->getObjectGroups().back();
Value value = attributeDict["value"];
std::string key = attributeDict["name"].asString();
objectGroup->getProperties().insert(std::make_pair(key, value));
}
else if ( tmxMapInfo->getParentElement() == TMXPropertyObject )
{
// The parent element is the last object
TMXObjectGroup* objectGroup = tmxMapInfo->getObjectGroups().back();
ValueMap& dict = objectGroup->getObjects().rbegin()->asValueMap();
std::string propertyName = attributeDict["name"].asString();
dict[propertyName] = attributeDict["value"];
}
else if ( tmxMapInfo->getParentElement() == TMXPropertyTile )
{
ValueMap& dict = tmxMapInfo->getTileProperties().at(tmxMapInfo->getParentGID()).asValueMap();
std::string propertyName = attributeDict["name"].asString();