本文整理汇总了C++中TMXMapInfo::getParentGID方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXMapInfo::getParentGID方法的具体用法?C++ TMXMapInfo::getParentGID怎么用?C++ TMXMapInfo::getParentGID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXMapInfo
的用法示例。
在下文中一共展示了TMXMapInfo::getParentGID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
//.........这里部分代码省略.........
tileset->_firstGid = _currentFirstGID;
_currentFirstGID = 0;
}
tileset->_spacing = attributeDict["spacing"].asInt();
tileset->_margin = attributeDict["margin"].asInt();
Size s;
s.width = attributeDict["tilewidth"].asFloat();
s.height = attributeDict["tileheight"].asFloat();
tileset->_tileSize = s;
tmxMapInfo->getTilesets().pushBack(tileset);
tileset->release();
}
}
else if (elementName == "tile")
{
if (tmxMapInfo->getParentElement() == TMXPropertyLayer)
{
TMXLayerInfo* layer = tmxMapInfo->getLayers().back();
Size layerSize = layer->_layerSize;
uint32_t gid = static_cast<uint32_t>(attributeDict["gid"].asInt());
int tilesAmount = layerSize.width*layerSize.height;
if (_xmlTileIndex < tilesAmount)
{
layer->_tiles[_xmlTileIndex++] = gid;
}
}
else
{
TMXTilesetInfo* info = tmxMapInfo->getTilesets().back();
tmxMapInfo->setParentGID(info->_firstGid + attributeDict["id"].asInt());
tmxMapInfo->getTileProperties()[tmxMapInfo->getParentGID()] = Value(ValueMap());
tmxMapInfo->setParentElement(TMXPropertyTile);
}
}
else if (elementName == "layer")
{
TMXLayerInfo *layer = new (std::nothrow) TMXLayerInfo();
layer->_name = attributeDict["name"].asString();
Size s;
s.width = attributeDict["width"].asFloat();
s.height = attributeDict["height"].asFloat();
layer->_layerSize = s;
Value& visibleValue = attributeDict["visible"];
layer->_visible = visibleValue.isNull() ? true : visibleValue.asBool();
Value& opacityValue = attributeDict["opacity"];
layer->_opacity = opacityValue.isNull() ? 255 : (unsigned char)(255.0f * opacityValue.asFloat());
float x = attributeDict["x"].asFloat();
float y = attributeDict["y"].asFloat();
layer->_offset.set(x, y);
tmxMapInfo->getLayers().pushBack(layer);
layer->release();
// The parent element is now "layer"
tmxMapInfo->setParentElement(TMXPropertyLayer);
}
else if (elementName == "objectgroup")
{
TMXObjectGroup *objectGroup = new (std::nothrow) TMXObjectGroup();