mirror of https://github.com/axmolengine/axmol.git
Merge branch 'master' of https://github.com/cocos2d/cocos2d-x
This commit is contained in:
commit
3a80e51d25
|
@ -25,7 +25,7 @@ echo.
|
|||
|
||||
call %VSVARS%
|
||||
if %VC_VER%==90 (
|
||||
vcbuild cocos2d-win32.vc2008.sln $ALL
|
||||
vcbuild /MP /M10 cocos2d-win32.vc2008.sln $ALL
|
||||
) else if %VC_VER%==100 (
|
||||
msbuild cocos2d-win32.vc2010.sln /p:Configuration="Debug"
|
||||
msbuild cocos2d-win32.vc2010.sln /p:Configuration="Release"
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -121,6 +121,25 @@ return NULL; \
|
|||
} \
|
||||
};
|
||||
|
||||
#define LAYER_NODE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
|
||||
static layer* node(__PARAMTYPE__ __PARAM__) \
|
||||
{ \
|
||||
layer *pRet = new layer(); \
|
||||
if (pRet && pRet->init(__PARAM__)) \
|
||||
{ \
|
||||
pRet->autorelease(); \
|
||||
return pRet; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
delete pRet; \
|
||||
pRet = NULL; \
|
||||
return NULL; \
|
||||
} \
|
||||
};
|
||||
|
||||
|
||||
|
||||
//
|
||||
// CCLayerColor
|
||||
//
|
||||
|
@ -177,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
|
||||
//
|
||||
|
@ -283,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__
|
||||
|
|
|
@ -124,10 +124,8 @@ namespace cocos2d{
|
|||
|
||||
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
|
||||
|
||||
private:
|
||||
CCMenuItem* itemForTouch(CCTouch * touch);
|
||||
|
||||
protected:
|
||||
CCMenuItem* itemForTouch(CCTouch * touch);
|
||||
tCCMenuState m_eState;
|
||||
GLubyte m_cOpacity;
|
||||
CCMenuItem *m_pSelectedItem;
|
||||
|
|
|
@ -86,14 +86,28 @@ public:
|
|||
|
||||
/** saves the texture into a file */
|
||||
// para szFilePath the absolute path to save
|
||||
bool saveBuffer(const char *szFilePath);
|
||||
/** saves the texture into a file. The format can be JPG or PNG */
|
||||
bool saveBuffer(const char *name, int format);
|
||||
// para x,y the lower left corner coordinates of the buffer to save
|
||||
// pare nWidth,nHeight the size of the buffer to save
|
||||
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
|
||||
bool saveBuffer(const char *szFilePath, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
|
||||
|
||||
/** saves the texture into a file.
|
||||
// para name the file name to save
|
||||
// para format the image format to save, here it supports kCCImageFormatPNG and kCCImageFormatJPG */
|
||||
// para x,y the lower left corner coordinates of the buffer to save
|
||||
// pare nWidth,nHeight the size of the buffer to save
|
||||
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
|
||||
bool saveBuffer(int format, const char *name, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
|
||||
|
||||
/* get buffer as UIImage, can only save a render buffer which has a RGBA8888 pixel format */
|
||||
CCData *getUIImageAsDataFromBuffer(int format);
|
||||
|
||||
bool getUIImageFromBuffer(CCImage *pImage);
|
||||
/** save the buffer data to a CCImage */
|
||||
// para pImage the CCImage to save
|
||||
// para x,y the lower left corner coordinates of the buffer to save
|
||||
// pare nWidth,nHeight the size of the buffer to save
|
||||
// when nWidth = 0 and nHeight = 0, the image size to save equals to buffer texture size
|
||||
bool getUIImageFromBuffer(CCImage *pImage, int x = 0, int y = 0, int nWidth = 0, int nHeight = 0);
|
||||
|
||||
protected:
|
||||
GLuint m_uFBO;
|
||||
|
|
|
@ -79,4 +79,21 @@ static scene* node() \
|
|||
} \
|
||||
};
|
||||
|
||||
#define SCENE_FUNC_PARAM(__TYPE__,__PARAMTYPE__,__PARAM__) \
|
||||
static cocos2d::CCScene* node(__PARAMTYPE__ __PARAM__) \
|
||||
{ \
|
||||
cocos2d::CCScene * scene = NULL; \
|
||||
do \
|
||||
{ \
|
||||
scene = cocos2d::CCScene::node(); \
|
||||
CC_BREAK_IF(! scene); \
|
||||
__TYPE__ *layer = __TYPE__::node(__PARAM__); \
|
||||
CC_BREAK_IF(! layer); \
|
||||
scene->addChild(layer); \
|
||||
} while (0); \
|
||||
return scene; \
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // __CCSCENE_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);
|
||||
|
||||
|
|
|
@ -142,13 +142,13 @@ public:
|
|||
public:
|
||||
/** singleton of the CCTouchDispatcher */
|
||||
static CCTouchDispatcher* sharedDispatcher();
|
||||
CCTouchHandler* findHandler(CCTouchDelegate *pDelegate);
|
||||
|
||||
protected:
|
||||
void forceRemoveDelegate(CCTouchDelegate *pDelegate);
|
||||
void forceAddHandler(CCTouchHandler *pHandler, CCMutableArray<CCTouchHandler*> *pArray);
|
||||
void forceRemoveAllDelegates(void);
|
||||
void rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArray);
|
||||
CCTouchHandler* findHandler(CCTouchDelegate *pDelegate);
|
||||
|
||||
protected:
|
||||
CCMutableArray<CCTouchHandler*> *m_pTargetedHandlers;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace cocos2d {
|
|||
CCTouchHandler
|
||||
Object than contains the delegate and priority of the event handler.
|
||||
*/
|
||||
class CCTouchHandler : public CCObject
|
||||
class CC_DLL CCTouchHandler : public CCObject
|
||||
{
|
||||
public:
|
||||
virtual ~CCTouchHandler(void);
|
||||
|
@ -69,7 +69,7 @@ protected:
|
|||
/** CCStandardTouchHandler
|
||||
It forwardes each event to the delegate.
|
||||
*/
|
||||
class CCStandardTouchHandler : public CCTouchHandler
|
||||
class CC_DLL CCStandardTouchHandler : public CCTouchHandler
|
||||
{
|
||||
public:
|
||||
/** initializes a TouchHandler with a delegate and a priority */
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
Object than contains the claimed touches and if it swallos touches.
|
||||
Used internally by TouchDispatcher
|
||||
*/
|
||||
class CCTargetedTouchHandler : public CCTouchHandler
|
||||
class CC_DLL CCTargetedTouchHandler : public CCTouchHandler
|
||||
{
|
||||
public:
|
||||
~CCTargetedTouchHandler(void);
|
|
@ -38,18 +38,18 @@ public:
|
|||
~CCUserDefault();
|
||||
|
||||
// get value methods
|
||||
bool getBoolForKey(const char* pKey);
|
||||
int getIntegerForKey(const char* pKey);
|
||||
float getFloatForKey(const char* pKey);
|
||||
double getDoubleForKey(const char* pKey);
|
||||
std::string getStringForKey(const char* pKey);
|
||||
bool getBoolForKey(const char* pKey, bool defaultValue = false);
|
||||
int getIntegerForKey(const char* pKey, int defaultValue = 0);
|
||||
float getFloatForKey(const char* pKey, float defaultValue=0.0f);
|
||||
double getDoubleForKey(const char* pKey, double defaultValue=0.0);
|
||||
std::string getStringForKey(const char* pKey, const std::string & defaultValue = "");
|
||||
|
||||
// set value methods
|
||||
void setBoolForKey(const char* pKey, bool value);
|
||||
void setIntegerForKey(const char* pKey, int value);
|
||||
void setFloatForKey(const char* pKey, float value);
|
||||
void setDoubleForKey(const char* pKey, double value);
|
||||
void setStringForKey(const char* pKey, std::string value);
|
||||
void setStringForKey(const char* pKey, const std::string & value);
|
||||
|
||||
static CCUserDefault* sharedUserDefault();
|
||||
static void purgeSharedUserDefault();
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
@ -80,6 +84,7 @@ THE SOFTWARE.
|
|||
#include "CCTexturePVR.h"
|
||||
#include "CCTransitionRadial.h"
|
||||
#include "CCActionProgressTimer.h"
|
||||
#include "CCTouchHandler.h"
|
||||
#include "CCTouchDispatcher.h"
|
||||
#include "CCDrawingPrimitives.h"
|
||||
#include "CCScheduler.h"
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
|
|
@ -31,6 +31,7 @@ THE SOFTWARE.
|
|||
#include "CCStdC.h"
|
||||
|
||||
#include <vector>
|
||||
#include <stdarg.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -174,6 +175,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)
|
||||
{
|
||||
|
|
|
@ -216,12 +216,12 @@ void CCRenderTexture::clear(float r, float g, float b, float a)
|
|||
this->end();
|
||||
}
|
||||
|
||||
bool CCRenderTexture::saveBuffer(const char *szFilePath)
|
||||
bool CCRenderTexture::saveBuffer(const char *szFilePath, int x, int y, int nWidth, int nHeight)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
CCImage *pImage = new CCImage();
|
||||
if (pImage != NULL && getUIImageFromBuffer(pImage))
|
||||
if (pImage != NULL && getUIImageFromBuffer(pImage, x, y, nWidth, nHeight))
|
||||
{
|
||||
bRet = pImage->saveToFile(szFilePath);
|
||||
}
|
||||
|
@ -229,14 +229,14 @@ bool CCRenderTexture::saveBuffer(const char *szFilePath)
|
|||
CC_SAFE_DELETE(pImage);
|
||||
return bRet;
|
||||
}
|
||||
bool CCRenderTexture::saveBuffer(const char *fileName, int format)
|
||||
bool CCRenderTexture::saveBuffer(int format, const char *fileName, int x, int y, int nWidth, int nHeight)
|
||||
{
|
||||
bool bRet = false;
|
||||
CCAssert(format == kCCImageFormatJPG || format == kCCImageFormatPNG,
|
||||
"the image can only be saved as JPG or PNG format");
|
||||
|
||||
CCImage *pImage = new CCImage();
|
||||
if (pImage != NULL && getUIImageFromBuffer(pImage))
|
||||
if (pImage != NULL && getUIImageFromBuffer(pImage, x, y, nWidth, nHeight))
|
||||
{
|
||||
std::string fullpath = CCFileUtils::getWriteablePath() + fileName;
|
||||
if (kCCImageFormatPNG == format)
|
||||
|
@ -257,13 +257,46 @@ bool CCRenderTexture::saveBuffer(const char *fileName, int format)
|
|||
}
|
||||
|
||||
/* get buffer as UIImage */
|
||||
bool CCRenderTexture::getUIImageFromBuffer(CCImage *pImage)
|
||||
bool CCRenderTexture::getUIImageFromBuffer(CCImage *pImage, int x, int y, int nWidth, int nHeight)
|
||||
{
|
||||
if (NULL == pImage)
|
||||
if (NULL == pImage || NULL == m_pTexture)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CCSize s = m_pTexture->getContentSizeInPixels();
|
||||
int tx = (int)s.width;
|
||||
int ty = (int)s.height;
|
||||
|
||||
if (x < 0 || x >= tx || y < 0 || y >= ty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nWidth < 0
|
||||
|| nHeight < 0
|
||||
|| (0 == nWidth && 0 != nHeight)
|
||||
|| (0 == nHeight && 0 != nWidth))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// to get the image size to save
|
||||
// if the saving image domain exeeds the buffer texture domain,
|
||||
// it should be cut
|
||||
int nSavedBufferWidth = nWidth;
|
||||
int nSavedBufferHeight = nHeight;
|
||||
if (0 == nWidth)
|
||||
{
|
||||
nSavedBufferWidth = tx;
|
||||
}
|
||||
if (0 == nHeight)
|
||||
{
|
||||
nSavedBufferHeight = ty;
|
||||
}
|
||||
nSavedBufferWidth = x + nSavedBufferWidth > tx ? (tx - x): nSavedBufferWidth;
|
||||
nSavedBufferHeight = y + nSavedBufferHeight > ty ? (ty - y): nSavedBufferHeight;
|
||||
|
||||
GLubyte *pBuffer = NULL;
|
||||
GLubyte *pTempData = NULL;
|
||||
bool bRet = false;
|
||||
|
@ -272,28 +305,38 @@ bool CCRenderTexture::getUIImageFromBuffer(CCImage *pImage)
|
|||
{
|
||||
CCAssert(m_ePixelFormat == kCCTexture2DPixelFormat_RGBA8888, "only RGBA8888 can be saved as image");
|
||||
|
||||
CCSize s = m_pTexture->getContentSizeInPixels();
|
||||
int tx = (int)s.width;
|
||||
int ty = (int)s.height;
|
||||
CC_BREAK_IF(! (pBuffer = new GLubyte[nSavedBufferWidth * nSavedBufferHeight * 4]));
|
||||
|
||||
CC_BREAK_IF(! (pBuffer = new GLubyte[tx * ty * 4]));
|
||||
CC_BREAK_IF(! (pTempData = new GLubyte[tx * ty * 4]));
|
||||
// On some machines, like Samsung i9000, Motorola Defy,
|
||||
// the dimension need to be a power of 2
|
||||
int nReadBufferWidth = 0;
|
||||
int nReadBufferHeight = 0;
|
||||
int nMaxTextureSize = 0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &nMaxTextureSize);
|
||||
|
||||
nReadBufferWidth = ccNextPOT(tx);
|
||||
nReadBufferHeight = ccNextPOT(ty);
|
||||
|
||||
CC_BREAK_IF(0 == nReadBufferWidth || 0 == nReadBufferHeight);
|
||||
CC_BREAK_IF(nReadBufferWidth > nMaxTextureSize || nReadBufferHeight > nMaxTextureSize);
|
||||
|
||||
CC_BREAK_IF(! (pTempData = new GLubyte[nReadBufferWidth * nReadBufferHeight * 4]));
|
||||
|
||||
this->begin();
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0,0,tx,ty,GL_RGBA,GL_UNSIGNED_BYTE, pBuffer);
|
||||
glReadPixels(0,0,nReadBufferWidth,nReadBufferHeight,GL_RGBA,GL_UNSIGNED_BYTE, pTempData);
|
||||
this->end();
|
||||
|
||||
// to get the actual texture data
|
||||
// #640 the image read from rendertexture is upseted
|
||||
int nRowBytes = tx * 4;
|
||||
for (int i = 0; i < ty; ++i)
|
||||
for (int i = 0; i < nSavedBufferHeight; ++i)
|
||||
{
|
||||
memcpy(&pTempData[(ty - 1 - i) * nRowBytes],
|
||||
&pBuffer[i * nRowBytes],
|
||||
nRowBytes);
|
||||
memcpy(&pBuffer[i * nSavedBufferWidth * 4],
|
||||
&pTempData[(y + nSavedBufferHeight - i - 1) * nReadBufferWidth * 4 + x * 4],
|
||||
nSavedBufferWidth * 4);
|
||||
}
|
||||
|
||||
bRet = pImage->initWithImageData(pTempData, tx * ty * 4, CCImage::kFmtRawData, tx, ty, 8);
|
||||
bRet = pImage->initWithImageData(pBuffer, nSavedBufferWidth * nSavedBufferHeight * 4, CCImage::kFmtRawData, nSavedBufferWidth, nSavedBufferHeight, 8);
|
||||
} while (0);
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(pBuffer);
|
||||
|
|
|
@ -34,6 +34,8 @@ THE SOFTWARE.
|
|||
|
||||
#define JAVAVM cocos2d::JniHelper::getJavaVM()
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
|
@ -161,34 +163,24 @@ extern "C"
|
|||
return bRet;
|
||||
}
|
||||
|
||||
static char* jstringToChar_(jstring jstr)
|
||||
static string jstring2string_(jstring jstr)
|
||||
{
|
||||
char* rtn = 0;
|
||||
JNIEnv *env = 0;
|
||||
|
||||
jboolean isCopy;
|
||||
if (! getEnv(&env))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// convert jstring to byte array
|
||||
jclass clsstring = env->FindClass("java/lang/String");
|
||||
jstring strencode = env->NewStringUTF("utf-8");
|
||||
jmethodID mid = env->GetMethodID(clsstring, "getBytes", "(Ljava/lang/String;)[B");
|
||||
jbyteArray barr= (jbyteArray)env->CallObjectMethod(jstr, mid, strencode);
|
||||
jsize alen = env->GetArrayLength(barr);
|
||||
jbyte* ba = env->GetByteArrayElements(barr, JNI_FALSE);
|
||||
|
||||
// copy byte array into char[]
|
||||
if (alen > 0)
|
||||
const char* chars = env->GetStringUTFChars(jstr, &isCopy);
|
||||
string ret(chars);
|
||||
if (isCopy)
|
||||
{
|
||||
rtn = new char[alen + 1];
|
||||
memcpy(rtn, ba, alen);
|
||||
rtn[alen] = 0;
|
||||
env->ReleaseStringUTFChars(jstr, chars);
|
||||
}
|
||||
env->ReleaseByteArrayElements(barr, ba, 0);
|
||||
|
||||
return rtn;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,8 +213,8 @@ namespace cocos2d {
|
|||
return getMethodInfo_(methodinfo, className, methodName, paramCode);
|
||||
}
|
||||
|
||||
char* JniHelper::jstringToChar(jstring str)
|
||||
string JniHelper::jstring2string(jstring str)
|
||||
{
|
||||
return jstringToChar_(str);
|
||||
return jstring2string_(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
|||
#define __ANDROID_JNI_HELPER_H__
|
||||
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include "CCPlatformMacros.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
@ -44,7 +45,7 @@ namespace cocos2d {
|
|||
static jclass getClassID(const char *className, JNIEnv *env=0);
|
||||
static bool getStaticMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode);
|
||||
static bool getMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode);
|
||||
static char* jstringToChar(jstring str);
|
||||
static std::string jstring2string(jstring str);
|
||||
|
||||
private:
|
||||
static JavaVM *m_psJavaVM;
|
||||
|
|
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
|||
#include "CCDirector.h"
|
||||
#include "JniHelper.h"
|
||||
#include "CCApplication.h"
|
||||
#include "CCFileUtils.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
@ -111,4 +112,18 @@ extern "C"
|
|||
t.env->CallStaticObjectMethod(t.classID, t.methodID);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// set apk path
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Java_org_cocos2dx_lib_Cocos2dxActivity_nativeSetPaths(JNIEnv* env, jobject thiz, jstring apkPath)
|
||||
{
|
||||
const char* str;
|
||||
jboolean isCopy;
|
||||
str = env->GetStringUTFChars(apkPath, &isCopy);
|
||||
if (isCopy) {
|
||||
cocos2d::CCFileUtils::setResourcePath(str);
|
||||
env->ReleaseStringUTFChars(apkPath, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ THE SOFTWARE.
|
|||
#include "CCAccelerometer.h"
|
||||
#include "platform/android/CCAccelerometer_android.h"
|
||||
#include "CCEGLView.h"
|
||||
#include "CCFileUtils.h"
|
||||
#include "JniHelper.h"
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
@ -59,18 +58,6 @@ extern "C"
|
|||
timeStamp);
|
||||
}
|
||||
|
||||
void Java_org_cocos2dx_lib_Cocos2dxActivity_nativeSetPaths(JNIEnv* env, jobject thiz, jstring apkPath)
|
||||
{
|
||||
const char* str;
|
||||
jboolean isCopy;
|
||||
str = env->GetStringUTFChars(apkPath, &isCopy);
|
||||
if (isCopy) {
|
||||
cocos2d::CCFileUtils::setResourcePath(str);
|
||||
env->ReleaseStringUTFChars(apkPath, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void enableAccelerometerJNI()
|
||||
{
|
||||
JniMethodInfo t;
|
||||
|
|
|
@ -50,7 +50,7 @@ extern "C"
|
|||
"()Ljava/lang/String;"))
|
||||
{
|
||||
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
|
||||
ret = JniHelper::jstringToChar(str);
|
||||
ret = (char*)JniHelper::jstring2string(str).c_str();
|
||||
|
||||
LOGD("package name %s", ret);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ extern "C"
|
|||
, "()Ljava/lang/String;"))
|
||||
{
|
||||
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
|
||||
ret = JniHelper::jstringToChar(str);
|
||||
ret = (char*)JniHelper::jstring2string(str).c_str();
|
||||
|
||||
LOGD("language name %s", ret);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "TG3.h"
|
||||
#include <string>
|
||||
#include "CCApplication.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -35,6 +36,7 @@ public:
|
|||
BitmapDC()
|
||||
: m_pBmp(NULL)
|
||||
, m_pMemWnd(NULL)
|
||||
, m_pFont(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -42,16 +44,59 @@ public:
|
|||
~BitmapDC(void)
|
||||
{
|
||||
prepareBitmap(0, 0);
|
||||
if (m_pFont)
|
||||
{
|
||||
delete m_pFont;
|
||||
m_pFont = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool setFont(const char * pFontName = NULL, int nSize = 0)
|
||||
{
|
||||
bool bRet = false;
|
||||
TFont * pNewFont = new TFont;
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(! m_hFont.Create(0, (Int32)nSize));
|
||||
if (NULL == pFontName)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
TUChar szFullPath[MAX_PATH] = {0};
|
||||
std::string fullpath;
|
||||
#ifdef _TRANZDA_VM_
|
||||
fullpath = pFontName;
|
||||
CCLog("++fullpath %s",fullpath.c_str());
|
||||
fullpath = CCFileUtils::fullPathFromRelativePath(fullpath.c_str());
|
||||
CCLog("--fullpath %s",fullpath.c_str());
|
||||
fullpath = &fullpath.c_str()[strlen("D:/Work7")];
|
||||
#else
|
||||
fullpath = CCApplication::sharedApplication().getAppDataPath();
|
||||
fullpath += pFontName;
|
||||
#endif
|
||||
TUString::StrGBToUnicode(szFullPath,(const Char*)fullpath.c_str());
|
||||
CCLog("path %s,++pNewFont->Create",fullpath.c_str());
|
||||
CC_BREAK_IF(! pNewFont->Create(szFullPath,0, (Int32)nSize,0,NULL));
|
||||
CCLog("path %s,--pNewFont->Create",fullpath.c_str());
|
||||
bRet = true;
|
||||
} while (0);
|
||||
// create default font
|
||||
if (!bRet &&
|
||||
pNewFont->Create(0, (Int32)nSize))
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
// delete old font
|
||||
if (bRet)
|
||||
{
|
||||
if (m_pFont)
|
||||
{
|
||||
delete m_pFont;
|
||||
m_pFont = NULL;
|
||||
}
|
||||
m_pFont = pNewFont;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
@ -96,7 +141,7 @@ public:
|
|||
}
|
||||
|
||||
// calculate the width of current line and update the window width
|
||||
int nTempWidth = m_hFont.CharsWidth(strLine.c_str(), strLine.length() + 1);
|
||||
int nTempWidth = m_pFont->CharsWidth(strLine.c_str(), strLine.length() + 1);
|
||||
if (nTempWidth >= nWinWidth)
|
||||
{
|
||||
nWinWidth = nTempWidth;
|
||||
|
@ -115,14 +160,14 @@ public:
|
|||
int nCurPos = 0;
|
||||
do
|
||||
{
|
||||
nCurPos = m_hFont.WordWrap(strLeft.c_str(), nWinWidth);
|
||||
nCurPos = m_pFont->WordWrap(strLeft.c_str(), nWinWidth);
|
||||
strLeft = strLeft.substr(nCurPos);
|
||||
++nLineCount;
|
||||
} while (strLeft.length() > 0);
|
||||
}
|
||||
|
||||
// calculate the window height.
|
||||
tSize.SetHeight(nLineCount * m_hFont.LineHeight());
|
||||
tSize.SetHeight(nLineCount * m_pFont->LineHeight());
|
||||
tSize.SetWidth(nWinWidth);
|
||||
|
||||
bRet = true;
|
||||
|
@ -205,7 +250,7 @@ public:
|
|||
m_pMemWnd->GetMemWindowTBitmapPtr()->Fill32(RGBA(0, 0, 0, 0), 0, 0, nWidth, nHeight);
|
||||
|
||||
TRectangle rect(0, 0, nWidth, nHeight);
|
||||
dc.DrawTextInRectangleEx(pszText, 0, RGBA(255,255,255,255), RGBA(0,0,0,255), m_hFont, &rect, style);
|
||||
dc.DrawTextInRectangleEx(pszText, 0, RGBA(255,255,255,255), RGBA(0,0,0,255), *m_pFont, &rect, style);
|
||||
|
||||
dc.ReadBitmap(m_pBmp, 0, 0);
|
||||
|
||||
|
@ -217,7 +262,7 @@ public:
|
|||
CC_SYNTHESIZE_READONLY(TBitmap*, m_pBmp, Bitmap);
|
||||
|
||||
private:
|
||||
TFont m_hFont;
|
||||
TFont * m_pFont;
|
||||
TWindow * m_pMemWnd;
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -148,26 +148,24 @@ void CCUserDefault::purgeSharedUserDefault()
|
|||
m_spUserDefault = NULL;
|
||||
}
|
||||
|
||||
bool CCUserDefault::getBoolForKey(const char* pKey)
|
||||
bool CCUserDefault::getBoolForKey(const char* pKey, bool defaultValue)
|
||||
{
|
||||
const char* value = getValueForKey(pKey);
|
||||
bool ret = false;
|
||||
bool ret = defaultValue;
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (! strcmp(value, "true"))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
ret = (! strcmp(value, "true"));
|
||||
xmlFree((void*)value);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CCUserDefault::getIntegerForKey(const char* pKey)
|
||||
int CCUserDefault::getIntegerForKey(const char* pKey, int defaultValue)
|
||||
{
|
||||
const char* value = getValueForKey(pKey);
|
||||
int ret = 0;
|
||||
int ret = defaultValue;
|
||||
|
||||
if (value)
|
||||
{
|
||||
|
@ -178,17 +176,17 @@ int CCUserDefault::getIntegerForKey(const char* pKey)
|
|||
return ret;
|
||||
}
|
||||
|
||||
float CCUserDefault::getFloatForKey(const char* pKey)
|
||||
float CCUserDefault::getFloatForKey(const char* pKey, float defaultValue)
|
||||
{
|
||||
float ret = (float)getDoubleForKey(pKey);
|
||||
float ret = (float)getDoubleForKey(pKey, (double)defaultValue);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
double CCUserDefault::getDoubleForKey(const char* pKey)
|
||||
double CCUserDefault::getDoubleForKey(const char* pKey, double defaultValue)
|
||||
{
|
||||
const char* value = getValueForKey(pKey);
|
||||
double ret = 0.0;
|
||||
double ret = defaultValue;
|
||||
|
||||
if (value)
|
||||
{
|
||||
|
@ -199,10 +197,10 @@ double CCUserDefault::getDoubleForKey(const char* pKey)
|
|||
return ret;
|
||||
}
|
||||
|
||||
string CCUserDefault::getStringForKey(const char* pKey)
|
||||
string CCUserDefault::getStringForKey(const char* pKey, const std::string & defaultValue)
|
||||
{
|
||||
const char* value = getValueForKey(pKey);
|
||||
string ret("");
|
||||
string ret = defaultValue;
|
||||
|
||||
if (value)
|
||||
{
|
||||
|
@ -264,7 +262,7 @@ void CCUserDefault::setDoubleForKey(const char* pKey, double value)
|
|||
setValueForKey(pKey, tmp);
|
||||
}
|
||||
|
||||
void CCUserDefault::setStringForKey(const char* pKey, std::string value)
|
||||
void CCUserDefault::setStringForKey(const char* pKey, const std::string & value)
|
||||
{
|
||||
// check key
|
||||
if (! pKey)
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -119,7 +119,8 @@ OBJECTS = \
|
|||
$(OBJECTS_DIR)/TouchesTest.o \
|
||||
$(OBJECTS_DIR)/TransitionsTest.o \
|
||||
$(OBJECTS_DIR)/UserDefaultTest.o \
|
||||
$(OBJECTS_DIR)/ZwoptexTest.o
|
||||
$(OBJECTS_DIR)/ZwoptexTest.o \
|
||||
$(OBJECTS_DIR)/FontTest.o
|
||||
|
||||
ADD_OBJECTS +=
|
||||
|
||||
|
@ -390,3 +391,6 @@ $(OBJECTS_DIR)/UserDefaultTest.o : ../tests/UserDefaultTest/UserDefaultTest.cpp
|
|||
$(OBJECTS_DIR)/ZwoptexTest.o : ../tests/ZwoptexTest/ZwoptexTest.cpp
|
||||
$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/ZwoptexTest.o ../tests/ZwoptexTest/ZwoptexTest.cpp
|
||||
|
||||
$(OBJECTS_DIR)/FontTest.o : ../tests/FontTest/FontTest.cpp
|
||||
$(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/FontTest.o ../tests/FontTest/FontTest.cpp
|
||||
|
||||
|
|
|
@ -1090,6 +1090,18 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="FontTest"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\tests\FontTest\FontTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tests\FontTest\FontTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
|
|
@ -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++)
|
||||
{
|
||||
|
@ -617,7 +617,7 @@ void ActionAnimate::onEnter()
|
|||
animation->addFrameWithFileName(frameName);
|
||||
}
|
||||
|
||||
CCActionInterval* action = CCAnimate::actionWithAnimation( animation, false);
|
||||
CCActionInterval* action = CCAnimate::actionWithDuration(3, animation, false);
|
||||
CCActionInterval* action_back = action->reverse();
|
||||
|
||||
m_grossini->runAction( CCSequence::actions( action, action_back, NULL));
|
||||
|
|
|
@ -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) );
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
@ -26,7 +28,7 @@
|
|||
#include <string.h>
|
||||
#include "chipmunk.h"
|
||||
#include "drawSpace.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static TestScene* CreateTestScene(int nIdx)
|
|||
pScene = new DirectorTestScene(); break;
|
||||
case TEST_BUGS:
|
||||
pScene = new BugsTestScene(); break;
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY)
|
||||
case TEST_FONTS:
|
||||
pScene = new FontTestScene(); break;
|
||||
#endif
|
||||
|
|
|
@ -21,29 +21,14 @@ namespace cocos2d {
|
|||
CCMutableArray<CCSpriteFrame*>* getFrames(void);
|
||||
void setFrames(CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
|
||||
bool initWithFrames(CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
|
||||
bool initWithFrames(CCMutableArray<CCSpriteFrame*> *pFrames, float delay);
|
||||
|
||||
|
||||
bool initWithName(const char *pszName);
|
||||
|
||||
|
||||
bool initWithName(const char *pszName, CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
bool initWithName(const char *pszName, float fDelay);
|
||||
|
||||
|
||||
bool initWithName(const char *pszName, float fDelay, CCMutableArray<CCSpriteFrame*> *pFrames);
|
||||
|
||||
|
||||
void addFrame(CCSpriteFrame *pFrame);
|
||||
|
||||
void addFrameWithFileName(const char *pszFileName);
|
||||
|
||||
|
||||
void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect);
|
||||
|
||||
bool init(void);
|
||||
|
@ -55,18 +40,6 @@ namespace cocos2d {
|
|||
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames);
|
||||
|
||||
static CCAnimation* animationWithFrames(CCMutableArray<CCSpriteFrame*> *frames, float delay);
|
||||
|
||||
|
||||
static CCAnimation* animationWithName(const char *pszName);
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -10,8 +10,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, int itemWidth, int itemHeight, char startCharMap);
|
||||
|
||||
static CCLabelAtlas * labelAtlasWithString(const char *label, const char *charMapFile, int itemWidth, int itemHeight, 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, int itemWidth, int itemHeight, char startCharMap);
|
||||
// super methods
|
||||
|
|
|
@ -51,7 +51,6 @@ namespace cocos2d{
|
|||
CCLabelBMFont();
|
||||
static void purgeCachedData();
|
||||
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile);
|
||||
static CCLabelBMFont * bitmapFontAtlasWithString(const char *str, const char *fntFile);
|
||||
bool initWithString(const char *str, const char *fntFile);
|
||||
void createFontChars();
|
||||
void setString(const char *label);
|
||||
|
@ -68,10 +67,6 @@ namespace cocos2d{
|
|||
|
||||
void FNTConfigRemoveCache( void );
|
||||
|
||||
class CCBitmapFontAtlas : public CCLabelBMFont
|
||||
{
|
||||
};
|
||||
|
||||
}// namespace cocos2d
|
||||
|
||||
|
||||
|
|
|
@ -74,12 +74,6 @@ namespace cocos2d {
|
|||
|
||||
};
|
||||
|
||||
class CCColorLayer : public CCLayerColor
|
||||
{
|
||||
static CCColorLayer * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
|
||||
static CCColorLayer * layerWithColor(ccColor4B color);
|
||||
};
|
||||
|
||||
class CCLayerGradient : public CCLayerColor
|
||||
{
|
||||
|
||||
|
@ -128,8 +122,4 @@ namespace cocos2d {
|
|||
void switchTo(unsigned int n);
|
||||
void switchToAndReleaseMe(unsigned int n);
|
||||
};
|
||||
|
||||
class CCMultiplexLayer : public CCLayerMultiplex
|
||||
{
|
||||
};
|
||||
}//namespace cocos2d
|
||||
|
|
|
@ -148,18 +148,10 @@ class CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
|
|||
void setTextureRect(CCRect rect);
|
||||
|
||||
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size);
|
||||
|
||||
void useBatchNode(CCSpriteBatchNode *batchNode);
|
||||
void setDisplayFrame(CCSpriteFrame *pNewFrame);
|
||||
bool isFrameDisplayed(CCSpriteFrame *pFrame);
|
||||
CCSpriteFrame* displayedFrame(void);
|
||||
|
||||
void addAnimation(CCAnimation *pAnimation);
|
||||
|
||||
CCAnimation* animationByName(const char *pszAnimationName);
|
||||
|
||||
void setDisplayFrame(const char *pszAnimationName, int nFrameIndex);
|
||||
|
||||
void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex);
|
||||
|
||||
};
|
||||
|
|
|
@ -12,24 +12,15 @@ namespace cocos2d
|
|||
CCArray* getDescendants(void);
|
||||
|
||||
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D *tex);
|
||||
static CCSpriteBatchNode* spriteSheetWithTexture(CCTexture2D *tex); // deprecated
|
||||
|
||||
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity);
|
||||
static CCSpriteBatchNode* spriteSheetWithTexture(CCTexture2D *tex, unsigned int capacity); // deprecated
|
||||
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage);
|
||||
static CCSpriteBatchNode* spriteSheetWithFile(const char* fileImage); // deprecated
|
||||
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity);
|
||||
static CCSpriteBatchNode* spriteSheetWithFile(const char* fileImage, unsigned int capacity); // deprecated
|
||||
bool initWithTexture(CCTexture2D *tex, unsigned int capacity);
|
||||
|
||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
||||
|
||||
void increaseAtlasCapacity();
|
||||
|
||||
CCSprite* createSpriteWithRect(CCRect rect);
|
||||
|
||||
void initSprite(CCSprite *sprite, CCRect rect);
|
||||
|
||||
void removeChildAtIndex(unsigned int index, bool doCleanup);
|
||||
|
||||
void insertChild(CCSprite *child, unsigned int index);
|
||||
|
|
|
@ -35,8 +35,6 @@ class CCSpriteFrameCache : public CCObject
|
|||
|
||||
CCSpriteFrame* spriteFrameByName(const char *pszName);
|
||||
|
||||
CCSprite* createSpriteWithFrameName(const char *pszName);
|
||||
|
||||
|
||||
/** Returns the shared instance of the Sprite Frame cache */
|
||||
static CCSpriteFrameCache* sharedSpriteFrameCache(void);
|
||||
|
|
|
@ -46,11 +46,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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue