Merge pull request #1064 from dumganhar/gles20

fixed #1367: Refactor "createWith***" to "create".
This commit is contained in:
James Chen 2012-06-27 01:50:03 -07:00
commit 2d581e5018
59 changed files with 244 additions and 216 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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");

View File

@ -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.");

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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))

View File

@ -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);

View File

@ -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);

View File

@ -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".

View File

@ -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");

View File

@ -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()

View File

@ -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,9 +347,9 @@ protected:
//
// Data used when the sprite is rendered using a CCSpriteSheet
//
CCTextureAtlas *m_pobTextureAtlas; // Sprite Sheet texture atlas (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)
CCSpriteBatchNode* m_pobBatchNode; // Used batch node (weak reference)
bool m_bDirty; // Sprite needs to be updated
bool m_bRecursiveDirty; // Subchildren needs to be updated
@ -361,7 +361,7 @@ protected:
// 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

View File

@ -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);

View File

@ -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.

View File

@ -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);
@ -199,7 +199,7 @@ CCTexture2D* CCSpriteFrame::getTexture(void)
return m_pobTexture;
}
if( m_strTextureFilename.length() <= 0 ) {
if( m_strTextureFilename.length() > 0 ) {
return CCTextureCache::sharedTextureCache()->addImage(m_strTextureFilename.c_str());
}
// no texture or texture filename

View File

@ -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.

View File

@ -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))

View File

@ -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.

View File

@ -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

View File

@ -1 +1 @@
22628adfacd66254448f16f59cb8bd2af00a92ac
95b4c2c0005c822aadfa31b31b2e92d2d0e21662

View File

@ -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

View File

@ -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

View File

@ -37,7 +37,7 @@
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration).win32\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration).win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration).win32\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration).win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
@ -64,7 +64,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\Classes;..\..\js\spidermonkey-win32\include;..\..\js\JSBindings;..\..\js\BindingsExample;..\..\cocos2dx;..\..\cocos2dx\include;..\..\cocos2dx\kazmath\include;..\..\cocos2dx\platform\win32;..\..\cocos2dx\platform\third_party\win32;..\..\cocos2dx\platform\third_party\win32\OGLES;..\..\CocosDenshion\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -72,7 +72,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4251;4800;4244;4390;4065;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4267;4251;4244</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -107,7 +107,7 @@ xcopy /Y /Q "$(SolutionDir)js\spidermonkey-win32\lib\*.*" "$(OutDir)"
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>.;..\Classes;..\..\js\spidermonkey-win32\include;..\..\js\JSBindings;..\..\js\BindingsExample;..\..\cocos2dx;..\..\cocos2dx\include;..\..\cocos2dx\kazmath\include;..\..\cocos2dx\platform\win32;..\..\cocos2dx\platform\third_party\win32;..\..\cocos2dx\platform\third_party\win32\OGLES;..\..\CocosDenshion\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -116,7 +116,7 @@ xcopy /Y /Q "$(SolutionDir)js\spidermonkey-win32\lib\*.*" "$(OutDir)"
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4267;4251;4244</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -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();

View File

@ -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);

View File

@ -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; i<totalToAdd; i++)
{
CCSprite* pSprite = CCSprite::createWithTexture(batchNode->getTexture(), 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;i<totalToAdd;i++)
{
CCSprite* pSprite = CCSprite::createWithTexture(batchNode->getTexture(), 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;i<totalToAdd;i++)
{
CCSprite* pSprite = CCSprite::createWithTexture(batchNode->getTexture(), CCRectMake(0,0,32,32));
CCSprite* pSprite = CCSprite::create(batchNode->getTexture(), CCRectMake(0,0,32,32));
sprites->addObject(pSprite);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -1 +1 @@
830b848e5d80adc751de8b576dfeba1423ff77b4
ce063dda23d6a1bcfed54ba357a7aded426ea89e

View File

@ -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);

View File

@ -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());

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)));
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);

View File

@ -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);

View File

@ -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();

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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);
};

View File

@ -70,10 +70,10 @@ 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, CCRect rect);

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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"

View File

@ -105,7 +105,7 @@ local CCObjectTypes = {
"CCMotionStreak",
"CCParallaxNode",
"CCParticleSystem",
"CCParticleSystemPoint",
"CCParticleBatchNode",
"CCParticleSystemQuad",
"CCProgressTimer",
"CCRenderTexture",