diff --git a/build-win32.bat b/build-win32.bat index 587cd43bf5..82705aa033 100644 --- a/build-win32.bat +++ b/build-win32.bat @@ -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" diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 27df5301c8..08d3d9f3de 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -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); diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index cab45bf879..04ee34751d 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -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(); diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 723b262dea..ccc9daddbc 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -166,7 +166,7 @@ void CCNode::setZOrder(int z) /// ertexZ getter float CCNode::getVertexZ() { - return m_fVertexZ; + return m_fVertexZ / CC_CONTENT_SCALE_FACTOR(); } @@ -852,13 +852,13 @@ void CCNode::transform() if (m_fRotation != 0.0f ) glRotatef( -m_fRotation, 0.0f, 0.0f, 1.0f ); - // skew - if ( (skewX_ != 0.0f) || (skewY_ != 0.0f) ) - { - CCAffineTransform skewMatrix = CCAffineTransformMake( 1.0f, tanf(CC_DEGREES_TO_RADIANS(skewY_)), tanf(CC_DEGREES_TO_RADIANS(skewX_)), 1.0f, 0.0f, 0.0f ); - GLfloat glMatrix[16]; - CCAffineToGL(&skewMatrix, glMatrix); - glMultMatrixf(glMatrix); + // skew + if ( (skewX_ != 0.0f) || (skewY_ != 0.0f) ) + { + CCAffineTransform skewMatrix = CCAffineTransformMake( 1.0f, tanf(CC_DEGREES_TO_RADIANS(skewY_)), tanf(CC_DEGREES_TO_RADIANS(skewX_)), 1.0f, 0.0f, 0.0f ); + GLfloat glMatrix[16]; + CCAffineToGL(&skewMatrix, glMatrix); + glMultMatrixf(glMatrix); } // scale @@ -1022,12 +1022,12 @@ CCAffineTransform CCNode::nodeToParentTransform(void) m_tTransform = CCAffineTransformRotate(m_tTransform, -CC_DEGREES_TO_RADIANS(m_fRotation)); } - if(m_fSkewX != 0 || m_fSkewY != 0) - { - // create a skewed coordinate system - CCAffineTransform skew = CCAffineTransformMake(1.0f, tanf(CC_DEGREES_TO_RADIANS(m_fSkewY)), tanf(CC_DEGREES_TO_RADIANS(m_fSkewX)), 1.0f, 0.0f, 0.0f); - // apply the skew to the transform - m_tTransform = CCAffineTransformConcat(skew, m_tTransform); + if(m_fSkewX != 0 || m_fSkewY != 0) + { + // create a skewed coordinate system + CCAffineTransform skew = CCAffineTransformMake(1.0f, tanf(CC_DEGREES_TO_RADIANS(m_fSkewY)), tanf(CC_DEGREES_TO_RADIANS(m_fSkewX)), 1.0f, 0.0f, 0.0f); + // apply the skew to the transform + m_tTransform = CCAffineTransformConcat(skew, m_tTransform); } if(! (m_fScaleX == 1 && m_fScaleY == 1)) diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index 311f1a8d56..d408f92265 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -29,7 +29,7 @@ namespace cocos2d { const char* cocos2dVersion() { - return "cocos2d v1.0.0"; + return "cocos2d v1.0.1"; } }//namespace cocos2d diff --git a/cocos2dx/include/CCAnimation.h b/cocos2dx/include/CCAnimation.h index 30befb916f..cdd2e70f1e 100644 --- a/cocos2dx/include/CCAnimation.h +++ b/cocos2dx/include/CCAnimation.h @@ -86,28 +86,6 @@ namespace cocos2d { */ bool initWithFrames(CCMutableArray *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 *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 *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 *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 *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 *pFrames); }; } // end of name sapce cocos2d diff --git a/cocos2dx/include/CCDirector.h b/cocos2dx/include/CCDirector.h index f0f1e44c79..6b942bb05d 100644 --- a/cocos2dx/include/CCDirector.h +++ b/cocos2dx/include/CCDirector.h @@ -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 */ diff --git a/cocos2dx/include/CCLabelAtlas.h b/cocos2dx/include/CCLabelAtlas.h index 95963d4dc9..01a87202a3 100644 --- a/cocos2dx/include/CCLabelAtlas.h +++ b/cocos2dx/include/CCLabelAtlas.h @@ -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 diff --git a/cocos2dx/include/CCLabelBMFont.h b/cocos2dx/include/CCLabelBMFont.h index 320f1e9cca..f6fd02eee1 100644 --- a/cocos2dx/include/CCLabelBMFont.h +++ b/cocos2dx/include/CCLabelBMFont.h @@ -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__ diff --git a/cocos2dx/include/CCLayer.h b/cocos2dx/include/CCLayer.h index 14a8cb90c2..3da9ddf757 100644 --- a/cocos2dx/include/CCLayer.h +++ b/cocos2dx/include/CCLayer.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__ diff --git a/cocos2dx/include/CCMenu.h b/cocos2dx/include/CCMenu.h index 5ecda9d701..7b8c158f15 100644 --- a/cocos2dx/include/CCMenu.h +++ b/cocos2dx/include/CCMenu.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; diff --git a/cocos2dx/include/CCRenderTexture.h b/cocos2dx/include/CCRenderTexture.h index a7ecd0b367..77477a5533 100644 --- a/cocos2dx/include/CCRenderTexture.h +++ b/cocos2dx/include/CCRenderTexture.h @@ -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; diff --git a/cocos2dx/include/CCScene.h b/cocos2dx/include/CCScene.h index 79e41ee721..f8e37b9686 100644 --- a/cocos2dx/include/CCScene.h +++ b/cocos2dx/include/CCScene.h @@ -1,82 +1,99 @@ -/**************************************************************************** -Copyright (c) 2010-2011 cocos2d-x.org -Copyright (c) 2008-2010 Ricardo Quesada -Copyright (c) 2011 Zynga Inc. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CCSCENE_H__ -#define __CCSCENE_H__ - -#include "CCNode.h" - -namespace cocos2d { - -typedef enum -{ - ccNormalScene = 1 << 0, - ccTransitionScene = 1 << 1, -} ccSceneFlag; - -/** @brief CCScene is a subclass of CCNode that is used only as an abstract concept. - -CCScene an CCNode are almost identical with the difference that CCScene has it's -anchor point (by default) at the center of the screen. - -For the moment CCScene has no other logic than that, but in future releases it might have -additional logic. - -It is a good practice to use and CCScene as the parent of all your nodes. -*/ -class CC_DLL CCScene : public CCNode -{ -public: - CCScene(); - virtual ~CCScene(); - bool init(); - static CCScene *node(void); - inline ccSceneFlag getSceneType(void) { return m_eSceneType; } - -protected: - ccSceneFlag m_eSceneType; -}; -}//namespace cocos2d - -// for the subclass of CCScene, each has to implement the static "node" method -#define SCENE_NODE_FUNC(scene) \ -static scene* node() \ -{ \ - scene *pRet = new scene(); \ - if (pRet && pRet->init()) \ - { \ - pRet->autorelease(); \ - return pRet; \ - } \ - else \ - { \ - delete pRet; \ - pRet = NULL; \ - return NULL; \ - } \ -}; - -#endif // __CCSCENE_H__ +/**************************************************************************** +Copyright (c) 2010-2011 cocos2d-x.org +Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2011 Zynga Inc. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCSCENE_H__ +#define __CCSCENE_H__ + +#include "CCNode.h" + +namespace cocos2d { + +typedef enum +{ + ccNormalScene = 1 << 0, + ccTransitionScene = 1 << 1, +} ccSceneFlag; + +/** @brief CCScene is a subclass of CCNode that is used only as an abstract concept. + +CCScene an CCNode are almost identical with the difference that CCScene has it's +anchor point (by default) at the center of the screen. + +For the moment CCScene has no other logic than that, but in future releases it might have +additional logic. + +It is a good practice to use and CCScene as the parent of all your nodes. +*/ +class CC_DLL CCScene : public CCNode +{ +public: + CCScene(); + virtual ~CCScene(); + bool init(); + static CCScene *node(void); + inline ccSceneFlag getSceneType(void) { return m_eSceneType; } + +protected: + ccSceneFlag m_eSceneType; +}; +}//namespace cocos2d + +// for the subclass of CCScene, each has to implement the static "node" method +#define SCENE_NODE_FUNC(scene) \ +static scene* node() \ +{ \ + scene *pRet = new scene(); \ + if (pRet && pRet->init()) \ + { \ + pRet->autorelease(); \ + return pRet; \ + } \ + else \ + { \ + delete pRet; \ + pRet = NULL; \ + return NULL; \ + } \ +}; + +#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__ diff --git a/cocos2dx/include/CCSprite.h b/cocos2dx/include/CCSprite.h index 56ed3d985a..a0ce41dfb8 100644 --- a/cocos2dx/include/CCSprite.h +++ b/cocos2dx/include/CCSprite.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 *m_pAnimations; }; }//namespace cocos2d diff --git a/cocos2dx/include/CCSpriteBatchNode.h b/cocos2dx/include/CCSpriteBatchNode.h index 128c95b3ba..fbe1c1c6b8 100644 --- a/cocos2dx/include/CCSpriteBatchNode.h +++ b/cocos2dx/include/CCSpriteBatchNode.h @@ -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 */ diff --git a/cocos2dx/include/CCSpriteFrameCache.h b/cocos2dx/include/CCSpriteFrameCache.h index 80da56e330..9b29cc32d6 100644 --- a/cocos2dx/include/CCSpriteFrameCache.h +++ b/cocos2dx/include/CCSpriteFrameCache.h @@ -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); diff --git a/cocos2dx/include/CCTMXTiledMap.h b/cocos2dx/include/CCTMXTiledMap.h index 4447a2f3d3..452e7b6cf6 100644 --- a/cocos2dx/include/CCTMXTiledMap.h +++ b/cocos2dx/include/CCTMXTiledMap.h @@ -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); diff --git a/cocos2dx/include/CCTouchDispatcher.h b/cocos2dx/include/CCTouchDispatcher.h index 389a08e2b2..db1a53bc4a 100644 --- a/cocos2dx/include/CCTouchDispatcher.h +++ b/cocos2dx/include/CCTouchDispatcher.h @@ -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 *pArray); void forceRemoveAllDelegates(void); void rearrangeHandlers(CCMutableArray *pArray); - CCTouchHandler* findHandler(CCTouchDelegate *pDelegate); protected: CCMutableArray *m_pTargetedHandlers; diff --git a/cocos2dx/touch_dispatcher/CCTouchHandler.h b/cocos2dx/include/CCTouchHandler.h similarity index 92% rename from cocos2dx/touch_dispatcher/CCTouchHandler.h rename to cocos2dx/include/CCTouchHandler.h index 800945c0d6..3f97bd1ad2 100644 --- a/cocos2dx/touch_dispatcher/CCTouchHandler.h +++ b/cocos2dx/include/CCTouchHandler.h @@ -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); diff --git a/cocos2dx/include/CCUserDefault.h b/cocos2dx/include/CCUserDefault.h index 59bb034bbc..c4b5d5fc89 100644 --- a/cocos2dx/include/CCUserDefault.h +++ b/cocos2dx/include/CCUserDefault.h @@ -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(); diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 8eab7f131a..59c5f51ab8 100644 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -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" diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index 9edc543eff..b3a585a158 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -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); diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 34b077253c..2bbe45067a 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -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); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 1eb963f45c..6f7bad65d5 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -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 // diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index 373dda9238..8c42d9b120 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -31,6 +31,7 @@ THE SOFTWARE. #include "CCStdC.h" #include +#include using namespace std; @@ -77,11 +78,11 @@ namespace cocos2d{ return menuWithItems(item, NULL); } - bool CCMenu::init() - { - va_list args; - return initWithItems(0, args); - } + bool CCMenu::init() + { + va_list args; + return initWithItems(0, args); + } bool CCMenu::initWithItems(CCMenuItem* item, va_list args) { @@ -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) { diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index 78911e3007..48bfc2b5b2 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -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,43 +257,86 @@ 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; } - GLubyte *pBuffer = NULL; - GLubyte *pTempData = NULL; - bool bRet = false; + CCSize s = m_pTexture->getContentSizeInPixels(); + int tx = (int)s.width; + int ty = (int)s.height; - do - { - CCAssert(m_ePixelFormat == kCCTexture2DPixelFormat_RGBA8888, "only RGBA8888 can be saved as image"); + if (x < 0 || x >= tx || y < 0 || y >= ty) + { + return false; + } - CCSize s = m_pTexture->getContentSizeInPixels(); - int tx = (int)s.width; - int ty = (int)s.height; + 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; - CC_BREAK_IF(! (pBuffer = new GLubyte[tx * ty * 4])); - CC_BREAK_IF(! (pTempData = new GLubyte[tx * ty * 4])); + GLubyte *pBuffer = NULL; + GLubyte *pTempData = NULL; + bool bRet = false; + + do + { + CCAssert(m_ePixelFormat == kCCTexture2DPixelFormat_RGBA8888, "only RGBA8888 can be saved as image"); + + CC_BREAK_IF(! (pBuffer = new GLubyte[nSavedBufferWidth * nSavedBufferHeight * 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); diff --git a/cocos2dx/platform/android/jni/JniHelper.cpp b/cocos2dx/platform/android/jni/JniHelper.cpp index da26eba7a7..b95a45f6ec 100644 --- a/cocos2dx/platform/android/jni/JniHelper.cpp +++ b/cocos2dx/platform/android/jni/JniHelper.cpp @@ -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); } } diff --git a/cocos2dx/platform/android/jni/JniHelper.h b/cocos2dx/platform/android/jni/JniHelper.h index cc49571c44..778e8d76b9 100644 --- a/cocos2dx/platform/android/jni/JniHelper.h +++ b/cocos2dx/platform/android/jni/JniHelper.h @@ -25,6 +25,7 @@ THE SOFTWARE. #define __ANDROID_JNI_HELPER_H__ #include +#include #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; diff --git a/cocos2dx/platform/android/jni/MessageJni.cpp b/cocos2dx/platform/android/jni/MessageJni.cpp index d8e0b9c9e6..77efe1d441 100644 --- a/cocos2dx/platform/android/jni/MessageJni.cpp +++ b/cocos2dx/platform/android/jni/MessageJni.cpp @@ -25,6 +25,7 @@ THE SOFTWARE. #include "CCDirector.h" #include "JniHelper.h" #include "CCApplication.h" +#include "CCFileUtils.h" #include #include @@ -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); + } + } } diff --git a/cocos2dx/platform/android/jni/SensorJni.cpp b/cocos2dx/platform/android/jni/SensorJni.cpp index 6a8d7cabc7..1c938d5890 100644 --- a/cocos2dx/platform/android/jni/SensorJni.cpp +++ b/cocos2dx/platform/android/jni/SensorJni.cpp @@ -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 #include @@ -57,19 +56,7 @@ extern "C" (y - rcRect.origin.y) / fScreenScaleFactor, z, 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() { diff --git a/cocos2dx/platform/android/jni/SystemInfoJni.cpp b/cocos2dx/platform/android/jni/SystemInfoJni.cpp index 24bbc7d608..b7a05391d3 100644 --- a/cocos2dx/platform/android/jni/SystemInfoJni.cpp +++ b/cocos2dx/platform/android/jni/SystemInfoJni.cpp @@ -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); } diff --git a/cocos2dx/platform/wophone/CCImage_wophone.cpp b/cocos2dx/platform/wophone/CCImage_wophone.cpp index 8df96d451a..8f09fbb34c 100644 --- a/cocos2dx/platform/wophone/CCImage_wophone.cpp +++ b/cocos2dx/platform/wophone/CCImage_wophone.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. #include "TG3.h" #include +#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)); - bRet = true; + 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; }; diff --git a/cocos2dx/sprite_nodes/CCAnimation.cpp b/cocos2dx/sprite_nodes/CCAnimation.cpp index 6994a69c24..e44289d2fd 100644 --- a/cocos2dx/sprite_nodes/CCAnimation.cpp +++ b/cocos2dx/sprite_nodes/CCAnimation.cpp @@ -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 *pFrames) - { - CCAnimation *pAnimation = new CCAnimation(); - pAnimation->initWithName(pszName, pFrames); - pAnimation->autorelease(); - - return pAnimation; - } - - CCAnimation* CCAnimation::animationWithName(const char *pszName, float fDelay, CCMutableArray *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 *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 *pFrames) - { - return initWithName(pszName, 0, pFrames); - } - - bool CCAnimation::initWithName(const char *pszName, float fDelay, CCMutableArray *pFrames) - { - m_fDelay = fDelay; - m_nameStr = pszName; - m_pobFrames = CCMutableArray::arrayWithArray(pFrames); - m_pobFrames->retain(); - - return true; - } - CCAnimation::~CCAnimation(void) { CCLOGINFO("cocos2d, deallocing %p", this); diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 5404fc16bc..1cbc637570 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -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(); -} - 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) diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 3d017b0ed3..d09620a40d 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -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); diff --git a/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp b/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp index 78188410bc..877497b060 100644 --- a/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp @@ -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 *dict) { if (dict) diff --git a/cocos2dx/support/CCUserDefault.cpp b/cocos2dx/support/CCUserDefault.cpp index 8423abca3c..e2663e40db 100644 --- a/cocos2dx/support/CCUserDefault.cpp +++ b/cocos2dx/support/CCUserDefault.cpp @@ -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) diff --git a/cocos2dx/tileMap_parallax_nodes/CCTMXTiledMap.cpp b/cocos2dx/tileMap_parallax_nodes/CCTMXTiledMap.cpp index 3d0e6e18dc..752c47df3f 100644 --- a/cocos2dx/tileMap_parallax_nodes/CCTMXTiledMap.cpp +++ b/cocos2dx/tileMap_parallax_nodes/CCTMXTiledMap.cpp @@ -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)); diff --git a/tests/test.wophone/Makefile.ARM b/tests/test.wophone/Makefile.ARM index d5a9bc59aa..225c8158cb 100644 --- a/tests/test.wophone/Makefile.ARM +++ b/tests/test.wophone/Makefile.ARM @@ -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 + diff --git a/tests/test.wophone/test.wophone.vcproj b/tests/test.wophone/test.wophone.vcproj index fa2cfac2fd..29ab686ac4 100644 --- a/tests/test.wophone/test.wophone.vcproj +++ b/tests/test.wophone/test.wophone.vcproj @@ -1090,6 +1090,18 @@ > + + + + + + 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)); diff --git a/tests/tests/Box2DTest/Box2dTest.cpp b/tests/tests/Box2DTest/Box2dTest.cpp index 83a49feee7..48e13a5b06 100644 --- a/tests/tests/Box2DTest/Box2dTest.cpp +++ b/tests/tests/Box2DTest/Box2dTest.cpp @@ -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) ); diff --git a/tests/tests/ChipmunkTest/drawSpace.cpp b/tests/tests/ChipmunkTest/drawSpace.cpp index ad97d64546..0b694f0393 100644 --- a/tests/tests/ChipmunkTest/drawSpace.cpp +++ b/tests/tests/ChipmunkTest/drawSpace.cpp @@ -19,6 +19,8 @@ * SOFTWARE. */ + +#include "cocos2d.h" #include #include #include @@ -26,7 +28,7 @@ #include #include "chipmunk.h" #include "drawSpace.h" -#include "cocos2d.h" + using namespace cocos2d; diff --git a/tests/tests/controller.cpp b/tests/tests/controller.cpp index 7df615e431..3229ec6331 100644 --- a/tests/tests/controller.cpp +++ b/tests/tests/controller.cpp @@ -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 diff --git a/tools/tolua++/CCAnimation.pkg b/tools/tolua++/CCAnimation.pkg index f08e5f9da0..feba212f74 100644 --- a/tools/tolua++/CCAnimation.pkg +++ b/tools/tolua++/CCAnimation.pkg @@ -20,29 +20,14 @@ namespace cocos2d { void setDelay(float fDelay); CCMutableArray* getFrames(void); void setFrames(CCMutableArray *pFrames); - bool initWithFrames(CCMutableArray *pFrames); - bool initWithFrames(CCMutableArray *pFrames, float delay); - - - bool initWithName(const char *pszName); - - - bool initWithName(const char *pszName, CCMutableArray *pFrames); - - bool initWithName(const char *pszName, float fDelay); - - - bool initWithName(const char *pszName, float fDelay, CCMutableArray *pFrames); - void addFrame(CCSpriteFrame *pFrame); void addFrameWithFileName(const char *pszFileName); - void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect); @@ -55,18 +40,6 @@ namespace cocos2d { static CCAnimation* animationWithFrames(CCMutableArray *frames); static CCAnimation* animationWithFrames(CCMutableArray *frames, float delay); - - - static CCAnimation* animationWithName(const char *pszName); - - - static CCAnimation* animationWithName(const char *pszName, CCMutableArray *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 *pFrames); }; } // end of name sapce cocos2d diff --git a/tools/tolua++/CCLabelAtlas.pkg b/tools/tolua++/CCLabelAtlas.pkg index 8a35e0c887..1f1bf3d21e 100644 --- a/tools/tolua++/CCLabelAtlas.pkg +++ b/tools/tolua++/CCLabelAtlas.pkg @@ -9,8 +9,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); diff --git a/tools/tolua++/CCLabelBMFont.pkg b/tools/tolua++/CCLabelBMFont.pkg index afbc12a455..04289d5fd5 100644 --- a/tools/tolua++/CCLabelBMFont.pkg +++ b/tools/tolua++/CCLabelBMFont.pkg @@ -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 diff --git a/tools/tolua++/CCLayer.pkg b/tools/tolua++/CCLayer.pkg index 99489c722f..4e9c876b3a 100644 --- a/tools/tolua++/CCLayer.pkg +++ b/tools/tolua++/CCLayer.pkg @@ -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 diff --git a/tools/tolua++/CCSprite.pkg b/tools/tolua++/CCSprite.pkg index aee8bc8ffc..893421e030 100644 --- a/tools/tolua++/CCSprite.pkg +++ b/tools/tolua++/CCSprite.pkg @@ -145,21 +145,13 @@ class CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol void useSelfRender(void); - void setTextureRect(CCRect rect); + void setTextureRect(CCRect rect); void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size); - void useBatchNode(CCSpriteBatchNode *batchNode); void setDisplayFrame(CCSpriteFrame *pNewFrame); 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); }; diff --git a/tools/tolua++/CCSpriteBatchNode.pkg b/tools/tolua++/CCSpriteBatchNode.pkg index d0dd9d2819..b447dd4582 100644 --- a/tools/tolua++/CCSpriteBatchNode.pkg +++ b/tools/tolua++/CCSpriteBatchNode.pkg @@ -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* batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity); 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); diff --git a/tools/tolua++/CCSpriteFrameCache.pkg b/tools/tolua++/CCSpriteFrameCache.pkg index 480cffbf99..d5fe88b4c5 100644 --- a/tools/tolua++/CCSpriteFrameCache.pkg +++ b/tools/tolua++/CCSpriteFrameCache.pkg @@ -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); diff --git a/tools/tolua++/CCTMXTiledMap.pkg b/tools/tolua++/CCTMXTiledMap.pkg index 00bc004f53..ba0cfdedde 100644 --- a/tools/tolua++/CCTMXTiledMap.pkg +++ b/tools/tolua++/CCTMXTiledMap.pkg @@ -11,24 +11,24 @@ namespace cocos2d { CCTMXOrientationIso, }; - + class CCTMXTiledMap : public CCNode { - /** the map's size property measured in tiles */ - CCSize getMapSize(); + /** the map's size property measured in tiles */ + CCSize getMapSize(); void setMapSize(CCSize sz); - /** the tiles's size property measured in pixels */ - CCSize getTileSize(); + /** the tiles's size property measured in pixels */ + CCSize getTileSize(); void setTileSize(CCSize sz); - /** map orientation */ - int getMapOrientation(); + /** map orientation */ + int getMapOrientation(); void setMapOrientation(int val); /** object groups */ - - CCMutableArray* getObjectGroups(); + + CCMutableArray* getObjectGroups(); void setObjectGroups(CCMutableArray* pval); - /** properties */ - CCStringToStringDictionary* getProperties(); + /** properties */ + CCStringToStringDictionary* getProperties(); void setProperties(CCStringToStringDictionary* pval); CCTMXTiledMap(); @@ -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); @@ -58,8 +53,8 @@ namespace cocos2d { CCDictionary *propertiesForGID(int GID); }; - -}// namespace cocos2d - - - + +}// namespace cocos2d + + +