mirror of https://github.com/axmolengine/axmol.git
issue #645: update to v1.0.1
This commit is contained in:
parent
730ff63c9f
commit
09dc164fff
|
@ -102,7 +102,7 @@ bool CCDirector::init(void)
|
|||
|
||||
// FPS
|
||||
m_bDisplayFPS = false;
|
||||
m_nFrames = 0;
|
||||
m_uTotalFrames = m_uFrames = 0;
|
||||
m_pszFPS = new char[10];
|
||||
m_pLastUpdate = new struct cc_timeval();
|
||||
|
||||
|
@ -227,6 +227,8 @@ void CCDirector::drawScene(void)
|
|||
|
||||
glPopMatrix();
|
||||
|
||||
m_uTotalFrames++;
|
||||
|
||||
// swap buffers
|
||||
if (m_pobOpenGLView)
|
||||
{
|
||||
|
@ -669,13 +671,13 @@ void CCDirector::resume(void)
|
|||
// updates the FPS every frame
|
||||
void CCDirector::showFPS(void)
|
||||
{
|
||||
m_nFrames++;
|
||||
m_uFrames++;
|
||||
m_fAccumDt += m_fDeltaTime;
|
||||
|
||||
if (m_fAccumDt > CC_DIRECTOR_FPS_INTERVAL)
|
||||
{
|
||||
m_fFrameRate = m_nFrames / m_fAccumDt;
|
||||
m_nFrames = 0;
|
||||
m_fFrameRate = m_uFrames / m_fAccumDt;
|
||||
m_uFrames = 0;
|
||||
m_fAccumDt = 0;
|
||||
|
||||
sprintf(m_pszFPS, "%.1f", m_fFrameRate);
|
||||
|
|
|
@ -2180,8 +2180,7 @@ CCActionInterval* CCAnimate::reverse(void)
|
|||
}
|
||||
}
|
||||
|
||||
CCAnimation *pNewAnim = CCAnimation::animationWithName(m_pAnimation->getName(),
|
||||
m_pAnimation->getDelay(), pNewArray);
|
||||
CCAnimation *pNewAnim = CCAnimation::animationWithFrames(pNewArray, m_pAnimation->getDelay());
|
||||
|
||||
pNewArray->release();
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ void CCNode::setZOrder(int z)
|
|||
/// ertexZ getter
|
||||
float CCNode::getVertexZ()
|
||||
{
|
||||
return m_fVertexZ;
|
||||
return m_fVertexZ / CC_CONTENT_SCALE_FACTOR();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace cocos2d {
|
|||
|
||||
const char* cocos2dVersion()
|
||||
{
|
||||
return "cocos2d v1.0.0";
|
||||
return "cocos2d v1.0.1";
|
||||
}
|
||||
|
||||
}//namespace cocos2d
|
||||
|
|
|
@ -86,28 +86,6 @@ namespace cocos2d {
|
|||
*/
|
||||
bool initWithFrames(CCMutableArray<CCSpriteFrame*> *pFrames, float delay);
|
||||
|
||||
/** Initializes a CCAnimation with a name
|
||||
@since v0.99.3
|
||||
@deprecated Will be removed in 1.0.1. Use "init" instead.
|
||||
*/
|
||||
bool initWithName(const char *pszName);
|
||||
|
||||
/** Initializes a CCAnimation with a name and frames
|
||||
@since v0.99.3
|
||||
@deprecated Will be removed in 1.0.1. Use "initWithFrames" instead.
|
||||
*/
|
||||
bool initWithName(const char *pszName, CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
/** Initializes a CCAnimation with a name and delay between frames.
|
||||
@deprecated Will be removed in 1.0.1. Use "initWithFrames:nil delay:delay" instead.
|
||||
*/
|
||||
bool initWithName(const char *pszName, float fDelay);
|
||||
|
||||
/** Initializes a CCAnimation with a name, delay and an array of CCSpriteFrames.
|
||||
@deprecated Will be removed in 1.0.1. Use "initWithFrames:frames delay:delay" instead.
|
||||
*/
|
||||
bool initWithName(const char *pszName, float fDelay, CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
/** adds a frame to a CCAnimation */
|
||||
void addFrame(CCSpriteFrame *pFrame);
|
||||
|
||||
|
@ -138,24 +116,6 @@ namespace cocos2d {
|
|||
@since v0.99.5
|
||||
*/
|
||||
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames, float delay);
|
||||
|
||||
/** Creates a CCAnimation with a name
|
||||
@since v0.99.3
|
||||
@deprecated Will be removed in 1.0.1. Use "animation" instead.
|
||||
*/
|
||||
static CCAnimation* animationWithName(const char *pszName);
|
||||
|
||||
/** Creates a CCAnimation with a name and frames
|
||||
@since v0.99.3
|
||||
@deprecated Will be removed in 1.0.1. Use "animationWithFrames" instead.
|
||||
*/
|
||||
static CCAnimation* animationWithName(const char *pszName, CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
/** Creates a CCAnimation with a name and delay between frames. */
|
||||
static CCAnimation* animationWithName(const char *pszName, float fDelay);
|
||||
|
||||
/** Creates a CCAnimation with a name, delay and an array of CCSpriteFrames. */
|
||||
static CCAnimation* animationWithName(const char *pszName, float fDelay, CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
};
|
||||
} // end of name sapce cocos2d
|
||||
|
||||
|
|
|
@ -404,7 +404,6 @@ protected:
|
|||
bool m_bLandscape;
|
||||
|
||||
bool m_bDisplayFPS;
|
||||
int m_nFrames;
|
||||
ccTime m_fAccumDt;
|
||||
ccTime m_fFrameRate;
|
||||
#if CC_DIRECTOR_FAST_FPS
|
||||
|
@ -415,6 +414,7 @@ protected:
|
|||
bool m_bPaused;
|
||||
|
||||
/* How many frames were called since the director started */
|
||||
unsigned int m_uTotalFrames;
|
||||
unsigned int m_uFrames;
|
||||
|
||||
/* The running scene */
|
||||
|
|
|
@ -52,12 +52,6 @@ namespace cocos2d{
|
|||
/** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
|
||||
static CCLabelAtlas * labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap);
|
||||
|
||||
|
||||
/** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element in points and the starting char of the atlas.
|
||||
@deprecated Will be removed in 1.0.1. Use "labelWithString:" instead
|
||||
*/
|
||||
static CCLabelAtlas * labelAtlasWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap);
|
||||
|
||||
/** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element and the starting char of the atlas */
|
||||
bool initWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap);
|
||||
// super methods
|
||||
|
|
|
@ -171,12 +171,6 @@ namespace cocos2d{
|
|||
/** creates a bitmap font altas with an initial string and the FNT file */
|
||||
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile);
|
||||
|
||||
/** creates a BMFont label with an initial string and the FNT file
|
||||
@deprecated Will be removed in 1.0.1. Use "labelWithString" instead.
|
||||
@since v0.99.5
|
||||
*/
|
||||
static CCLabelBMFont * bitmapFontAtlasWithString(const char *str, const char *fntFile);
|
||||
|
||||
/** init a bitmap font altas with an initial string and the FNT file */
|
||||
bool initWithString(const char *str, const char *fntFile);
|
||||
/** updates the font chars based on the string to render */
|
||||
|
@ -203,14 +197,6 @@ namespace cocos2d{
|
|||
/** Purges the FNT config cache
|
||||
*/
|
||||
CC_DLL void FNTConfigRemoveCache( void );
|
||||
|
||||
/** CCBitmapFontAtlas
|
||||
@deprecated Use CCLabelBMFont instead. Will be removed 1.0.1
|
||||
*/
|
||||
class CCBitmapFontAtlas : public CCLabelBMFont
|
||||
{
|
||||
};
|
||||
|
||||
}// namespace cocos2d
|
||||
|
||||
#endif //__CCBITMAP_FONT_ATLAS_H__
|
||||
|
|
|
@ -196,18 +196,6 @@ protected:
|
|||
virtual void updateColor();
|
||||
};
|
||||
|
||||
/** CCColorLayer
|
||||
It is the same as CCLayerColor.
|
||||
|
||||
@deprecated Use CCLayerColor instead. This class will be removed in v1.0.1
|
||||
*/
|
||||
class CC_DLL CCColorLayer : public CCLayerColor
|
||||
{
|
||||
public:
|
||||
static CCColorLayer * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||
static CCColorLayer * layerWithColor(ccColor4B color);
|
||||
};
|
||||
|
||||
//
|
||||
// CCLayerGradient
|
||||
//
|
||||
|
@ -302,14 +290,6 @@ public:
|
|||
LAYER_NODE_FUNC(CCLayerMultiplex);
|
||||
};
|
||||
|
||||
/** CCMultiplexLayer
|
||||
It is the same as CCLayerMultiplex.
|
||||
|
||||
@deprecated Use CCLayerMultiplex instead. This class will be removed in v1.0.1
|
||||
*/
|
||||
class CCMultiplexLayer : public CCLayerMultiplex
|
||||
{
|
||||
};
|
||||
}//namespace cocos2d
|
||||
|
||||
#endif // __CCLAYER_H__
|
||||
|
|
|
@ -327,25 +327,8 @@ public:
|
|||
/** returns the current displayed frame. */
|
||||
CCSpriteFrame* displayedFrame(void);
|
||||
|
||||
/** adds an Animation to the Sprite.
|
||||
|
||||
@deprecated Use CCAnimationCache instead. Will be removed in 1.0.1
|
||||
*/
|
||||
void addAnimation(CCAnimation *pAnimation);
|
||||
|
||||
/** returns an Animation given it's name.
|
||||
|
||||
@deprecated Use CCAnimationCache instead. Will be removed in 1.0.1
|
||||
*/
|
||||
CCAnimation* animationByName(const char *pszAnimationName);
|
||||
|
||||
// Animation
|
||||
|
||||
/** changes the display frame based on an animation and an index.
|
||||
@deprecated Will be removed in 1.0.1. Use setDisplayFrameWithAnimationName:index instead
|
||||
*/
|
||||
void setDisplayFrame(const char *pszAnimationName, int nFrameIndex);
|
||||
|
||||
/** changes the display frame with animation name and index.
|
||||
The animation name will be get from the CCAnimationCache
|
||||
@since v0.99.5
|
||||
|
@ -355,7 +338,6 @@ public:
|
|||
protected:
|
||||
void updateTextureCoords(CCRect rect);
|
||||
void updateBlendFunc(void);
|
||||
void initAnimationDictionary(void);
|
||||
void getTransformValues(struct transformValues_ *tv); // optimization
|
||||
|
||||
protected:
|
||||
|
@ -404,9 +386,6 @@ protected:
|
|||
// image is flipped
|
||||
bool m_bFlipX;
|
||||
bool m_bFlipY;
|
||||
|
||||
// Animations that belong to the sprite
|
||||
CCMutableDictionary<std::string, CCAnimation*> *m_pAnimations;
|
||||
};
|
||||
}//namespace cocos2d
|
||||
|
||||
|
|
|
@ -78,27 +78,23 @@ namespace cocos2d
|
|||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
*/
|
||||
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D *tex);
|
||||
static CCSpriteBatchNode* spriteSheetWithTexture(CCTexture2D *tex); // deprecated
|
||||
|
||||
/** 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* batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity);
|
||||
static CCSpriteBatchNode* spriteSheetWithTexture(CCTexture2D *tex, unsigned int capacity); // deprecated
|
||||
|
||||
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) with a default capacity of 29 children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage);
|
||||
static CCSpriteBatchNode* spriteSheetWithFile(const char* fileImage); // deprecated
|
||||
|
||||
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity);
|
||||
static CCSpriteBatchNode* spriteSheetWithFile(const char* fileImage, unsigned int capacity); // deprecated
|
||||
|
||||
/** initializes a CCSpriteBatchNode with a texture2d and capacity of children.
|
||||
The capacity will be increased in 33% in runtime if it run out of space.
|
||||
|
@ -112,25 +108,6 @@ namespace cocos2d
|
|||
|
||||
void increaseAtlasCapacity();
|
||||
|
||||
/** creates an sprite with a rect in the CCSpriteBatchNode.
|
||||
It's the same as:
|
||||
- create an standard CCSsprite
|
||||
- set the usingSpriteSheet = YES
|
||||
- set the textureAtlas to the same texture Atlas as the CCSpriteBatchNode
|
||||
@deprecated Use [CCSprite spriteWithBatchNode:rect:] instead;
|
||||
*/
|
||||
CCSprite* createSpriteWithRect(CCRect rect);
|
||||
|
||||
/** initializes a previously created sprite with a rect. This sprite will have the same texture as the CCSpriteBatchNode.
|
||||
It's the same as:
|
||||
- initialize an standard CCSsprite
|
||||
- set the usingBatchNode = YES
|
||||
- set the textureAtlas to the same texture Atlas as the CCSpriteBatchNode
|
||||
@since v0.99.0
|
||||
@deprecated Use [CCSprite initWithBatchNode:rect:] instead;
|
||||
*/
|
||||
void initSprite(CCSprite *sprite, CCRect rect);
|
||||
|
||||
/** removes a child given a certain index. It will also cleanup the running actions depending on the cleanup parameter.
|
||||
@warning Removing a child from a CCSpriteBatchNode is very slow
|
||||
*/
|
||||
|
|
|
@ -117,13 +117,6 @@ public:
|
|||
*/
|
||||
CCSpriteFrame* spriteFrameByName(const char *pszName);
|
||||
|
||||
/** Creates an sprite with the name of an sprite frame.
|
||||
The created sprite will contain the texture, rect and offset of the sprite frame.
|
||||
It returns an autorelease object.
|
||||
@deprecated use CCSprite::spriteWithSpriteFrameName(name). This method will be removed on final v0.9
|
||||
*/
|
||||
CCSprite* createSpriteWithFrameName(const char *pszName);
|
||||
|
||||
public:
|
||||
/** Returns the shared instance of the Sprite Frame cache */
|
||||
static CCSpriteFrameCache* sharedSpriteFrameCache(void);
|
||||
|
|
|
@ -128,11 +128,6 @@ namespace cocos2d {
|
|||
/** return the TMXObjectGroup for the secific group */
|
||||
CCTMXObjectGroup* objectGroupNamed(const char *groupName);
|
||||
|
||||
/** return the TMXObjectGroup for the secific group
|
||||
@deprecated Use map#objectGroupNamed instead
|
||||
*/
|
||||
CCTMXObjectGroup* groupNamed(const char *groupName);
|
||||
|
||||
/** return the value for the specific property name */
|
||||
CCString *propertyNamed(const char *propertyName);
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ THE SOFTWARE.
|
|||
#ifndef __COCOS2D_H__
|
||||
#define __COCOS2D_H__
|
||||
|
||||
// 0x00 HI ME LO
|
||||
// 00 01 00 01
|
||||
#define COCOS2D_VERSION 0x00010001
|
||||
|
||||
//
|
||||
// all cocos2d include files
|
||||
//
|
||||
|
|
|
@ -44,11 +44,6 @@ namespace cocos2d{
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CCLabelAtlas * CCLabelAtlas::labelAtlasWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap)
|
||||
{
|
||||
return labelWithString(label, charMapFile, itemWidth, itemHeight, startCharMap);
|
||||
}
|
||||
|
||||
bool CCLabelAtlas::initWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap)
|
||||
{
|
||||
assert(label != NULL);
|
||||
|
|
|
@ -392,11 +392,6 @@ namespace cocos2d{
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CCLabelBMFont * CCLabelBMFont::bitmapFontAtlasWithString(const char *str, const char *fntFile)
|
||||
{
|
||||
return labelWithString(str, fntFile);
|
||||
}
|
||||
|
||||
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile)
|
||||
{
|
||||
assert(theString != NULL);
|
||||
|
|
|
@ -469,33 +469,6 @@ void CCLayerColor::draw()
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
//
|
||||
// CCColorLayer
|
||||
//
|
||||
CCColorLayer* CCColorLayer::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
|
||||
{
|
||||
CCColorLayer * pLayer = new CCColorLayer();
|
||||
if( pLayer && pLayer->initWithColorWidthHeight(color,width,height))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CC_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCColorLayer* CCColorLayer::layerWithColor(ccColor4B color)
|
||||
{
|
||||
CCColorLayer * pLayer = new CCColorLayer();
|
||||
if(pLayer && pLayer->initWithColor(color))
|
||||
{
|
||||
pLayer->autorelease();
|
||||
return pLayer;
|
||||
}
|
||||
CC_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// CCLayerGradient
|
||||
//
|
||||
|
|
|
@ -77,11 +77,11 @@ namespace cocos2d{
|
|||
return menuWithItems(item, NULL);
|
||||
}
|
||||
|
||||
bool CCMenu::init()
|
||||
{
|
||||
va_list args;
|
||||
return initWithItems(0, args);
|
||||
}
|
||||
bool CCMenu::init()
|
||||
{
|
||||
va_list args = NULL;
|
||||
return initWithItems(0, args);
|
||||
}
|
||||
|
||||
bool CCMenu::initWithItems(CCMenuItem* item, va_list args)
|
||||
{
|
||||
|
@ -174,6 +174,15 @@ namespace cocos2d{
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
|
||||
{
|
||||
if (c->getIsVisible() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_pSelectedItem = this->itemForTouch(touch);
|
||||
if (m_pSelectedItem)
|
||||
{
|
||||
|
|
|
@ -65,42 +65,6 @@ namespace cocos2d
|
|||
return pAnimation;
|
||||
}
|
||||
|
||||
CCAnimation* CCAnimation::animationWithName(const char *pszName)
|
||||
{
|
||||
CCAnimation *pAnimation = new CCAnimation();
|
||||
pAnimation->initWithName(pszName);
|
||||
pAnimation->autorelease();
|
||||
|
||||
return pAnimation;
|
||||
}
|
||||
|
||||
CCAnimation* CCAnimation::animationWithName(const char *pszName, CCMutableArray<CCSpriteFrame*> *pFrames)
|
||||
{
|
||||
CCAnimation *pAnimation = new CCAnimation();
|
||||
pAnimation->initWithName(pszName, pFrames);
|
||||
pAnimation->autorelease();
|
||||
|
||||
return pAnimation;
|
||||
}
|
||||
|
||||
CCAnimation* CCAnimation::animationWithName(const char *pszName, float fDelay, CCMutableArray<CCSpriteFrame*> *pFrames)
|
||||
{
|
||||
CCAnimation *pAnimation = new CCAnimation();
|
||||
pAnimation->initWithName(pszName, fDelay, pFrames);
|
||||
pAnimation->autorelease();
|
||||
|
||||
return pAnimation;
|
||||
}
|
||||
|
||||
CCAnimation* CCAnimation::animationWithName(const char *pszName, float fDelay)
|
||||
{
|
||||
CCAnimation *pAnimation = new CCAnimation();
|
||||
pAnimation->initWithName(pszName, fDelay);
|
||||
pAnimation->autorelease();
|
||||
|
||||
return pAnimation;
|
||||
}
|
||||
|
||||
bool CCAnimation::initWithFrames(CCMutableArray<CCSpriteFrame*> *pFrames, float delay)
|
||||
{
|
||||
m_fDelay = delay;
|
||||
|
@ -115,31 +79,6 @@ namespace cocos2d
|
|||
return initWithFrames(pFrames, 0);
|
||||
}
|
||||
|
||||
bool CCAnimation::initWithName(const char *pszName)
|
||||
{
|
||||
return initWithName(pszName, 0, NULL);
|
||||
}
|
||||
|
||||
bool CCAnimation::initWithName(const char *pszName, float fDelay)
|
||||
{
|
||||
return initWithName(pszName, fDelay, NULL);
|
||||
}
|
||||
|
||||
bool CCAnimation::initWithName(const char *pszName, CCMutableArray<CCSpriteFrame*> *pFrames)
|
||||
{
|
||||
return initWithName(pszName, 0, pFrames);
|
||||
}
|
||||
|
||||
bool CCAnimation::initWithName(const char *pszName, float fDelay, CCMutableArray<CCSpriteFrame*> *pFrames)
|
||||
{
|
||||
m_fDelay = fDelay;
|
||||
m_nameStr = pszName;
|
||||
m_pobFrames = CCMutableArray<CCSpriteFrame*>::arrayWithArray(pFrames);
|
||||
m_pobFrames->retain();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CCAnimation::~CCAnimation(void)
|
||||
{
|
||||
CCLOGINFO("cocos2d, deallocing %p", this);
|
||||
|
|
|
@ -195,9 +195,6 @@ bool CCSprite::init(void)
|
|||
|
||||
m_bFlipX = m_bFlipY = false;
|
||||
|
||||
// lazy alloc
|
||||
m_pAnimations = NULL;
|
||||
|
||||
// default transform anchor: center
|
||||
setAnchorPoint(ccp(0.5f, 0.5f));
|
||||
|
||||
|
@ -332,7 +329,6 @@ CCSprite::CCSprite()
|
|||
CCSprite::~CCSprite(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pobTexture);
|
||||
CC_SAFE_RELEASE(m_pAnimations);
|
||||
}
|
||||
|
||||
void CCSprite::useSelfRender(void)
|
||||
|
@ -360,11 +356,6 @@ void CCSprite::useBatchNode(CCSpriteBatchNode *batchNode)
|
|||
m_pobBatchNode = batchNode;
|
||||
}
|
||||
|
||||
void CCSprite::initAnimationDictionary(void)
|
||||
{
|
||||
m_pAnimations = new CCMutableDictionary<string, CCAnimation*>();
|
||||
}
|
||||
|
||||
void CCSprite::setTextureRect(CCRect rect)
|
||||
{
|
||||
CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect);
|
||||
|
@ -1039,22 +1030,6 @@ void CCSprite::setDisplayFrame(CCSpriteFrame *pNewFrame)
|
|||
setTextureRectInPixels(pNewFrame->getRectInPixels(), pNewFrame->isRotated(), pNewFrame->getOriginalSizeInPixels());
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
void CCSprite::setDisplayFrame(const char *pszAnimationName, int nFrameIndex)
|
||||
{
|
||||
if (! m_pAnimations)
|
||||
{
|
||||
initAnimationDictionary();
|
||||
}
|
||||
|
||||
CCAnimation *pAnimation = m_pAnimations->objectForKey(std::string(pszAnimationName));
|
||||
CCSpriteFrame *pFrame = pAnimation->getFrames()->getObjectAtIndex(nFrameIndex);
|
||||
|
||||
assert(pFrame);
|
||||
|
||||
setDisplayFrame(pFrame);
|
||||
}
|
||||
|
||||
void CCSprite::setDisplayFrameWithAnimationName(const char *animationName, int frameIndex)
|
||||
{
|
||||
assert(animationName);
|
||||
|
@ -1087,24 +1062,6 @@ CCSpriteFrame* CCSprite::displayedFrame(void)
|
|||
m_tContentSizeInPixels);
|
||||
}
|
||||
|
||||
void CCSprite::addAnimation(CCAnimation *pAnimation)
|
||||
{
|
||||
// lazy alloc
|
||||
if (! m_pAnimations)
|
||||
{
|
||||
initAnimationDictionary();
|
||||
}
|
||||
|
||||
m_pAnimations->setObject(pAnimation, pAnimation->getName());
|
||||
}
|
||||
|
||||
CCAnimation* CCSprite::animationByName(const char *pszAnimationName)
|
||||
{
|
||||
assert(pszAnimationName != NULL);
|
||||
|
||||
return m_pAnimations->objectForKey(std::string(pszAnimationName));
|
||||
}
|
||||
|
||||
// Texture protocol
|
||||
|
||||
void CCSprite::updateBlendFunc(void)
|
||||
|
|
|
@ -48,11 +48,6 @@ namespace cocos2d
|
|||
return batchNode;
|
||||
}
|
||||
|
||||
CCSpriteBatchNode* CCSpriteBatchNode::spriteSheetWithTexture(cocos2d::CCTexture2D *tex)
|
||||
{
|
||||
return batchNodeWithTexture(tex);
|
||||
}
|
||||
|
||||
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity)
|
||||
{
|
||||
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
|
||||
|
@ -62,11 +57,6 @@ namespace cocos2d
|
|||
return batchNode;
|
||||
}
|
||||
|
||||
CCSpriteBatchNode* CCSpriteBatchNode::spriteSheetWithTexture(CCTexture2D *tex, unsigned int capacity)
|
||||
{
|
||||
return batchNodeWithTexture(tex, capacity);
|
||||
}
|
||||
|
||||
/*
|
||||
* creation with File Image
|
||||
*/
|
||||
|
@ -79,11 +69,6 @@ namespace cocos2d
|
|||
return batchNode;
|
||||
}
|
||||
|
||||
CCSpriteBatchNode* CCSpriteBatchNode::spriteSheetWithFile(const char *fileImage, unsigned int capacity)
|
||||
{
|
||||
return batchNodeWithFile(fileImage, capacity);
|
||||
}
|
||||
|
||||
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithFile(const char *fileImage)
|
||||
{
|
||||
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
|
||||
|
@ -93,11 +78,6 @@ namespace cocos2d
|
|||
return batchNode;
|
||||
}
|
||||
|
||||
CCSpriteBatchNode* CCSpriteBatchNode::spriteSheetWithFile(const char *fileImage)
|
||||
{
|
||||
return batchNodeWithFile(fileImage);
|
||||
}
|
||||
|
||||
/*
|
||||
* init with CCTexture2D
|
||||
*/
|
||||
|
@ -170,25 +150,6 @@ namespace cocos2d
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
// xxx deprecated
|
||||
CCSprite* CCSpriteBatchNode::createSpriteWithRect(CCRect rect)
|
||||
{
|
||||
CCSprite *pSprite = CCSprite::spriteWithTexture(m_pobTextureAtlas->getTexture(), rect);
|
||||
pSprite->useBatchNode(this);
|
||||
|
||||
return pSprite;
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
void CCSpriteBatchNode::initSprite(cocos2d::CCSprite *sprite, cocos2d::CCRect rect)
|
||||
{
|
||||
if (sprite)
|
||||
{
|
||||
sprite->initWithTexture(m_pobTextureAtlas->getTexture(), rect);
|
||||
sprite->useBatchNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSpriteBatchNode::addChild(CCNode *child, int zOrder, int tag)
|
||||
{
|
||||
assert(child != NULL);
|
||||
|
|
|
@ -388,11 +388,6 @@ CCSpriteFrame* CCSpriteFrameCache::spriteFrameByName(const char *pszName)
|
|||
return frame;
|
||||
}
|
||||
|
||||
CCSprite* CCSpriteFrameCache::createSpriteWithFrameName(const char *pszName)
|
||||
{
|
||||
CCSpriteFrame *frame = m_pSpriteFrames->objectForKey(std::string(pszName));
|
||||
return CCSprite::spriteWithSpriteFrame(frame);
|
||||
}
|
||||
const char * CCSpriteFrameCache::valueForKey(const char *key, CCDictionary<std::string, CCObject*> *dict)
|
||||
{
|
||||
if (dict)
|
||||
|
|
|
@ -227,11 +227,6 @@ namespace cocos2d{
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// XXX deprecated
|
||||
CCTMXObjectGroup * CCTMXTiledMap::groupNamed(const char *groupName)
|
||||
{
|
||||
return objectGroupNamed(groupName);
|
||||
}
|
||||
CCString * CCTMXTiledMap::propertyNamed(const char *propertyName)
|
||||
{
|
||||
return m_pProperties->objectForKey(std::string(propertyName));
|
||||
|
|
|
@ -609,7 +609,7 @@ void ActionAnimate::onEnter()
|
|||
|
||||
centerSprites(1);
|
||||
|
||||
CCAnimation* animation = CCAnimation::animationWithName("dance", 0.2f);
|
||||
CCAnimation* animation = CCAnimation::animation();
|
||||
char frameName[100] = {0};
|
||||
for( int i=1;i<15;i++)
|
||||
{
|
||||
|
|
|
@ -120,7 +120,7 @@ void Box2DTestLayer::addNewSpriteWithCoords(CCPoint p)
|
|||
//just randomly picking one of the images
|
||||
int idx = (CCRANDOM_0_1() > .5 ? 0:1);
|
||||
int idy = (CCRANDOM_0_1() > .5 ? 0:1);
|
||||
CCSprite *sprite = batch->createSpriteWithRect( CCRectMake(32 * idx,32 * idy,32,32));
|
||||
CCSprite *sprite = CCSprite::spriteWithTexture(batch->getTexture(), CCRectMake(32 * idx,32 * idy,32,32));
|
||||
batch->addChild(sprite);
|
||||
|
||||
sprite->setPosition( CCPointMake( p.x, p.y) );
|
||||
|
|
Loading…
Reference in New Issue