Merge pull request #1118 from walzer/gles20

fixed #1402, résolve conflicting "create" functions
This commit is contained in:
Walzer 2012-07-23 09:40:51 -07:00
commit 221d06509a
65 changed files with 242 additions and 205 deletions

View File

@ -485,7 +485,7 @@ void CCScheduler::removeUpdateFromHash(struct _listEntry *entry)
HASH_DEL(m_pHashForUpdates, element); HASH_DEL(m_pHashForUpdates, element);
free(element); free(element);
// target#release should be the last one to prevent // target#release should be the last one to prevent
// a possible double-free. eg: If the [target dealloc] might want to remove it itself from there // a possible double-free. eg: If the [target dealloc] might want to remove it itself from there
pTarget->release(); pTarget->release();
} }
@ -608,7 +608,7 @@ unsigned int CCScheduler::scheduleScriptFunc(unsigned int nHandler, float fInter
CCSchedulerScriptHandlerEntry* pEntry = CCSchedulerScriptHandlerEntry::entryWithHandler(nHandler, fInterval, bPaused); CCSchedulerScriptHandlerEntry* pEntry = CCSchedulerScriptHandlerEntry::entryWithHandler(nHandler, fInterval, bPaused);
if (!m_pScriptHandlerEntries) if (!m_pScriptHandlerEntries)
{ {
m_pScriptHandlerEntries = CCArray::create(20); m_pScriptHandlerEntries = CCArray::createWithCapacity(20);
m_pScriptHandlerEntries->retain(); m_pScriptHandlerEntries->retain();
} }
m_pScriptHandlerEntries->addObject(pEntry); m_pScriptHandlerEntries->addObject(pEntry);

View File

@ -138,7 +138,7 @@ CCObject* CCGridAction::copyWithZone(CCZone *pZone)
CCGridBase* CCGrid3DAction::getGrid(void) CCGridBase* CCGrid3DAction::getGrid(void)
{ {
return CCGrid3D::gridWithSize(m_sGridSize); return CCGrid3D::create(m_sGridSize);
} }
ccVertex3F CCGrid3DAction::vertex(const ccGridSize& pos) ccVertex3F CCGrid3DAction::vertex(const ccGridSize& pos)
@ -163,7 +163,7 @@ void CCGrid3DAction::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
CCGridBase* CCTiledGrid3DAction::getGrid(void) CCGridBase* CCTiledGrid3DAction::getGrid(void)
{ {
return CCTiledGrid3D::gridWithSize(m_sGridSize); return CCTiledGrid3D::create(m_sGridSize);
} }
ccQuad3 CCTiledGrid3DAction::tile(const ccGridSize& pos) ccQuad3 CCTiledGrid3DAction::tile(const ccGridSize& pos)

View File

@ -153,13 +153,13 @@ CCActionInterval* CCActionInterval::reverse(void)
// //
CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo) CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{ {
return CCSequence::create(pActionOne, pActionTwo); return CCSequence::createWithTwoActions(pActionOne, pActionTwo);
} }
CCSequence* CCSequence::create(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo) CCSequence* CCSequence::createWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{ {
CCSequence *pSequence = new CCSequence(); CCSequence *pSequence = new CCSequence();
pSequence->initOneTwo(pActionOne, pActionTwo); pSequence->initWithTwoActions(pActionOne, pActionTwo);
pSequence->autorelease(); pSequence->autorelease();
return pSequence; return pSequence;
@ -178,7 +178,7 @@ CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
pNow = va_arg(params, CCFiniteTimeAction*); pNow = va_arg(params, CCFiniteTimeAction*);
if (pNow) if (pNow)
{ {
pPrev = CCSequence::create(pPrev, pNow); pPrev = CCSequence::createWithTwoActions(pPrev, pNow);
} }
else else
{ {
@ -203,7 +203,7 @@ CCFiniteTimeAction* CCSequence::create(CCFiniteTimeAction *pAction1, ...)
pNow = va_arg(params, CCFiniteTimeAction*); pNow = va_arg(params, CCFiniteTimeAction*);
if (pNow) if (pNow)
{ {
pPrev = create(pPrev, pNow); pPrev = createWithTwoActions(pPrev, pNow);
} }
else else
{ {
@ -226,13 +226,13 @@ CCFiniteTimeAction* CCSequence::create(CCArray* arrayOfActions)
for (unsigned int i = 1; i < arrayOfActions->count(); ++i) for (unsigned int i = 1; i < arrayOfActions->count(); ++i)
{ {
prev = create(prev, (CCFiniteTimeAction*)arrayOfActions->objectAtIndex(i)); prev = createWithTwoActions(prev, (CCFiniteTimeAction*)arrayOfActions->objectAtIndex(i));
} }
return prev; return prev;
} }
bool CCSequence::initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo) bool CCSequence::initWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{ {
CCAssert(pActionOne != NULL, ""); CCAssert(pActionOne != NULL, "");
CCAssert(pActionTwo != NULL, ""); CCAssert(pActionTwo != NULL, "");
@ -266,7 +266,7 @@ CCObject* CCSequence::copyWithZone(CCZone *pZone)
CCActionInterval::copyWithZone(pZone); CCActionInterval::copyWithZone(pZone);
pCopy->initOneTwo((CCFiniteTimeAction*)(m_pActions[0]->copy()->autorelease()), pCopy->initWithTwoActions((CCFiniteTimeAction*)(m_pActions[0]->copy()->autorelease()),
(CCFiniteTimeAction*)(m_pActions[1]->copy()->autorelease())); (CCFiniteTimeAction*)(m_pActions[1]->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone); CC_SAFE_DELETE(pNewZone);
@ -347,7 +347,7 @@ void CCSequence::update(float t)
CCActionInterval* CCSequence::reverse(void) CCActionInterval* CCSequence::reverse(void)
{ {
return CCSequence::create(m_pActions[1]->reverse(), m_pActions[0]->reverse()); return CCSequence::createWithTwoActions(m_pActions[1]->reverse(), m_pActions[0]->reverse());
} }
// //
@ -585,7 +585,7 @@ CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
pNow = va_arg(params, CCFiniteTimeAction*); pNow = va_arg(params, CCFiniteTimeAction*);
if (pNow) if (pNow)
{ {
pPrev = CCSpawn::create(pPrev, pNow); pPrev = CCSpawn::createWithTwoActions(pPrev, pNow);
} }
else else
{ {
@ -610,7 +610,7 @@ CCFiniteTimeAction* CCSpawn::create(CCFiniteTimeAction *pAction1, ...)
pNow = va_arg(params, CCFiniteTimeAction*); pNow = va_arg(params, CCFiniteTimeAction*);
if (pNow) if (pNow)
{ {
pPrev = create(pPrev, pNow); pPrev = createWithTwoActions(pPrev, pNow);
} }
else else
{ {
@ -633,7 +633,7 @@ CCFiniteTimeAction* CCSpawn::create(CCArray *arrayOfActions)
for (unsigned int i = 1; i < arrayOfActions->count(); ++i) for (unsigned int i = 1; i < arrayOfActions->count(); ++i)
{ {
prev = create(prev, (CCFiniteTimeAction*)arrayOfActions->objectAtIndex(i)); prev = createWithTwoActions(prev, (CCFiniteTimeAction*)arrayOfActions->objectAtIndex(i));
} }
return prev; return prev;
@ -641,19 +641,19 @@ CCFiniteTimeAction* CCSpawn::create(CCArray *arrayOfActions)
CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2) CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
{ {
return CCSpawn::create(pAction1, pAction2); return CCSpawn::createWithTwoActions(pAction1, pAction2);
} }
CCSpawn* CCSpawn::create(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2) CCSpawn* CCSpawn::createWithTwoActions(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
{ {
CCSpawn *pSpawn = new CCSpawn(); CCSpawn *pSpawn = new CCSpawn();
pSpawn->initOneTwo(pAction1, pAction2); pSpawn->initWithTwoActions(pAction1, pAction2);
pSpawn->autorelease(); pSpawn->autorelease();
return pSpawn; return pSpawn;
} }
bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2) bool CCSpawn:: initWithTwoActions(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
{ {
CCAssert(pAction1 != NULL, ""); CCAssert(pAction1 != NULL, "");
CCAssert(pAction2 != NULL, ""); CCAssert(pAction2 != NULL, "");
@ -705,7 +705,7 @@ CCObject* CCSpawn::copyWithZone(CCZone *pZone)
CCActionInterval::copyWithZone(pZone); CCActionInterval::copyWithZone(pZone);
pCopy->initOneTwo((CCFiniteTimeAction*)(m_pOne->copy()->autorelease()), pCopy->initWithTwoActions((CCFiniteTimeAction*)(m_pOne->copy()->autorelease()),
(CCFiniteTimeAction*)(m_pTwo->copy()->autorelease())); (CCFiniteTimeAction*)(m_pTwo->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone); CC_SAFE_DELETE(pNewZone);
@ -746,7 +746,7 @@ void CCSpawn::update(float time)
CCActionInterval* CCSpawn::reverse(void) CCActionInterval* CCSpawn::reverse(void)
{ {
return CCSpawn::create(m_pOne->reverse(), m_pTwo->reverse()); return CCSpawn::createWithTwoActions(m_pOne->reverse(), m_pTwo->reverse());
} }
// //
@ -2380,7 +2380,7 @@ void CCAnimate::update(float t)
CCActionInterval* CCAnimate::reverse(void) CCActionInterval* CCAnimate::reverse(void)
{ {
CCArray* pOldArray = m_pAnimation->getFrames(); CCArray* pOldArray = m_pAnimation->getFrames();
CCArray* pNewArray = CCArray::create(pOldArray->count()); CCArray* pNewArray = CCArray::createWithCapacity(pOldArray->count());
CCARRAY_VERIFY_TYPE(pOldArray, CCAnimationFrame*); CCARRAY_VERIFY_TYPE(pOldArray, CCAnimationFrame*);

View File

@ -103,7 +103,7 @@ public:
~CCSequence(void); ~CCSequence(void);
/** initializes the action */ /** initializes the action */
bool initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo); bool initWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -130,7 +130,7 @@ public:
/** helper contructor to create an array of sequenceable actions given an array */ /** helper contructor to create an array of sequenceable actions given an array */
static CCFiniteTimeAction* create(CCArray *arrayOfActions); static CCFiniteTimeAction* create(CCArray *arrayOfActions);
/** creates the action */ /** creates the action */
static CCSequence* create(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo); static CCSequence* createWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
protected: protected:
CCFiniteTimeAction *m_pActions[2]; CCFiniteTimeAction *m_pActions[2];
@ -243,7 +243,7 @@ public:
~CCSpawn(void); ~CCSpawn(void);
/** initializes the Spawn action with the 2 actions to spawn */ /** initializes the Spawn action with the 2 actions to spawn */
bool initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2); bool initWithTwoActions(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
virtual CCObject* copyWithZone(CCZone* pZone); virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget); virtual void startWithTarget(CCNode *pTarget);
@ -274,7 +274,7 @@ public:
static CCFiniteTimeAction* create(CCArray *arrayOfActions); static CCFiniteTimeAction* create(CCArray *arrayOfActions);
/** creates the Spawn action */ /** creates the Spawn action */
static CCSpawn* create(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2); static CCSpawn* createWithTwoActions(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
protected: protected:
CCFiniteTimeAction *m_pOne; CCFiniteTimeAction *m_pOne;

View File

@ -467,7 +467,7 @@ const char* CCNode::description()
// lazy allocs // lazy allocs
void CCNode::childrenAlloc(void) void CCNode::childrenAlloc(void)
{ {
m_pChildren = CCArray::create(4); m_pChildren = CCArray::createWithCapacity(4);
m_pChildren->retain(); m_pChildren->retain();
} }

View File

@ -136,10 +136,10 @@ CCArray* CCArray::create(CCObject* pObject, ...)
CCArray* CCArray::arrayWithCapacity(unsigned int capacity) CCArray* CCArray::arrayWithCapacity(unsigned int capacity)
{ {
return CCArray::create(capacity); return CCArray::createWithCapacity(capacity);
} }
CCArray* CCArray::create(unsigned int capacity) CCArray* CCArray::createWithCapacity(unsigned int capacity)
{ {
CCArray* pArray = new CCArray(); CCArray* pArray = new CCArray();
@ -157,10 +157,10 @@ CCArray* CCArray::create(unsigned int capacity)
CCArray* CCArray::arrayWithArray(CCArray* otherArray) CCArray* CCArray::arrayWithArray(CCArray* otherArray)
{ {
return CCArray::create(otherArray); return CCArray::createWithArray(otherArray);
} }
CCArray* CCArray::create(CCArray* otherArray) CCArray* CCArray::createWithArray(CCArray* otherArray)
{ {
CCArray* pRet = (CCArray*)otherArray->copy(); CCArray* pRet = (CCArray*)otherArray->copy();
pRet->autorelease(); pRet->autorelease();
@ -169,10 +169,10 @@ CCArray* CCArray::create(CCArray* otherArray)
CCArray* CCArray::arrayWithContentsOfFile(const char* pFileName) CCArray* CCArray::arrayWithContentsOfFile(const char* pFileName)
{ {
return CCArray::create(pFileName); return CCArray::createWithContentsOfFile(pFileName);
} }
CCArray* CCArray::create(const char* pFileName) CCArray* CCArray::createWithContentsOfFile(const char* pFileName)
{ {
CCArray* pRet = CCArray::createWithContentsOfFileThreadSafe(pFileName); CCArray* pRet = CCArray::createWithContentsOfFileThreadSafe(pFileName);
if (pRet != NULL) if (pRet != NULL)

View File

@ -152,20 +152,20 @@ public:
/** Create an array */ /** Create an array */
static CCArray* create(); static CCArray* create();
/** Create an array with one object */
static CCArray* createWithObject(CCObject* pObject);
/** Create an array with some objects */ /** Create an array with some objects */
static CCArray* create(CCObject* pObject, ...); static CCArray* create(CCObject* pObject, ...);
/** Create an array with one object */
static CCArray* createWithObject(CCObject* pObject);
/** Create an array with capacity */ /** Create an array with capacity */
static CCArray* create(unsigned int capacity); static CCArray* createWithCapacity(unsigned int capacity);
/** Create an array with an existing array */ /** Create an array with an existing array */
static CCArray* create(CCArray* otherArray); static CCArray* createWithArray(CCArray* otherArray);
/** /**
@brief Generate a CCArray pointer by file @brief Generate a CCArray pointer by file
@param pFileName The file name of *.plist file @param pFileName The file name of *.plist file
@return The CCArray pointer generated from the file @return The CCArray pointer generated from the file
*/ */
static CCArray* create(const char* pFileName); static CCArray* createWithContentsOfFile(const char* pFileName);
/* /*
@brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the @brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the

View File

@ -29,7 +29,7 @@ CCArray* CCDictionary::allKeys()
int iKeyCount = this->count(); int iKeyCount = this->count();
if (iKeyCount <= 0) return NULL; if (iKeyCount <= 0) return NULL;
CCArray* pArray = CCArray::create(iKeyCount); CCArray* pArray = CCArray::createWithCapacity(iKeyCount);
CCDictElement *pElement, *tmp; CCDictElement *pElement, *tmp;
if (m_eDictType == kCCDictStr) if (m_eDictType == kCCDictStr)
@ -309,10 +309,10 @@ CCDictionary* CCDictionary::create()
CCDictionary* CCDictionary::dictionaryWithDictionary(CCDictionary* srcDict) CCDictionary* CCDictionary::dictionaryWithDictionary(CCDictionary* srcDict)
{ {
return CCDictionary::create(srcDict); return CCDictionary::createWithDictionary(srcDict);
} }
CCDictionary* CCDictionary::create(CCDictionary* srcDict) CCDictionary* CCDictionary::createWithDictionary(CCDictionary* srcDict)
{ {
CCDictionary* pNewDict = (CCDictionary*)srcDict->copy(); CCDictionary* pNewDict = (CCDictionary*)srcDict->copy();
pNewDict->autorelease(); pNewDict->autorelease();
@ -333,10 +333,10 @@ CCDictionary* CCDictionary::createWithContentsOfFileThreadSafe(const char *pFile
CCDictionary* CCDictionary::dictionaryWithContentsOfFile(const char *pFileName) CCDictionary* CCDictionary::dictionaryWithContentsOfFile(const char *pFileName)
{ {
return CCDictionary::create(pFileName); return CCDictionary::createWithContentsOfFile(pFileName);
} }
CCDictionary* CCDictionary::create(const char *pFileName) CCDictionary* CCDictionary::createWithContentsOfFile(const char *pFileName)
{ {
CCDictionary* pRet = createWithContentsOfFileThreadSafe(pFileName); CCDictionary* pRet = createWithContentsOfFileThreadSafe(pFileName);
pRet->autorelease(); pRet->autorelease();

View File

@ -163,13 +163,13 @@ public:
static CCDictionary* create(); static CCDictionary* create();
static CCDictionary* create(CCDictionary* srcDict); static CCDictionary* createWithDictionary(CCDictionary* srcDict);
/** /**
@brief Generate a CCDictionary pointer by file @brief Generate a CCDictionary pointer by file
@param pFileName The file name of *.plist file @param pFileName The file name of *.plist file
@return The CCDictionary pointer generated from the file @return The CCDictionary pointer generated from the file
*/ */
static CCDictionary* create(const char *pFileName); static CCDictionary* createWithContentsOfFile(const char *pFileName);
/* /*
@brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the @brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the

View File

@ -171,10 +171,10 @@ CCString* CCString::stringWithString(const std::string& pStr)
CCString* CCString::stringWithData(const unsigned char* pData, unsigned long nLen) CCString* CCString::stringWithData(const unsigned char* pData, unsigned long nLen)
{ {
return CCString::create(pData, nLen); return CCString::createWithData(pData, nLen);
} }
CCString* CCString::create(const unsigned char* pData, unsigned long nLen) CCString* CCString::createWithData(const unsigned char* pData, unsigned long nLen)
{ {
CCString* pRet = NULL; CCString* pRet = NULL;
if (pData != NULL) if (pData != NULL)
@ -228,7 +228,7 @@ CCString* CCString::createWithContentsOfFile(const char* pszFileName)
unsigned char* pData = 0; unsigned char* pData = 0;
CCString* pRet = NULL; CCString* pRet = NULL;
pData = CCFileUtils::sharedFileUtils()->getFileData(pszFileName, "rb", &size); pData = CCFileUtils::sharedFileUtils()->getFileData(pszFileName, "rb", &size);
pRet = CCString::create(pData, size); pRet = CCString::createWithData(pData, size);
CC_SAFE_DELETE_ARRAY(pData); CC_SAFE_DELETE_ARRAY(pData);
return pRet; return pRet;
} }

View File

@ -132,7 +132,7 @@ public:
* @return A CCString pointer which is an autorelease object pointer, * @return A CCString pointer which is an autorelease object pointer,
* it means that you needn't do a release operation unless you retain it. * it means that you needn't do a release operation unless you retain it.
*/ */
static CCString* create(const unsigned char* pData, unsigned long nLen); static CCString* createWithData(const unsigned char* pData, unsigned long nLen);
/** create a string with a file, /** create a string with a file,
* @return A CCString pointer which is an autorelease object pointer, * @return A CCString pointer which is an autorelease object pointer,

View File

@ -264,8 +264,12 @@ void CCGridBase::calculateVertexPoints(void)
} }
// implementation of CCGrid3D // implementation of CCGrid3D
CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped) CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
return CCGrid3D::create(gridSize, pTexture, bFlipped);
}
CCGrid3D* CCGrid3D::create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{ {
CCGrid3D *pRet= new CCGrid3D(); CCGrid3D *pRet= new CCGrid3D();
@ -286,6 +290,11 @@ CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTextu
} }
CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize) CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize)
{
return CCGrid3D::create(gridSize);
}
CCGrid3D* CCGrid3D::create(const ccGridSize& gridSize)
{ {
CCGrid3D *pRet= new CCGrid3D(); CCGrid3D *pRet= new CCGrid3D();
@ -479,6 +488,11 @@ CCTiledGrid3D::~CCTiledGrid3D(void)
} }
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped) CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
return CCTiledGrid3D::create(gridSize, pTexture, bFlipped);
}
CCTiledGrid3D* CCTiledGrid3D::create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{ {
CCTiledGrid3D *pRet= new CCTiledGrid3D(); CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -499,6 +513,11 @@ CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture
} }
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize) CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize)
{
return CCTiledGrid3D::create(gridSize);
}
CCTiledGrid3D* CCTiledGrid3D::create(const ccGridSize& gridSize)
{ {
CCTiledGrid3D *pRet= new CCTiledGrid3D(); CCTiledGrid3D *pRet= new CCTiledGrid3D();

View File

@ -130,9 +130,18 @@ public:
virtual void calculateVertexPoints(void); virtual void calculateVertexPoints(void);
public: public:
static CCGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped); /** @deprecated: This interface will be deprecated sooner or later.
static CCGrid3D* gridWithSize(const ccGridSize& gridSize); */
CC_DEPRECATED_ATTRIBUTE static CCGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
/** @deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCGrid3D* gridWithSize(const ccGridSize& gridSize);
/** create one Grid */
static CCGrid3D* create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
/** create one Grid */
static CCGrid3D* create(const ccGridSize& gridSize);
protected: protected:
GLvoid *m_pTexCoordinates; GLvoid *m_pTexCoordinates;
GLvoid *m_pVertices; GLvoid *m_pVertices;
@ -162,9 +171,13 @@ public:
virtual void calculateVertexPoints(void); virtual void calculateVertexPoints(void);
public: public:
static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped); CC_DEPRECATED_ATTRIBUTE static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize); CC_DEPRECATED_ATTRIBUTE static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize);
/** create one Grid */
static CCTiledGrid3D* create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
/** create one Grid */
static CCTiledGrid3D* create(const ccGridSize& gridSize);
protected: protected:
GLvoid *m_pTexCoordinates; GLvoid *m_pTexCoordinates;
GLvoid *m_pVertices; GLvoid *m_pVertices;

View File

@ -41,15 +41,15 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
//CCLabelAtlas - Creation & Init //CCLabelAtlas - Creation & Init
CCLabelAtlas* CCLabelAtlas::labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap) CCLabelAtlas* CCLabelAtlas::labelWithString(const char *string, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
{ {
return CCLabelAtlas::create(label, charMapFile, itemWidth, itemHeight, startCharMap); return CCLabelAtlas::create(string, charMapFile, itemWidth, itemHeight, startCharMap);
} }
CCLabelAtlas* CCLabelAtlas::create(const char *label, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap) CCLabelAtlas* CCLabelAtlas::create(const char *string, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
{ {
CCLabelAtlas *pRet = new CCLabelAtlas(); CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet && pRet->initWithString(label, charMapFile, itemWidth, itemHeight, startCharMap)) if(pRet && pRet->initWithString(string, charMapFile, itemWidth, itemHeight, startCharMap))
{ {
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
@ -58,13 +58,13 @@ CCLabelAtlas* CCLabelAtlas::create(const char *label, const char *charMapFile, u
return NULL; return NULL;
} }
bool CCLabelAtlas::initWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap) bool CCLabelAtlas::initWithString(const char *string, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap)
{ {
CCAssert(label != NULL, ""); CCAssert(string != NULL, "");
if (CCAtlasNode::initWithTileFile(charMapFile, itemWidth, itemHeight, strlen(label))) if (CCAtlasNode::initWithTileFile(charMapFile, itemWidth, itemHeight, strlen(string)))
{ {
m_uMapStartChar = startCharMap; m_uMapStartChar = startCharMap;
this->setString(label); this->setString(string);
return true; return true;
} }
return false; return false;
@ -95,7 +95,7 @@ CCLabelAtlas* CCLabelAtlas::create(const char *string, const char *fntFile)
bool CCLabelAtlas::initWithString(const char *theString, const char *fntFile) bool CCLabelAtlas::initWithString(const char *theString, const char *fntFile)
{ {
CCDictionary *dict = CCDictionary::create(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fntFile)); CCDictionary *dict = CCDictionary::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fntFile));
CCAssert(((CCString*)dict->objectForKey("version"))->intValue() == 1, "Unsupported version. Upgrade cocos2d version"); CCAssert(((CCString*)dict->objectForKey("version"))->intValue() == 1, "Unsupported version. Upgrade cocos2d version");

View File

@ -61,24 +61,24 @@ public:
/** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLabelAtlas * labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap); CC_DEPRECATED_ATTRIBUTE static CCLabelAtlas * labelWithString(const char *string, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap);
/** creates the CCLabelAtlas with a string and a configuration file /** creates the CCLabelAtlas with a string and a configuration file
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
@since v2.0 @since v2.0
*/ */
CC_DEPRECATED_ATTRIBUTE static CCLabelAtlas* labelWithString(const char *sring, const char *fntFile); CC_DEPRECATED_ATTRIBUTE static CCLabelAtlas* labelWithString(const char *string, const char *fntFile);
/** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */ /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
static CCLabelAtlas * create(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap); static CCLabelAtlas * create(const char *string, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap);
/** creates the CCLabelAtlas with a string and a configuration file /** creates the CCLabelAtlas with a string and a configuration file
@since v2.0 @since v2.0
*/ */
static CCLabelAtlas* create(const char *sring, const char *fntFile); static CCLabelAtlas* create(const char *string, const char *fntFile);
/** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */ /** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
bool initWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap); bool initWithString(const char *string, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap);
/** initializes the CCLabelAtlas with a string and a configuration file /** initializes the CCLabelAtlas with a string and a configuration file
@since v2.0 @since v2.0

View File

@ -797,7 +797,7 @@ void CCLayerMultiplex::addLayer(CCLayer* layer)
bool CCLayerMultiplex::initWithLayers(CCLayer *layer, va_list params) bool CCLayerMultiplex::initWithLayers(CCLayer *layer, va_list params)
{ {
m_pLayers = CCArray::create(5); m_pLayers = CCArray::createWithCapacity(5);
m_pLayers->retain(); m_pLayers->retain();
m_pLayers->addObject(layer); m_pLayers->addObject(layer);

View File

@ -90,10 +90,10 @@ CCMenu * CCMenu::create(CCMenuItem* item, ...)
CCMenu* CCMenu::menuWithArray(CCArray* pArrayOfItems) CCMenu* CCMenu::menuWithArray(CCArray* pArrayOfItems)
{ {
return CCMenu::create(pArrayOfItems); return CCMenu::createWithArray(pArrayOfItems);
} }
CCMenu* CCMenu::create(CCArray* pArrayOfItems) CCMenu* CCMenu::createWithArray(CCArray* pArrayOfItems)
{ {
CCMenu *pRet = new CCMenu(); CCMenu *pRet = new CCMenu();
if (pRet && pRet->initWithArray(pArrayOfItems)) if (pRet && pRet->initWithArray(pArrayOfItems))

View File

@ -98,7 +98,7 @@ public:
static CCMenu* create(CCMenuItem* item, ...); static CCMenu* create(CCMenuItem* item, ...);
/** creates a CCMenu with a CCArray of CCMenuItem objects */ /** creates a CCMenu with a CCArray of CCMenuItem objects */
static CCMenu* create(CCArray* pArrayOfItems); static CCMenu* createWithArray(CCArray* pArrayOfItems);
/** creates a CCMenu with it's item, then use addChild() to add /** creates a CCMenu with it's item, then use addChild() to add
* other items. It is used for script, it can't init with undetermined * other items. It is used for script, it can't init with undetermined

View File

@ -796,17 +796,17 @@ bool CCMenuItemImage::initWithNormalImage(const char *normalImage, const char *s
// //
void CCMenuItemImage::setNormalSpriteFrame(CCSpriteFrame * frame) void CCMenuItemImage::setNormalSpriteFrame(CCSpriteFrame * frame)
{ {
setNormalImage(CCSprite::create(frame)); setNormalImage(CCSprite::createWithSpriteFrame(frame));
} }
void CCMenuItemImage::setSelectedSpriteFrame(CCSpriteFrame * frame) void CCMenuItemImage::setSelectedSpriteFrame(CCSpriteFrame * frame)
{ {
setSelectedImage(CCSprite::create(frame)); setSelectedImage(CCSprite::createWithSpriteFrame(frame));
} }
void CCMenuItemImage::setDisabledSpriteFrame(CCSpriteFrame * frame) void CCMenuItemImage::setDisabledSpriteFrame(CCSpriteFrame * frame)
{ {
setDisabledImage(CCSprite::create(frame)); setDisabledImage(CCSprite::createWithSpriteFrame(frame));
} }
// //
// MenuItemToggle // MenuItemToggle
@ -834,7 +834,7 @@ CCMenuItemToggle * CCMenuItemToggle::itemWithTarget(CCObject* target, SEL_MenuHa
return pRet; return pRet;
} }
CCMenuItemToggle * CCMenuItemToggle::create(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...) CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...)
{ {
va_list args; va_list args;
va_start(args, item); va_start(args, item);

View File

@ -391,7 +391,7 @@ public:
CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* itemWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...); CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* itemWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...);
/** creates a menu item from a list of items with a target/selector */ /** creates a menu item from a list of items with a target/selector */
static CCMenuItemToggle* create(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...); static CCMenuItemToggle* createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...);
/** initializes a menu item from a list of items with a target selector */ /** initializes a menu item from a list of items with a target selector */
bool initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, va_list args); bool initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, va_list args);

View File

@ -228,7 +228,7 @@ bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelForma
m_pTexture->setAliasTexParameters(); m_pTexture->setAliasTexParameters();
m_pSprite = CCSprite::create(m_pTexture); m_pSprite = CCSprite::createWithTexture(m_pTexture);
m_pTexture->release(); m_pTexture->release();
m_pSprite->setScaleY(-1); m_pSprite->setScaleY(-1);

View File

@ -60,10 +60,10 @@ CCParticleBatchNode::~CCParticleBatchNode()
*/ */
CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/) CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/)
{ {
return CCParticleBatchNode::create(tex, capacity); return CCParticleBatchNode::createWithTexture(tex, capacity);
} }
CCParticleBatchNode* CCParticleBatchNode::create(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/) CCParticleBatchNode* CCParticleBatchNode::createWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/)
{ {
CCParticleBatchNode * p = new CCParticleBatchNode(); CCParticleBatchNode * p = new CCParticleBatchNode();
if( p && p->initWithTexture(tex, capacity)) if( p && p->initWithTexture(tex, capacity))

View File

@ -81,7 +81,7 @@ public:
CC_DEPRECATED_ATTRIBUTE static CCParticleBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity); CC_DEPRECATED_ATTRIBUTE static CCParticleBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);
/** initializes the particle system with CCTexture2D, a capacity of particles, which particle system to use */ /** initializes the particle system with CCTexture2D, a capacity of particles, which particle system to use */
static CCParticleBatchNode* create(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity); static CCParticleBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity);
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles */ /** initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles */
static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity); static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);

View File

@ -194,12 +194,12 @@ public: virtual void set##funName(varType var) \
/* /*
* only certain compilers support __attribute__((deprecated)) * only certain compilers support __attribute__((deprecated))
*/ */
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) // #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) // #define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#elif _MSC_VER >= 1400 //vs 2005 or higher // #elif _MSC_VER >= 1400 //vs 2005 or higher
#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) // #define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated)
#else // #else
#define CC_DEPRECATED_ATTRIBUTE #define CC_DEPRECATED_ATTRIBUTE
#endif // #endif
#endif // __CC_PLATFORM_MACROS_H__ #endif // __CC_PLATFORM_MACROS_H__

View File

@ -97,10 +97,10 @@ CCAnimation* CCAnimation::create(void)
CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/) CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/)
{ {
return CCAnimation::create(frames, delay); return CCAnimation::createWithSpriteFrames(frames, delay);
} }
CCAnimation* CCAnimation::create(CCArray *frames, float delay/* = 0.0f*/) CCAnimation* CCAnimation::createWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/)
{ {
CCAnimation *pAnimation = new CCAnimation(); CCAnimation *pAnimation = new CCAnimation();
pAnimation->initWithSpriteFrames(frames, delay); pAnimation->initWithSpriteFrames(frames, delay);
@ -161,7 +161,7 @@ bool CCAnimation::initWithAnimationFrames(CCArray* arrayOfAnimationFrames, float
m_fDelayPerUnit = delayPerUnit; m_fDelayPerUnit = delayPerUnit;
m_uLoops = loops; m_uLoops = loops;
setFrames(CCArray::create(arrayOfAnimationFrames)); setFrames(CCArray::createWithArray(arrayOfAnimationFrames));
CCObject* pObj = NULL; CCObject* pObj = NULL;
CCARRAY_FOREACH(m_pFrames, pObj) CCARRAY_FOREACH(m_pFrames, pObj)
@ -205,13 +205,13 @@ void CCAnimation::addSpriteFrameWithFileName(const char *pszFileName)
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage(pszFileName); CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage(pszFileName);
CCRect rect = CCRectZero; CCRect rect = CCRectZero;
rect.size = pTexture->getContentSize(); rect.size = pTexture->getContentSize();
CCSpriteFrame *pFrame = CCSpriteFrame::create(pTexture, rect); CCSpriteFrame *pFrame = CCSpriteFrame::createWithTexture(pTexture, rect);
addSpriteFrame(pFrame); addSpriteFrame(pFrame);
} }
void CCAnimation::addSpriteFrameWithTexture(CCTexture2D *pobTexture, const CCRect& rect) void CCAnimation::addSpriteFrameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{ {
CCSpriteFrame *pFrame = CCSpriteFrame::create(pobTexture, rect); CCSpriteFrame *pFrame = CCSpriteFrame::createWithTexture(pobTexture, rect);
addSpriteFrame(pFrame); addSpriteFrame(pFrame);
} }

View File

@ -116,7 +116,7 @@ public:
The frames will be added with one "delay unit". The frames will be added with one "delay unit".
@since v0.99.5 @since v0.99.5
*/ */
static CCAnimation* create(CCArray* arrayOfSpriteFrameNames, float delay = 0.0f); static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay = 0.0f);
/* Creates an animation with an array of CCAnimationFrame, the delay per units in seconds and and how many times it should be executed. /* Creates an animation with an array of CCAnimationFrame, the delay per units in seconds and and how many times it should be executed.
@since v2.0 @since v2.0

View File

@ -108,7 +108,7 @@ void CCAnimationCache::parseVersion1(CCDictionary* animations)
continue; continue;
} }
CCArray* frames = CCArray::create(frameNames->count()); CCArray* frames = CCArray::createWithCapacity(frameNames->count());
frames->retain(); frames->retain();
CCObject* pObj = NULL; CCObject* pObj = NULL;
@ -164,7 +164,7 @@ void CCAnimationCache::parseVersion2(CCDictionary* animations)
} }
// Array of AnimationFrames // Array of AnimationFrames
CCArray* array = CCArray::create(frameArray->count()); CCArray* array = CCArray::createWithCapacity(frameArray->count());
array->retain(); array->retain();
CCObject* pObj = NULL; CCObject* pObj = NULL;
@ -245,7 +245,7 @@ void CCAnimationCache::addAnimationsWithFile(const char* plist)
CCAssert( plist, "Invalid texture file name"); CCAssert( plist, "Invalid texture file name");
const char* path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(plist); const char* path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(plist);
CCDictionary* dict = CCDictionary::create(path); CCDictionary* dict = CCDictionary::createWithContentsOfFile(path);
CCAssert( dict, "CCAnimationCache: File could not be found"); CCAssert( dict, "CCAnimationCache: File could not be found");

View File

@ -60,10 +60,10 @@ NS_CC_BEGIN
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture) CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
{ {
return CCSprite::create(pTexture); return CCSprite::createWithTexture(pTexture);
} }
CCSprite* CCSprite::create(CCTexture2D *pTexture) CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture)
{ {
CCSprite *pobSprite = new CCSprite(); CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture)) if (pobSprite && pobSprite->initWithTexture(pTexture))
@ -77,10 +77,10 @@ CCSprite* CCSprite::create(CCTexture2D *pTexture)
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect) CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{ {
return CCSprite::create(pTexture, rect); return CCSprite::createWithTexture(pTexture, rect);
} }
CCSprite* CCSprite::create(CCTexture2D *pTexture, const CCRect& rect) CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{ {
CCSprite *pobSprite = new CCSprite(); CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture, rect)) if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
@ -128,10 +128,10 @@ CCSprite* CCSprite::create(const char *pszFileName, const CCRect& rect)
CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame) CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
{ {
return CCSprite::create(pSpriteFrame); return CCSprite::createWithSpriteFrame(pSpriteFrame);
} }
CCSprite* CCSprite::create(CCSpriteFrame *pSpriteFrame) CCSprite* CCSprite::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
{ {
CCSprite *pobSprite = new CCSprite(); CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame)) if (pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame))
@ -155,7 +155,7 @@ CCSprite* CCSprite::createWithSpriteFrameName(const char *pszSpriteFrameName)
char msg[256] = {0}; char msg[256] = {0};
sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName); sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName);
CCAssert(pFrame != NULL, msg); CCAssert(pFrame != NULL, msg);
return create(pFrame); return createWithSpriteFrame(pFrame);
} }
CCSprite* CCSprite::node() CCSprite* CCSprite::node()
@ -1023,7 +1023,7 @@ bool CCSprite::isFrameDisplayed(CCSpriteFrame *pFrame)
CCSpriteFrame* CCSprite::displayFrame(void) CCSpriteFrame* CCSprite::displayFrame(void)
{ {
return CCSpriteFrame::create(m_pobTexture, return CCSpriteFrame::createWithTexture(m_pobTexture,
CC_RECT_POINTS_TO_PIXELS(m_obRect), CC_RECT_POINTS_TO_PIXELS(m_obRect),
m_bRectRotated, m_bRectRotated,
m_obUnflippedOffsetPositionFromCenter, m_obUnflippedOffsetPositionFromCenter,

View File

@ -142,12 +142,12 @@ public:
The rect used will be the size of the texture. The rect used will be the size of the texture.
The offset will be (0,0). The offset will be (0,0).
*/ */
static CCSprite* create(CCTexture2D *pTexture); static CCSprite* createWithTexture(CCTexture2D *pTexture);
/** Creates an sprite with a texture and a rect. /** Creates an sprite with a texture and a rect.
The offset will be (0,0). The offset will be (0,0).
*/ */
static CCSprite* create(CCTexture2D *pTexture, const CCRect& rect); static CCSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect);
/** Creates an sprite with an sprite frame. /** Creates an sprite with an sprite frame.
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
@ -163,7 +163,7 @@ public:
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName); CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
/** Creates an sprite with an sprite frame. */ /** Creates an sprite with an sprite frame. */
static CCSprite* create(CCSpriteFrame *pSpriteFrame); static CCSprite* createWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
/** Creates an sprite with an sprite frame name. /** Creates an sprite with an sprite frame name.
An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name. An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name.

View File

@ -48,10 +48,10 @@ NS_CC_BEGIN
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/) CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{ {
return CCSpriteBatchNode::create(tex, capacity); return CCSpriteBatchNode::createWithTexture(tex, capacity);
} }
CCSpriteBatchNode* CCSpriteBatchNode::create(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/) CCSpriteBatchNode* CCSpriteBatchNode::createWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{ {
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode(); CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, capacity); batchNode->initWithTexture(tex, capacity);

View File

@ -97,7 +97,7 @@ public:
/** creates a CCSpriteBatchNode with a texture2d and capacity of children. /** creates a CCSpriteBatchNode with a texture2d and capacity of children.
The capacity will be increased in 33% in runtime if it run out of space. The capacity will be increased in 33% in runtime if it run out of space.
*/ */
static CCSpriteBatchNode* create(CCTexture2D* tex, unsigned int capacity = kDefaultSpriteBatchCapacity); static CCSpriteBatchNode* createWithTexture(CCTexture2D* tex, unsigned int capacity = kDefaultSpriteBatchCapacity);
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children. /** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
The capacity will be increased in 33% in runtime if it run out of space. The capacity will be increased in 33% in runtime if it run out of space.

View File

@ -33,10 +33,10 @@ NS_CC_BEGIN
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CCRect& rect) CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{ {
return CCSpriteFrame::create(pobTexture, rect); return CCSpriteFrame::createWithTexture(pobTexture, rect);
} }
CCSpriteFrame* CCSpriteFrame::create(CCTexture2D *pobTexture, const CCRect& rect) CCSpriteFrame* CCSpriteFrame::createWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{ {
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();; CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect); pSpriteFrame->initWithTexture(pobTexture, rect);
@ -61,10 +61,10 @@ CCSpriteFrame* CCSpriteFrame::create(const char* filename, const CCRect& rect)
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize) CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{ {
return CCSpriteFrame::create(pobTexture, rect, rotated, offset, originalSize); return CCSpriteFrame::createWithTexture(pobTexture, rect, rotated, offset, originalSize);
} }
CCSpriteFrame* CCSpriteFrame::create(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize) CCSpriteFrame* CCSpriteFrame::createWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{ {
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();; CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect, rotated, offset, originalSize); pSpriteFrame->initWithTexture(pobTexture, rect, rotated, offset, originalSize);

View File

@ -119,25 +119,25 @@ public:
*/ */
CC_DEPRECATED_ATTRIBUTE static CCSpriteFrame* frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize); CC_DEPRECATED_ATTRIBUTE static CCSpriteFrame* frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* create(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture filename, rect in points. /** Create a CCSpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed. It is assumed that the frame was not trimmed.
*/ */
static CCSpriteFrame* create(const char* filename, const CCRect& rect); static CCSpriteFrame* create(const char* filename, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
static CCSpriteFrame* create(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. /** Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed. The originalSize is the size in pixels of the frame before being trimmed.
*/ */
static CCSpriteFrame* create(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize); static CCSpriteFrame* create(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* createWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
static CCSpriteFrame* createWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
public: public:
/** Initializes a CCSpriteFrame with a texture, rect in points. /** Initializes a CCSpriteFrame with a texture, rect in points.

View File

@ -34,7 +34,7 @@ static CCNotificationCenter *s_sharedNotifCenter = NULL;
CCNotificationCenter::CCNotificationCenter() CCNotificationCenter::CCNotificationCenter()
{ {
m_observers = CCArray::create(3); m_observers = CCArray::createWithCapacity(3);
m_observers->retain(); m_observers->retain();
} }

View File

@ -121,10 +121,10 @@ CCTextureAtlas * CCTextureAtlas::create(const char* file, unsigned int capacity)
CCTextureAtlas * CCTextureAtlas::textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity) CCTextureAtlas * CCTextureAtlas::textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity)
{ {
return CCTextureAtlas::create(texture, capacity); return CCTextureAtlas::createWithTexture(texture, capacity);
} }
CCTextureAtlas * CCTextureAtlas::create(CCTexture2D *texture, unsigned int capacity) CCTextureAtlas * CCTextureAtlas::createWithTexture(CCTexture2D *texture, unsigned int capacity)
{ {
CCTextureAtlas * pTextureAtlas = new CCTextureAtlas(); CCTextureAtlas * pTextureAtlas = new CCTextureAtlas();
if (pTextureAtlas && pTextureAtlas->initWithTexture(texture, capacity)) if (pTextureAtlas && pTextureAtlas->initWithTexture(texture, capacity))

View File

@ -109,7 +109,7 @@ public:
* with an initial capacity for n Quads. * with an initial capacity for n Quads.
* The TextureAtlas capacity can be increased in runtime. * The TextureAtlas capacity can be increased in runtime.
*/ */
static CCTextureAtlas* create(CCTexture2D *texture, unsigned int capacity); static CCTextureAtlas* createWithTexture(CCTexture2D *texture, unsigned int capacity);
/** initializes a TextureAtlas with a previously initialized Texture2D object, and /** initializes a TextureAtlas with a previously initialized Texture2D object, and

View File

@ -432,6 +432,11 @@ bool CCTexturePVR::initWithContentsOfFile(const char* path)
} }
CCTexturePVR * CCTexturePVR::pvrTextureWithContentsOfFile(const char* path) CCTexturePVR * CCTexturePVR::pvrTextureWithContentsOfFile(const char* path)
{
return CCTexturePVR::create(path);
}
CCTexturePVR * CCTexturePVR::create(const char* path)
{ {
CCTexturePVR * pTexture = new CCTexturePVR(); CCTexturePVR * pTexture = new CCTexturePVR();
if (pTexture) if (pTexture)

View File

@ -86,8 +86,11 @@ public:
/** initializes a CCTexturePVR with a path */ /** initializes a CCTexturePVR with a path */
bool initWithContentsOfFile(const char* path); bool initWithContentsOfFile(const char* path);
/** creates and initializes a CCTexturePVR with a path
@deprecated This interface will be deprecated when js-binding is stable. */
CC_DEPRECATED_ATTRIBUTE static CCTexturePVR* pvrTextureWithContentsOfFile(const char* path);
/** creates and initializes a CCTexturePVR with a path */ /** creates and initializes a CCTexturePVR with a path */
static CCTexturePVR* pvrTextureWithContentsOfFile(const char* path); static CCTexturePVR* create(const char* path);
// properties // properties

View File

@ -75,7 +75,7 @@ bool CCTMXLayer::initWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerIn
m_uMinGID = layerInfo->m_uMinGID; m_uMinGID = layerInfo->m_uMinGID;
m_uMaxGID = layerInfo->m_uMaxGID; m_uMaxGID = layerInfo->m_uMaxGID;
m_cOpacity = layerInfo->m_cOpacity; m_cOpacity = layerInfo->m_cOpacity;
setProperties(CCDictionary::create(layerInfo->getProperties())); setProperties(CCDictionary::createWithDictionary(layerInfo->getProperties()));
m_fContentScaleFactor = CCDirector::sharedDirector()->getContentScaleFactor(); m_fContentScaleFactor = CCDirector::sharedDirector()->getContentScaleFactor();
// tilesetInfo // tilesetInfo

View File

@ -51,10 +51,10 @@ CCTMXTiledMap * CCTMXTiledMap::create(const char *tmxFile)
CCTMXTiledMap* CCTMXTiledMap::tiledMapWithXML(const char* tmxString, const char* resourcePath) CCTMXTiledMap* CCTMXTiledMap::tiledMapWithXML(const char* tmxString, const char* resourcePath)
{ {
return CCTMXTiledMap::create(tmxString, resourcePath); return CCTMXTiledMap::createWithXML(tmxString, resourcePath);
} }
CCTMXTiledMap* CCTMXTiledMap::create(const char* tmxString, const char* resourcePath) CCTMXTiledMap* CCTMXTiledMap::createWithXML(const char* tmxString, const char* resourcePath)
{ {
CCTMXTiledMap *pRet = new CCTMXTiledMap(); CCTMXTiledMap *pRet = new CCTMXTiledMap();
if (pRet->initWithXML(tmxString, resourcePath)) if (pRet->initWithXML(tmxString, resourcePath))

View File

@ -136,7 +136,7 @@ public:
static CCTMXTiledMap* create(const char *tmxFile); static CCTMXTiledMap* create(const char *tmxFile);
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */ /** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
static CCTMXTiledMap* create(const char* tmxString, const char* resourcePath); static CCTMXTiledMap* createWithXML(const char* tmxString, const char* resourcePath);
/** initializes a TMX Tiled Map with a TMX file */ /** initializes a TMX Tiled Map with a TMX file */
bool initWithTMXFile(const char *tmxFile); bool initWithTMXFile(const char *tmxFile);

View File

@ -165,7 +165,7 @@ void CCTMXMapInfo::internalInit(const char* tmxFileName, const char* resourcePat
m_sResources = resourcePath; m_sResources = resourcePath;
} }
m_pObjectGroups = CCArray::create(4); m_pObjectGroups = CCArray::createWithCapacity(4);
m_pObjectGroups->retain(); m_pObjectGroups->retain();
m_pProperties = new CCDictionary(); m_pProperties = new CCDictionary();

View File

@ -67,11 +67,11 @@ void CCTouchDispatcher::setDispatchEvents(bool bDispatchEvents)
bool CCTouchDispatcher::init(void) bool CCTouchDispatcher::init(void)
{ {
m_bDispatchEvents = true; m_bDispatchEvents = true;
m_pTargetedHandlers = CCArray::create(8); m_pTargetedHandlers = CCArray::createWithCapacity(8);
m_pTargetedHandlers->retain(); m_pTargetedHandlers->retain();
m_pStandardHandlers = CCArray::create(4); m_pStandardHandlers = CCArray::createWithCapacity(4);
m_pStandardHandlers->retain(); m_pStandardHandlers->retain();
m_pHandlersToAdd = CCArray::create(8); m_pHandlersToAdd = CCArray::createWithCapacity(8);
m_pHandlersToAdd->retain(); m_pHandlersToAdd->retain();
m_pHandlersToRemove = ccCArrayNew(8); m_pHandlersToRemove = ccCArrayNew(8);

View File

@ -167,7 +167,7 @@ void CCBReader::readStringCacheEntry() {
int numBytes = b0 << 8 | b1; int numBytes = b0 << 8 | b1;
const unsigned char * src = (const unsigned char *) (this->mBytes + this->mCurrentByte); const unsigned char * src = (const unsigned char *) (this->mBytes + this->mCurrentByte);
CCString * string = CCString::create(src, (unsigned long)numBytes); CCString * string = CCString::createWithData(src, (unsigned long)numBytes);
string->retain(); string->retain();
this->mCurrentByte += numBytes; this->mCurrentByte += numBytes;

View File

@ -416,7 +416,7 @@ CCSpriteFrame * CCNodeLoader::parsePropTypeSpriteFrame(CCNode * pNode, CCNode *
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFilePath->getCString()); CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFilePath->getCString());
CCRect bounds = CCRectMake(0, 0, texture->getContentSize().width, texture->getContentSize().height); CCRect bounds = CCRectMake(0, 0, texture->getContentSize().width, texture->getContentSize().height);
spriteFrame = CCSpriteFrame::create(texture, bounds); spriteFrame = CCSpriteFrame::createWithTexture(texture, bounds);
} else { } else {
CCSpriteFrameCache * frameCache = CCSpriteFrameCache::sharedSpriteFrameCache(); CCSpriteFrameCache * frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();

View File

@ -293,7 +293,7 @@ CCArray* CCControl::dispatchListforControlEvent(CCControlEvent controlEvent)
// If the invocation list does not exist for the dispatch table, we create it // If the invocation list does not exist for the dispatch table, we create it
if (invocationList == NULL) if (invocationList == NULL)
{ {
invocationList = CCArray::create(1); invocationList = CCArray::createWithCapacity(1);
dispatchTable->setObject(invocationList, controlEvent); dispatchTable->setObject(invocationList, controlEvent);
} }
return invocationList; return invocationList;

View File

@ -120,25 +120,25 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
// //
// Centre // Centre
centre = CCSprite::create(scale9Image->getTexture(), m_capInsetsInternal); centre = CCSprite::createWithTexture(scale9Image->getTexture(), m_capInsetsInternal);
scale9Image->addChild(centre, 0, pCentre); scale9Image->addChild(centre, 0, pCentre);
// Top // Top
top = CCSprite::create(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x, top = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x,
t, t,
m_capInsetsInternal.size.width, m_capInsetsInternal.size.width,
m_capInsetsInternal.origin.y - t)); m_capInsetsInternal.origin.y - t));
scale9Image->addChild(top, 1, pTop); scale9Image->addChild(top, 1, pTop);
// Bottom // Bottom
bottom = CCSprite::create(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x, bottom = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x,
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height, m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
m_capInsetsInternal.size.width, m_capInsetsInternal.size.width,
h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height) )); h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height) ));
scale9Image->addChild(bottom, 1, pBottom); scale9Image->addChild(bottom, 1, pBottom);
// Left // Left
left = CCSprite::create(scale9Image->getTexture(), CCRectMake( left = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
l, l,
m_capInsetsInternal.origin.y, m_capInsetsInternal.origin.y,
m_capInsetsInternal.origin.x - l, m_capInsetsInternal.origin.x - l,
@ -146,7 +146,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
scale9Image->addChild(left, 1, pLeft); scale9Image->addChild(left, 1, pLeft);
// Right // Right
right = CCSprite::create(scale9Image->getTexture(), CCRectMake( right = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width, m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
m_capInsetsInternal.origin.y, m_capInsetsInternal.origin.y,
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width), w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
@ -154,7 +154,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
scale9Image->addChild(right, 1, pRight); scale9Image->addChild(right, 1, pRight);
// Top left // Top left
topLeft = CCSprite::create(scale9Image->getTexture(), CCRectMake( topLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
l, l,
t, t,
m_capInsetsInternal.origin.x - l, m_capInsetsInternal.origin.x - l,
@ -163,7 +163,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
scale9Image->addChild(topLeft, 2, pTopLeft); scale9Image->addChild(topLeft, 2, pTopLeft);
// Top right // Top right
topRight = CCSprite::create(scale9Image->getTexture(), CCRectMake( topRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width, m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
t, t,
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width), w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
@ -172,7 +172,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
scale9Image->addChild(topRight, 2, pTopRight); scale9Image->addChild(topRight, 2, pTopRight);
// Bottom left // Bottom left
bottomLeft = CCSprite::create(scale9Image->getTexture(), CCRectMake( bottomLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
l, l,
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height, m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
m_capInsetsInternal.origin.x - l, m_capInsetsInternal.origin.x - l,
@ -180,7 +180,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re
scale9Image->addChild(bottomLeft, 2, pBottomLeft); scale9Image->addChild(bottomLeft, 2, pBottomLeft);
// Bottom right // Bottom right
bottomRight = CCSprite::create(scale9Image->getTexture(), CCRectMake( bottomRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width, m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width,
m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height, m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height,
w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width), w - (m_capInsetsInternal.origin.x - l + m_capInsetsInternal.size.width),
@ -347,7 +347,7 @@ bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capI
{ {
CCAssert(spriteFrame != NULL, "Sprite frame must be not nil"); CCAssert(spriteFrame != NULL, "Sprite frame must be not nil");
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::create(spriteFrame->getTexture(), 9); CCSpriteBatchNode *batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), capInsets); bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), capInsets);
return pReturn; return pReturn;
} }
@ -602,7 +602,7 @@ bool CCScale9Sprite::isOpacityModifyRGB()
void CCScale9Sprite::setSpriteFrame(CCSpriteFrame * spriteFrame) void CCScale9Sprite::setSpriteFrame(CCSpriteFrame * spriteFrame)
{ {
CCSpriteBatchNode * batchnode = CCSpriteBatchNode::create(spriteFrame->getTexture(), 9); CCSpriteBatchNode * batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
this->updateWithBatchNode(batchnode, spriteFrame->getRect(), CCRectZero); this->updateWithBatchNode(batchnode, spriteFrame->getRect(), CCRectZero);
// Reset insets // Reset insets

View File

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 45; objectVersion = 46;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@ -537,8 +537,11 @@
/* Begin PBXProject section */ /* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = { 29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloLua" */; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloLua" */;
compatibilityVersion = "Xcode 3.1"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
knownRegions = ( knownRegions = (
@ -677,7 +680,6 @@
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_FAST_OBJC_DISPATCH = YES; GCC_FAST_OBJC_DISPATCH = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_OBJC_CALL_CXX_CDTORS = YES;
@ -706,14 +708,13 @@
IPHONEOS_DEPLOYMENT_TARGET = 5.0; IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"\"$(SRCROOT)/../../cocos2dx/platform/third_party/ios/libraries\"", "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios/libraries\"",
); );
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"-ObjC", "-ObjC",
"-all_load", "-all_load",
); );
PREBINDING = NO;
PRODUCT_NAME = HelloLua; PRODUCT_NAME = HelloLua;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -729,7 +730,6 @@
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_FAST_OBJC_DISPATCH = YES; GCC_FAST_OBJC_DISPATCH = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_OBJC_CALL_CXX_CDTORS = YES;
@ -757,14 +757,13 @@
IPHONEOS_DEPLOYMENT_TARGET = 5.0; IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"\"$(SRCROOT)/../../cocos2dx/platform/third_party/ios/libraries\"", "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios/libraries\"",
); );
ONLY_ACTIVE_ARCH = NO; ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"-ObjC", "-ObjC",
"-all_load", "-all_load",
); );
PREBINDING = NO;
PRODUCT_NAME = HelloLua; PRODUCT_NAME = HelloLua;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
@ -793,7 +792,6 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0; IPHONEOS_DEPLOYMENT_TARGET = 4.0;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "armv6 armv7 i386"; VALID_ARCHS = "armv6 armv7 i386";
@ -814,7 +812,6 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0; IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PREBINDING = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "armv6 armv7 i386"; VALID_ARCHS = "armv6 armv7 i386";

View File

@ -635,6 +635,7 @@ void ActionAnimate::onEnter()
centerSprites(3); centerSprites(3);
// //
// Manual animation // Manual animation
// //
@ -651,8 +652,7 @@ void ActionAnimate::onEnter()
CCAnimate* action = CCAnimate::create(animation); CCAnimate* action = CCAnimate::create(animation);
m_grossini->runAction(CCSequence::create(action, action->reverse(), NULL)); m_grossini->runAction(CCSequence::create(action, action->reverse(), NULL));
// //
// File animation // File animation
// //

View File

@ -94,7 +94,7 @@ NotificationCenterTest::NotificationCenterTest()
CCLabelTTF *label2 = CCLabelTTF::create("switch on", "Marker Felt", 26); CCLabelTTF *label2 = CCLabelTTF::create("switch on", "Marker Felt", 26);
CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1); CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1);
CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2); CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2);
CCMenuItemToggle *item = CCMenuItemToggle::create(this, menu_selector(NotificationCenterTest::toggleSwitch), item1, item2, NULL); CCMenuItemToggle *item = CCMenuItemToggle::createWithTarget(this, menu_selector(NotificationCenterTest::toggleSwitch), item1, item2, NULL);
// turn on // turn on
item->setSelectedIndex(1); item->setSelectedIndex(1);
CCMenu *menu = CCMenu::create(item, NULL); CCMenu *menu = CCMenu::create(item, NULL);
@ -116,7 +116,7 @@ NotificationCenterTest::NotificationCenterTest()
CCLabelTTF *label2 = CCLabelTTF::create("connected", "Marker Felt", 26); CCLabelTTF *label2 = CCLabelTTF::create("connected", "Marker Felt", 26);
CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1); CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1);
CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2); CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2);
CCMenuItemToggle *item = CCMenuItemToggle::create(this, menu_selector(NotificationCenterTest::connectToSwitch), item1, item2, NULL); CCMenuItemToggle *item = CCMenuItemToggle::createWithTarget(this, menu_selector(NotificationCenterTest::connectToSwitch), item1, item2, NULL);
item->setTag(kTagConnect+i); item->setTag(kTagConnect+i);
item->setPosition(ccp(light->getPosition().x, light->getPosition().y+50)); item->setPosition(ccp(light->getPosition().x, light->getPosition().y+50));
menuConnect->addChild(item, 0); menuConnect->addChild(item, 0);

