Merge branch 'upto-0.99.5' of https://github.com/cocos2d/cocos2d-x into merger

This commit is contained in:
minggo 2011-01-06 10:24:29 +08:00
commit e312bb4d18
17 changed files with 154 additions and 73 deletions

View File

@ -48,6 +48,12 @@ public:
@warning If you get the file data succeed,you must delete it after used. @warning If you get the file data succeed,you must delete it after used.
*/ */
static unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize); static unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize);
/** removes the HD suffix from a path
@returns const char * without the HD suffix
@since v0.99.5
*/
static const char* ccRemoveHDSuffixFromFile(const char* path);
}; };
} // namespace cocos2d } // namespace cocos2d

View File

@ -145,7 +145,6 @@ namespace cocos2d{
} }
CCMenuItemLabel::~CCMenuItemLabel() CCMenuItemLabel::~CCMenuItemLabel()
{ {
CCX_SAFE_RELEASE(m_pLabel);
} }
void CCMenuItemLabel::setString(const char * label) void CCMenuItemLabel::setString(const char * label)
{ {
@ -378,9 +377,10 @@ namespace cocos2d{
{ {
assert(normalSprite != NULL); assert(normalSprite != NULL);
CCMenuItem::initWithTarget(target, selector); CCMenuItem::initWithTarget(target, selector);
this->m_pNormalImage = normalSprite; CCX_SAFE_RETAIN(normalSprite); setNormalImage(normalSprite);
this->m_pSelectedImage = selectedSprite; CCX_SAFE_RETAIN(selectedSprite); setSelectedImage(selectedSprite);
this->m_pDisabledImage = disabledSprite; CCX_SAFE_RETAIN(disabledSprite); setDisabledImage(disabledSprite);
this->setContentSize(m_pNormalImage->getContentSize()); this->setContentSize(m_pNormalImage->getContentSize());
return true; return true;
} }

View File

@ -53,7 +53,15 @@ bool CCParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
} }
// initialize only once the texCoords and the indices // initialize only once the texCoords and the indices
this->initTexCoordsWithRect(CGRectMake((float)0, (float)0, (float)m_pTexture->getPixelsWide(), (float)m_pTexture->getPixelsHigh())); if (m_pTexture)
{
this->initTexCoordsWithRect(CGRectMake((float)0, (float)0, (float)m_pTexture->getPixelsWide(), (float)m_pTexture->getPixelsHigh()));
}
else
{
this->initTexCoordsWithRect(CGRectMake((float)0, (float)0, (float)1, (float)1));
}
this->initIndices(); this->initIndices();
#if CC_USES_VBO #if CC_USES_VBO
@ -89,8 +97,14 @@ void CCParticleSystemQuad::initTexCoordsWithRect(CGRect pointRect)
pointRect.size.width * CC_CONTENT_SCALE_FACTOR(), pointRect.size.width * CC_CONTENT_SCALE_FACTOR(),
pointRect.size.height * CC_CONTENT_SCALE_FACTOR()); pointRect.size.height * CC_CONTENT_SCALE_FACTOR());
GLfloat wide = (GLfloat)m_pTexture->getPixelsWide(); GLfloat wide = (GLfloat) pointRect.size.width;
GLfloat high = (GLfloat)m_pTexture->getPixelsHigh(); GLfloat high = (GLfloat) pointRect.size.height;
if (m_pTexture)
{
wide = (GLfloat)m_pTexture->getPixelsWide();
high = (GLfloat)m_pTexture->getPixelsHigh();
}
#if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL #if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
GLfloat left = (rect.origin.x*2+1) / (wide*2); GLfloat left = (rect.origin.x*2+1) / (wide*2);

View File

@ -284,11 +284,10 @@ void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
delete m_pobOpenGLView; // [openGLView_ release] delete m_pobOpenGLView; // [openGLView_ release]
m_pobOpenGLView = pobOpenGLView; m_pobOpenGLView = pobOpenGLView;
setGLDefaultValues();
// set size // set size
m_obWinSizeInPoints = CCNSSizeToCGSize(m_pobOpenGLView->getSize()); m_obWinSizeInPoints = CCNSSizeToCGSize(m_pobOpenGLView->getSize());
m_obWinSizeInPixels = CGSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor); m_obWinSizeInPixels = CGSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor);
setGLDefaultValues();
if (m_fContentScaleFactor != 1) if (m_fContentScaleFactor != 1)
{ {
@ -297,7 +296,7 @@ void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
CCTouchDispatcher *pTouchDispatcher = CCTouchDispatcher::sharedDispatcher(); CCTouchDispatcher *pTouchDispatcher = CCTouchDispatcher::sharedDispatcher();
m_pobOpenGLView->setTouchDelegate(pTouchDispatcher); m_pobOpenGLView->setTouchDelegate(pTouchDispatcher);
pTouchDispatcher->setDispatchEvents(true); pTouchDispatcher->setDispatchEvents(true);
} }
} }

