本文整理汇总了C++中TMXObjectGroup::setGroupName方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXObjectGroup::setGroupName方法的具体用法?C++ TMXObjectGroup::setGroupName怎么用?C++ TMXObjectGroup::setGroupName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXObjectGroup
的用法示例。
在下文中一共展示了TMXObjectGroup::setGroupName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
//.........这里部分代码省略.........
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();
objectGroup->setGroupName(attributeDict["name"].asString());
Vec2 positionOffset;
positionOffset.x = attributeDict["x"].asFloat() * tmxMapInfo->getTileSize().width;
positionOffset.y = attributeDict["y"].asFloat() * tmxMapInfo->getTileSize().height;
objectGroup->setPositionOffset(positionOffset);
tmxMapInfo->getObjectGroups().pushBack(objectGroup);
objectGroup->release();
// The parent element is now "objectgroup"
tmxMapInfo->setParentElement(TMXPropertyObjectGroup);
}
else if (elementName == "image")
{
TMXTilesetInfo* tileset = tmxMapInfo->getTilesets().back();
// build full path
std::string imagename = attributeDict["source"].asString();
tileset->_originSourceImage = imagename;
if (_TMXFileName.find_last_of("/") != string::npos)
{
string dir = _TMXFileName.substr(0, _TMXFileName.find_last_of("/") + 1);
tileset->_sourceImage = dir + imagename;
}
else
{
tileset->_sourceImage = _resources + (_resources.size() ? "/" : "") + imagename;
}
}
else if (elementName == "data")
{
std::string encoding = attributeDict["encoding"].asString();