View File

@ -1390,7 +1390,7 @@ std::string BMFontOneAtlas::subtitle()
/// BMFontUnicode /// BMFontUnicode
BMFontUnicode::BMFontUnicode() BMFontUnicode::BMFontUnicode()
{ {
CCDictionary *strings = CCDictionary::create("fonts/strings.xml"); CCDictionary *strings = CCDictionary::createWithContentsOfFile("fonts/strings.xml");
const char *chinese = ((CCString*)strings->objectForKey("chinese1"))->m_sString.c_str(); const char *chinese = ((CCString*)strings->objectForKey("chinese1"))->m_sString.c_str();
const char *japanese = ((CCString*)strings->objectForKey("japanese"))->m_sString.c_str(); const char *japanese = ((CCString*)strings->objectForKey("japanese"))->m_sString.c_str();
const char *spanish = ((CCString*)strings->objectForKey("spanish"))->m_sString.c_str(); const char *spanish = ((CCString*)strings->objectForKey("spanish"))->m_sString.c_str();

View File

@ -314,7 +314,7 @@ LayerGradient::LayerGradient()
CCLabelTTF *label2 = CCLabelTTF::create("Compressed Interpolation: Disabled", "Marker Felt", 26); CCLabelTTF *label2 = CCLabelTTF::create("Compressed Interpolation: Disabled", "Marker Felt", 26);
CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1); CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1);
CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2); CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2);
CCMenuItemToggle *item = CCMenuItemToggle::create(this, menu_selector(LayerGradient::toggleItem), item1, item2, NULL); CCMenuItemToggle *item = CCMenuItemToggle::createWithTarget(this, menu_selector(LayerGradient::toggleItem), item1, item2, NULL);
CCMenu *menu = CCMenu::create(item, NULL); CCMenu *menu = CCMenu::create(item, NULL);
addChild(menu); addChild(menu);

