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


C++ CCArray::autorelease方法代码示例

本文整理汇总了C++中CCArray::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ CCArray::autorelease方法的具体用法?C++ CCArray::autorelease怎么用?C++ CCArray::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCArray的用法示例。


在下文中一共展示了CCArray::autorelease方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: breadthFirstSearch

void TestScene::breadthFirstSearch(cocos2d::CCPoint playerPos, cocos2d::CCPoint npcPos, TileObject **tileArray, cocos2d::CCSize mapSize){
    CCPoint npcCoord = tileCoordForPosition(npcPos, tileMap);
    CCPoint playerCoord = tileCoordForPosition(playerPos, tileMap);
    std::queue<TileObject*>* listCheckedTiles = new std::queue<TileObject*>;
    TileObject* u = &tileArray[(int)npcCoord.x][(int)npcCoord.y];
    u->setPreTile(NULL);
    u->setIsCheck(true);
    CCArray* nextArrayTile = new CCArray;
    nextArrayTile->autorelease();
    listCheckedTiles->push(u);
    while (!listCheckedTiles->empty()) {
        TileObject* v = listCheckedTiles->front();
        listCheckedTiles->pop();
        nextArrayTile = next(v, tileArray, mapSize);
        CCObject* obj;
        CCARRAY_FOREACH(nextArrayTile, obj){
            TileObject* u = dynamic_cast<TileObject*>(obj);
            if (u->getIsCheck() == false) {
                u->setIsCheck(true);
                u->setPreTile(v);
                listCheckedTiles->push(u);
                if (u->getXCoord() == playerCoord.x && u->getYCoord() == playerCoord.y) {
                    return;
                }
            }
        }
        
    }
开发者ID:thevinh,项目名称:Maze,代码行数:28,代码来源:TestScene.cpp

示例2: arrayWithContentsOfFile

CCArray* CCFileUtils::arrayWithContentsOfFile(const char* pFileName)
{
	//convert to full path
	std::string fileFullPath;
	fileFullPath = CCFileUtils::fullPathFromRelativePath(pFileName);
	CCArray* ret = arrayWithContentsOfFileThreadSafe(fileFullPath.c_str());
    ret->autorelease();
    return ret;
}
开发者ID:QiMa,项目名称:Cocos2dWindows,代码行数:9,代码来源:CCFileUtils.cpp

示例3: createWithObject

CCArray* CCArray::createWithObject(CCObject* pObject)
{
    CCArray* pArray = new CCArray();

    if (pArray && pArray->initWithObject(pObject))
    {
        pArray->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pArray);
    }

    return pArray;
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:15,代码来源:CCArray.cpp

示例4: create

CCArray* CCArray::create()
{
    CCArray* pArray = new CCArray();

    if (pArray && pArray->init())
    {
        pArray->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pArray);
    }
    
    return pArray;
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:15,代码来源:CCArray.cpp

示例5: arrayWithArray

CCArray* CCArray::arrayWithArray(CCArray* otherArray)
{
    CCArray* pArray = new CCArray();

    if (pArray && pArray->initWithArray(otherArray))
    {
        pArray->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pArray);
    }

    return pArray;
}
开发者ID:fordream,项目名称:MyFanCard01,代码行数:15,代码来源:CCArray.cpp

示例6: arrayWithCapacity

CCArray* CCArray::arrayWithCapacity(unsigned int capacity)
{
    CCArray* pArray = new CCArray();

    if (pArray && pArray->initWithCapacity(capacity))
    {
        pArray->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pArray);
    }

    return pArray;
}
开发者ID:fordream,项目名称:MyFanCard01,代码行数:15,代码来源:CCArray.cpp

示例7: createCCArrayWithData

CCArray* createCCArrayWithData(unsigned char* data)
{
    CCAssert((data),"data must not be NULL!!!");
    
    CCDictMaker tMaker;
	CCArray* array = tMaker.arrayWithData(data);
    
    if (array != NULL)
    {
        array->autorelease();
    }
    CC_SAFE_DELETE_ARRAY(data);
    
    return array;
}
开发者ID:QiuleiWang,项目名称:cocos2d-x-2.x-utils,代码行数:15,代码来源:EncryptUtils.cpp

示例8: next

