當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。