View File

@ -383,7 +383,7 @@ MenuLayer4::MenuLayer4()
title1->setEnabled(false); title1->setEnabled(false);
CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontName( "Marker Felt" );
CCMenuItemFont::setFontSize(34); CCMenuItemFont::setFontSize(34);
CCMenuItemToggle* item1 = CCMenuItemToggle::create( this, CCMenuItemToggle* item1 = CCMenuItemToggle::createWithTarget(this,
menu_selector(MenuLayer4::menuCallback), menu_selector(MenuLayer4::menuCallback),
CCMenuItemFont::create( "On" ), CCMenuItemFont::create( "On" ),
CCMenuItemFont::create( "Off"), CCMenuItemFont::create( "Off"),
@ -395,7 +395,7 @@ MenuLayer4::MenuLayer4()
title2->setEnabled(false); title2->setEnabled(false);
CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontName( "Marker Felt" );
CCMenuItemFont::setFontSize(34); CCMenuItemFont::setFontSize(34);
CCMenuItemToggle *item2 = CCMenuItemToggle::create( this, CCMenuItemToggle *item2 = CCMenuItemToggle::createWithTarget(this,
menu_selector(MenuLayer4::menuCallback), menu_selector(MenuLayer4::menuCallback),
CCMenuItemFont::create( "On" ), CCMenuItemFont::create( "On" ),
CCMenuItemFont::create( "Off"), CCMenuItemFont::create( "Off"),
@ -407,7 +407,7 @@ MenuLayer4::MenuLayer4()
title3->setEnabled( false ); title3->setEnabled( false );
CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontName( "Marker Felt" );
CCMenuItemFont::setFontSize(34); CCMenuItemFont::setFontSize(34);
CCMenuItemToggle *item3 = CCMenuItemToggle::create( this, CCMenuItemToggle *item3 = CCMenuItemToggle::createWithTarget(this,
menu_selector(MenuLayer4::menuCallback), menu_selector(MenuLayer4::menuCallback),
CCMenuItemFont::create( "High" ), CCMenuItemFont::create( "High" ),
CCMenuItemFont::create( "Low" ), CCMenuItemFont::create( "Low" ),
@ -419,7 +419,7 @@ MenuLayer4::MenuLayer4()
title4->setEnabled(false); title4->setEnabled(false);
CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontName( "Marker Felt" );
CCMenuItemFont::setFontSize(34); CCMenuItemFont::setFontSize(34);
CCMenuItemToggle *item4 = CCMenuItemToggle::create( this, CCMenuItemToggle *item4 = CCMenuItemToggle::createWithTarget(this,
menu_selector(MenuLayer4::menuCallback), menu_selector(MenuLayer4::menuCallback),
CCMenuItemFont::create( "Off" ), CCMenuItemFont::create( "Off" ),
NULL ); NULL );

View File

@ -258,7 +258,7 @@ void MotionStreakTest::onEnter()
addChild(menu, 1); addChild(menu, 1);
CCMenuItemToggle *itemMode = CCMenuItemToggle::create(this, menu_selector(MotionStreakTest::modeCallback), CCMenuItemToggle *itemMode = CCMenuItemToggle::createWithTarget(this, menu_selector(MotionStreakTest::modeCallback),
CCMenuItemFont::create("Use High Quality Mode"), CCMenuItemFont::create("Use High Quality Mode"),
CCMenuItemFont::create("Use Fast Mode"), CCMenuItemFont::create("Use Fast Mode"),
NULL); NULL);

View File

@ -1088,7 +1088,7 @@ void ParticleDemo::onEnter(void)
CCMenuItemImage* item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) ); CCMenuItemImage* item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) );
CCMenuItemImage* item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ParticleDemo::nextCallback) ); CCMenuItemImage* item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ParticleDemo::nextCallback) );
CCMenuItemToggle* item4 = CCMenuItemToggle::create( this, CCMenuItemToggle* item4 = CCMenuItemToggle::createWithTarget(this,
menu_selector(ParticleDemo::toggleCallback), menu_selector(ParticleDemo::toggleCallback),
CCMenuItemFont::create( "Free Movement" ), CCMenuItemFont::create( "Free Movement" ),
CCMenuItemFont::create( "Relative Movement" ), CCMenuItemFont::create( "Relative Movement" ),
@ -1239,7 +1239,7 @@ void ParticleBatchHybrid::onEnter()
m_emitter = CCParticleSystemQuad::create("Particles/LavaFlow.plist"); m_emitter = CCParticleSystemQuad::create("Particles/LavaFlow.plist");
m_emitter->retain(); m_emitter->retain();
CCParticleBatchNode *batch = CCParticleBatchNode::create(m_emitter->getTexture()); CCParticleBatchNode *batch = CCParticleBatchNode::createWithTexture(m_emitter->getTexture());
batch->addChild(m_emitter); batch->addChild(m_emitter);
@ -1298,7 +1298,7 @@ void ParticleBatchMultipleEmitters::onEnter()
emitter2->setPosition(ccp( s.width/2, s.height/2)); emitter2->setPosition(ccp( s.width/2, s.height/2));
emitter3->setPosition(ccp( s.width/4, s.height/4)); emitter3->setPosition(ccp( s.width/4, s.height/4));
CCParticleBatchNode *batch = CCParticleBatchNode::create(emitter1->getTexture()); CCParticleBatchNode *batch = CCParticleBatchNode::createWithTexture(emitter1->getTexture());
batch->addChild(emitter1, 0); batch->addChild(emitter1, 0);
batch->addChild(emitter2, 0); batch->addChild(emitter2, 0);
@ -1330,7 +1330,7 @@ void ParticleReorder::onEnter()
CCParticleSystem* ignore = CCParticleSystemQuad::create("Particles/SmallSun.plist"); CCParticleSystem* ignore = CCParticleSystemQuad::create("Particles/SmallSun.plist");
CCNode *parent1 = CCNode::create(); CCNode *parent1 = CCNode::create();
CCNode *parent2 = CCParticleBatchNode::create(ignore->getTexture()); CCNode *parent2 = CCParticleBatchNode::createWithTexture(ignore->getTexture());
ignore->unscheduleUpdate(); ignore->unscheduleUpdate();
for( unsigned int i=0; i<2;i++) for( unsigned int i=0; i<2;i++)
@ -1646,7 +1646,7 @@ void AddAndDeleteParticleSystems::onEnter()
m_background = NULL; m_background = NULL;
//adds the texture inside the plist to the texture cache //adds the texture inside the plist to the texture cache
m_pBatchNode = CCParticleBatchNode::create((CCTexture2D*)NULL, 16000); m_pBatchNode = CCParticleBatchNode::createWithTexture((CCTexture2D*)NULL, 16000);
addChild(m_pBatchNode, 1, 2); addChild(m_pBatchNode, 1, 2);

View File

@ -180,7 +180,7 @@ void IterateSpriteSheet::updateQuantityOfNodes()
{ {
for(int i = 0; i < (quantityOfNodes-currentQuantityOfNodes); i++) for(int i = 0; i < (quantityOfNodes-currentQuantityOfNodes); i++)
{ {
CCSprite *sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0, 0, 32, 32)); CCSprite *sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0, 0, 32, 32));
batchNode->addChild(sprite); batchNode->addChild(sprite);
sprite->setPosition(ccp( CCRANDOM_0_1()*s.width, CCRANDOM_0_1()*s.height)); sprite->setPosition(ccp( CCRANDOM_0_1()*s.width, CCRANDOM_0_1()*s.height));
} }
@ -337,7 +337,7 @@ void AddRemoveSpriteSheet::updateQuantityOfNodes()
{ {
for (int i=0; i < (quantityOfNodes-currentQuantityOfNodes); i++) for (int i=0; i < (quantityOfNodes-currentQuantityOfNodes); i++)
{ {
CCSprite *sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0, 0, 32, 32)); CCSprite *sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0, 0, 32, 32));
batchNode->addChild(sprite); batchNode->addChild(sprite);
sprite->setPosition(ccp( CCRANDOM_0_1()*s.width, CCRANDOM_0_1()*s.height)); sprite->setPosition(ccp( CCRANDOM_0_1()*s.width, CCRANDOM_0_1()*s.height));
sprite->setVisible(false); sprite->setVisible(false);
@ -376,13 +376,13 @@ void AddSpriteSheet::update(float dt)
if( totalToAdd > 0 ) if( totalToAdd > 0 )
{ {
CCArray* sprites = CCArray::create(totalToAdd); CCArray* sprites = CCArray::createWithCapacity(totalToAdd);
int *zs = new int[totalToAdd]; int *zs = new int[totalToAdd];
// Don't include the sprite creation time and random as part of the profiling // Don't include the sprite creation time and random as part of the profiling
for(int i=0; i<totalToAdd; i++) for(int i=0; i<totalToAdd; i++)
{ {
CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32)); CCSprite* pSprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0,0,32,32));
sprites->addObject(pSprite); sprites->addObject(pSprite);
zs[i] = CCRANDOM_MINUS1_1() * 50; zs[i] = CCRANDOM_MINUS1_1() * 50;
} }
@ -440,12 +440,12 @@ void RemoveSpriteSheet::update(float dt)
if( totalToAdd > 0 ) if( totalToAdd > 0 )
{ {
CCArray* sprites = CCArray::create(totalToAdd); CCArray* sprites = CCArray::createWithCapacity(totalToAdd);
// Don't include the sprite creation time as part of the profiling // Don't include the sprite creation time as part of the profiling
for(int i=0;i<totalToAdd;i++) for(int i=0;i<totalToAdd;i++)
{ {
CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32)); CCSprite* pSprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0,0,32,32));
sprites->addObject(pSprite); sprites->addObject(pSprite);
} }
@ -500,12 +500,12 @@ void ReorderSpriteSheet::update(float dt)
if( totalToAdd > 0 ) if( totalToAdd > 0 )
{ {
CCArray* sprites = CCArray::create(totalToAdd); CCArray* sprites = CCArray::createWithCapacity(totalToAdd);
// Don't include the sprite creation time as part of the profiling // Don't include the sprite creation time as part of the profiling
for(int i=0;i<totalToAdd;i++) for(int i=0;i<totalToAdd;i++)
{ {
CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32)); CCSprite* pSprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0,0,32,32));
sprites->addObject(pSprite); sprites->addObject(pSprite);
} }

