当前位置: 首页>>代码示例>>C++>>正文


C++ CC_SAFE_RETAIN函数代码示例

本文整理汇总了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) );
}
开发者ID:BoniGauglitz,项目名称:OpenBird,代码行数:7,代码来源:CCMenuItem.cpp

示例2: CC_SAFE_RETAIN

void AtlasNode::setTextureAtlas(TextureAtlas* textureAtlas)
{
    CC_SAFE_RETAIN(textureAtlas);
    CC_SAFE_RELEASE(_textureAtlas);
    _textureAtlas = textureAtlas;
}
开发者ID:Jennal,项目名称:cocos2dx-3.2-qt,代码行数:6,代码来源:CCAtlasNode.cpp

示例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);
}
开发者ID:Cocos2d-x-vn,项目名称:cocos2dx-better,代码行数:6,代码来源:VolatileTexture_richlabel.cpp

示例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);
            }
        }
    }
}
开发者ID:backjy,项目名称:kongkongxiyou,代码行数:66,代码来源:MapManager.cpp

示例5: running

GameLayer::GameLayer() :
		running(true) {
	timer = TimerSprite::create();
	CC_SAFE_RETAIN(timer);
}
开发者ID:beforeeight,项目名称:sort,代码行数:5,代码来源:GameScene.cpp

示例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;
	}
开发者ID:KerwinMa,项目名称:NDRemoteTest,代码行数:61,代码来源:CCTMXTiledMap.cpp

示例7: CC_SAFE_RELEASE

void NodeGrid::setGrid(GridBase *grid)
{
    CC_SAFE_RELEASE(_nodeGrid);
    CC_SAFE_RETAIN(grid);
    _nodeGrid = grid;
}
开发者ID:0xiaohui00,项目名称:Cocos2dx-Wechat,代码行数:6,代码来源:CCNodeGrid.cpp

示例8: CC_SAFE_RETAIN

void ArmatureAnimation::setUserObject(Ref *pUserObject)
{
    CC_SAFE_RETAIN(pUserObject);
    CC_SAFE_RELEASE(_userObject);
    _userObject = pUserObject;
}
开发者ID:bonlai,项目名称:3kaigame,代码行数:6,代码来源:CCArmatureAnimation.cpp

示例9: CC_SAFE_RELEASE

void CCDirector::setNotificationNode(CCNode *node)
{
	CC_SAFE_RELEASE(m_pNotificationNode);
	m_pNotificationNode = node;
	CC_SAFE_RETAIN(m_pNotificationNode);
}
开发者ID:qvbige240,项目名称:cocos2d-1.0.1-x-0.13.0-beta,代码行数:6,代码来源:CCDirector.cpp

示例10: CC_SAFE_RETAIN

void CCTMXLayer::setTileSet(CCTMXTilesetInfo* var)
{
    CC_SAFE_RETAIN(var);
    CC_SAFE_RELEASE(m_pTileSet);
    m_pTileSet = var;
}
开发者ID:1901,项目名称:CCDate,代码行数:6,代码来源:CCTMXLayer.cpp

示例11: CC_SAFE_RETAIN

void CCTextureAtlas::setTexture(CCTexture2D * var)
{
    CC_SAFE_RETAIN(var);
    CC_SAFE_RELEASE(m_pTexture);
    m_pTexture = var;
}
开发者ID:BradB132,项目名称:cocos2d-x,代码行数:6,代码来源:CCTextureAtlas.cpp

示例12: CC_SAFE_RETAIN

void Hero::setTiledMap(CCTMXTiledMap* map)
{
	CC_SAFE_RETAIN(map);
	CC_SAFE_RELEASE(m_map);
	this->m_map = map;
}
开发者ID:Jormungendr,项目名称:HotPunch,代码行数:6,代码来源:Hero.cpp

示例13: CC_SAFE_RETAIN

void CCMenuItemToggle::setSubItems(CCArray* var)
{
    CC_SAFE_RETAIN(var);
    CC_SAFE_RELEASE(m_pSubItems);
    m_pSubItems = var;
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:6,代码来源:CCMenuItem.cpp

示例14: CC_SAFE_RETAIN

	void CCTMXTiledMap::setObjectGroups(CCMutableArray<CCTMXObjectGroup*>* var)
	{
		CC_SAFE_RETAIN(var);
		CC_SAFE_RELEASE(m_pObjectGroups);
		m_pObjectGroups = var;
	}
开发者ID:KerwinMa,项目名称:NDRemoteTest,代码行数:6,代码来源:CCTMXTiledMap.cpp

示例15: CC_SAFE_RETAIN

void Situation::raiseSituation(Situation* situation) {
    this->subSituation = situation;
    CC_SAFE_RETAIN(this->subSituation);
}
开发者ID:vuadoc,项目名称:BigHero,代码行数:4,代码来源:Situation.cpp


注:本文中的CC_SAFE_RETAIN函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。