本文整理汇总了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;
}
}
}
}
示例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;
}
示例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;
}
示例4: create
CCArray* CCArray::create()
{
CCArray* pArray = new CCArray();
if (pArray && pArray->init())
{
pArray->autorelease();
}
else
{
CC_SAFE_DELETE(pArray);
}
return pArray;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
});
}