View File

@ -130,7 +130,7 @@ CCSprite* SubTest::createSpriteWithTag(int tag)
case 2: case 2:
case 3: case 3:
{ {
sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0, 0, 52, 139)); sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0, 0, 52, 139));
batchNode->addChild(sprite, 0, tag+100); batchNode->addChild(sprite, 0, tag+100);
break; break;
} }
@ -154,7 +154,7 @@ CCSprite* SubTest::createSpriteWithTag(int tag)
x *= 85; x *= 85;
y *= 121; y *= 121;
sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(x,y,85,121)); sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(x,y,85,121));
batchNode->addChild(sprite, 0, tag+100); batchNode->addChild(sprite, 0, tag+100);
break; break;
} }
@ -185,7 +185,7 @@ CCSprite* SubTest::createSpriteWithTag(int tag)
x *= 32; x *= 32;
y *= 32; y *= 32;
sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(x,y,32,32)); sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(x,y,32,32));
batchNode->addChild(sprite, 0, tag+100); batchNode->addChild(sprite, 0, tag+100);
break; break;
} }
@ -441,7 +441,7 @@ void performanceActions20(CCSprite* pSprite)
float growDuration = 0.5f + (rand() % 1000) / 500.0f; float growDuration = 0.5f + (rand() % 1000) / 500.0f;
CCActionInterval *grow = CCScaleBy::create(growDuration, 0.5f, 0.5f); CCActionInterval *grow = CCScaleBy::create(growDuration, 0.5f, 0.5f);
CCAction *permanentScaleLoop = CCRepeatForever::create(CCSequence::create(grow, grow->reverse())); CCAction *permanentScaleLoop = CCRepeatForever::create(CCSequence::createWithTwoActions(grow, grow->reverse()));
pSprite->runAction(permanentScaleLoop); pSprite->runAction(permanentScaleLoop);
} }