View File

@ -84,7 +84,7 @@ namespace cocos2d{
{ {
s.height -= r.size.height; s.height -= r.size.height;
} }
this->m_tPosition = ccp(s.width/2, s.height/2); setPosition(ccp(s.width/2, s.height/2));
int z=0; int z=0;

View File

@ -223,11 +223,11 @@ void CCNode::setPosition(CGPoint newPosition)
m_tPosition = newPosition; m_tPosition = newPosition;
if (CC_CONTENT_SCALE_FACTOR() == 1) if (CC_CONTENT_SCALE_FACTOR() == 1)
{ {
m_tAnchorPointInPixels = m_tPosition; m_tPositionInPixels = m_tPosition;
} }
else else
{ {
m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); m_tPositionInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR());
} }
m_bIsTransformDirty = m_bIsInverseDirty = true; m_bIsTransformDirty = m_bIsInverseDirty = true;
@ -343,7 +343,17 @@ void CCNode::setContentSize(CGSize size)
if( ! CGSize::CGSizeEqualToSize(size, m_tContentSize) ) if( ! CGSize::CGSizeEqualToSize(size, m_tContentSize) )
{ {
m_tContentSize = size; m_tContentSize = size;
m_tAnchorPointInPixels = ccp( m_tContentSize.width * m_tAnchorPoint.x, m_tContentSize.height * m_tAnchorPoint.y );
if( CC_CONTENT_SCALE_FACTOR() == 1 )
{
m_tContentSizeInPixels = m_tContentSize;
}
else
{
m_tContentSizeInPixels = CGSizeMake( size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
}
m_tAnchorPointInPixels = ccp( m_tContentSizeInPixels.width * m_tAnchorPoint.x, m_tContentSizeInPixels.height * m_tAnchorPoint.y );
m_bIsTransformDirty = m_bIsInverseDirty = true; m_bIsTransformDirty = m_bIsInverseDirty = true;
#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX #ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX
m_bIsTransformGLDirty = true; m_bIsTransformGLDirty = true;
@ -641,35 +651,30 @@ void CCNode::detachChild(CCNode *child, bool doCleanup)
// helper used by reorderChild & add // helper used by reorderChild & add
void CCNode::insertChild(CCNode* child, int z) void CCNode::insertChild(CCNode* child, int z)
{ {
unsigned int index=0; unsigned int index = 0;
CCNode* a = m_pChildren->getLastObject();
if (!a || a->getZOrder() <= z)
{
m_pChildren->addObject(child);
}
else
{
CCNode* pNode;
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
for( it = m_pChildren->begin(); it != m_pChildren->end(); it++)
{
pNode = (*it);
if(m_pChildren && m_pChildren->count() > 0) if ( pNode && pNode->m_nZOrder > z )
{ {
CCNode* pNode = m_pChildren->getLastObject(); m_pChildren->insertObjectAtIndex(child, index);
break;
}
index++;
}
}
// // quick comparison to improve performance child->setZOrder(z);
if (! pNode || pNode->getZOrder() <= z)
{
m_pChildren->addObject(child);
}
else
{
NSMutableArray<CCNode*>::NSMutableArrayIterator it;
for( it = m_pChildren->begin(); it != m_pChildren->end(); it++)
{
pNode = (*it);
if ( pNode && pNode->m_nZOrder > z )
{
m_pChildren->insertObjectAtIndex(child, index);
break;
}
index++;
}
}
}
child->setZOrder(z);
} }
void CCNode::reorderChild(CCNode *child, int zOrder) void CCNode::reorderChild(CCNode *child, int zOrder)
@ -809,9 +814,9 @@ void CCNode::transform()
glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0);
if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0) if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0)
glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPosition.y + m_tAnchorPointInPixels.y), m_fVertexZ); glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPositionInPixels.y + m_tAnchorPointInPixels.y), m_fVertexZ);
else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0) else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0)
glTranslatef( RENDER_IN_SUBPIXEL(m_tPosition.x), RENDER_IN_SUBPIXEL(m_tPosition.y), m_fVertexZ ); glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x), RENDER_IN_SUBPIXEL(m_tPositionInPixels.y), m_fVertexZ );
// rotate // rotate
if (m_fRotation != 0.0f ) if (m_fRotation != 0.0f )
@ -967,7 +972,7 @@ CGAffineTransform CCNode::nodeToParentTransform(void)
m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tAnchorPointInPixels.x, m_tAnchorPointInPixels.y); m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tAnchorPointInPixels.x, m_tAnchorPointInPixels.y);
if( ! CGPoint::CGPointEqualToPoint(m_tPositionInPixels, CGPointZero) ) if( ! CGPoint::CGPointEqualToPoint(m_tPositionInPixels, CGPointZero) )
m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tPositionInPixels.x, m_tPosition.y); m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tPositionInPixels.x, m_tPositionInPixels.y);
if( m_fRotation != 0 ) if( m_fRotation != 0 )
m_tTransform = CGAffineTransformRotate(m_tTransform, -CC_DEGREES_TO_RADIANS(m_fRotation)); m_tTransform = CGAffineTransformRotate(m_tTransform, -CC_DEGREES_TO_RADIANS(m_fRotation));
if( ! (m_fScaleX == 1 && m_fScaleY == 1) ) if( ! (m_fScaleX == 1 && m_fScaleY == 1) )

View File

@ -74,7 +74,7 @@ namespace cocos2d{
// XXX: in v0.7, winSize should return the visible size // XXX: in v0.7, winSize should return the visible size
// XXX: so the bar calculation should be done there // XXX: so the bar calculation should be done there
this->m_tPosition = ccp(s.width/2, s.height/2); setPosition(ccp(s.width/2, s.height/2));
int z=0; int z=0;

View File

@ -224,11 +224,11 @@ void CCNode::setPosition(CGPoint newPosition)
m_tPosition = newPosition; m_tPosition = newPosition;
if (CC_CONTENT_SCALE_FACTOR() == 1) if (CC_CONTENT_SCALE_FACTOR() == 1)
{ {
m_tAnchorPointInPixels = m_tPosition m_tPositionInPixels = m_tPosition
} }
else else
{ {
m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); m_tPositionInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR());
} }
m_bIsTransformDirty = m_bIsInverseDirty = true; m_bIsTransformDirty = m_bIsInverseDirty = true;
@ -239,11 +239,11 @@ void CCNode::setPosition(CGPoint newPosition)
void CCNode::setPositionInPixels(CGPoint newPosition) void CCNode::setPositionInPixels(CGPoint newPosition)
{ {
m_tAnchorPointInPixels = newPosition; m_tPositionInPixels = newPosition;
if ( CC_CONTENT_SCALE_FACTOR() == 1) if ( CC_CONTENT_SCALE_FACTOR() == 1)
{ {
m_tPosition = m_tAnchorPointInPixels; m_tPosition = m_tPositionInPixels;
} }
else else
{ {
@ -801,9 +801,9 @@ void CCNode::transform()
glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0);
if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0) if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0)
glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPosition.y + m_tAnchorPointInPixels.y), m_fVertexZ); glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPositionInPixels.y + m_tAnchorPointInPixels.y), m_fVertexZ);
else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0) else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0)
glTranslatef( RENDER_IN_SUBPIXEL(m_tPosition.x), RENDER_IN_SUBPIXEL(m_tPosition.y), m_fVertexZ ); glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x), RENDER_IN_SUBPIXEL(m_tPositionInPixels.y), m_fVertexZ );
// rotate // rotate
if (m_fRotation != 0.0f ) if (m_fRotation != 0.0f )

View File

@ -470,8 +470,33 @@ int CCFileUtils::ccLoadFileIntoMemory(const char *filename, unsigned char **out)
const char* CCFileUtils::ccRemoveHDSuffixFromFile( const char *path ) const char* CCFileUtils::ccRemoveHDSuffixFromFile( const char *path )
{ {
///@todo #if CC_IS_RETINA_DISPLAY_SUPPORTED
return NULL;
if( CC_CONTENT_SCALE_FACTOR() == 2 )
{
std::string curPath = path;
int pos = curPath.rfind("/");
std::string fileName = curPath.substr(pos + 1);
std::string filePath = "";
if (-1 != pos)
{
filePath = curPath.substr(0, pos);
}
int suffixPos = fileName.rfind(CC_RETINA_DISPLAY_FILENAME_SUFFIX);
if (-1 != suffixPos)
{
fileName.replace(pos, strlen(CC_RETINA_DISPLAY_FILENAME_SUFFIX), "");
}
std::string result = filePath + fileName;
return result.c_str();
}
#endif // CC_IS_RETINA_DISPLAY_SUPPORTED
return path;
} }
////////////////////////////////////////////////// //////////////////////////////////////////////////