CCArray* TestScene::next(TileObject *u, TileObject **tileArray, cocos2d::CCSize mapSize){
    CCArray* nextArray = new CCArray;
    nextArray->autorelease();
    int x = u->getXCoord();
    int y = u->getYCoord();
    // left
    int x1, y1;
    x1 = x - 1;
    y1 = y;
    if ( (x1 >= 0 && x1 < mapSize.width) &&
        (y1 >= 0 && y1 < mapSize.height) &&
        (tileArray[x1][y1].getWall() % 2) == 0) {
        TileObject* tile = &tileArray[x1][y1];
        nextArray->addObject(tile);
    }
    
    //up
    x1 = x;
    y1 = y -1;
    if ( (x1 >= 0 && x1 < mapSize.width) &&
        (y1 >= 0 && y1 < mapSize.height) &&
        tileArray[x1][y1].getWall() < 2 ) {
        TileObject* tile = &tileArray[x1][y1];
        nextArray->addObject(tile);
    }
    
    //right
    x1 = x + 1;
    y1 = y;
    if ( (x1 >= 0 && x1 < mapSize.width) &&
        (y1 >= 0 && y1 < mapSize.height) &&
        (u->getWall() % 2) == 0 ) {
        TileObject* tile = &tileArray[x1][y1];
        nextArray->addObject(tile);
    }
    
    //down
    x1 = x;
    y1 = y + 1;
    if ( (x1 >= 0 && x1 < mapSize.width) &&
        (y1 >= 0 && y1 < mapSize.height) &&
        (u->getWall() < 2) ) {
        TileObject* tile = &tileArray[x1][y1];
        nextArray->addObject(tile);
    }
    return nextArray;
}
开发者ID:thevinh,项目名称:Maze,代码行数:47,代码来源:TestScene.cpp

示例9: getCells

CCArray* CGridView::getCells()
{
	CCArray* pArray = new CCArray();
	pArray->initWithCapacity(10);

	if( !m_lCellsUsed.empty() )
	{
		list<CGridViewCell*>::iterator iter = m_lCellsUsed.begin();
		for(; iter != m_lCellsUsed.end(); ++iter)
		{
			pArray->addObject(*iter);
		}
	}

	pArray->autorelease();
	return pArray;
}
开发者ID:54993306,项目名称:Classes,代码行数:17,代码来源:GridView.cpp

示例10: getNodes

CCArray* CListView::getNodes()
{
	CCArray* pArray = new CCArray();
	pArray->initWithCapacity(10);

	if( !m_vNodeList.empty() )
	{
		vector<CCNode*>::iterator iter = m_vNodeList.begin();
		vector<CCNode*>::iterator iend = m_vNodeList.end();

		for(; iter != iend; ++iter )
		{
			pArray->addObject(*iter);
		}
	}

	pArray->autorelease();
	return pArray;
}
开发者ID:9tong,项目名称:CocosWidget,代码行数:19,代码来源:ListView.cpp

示例11: loadProducts

void INSPayment_iOS::loadProducts(inewsoft::ol::LoadProductCallback callback)
{
    if(!this->productTable.empty() && productsState == inewsoft::ol::kProductsStateLoaded)
    {
        callback(true);
        return;
    }
    else if(this->productsState == inewsoft::ol::kProductsStateLoading)
    {
        this->loadProductCallback = callback;
        return;
    }
    
    /// loald product from developer server firstly
    this->productsState = inewsoft::ol::kProductsStateLoading;
    Payment::loadProducts([this, callback](bool succeed){
        if(succeed) {
            INSStore::sharedStore()->registerTransactionObserver(this);
            CCArray* productsId = new CCArray();
            productsId->autorelease();
            
            for(auto iter = this->productTable.begin(); iter != this->productTable.end(); ++iter)
            {
                productsId->addObject(newCCString(iter->second.id.c_str()));
            }
            
            this->loadProductCallback = callback;
            INSStore::sharedStore()->loadProducts(productsId, this);
        }
        else {
            this->productsState = inewsoft::ol::kProductsStateUnload;
            callback(false);
            
        }
    });
}
开发者ID:xubingyue,项目名称:libxstudio365,代码行数:36,代码来源:INSPayment_iOS.cpp


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