View File

@ -188,7 +188,7 @@ void RenderTextureSave::saveImage(cocos2d::CCObject *pSender)
CC_SAFE_DELETE(pImage); CC_SAFE_DELETE(pImage);
CCSprite *sprite = CCSprite::create(tex); CCSprite *sprite = CCSprite::createWithTexture(tex);
sprite->setScale(0.3f); sprite->setScale(0.3f);
addChild(sprite); addChild(sprite);
@ -457,7 +457,7 @@ void RenderTextureZbuffer::renderScreenShot()
texture->end(); texture->end();
CCSprite *sprite = CCSprite::create(texture->getSprite()->getTexture()); CCSprite *sprite = CCSprite::createWithTexture(texture->getSprite()->getTexture());
sprite->setPosition(ccp(256, 256)); sprite->setPosition(ccp(256, 256));
sprite->setOpacity(182); sprite->setOpacity(182);

View File

@ -1 +1 @@
ce063dda23d6a1bcfed54ba357a7aded426ea89e 5fc56349b3bc725b72183e738c2673d084631809

View File

@ -283,12 +283,12 @@ void TextureMipMap::onEnter()
CCTexture2D *texture1 = CCTextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas_nomipmap.png"); CCTexture2D *texture1 = CCTextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas_nomipmap.png");
CCSprite *img0 = CCSprite::create(texture0); CCSprite *img0 = CCSprite::createWithTexture(texture0);
img0->setTextureRect(CCRectMake(85, 121, 85, 121)); img0->setTextureRect(CCRectMake(85, 121, 85, 121));
img0->setPosition(ccp( s.width/3.0f, s.height/2.0f)); img0->setPosition(ccp( s.width/3.0f, s.height/2.0f));
addChild(img0); addChild(img0);
CCSprite *img1 = CCSprite::create(texture1); CCSprite *img1 = CCSprite::createWithTexture(texture1);
img1->setTextureRect(CCRectMake(85, 121, 85, 121)); img1->setTextureRect(CCRectMake(85, 121, 85, 121));
img1->setPosition(ccp( 2*s.width/3.0f, s.height/2.0f)); img1->setPosition(ccp( 2*s.width/3.0f, s.height/2.0f));
addChild(img1); addChild(img1);
@ -1162,7 +1162,7 @@ void TextureAsync::imageLoaded(CCObject* pObj)
// This test just creates a sprite based on the Texture // This test just creates a sprite based on the Texture
CCSprite *sprite = CCSprite::create(tex); CCSprite *sprite = CCSprite::createWithTexture(tex);
sprite->setAnchorPoint(ccp(0,0)); sprite->setAnchorPoint(ccp(0,0));
addChild(sprite, -1); addChild(sprite, -1);