View File

@ -342,7 +342,8 @@ void CCSprite::useSelfRender(void)
void CCSprite::useBatchNode(CCSpriteBatchNode *batchNode) void CCSprite::useBatchNode(CCSpriteBatchNode *batchNode)
{ {
m_bUsesBatchNode = true; m_bUsesBatchNode = true;
m_pobTextureAtlas = m_pobBatchNode->getTextureAtlas(); // weak ref m_pobTextureAtlas = batchNode->getTextureAtlas(); // weak ref
m_pobBatchNode = batchNode;
} }
void CCSprite::useSpriteSheetRender(CCSpriteSheetInternalOnly *pSpriteSheet) void CCSprite::useSpriteSheetRender(CCSpriteSheetInternalOnly *pSpriteSheet)

View File

@ -227,7 +227,7 @@ void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist)
// build texture path relative to plist file // build texture path relative to plist file
// stringByDeletingLastPathComponent // stringByDeletingLastPathComponent
string textureBase(pszPlist); string textureBase(pszPath);
int indexOfLastSeperator = textureBase.find_last_of('/'); int indexOfLastSeperator = textureBase.find_last_of('/');
if (indexOfLastSeperator == textureBase.length() - 1) if (indexOfLastSeperator == textureBase.length() - 1)
{ {
@ -245,6 +245,7 @@ void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist)
else else
{ {
// build texture path by replacing file extension // build texture path by replacing file extension
texturePath = pszPath;
// remove .xxx // remove .xxx
size_t startPos = texturePath.find_last_of("."); size_t startPos = texturePath.find_last_of(".");

View File

@ -95,4 +95,35 @@ unsigned char* FileUtils::getFileDataFromZip(const char* pszZipFilePath, const c
return pBuffer; return pBuffer;
} }
const char* FileUtils::ccRemoveHDSuffixFromFile(const char* path)
{
#if CC_IS_RETINA_DISPLAY_SUPPORTED
if( CC_CONTENT_SCALE_FACTOR() == 2 )
{
std::string curPath = path;
int pos = curPath.rfind("/");
std::string fileName = curPath.substr(pos + 1);
std::string filePath = "";
if (-1 != pos)
{
filePath = curPath.substr(0, pos);
}
int suffixPos = fileName.rfind(CC_RETINA_DISPLAY_FILENAME_SUFFIX);
if (-1 != suffixPos)
{
fileName.replace(pos, strlen(CC_RETINA_DISPLAY_FILENAME_SUFFIX), "");
}
std::string result = filePath + fileName;
return result.c_str();
}
#endif // CC_IS_RETINA_DISPLAY_SUPPORTED
return path;
}
} //namespace cocos2d } //namespace cocos2d

View File

@ -335,7 +335,7 @@ namespace cocos2d {
// get atlas index // get atlas index
unsigned int indexForZ = atlasIndexForExistantZ(z); unsigned int indexForZ = atlasIndexForExistantZ(z);
m_pReusedTile->setAtlasIndex(indexForZ); m_pReusedTile->setAtlasIndex(indexForZ);
m_pReusedTile->setDirty(YES); m_pReusedTile->setDirty(true);
m_pReusedTile->updateTransform(); m_pReusedTile->updateTransform();
m_pTiles[z] = gid; m_pTiles[z] = gid;

View File

@ -121,7 +121,7 @@ void Box2DTestLayer::addNewSpriteWithCoords(CGPoint p)
int idx = (CCRANDOM_0_1() > .5 ? 0:1); int idx = (CCRANDOM_0_1() > .5 ? 0:1);
int idy = (CCRANDOM_0_1() > .5 ? 0:1); int idy = (CCRANDOM_0_1() > .5 ? 0:1);
CCSprite *sprite = sheet->createSpriteWithRect( CGRectMake(32 * idx,32 * idy,32,32)); CCSprite *sprite = sheet->createSpriteWithRect( CGRectMake(32 * idx,32 * idy,32,32));
(CCNode*)(sheet)->addChild(sprite); sheet->addChild(sprite);
sprite->setPosition( CGPointMake( p.x, p.y) ); sprite->setPosition( CGPointMake( p.x, p.y) );

View File

@ -31,6 +31,8 @@
about Chipmunk which may change with little to no warning. about Chipmunk which may change with little to no warning.
*/ */
#include "cocos2d.h"
#include "cocos2dChipmunkDemo.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -38,9 +40,6 @@
#include <math.h> #include <math.h>
#include <limits.h> #include <limits.h>
#include "cocos2d.h"
#include "cocos2dChipmunkDemo.h"
#define SLEEP_TICKS 16 #define SLEEP_TICKS 16
//extern chipmunkDemo Test; //extern chipmunkDemo Test;

View File

@ -19,16 +19,16 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include "chipmunk.h"
#include "drawSpace.h"
#include "cocos2d.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include "chipmunk.h"
#include "drawSpace.h"
#include "cocos2d.h"
/* /*
IMPORTANT - READ ME! IMPORTANT - READ ME!

View File

@ -291,7 +291,7 @@ void SpriteSheet1::addNewSpriteWithCoords(CGPoint p)
CCSprite* sprite = CCSprite::spriteWithTexture(sheet->getTexture(), CGRectMake(x,y,85,121)); CCSprite* sprite = CCSprite::spriteWithTexture(sheet->getTexture(), CGRectMake(x,y,85,121));
(CCNode*)(sheet)->addChild(sprite); sheet->addChild(sprite);
sprite->setPosition( ccp( p.x, p.y) ); sprite->setPosition( ccp( p.x, p.y) );
@ -646,7 +646,7 @@ SpriteSheetReorder::SpriteSheetReorder()
for(int i=0; i<10; i++) for(int i=0; i<10; i++)
{ {
CCSprite* s1 = CCSprite::spriteWithSpriteSheet(asmtest, CGRectMake(0, 0, 50, 50)); CCSprite* s1 = CCSprite::spriteWithSpriteSheet((CCSpriteSheetInternalOnly* )asmtest, CGRectMake(0, 0, 50, 50));
a->addObject(s1); a->addObject(s1);
asmtest->addChild(s1, 10); asmtest->addChild(s1, 10);
} }
@ -718,7 +718,7 @@ SpriteSheetReorderIssue744::SpriteSheetReorderIssue744()
CCSpriteBatchNode* sheet = CCSpriteBatchNode::spriteSheetWithFile("Images/grossini_dance_atlas.png", 15); CCSpriteBatchNode* sheet = CCSpriteBatchNode::spriteSheetWithFile("Images/grossini_dance_atlas.png", 15);
addChild(sheet, 0, kTagSpriteSheet); addChild(sheet, 0, kTagSpriteSheet);
CCSprite* sprite = CCSprite::spriteWithSpriteSheet(sheet,CGRectMake(0, 0, 85, 121)); CCSprite* sprite = CCSprite::spriteWithSpriteSheet((CCSpriteSheetInternalOnly* )sheet,CGRectMake(0, 0, 85, 121));
sprite->setPosition( ccp(s.width/2, s.height/2) ); sprite->setPosition( ccp(s.width/2, s.height/2) );
sheet->addChild(sprite, 3); sheet->addChild(sprite, 3);
sheet->reorderChild(sprite, 1); sheet->reorderChild(sprite, 1);
@ -1871,12 +1871,12 @@ SpriteAnimationSplit::SpriteAnimationSplit()
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage("animations/dragon_animation.png"); CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage("animations/dragon_animation.png");
// manually add frames to the frame cache // manually add frames to the frame cache
CCSpriteFrame *frame0 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*0, 132*0, 132, 132), CGPointZero); CCSpriteFrame *frame0 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*0, 132*0, 132, 132));
CCSpriteFrame *frame1 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*1, 132*0, 132, 132), CGPointZero); CCSpriteFrame *frame1 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*1, 132*0, 132, 132));
CCSpriteFrame *frame2 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*2, 132*0, 132, 132), CGPointZero); CCSpriteFrame *frame2 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*2, 132*0, 132, 132));
CCSpriteFrame *frame3 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*3, 132*0, 132, 132), CGPointZero); CCSpriteFrame *frame3 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*3, 132*0, 132, 132));
CCSpriteFrame *frame4 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*0, 132*1, 132, 132), CGPointZero); CCSpriteFrame *frame4 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*0, 132*1, 132, 132));
CCSpriteFrame *frame5 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*1, 132*1, 132, 132), CGPointZero); CCSpriteFrame *frame5 = CCSpriteFrame::frameWithTexture(texture, CGRectMake(132*1, 132*1, 132, 132));
// //