本文整理汇总了C++中TMXLayer::removeFromParentAndCleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXLayer::removeFromParentAndCleanup方法的具体用法?C++ TMXLayer::removeFromParentAndCleanup怎么用?C++ TMXLayer::removeFromParentAndCleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXLayer
的用法示例。
在下文中一共展示了TMXLayer::removeFromParentAndCleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initTileMap
bool BaseLayer::initTileMap(int ID)//初始化地图
{
bool bRet = false;
do {
m_tileParallaxNode = TileParallaxNode::createWithID(ID);
CCAssert(m_tileParallaxNode != NULL, "TileParallaxNode cannot be NULL");
CC_BREAK_IF(!m_tileParallaxNode);
m_tileParallaxNode->retain();
addChild(m_tileParallaxNode, 0, -6);
TMXTiledMap* pTileMap = m_tileParallaxNode->getTileMap();
TMXLayer *tmxLayer;
tmxLayer = pTileMap->getLayer("ObjectsFar");
CCAssert(tmxLayer != NULL, "ObjectsFar layer not found!");
tmxLayer->retain();
tmxLayer->removeFromParentAndCleanup(false);
m_objectsFar->addChild(tmxLayer, 0, OBJECT_FAR_TAG);
addChild(m_objectsFar);
tmxLayer->release();
tmxLayer = pTileMap->getLayer("ObjectsMiddle");
CCAssert(tmxLayer != NULL, "ObjectsMiddle layer not found!");
tmxLayer->retain();
tmxLayer->removeFromParentAndCleanup(false);
m_objectsMiddle->addChild(tmxLayer);
tmxLayer->setTag(OBJECT_MIDDLE_TAG);
addChild(m_objectsMiddle, CaculateObjectMiddleOrder(),OBJECT_MIDDLE_TAG);
//reorderTMXLayer(tmxLayer);//这样渲染批次有点高
tmxLayer->release();
tmxLayer = pTileMap->getLayer("ObjectsNear");
CCAssert(tmxLayer != NULL, "ObjectsNear layer not found!");
tmxLayer->retain();
tmxLayer->removeFromParentAndCleanup(false);
m_objectsNear->addChild(tmxLayer,0,OBJECT_NEAR_TAG);
addChild(m_objectsNear);
tmxLayer->release();
reorderChild(m_objectsFar, 0);//reorder the layer
reorderChild(m_objectsNear, DataManager::getInstance()->getMaxZorder() + 1);
bRet = true;
} while (0);
return bRet;
}