View File

@ -1257,7 +1257,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
CCString* str = CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str())); CCString* str = CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str()));
CCAssert(str != NULL, "Unable to open file"); CCAssert(str != NULL, "Unable to open file");
CCTMXTiledMap *map = CCTMXTiledMap::create(str->getCString() ,resources.c_str()); CCTMXTiledMap *map = CCTMXTiledMap::createWithXML(str->getCString() ,resources.c_str());
addChild(map, 0, kTagTileMap); addChild(map, 0, kTagTileMap);
CCSize s = map->getContentSize(); CCSize s = map->getContentSize();

View File

@ -54,7 +54,7 @@ PongLayer::PongLayer()
CCTexture2D* paddleTexture = CCTextureCache::sharedTextureCache()->addImage(s_Paddle); CCTexture2D* paddleTexture = CCTextureCache::sharedTextureCache()->addImage(s_Paddle);
CCArray *paddlesM = CCArray::create(4); CCArray *paddlesM = CCArray::createWithCapacity(4);
Paddle* paddle = Paddle::paddleWithTexture(paddleTexture); Paddle* paddle = Paddle::paddleWithTexture(paddleTexture);
paddle->setPosition( CCPointMake(m_tWinSize.width/2, 15) ); paddle->setPosition( CCPointMake(m_tWinSize.width/2, 15) );

