本文整理汇总了C++中CC_SAFE_RETAIN函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_SAFE_RETAIN函数的具体用法?C++ CC_SAFE_RETAIN怎么用?C++ CC_SAFE_RETAIN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CC_SAFE_RETAIN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CC_SAFE_RETAIN
// XXX deprecated
bool MenuItem::initWithTarget(cocos2d::Object *target, SEL_MenuHandler selector )
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithCallback( std::bind(selector,target, std::placeholders::_1) );
}
示例2: CC_SAFE_RETAIN
void AtlasNode::setTextureAtlas(TextureAtlas* textureAtlas)
{
CC_SAFE_RETAIN(textureAtlas);
CC_SAFE_RELEASE(_textureAtlas);
_textureAtlas = textureAtlas;
}
示例3: m_texture
VolatileTexture_richlabel::VolatileTexture_richlabel(CCTexture2D_richlabel* t) :
m_texture(t),
m_cachedImageType(kInvalid) {
s_textures.push_back(this);
CC_SAFE_RETAIN(m_texture);
}
示例4: CC_SAFE_RETAIN
void MapManager::loadFarMap(int resId,int mapResRow,int mapResColumn)
{
if(_currentFarResId==resId)
return;
// if (floor(resId/1000)!=3) return;
_currentFarResId=resId;
if(_farMapNode)
{
_farMapNode->removeFromParent();
}
else
{
_farMapNode=Node::create();
CC_SAFE_RETAIN(_farMapNode);
}
if (_farMapImgsMap)
{
_farMapImgsMap->clear();
}
else
{
_farMapImgsMap=new std::map<std::string,bool>;
}
std::stringstream myStringStream;
myStringStream<<"map/"<<resId;
std::string mapDir=myStringStream.str();
char mapImgPath[256]={0};
float offsetX=0.0f;
// float offsetY=0.0f;
Sprite* spriteNode=nullptr;
bool isPictureExist=false;
Size contentSize;
for (int row =1;row<=mapResRow;row++)
{
for (int column=1;column<=mapResColumn;column++)
{
sprintf(mapImgPath, "%s/m%d%03d.jpg",mapDir.c_str(),row,column);
isPictureExist=FileUtils::getInstance()->isFileExist(mapImgPath);
if (!isPictureExist)
{
sprintf(mapImgPath, "%s/m%d%03d.png",mapDir.c_str(),row,column);
isPictureExist=FileUtils::getInstance()->isFileExist(mapImgPath);
}
if(isPictureExist)
{
spriteNode=Sprite::create(mapImgPath);
spriteNode->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
_farMapNode->addChild(spriteNode);
spriteNode->setPosition(offsetX,_mapHeight);
contentSize=spriteNode->getContentSize();
offsetX=offsetX+contentSize.width;
(*_farMapImgsMap)[mapImgPath]=true;
}
else
{
offsetX=offsetX+512;
CCLOG("far map file no exist:%s",mapImgPath);
}
}
}
}
示例5: running
GameLayer::GameLayer() :
running(true) {
timer = TimerSprite::create();
CC_SAFE_RETAIN(timer);
}
示例6: CCAssert
bool CCTMXTiledMap::initWithTMXFile(const char *tmxFile)
{
CCAssert(tmxFile != NULL && strlen(tmxFile)>0, "TMXTiledMap: tmx file should not bi nil");
setContentSize(CCSizeZero);
CCTMXMapInfo *mapInfo = CCTMXMapInfo::formatWithTMXFile(tmxFile);
if (! mapInfo)
{
return false;
}
CCAssert( mapInfo->getTilesets()->count() != 0, "TMXTiledMap: Map not found. Please check the filename.");
m_tMapSize = mapInfo->getMapSize();
m_tTileSize = mapInfo->getTileSize();
m_nMapOrientation = mapInfo->getOrientation();
setObjectGroups(mapInfo->getObjectGroups());
setProperties(mapInfo->getProperties());
CC_SAFE_RELEASE(m_pTileProperties);
m_pTileProperties = mapInfo->getTileProperties();
CC_SAFE_RETAIN(m_pTileProperties);
int idx = 0;
CCMutableArray<CCTMXLayerInfo*>* layers = mapInfo->getLayers();
if (layers && layers->count()>0)
{
if (NULL == m_pTMXLayers)
{
m_pTMXLayers = new CCDictionary<std::string, CCTMXLayer*>();
CCAssert(m_pTMXLayers, "Allocate memory failed!");
}
CCTMXLayerInfo *layerInfo = NULL;
CCMutableArray<CCTMXLayerInfo*>::CCMutableArrayIterator it;
for (it = layers->begin(); it != layers->end(); ++it)
{
layerInfo = *it;
if (layerInfo && layerInfo->m_bVisible)
{
CCTMXLayer *child = parseLayer(layerInfo, mapInfo);
addChild((CCNode*)child, idx, idx);
// record the CCTMXLayer object by it's name
std::string layerName = child->getLayerName();
m_pTMXLayers->setObject(child, layerName);
// update content size with the max size
const CCSize& childSize = child->getContentSize();
CCSize currentSize = this->getContentSize();
currentSize.width = MAX( currentSize.width, childSize.width );
currentSize.height = MAX( currentSize.height, childSize.height );
this->setContentSize(currentSize);
idx++;
}
}
}
return true;
}
示例7: CC_SAFE_RELEASE
void NodeGrid::setGrid(GridBase *grid)
{
CC_SAFE_RELEASE(_nodeGrid);
CC_SAFE_RETAIN(grid);
_nodeGrid = grid;
}
示例8: CC_SAFE_RETAIN
void ArmatureAnimation::setUserObject(Ref *pUserObject)
{
CC_SAFE_RETAIN(pUserObject);
CC_SAFE_RELEASE(_userObject);
_userObject = pUserObject;
}
示例9: CC_SAFE_RELEASE
void CCDirector::setNotificationNode(CCNode *node)
{
CC_SAFE_RELEASE(m_pNotificationNode);
m_pNotificationNode = node;
CC_SAFE_RETAIN(m_pNotificationNode);
}
示例10: CC_SAFE_RETAIN
void CCTMXLayer::setTileSet(CCTMXTilesetInfo* var)
{
CC_SAFE_RETAIN(var);
CC_SAFE_RELEASE(m_pTileSet);
m_pTileSet = var;
}
示例11: CC_SAFE_RETAIN
void CCTextureAtlas::setTexture(CCTexture2D * var)
{
CC_SAFE_RETAIN(var);
CC_SAFE_RELEASE(m_pTexture);
m_pTexture = var;
}
示例12: CC_SAFE_RETAIN
void Hero::setTiledMap(CCTMXTiledMap* map)
{
CC_SAFE_RETAIN(map);
CC_SAFE_RELEASE(m_map);
this->m_map = map;
}
示例13: CC_SAFE_RETAIN
void CCMenuItemToggle::setSubItems(CCArray* var)
{
CC_SAFE_RETAIN(var);
CC_SAFE_RELEASE(m_pSubItems);
m_pSubItems = var;
}
示例14: CC_SAFE_RETAIN
void CCTMXTiledMap::setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* var)
{
CC_SAFE_RETAIN(var);
CC_SAFE_RELEASE(m_pObjectGroups);
m_pObjectGroups = var;
}
示例15: CC_SAFE_RETAIN
void Situation::raiseSituation(Situation* situation) {
this->subSituation = situation;
CC_SAFE_RETAIN(this->subSituation);
}