diff --git a/HelloLua/Resources/hello.lua b/HelloLua/Resources/hello.lua index 0f99068474..33efc36f37 100644 --- a/HelloLua/Resources/hello.lua +++ b/HelloLua/Resources/hello.lua @@ -26,7 +26,7 @@ local function creatDog() rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight) local frame1 = CCSpriteFrame:create(textureDog, rect) - local spriteDog = CCSprite:createWithSpriteFrame(frame0) + local spriteDog = CCSprite:create(frame0) spriteDog.isPaused = false spriteDog:setPosition(0, winSize.height / 4 * 3) @@ -35,7 +35,7 @@ local function creatDog() animFrames:addObject(frame0) animFrames:addObject(frame1) - local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.5) + local animation = CCAnimation:create(animFrames, 0.5) local animate = CCAnimate:create(animation); spriteDog:runAction(CCRepeatForever:create(animate)) @@ -76,11 +76,10 @@ local function createLayerFram() end -- add crop - local textureCrop = CCTextureCache:sharedTextureCache():addImage("crop.png") - local frameCrop = CCSpriteFrame:create(textureCrop, CCRectMake(0, 0, 105, 95)) + local frameCrop = CCSpriteFrame:create("crop.png", CCRectMake(0, 0, 105, 95)) for i = 0, 3 do for j = 0, 1 do - local spriteCrop = CCSprite:createWithSpriteFrame(frameCrop); + local spriteCrop = CCSprite:create(frameCrop); spriteCrop:setPosition(10 + 200 + j * 180 - i % 2 * 90, 30 + 10 + i * 95 / 2) layerFarm:addChild(spriteCrop) end diff --git a/cocos2dx/CCDrawingPrimitives.cpp b/cocos2dx/CCDrawingPrimitives.cpp index 8299202943..e2dfd6297e 100644 --- a/cocos2dx/CCDrawingPrimitives.cpp +++ b/cocos2dx/CCDrawingPrimitives.cpp @@ -42,35 +42,35 @@ NS_CC_BEGIN #define M_PI 3.14159265358979323846 #endif -static bool initialized = false; -static CCGLProgram *shader_ = NULL; -static int colorLocation_ = -1; -static ccColor4F color_ = {1,1,1,1}; -static int pointSizeLocation_ = -1; -static GLfloat pointSize_ = 1; +static bool s_bInitialized = false; +static CCGLProgram* s_pShader = NULL; +static int s_nColorLocation = -1; +static ccColor4F s_tColor = {1.0f,1.0f,1.0f,1.0f}; +static int s_nPointSizeLocation = -1; +static GLfloat s_fPointSize = 1.0f; static void lazy_init( void ) { - if( ! initialized ) { + if( ! s_bInitialized ) { // // Position and 1 color passed as a uniform (to similate glColor4ub ) // - shader_ = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_Position_uColor); + s_pShader = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_Position_uColor); - colorLocation_ = glGetUniformLocation( shader_->getProgram(), "u_color"); + s_nColorLocation = glGetUniformLocation( s_pShader->getProgram(), "u_color"); CHECK_GL_ERROR_DEBUG(); - pointSizeLocation_ = glGetUniformLocation( shader_->getProgram(), "u_pointSize"); + s_nPointSizeLocation = glGetUniformLocation( s_pShader->getProgram(), "u_pointSize"); CHECK_GL_ERROR_DEBUG(); - initialized = true; + s_bInitialized = true; } } // When back to foreground on android, we want to it to inilialize again void ccDrawInit() { - initialized = false; + s_bInitialized = false; } void ccDrawPoint( const CCPoint& point ) @@ -82,11 +82,11 @@ void ccDrawPoint( const CCPoint& point ) p.y = point.y; ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); - shader_->setUniformLocationWith1f(pointSizeLocation_, pointSize_); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); + s_pShader->setUniformLocationWith1f(s_nPointSizeLocation, s_fPointSize); glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, &p); @@ -100,10 +100,10 @@ void ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ) lazy_init(); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); - shader_->setUniformLocationWith1f(pointSizeLocation_, pointSize_); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); + s_pShader->setUniformLocationWith1f(s_nPointSizeLocation, s_fPointSize); // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed ccVertex2F* newPoints = new ccVertex2F[numberOfPoints]; @@ -140,11 +140,11 @@ void ccDrawLine( const CCPoint& origin, const CCPoint& destination ) {destination.x, destination.y} }; - shader_->use(); + s_pShader->use(); CHECK_GL_ERROR_DEBUG(); - shader_->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformForModelViewProjectionMatrix(); CHECK_GL_ERROR_DEBUG(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); CHECK_GL_ERROR_DEBUG(); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -180,9 +180,9 @@ void ccDrawPoly( const CCPoint *poli, unsigned int numberOfPoints, bool closePol { lazy_init(); - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -217,9 +217,9 @@ void ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4 { lazy_init(); - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color.r, 1); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &color.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -272,9 +272,9 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned in vertices[(segments+1)*2] = center.x; vertices[(segments+1)*2+1] = center.y; - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -302,9 +302,9 @@ void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoi vertices[segments].x = destination.x; vertices[segments].y = destination.y; - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -354,9 +354,9 @@ void ccDrawCardinalSpline( CCPointArray *config, CCFloat tension, unsigned int vertices[i].y = newPos.y; } - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*)&color_.r, 1); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*)&s_tColor.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -383,9 +383,9 @@ void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCP vertices[segments].x = destination.x; vertices[segments].y = destination.y; - shader_->use(); - shader_->setUniformForModelViewProjectionMatrix(); - shader_->setUniformLocationWith4fv(colorLocation_, (GLfloat*) &color_.r, 1); + s_pShader->use(); + s_pShader->setUniformForModelViewProjectionMatrix(); + s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); @@ -398,15 +398,15 @@ void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCP void ccDrawColor4F( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) { - color_.r = r; - color_.g = g; - color_.b = b; - color_.a = a; + s_tColor.r = r; + s_tColor.g = g; + s_tColor.b = b; + s_tColor.a = a; } void ccPointSize( GLfloat pointSize ) { - pointSize_ = pointSize * CC_CONTENT_SCALE_FACTOR(); + s_fPointSize = pointSize * CC_CONTENT_SCALE_FACTOR(); //TODO :glPointSize( pointSize ); @@ -414,10 +414,10 @@ void ccPointSize( GLfloat pointSize ) void ccDrawColor4B( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { - color_.r = r/255.0f; - color_.g = g/255.0f; - color_.b = b/255.0f; - color_.a = a/255.0f; + s_tColor.r = r/255.0f; + s_tColor.g = g/255.0f; + s_tColor.b = b/255.0f; + s_tColor.a = a/255.0f; } NS_CC_END diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index cddd12b8c6..745f914737 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -2399,7 +2399,7 @@ CCActionInterval* CCAnimate::reverse(void) } } - CCAnimation *newAnim = CCAnimation::createWithAnimationFrames(pNewArray, m_pAnimation->getDelayPerUnit(), m_pAnimation->getLoops()); + CCAnimation *newAnim = CCAnimation::create(pNewArray, m_pAnimation->getDelayPerUnit(), m_pAnimation->getLoops()); newAnim->setRestoreOriginalFrame(m_pAnimation->getRestoreOriginalFrame()); return create(newAnim); } diff --git a/cocos2dx/cocoa/CCArray.cpp b/cocos2dx/cocoa/CCArray.cpp index 58c50c5465..63c6d8ad8f 100644 --- a/cocos2dx/cocoa/CCArray.cpp +++ b/cocos2dx/cocoa/CCArray.cpp @@ -169,12 +169,12 @@ CCArray* CCArray::create(CCArray* otherArray) CCArray* CCArray::arrayWithContentsOfFile(const char* pFileName) { - return CCArray::createWithContentsOfFile(pFileName); + return CCArray::create(pFileName); } -CCArray* CCArray::createWithContentsOfFile(const char* pFileName) +CCArray* CCArray::create(const char* pFileName) { - CCArray* pRet = createWithContentsOfFileThreadSafe(pFileName); + CCArray* pRet = CCArray::createWithContentsOfFileThreadSafe(pFileName); if (pRet != NULL) { pRet->autorelease(); diff --git a/cocos2dx/cocoa/CCArray.h b/cocos2dx/cocoa/CCArray.h index 1b45372a7a..5f69be05f3 100644 --- a/cocos2dx/cocoa/CCArray.h +++ b/cocos2dx/cocoa/CCArray.h @@ -165,7 +165,7 @@ public: @param pFileName The file name of *.plist file @return The CCArray pointer generated from the file */ - static CCArray* createWithContentsOfFile(const char* pFileName); + static CCArray* create(const char* pFileName); /* @brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the diff --git a/cocos2dx/cocoa/CCDictionary.cpp b/cocos2dx/cocoa/CCDictionary.cpp index a2d67c3aca..a413f539ec 100644 --- a/cocos2dx/cocoa/CCDictionary.cpp +++ b/cocos2dx/cocoa/CCDictionary.cpp @@ -309,10 +309,10 @@ CCDictionary* CCDictionary::create() CCDictionary* CCDictionary::dictionaryWithDictionary(CCDictionary* srcDict) { - return CCDictionary::createWithDictionary(srcDict); + return CCDictionary::create(srcDict); } -CCDictionary* CCDictionary::createWithDictionary(CCDictionary* srcDict) +CCDictionary* CCDictionary::create(CCDictionary* srcDict) { CCDictionary* pNewDict = (CCDictionary*)srcDict->copy(); pNewDict->autorelease(); @@ -333,10 +333,10 @@ CCDictionary* CCDictionary::createWithContentsOfFileThreadSafe(const char *pFile CCDictionary* CCDictionary::dictionaryWithContentsOfFile(const char *pFileName) { - return CCDictionary::createWithContentsOfFile(pFileName); + return CCDictionary::create(pFileName); } -CCDictionary* CCDictionary::createWithContentsOfFile(const char *pFileName) +CCDictionary* CCDictionary::create(const char *pFileName) { CCDictionary* pRet = createWithContentsOfFileThreadSafe(pFileName); pRet->autorelease(); diff --git a/cocos2dx/cocoa/CCDictionary.h b/cocos2dx/cocoa/CCDictionary.h index c6f8e3392f..ec54485d30 100644 --- a/cocos2dx/cocoa/CCDictionary.h +++ b/cocos2dx/cocoa/CCDictionary.h @@ -163,13 +163,13 @@ public: static CCDictionary* create(); - static CCDictionary* createWithDictionary(CCDictionary* srcDict); + static CCDictionary* create(CCDictionary* srcDict); /** @brief Generate a CCDictionary pointer by file @param pFileName The file name of *.plist file @return The CCDictionary pointer generated from the file */ - static CCDictionary* createWithContentsOfFile(const char *pFileName); + static CCDictionary* create(const char *pFileName); /* @brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the diff --git a/cocos2dx/cocoa/CCString.cpp b/cocos2dx/cocoa/CCString.cpp index f6ea6d8390..7e7407b692 100644 --- a/cocos2dx/cocoa/CCString.cpp +++ b/cocos2dx/cocoa/CCString.cpp @@ -171,10 +171,10 @@ CCString* CCString::stringWithString(const std::string& pStr) CCString* CCString::stringWithData(const unsigned char* pData, unsigned long nLen) { - return CCString::createWithData(pData, nLen); + return CCString::create(pData, nLen); } -CCString* CCString::createWithData(const unsigned char* pData, unsigned long nLen) +CCString* CCString::create(const unsigned char* pData, unsigned long nLen) { CCString* pRet = NULL; if (pData != NULL) @@ -219,7 +219,7 @@ CCString* CCString::createWithFormat(const char* format, ...) CCString* CCString::stringWithContentsOfFile(const char* pszFileName) { - return CCString::createWithContentsOfFile(pszFileName); + return CCString::create(pszFileName); } CCString* CCString::createWithContentsOfFile(const char* pszFileName) @@ -228,7 +228,7 @@ CCString* CCString::createWithContentsOfFile(const char* pszFileName) unsigned char* pData = 0; CCString* pRet = NULL; pData = CCFileUtils::sharedFileUtils()->getFileData(pszFileName, "rb", &size); - pRet = CCString::createWithData(pData, size); + pRet = CCString::create(pData, size); CC_SAFE_DELETE_ARRAY(pData); return pRet; } diff --git a/cocos2dx/cocoa/CCString.h b/cocos2dx/cocoa/CCString.h index 94912399a0..3084de461c 100644 --- a/cocos2dx/cocoa/CCString.h +++ b/cocos2dx/cocoa/CCString.h @@ -132,7 +132,7 @@ public: * @return A CCString pointer which is an autorelease object pointer, * it means that you needn't do a release operation unless you retain it. */ - static CCString* createWithData(const unsigned char* pData, unsigned long nLen); + static CCString* create(const unsigned char* pData, unsigned long nLen); /** create a string with a file, * @return A CCString pointer which is an autorelease object pointer, diff --git a/cocos2dx/extensions/CCBReader/CCBReader.cpp b/cocos2dx/extensions/CCBReader/CCBReader.cpp index 76548aab89..3688042a12 100644 --- a/cocos2dx/extensions/CCBReader/CCBReader.cpp +++ b/cocos2dx/extensions/CCBReader/CCBReader.cpp @@ -167,7 +167,7 @@ void CCBReader::readStringCacheEntry() { int numBytes = b0 << 8 | b1; const unsigned char * src = (const unsigned char *) (this->mBytes + this->mCurrentByte); - CCString * string = CCString::createWithData(src, (unsigned long)numBytes); + CCString * string = CCString::create(src, (unsigned long)numBytes); string->retain(); this->mCurrentByte += numBytes; diff --git a/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp b/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp index 9913af1eb5..2cc7a173dd 100644 --- a/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp @@ -120,25 +120,25 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re // // Centre - centre = CCSprite::createWithTexture(scale9Image->getTexture(), m_capInsetsInternal); + centre = CCSprite::create(scale9Image->getTexture(), m_capInsetsInternal); scale9Image->addChild(centre, 0, pCentre); // Top - top = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x, + top = CCSprite::create(scale9Image->getTexture(), CCRectMake(m_capInsetsInternal.origin.x, t, m_capInsetsInternal.size.width, m_capInsetsInternal.origin.y - t)); scale9Image->addChild(top, 1, pTop); // Bottom - bottom = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x, + bottom = CCSprite::create(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x, m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height, m_capInsetsInternal.size.width, h - (m_capInsetsInternal.origin.y - t + m_capInsetsInternal.size.height) )); scale9Image->addChild(bottom, 1, pBottom); // Left - left = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( + left = CCSprite::create(scale9Image->getTexture(), CCRectMake( l, m_capInsetsInternal.origin.y, m_capInsetsInternal.origin.x - l, @@ -146,7 +146,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re scale9Image->addChild(left, 1, pLeft); // Right - right = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( + right = CCSprite::create(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width, m_capInsetsInternal.origin.y, 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); // Top left - topLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( + topLeft = CCSprite::create(scale9Image->getTexture(), CCRectMake( l, t, m_capInsetsInternal.origin.x - l, @@ -163,7 +163,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re scale9Image->addChild(topLeft, 2, pTopLeft); // Top right - topRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( + topRight = CCSprite::create(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width, t, 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); // Bottom left - bottomLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( + bottomLeft = CCSprite::create(scale9Image->getTexture(), CCRectMake( l, m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height, m_capInsetsInternal.origin.x - l, @@ -180,7 +180,7 @@ bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect re scale9Image->addChild(bottomLeft, 2, pBottomLeft); // Bottom right - bottomRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( + bottomRight = CCSprite::create(scale9Image->getTexture(), CCRectMake( m_capInsetsInternal.origin.x + m_capInsetsInternal.size.width, m_capInsetsInternal.origin.y + m_capInsetsInternal.size.height, 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"); - CCSpriteBatchNode *batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9); + CCSpriteBatchNode *batchnode = CCSpriteBatchNode::create(spriteFrame->getTexture(), 9); bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), capInsets); return pReturn; } @@ -602,7 +602,7 @@ bool CCScale9Sprite::isOpacityModifyRGB() void CCScale9Sprite::setSpriteFrame(CCSpriteFrame * spriteFrame) { - CCSpriteBatchNode * batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9); + CCSpriteBatchNode * batchnode = CCSpriteBatchNode::create(spriteFrame->getTexture(), 9); this->updateWithBatchNode(batchnode, spriteFrame->getRect(), CCRectZero); // Reset insets diff --git a/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp b/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp index a3630e1176..89f23ebd30 100644 --- a/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp +++ b/cocos2dx/extensions/CCTextureWatcher/CCTextureWatcher.cpp @@ -321,7 +321,7 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro labelName->setAnchorPoint(ccp(0.5f, 0)); cell->addChild(labelName); - CCSprite *sprite = CCSprite::createWithTexture(textrue); + CCSprite *sprite = CCSprite::create(textrue); sprite->setAnchorPoint(ccp(0, 0)); CCSize spriteSize = sprite->getContentSize(); diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index 61b2d03620..a17d652cd0 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -95,7 +95,7 @@ CCLabelAtlas* CCLabelAtlas::create(const char *string, const char *fntFile) bool CCLabelAtlas::initWithString(const char *theString, const char *fntFile) { - CCDictionary *dict = CCDictionary::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fntFile)); + CCDictionary *dict = CCDictionary::create(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fntFile)); CCAssert(((CCString*)dict->objectForKey("version"))->intValue() == 1, "Unsupported version. Upgrade cocos2d version"); diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index d5401a2e92..47d94d5b34 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -487,7 +487,7 @@ void CCBMFontConfiguration::purgeFontDefDictionary() bool CCBMFontConfiguration::parseConfigFile(const char *controlFile) { std::string fullpath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(controlFile); - CCString *contents = CCString::createWithContentsOfFile(fullpath.c_str()); + CCString *contents = CCString::create(fullpath.c_str()); CCAssert(contents, "CCBMFontConfiguration::parseConfigFile | Open file error."); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index d189784841..578c49f527 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -786,10 +786,7 @@ CCLayerMultiplex * CCLayerMultiplex::layerWithLayer(CCLayer* layer) CCLayerMultiplex * CCLayerMultiplex::createWithLayer(CCLayer* layer) { - CCLayerMultiplex * pMultiplexLayer = new CCLayerMultiplex(); - pMultiplexLayer->initWithLayer(layer); - pMultiplexLayer->autorelease(); - return pMultiplexLayer; + return CCLayerMultiplex::create(layer, NULL); } void CCLayerMultiplex::addLayer(CCLayer* layer) @@ -798,16 +795,6 @@ void CCLayerMultiplex::addLayer(CCLayer* layer) m_pLayers->addObject(layer); } -bool CCLayerMultiplex::initWithLayer(CCLayer* layer) -{ - m_pLayers = CCArray::create(); - m_pLayers->retain(); - m_pLayers->addObject(layer); - m_nEnabledLayer = 0; - this->addChild(layer); - return true; -} - bool CCLayerMultiplex::initWithLayers(CCLayer *layer, va_list params) { m_pLayers = CCArray::create(5); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index c888e86076..410346fe99 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -379,7 +379,6 @@ public: static CCLayerMultiplex * createWithLayer(CCLayer* layer); void addLayer(CCLayer* layer); - bool initWithLayer(CCLayer* layer); /** initializes a MultiplexLayer with one or more layers using a variable argument list. */ bool initWithLayers(CCLayer* layer, va_list params); diff --git a/cocos2dx/menu_nodes/CCMenu.h b/cocos2dx/menu_nodes/CCMenu.h index ac81283342..669cf318a1 100644 --- a/cocos2dx/menu_nodes/CCMenu.h +++ b/cocos2dx/menu_nodes/CCMenu.h @@ -97,7 +97,7 @@ public: /** creates a CCMenu with it's items */ static CCMenu* create(CCMenuItem* item, ...); - /** creates a CCMenu with a NSArray of CCMenuItem objects */ + /** creates a CCMenu with a CCArray of CCMenuItem objects */ static CCMenu* create(CCArray* pArrayOfItems); /** creates a CCMenu with it's item, then use addChild() to add diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index 1667befd8d..93df0ca76c 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -796,17 +796,17 @@ bool CCMenuItemImage::initWithNormalImage(const char *normalImage, const char *s // void CCMenuItemImage::setNormalSpriteFrame(CCSpriteFrame * frame) { - setNormalImage(CCSprite::createWithSpriteFrame(frame)); + setNormalImage(CCSprite::create(frame)); } void CCMenuItemImage::setSelectedSpriteFrame(CCSpriteFrame * frame) { - setSelectedImage(CCSprite::createWithSpriteFrame(frame)); + setSelectedImage(CCSprite::create(frame)); } void CCMenuItemImage::setDisabledSpriteFrame(CCSpriteFrame * frame) { - setDisabledImage(CCSprite::createWithSpriteFrame(frame)); + setDisabledImage(CCSprite::create(frame)); } // // MenuItemToggle diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index 6fbe66efe4..a84d07450d 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -228,7 +228,7 @@ bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelForma m_pTexture->setAliasTexParameters(); - m_pSprite = CCSprite::createWithTexture(m_pTexture); + m_pSprite = CCSprite::create(m_pTexture); m_pTexture->release(); m_pSprite->setScaleY(-1); diff --git a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp index 86da441a9b..94a105840f 100644 --- a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp +++ b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp @@ -60,10 +60,10 @@ CCParticleBatchNode::~CCParticleBatchNode() */ CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/) { - return CCParticleBatchNode::createWithTexture(tex, capacity); + return CCParticleBatchNode::create(tex, capacity); } -CCParticleBatchNode* CCParticleBatchNode::createWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/) +CCParticleBatchNode* CCParticleBatchNode::create(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/) { CCParticleBatchNode * p = new CCParticleBatchNode(); if( p && p->initWithTexture(tex, capacity)) diff --git a/cocos2dx/particle_nodes/CCParticleBatchNode.h b/cocos2dx/particle_nodes/CCParticleBatchNode.h index b02594273d..59b9c6bbca 100644 --- a/cocos2dx/particle_nodes/CCParticleBatchNode.h +++ b/cocos2dx/particle_nodes/CCParticleBatchNode.h @@ -81,7 +81,7 @@ public: 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 */ - static CCParticleBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity); + static CCParticleBatchNode* create(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 */ static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity); diff --git a/cocos2dx/sprite_nodes/CCAnimation.cpp b/cocos2dx/sprite_nodes/CCAnimation.cpp index 1d7af65e4c..068bc10e91 100644 --- a/cocos2dx/sprite_nodes/CCAnimation.cpp +++ b/cocos2dx/sprite_nodes/CCAnimation.cpp @@ -97,10 +97,10 @@ CCAnimation* CCAnimation::create(void) CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/) { - return CCAnimation::createWithSpriteFrames(frames, delay); + return CCAnimation::create(frames, delay); } -CCAnimation* CCAnimation::createWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/) +CCAnimation* CCAnimation::create(CCArray *frames, float delay/* = 0.0f*/) { CCAnimation *pAnimation = new CCAnimation(); pAnimation->initWithSpriteFrames(frames, delay); @@ -111,10 +111,10 @@ CCAnimation* CCAnimation::createWithSpriteFrames(CCArray *frames, float delay/* CCAnimation* CCAnimation::animationWithAnimationFrames(CCArray* arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops) { - return CCAnimation::createWithAnimationFrames(arrayOfAnimationFrameNames, delayPerUnit, loops); + return CCAnimation::create(arrayOfAnimationFrameNames, delayPerUnit, loops); } -CCAnimation* CCAnimation::createWithAnimationFrames(CCArray* arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops) +CCAnimation* CCAnimation::create(CCArray* arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops) { CCAnimation *pAnimation = new CCAnimation(); pAnimation->initWithAnimationFrames(arrayOfAnimationFrameNames, delayPerUnit, loops); diff --git a/cocos2dx/sprite_nodes/CCAnimation.h b/cocos2dx/sprite_nodes/CCAnimation.h index 7b419cf7cb..3898fb6dc0 100644 --- a/cocos2dx/sprite_nodes/CCAnimation.h +++ b/cocos2dx/sprite_nodes/CCAnimation.h @@ -116,12 +116,12 @@ public: The frames will be added with one "delay unit". @since v0.99.5 */ - static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay = 0.0f); + static CCAnimation* create(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. @since v2.0 */ - static CCAnimation* createWithAnimationFrames(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops); + static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops); /** Adds a CCSpriteFrame to a CCAnimation. The frame will be added with one "delay unit". diff --git a/cocos2dx/sprite_nodes/CCAnimationCache.cpp b/cocos2dx/sprite_nodes/CCAnimationCache.cpp index 328800cd1b..973dc85740 100644 --- a/cocos2dx/sprite_nodes/CCAnimationCache.cpp +++ b/cocos2dx/sprite_nodes/CCAnimationCache.cpp @@ -136,7 +136,7 @@ void CCAnimationCache::parseVersion1(CCDictionary* animations) CCLOG("cocos2d: CCAnimationCache: An animation in your dictionary refers to a frame which is not in the CCSpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.", pElement->getStrKey()); } - animation = CCAnimation::createWithAnimationFrames(frames, delay, 1); + animation = CCAnimation::create(frames, delay, 1); CCAnimationCache::sharedAnimationCache()->addAnimation(animation, pElement->getStrKey()); frames->release(); @@ -245,7 +245,7 @@ void CCAnimationCache::addAnimationsWithFile(const char* plist) CCAssert( plist, "Invalid texture file name"); const char* path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(plist); - CCDictionary* dict = CCDictionary::createWithContentsOfFile(path); + CCDictionary* dict = CCDictionary::create(path); CCAssert( dict, "CCAnimationCache: File could not be found"); diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 2aff4cc096..66c104bf19 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -60,10 +60,10 @@ NS_CC_BEGIN CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture) { - return CCSprite::createWithTexture(pTexture); + return CCSprite::create(pTexture); } -CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture) +CCSprite* CCSprite::create(CCTexture2D *pTexture) { CCSprite *pobSprite = new CCSprite(); if (pobSprite && pobSprite->initWithTexture(pTexture)) @@ -77,10 +77,10 @@ CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture) CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect) { - return CCSprite::createWithTexture(pTexture, rect); + return CCSprite::create(pTexture, rect); } -CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture, const CCRect& rect) +CCSprite* CCSprite::create(CCTexture2D *pTexture, const CCRect& rect) { CCSprite *pobSprite = new CCSprite(); if (pobSprite && pobSprite->initWithTexture(pTexture, rect)) @@ -128,10 +128,10 @@ CCSprite* CCSprite::create(const char *pszFileName, const CCRect& rect) CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame) { - return CCSprite::createWithSpriteFrame(pSpriteFrame); + return CCSprite::create(pSpriteFrame); } -CCSprite* CCSprite::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame) +CCSprite* CCSprite::create(CCSpriteFrame *pSpriteFrame) { CCSprite *pobSprite = new CCSprite(); if (pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame)) @@ -155,7 +155,7 @@ CCSprite* CCSprite::createWithSpriteFrameName(const char *pszSpriteFrameName) char msg[256] = {0}; sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName); CCAssert(pFrame != NULL, msg); - return createWithSpriteFrame(pFrame); + return create(pFrame); } CCSprite* CCSprite::node() diff --git a/cocos2dx/sprite_nodes/CCSprite.h b/cocos2dx/sprite_nodes/CCSprite.h index 2c4acec767..0c44ca27bd 100644 --- a/cocos2dx/sprite_nodes/CCSprite.h +++ b/cocos2dx/sprite_nodes/CCSprite.h @@ -142,12 +142,12 @@ public: The rect used will be the size of the texture. The offset will be (0,0). */ - static CCSprite* createWithTexture(CCTexture2D *pTexture); + static CCSprite* create(CCTexture2D *pTexture); /** Creates an sprite with a texture and a rect. The offset will be (0,0). */ - static CCSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect); + static CCSprite* create(CCTexture2D *pTexture, const CCRect& rect); /** Creates an sprite with an sprite frame. @deprecated: This interface will be deprecated sooner or later. @@ -163,7 +163,7 @@ public: CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName); /** Creates an sprite with an sprite frame. */ - static CCSprite* createWithSpriteFrame(CCSpriteFrame *pSpriteFrame); + static CCSprite* create(CCSpriteFrame *pSpriteFrame); /** Creates an sprite with an sprite frame name. An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name. @@ -347,21 +347,21 @@ protected: // // Data used when the sprite is rendered using a CCSpriteSheet // - CCTextureAtlas *m_pobTextureAtlas; // Sprite Sheet texture atlas (weak reference) - unsigned int m_uAtlasIndex; // Absolute (real) Index on the SpriteSheet - CCSpriteBatchNode *m_pobBatchNode; // Used batch node (weak reference) + CCTextureAtlas* m_pobTextureAtlas; // Sprite Sheet texture atlas (weak reference) + unsigned int m_uAtlasIndex; // Absolute (real) Index on the SpriteSheet + CCSpriteBatchNode* m_pobBatchNode; // Used batch node (weak reference) - bool m_bDirty; // Sprite needs to be updated - bool m_bRecursiveDirty; // Subchildren needs to be updated - bool m_bHasChildren; // optimization to check if it contain children - bool m_bShouldBeHidden; // should not be drawn because one of the ancestors is not visible - CCAffineTransform m_transformToBatch; // + bool m_bDirty; // Sprite needs to be updated + bool m_bRecursiveDirty; // Subchildren needs to be updated + bool m_bHasChildren; // optimization to check if it contain children + bool m_bShouldBeHidden; // should not be drawn because one of the ancestors is not visible + CCAffineTransform m_transformToBatch; // // // Data used when the sprite is self-rendered // ccBlendFunc m_sBlendFunc; // Needed for the texture protocol - CCTexture2D *m_pobTexture;// Texture used to render the sprite + CCTexture2D* m_pobTexture;// Texture used to render the sprite // // Shared data diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index ac82b54d03..4f31949437 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -48,10 +48,10 @@ NS_CC_BEGIN CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/) { - return CCSpriteBatchNode::createWithTexture(tex, capacity); + return CCSpriteBatchNode::create(tex, capacity); } -CCSpriteBatchNode* CCSpriteBatchNode::createWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/) +CCSpriteBatchNode* CCSpriteBatchNode::create(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/) { CCSpriteBatchNode *batchNode = new CCSpriteBatchNode(); batchNode->initWithTexture(tex, capacity); diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.h b/cocos2dx/sprite_nodes/CCSpriteBatchNode.h index 2a30f37487..3499a2f336 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.h +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.h @@ -97,7 +97,7 @@ public: /** 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. */ - static CCSpriteBatchNode* createWithTexture(CCTexture2D* tex, unsigned int capacity = kDefaultSpriteBatchCapacity); + static CCSpriteBatchNode* create(CCTexture2D* tex, unsigned int capacity = kDefaultSpriteBatchCapacity); /** 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. diff --git a/cocos2dx/sprite_nodes/CCSpriteFrame.cpp b/cocos2dx/sprite_nodes/CCSpriteFrame.cpp index 4a0a8c1fbf..e343530329 100644 --- a/cocos2dx/sprite_nodes/CCSpriteFrame.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteFrame.cpp @@ -47,10 +47,10 @@ CCSpriteFrame* CCSpriteFrame::create(CCTexture2D *pobTexture, const CCRect& rect CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, const CCRect& rect) { - return createWithTextureFilename(filename, rect); + return CCSpriteFrame::create(filename, rect); } -CCSpriteFrame* CCSpriteFrame::createWithTextureFilename(const char* filename, const CCRect& rect) +CCSpriteFrame* CCSpriteFrame::create(const char* filename, const CCRect& rect) { CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();; pSpriteFrame->initWithTextureFilename(filename, rect); @@ -75,10 +75,10 @@ CCSpriteFrame* CCSpriteFrame::create(CCTexture2D* pobTexture, const CCRect& rect CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize) { - return CCSpriteFrame::createWithTextureFilename(filename, rect, rotated, offset, originalSize); + return CCSpriteFrame::create(filename, rect, rotated, offset, originalSize); } -CCSpriteFrame* CCSpriteFrame::createWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize) +CCSpriteFrame* CCSpriteFrame::create(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize) { CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();; pSpriteFrame->initWithTextureFilename(filename, rect, rotated, offset, originalSize); diff --git a/cocos2dx/sprite_nodes/CCSpriteFrame.h b/cocos2dx/sprite_nodes/CCSpriteFrame.h index d41b4bf1c0..23247d3e6c 100644 --- a/cocos2dx/sprite_nodes/CCSpriteFrame.h +++ b/cocos2dx/sprite_nodes/CCSpriteFrame.h @@ -127,7 +127,7 @@ public: /** Create a CCSpriteFrame with a texture filename, rect in points. It is assumed that the frame was not trimmed. */ - static CCSpriteFrame* createWithTextureFilename(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. @@ -137,7 +137,7 @@ public: /** 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. */ - static CCSpriteFrame* createWithTextureFilename(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); public: /** Initializes a CCSpriteFrame with a texture, rect in points. diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 9c1ca76f65..79060c2237 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -102,8 +102,12 @@ void CCTextureAtlas::setQuads(ccV3F_C4B_T2F_Quad *var) } // TextureAtlas - alloc & init - CCTextureAtlas * CCTextureAtlas::textureAtlasWithFile(const char* file, unsigned int capacity) +{ + return CCTextureAtlas::create(file, capacity); +} + +CCTextureAtlas * CCTextureAtlas::create(const char* file, unsigned int capacity) { CCTextureAtlas * pTextureAtlas = new CCTextureAtlas(); if(pTextureAtlas && pTextureAtlas->initWithFile(file, capacity)) @@ -116,6 +120,11 @@ CCTextureAtlas * CCTextureAtlas::textureAtlasWithFile(const char* file, unsigned } CCTextureAtlas * CCTextureAtlas::textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity) +{ + return CCTextureAtlas::create(texture, capacity); +} + +CCTextureAtlas * CCTextureAtlas::create(CCTexture2D *texture, unsigned int capacity) { CCTextureAtlas * pTextureAtlas = new CCTextureAtlas(); if (pTextureAtlas && pTextureAtlas->initWithTexture(texture, capacity)) diff --git a/cocos2dx/textures/CCTextureAtlas.h b/cocos2dx/textures/CCTextureAtlas.h index 47686f5bcf..ee9be6e8c9 100644 --- a/cocos2dx/textures/CCTextureAtlas.h +++ b/cocos2dx/textures/CCTextureAtlas.h @@ -58,9 +58,9 @@ class CC_DLL CCTextureAtlas : public CCObject protected: GLushort* m_pIndices; #if CC_TEXTURE_ATLAS_USE_VAO - GLuint m_uVAOname; + GLuint m_uVAOname; #endif - GLuint m_pBuffersVBO[2]; //0: vertex 1: indices + GLuint m_pBuffersVBO[2]; //0: vertex 1: indices bool m_bDirty; //indicates whether or not the array buffer of the VBO needs to be updated @@ -82,8 +82,14 @@ public: /** creates a TextureAtlas with an filename and with an initial capacity for Quads. * The TextureAtlas capacity can be increased in runtime. + @deprecated: This interface will be deprecated sooner or later. */ - static CCTextureAtlas * textureAtlasWithFile(const char* file , unsigned int capacity); + CC_DEPRECATED_ATTRIBUTE static CCTextureAtlas * textureAtlasWithFile(const char* file , unsigned int capacity); + + /** creates a TextureAtlas with an filename and with an initial capacity for Quads. + * The TextureAtlas capacity can be increased in runtime. + */ + static CCTextureAtlas* create(const char* file , unsigned int capacity); /** initializes a TextureAtlas with a filename and with a certain capacity for Quads. * The TextureAtlas capacity can be increased in runtime. @@ -95,8 +101,16 @@ public: /** creates a TextureAtlas with a previously initialized Texture2D object, and * with an initial capacity for n Quads. * The TextureAtlas capacity can be increased in runtime. + @deprecated: This interface will be deprecated sooner or later. */ - static CCTextureAtlas * textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity); + CC_DEPRECATED_ATTRIBUTE static CCTextureAtlas * textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity); + + /** creates a TextureAtlas with a previously initialized Texture2D object, and + * with an initial capacity for n Quads. + * The TextureAtlas capacity can be increased in runtime. + */ + static CCTextureAtlas* create(CCTexture2D *texture, unsigned int capacity); + /** initializes a TextureAtlas with a previously initialized Texture2D object, and * with an initial capacity for Quads. diff --git a/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp index fc52c93355..ced17788d2 100644 --- a/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp @@ -75,7 +75,7 @@ bool CCTMXLayer::initWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerIn m_uMinGID = layerInfo->m_uMinGID; m_uMaxGID = layerInfo->m_uMaxGID; m_cOpacity = layerInfo->m_cOpacity; - setProperties(CCDictionary::createWithDictionary(layerInfo->getProperties())); + setProperties(CCDictionary::create(layerInfo->getProperties())); m_fContentScaleFactor = CCDirector::sharedDirector()->getContentScaleFactor(); // tilesetInfo diff --git a/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index c6e86f7d02..2751d17e80 100644 --- a/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -22628adfacd66254448f16f59cb8bd2af00a92ac \ No newline at end of file +95b4c2c0005c822aadfa31b31b2e92d2d0e21662 \ No newline at end of file diff --git a/template/msvc/CCAppWiz.win32/Templates/1033/Resources/hello.lua b/template/msvc/CCAppWiz.win32/Templates/1033/Resources/hello.lua index 0f99068474..33efc36f37 100644 --- a/template/msvc/CCAppWiz.win32/Templates/1033/Resources/hello.lua +++ b/template/msvc/CCAppWiz.win32/Templates/1033/Resources/hello.lua @@ -26,7 +26,7 @@ local function creatDog() rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight) local frame1 = CCSpriteFrame:create(textureDog, rect) - local spriteDog = CCSprite:createWithSpriteFrame(frame0) + local spriteDog = CCSprite:create(frame0) spriteDog.isPaused = false spriteDog:setPosition(0, winSize.height / 4 * 3) @@ -35,7 +35,7 @@ local function creatDog() animFrames:addObject(frame0) animFrames:addObject(frame1) - local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.5) + local animation = CCAnimation:create(animFrames, 0.5) local animate = CCAnimate:create(animation); spriteDog:runAction(CCRepeatForever:create(animate)) @@ -76,11 +76,10 @@ local function createLayerFram() end -- add crop - local textureCrop = CCTextureCache:sharedTextureCache():addImage("crop.png") - local frameCrop = CCSpriteFrame:create(textureCrop, CCRectMake(0, 0, 105, 95)) + local frameCrop = CCSpriteFrame:create("crop.png", CCRectMake(0, 0, 105, 95)) for i = 0, 3 do for j = 0, 1 do - local spriteCrop = CCSprite:createWithSpriteFrame(frameCrop); + local spriteCrop = CCSprite:create(frameCrop); spriteCrop:setPosition(10 + 200 + j * 180 - i % 2 * 90, 30 + 10 + i * 95 / 2) layerFarm:addChild(spriteCrop) end diff --git a/template/xcode4/cocos2dx_lua.xctemplate/Resources/hello.lua b/template/xcode4/cocos2dx_lua.xctemplate/Resources/hello.lua index 0f99068474..33efc36f37 100644 --- a/template/xcode4/cocos2dx_lua.xctemplate/Resources/hello.lua +++ b/template/xcode4/cocos2dx_lua.xctemplate/Resources/hello.lua @@ -26,7 +26,7 @@ local function creatDog() rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight) local frame1 = CCSpriteFrame:create(textureDog, rect) - local spriteDog = CCSprite:createWithSpriteFrame(frame0) + local spriteDog = CCSprite:create(frame0) spriteDog.isPaused = false spriteDog:setPosition(0, winSize.height / 4 * 3) @@ -35,7 +35,7 @@ local function creatDog() animFrames:addObject(frame0) animFrames:addObject(frame1) - local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.5) + local animation = CCAnimation:create(animFrames, 0.5) local animate = CCAnimate:create(animation); spriteDog:runAction(CCRepeatForever:create(animate)) @@ -76,11 +76,10 @@ local function createLayerFram() end -- add crop - local textureCrop = CCTextureCache:sharedTextureCache():addImage("crop.png") - local frameCrop = CCSpriteFrame:create(textureCrop, CCRectMake(0, 0, 105, 95)) + local frameCrop = CCSpriteFrame:create("crop.png", CCRectMake(0, 0, 105, 95)) for i = 0, 3 do for j = 0, 1 do - local spriteCrop = CCSprite:createWithSpriteFrame(frameCrop); + local spriteCrop = CCSprite:create(frameCrop); spriteCrop:setPosition(10 + 200 + j * 180 - i % 2 * 90, 30 + 10 + i * 95 / 2) layerFarm:addChild(spriteCrop) end diff --git a/tests/tests/LabelTest/LabelTest.cpp b/tests/tests/LabelTest/LabelTest.cpp index 8b5c1a3b7b..c5da591143 100644 --- a/tests/tests/LabelTest/LabelTest.cpp +++ b/tests/tests/LabelTest/LabelTest.cpp @@ -195,7 +195,7 @@ void AtlasDemo::backCallback(CCObject* pSender) //------------------------------------------------------------------ Atlas1::Atlas1() { - m_textureAtlas = CCTextureAtlas::textureAtlasWithFile(s_AtlasTest, 3); m_textureAtlas->retain(); + m_textureAtlas = CCTextureAtlas::create(s_AtlasTest, 3); m_textureAtlas->retain(); CCSize s = CCDirector::sharedDirector()->getWinSize(); @@ -1390,7 +1390,7 @@ std::string BMFontOneAtlas::subtitle() /// BMFontUnicode BMFontUnicode::BMFontUnicode() { - CCDictionary *strings = CCDictionary::createWithContentsOfFile("fonts/strings.xml"); + CCDictionary *strings = CCDictionary::create("fonts/strings.xml"); const char *chinese = ((CCString*)strings->objectForKey("chinese1"))->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(); diff --git a/tests/tests/ParticleTest/ParticleTest.cpp b/tests/tests/ParticleTest/ParticleTest.cpp index 3d8f5f3309..75f434a9f0 100644 --- a/tests/tests/ParticleTest/ParticleTest.cpp +++ b/tests/tests/ParticleTest/ParticleTest.cpp @@ -1239,7 +1239,7 @@ void ParticleBatchHybrid::onEnter() m_emitter = CCParticleSystemQuad::create("Particles/LavaFlow.plist"); m_emitter->retain(); - CCParticleBatchNode *batch = CCParticleBatchNode::createWithTexture(m_emitter->getTexture()); + CCParticleBatchNode *batch = CCParticleBatchNode::create(m_emitter->getTexture()); batch->addChild(m_emitter); @@ -1298,7 +1298,7 @@ void ParticleBatchMultipleEmitters::onEnter() emitter2->setPosition(ccp( s.width/2, s.height/2)); emitter3->setPosition(ccp( s.width/4, s.height/4)); - CCParticleBatchNode *batch = CCParticleBatchNode::createWithTexture(emitter1->getTexture()); + CCParticleBatchNode *batch = CCParticleBatchNode::create(emitter1->getTexture()); batch->addChild(emitter1, 0); batch->addChild(emitter2, 0); @@ -1330,7 +1330,7 @@ void ParticleReorder::onEnter() CCParticleSystem* ignore = CCParticleSystemQuad::create("Particles/SmallSun.plist"); CCNode *parent1 = CCNode::create(); - CCNode *parent2 = CCParticleBatchNode::createWithTexture(ignore->getTexture()); + CCNode *parent2 = CCParticleBatchNode::create(ignore->getTexture()); ignore->unscheduleUpdate(); for( unsigned int i=0; i<2;i++) @@ -1646,7 +1646,7 @@ void AddAndDeleteParticleSystems::onEnter() m_background = NULL; //adds the texture inside the plist to the texture cache - m_pBatchNode = CCParticleBatchNode::createWithTexture(NULL, 16000); + m_pBatchNode = CCParticleBatchNode::create((CCTexture2D*)NULL, 16000); addChild(m_pBatchNode, 1, 2); diff --git a/tests/tests/PerformanceTest/PerformanceNodeChildrenTest.cpp b/tests/tests/PerformanceTest/PerformanceNodeChildrenTest.cpp index 732b60e341..3dfbd8b1f5 100644 --- a/tests/tests/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/tests/tests/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -180,7 +180,7 @@ void IterateSpriteSheet::updateQuantityOfNodes() { for(int i = 0; i < (quantityOfNodes-currentQuantityOfNodes); i++) { - CCSprite *sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0, 0, 32, 32)); + CCSprite *sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0, 0, 32, 32)); batchNode->addChild(sprite); 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++) { - CCSprite *sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0, 0, 32, 32)); + CCSprite *sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0, 0, 32, 32)); batchNode->addChild(sprite); sprite->setPosition(ccp( CCRANDOM_0_1()*s.width, CCRANDOM_0_1()*s.height)); sprite->setVisible(false); @@ -382,7 +382,7 @@ void AddSpriteSheet::update(float dt) // Don't include the sprite creation time and random as part of the profiling for(int i=0; igetTexture(), CCRectMake(0,0,32,32)); + CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32)); sprites->addObject(pSprite); zs[i] = CCRANDOM_MINUS1_1() * 50; } @@ -445,7 +445,7 @@ void RemoveSpriteSheet::update(float dt) // Don't include the sprite creation time as part of the profiling for(int i=0;igetTexture(), CCRectMake(0,0,32,32)); + CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32)); sprites->addObject(pSprite); } @@ -505,7 +505,7 @@ void ReorderSpriteSheet::update(float dt) // Don't include the sprite creation time as part of the profiling for(int i=0;igetTexture(), CCRectMake(0,0,32,32)); + CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32)); sprites->addObject(pSprite); } diff --git a/tests/tests/PerformanceTest/PerformanceSpriteTest.cpp b/tests/tests/PerformanceTest/PerformanceSpriteTest.cpp index b174e03007..af15df7b44 100644 --- a/tests/tests/PerformanceTest/PerformanceSpriteTest.cpp +++ b/tests/tests/PerformanceTest/PerformanceSpriteTest.cpp @@ -130,7 +130,7 @@ CCSprite* SubTest::createSpriteWithTag(int tag) case 2: case 3: { - sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0, 0, 52, 139)); + sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0, 0, 52, 139)); batchNode->addChild(sprite, 0, tag+100); break; } @@ -154,7 +154,7 @@ CCSprite* SubTest::createSpriteWithTag(int tag) x *= 85; y *= 121; - sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(x,y,85,121)); + sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(x,y,85,121)); batchNode->addChild(sprite, 0, tag+100); break; } @@ -185,7 +185,7 @@ CCSprite* SubTest::createSpriteWithTag(int tag) x *= 32; y *= 32; - sprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(x,y,32,32)); + sprite = CCSprite::create(batchNode->getTexture(), CCRectMake(x,y,32,32)); batchNode->addChild(sprite, 0, tag+100); break; } diff --git a/tests/tests/RenderTextureTest/RenderTextureTest.cpp b/tests/tests/RenderTextureTest/RenderTextureTest.cpp index b156546d3f..97d55c4f6e 100644 --- a/tests/tests/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/tests/RenderTextureTest/RenderTextureTest.cpp @@ -188,7 +188,7 @@ void RenderTextureSave::saveImage(cocos2d::CCObject *pSender) CC_SAFE_DELETE(pImage); - CCSprite *sprite = CCSprite::createWithTexture(tex); + CCSprite *sprite = CCSprite::create(tex); sprite->setScale(0.3f); addChild(sprite); @@ -457,7 +457,7 @@ void RenderTextureZbuffer::renderScreenShot() texture->end(); - CCSprite *sprite = CCSprite::createWithTexture(texture->getSprite()->getTexture()); + CCSprite *sprite = CCSprite::create(texture->getSprite()->getTexture()); sprite->setPosition(ccp(256, 256)); sprite->setOpacity(182); diff --git a/tests/tests/ShaderTest/ShaderTest.cpp b/tests/tests/ShaderTest/ShaderTest.cpp index d99c78025e..e9d0d99eeb 100644 --- a/tests/tests/ShaderTest/ShaderTest.cpp +++ b/tests/tests/ShaderTest/ShaderTest.cpp @@ -475,7 +475,7 @@ bool SpriteBlur::initWithTexture(CCTexture2D* texture, const CCRect& rect) blur_ = ccp(1/s.width, 1/s.height); sub_[0] = sub_[1] = sub_[2] = sub_[3] = 0; - GLchar * fragSource = (GLchar*) CCString::createWithContentsOfFile( + GLchar * fragSource = (GLchar*) CCString::create( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_Blur.fsh"))->getCString(); CCGLProgram* pProgram = new CCGLProgram(); pProgram->initWithVertexShaderByteArray(ccPositionTextureColor_vert, fragSource); @@ -630,7 +630,7 @@ bool ShaderRetroEffect::init() { if( ShaderTestDemo::init() ) { - GLchar * fragSource = (GLchar*) CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_HorizontalColor.fsh"))->getCString(); + GLchar * fragSource = (GLchar*) CCString::create(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_HorizontalColor.fsh"))->getCString(); CCGLProgram *p = new CCGLProgram(); p->initWithVertexShaderByteArray(ccPositionTexture_vert, fragSource); diff --git a/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id b/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id index 5f7a8ab926..5404304a26 100644 --- a/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id +++ b/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id @@ -1 +1 @@ -830b848e5d80adc751de8b576dfeba1423ff77b4 \ No newline at end of file +ce063dda23d6a1bcfed54ba357a7aded426ea89e \ No newline at end of file diff --git a/tests/tests/Texture2dTest/Texture2dTest.cpp b/tests/tests/Texture2dTest/Texture2dTest.cpp index 979536e486..05aabb1b9b 100644 --- a/tests/tests/Texture2dTest/Texture2dTest.cpp +++ b/tests/tests/Texture2dTest/Texture2dTest.cpp @@ -283,12 +283,12 @@ void TextureMipMap::onEnter() CCTexture2D *texture1 = CCTextureCache::sharedTextureCache()->addImage("Images/grossini_dance_atlas_nomipmap.png"); - CCSprite *img0 = CCSprite::createWithTexture(texture0); + CCSprite *img0 = CCSprite::create(texture0); img0->setTextureRect(CCRectMake(85, 121, 85, 121)); img0->setPosition(ccp( s.width/3.0f, s.height/2.0f)); addChild(img0); - CCSprite *img1 = CCSprite::createWithTexture(texture1); + CCSprite *img1 = CCSprite::create(texture1); img1->setTextureRect(CCRectMake(85, 121, 85, 121)); img1->setPosition(ccp( 2*s.width/3.0f, s.height/2.0f)); addChild(img1); @@ -1162,7 +1162,7 @@ void TextureAsync::imageLoaded(CCObject* pObj) // This test just creates a sprite based on the Texture - CCSprite *sprite = CCSprite::createWithTexture(tex); + CCSprite *sprite = CCSprite::create(tex); sprite->setAnchorPoint(ccp(0,0)); addChild(sprite, -1); diff --git a/tests/tests/TileMapTest/TileMapTest.cpp b/tests/tests/TileMapTest/TileMapTest.cpp index 334ccddbc6..17710948bf 100644 --- a/tests/tests/TileMapTest/TileMapTest.cpp +++ b/tests/tests/TileMapTest/TileMapTest.cpp @@ -1254,7 +1254,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() string resources = "TileMaps"; // partial paths are OK as resource paths. string file = resources + "/orthogonal-test1.tmx"; - CCString* str = CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str())); + CCString* str = CCString::create(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str())); CCAssert(str != NULL, "Unable to open file"); CCTMXTiledMap *map = CCTMXTiledMap::create(str->getCString() ,resources.c_str()); diff --git a/tests/tests/ZwoptexTest/ZwoptexTest.cpp b/tests/tests/ZwoptexTest/ZwoptexTest.cpp index bb143af603..375967147c 100644 --- a/tests/tests/ZwoptexTest/ZwoptexTest.cpp +++ b/tests/tests/ZwoptexTest/ZwoptexTest.cpp @@ -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))); addChild(layer1); - sprite1 = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_01.png")); + sprite1 = CCSprite::create(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_01.png")); sprite1->setPosition(ccp( s.width/2-80, s.height/2)); 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))); addChild(layer2); - sprite2 = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_generic_01.png")); + sprite2 = CCSprite::create(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("grossini_dance_generic_01.png")); sprite2->setPosition(ccp( s.width/2 + 80, s.height/2)); addChild(sprite2); diff --git a/tools/tolua++/CCAnimation.pkg b/tools/tolua++/CCAnimation.pkg index 0e528ed731..c7c3f9de9f 100644 --- a/tools/tolua++/CCAnimation.pkg +++ b/tools/tolua++/CCAnimation.pkg @@ -23,9 +23,9 @@ class CCAnimation : public CCObject ~CCAnimation(void); static CCAnimation* create(void); - static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames); - static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay); - static CCAnimation* createWithAnimationFrames(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops); + static CCAnimation* create(CCArray* arrayOfSpriteFrameNames); + static CCAnimation* create(CCArray* arrayOfSpriteFrameNames, float delay); + static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops); void addSpriteFrame(CCSpriteFrame *pFrame); void addSpriteFrameWithFileName(const char *pszFileName); diff --git a/tools/tolua++/CCArray.pkg b/tools/tolua++/CCArray.pkg index c075ca8763..7b7a15e9da 100644 --- a/tools/tolua++/CCArray.pkg +++ b/tools/tolua++/CCArray.pkg @@ -1,12 +1,10 @@ class CCArray : public CCObject { -public: - static CCArray* create(); static CCArray* createWithObject(CCObject* pObject); + static CCArray* create(const char* pFileName); static CCArray* create(unsigned int capacity); static CCArray* create(CCArray* otherArray); - static CCArray* createWithContentsOfFile(const char* pFileName); unsigned int count(); @@ -52,4 +50,4 @@ public: void replaceObjectAtIndex(unsigned int uIndex, CCObject* pObject, bool bReleaseObject = true); -}; \ No newline at end of file +}; diff --git a/tools/tolua++/CCDictionary.pkg b/tools/tolua++/CCDictionary.pkg index 3c87553265..218e0f5ca2 100644 --- a/tools/tolua++/CCDictionary.pkg +++ b/tools/tolua++/CCDictionary.pkg @@ -19,8 +19,8 @@ class CCDictionary : public CCObject void removeAllObjects(); static CCDictionary* create(); - static CCDictionary* createWithDictionary(CCDictionary* srcDict); - static CCDictionary* createWithContentsOfFile(const char *pFileName); + static CCDictionary* create(CCDictionary* srcDict); + static CCDictionary* create(const char *pFileName); }; diff --git a/tools/tolua++/CCLayer.pkg b/tools/tolua++/CCLayer.pkg index 6085bd9074..25c47c2a6b 100644 --- a/tools/tolua++/CCLayer.pkg +++ b/tools/tolua++/CCLayer.pkg @@ -62,5 +62,5 @@ class CCLayerMultiplex : public CCLayer void switchTo(unsigned int n); void switchToAndReleaseMe(unsigned int n); - static CCLayerMultiplex * create(CCLayer* layer); + static CCLayerMultiplex * createWithLayer(CCLayer* layer); }; diff --git a/tools/tolua++/CCParticleBatchNode.pkg b/tools/tolua++/CCParticleBatchNode.pkg new file mode 100644 index 0000000000..f30ecec06e --- /dev/null +++ b/tools/tolua++/CCParticleBatchNode.pkg @@ -0,0 +1,23 @@ +class CCParticleBatchNode : public CCNode, public CCTextureProtocol +{ +public: + static CCParticleBatchNode* create(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity); + static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity); + + virtual void addChild(CCNode * child); + virtual void addChild(CCNode * child, int zOrder); + virtual void addChild(CCNode * child, int zOrder, int tag); + + void insertChild(CCParticleSystem* pSystem, unsigned int index); + + virtual void removeChild(CCNode* child, bool cleanup); + virtual void reorderChild(CCNode * child, int zOrder); + void removeChildAtIndex(unsigned int index, bool doCleanup); + void removeAllChildrenWithCleanup(bool doCleanup); + void disableParticle(unsigned int particleIndex); + + virtual CCTexture2D* getTexture(void); + virtual void setTexture(CCTexture2D *texture); + virtual void setBlendFunc(ccBlendFunc blendFunc); + virtual ccBlendFunc getBlendFunc(void); +}; diff --git a/tools/tolua++/CCSprite.pkg b/tools/tolua++/CCSprite.pkg index 2bbbe57584..550bc8ecb0 100644 --- a/tools/tolua++/CCSprite.pkg +++ b/tools/tolua++/CCSprite.pkg @@ -62,7 +62,7 @@ class CCSprite : public CCNode void updateTransform(void); //void useSelfRender(void); - void setTextureRect(CCRect rect); + void setTextureRect(CCRect rect); //void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size); //void useBatchNode(CCSpriteBatchNode *batchNode); void setDisplayFrame(CCSpriteFrame *pNewFrame); @@ -70,12 +70,12 @@ class CCSprite : public CCNode //CCSpriteFrame* displayedFrame(void); void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex); - static CCSprite* createWithTexture(CCTexture2D *pTexture); - static CCSprite* createWithTexture(CCTexture2D *pTexture, CCRect rect); + static CCSprite* create(CCTexture2D *pTexture); + static CCSprite* create(CCTexture2D *pTexture, CCRect rect); // static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset); - static CCSprite* createWithSpriteFrame(CCSpriteFrame *pSpriteFrame); + static CCSprite* create(CCSpriteFrame *pSpriteFrame); static CCSprite* createWithSpriteFrameName(const char *pszSpriteFrameName); - static CCSprite* create(const char *pszFileName); + static CCSprite* create(const char *pszFileName); static CCSprite* create(const char *pszFileName, CCRect rect); //static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect); }; diff --git a/tools/tolua++/CCSpriteBatchNode.pkg b/tools/tolua++/CCSpriteBatchNode.pkg index 629266d7cd..d644d65783 100644 --- a/tools/tolua++/CCSpriteBatchNode.pkg +++ b/tools/tolua++/CCSpriteBatchNode.pkg @@ -20,8 +20,8 @@ class CCSpriteBatchNode : public CCNode void setBlendFunc(ccBlendFunc blendFunc); ccBlendFunc getBlendFunc(void); - static CCSpriteBatchNode* createWithTexture(CCTexture2D *tex); - static CCSpriteBatchNode* createWithTexture(CCTexture2D* tex, unsigned int capacity); + static CCSpriteBatchNode* create(CCTexture2D *tex); + static CCSpriteBatchNode* create(CCTexture2D* tex, unsigned int capacity); static CCSpriteBatchNode* create(const char* fileImage); static CCSpriteBatchNode* create(const char* fileImage, unsigned int capacity); }; diff --git a/tools/tolua++/CCSpriteFrame.pkg b/tools/tolua++/CCSpriteFrame.pkg index 7ec0e5578a..10e7047f10 100644 --- a/tools/tolua++/CCSpriteFrame.pkg +++ b/tools/tolua++/CCSpriteFrame.pkg @@ -21,6 +21,6 @@ class CCSpriteFrame : public CCObject static CCSpriteFrame* create(CCTexture2D* pobTexture, CCRect rect); static CCSpriteFrame* create(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize); - static CCSpriteFrame* createWithTextureFilename(const char* filename, CCRect rect); - static CCSpriteFrame* createWithTextureFilename(const char* filename, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize); + static CCSpriteFrame* create(const char* filename, CCRect rect); + static CCSpriteFrame* create(const char* filename, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize); }; diff --git a/tools/tolua++/CCString.pkg b/tools/tolua++/CCString.pkg index ea8df4181a..714e34af75 100644 --- a/tools/tolua++/CCString.pkg +++ b/tools/tolua++/CCString.pkg @@ -12,7 +12,7 @@ class CCString : public CCObject bool isEqual(const CCObject* pObject); static CCString* create(const char* pStr); - static CCString* createWithData(unsigned char* pData, unsigned long nLen); + static CCString* create(unsigned char* pData, unsigned long nLen); static CCString* createWithContentsOfFile(const char* pszFileName); }; diff --git a/tools/tolua++/CCTextureAtlas.pkg b/tools/tolua++/CCTextureAtlas.pkg index 78067dd172..680bdd0d84 100644 --- a/tools/tolua++/CCTextureAtlas.pkg +++ b/tools/tolua++/CCTextureAtlas.pkg @@ -21,6 +21,6 @@ class CCTextureAtlas : public CCObject void drawQuads(); - static CCTextureAtlas* textureAtlasWithFile(const char* file , unsigned int capacity); - static CCTextureAtlas* textureAtlasWithTexture(CCTexture2D *texture, unsigned int capacity); + static CCTextureAtlas* create(const char* file , unsigned int capacity); + static CCTextureAtlas* create(CCTexture2D *texture, unsigned int capacity); }; diff --git a/tools/tolua++/Cocos2d.pkg b/tools/tolua++/Cocos2d.pkg index ea5b7b7127..9479c1d8e9 100644 --- a/tools/tolua++/Cocos2d.pkg +++ b/tools/tolua++/Cocos2d.pkg @@ -34,6 +34,7 @@ $pfile "CCNode.pkg" $pfile "CCObject.pkg" $pfile "CCParallaxNode.pkg" $pfile "CCParticleSystem.pkg" +$pfile "CCParticleBatchNode.pkg" $pfile "CCPointExtension.pkg" $pfile "CCProgressTimer.pkg" $pfile "CCRenderTexture.pkg" diff --git a/tools/tolua++/basic.lua b/tools/tolua++/basic.lua index ccc153f707..dcfff784f9 100644 --- a/tools/tolua++/basic.lua +++ b/tools/tolua++/basic.lua @@ -105,7 +105,7 @@ local CCObjectTypes = { "CCMotionStreak", "CCParallaxNode", "CCParticleSystem", - "CCParticleSystemPoint", + "CCParticleBatchNode", "CCParticleSystemQuad", "CCProgressTimer", "CCRenderTexture",