View File

@ -136,7 +136,7 @@ void ZwoptexGenericTest::onEnter()
layer1->setPosition(ccp(s.width/2-80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f))); layer1->setPosition(ccp(s.width/2-80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f)));
addChild(layer1); addChild(layer1);
sprite1 = CCSprite::create(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_01.png")); sprite1 = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_01.png"));
sprite1->setPosition(ccp( s.width/2-80, s.height/2)); sprite1->setPosition(ccp( s.width/2-80, s.height/2));
addChild(sprite1); addChild(sprite1);
@ -147,7 +147,7 @@ void ZwoptexGenericTest::onEnter()
layer2->setPosition(ccp(s.width/2+80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f))); layer2->setPosition(ccp(s.width/2+80 - (85.0f * 0.5f), s.height/2 - (121.0f * 0.5f)));
addChild(layer2); addChild(layer2);
sprite2 = CCSprite::create(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_generic_01.png")); sprite2 = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_generic_01.png"));
sprite2->setPosition(ccp( s.width/2 + 80, s.height/2)); sprite2->setPosition(ccp( s.width/2 + 80, s.height/2));
addChild(sprite2); addChild(sprite2);

View File

@ -1 +1 @@
d9ee53ff007acf07cd57b33d0fb5648fd87b7a51 da857ec78bd3072e568563ae4ee25a23c63295f9

View File

@ -1 +1 @@
5a7e5635d52e83fd5083588da3ed657152d523cb 7cb982a0fdfc6ad650535099fa5fadf5d05073e4