issue #1324: Added create() for static member functions that new an autorelease object

This commit is contained in:
James Chen 2012-06-14 15:13:16 +08:00
Родитель 2460a9f41e
Коммит 3f7b44fc23
189 изменённых файлов: 6098 добавлений и 2984 удалений

Просмотреть файл

@ -5,10 +5,10 @@ USING_NS_CC;
CCScene* HelloWorld::scene()
{
// 'scene' is an autorelease object
CCScene *scene = CCScene::node();
CCScene *scene = CCScene::create();
// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::node();
HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
@ -32,7 +32,7 @@ bool HelloWorld::init()
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::itemWithNormalImage(
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
this,
@ -40,7 +40,7 @@ bool HelloWorld::init()
pCloseItem->setPosition( ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20) );
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::menuWithItems(pCloseItem, NULL);
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition( CCPointZero );
this->addChild(pMenu, 1);
@ -49,7 +49,7 @@ bool HelloWorld::init()
// add a label shows "Hello World"
// create and initialize a label
CCLabelTTF* pLabel = CCLabelTTF::labelWithString("Hello World", "Arial", 24);
CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24);
// ask director the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();

Просмотреть файл

@ -16,7 +16,7 @@ public:
virtual void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually
LAYER_NODE_FUNC(HelloWorld);
LAYER_CREATE_FUNC(HelloWorld);
};
#endif // __HELLOWORLD_SCENE_H__

Просмотреть файл

@ -48,7 +48,14 @@ CCAction::~CCAction()
CCLOGINFO("cocos2d: deallocing");
}
CCAction * CCAction::action()
//cjh CCAction * CCAction::action()
// {
// CCAction * pRet = new CCAction();
// pRet->autorelease();
// return pRet;
// }
CCAction* CCAction::create()
{
CCAction * pRet = new CCAction();
pRet->autorelease();
@ -124,7 +131,19 @@ CCSpeed::~CCSpeed()
CC_SAFE_RELEASE(m_pInnerAction);
}
CCSpeed * CCSpeed::actionWithAction(CCActionInterval *pAction, float fSpeed)
//cjh CCSpeed * CCSpeed::actionWithAction(CCActionInterval *pAction, float fSpeed)
// {
// CCSpeed *pRet = new CCSpeed();
// if (pRet && pRet->initWithAction(pAction, fSpeed))
// {
// pRet->autorelease();
// return pRet;
// }
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCSpeed* CCSpeed::create(CCActionInterval* pAction, float fSpeed)
{
CCSpeed *pRet = new CCSpeed();
if (pRet && pRet->initWithAction(pAction, fSpeed))
@ -190,7 +209,7 @@ bool CCSpeed::isDone()
CCActionInterval *CCSpeed::reverse()
{
return (CCActionInterval*)(CCSpeed::actionWithAction(m_pInnerAction->reverse(), m_fSpeed));
return (CCActionInterval*)(CCSpeed::create(m_pInnerAction->reverse(), m_fSpeed));
}
void CCSpeed::setInnerAction(CCActionInterval *pAction)
@ -211,18 +230,19 @@ CCFollow::~CCFollow()
CC_SAFE_RELEASE(m_pobFollowedNode);
}
CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode)
{
CCFollow *pRet = new CCFollow();
if (pRet && pRet->initWithTarget(pFollowedNode))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect)
//cjh CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect/* = CCRectZero*/)
// {
// CCFollow *pRet = new CCFollow();
// if (pRet && pRet->initWithTarget(pFollowedNode, rect))
// {
// pRet->autorelease();
// return pRet;
// }
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCFollow* CCFollow::create(CCNode *pFollowedNode, const CCRect& rect/* = CCRectZero*/)
{
CCFollow *pRet = new CCFollow();
if (pRet && pRet->initWithTarget(pFollowedNode, rect))
@ -234,56 +254,56 @@ CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect)
return NULL;
}
bool CCFollow::initWithTarget(CCNode *pFollowedNode)
bool CCFollow::initWithTarget(CCNode *pFollowedNode, const CCRect& rect/* = CCRectZero*/)
{
CCAssert(pFollowedNode != NULL, "");
pFollowedNode->retain();
m_pobFollowedNode = pFollowedNode;
m_bBoundarySet = false;
m_bBoundaryFullyCovered = false;
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_obFullScreenSize = CCPointMake(winSize.width, winSize.height);
m_obHalfScreenSize = ccpMult(m_obFullScreenSize, 0.5f);
return true;
}
bool CCFollow::initWithTarget(CCNode *pFollowedNode, const CCRect& rect)
{
CCAssert(pFollowedNode != NULL, "");
pFollowedNode->retain();
m_pobFollowedNode = pFollowedNode;
m_bBoundarySet = true;
if (CCRect::CCRectEqualToRect(rect, CCRectZero))
{
m_bBoundarySet = false;
}
else
{
m_bBoundarySet = true;
}
m_bBoundaryFullyCovered = false;
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
m_obFullScreenSize = CCPointMake(winSize.width, winSize.height);
m_obHalfScreenSize = ccpMult(m_obFullScreenSize, 0.5f);
m_fLeftBoundary = -((rect.origin.x+rect.size.width) - m_obFullScreenSize.x);
m_fRightBoundary = -rect.origin.x ;
m_fTopBoundary = -rect.origin.y;
m_fBottomBoundary = -((rect.origin.y+rect.size.height) - m_obFullScreenSize.y);
if (m_bBoundarySet)
{
m_fLeftBoundary = -((rect.origin.x+rect.size.width) - m_obFullScreenSize.x);
m_fRightBoundary = -rect.origin.x ;
m_fTopBoundary = -rect.origin.y;
m_fBottomBoundary = -((rect.origin.y+rect.size.height) - m_obFullScreenSize.y);
if(m_fRightBoundary < m_fLeftBoundary)
{
// screen width is larger than world's boundary width
//set both in the middle of the world
m_fRightBoundary = m_fLeftBoundary = (m_fLeftBoundary + m_fRightBoundary) / 2;
}
if(m_fTopBoundary < m_fBottomBoundary)
{
// screen width is larger than world's boundary width
//set both in the middle of the world
m_fTopBoundary = m_fBottomBoundary = (m_fTopBoundary + m_fBottomBoundary) / 2;
}
if(m_fRightBoundary < m_fLeftBoundary)
{
// screen width is larger than world's boundary width
//set both in the middle of the world
m_fRightBoundary = m_fLeftBoundary = (m_fLeftBoundary + m_fRightBoundary) / 2;
}
if(m_fTopBoundary < m_fBottomBoundary)
{
// screen width is larger than world's boundary width
//set both in the middle of the world
m_fTopBoundary = m_fBottomBoundary = (m_fTopBoundary + m_fBottomBoundary) / 2;
}
if( (m_fTopBoundary == m_fBottomBoundary) && (m_fLeftBoundary == m_fRightBoundary) )
{
m_bBoundaryFullyCovered = true;
if( (m_fTopBoundary == m_fBottomBoundary) && (m_fLeftBoundary == m_fRightBoundary) )
{
m_bBoundaryFullyCovered = true;
}
}
return true;
}
CCObject *CCFollow::copyWithZone(CCZone *pZone)
{
CCZone *pNewZone = NULL;
@ -303,6 +323,7 @@ CCObject *CCFollow::copyWithZone(CCZone *pZone)
CC_SAFE_DELETE(pNewZone);
return pRet;
}
void CCFollow::step(float dt)
{
CC_UNUSED_PARAM(dt);
@ -328,6 +349,7 @@ bool CCFollow::isDone()
{
return ( !m_pobFollowedNode->getIsRunning() );
}
void CCFollow::stop()
{
m_pTarget = NULL;

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -91,9 +91,13 @@ public:
inline void setTag(int nTag) { m_nTag = nTag; }
public:
/** Allocates and initializes the action */
static CCAction* action();
/** Allocates and initializes the action
@warning: This interface will be deprecated in future.
*/
//static CCAction* action();
/** Create an action */
static CCAction* create();
protected:
CCNode *m_pOriginalTarget;
/** The "target".
@ -174,9 +178,13 @@ public:
}
public:
/** creates the action */
static CCSpeed* actionWithAction(CCActionInterval *pAction, float fSpeed);
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCSpeed* actionWithAction(CCActionInterval *pAction, float fSpeed);
/** create the action */
static CCSpeed* create(CCActionInterval* pAction, float fSpeed);
protected:
float m_fSpeed;
CCActionInterval *m_pInnerAction;
@ -209,11 +217,8 @@ public:
/** alter behavior - turn on/off boundary */
inline void setBoudarySet(bool bValue) { m_bBoundarySet = bValue; }
/** initializes the action */
bool initWithTarget(CCNode *pFollowedNode);
/** initializes the action with a set boundary */
bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect);
bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void step(float dt);
@ -221,12 +226,15 @@ public:
virtual void stop(void);
public:
/** creates the action with no boundary set */
static CCFollow* actionWithTarget(CCNode *pFollowedNode);
/** creates the action with a set boundary */
static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect);
/** creates the action with a set boundary,
It will work with no boundary if @param rect is equal to CCRectZero.
@warning: This interface will be deprecated in future.
*/
//static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
/** creates the action with a set boundary,
It will work with no boundary if @param rect is equal to CCRectZero.
*/
static CCFollow* create(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
protected:
// node to follow
CCNode *m_pobFollowedNode;

Просмотреть файл

@ -45,12 +45,24 @@ void CCActionCamera::startWithTarget(CCNode *pTarget)
CCActionInterval * CCActionCamera::reverse()
{
return CCReverseTime::actionWithAction(this);
return CCReverseTime::create(this);
}
//
// CCOrbitCamera
//
CCOrbitCamera * CCOrbitCamera::actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX)
//cjh CCOrbitCamera * CCOrbitCamera::actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX)
// {
// CCOrbitCamera * pRet = new CCOrbitCamera();
// if(pRet->initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX))
// {
// pRet->autorelease();
// return pRet;
// }
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCOrbitCamera * CCOrbitCamera::create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX)
{
CCOrbitCamera * pRet = new CCOrbitCamera();
if(pRet->initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX))

Просмотреть файл

@ -87,8 +87,14 @@ public:
, m_fRadDeltaX(0.0)
{}
~CCOrbitCamera(){}
/** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX
@warning: This interface will be deprecated in future.
*/
//static CCOrbitCamera* actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
/** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
static CCOrbitCamera * actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
static CCOrbitCamera* create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
/** initializes a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
bool initWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
/** positions the camera according to spherical coordinates */

Просмотреть файл

@ -35,6 +35,7 @@
#include "ccMacros.h"
#include "support/CCPointExtension.h"
#include "CCActionCatmullRom.h"
#include "CCZone.h"
using namespace std;
@ -43,7 +44,26 @@ NS_CC_BEGIN;
/*
* Implementation of CCPointArray
*/
CCPointArray* CCPointArray::arrayWithCapacity(unsigned int capacity)
//cjh CCPointArray* CCPointArray::arrayWithCapacity(unsigned int capacity)
// {
// CCPointArray* ret = new CCPointArray();
// if (ret)
// {
// if (ret->initWithCapacity(capacity))
// {
// ret->autorelease();
// }
// else
// {
// delete ret;
// ret = NULL;
// }
// }
//
// return ret;
// }
CCPointArray* CCPointArray::create(unsigned int capacity)
{
CCPointArray* ret = new CCPointArray();
if (ret)
@ -58,10 +78,11 @@ CCPointArray* CCPointArray::arrayWithCapacity(unsigned int capacity)
ret = NULL;
}
}
return ret;
}
bool CCPointArray::initWithCapacity(unsigned int capacity)
{
m_pControlPoints = new CCArray(capacity);
@ -71,15 +92,8 @@ bool CCPointArray::initWithCapacity(unsigned int capacity)
CCObject* CCPointArray::copyWithZone(cocos2d::CCZone *zone)
{
CCArray *newArray = new CCArray();
CCObject* pObj = NULL;
CCARRAY_FOREACH(m_pControlPoints, pObj)
{
newArray->addObject(pObj);
}
CCPointArray *points = CCPointArray::arrayWithCapacity(10);
CCArray *newArray = (CCArray*)m_pControlPoints->copy();
CCPointArray *points = CCPointArray::create(10);
points->retain();
points->setControlPoints(newArray);
newArray->release();
@ -158,7 +172,7 @@ CCPointArray* CCPointArray::reverse()
{
newArray->addObject(m_pControlPoints->objectAtIndex(i));
}
CCPointArray *config = CCPointArray::arrayWithCapacity(0);
CCPointArray *config = CCPointArray::create(0);
config->setControlPoints(newArray);
newArray->release();
@ -199,7 +213,25 @@ CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, f
/* Implementation of CCCardinalSplineTo
*/
CCCardinalSplineTo* CCCardinalSplineTo::actionWithDuration(float duration, cocos2d::CCPointArray *points, float tension)
//cjh CCCardinalSplineTo* CCCardinalSplineTo::actionWithDuration(float duration, cocos2d::CCPointArray *points, float tension)
// {
// CCCardinalSplineTo *ret = new CCCardinalSplineTo();
// if (ret)
// {
// if (ret->initWithDuration(duration, points, tension))
// {
// ret->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(ret);
// }
// }
//
// return ret;
// }
CCCardinalSplineTo* CCCardinalSplineTo::create(float duration, cocos2d::CCPointArray *points, float tension)
{
CCCardinalSplineTo *ret = new CCCardinalSplineTo();
if (ret)
@ -213,7 +245,7 @@ CCCardinalSplineTo* CCCardinalSplineTo::actionWithDuration(float duration, cocos
CC_SAFE_RELEASE_NULL(ret);
}
}
return ret;
}
@ -253,8 +285,24 @@ void CCCardinalSplineTo::startWithTarget(cocos2d::CCNode *pTarget)
CCCardinalSplineTo* CCCardinalSplineTo::copyWithZone(cocos2d::CCZone *pZone)
{
CCCardinalSplineTo *copy = CCCardinalSplineTo::actionWithDuration(this->getDuration(), this->m_pPoints, this->m_fTension);
return copy;
CCZone* pNewZone = NULL;
CCCardinalSplineTo* pRet = NULL;
if(pZone && pZone->m_pCopyObject) //in case of being called at sub class
{
pRet = (CCCardinalSplineTo*)(pZone->m_pCopyObject);
}
else
{
pRet = new CCCardinalSplineTo();
pZone = pNewZone = new CCZone(pRet);
}
CCActionInterval::copyWithZone(pZone);
pRet->initWithDuration(this->getDuration(), this->m_pPoints, this->m_fTension);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
void CCCardinalSplineTo::update(float time)
@ -292,15 +340,33 @@ void CCCardinalSplineTo::updatePosition(cocos2d::CCPoint &newPos)
CCActionInterval* CCCardinalSplineTo::reverse()
{
CCPointArray *reverse = m_pPoints->reverse();
CCPointArray *pReverse = m_pPoints->reverse();
return CCCardinalSplineTo::actionWithDuration(m_fDuration, reverse, m_fTension);
return CCCardinalSplineTo::create(m_fDuration, pReverse, m_fTension);
}
/* CCCardinalSplineBy
*/
CCCardinalSplineBy* CCCardinalSplineBy::actionWithDuration(float duration, cocos2d::CCPointArray *points, float tension)
//cjh CCCardinalSplineBy* CCCardinalSplineBy::actionWithDuration(float duration, cocos2d::CCPointArray *points, float tension)
// {
// CCCardinalSplineBy *ret = new CCCardinalSplineBy();
// if (ret)
// {
// if (ret->initWithDuration(duration, points, tension))
// {
// ret->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(ret);
// }
// }
//
// return ret;
// }
CCCardinalSplineBy* CCCardinalSplineBy::create(float duration, cocos2d::CCPointArray *points, float tension)
{
CCCardinalSplineBy *ret = new CCCardinalSplineBy();
if (ret)
@ -314,7 +380,7 @@ CCCardinalSplineBy* CCCardinalSplineBy::actionWithDuration(float duration, cocos
CC_SAFE_RELEASE_NULL(ret);
}
}
return ret;
}
@ -347,28 +413,28 @@ CCActionInterval* CCCardinalSplineBy::reverse()
// convert to "diffs" to "reverse absolute"
CCPointArray *reverse = copyConfig->reverse();
CCPointArray *pReverse = copyConfig->reverse();
copyConfig->release();
// 1st element (which should be 0,0) should be here too
p = reverse->getControlPointAtIndex(reverse->count()-1);
reverse->removeControlPointAtIndex(reverse->count()-1);
p = pReverse->getControlPointAtIndex(pReverse->count()-1);
pReverse->removeControlPointAtIndex(pReverse->count()-1);
p = ccpNeg(p);
reverse->insertControlPoint(p, 0);
pReverse->insertControlPoint(p, 0);
for (unsigned int i = 1; i < reverse->count(); ++i)
for (unsigned int i = 1; i < pReverse->count(); ++i)
{
CCPoint current = reverse->getControlPointAtIndex(i);
CCPoint current = pReverse->getControlPointAtIndex(i);
current = ccpNeg(current);
CCPoint abs = ccpAdd(current, p);
reverse->replaceControlPoint(abs, i);
pReverse->replaceControlPoint(abs, i);
p = abs;
}
return CCCardinalSplineBy::actionWithDuration(m_fDuration, reverse, m_fTension);
return CCCardinalSplineBy::create(m_fDuration, pReverse, m_fTension);
}
void CCCardinalSplineBy::startWithTarget(cocos2d::CCNode *pTarget)
@ -379,7 +445,25 @@ void CCCardinalSplineBy::startWithTarget(cocos2d::CCNode *pTarget)
/* CCCatmullRomTo
*/
CCCatmullRomTo* CCCatmullRomTo::actionWithDuration(float dt, cocos2d::CCPointArray *points)
// CCCatmullRomTo* CCCatmullRomTo::actionWithDuration(float dt, cocos2d::CCPointArray *points)
// {
// CCCatmullRomTo *ret = new CCCatmullRomTo();
// if (ret)
// {
// if (ret->initWithDuration(dt, points))
// {
// ret->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(ret);
// }
// }
//
// return ret;
// }
CCCatmullRomTo* CCCatmullRomTo::create(float dt, cocos2d::CCPointArray *points)
{
CCCatmullRomTo *ret = new CCCatmullRomTo();
if (ret)
@ -393,7 +477,7 @@ CCCatmullRomTo* CCCatmullRomTo::actionWithDuration(float dt, cocos2d::CCPointArr
CC_SAFE_RELEASE_NULL(ret);
}
}
return ret;
}
@ -409,7 +493,25 @@ bool CCCatmullRomTo::initWithDuration(float dt, cocos2d::CCPointArray *points)
/* CCCatmullRomBy
*/
CCCatmullRomBy* CCCatmullRomBy::actionWithDuration(float dt, cocos2d::CCPointArray *points)
// CCCatmullRomBy* CCCatmullRomBy::actionWithDuration(float dt, cocos2d::CCPointArray *points)
// {
// CCCatmullRomBy *ret = new CCCatmullRomBy();
// if (ret)
// {
// if (ret->initWithDuration(dt, points))
// {
// ret->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(ret);
// }
// }
//
// return ret;
// }
CCCatmullRomBy* CCCatmullRomBy::create(float dt, cocos2d::CCPointArray *points)
{
CCCatmullRomBy *ret = new CCCatmullRomBy();
if (ret)
@ -423,7 +525,7 @@ CCCatmullRomBy* CCCatmullRomBy::actionWithDuration(float dt, cocos2d::CCPointArr
CC_SAFE_RELEASE_NULL(ret);
}
}
return ret;
}

Просмотреть файл

@ -49,9 +49,14 @@ NS_CC_BEGIN;
class CC_DLL CCPointArray : public CCNode
{
public:
/** creates and initializes a Points array with capacity */
static CCPointArray* arrayWithCapacity(unsigned int capacity);
/** creates and initializes a Points array with capacity
@warning: This interface will be deprecated in future.
*/
//static CCPointArray* arrayWithCapacity(unsigned int capacity);
/** creates and initializes a Points array with capacity */
static CCPointArray* create(unsigned int capacity);
virtual ~CCPointArray();
CCPointArray();
@ -102,9 +107,14 @@ private:
class CC_DLL CCCardinalSplineTo : public CCActionInterval
{
public:
/** creates an action with a Cardinal Spline array of points and tension
@warning: This interface will be deprecated in future.
*/
//static CCCardinalSplineTo* actionWithDuration(float duration, CCPointArray* points, float tension);
/** creates an action with a Cardinal Spline array of points and tension */
static CCCardinalSplineTo* actionWithDuration(float duration, CCPointArray* points, float tension);
static CCCardinalSplineTo* create(float duration, CCPointArray* points, float tension);
virtual ~CCCardinalSplineTo();
CCCardinalSplineTo();
@ -140,9 +150,14 @@ protected:
class CC_DLL CCCardinalSplineBy : public CCCardinalSplineTo
{
public:
/** creates an action with a Cardinal Spline array of points and tension */
static CCCardinalSplineBy* actionWithDuration(float duration, CCPointArray* points, float tension);
/** creates an action with a Cardinal Spline array of points and tension
@warning: This interface will be deprecated in future.
*/
//static CCCardinalSplineBy* actionWithDuration(float duration, CCPointArray* points, float tension);
/** creates an action with a Cardinal Spline array of points and tension */
static CCCardinalSplineBy* create(float duration, CCPointArray* points, float tension);
CCCardinalSplineBy();
virtual void startWithTarget(CCNode *pTarget);
@ -159,9 +174,14 @@ protected:
class CC_DLL CCCatmullRomTo : public CCCardinalSplineTo
{
public:
/** creates an action with a Cardinal Spline array of points and tension */
static CCCatmullRomTo* actionWithDuration(float dt, CCPointArray* points);
/** creates an action with a Cardinal Spline array of points and tension
@warning: This interface will be deprecated in future.
*/
//static CCCatmullRomTo* actionWithDuration(float dt, CCPointArray* points);
/** creates an action with a Cardinal Spline array of points and tension */
static CCCatmullRomTo* create(float dt, CCPointArray* points);
/** initializes the action with a duration and an array of points */
bool initWithDuration(float dt, CCPointArray* points);
};
@ -173,9 +193,14 @@ public:
class CC_DLL CCCatmullRomBy : public CCCardinalSplineBy
{
public:
/** creates an action with a Cardinal Spline array of points and tension */
static CCCatmullRomBy* actionWithDuration(float dt, CCPointArray* points);
/** creates an action with a Cardinal Spline array of points and tension
@warning: This interface will be deprecated in future.
*/
//static CCCatmullRomBy* actionWithDuration(float dt, CCPointArray* points);
/** creates an action with a Cardinal Spline array of points and tension */
static CCCatmullRomBy* create(float dt, CCPointArray* points);
/** initializes the action with a duration and an array of points */
bool initWithDuration(float dt, CCPointArray* points);
};

Просмотреть файл

@ -42,7 +42,25 @@ NS_CC_BEGIN
//
// EaseAction
//
CCActionEase* CCActionEase::actionWithAction(CCActionInterval *pAction)
//cjh CCActionEase* CCActionEase::actionWithAction(CCActionInterval *pAction)
// {
// CCActionEase *pRet = new CCActionEase();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCActionEase* CCActionEase::create(CCActionInterval *pAction)
{
CCActionEase *pRet = new CCActionEase();
if (pRet)
@ -122,13 +140,31 @@ void CCActionEase::update(float time)
CCActionInterval* CCActionEase::reverse(void)
{
return CCActionEase::actionWithAction(m_pOther->reverse());
return CCActionEase::create(m_pOther->reverse());
}
//
// EaseRateAction
//
CCEaseRateAction* CCEaseRateAction::actionWithAction(CCActionInterval *pAction, float fRate)
//cjh CCEaseRateAction* CCEaseRateAction::actionWithAction(CCActionInterval *pAction, float fRate)
// {
// CCEaseRateAction *pRet = new CCEaseRateAction();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fRate))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseRateAction* CCEaseRateAction::create(CCActionInterval *pAction, float fRate)
{
CCEaseRateAction *pRet = new CCEaseRateAction();
if (pRet)
@ -184,13 +220,31 @@ CCEaseRateAction::~CCEaseRateAction(void)
CCActionInterval* CCEaseRateAction::reverse(void)
{
return CCEaseRateAction::actionWithAction(m_pOther->reverse(), 1 / m_fRate);
return CCEaseRateAction::create(m_pOther->reverse(), 1 / m_fRate);
}
//
// EeseIn
//
CCEaseIn* CCEaseIn::actionWithAction(CCActionInterval *pAction, float fRate)
//cjh CCEaseIn* CCEaseIn::actionWithAction(CCActionInterval *pAction, float fRate)
// {
// CCEaseIn *pRet = new CCEaseIn();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fRate))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseIn* CCEaseIn::create(CCActionInterval *pAction, float fRate)
{
CCEaseIn *pRet = new CCEaseIn();
if (pRet)
@ -236,13 +290,31 @@ void CCEaseIn::update(float time)
CCActionInterval* CCEaseIn::reverse(void)
{
return CCEaseIn::actionWithAction(m_pOther->reverse(), 1 / m_fRate);
return CCEaseIn::create(m_pOther->reverse(), 1 / m_fRate);
}
//
// EaseOut
//
CCEaseOut* CCEaseOut::actionWithAction(CCActionInterval *pAction, float fRate)
//cjh CCEaseOut* CCEaseOut::actionWithAction(CCActionInterval *pAction, float fRate)
// {
// CCEaseOut *pRet = new CCEaseOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fRate))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseOut* CCEaseOut::create(CCActionInterval *pAction, float fRate)
{
CCEaseOut *pRet = new CCEaseOut();
if (pRet)
@ -257,7 +329,7 @@ CCEaseOut* CCEaseOut::actionWithAction(CCActionInterval *pAction, float fRate)
}
}
return pRet;
return pRet;
}
CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
@ -288,13 +360,31 @@ void CCEaseOut::update(float time)
CCActionInterval* CCEaseOut::reverse()
{
return CCEaseOut::actionWithAction(m_pOther->reverse(), 1 / m_fRate);
return CCEaseOut::create(m_pOther->reverse(), 1 / m_fRate);
}
//
// EaseInOut
//
CCEaseInOut* CCEaseInOut::actionWithAction(CCActionInterval *pAction, float fRate)
//cjh CCEaseInOut* CCEaseInOut::actionWithAction(CCActionInterval *pAction, float fRate)
// {
// CCEaseInOut *pRet = new CCEaseInOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fRate))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseInOut* CCEaseInOut::create(CCActionInterval *pAction, float fRate)
{
CCEaseInOut *pRet = new CCEaseInOut();
if (pRet)
@ -309,7 +399,7 @@ CCEaseInOut* CCEaseInOut::actionWithAction(CCActionInterval *pAction, float fRat
}
}
return pRet;
return pRet;
}
CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
@ -349,13 +439,31 @@ void CCEaseInOut::update(float time)
// InOut and OutIn are symmetrical
CCActionInterval* CCEaseInOut::reverse(void)
{
return CCEaseInOut::actionWithAction(m_pOther->reverse(), m_fRate);
return CCEaseInOut::create(m_pOther->reverse(), m_fRate);
}
//
// EaseExponentialIn
//
CCEaseExponentialIn* CCEaseExponentialIn::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseExponentialIn* CCEaseExponentialIn::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseExponentialIn *pRet = new CCEaseExponentialIn();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseExponentialIn* CCEaseExponentialIn::create(CCActionInterval* pAction)
{
CCEaseExponentialIn *pRet = new CCEaseExponentialIn();
if (pRet)
@ -370,7 +478,7 @@ CCEaseExponentialIn* CCEaseExponentialIn::actionWithAction(CCActionInterval* pAc
}
}
return pRet;
return pRet;
}
CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
@ -401,13 +509,31 @@ void CCEaseExponentialIn::update(float time)
CCActionInterval* CCEaseExponentialIn::reverse(void)
{
return CCEaseExponentialOut::actionWithAction(m_pOther->reverse());
return CCEaseExponentialOut::create(m_pOther->reverse());
}
//
// EaseExponentialOut
//
CCEaseExponentialOut* CCEaseExponentialOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseExponentialOut* CCEaseExponentialOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseExponentialOut *pRet = new CCEaseExponentialOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseExponentialOut* CCEaseExponentialOut::create(CCActionInterval* pAction)
{
CCEaseExponentialOut *pRet = new CCEaseExponentialOut();
if (pRet)
@ -453,13 +579,31 @@ void CCEaseExponentialOut::update(float time)
CCActionInterval* CCEaseExponentialOut::reverse(void)
{
return CCEaseExponentialIn::actionWithAction(m_pOther->reverse());
return CCEaseExponentialIn::create(m_pOther->reverse());
}
//
// EaseExponentialInOut
//
CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(CCActionInterval *pAction)
//cjh CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(CCActionInterval *pAction)
// {
// CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseExponentialInOut* CCEaseExponentialInOut::create(CCActionInterval *pAction)
{
CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut();
if (pRet)
@ -515,13 +659,31 @@ void CCEaseExponentialInOut::update(float time)
CCActionInterval* CCEaseExponentialInOut::reverse()
{
return CCEaseExponentialInOut::actionWithAction(m_pOther->reverse());
return CCEaseExponentialInOut::create(m_pOther->reverse());
}
//
// EaseSineIn
//
CCEaseSineIn* CCEaseSineIn::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseSineIn* CCEaseSineIn::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseSineIn *pRet = new CCEaseSineIn();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseSineIn* CCEaseSineIn::create(CCActionInterval* pAction)
{
CCEaseSineIn *pRet = new CCEaseSineIn();
if (pRet)
@ -567,13 +729,31 @@ void CCEaseSineIn::update(float time)
CCActionInterval* CCEaseSineIn::reverse(void)
{
return CCEaseSineOut::actionWithAction(m_pOther->reverse());
return CCEaseSineOut::create(m_pOther->reverse());
}
//
// EaseSineOut
//
CCEaseSineOut* CCEaseSineOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseSineOut* CCEaseSineOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseSineOut *pRet = new CCEaseSineOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseSineOut* CCEaseSineOut::create(CCActionInterval* pAction)
{
CCEaseSineOut *pRet = new CCEaseSineOut();
if (pRet)
@ -619,13 +799,31 @@ void CCEaseSineOut::update(float time)
CCActionInterval* CCEaseSineOut::reverse(void)
{
return CCEaseSineIn::actionWithAction(m_pOther->reverse());
return CCEaseSineIn::create(m_pOther->reverse());
}
//
// EaseSineInOut
//
CCEaseSineInOut* CCEaseSineInOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseSineInOut* CCEaseSineInOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseSineInOut *pRet = new CCEaseSineInOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseSineInOut* CCEaseSineInOut::create(CCActionInterval* pAction)
{
CCEaseSineInOut *pRet = new CCEaseSineInOut();
if (pRet)
@ -671,31 +869,32 @@ void CCEaseSineInOut::update(float time)
CCActionInterval* CCEaseSineInOut::reverse()
{
return CCEaseSineInOut::actionWithAction(m_pOther->reverse());
return CCEaseSineInOut::create(m_pOther->reverse());
}
//
// EaseElastic
//
CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction)
{
CCEaseElastic *pRet = new CCEaseElastic();
if (pRet)
{
if (pRet->initWithAction(pAction))
{
pRet->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
}
}
return pRet;
}
//cjh CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
// {
// CCEaseElastic *pRet = new CCEaseElastic();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fPeriod))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float fPeriod)
CCEaseElastic* CCEaseElastic::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
{
CCEaseElastic *pRet = new CCEaseElastic();
if (pRet)
@ -713,12 +912,7 @@ CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float
return pRet;
}
bool CCEaseElastic::initWithAction(CCActionInterval *pAction)
{
return initWithAction(pAction, 0.3f);
}
bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod)
bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
{
if (CCActionEase::initWithAction(pAction))
{
@ -760,7 +954,25 @@ CCActionInterval* CCEaseElastic::reverse(void)
//
// EaseElasticIn
//
CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction, float fPeriod)
//cjh CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
// {
// CCEaseElasticIn *pRet = new CCEaseElasticIn();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fPeriod))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseElasticIn* CCEaseElasticIn::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
{
CCEaseElasticIn *pRet = new CCEaseElasticIn();
if (pRet)
@ -778,24 +990,6 @@ CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction, fl
return pRet;
}
CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction)
{
CCEaseElasticIn *pRet = new CCEaseElasticIn();
if (pRet)
{
if (pRet->initWithAction(pAction))
{
pRet->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
}
}
return pRet;
}
CCObject* CCEaseElasticIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
@ -836,31 +1030,32 @@ void CCEaseElasticIn::update(float time)
CCActionInterval* CCEaseElasticIn::reverse(void)
{
return CCEaseElasticOut::actionWithAction(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticOut::create(m_pOther->reverse(), m_fPeriod);
}
//
// EaseElasticOut
//
CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction)
{
CCEaseElasticOut *pRet = new CCEaseElasticOut();
if (pRet)
{
if (pRet->initWithAction(pAction))
{
pRet->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
}
}
return pRet;
}
//cjh CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
// {
// CCEaseElasticOut *pRet = new CCEaseElasticOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fPeriod))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction, float fPeriod)
CCEaseElasticOut* CCEaseElasticOut::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
{
CCEaseElasticOut *pRet = new CCEaseElasticOut();
if (pRet)
@ -917,31 +1112,32 @@ void CCEaseElasticOut::update(float time)
CCActionInterval* CCEaseElasticOut::reverse(void)
{
return CCEaseElasticIn::actionWithAction(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticIn::create(m_pOther->reverse(), m_fPeriod);
}
//
// EaseElasticInOut
//
CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pAction)
{
CCEaseElasticInOut *pRet = new CCEaseElasticInOut();
if (pRet)
{
if (pRet->initWithAction(pAction))
{
pRet->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
}
}
return pRet;
}
//cjh CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
// {
// CCEaseElasticInOut *pRet = new CCEaseElasticInOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, fPeriod))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pAction, float fPeriod)
CCEaseElasticInOut* CCEaseElasticInOut::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
{
CCEaseElasticInOut *pRet = new CCEaseElasticInOut();
if (pRet)
@ -1014,13 +1210,31 @@ void CCEaseElasticInOut::update(float time)
CCActionInterval* CCEaseElasticInOut::reverse(void)
{
return CCEaseElasticInOut::actionWithAction(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticInOut::create(m_pOther->reverse(), m_fPeriod);
}
//
// EaseBounce
//
CCEaseBounce* CCEaseBounce::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseBounce* CCEaseBounce::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseBounce *pRet = new CCEaseBounce();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBounce* CCEaseBounce::create(CCActionInterval* pAction)
{
CCEaseBounce *pRet = new CCEaseBounce();
if (pRet)
@ -1082,13 +1296,31 @@ float CCEaseBounce::bounceTime(float time)
CCActionInterval* CCEaseBounce::reverse()
{
return CCEaseBounce::actionWithAction(m_pOther->reverse());
return CCEaseBounce::create(m_pOther->reverse());
}
//
// EaseBounceIn
//
CCEaseBounceIn* CCEaseBounceIn::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseBounceIn* CCEaseBounceIn::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseBounceIn *pRet = new CCEaseBounceIn();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBounceIn* CCEaseBounceIn::create(CCActionInterval* pAction)
{
CCEaseBounceIn *pRet = new CCEaseBounceIn();
if (pRet)
@ -1135,13 +1367,31 @@ void CCEaseBounceIn::update(float time)
CCActionInterval* CCEaseBounceIn::reverse(void)
{
return CCEaseBounceOut::actionWithAction(m_pOther->reverse());
return CCEaseBounceOut::create(m_pOther->reverse());
}
//
// EaseBounceOut
//
CCEaseBounceOut* CCEaseBounceOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseBounceOut* CCEaseBounceOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseBounceOut *pRet = new CCEaseBounceOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBounceOut* CCEaseBounceOut::create(CCActionInterval* pAction)
{
CCEaseBounceOut *pRet = new CCEaseBounceOut();
if (pRet)
@ -1188,13 +1438,31 @@ void CCEaseBounceOut::update(float time)
CCActionInterval* CCEaseBounceOut::reverse(void)
{
return CCEaseBounceIn::actionWithAction(m_pOther->reverse());
return CCEaseBounceIn::create(m_pOther->reverse());
}
//
// EaseBounceInOut
//
CCEaseBounceInOut* CCEaseBounceInOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseBounceInOut* CCEaseBounceInOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseBounceInOut *pRet = new CCEaseBounceInOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBounceInOut* CCEaseBounceInOut::create(CCActionInterval* pAction)
{
CCEaseBounceInOut *pRet = new CCEaseBounceInOut();
if (pRet)
@ -1251,13 +1519,31 @@ void CCEaseBounceInOut::update(float time)
CCActionInterval* CCEaseBounceInOut::reverse()
{
return CCEaseBounceInOut::actionWithAction(m_pOther->reverse());
return CCEaseBounceInOut::create(m_pOther->reverse());
}
//
// EaseBackIn
//
CCEaseBackIn* CCEaseBackIn::actionWithAction(CCActionInterval *pAction)
//cjh CCEaseBackIn* CCEaseBackIn::actionWithAction(CCActionInterval *pAction)
// {
// CCEaseBackIn *pRet = new CCEaseBackIn();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBackIn* CCEaseBackIn::create(CCActionInterval *pAction)
{
CCEaseBackIn *pRet = new CCEaseBackIn();
if (pRet)
@ -1304,13 +1590,31 @@ void CCEaseBackIn::update(float time)
CCActionInterval* CCEaseBackIn::reverse(void)
{
return CCEaseBackOut::actionWithAction(m_pOther->reverse());
return CCEaseBackOut::create(m_pOther->reverse());
}
//
// EaseBackOut
//
CCEaseBackOut* CCEaseBackOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseBackOut* CCEaseBackOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseBackOut *pRet = new CCEaseBackOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBackOut* CCEaseBackOut::create(CCActionInterval* pAction)
{
CCEaseBackOut *pRet = new CCEaseBackOut();
if (pRet)
@ -1359,13 +1663,31 @@ void CCEaseBackOut::update(float time)
CCActionInterval* CCEaseBackOut::reverse(void)
{
return CCEaseBackIn::actionWithAction(m_pOther->reverse());
return CCEaseBackIn::create(m_pOther->reverse());
}
//
// EaseBackInOut
//
CCEaseBackInOut* CCEaseBackInOut::actionWithAction(CCActionInterval* pAction)
//cjh CCEaseBackInOut* CCEaseBackInOut::actionWithAction(CCActionInterval* pAction)
// {
// CCEaseBackInOut *pRet = new CCEaseBackInOut();
// if (pRet)
// {
// if (pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pRet);
// }
// }
//
// return pRet;
// }
CCEaseBackInOut* CCEaseBackInOut::create(CCActionInterval* pAction)
{
CCEaseBackInOut *pRet = new CCEaseBackInOut();
if (pRet)
@ -1422,7 +1744,7 @@ void CCEaseBackInOut::update(float time)
CCActionInterval* CCEaseBackInOut::reverse()
{
return CCEaseBackInOut::actionWithAction(m_pOther->reverse());
return CCEaseBackInOut::create(m_pOther->reverse());
}
NS_CC_END

Просмотреть файл

@ -51,8 +51,13 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCActionEase* actionWithAction(CCActionInterval *pAction);
/** creates the action */
static CCActionEase* actionWithAction(CCActionInterval *pAction);
static CCActionEase* create(CCActionInterval *pAction);
protected:
CCActionInterval *m_pOther;
@ -78,8 +83,13 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** Creates the action with the inner action and the rate parameter
@warning: This interface will be deprecated in future.
*/
//static CCEaseRateAction* actionWithAction(CCActionInterval* pAction, float fRate);
/** Creates the action with the inner action and the rate parameter */
static CCEaseRateAction* actionWithAction(CCActionInterval* pAction, float fRate);
static CCEaseRateAction* create(CCActionInterval* pAction, float fRate);
protected:
float m_fRate;
@ -95,8 +105,13 @@ public:
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** Creates the action with the inner action and the rate parameter
@warning: This interface will be deprecated in future.
*/
//static CCEaseIn* actionWithAction(CCActionInterval* pAction, float fRate);
/** Creates the action with the inner action and the rate parameter */
static CCEaseIn* actionWithAction(CCActionInterval* pAction, float fRate);
static CCEaseIn* create(CCActionInterval* pAction, float fRate);
};
/**
@ -110,8 +125,13 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** Creates the action with the inner action and the rate parameter
@warning: This interface will be deprecated in future.
*/
//static CCEaseOut* actionWithAction(CCActionInterval* pAction, float fRate);
/** Creates the action with the inner action and the rate parameter */
static CCEaseOut* actionWithAction(CCActionInterval* pAction, float fRate);
static CCEaseOut* create(CCActionInterval* pAction, float fRate);
};
/**
@ -125,8 +145,13 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** Creates the action with the inner action and the rate parameter
@warning: This interface will be deprecated in future.
*/
//static CCEaseInOut* actionWithAction(CCActionInterval* pAction, float fRate);
/** Creates the action with the inner action and the rate parameter */
static CCEaseInOut* actionWithAction(CCActionInterval* pAction, float fRate);
static CCEaseInOut* create(CCActionInterval* pAction, float fRate);
};
/**
@ -140,8 +165,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseExponentialIn* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseExponentialIn* actionWithAction(CCActionInterval* pAction);
static CCEaseExponentialIn* create(CCActionInterval* pAction);
};
/**
@ -155,9 +184,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseExponentialOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseExponentialOut* actionWithAction(CCActionInterval* pAction);
static CCEaseExponentialOut* create(CCActionInterval* pAction);
};
/**
@ -171,9 +203,13 @@ public:
virtual CCActionInterval* reverse();
public:
/** creates the action */
static CCEaseExponentialInOut* actionWithAction(CCActionInterval* pAction);
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseExponentialInOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseExponentialInOut* create(CCActionInterval* pAction);
};
/**
@ -187,8 +223,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseSineIn* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseSineIn* actionWithAction(CCActionInterval* pAction);
static CCEaseSineIn* create(CCActionInterval* pAction);
};
/**
@ -202,8 +242,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseSineOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseSineOut* actionWithAction(CCActionInterval* pAction);
static CCEaseSineOut* create(CCActionInterval* pAction);
};
/**
@ -217,8 +261,12 @@ public:
virtual CCActionInterval* reverse();
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseSineInOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseSineInOut* actionWithAction(CCActionInterval* pAction);
static CCEaseSineInOut* create(CCActionInterval* pAction);
};
/**
@ -234,19 +282,18 @@ public:
inline void setPeriod(float fPeriod) { m_fPeriod = fPeriod; }
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
bool initWithAction(CCActionInterval *pAction, float fPeriod);
/** initializes the action */
bool initWithAction(CCActionInterval *pAction);
bool initWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCEaseElastic* actionWithAction(CCActionInterval *pAction);
/** Creates the action with the inner action and the period in radians (default is 0.3)
@warning: This interface will be deprecated in future.
*/
//static CCEaseElastic* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElastic* actionWithAction(CCActionInterval *pAction, float fPeriod);
static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod = 0.3f);
protected:
float m_fPeriod;
};
@ -264,10 +311,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction);
/** Creates the action with the inner action and the period in radians (default is 0.3)
@warning: This interface will be deprecated in future.
*/
//static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction, float fPeriod);
static CCEaseElasticIn* create(CCActionInterval *pAction, float fPeriod = 0.3f);
};
/**
@ -283,10 +332,13 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction);
/** Creates the action with the inner action and the period in radians (default is 0.3)
@warning: This interface will be deprecated in future.
*/
//static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction, float fPeriod);
static CCEaseElasticOut* create(CCActionInterval *pAction, float fPeriod = 0.3f);
};
/**
@ -302,10 +354,13 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction);
/** Creates the action with the inner action and the period in radians (default is 0.3)
@warning: This interface will be deprecated in future.
*/
//static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction, float fPeriod);
static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPeriod = 0.3f);
};
/**
@ -320,8 +375,12 @@ public:
virtual CCActionInterval* reverse();
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBounce* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBounce* actionWithAction(CCActionInterval* pAction);
static CCEaseBounce* create(CCActionInterval* pAction);
};
/**
@ -337,8 +396,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBounceIn* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBounceIn* actionWithAction(CCActionInterval* pAction);
static CCEaseBounceIn* create(CCActionInterval* pAction);
};
/**
@ -354,8 +417,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBounceOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBounceOut* actionWithAction(CCActionInterval* pAction);
static CCEaseBounceOut* create(CCActionInterval* pAction);
};
/**
@ -371,8 +438,12 @@ public:
virtual CCActionInterval* reverse();
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBounceInOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBounceInOut* actionWithAction(CCActionInterval* pAction);
static CCEaseBounceInOut* create(CCActionInterval* pAction);
};
/**
@ -388,8 +459,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBackIn* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBackIn* actionWithAction(CCActionInterval* pAction);
static CCEaseBackIn* create(CCActionInterval* pAction);
};
/**
@ -405,8 +480,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBackOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBackOut* actionWithAction(CCActionInterval* pAction);
static CCEaseBackOut* create(CCActionInterval* pAction);
};
/**
@ -422,8 +501,12 @@ public:
virtual CCActionInterval* reverse();
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCEaseBackInOut* actionWithAction(CCActionInterval* pAction);
/** creates the action */
static CCEaseBackInOut* actionWithAction(CCActionInterval* pAction);
static CCEaseBackInOut* create(CCActionInterval* pAction);
};
NS_CC_END

Просмотреть файл

@ -30,7 +30,25 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCGridAction
CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, float duration)
// CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, float duration)
// {
// CCGridAction *pAction = new CCGridAction();
// if (pAction)
// {
// if (pAction->initWithSize(gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pAction);
// }
// }
//
// return pAction;
// }
CCGridAction* CCGridAction::create(const ccGridSize& gridSize, float duration)
{
CCGridAction *pAction = new CCGridAction();
if (pAction)
@ -103,7 +121,7 @@ CCGridBase* CCGridAction::getGrid(void)
CCActionInterval* CCGridAction::reverse(void)
{
return CCReverseTime::actionWithAction(this);
return CCReverseTime::create(this);
}
CCObject* CCGridAction::copyWithZone(CCZone *pZone)
@ -181,7 +199,25 @@ void CCTiledGrid3DAction::setTile(const ccGridSize& pos, const ccQuad3& coords)
// implementation CCAccelDeccelAmplitude
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pAction, float duration)
// CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pAction, float duration)
// {
// CCAccelDeccelAmplitude *pRet = new CCAccelDeccelAmplitude();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, duration))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pRet);
// }
// }
//
// return pRet;
// }
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::create(CCAction *pAction, float duration)
{
CCAccelDeccelAmplitude *pRet = new CCAccelDeccelAmplitude();
if (pRet)
@ -239,12 +275,30 @@ void CCAccelDeccelAmplitude::update(float time)
CCActionInterval* CCAccelDeccelAmplitude::reverse(void)
{
return CCAccelDeccelAmplitude::actionWithAction(m_pOther->reverse(), m_fDuration);
return CCAccelDeccelAmplitude::create(m_pOther->reverse(), m_fDuration);
}
// implementation of AccelAmplitude
CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, float duration)
// CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, float duration)
// {
// CCAccelAmplitude *pRet = new CCAccelAmplitude();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, duration))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pRet);
// }
// }
//
// return pRet;
// }
CCAccelAmplitude* CCAccelAmplitude::create(CCAction *pAction, float duration)
{
CCAccelAmplitude *pRet = new CCAccelAmplitude();
if (pRet)
@ -295,12 +349,30 @@ void CCAccelAmplitude::update(float time)
CCActionInterval* CCAccelAmplitude::reverse(void)
{
return CCAccelAmplitude::actionWithAction(m_pOther->reverse(), m_fDuration);
return CCAccelAmplitude::create(m_pOther->reverse(), m_fDuration);
}
// DeccelAmplitude
CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, float duration)
// CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, float duration)
// {
// CCDeccelAmplitude *pRet = new CCDeccelAmplitude();
// if (pRet)
// {
// if (pRet->initWithAction(pAction, duration))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pRet);
// }
// }
//
// return pRet;
// }
CCDeccelAmplitude* CCDeccelAmplitude::create(CCAction *pAction, float duration)
{
CCDeccelAmplitude *pRet = new CCDeccelAmplitude();
if (pRet)
@ -318,6 +390,7 @@ CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, float
return pRet;
}
bool CCDeccelAmplitude::initWithAction(CCAction *pAction, float duration)
{
if (CCActionInterval::initWithDuration(duration))
@ -351,7 +424,7 @@ void CCDeccelAmplitude::update(float time)
CCActionInterval* CCDeccelAmplitude::reverse(void)
{
return CCDeccelAmplitude::actionWithAction(m_pOther->reverse(), m_fDuration);
return CCDeccelAmplitude::create(m_pOther->reverse(), m_fDuration);
}
// implementation of StopGrid
@ -367,17 +440,42 @@ void CCStopGrid::startWithTarget(CCNode *pTarget)
}
}
CCStopGrid* CCStopGrid::action(void)
// CCStopGrid* CCStopGrid::action(void)
// {
// CCStopGrid* pAction = new CCStopGrid();
// pAction->autorelease();
//
// return pAction;
// }
CCStopGrid* CCStopGrid::create(void)
{
CCStopGrid* pAction = new CCStopGrid();
pAction->autorelease();
return pAction;
}
// implementation of CCReuseGrid
CCReuseGrid* CCReuseGrid::actionWithTimes(int times)
// CCReuseGrid* CCReuseGrid::actionWithTimes(int times)
// {
// CCReuseGrid *pAction = new CCReuseGrid();
// if (pAction)
// {
// if (pAction->initWithTimes(times))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pAction);
// }
// }
//
// return pAction;
// }
CCReuseGrid* CCReuseGrid::create(int times)
{
CCReuseGrid *pAction = new CCReuseGrid();
if (pAction)

Просмотреть файл

@ -46,9 +46,12 @@ public:
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration
@warning: This interface will be deprecated in future.
*/
//static CCGridAction* actionWithSize(const ccGridSize& gridSize, float duration);
/** creates the action with size and duration */
static CCGridAction* actionWithSize(const ccGridSize& gridSize, float duration);
static CCGridAction* create(const ccGridSize& gridSize, float duration);
protected:
ccGridSize m_sGridSize;
};
@ -70,8 +73,12 @@ public:
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
public:
/** creates the action with size and duration
@warning: This interface will be deprecated in future.
*/
//static CCGrid3DAction* actionWithSize(const ccGridSize& gridSize, float duration);
/** creates the action with size and duration */
static CCGrid3DAction* actionWithSize(const ccGridSize& gridSize, float duration);
static CCGrid3DAction* create(const ccGridSize& gridSize, float duration);
};
/** @brief Base class for CCTiledGrid3D actions */
@ -89,8 +96,12 @@ public:
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration
@warning: This interface will be deprecated in future.
*/
//static CCTiledGrid3DAction* actionWithSize(const ccGridSize& gridSize, float duration);
/** creates the action with size and duration */
static CCTiledGrid3DAction* actionWithSize(const ccGridSize& gridSize, float duration);
static CCTiledGrid3DAction* create(const ccGridSize& gridSize, float duration);
};
/** @brief CCAccelDeccelAmplitude action */
@ -111,8 +122,12 @@ public:
inline void setRate(float fRate) { m_fRate = fRate; }
public:
/** creates the action with an inner action that has the amplitude property, and a duration time
@warning: This interface will be deprecated in future.
*/
//static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, float duration);
/** creates the action with an inner action that has the amplitude property, and a duration time */
static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, float duration);
static CCAccelDeccelAmplitude* create(CCAction *pAction, float duration);
protected:
float m_fRate;
@ -137,9 +152,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action with an inner action that has the amplitude property, and a duration time
@warning: This interface will be deprecated in future.
*/
//static CCAccelAmplitude* actionWithAction(CCAction *pAction, float duration);
/** creates the action with an inner action that has the amplitude property, and a duration time */
static CCAccelAmplitude* actionWithAction(CCAction *pAction, float duration);
static CCAccelAmplitude* create(CCAction *pAction, float duration);
protected:
float m_fRate;
CCActionInterval *m_pOther;
@ -163,8 +181,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action with an inner action that has the amplitude property, and a duration time
@warning: This interface will be deprecated in future.
*/
//static CCDeccelAmplitude* actionWithAction(CCAction *pAction, float duration);
/** creates the action with an inner action that has the amplitude property, and a duration time */
static CCDeccelAmplitude* actionWithAction(CCAction *pAction, float duration);
static CCDeccelAmplitude* create(CCAction *pAction, float duration);
protected:
float m_fRate;
@ -182,8 +204,12 @@ public:
virtual void startWithTarget(CCNode *pTarget);
public:
/** Allocates and initializes the action
@warning: This interface will be deprecated in future.
*/
//static CCStopGrid* action(void);
/** Allocates and initializes the action */
static CCStopGrid* action(void);
static CCStopGrid* create(void);
};
/** @brief CCReuseGrid action */
@ -196,9 +222,12 @@ public:
virtual void startWithTarget(CCNode *pTarget);
public:
/** creates an action with the number of times that the current grid will be reused
@warning: This interface will be deprecated in future.
*/
//static CCReuseGrid* actionWithTimes(int times);
/** creates an action with the number of times that the current grid will be reused */
static CCReuseGrid* actionWithTimes(int times);
static CCReuseGrid* create(int times);
protected:
int m_nTimes;
};

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org
@ -31,7 +31,26 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCWaves3D
CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
// CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
// {
// CCWaves3D *pAction = new CCWaves3D();
//
// if (pAction)
// {
// if (pAction->initWithWaves(wav, amp, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCWaves3D* CCWaves3D::create(int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCWaves3D *pAction = new CCWaves3D();
@ -105,7 +124,26 @@ void CCWaves3D::update(float time)
// implementation of CCFlipX3D
CCFlipX3D* CCFlipX3D::actionWithDuration(float duration)
// CCFlipX3D* CCFlipX3D::actionWithDuration(float duration)
// {
// CCFlipX3D *pAction = new CCFlipX3D();
//
// if (pAction)
// {
// if (pAction->initWithSize(ccg(1, 1), duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCFlipX3D* CCFlipX3D::create(float duration)
{
CCFlipX3D *pAction = new CCFlipX3D();
@ -231,7 +269,26 @@ void CCFlipX3D::update(float time)
// implementation of FlipY3D
CCFlipY3D* CCFlipY3D::actionWithDuration(float duration)
// CCFlipY3D* CCFlipY3D::actionWithDuration(float duration)
// {
// CCFlipY3D *pAction = new CCFlipY3D();
//
// if (pAction)
// {
// if (pAction->initWithSize(ccg(1, 1), duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCFlipY3D* CCFlipY3D::create(float duration)
{
CCFlipY3D *pAction = new CCFlipY3D();
@ -340,7 +397,26 @@ void CCFlipY3D::update(float time)
// implementation of Lens3D
CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
// CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
// {
// CCLens3D *pAction = new CCLens3D();
//
// if (pAction)
// {
// if (pAction->initWithPosition(pos, r, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCLens3D* CCLens3D::create(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
{
CCLens3D *pAction = new CCLens3D();
@ -451,7 +527,26 @@ void CCLens3D::update(float time)
// implementation of Ripple3D
CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
// CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
// {
// CCRipple3D *pAction = new CCRipple3D();
//
// if (pAction)
// {
// if (pAction->initWithPosition(pos, r, wav, amp, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCRipple3D* CCRipple3D::create(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCRipple3D *pAction = new CCRipple3D();
@ -540,7 +635,26 @@ void CCRipple3D::update(float time)
// implementation of Shaky3D
CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
// CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
// {
// CCShaky3D *pAction = new CCShaky3D();
//
// if (pAction)
// {
// if (pAction->initWithRange(range, shakeZ, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCShaky3D* CCShaky3D::create(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
{
CCShaky3D *pAction = new CCShaky3D();
@ -619,7 +733,26 @@ void CCShaky3D::update(float time)
// implementation of Liquid
CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
// CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
// {
// CCLiquid *pAction = new CCLiquid();
//
// if (pAction)
// {
// if (pAction->initWithWaves(wav, amp, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCLiquid* CCLiquid::create(int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCLiquid *pAction = new CCLiquid();
@ -693,7 +826,26 @@ void CCLiquid::update(float time)
// implementation of Waves
CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
// CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
// {
// CCWaves *pAction = new CCWaves();
//
// if (pAction)
// {
// if (pAction->initWithWaves(wav, amp, h, v, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCWaves* CCWaves::create(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
{
CCWaves *pAction = new CCWaves();
@ -778,7 +930,26 @@ void CCWaves::update(float time)
// implementation of Twirl
CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize, float duration)
// CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize, float duration)
// {
// CCTwirl *pAction = new CCTwirl();
//
// if (pAction)
// {
// if (pAction->initWithPosition(pos, t, amp, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCTwirl* CCTwirl::create(CCPoint pos, int t, float amp, const ccGridSize& gridSize, float duration)
{
CCTwirl *pAction = new CCTwirl();

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org
@ -47,9 +47,12 @@ public:
virtual void update(float time);
public:
/** create the action
@warning: This interface will be deprecated in future.
*/
//static CCWaves3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
/** create the action */
static CCWaves3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
static CCWaves3D* create(int wav, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nWaves;
float m_fAmplitude;
@ -67,8 +70,12 @@ public:
virtual void update(float time);
public:
/** creates the action with duration
@warning: This interface will be deprecated in future.
*/
//static CCFlipX3D* actionWithDuration(float duration);
/** creates the action with duration */
static CCFlipX3D* actionWithDuration(float duration);
static CCFlipX3D* create(float duration);
};
/** @brief CCFlipY3D action */
@ -79,8 +86,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action with duration
@warning: This interface will be deprecated in future.
*/
//static CCFlipY3D* actionWithDuration(float duration);
/** creates the action with duration */
static CCFlipY3D* actionWithDuration(float duration);
static CCFlipY3D* create(float duration);
};
/** @brief CCLens3D action */
@ -101,8 +112,12 @@ public:
virtual void update(float time);
public:
/** creates the action with center position, radius, a grid size and duration
@warning: This interface will be deprecated in future.
*/
//static CCLens3D* actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration);
/** creates the action with center position, radius, a grid size and duration */
static CCLens3D* actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration);
static CCLens3D* create(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration);
protected:
/* lens center position */
CCPoint m_position;
@ -135,8 +150,13 @@ public:
virtual void update(float time);
public:
/** creates the action with radius, number of waves, amplitude, a grid size and duration
@warning: This interface will be deprecated in future.
*/
//static CCRipple3D* actionWithPosition(const CCPoint& pos, float r, int wav, float amp,
// const ccGridSize& gridSize, float duration);
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
static CCRipple3D* actionWithPosition(const CCPoint& pos, float r, int wav, float amp,
static CCRipple3D* create(const CCPoint& pos, float r, int wav, float amp,
const ccGridSize& gridSize, float duration);
protected:
/* center position */
@ -157,9 +177,12 @@ public:
virtual void update(float time);
public:
/** creates the action with a range, shake Z vertices, a grid and duration
@warning: This interface will be deprecated in future.
*/
//static CCShaky3D* actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration);
/** creates the action with a range, shake Z vertices, a grid and duration */
static CCShaky3D* actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration);
static CCShaky3D* create(int range, bool shakeZ, const ccGridSize& gridSize, float duration);
protected:
int m_nRandrange;
bool m_bShakeZ;
@ -181,9 +204,12 @@ public:
virtual void update(float time);
public:
/** creates the action with amplitude, a grid and duration
@warning: This interface will be deprecated in future.
*/
//static CCLiquid* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
/** creates the action with amplitude, a grid and duration */
static CCLiquid* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
static CCLiquid* create(int wav, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nWaves;
float m_fAmplitude;
@ -207,8 +233,14 @@ public:
virtual void update(float time);
public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
@warning: This interface will be deprecated in future.
*/
// static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
// float duration);
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
static CCWaves* create(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
float duration);
protected:
int m_nWaves;
@ -240,8 +272,14 @@ public:
virtual void update(float time);
public:
/** creates the action with center position, number of twirls, amplitude, a grid size and duration
@warning: This interface will be deprecated in future.
*/
// static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize,
// float duration);
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize,
static CCTwirl* create(CCPoint pos, int t, float amp, const ccGridSize& gridSize,
float duration);
protected:
/* twirl center */

Просмотреть файл

@ -73,7 +73,17 @@ CCFiniteTimeAction * CCActionInstant::reverse() {
//
// Show
//
CCShow* CCShow::action() {
// CCShow* CCShow::action() {
// CCShow* pRet = new CCShow();
//
// if (pRet) {
// pRet->autorelease();
// }
//
// return pRet;
// }
CCShow* CCShow::create() {
CCShow* pRet = new CCShow();
if (pRet) {
@ -89,7 +99,7 @@ void CCShow::update(float time) {
}
CCFiniteTimeAction* CCShow::reverse() {
return (CCFiniteTimeAction*) (CCHide::action());
return (CCFiniteTimeAction*) (CCHide::create());
}
CCObject* CCShow::copyWithZone(CCZone *pZone) {
@ -111,7 +121,17 @@ CCObject* CCShow::copyWithZone(CCZone *pZone) {
//
// Hide
//
CCHide * CCHide::action() {
// CCHide * CCHide::action() {
// CCHide *pRet = new CCHide();
//
// if (pRet) {
// pRet->autorelease();
// }
//
// return pRet;
// }
CCHide * CCHide::create() {
CCHide *pRet = new CCHide();
if (pRet) {
@ -127,7 +147,7 @@ void CCHide::update(float time) {
}
CCFiniteTimeAction *CCHide::reverse() {
return (CCFiniteTimeAction*) (CCShow::action());
return (CCFiniteTimeAction*) (CCShow::create());
}
CCObject* CCHide::copyWithZone(CCZone *pZone) {
@ -149,7 +169,19 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
//
// ToggleVisibility
//
CCToggleVisibility * CCToggleVisibility::action()
// CCToggleVisibility * CCToggleVisibility::action()
// {
// CCToggleVisibility *pRet = new CCToggleVisibility();
//
// if (pRet)
// {
// pRet->autorelease();
// }
//
// return pRet;
// }
CCToggleVisibility * CCToggleVisibility::create()
{
CCToggleVisibility *pRet = new CCToggleVisibility();
@ -187,7 +219,19 @@ CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone)
//
// FlipX
//
CCFlipX *CCFlipX::actionWithFlipX(bool x) {
// CCFlipX *CCFlipX::actionWithFlipX(bool x) {
// CCFlipX *pRet = new CCFlipX();
//
// if (pRet && pRet->initWithFlipX(x)) {
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCFlipX *CCFlipX::create(bool x) {
CCFlipX *pRet = new CCFlipX();
if (pRet && pRet->initWithFlipX(x)) {
@ -210,7 +254,7 @@ void CCFlipX::update(float time) {
}
CCFiniteTimeAction* CCFlipX::reverse() {
return CCFlipX::actionWithFlipX(!m_bFlipX);
return CCFlipX::create(!m_bFlipX);
}
CCObject * CCFlipX::copyWithZone(CCZone *pZone) {
@ -233,7 +277,19 @@ CCObject * CCFlipX::copyWithZone(CCZone *pZone) {
//
// FlipY
//
CCFlipY * CCFlipY::actionWithFlipY(bool y) {
// CCFlipY * CCFlipY::actionWithFlipY(bool y) {
// CCFlipY *pRet = new CCFlipY();
//
// if (pRet && pRet->initWithFlipY(y)) {
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCFlipY * CCFlipY::create(bool y) {
CCFlipY *pRet = new CCFlipY();
if (pRet && pRet->initWithFlipY(y)) {
@ -256,7 +312,7 @@ void CCFlipY::update(float time) {
}
CCFiniteTimeAction* CCFlipY::reverse() {
return CCFlipY::actionWithFlipY(!m_bFlipY);
return CCFlipY::create(!m_bFlipY);
}
CCObject* CCFlipY::copyWithZone(CCZone *pZone) {
@ -279,7 +335,19 @@ CCObject* CCFlipY::copyWithZone(CCZone *pZone) {
//
// Place
//
CCPlace* CCPlace::actionWithPosition(const CCPoint& pos) {
// CCPlace* CCPlace::actionWithPosition(const CCPoint& pos) {
// CCPlace *pRet = new CCPlace();
//
// if (pRet && pRet->initWithPosition(pos)) {
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCPlace* CCPlace::create(const CCPoint& pos) {
CCPlace *pRet = new CCPlace();
if (pRet && pRet->initWithPosition(pos)) {
@ -322,7 +390,21 @@ void CCPlace::update(float time) {
// CallFunc
//
CCCallFunc * CCCallFunc::actionWithTarget(CCObject* pSelectorTarget,
// CCCallFunc * CCCallFunc::actionWithTarget(CCObject* pSelectorTarget,
// SEL_CallFunc selector) {
// CCCallFunc *pRet = new CCCallFunc();
//
// if (pRet && pRet->initWithTarget(pSelectorTarget)) {
// pRet->m_pCallFunc = selector;
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCCallFunc * CCCallFunc::create(CCObject* pSelectorTarget,
SEL_CallFunc selector) {
CCCallFunc *pRet = new CCCallFunc();
@ -390,7 +472,20 @@ void CCCallFuncN::execute() {
}
}
CCCallFuncN * CCCallFuncN::actionWithTarget(CCObject* pSelectorTarget,
// CCCallFuncN * CCCallFuncN::actionWithTarget(CCObject* pSelectorTarget,
// SEL_CallFuncN selector) {
// CCCallFuncN *pRet = new CCCallFuncN();
//
// if (pRet && pRet->initWithTarget(pSelectorTarget, selector)) {
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCCallFuncN * CCCallFuncN::create(CCObject* pSelectorTarget,
SEL_CallFuncN selector) {
CCCallFuncN *pRet = new CCCallFuncN();
@ -434,7 +529,20 @@ CCObject * CCCallFuncN::copyWithZone(CCZone* zone) {
//
// CallFuncND
//
CCCallFuncND * CCCallFuncND::actionWithTarget(CCObject* pSelectorTarget,
// CCCallFuncND * CCCallFuncND::actionWithTarget(CCObject* pSelectorTarget,
// SEL_CallFuncND selector, void* d) {
// CCCallFuncND* pRet = new CCCallFuncND();
//
// if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d)) {
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCCallFuncND * CCCallFuncND::create(CCObject* pSelectorTarget,
SEL_CallFuncND selector, void* d) {
CCCallFuncND* pRet = new CCCallFuncND();
@ -499,7 +607,20 @@ void CCCallFuncO::execute() {
}
}
CCCallFuncO * CCCallFuncO::actionWithTarget(CCObject* pSelectorTarget,
// CCCallFuncO * CCCallFuncO::actionWithTarget(CCObject* pSelectorTarget,
// SEL_CallFuncO selector, CCObject* pObject) {
// CCCallFuncO *pRet = new CCCallFuncO();
//
// if (pRet && pRet->initWithTarget(pSelectorTarget, selector, pObject)) {
// pRet->autorelease();
// return pRet;
// }
//
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCCallFuncO * CCCallFuncO::create(CCObject* pSelectorTarget,
SEL_CallFuncO selector, CCObject* pObject) {
CCCallFuncO *pRet = new CCCallFuncO();

Просмотреть файл

@ -63,8 +63,13 @@ public:
virtual CCObject* copyWithZone(CCZone *pZone);
public:
//override static method
/** Allocates and initializes the action
@warning: This interface will be deprecated in future.
*/
//static CCShow * action();
/** Allocates and initializes the action */
static CCShow * action();
static CCShow * create();
};
@ -83,8 +88,13 @@ public:
virtual CCObject* copyWithZone(CCZone *pZone);
public:
//override static method
/** Allocates and initializes the action
@warning: This interface will be deprecated in future.
*/
//static CCHide * action();
/** Allocates and initializes the action */
static CCHide * action();
static CCHide * create();
};
/** @brief Toggles the visibility of a node
@ -99,8 +109,13 @@ public:
virtual CCObject* copyWithZone(CCZone *pZone);
public:
//override static method
/** Allocates and initializes the action
@warning: This interface will be deprecated in future.
*/
//static CCToggleVisibility * action();
/** Allocates and initializes the action */
static CCToggleVisibility * action();
static CCToggleVisibility * create();
};
/**
@ -115,8 +130,14 @@ public:
{}
virtual ~CCFlipX(){}
/** create the action
@warning: This interface will be deprecated in future.
*/
//static CCFlipX * actionWithFlipX(bool x);
/** create the action */
static CCFlipX * actionWithFlipX(bool x);
static CCFlipX * create(bool x);
/** init the action */
bool initWithFlipX(bool x);
//super methods
@ -140,8 +161,14 @@ public:
{}
virtual ~CCFlipY(){}
/** create the action
@warning: This interface will be deprecated in future.
*/
//static CCFlipY * actionWithFlipY(bool y);
/** create the action */
static CCFlipY * actionWithFlipY(bool y);
static CCFlipY * create(bool y);
/** init the action */
bool initWithFlipY(bool y);
//super methods
@ -160,8 +187,12 @@ class CC_DLL CCPlace : public CCActionInstant //<NSCopying>
public:
CCPlace(){}
virtual ~CCPlace(){}
/** creates a Place action with a position
@warning: This interface will be deprecated in future.
*/
//static CCPlace * actionWithPosition(const CCPoint& pos);
/** creates a Place action with a position */
static CCPlace * actionWithPosition(const CCPoint& pos);
static CCPlace * create(const CCPoint& pos);
/** Initializes a Place action with a position */
bool initWithPosition(const CCPoint& pos);
//super methods
@ -189,11 +220,18 @@ public:
m_pSelectorTarget->release();
}
}
/** creates the action with the callback
@warning: This interface will be deprecated in future.
typedef void (CCObject::*SEL_CallFunc)();
*/
//static CCCallFunc * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFunc selector);
/** creates the action with the callback
typedef void (CCObject::*SEL_CallFunc)();
*/
static CCCallFunc * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFunc selector);
static CCCallFunc * create(CCObject* pSelectorTarget, SEL_CallFunc selector);
/** initializes the action with the callback
typedef void (CCObject::*SEL_CallFunc)();
@ -250,11 +288,17 @@ class CC_DLL CCCallFuncN : public CCCallFunc
public:
CCCallFuncN(){}
virtual ~CCCallFuncN(){}
/** creates the action with the callback
@warning: This interface will be deprecated in future.
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
*/
//static CCCallFuncN * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector);
/** creates the action with the callback
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
*/
static CCCallFuncN * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector);
static CCCallFuncN * create(CCObject* pSelectorTarget, SEL_CallFuncN selector);
/** initializes the action with the callback
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
@ -274,8 +318,14 @@ class CC_DLL CCCallFuncND : public CCCallFuncN
{
public:
/** creates the action with the callback and the data to pass as an argument
@warning: This interface will be deprecated in future.
*/
//static CCCallFuncND * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
/** creates the action with the callback and the data to pass as an argument */
static CCCallFuncND * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
static CCCallFuncND * create(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
/** initializes the action with the callback and the data to pass as an argument */
virtual bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
// super methods
@ -297,11 +347,18 @@ class CC_DLL CCCallFuncO : public CCCallFunc
public:
CCCallFuncO();
virtual ~CCCallFuncO();
/** creates the action with the callback
@warning: This interface will be deprecated in future.
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);
*/
//static CCCallFuncO * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
/** creates the action with the callback
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);
*/
static CCCallFuncO * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
static CCCallFuncO * create(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
/** initializes the action with the callback
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);

Просмотреть файл

@ -38,7 +38,16 @@ NS_CC_BEGIN
//
// IntervalAction
//
CCActionInterval* CCActionInterval::actionWithDuration(float d)
// CCActionInterval* CCActionInterval::actionWithDuration(float d)
// {
// CCActionInterval *pAction = new CCActionInterval();
// pAction->initWithDuration(d);
// pAction->autorelease();
//
// return pAction;
// }
CCActionInterval* CCActionInterval::create(float d)
{
CCActionInterval *pAction = new CCActionInterval();
pAction->initWithDuration(d);
@ -146,7 +155,16 @@ CCActionInterval* CCActionInterval::reverse(void)
//
// Sequence
//
CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
// CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
// {
// CCSequence *pSequence = new CCSequence();
// pSequence->initOneTwo(pActionOne, pActionTwo);
// pSequence->autorelease();
//
// return pSequence;
// }
CCSequence* CCSequence::create(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{
CCSequence *pSequence = new CCSequence();
pSequence->initOneTwo(pActionOne, pActionTwo);
@ -155,7 +173,32 @@ CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTim
return pSequence;
}
CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
// CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
// {
// va_list params;
// va_start(params, pAction1);
//
// CCFiniteTimeAction *pNow;
// CCFiniteTimeAction *pPrev = pAction1;
//
// while (pAction1)
// {
// pNow = va_arg(params, CCFiniteTimeAction*);
// if (pNow)
// {
// pPrev = actionOneTwo(pPrev, pNow);
// }
// else
// {
// break;
// }
// }
//
// va_end(params);
// return pPrev;
// }
CCFiniteTimeAction* CCSequence::create(CCFiniteTimeAction *pAction1, ...)
{
va_list params;
va_start(params, pAction1);
@ -168,7 +211,7 @@ CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
pNow = va_arg(params, CCFiniteTimeAction*);
if (pNow)
{
pPrev = actionOneTwo(pPrev, pNow);
pPrev = create(pPrev, pNow);
}
else
{
@ -180,13 +223,25 @@ CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
return pPrev;
}
CCFiniteTimeAction* CCSequence::actionWithArray(CCArray *actions)
// CCFiniteTimeAction* CCSequence::actionWithArray(CCArray *actions)
// {
// CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
//
// for (unsigned int i = 1; i < actions->count(); ++i)
// {
// prev = actionOneTwo(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i));
// }
//
// return prev;
// }
CCFiniteTimeAction* CCSequence::create(CCArray *actions)
{
CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
for (unsigned int i = 1; i < actions->count(); ++i)
{
prev = actionOneTwo(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i));
prev = create(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i));
}
return prev;
@ -307,13 +362,22 @@ void CCSequence::update(float t)
CCActionInterval* CCSequence::reverse(void)
{
return CCSequence::actionOneTwo(m_pActions[1]->reverse(), m_pActions[0]->reverse());
return CCSequence::create(m_pActions[1]->reverse(), m_pActions[0]->reverse());
}
//
// Repeat
//
CCRepeat* CCRepeat::actionWithAction(CCFiniteTimeAction *pAction, unsigned int times)
// CCRepeat* CCRepeat::actionWithAction(CCFiniteTimeAction *pAction, unsigned int times)
// {
// CCRepeat* pRepeat = new CCRepeat();
// pRepeat->initWithAction(pAction, times);
// pRepeat->autorelease();
//
// return pRepeat;
// }
CCRepeat* CCRepeat::create(CCFiniteTimeAction *pAction, unsigned int times)
{
CCRepeat* pRepeat = new CCRepeat();
pRepeat->initWithAction(pAction, times);
@ -440,7 +504,7 @@ bool CCRepeat::isDone(void)
CCActionInterval* CCRepeat::reverse(void)
{
return CCRepeat::actionWithAction(m_pInnerAction->reverse(), m_uTimes);
return CCRepeat::create(m_pInnerAction->reverse(), m_uTimes);
}
//
@ -450,7 +514,20 @@ CCRepeatForever::~CCRepeatForever()
{
CC_SAFE_RELEASE(m_pInnerAction);
}
CCRepeatForever *CCRepeatForever::actionWithAction(CCActionInterval *pAction)
// CCRepeatForever *CCRepeatForever::actionWithAction(CCActionInterval *pAction)
// {
// CCRepeatForever *pRet = new CCRepeatForever();
// if (pRet && pRet->initWithAction(pAction))
// {
// pRet->autorelease();
// return pRet;
// }
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCRepeatForever *CCRepeatForever::create(CCActionInterval *pAction)
{
CCRepeatForever *pRet = new CCRepeatForever();
if (pRet && pRet->initWithAction(pAction))
@ -515,13 +592,38 @@ bool CCRepeatForever::isDone()
CCActionInterval *CCRepeatForever::reverse()
{
return (CCActionInterval*)(CCRepeatForever::actionWithAction(m_pInnerAction->reverse()));
return (CCActionInterval*)(CCRepeatForever::create(m_pInnerAction->reverse()));
}
//
// Spawn
//
CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
// CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
// {
// va_list params;
// va_start(params, pAction1);
//
// CCFiniteTimeAction *pNow;
// CCFiniteTimeAction *pPrev = pAction1;
//
// while (pAction1)
// {
// pNow = va_arg(params, CCFiniteTimeAction*);
// if (pNow)
// {
// pPrev = actionOneTwo(pPrev, pNow);
// }
// else
// {
// break;
// }
// }
//
// va_end(params);
// return pPrev;
// }
CCFiniteTimeAction* CCSpawn::create(CCFiniteTimeAction *pAction1, ...)
{
va_list params;
va_start(params, pAction1);
@ -534,7 +636,7 @@ CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
pNow = va_arg(params, CCFiniteTimeAction*);
if (pNow)
{
pPrev = actionOneTwo(pPrev, pNow);
pPrev = create(pPrev, pNow);
}
else
{
@ -546,19 +648,40 @@ CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
return pPrev;
}
CCFiniteTimeAction* CCSpawn::actionWithArray(CCArray *actions)
// CCFiniteTimeAction* CCSpawn::actionWithArray(CCArray *actions)
// {
// CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
//
// for (unsigned int i = 1; i < actions->count(); ++i)
// {
// prev = actionOneTwo(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i));
// }
//
// return prev;
// }
CCFiniteTimeAction* CCSpawn::create(CCArray *actions)
{
CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
for (unsigned int i = 1; i < actions->count(); ++i)
{
prev = actionOneTwo(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i));
prev = create(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i));
}
return prev;
}
CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
// CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
// {
// CCSpawn *pSpawn = new CCSpawn();
// pSpawn->initOneTwo(pAction1, pAction2);
// pSpawn->autorelease();
//
// return pSpawn;
// }
CCSpawn* CCSpawn::create(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
{
CCSpawn *pSpawn = new CCSpawn();
pSpawn->initOneTwo(pAction1, pAction2);
@ -584,11 +707,11 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
if (d1 > d2)
{
m_pTwo = CCSequence::actionOneTwo(pAction2, CCDelayTime::actionWithDuration(d1 - d2));
m_pTwo = CCSequence::create(pAction2, CCDelayTime::create(d1 - d2));
} else
if (d1 < d2)
{
m_pOne = CCSequence::actionOneTwo(pAction1, CCDelayTime::actionWithDuration(d2 - d1));
m_pOne = CCSequence::create(pAction1, CCDelayTime::create(d2 - d1));
}
m_pOne->retain();
@ -660,13 +783,22 @@ void CCSpawn::update(float time)
CCActionInterval* CCSpawn::reverse(void)
{
return CCSpawn::actionOneTwo(m_pOne->reverse(), m_pTwo->reverse());
return CCSpawn::create(m_pOne->reverse(), m_pTwo->reverse());
}
//
// RotateTo
//
CCRotateTo* CCRotateTo::actionWithDuration(float duration, float fDeltaAngle)
// CCRotateTo* CCRotateTo::actionWithDuration(float duration, float fDeltaAngle)
// {
// CCRotateTo* pRotateTo = new CCRotateTo();
// pRotateTo->initWithDuration(duration, fDeltaAngle);
// pRotateTo->autorelease();
//
// return pRotateTo;
// }
CCRotateTo* CCRotateTo::create(float duration, float fDeltaAngle)
{
CCRotateTo* pRotateTo = new CCRotateTo();
pRotateTo->initWithDuration(duration, fDeltaAngle);
@ -748,7 +880,16 @@ void CCRotateTo::update(float time)
//
// RotateBy
//
CCRotateBy* CCRotateBy::actionWithDuration(float duration, float fDeltaAngle)
// CCRotateBy* CCRotateBy::actionWithDuration(float duration, float fDeltaAngle)
// {
// CCRotateBy *pRotateBy = new CCRotateBy();
// pRotateBy->initWithDuration(duration, fDeltaAngle);
// pRotateBy->autorelease();
//
// return pRotateBy;
// }
CCRotateBy* CCRotateBy::create(float duration, float fDeltaAngle)
{
CCRotateBy *pRotateBy = new CCRotateBy();
pRotateBy->initWithDuration(duration, fDeltaAngle);
@ -808,13 +949,22 @@ void CCRotateBy::update(float time)
CCActionInterval* CCRotateBy::reverse(void)
{
return CCRotateBy::actionWithDuration(m_fDuration, -m_fAngle);
return CCRotateBy::create(m_fDuration, -m_fAngle);
}
//
// MoveTo
//
CCMoveTo* CCMoveTo::actionWithDuration(float duration, const CCPoint& position)
// CCMoveTo* CCMoveTo::actionWithDuration(float duration, const CCPoint& position)
// {
// CCMoveTo *pMoveTo = new CCMoveTo();
// pMoveTo->initWithDuration(duration, position);
// pMoveTo->autorelease();
//
// return pMoveTo;
// }
CCMoveTo* CCMoveTo::create(float duration, const CCPoint& position)
{
CCMoveTo *pMoveTo = new CCMoveTo();
pMoveTo->initWithDuration(duration, position);
@ -876,7 +1026,16 @@ void CCMoveTo::update(float time)
//
// MoveBy
//
CCMoveBy* CCMoveBy::actionWithDuration(float duration, const CCPoint& position)
// CCMoveBy* CCMoveBy::actionWithDuration(float duration, const CCPoint& position)
// {
// CCMoveBy *pMoveBy = new CCMoveBy();
// pMoveBy->initWithDuration(duration, position);
// pMoveBy->autorelease();
//
// return pMoveBy;
// }
CCMoveBy* CCMoveBy::create(float duration, const CCPoint& position)
{
CCMoveBy *pMoveBy = new CCMoveBy();
pMoveBy->initWithDuration(duration, position);
@ -928,13 +1087,31 @@ void CCMoveBy::startWithTarget(CCNode *pTarget)
CCActionInterval* CCMoveBy::reverse(void)
{
return CCMoveBy::actionWithDuration(m_fDuration, ccp(-m_delta.x, -m_delta.y));
return CCMoveBy::create(m_fDuration, ccp(-m_delta.x, -m_delta.y));
}
//
// CCSkewTo
//
CCSkewTo* CCSkewTo::actionWithDuration(float t, float sx, float sy)
// CCSkewTo* CCSkewTo::actionWithDuration(float t, float sx, float sy)
// {
// CCSkewTo *pSkewTo = new CCSkewTo();
// if (pSkewTo)
// {
// if (pSkewTo->initWithDuration(t, sx, sy))
// {
// pSkewTo->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pSkewTo);
// }
// }
//
// return pSkewTo;
// }
CCSkewTo* CCSkewTo::create(float t, float sx, float sy)
{
CCSkewTo *pSkewTo = new CCSkewTo();
if (pSkewTo)
@ -1060,7 +1237,25 @@ CCSkewTo::CCSkewTo()
//
// CCSkewBy
//
CCSkewBy* CCSkewBy::actionWithDuration(float t, float sx, float sy)
// CCSkewBy* CCSkewBy::actionWithDuration(float t, float sx, float sy)
// {
// CCSkewBy *pSkewBy = new CCSkewBy();
// if (pSkewBy)
// {
// if (pSkewBy->initWithDuration(t, sx, sy))
// {
// pSkewBy->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pSkewBy);
// }
// }
//
// return pSkewBy;
// }
CCSkewBy* CCSkewBy::create(float t, float sx, float sy)
{
CCSkewBy *pSkewBy = new CCSkewBy();
if (pSkewBy)
@ -1104,13 +1299,22 @@ void CCSkewBy::startWithTarget(CCNode *pTarget)
CCActionInterval* CCSkewBy::reverse()
{
return actionWithDuration(m_fDuration, -m_fSkewX, -m_fSkewY);
return create(m_fDuration, -m_fSkewX, -m_fSkewY);
}
//
// JumpBy
//
CCJumpBy* CCJumpBy::actionWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps)
// CCJumpBy* CCJumpBy::actionWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps)
// {
// CCJumpBy *pJumpBy = new CCJumpBy();
// pJumpBy->initWithDuration(duration, position, height, jumps);
// pJumpBy->autorelease();
//
// return pJumpBy;
// }
CCJumpBy* CCJumpBy::create(float duration, const CCPoint& position, float height, unsigned int jumps)
{
CCJumpBy *pJumpBy = new CCJumpBy();
pJumpBy->initWithDuration(duration, position, height, jumps);
@ -1177,14 +1381,23 @@ void CCJumpBy::update(float time)
CCActionInterval* CCJumpBy::reverse(void)
{
return CCJumpBy::actionWithDuration(m_fDuration, ccp(-m_delta.x, -m_delta.y),
return CCJumpBy::create(m_fDuration, ccp(-m_delta.x, -m_delta.y),
m_height, m_nJumps);
}
//
// JumpTo
//
CCJumpTo* CCJumpTo::actionWithDuration(float duration, const CCPoint& position, float height, int jumps)
// CCJumpTo* CCJumpTo::actionWithDuration(float duration, const CCPoint& position, float height, int jumps)
// {
// CCJumpTo *pJumpTo = new CCJumpTo();
// pJumpTo->initWithDuration(duration, position, height, jumps);
// pJumpTo->autorelease();
//
// return pJumpTo;
// }
CCJumpTo* CCJumpTo::create(float duration, const CCPoint& position, float height, int jumps)
{
CCJumpTo *pJumpTo = new CCJumpTo();
pJumpTo->initWithDuration(duration, position, height, jumps);
@ -1237,7 +1450,16 @@ static inline float bezierat( float a, float b, float c, float d, float t )
//
// BezierBy
//
CCBezierBy* CCBezierBy::actionWithDuration(float t, const ccBezierConfig& c)
// CCBezierBy* CCBezierBy::actionWithDuration(float t, const ccBezierConfig& c)
// {
// CCBezierBy *pBezierBy = new CCBezierBy();
// pBezierBy->initWithDuration(t, c);
// pBezierBy->autorelease();
//
// return pBezierBy;
// }
CCBezierBy* CCBezierBy::create(float t, const ccBezierConfig& c)
{
CCBezierBy *pBezierBy = new CCBezierBy();
pBezierBy->initWithDuration(t, c);
@ -1314,14 +1536,23 @@ CCActionInterval* CCBezierBy::reverse(void)
r.controlPoint_1 = ccpAdd(m_sConfig.controlPoint_2, ccpNeg(m_sConfig.endPosition));
r.controlPoint_2 = ccpAdd(m_sConfig.controlPoint_1, ccpNeg(m_sConfig.endPosition));
CCBezierBy *pAction = CCBezierBy::actionWithDuration(m_fDuration, r);
CCBezierBy *pAction = CCBezierBy::create(m_fDuration, r);
return pAction;
}
//
// BezierTo
//
CCBezierTo* CCBezierTo::actionWithDuration(float t, const ccBezierConfig& c)
// CCBezierTo* CCBezierTo::actionWithDuration(float t, const ccBezierConfig& c)
// {
// CCBezierTo *pBezierTo = new CCBezierTo();
// pBezierTo->initWithDuration(t, c);
// pBezierTo->autorelease();
//
// return pBezierTo;
// }
CCBezierTo* CCBezierTo::create(float t, const ccBezierConfig& c)
{
CCBezierTo *pBezierTo = new CCBezierTo();
pBezierTo->initWithDuration(t, c);
@ -1330,6 +1561,7 @@ CCBezierTo* CCBezierTo::actionWithDuration(float t, const ccBezierConfig& c)
return pBezierTo;
}
CCObject* CCBezierTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
@ -1364,7 +1596,16 @@ void CCBezierTo::startWithTarget(CCNode *pTarget)
//
// ScaleTo
//
CCScaleTo* CCScaleTo::actionWithDuration(float duration, float s)
// CCScaleTo* CCScaleTo::actionWithDuration(float duration, float s)
// {
// CCScaleTo *pScaleTo = new CCScaleTo();
// pScaleTo->initWithDuration(duration, s);
// pScaleTo->autorelease();
//
// return pScaleTo;
// }
CCScaleTo* CCScaleTo::create(float duration, float s)
{
CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, s);
@ -1386,7 +1627,16 @@ bool CCScaleTo::initWithDuration(float duration, float s)
return false;
}
CCScaleTo* CCScaleTo::actionWithDuration(float duration, float sx, float sy)
// CCScaleTo* CCScaleTo::actionWithDuration(float duration, float sx, float sy)
// {
// CCScaleTo *pScaleTo = new CCScaleTo();
// pScaleTo->initWithDuration(duration, sx, sy);
// pScaleTo->autorelease();
//
// return pScaleTo;
// }
CCScaleTo* CCScaleTo::create(float duration, float sx, float sy)
{
CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, sx, sy);
@ -1453,7 +1703,25 @@ void CCScaleTo::update(float time)
//
// ScaleBy
//
CCScaleBy* CCScaleBy::actionWithDuration(float duration, float s)
// CCScaleBy* CCScaleBy::actionWithDuration(float duration, float s)
// {
// CCScaleBy *pScaleBy = new CCScaleBy();
// pScaleBy->initWithDuration(duration, s);
// pScaleBy->autorelease();
//
// return pScaleBy;
// }
//
// CCScaleBy* CCScaleBy::actionWithDuration(float duration, float sx, float sy)
// {
// CCScaleBy *pScaleBy = new CCScaleBy();
// pScaleBy->initWithDuration(duration, sx, sy);
// pScaleBy->autorelease();
//
// return pScaleBy;
// }
CCScaleBy* CCScaleBy::create(float duration, float s)
{
CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, s);
@ -1462,7 +1730,7 @@ CCScaleBy* CCScaleBy::actionWithDuration(float duration, float s)
return pScaleBy;
}
CCScaleBy* CCScaleBy::actionWithDuration(float duration, float sx, float sy)
CCScaleBy* CCScaleBy::create(float duration, float sx, float sy)
{
CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, sx, sy);
@ -1504,13 +1772,22 @@ void CCScaleBy::startWithTarget(CCNode *pTarget)
CCActionInterval* CCScaleBy::reverse(void)
{
return CCScaleBy::actionWithDuration(m_fDuration, 1 / m_fEndScaleX, 1 / m_fEndScaleY);
return CCScaleBy::create(m_fDuration, 1 / m_fEndScaleX, 1 / m_fEndScaleY);
}
//
// Blink
//
CCBlink* CCBlink::actionWithDuration(float duration, unsigned int uBlinks)
// CCBlink* CCBlink::actionWithDuration(float duration, unsigned int uBlinks)
// {
// CCBlink *pBlink = new CCBlink();
// pBlink->initWithDuration(duration, uBlinks);
// pBlink->autorelease();
//
// return pBlink;
// }
CCBlink* CCBlink::create(float duration, unsigned int uBlinks)
{
CCBlink *pBlink = new CCBlink();
pBlink->initWithDuration(duration, uBlinks);
@ -1567,18 +1844,28 @@ void CCBlink::update(float time)
CCActionInterval* CCBlink::reverse(void)
{
// return 'self'
return CCBlink::actionWithDuration(m_fDuration, m_nTimes);
return CCBlink::create(m_fDuration, m_nTimes);
}
//
// FadeIn
//
CCFadeIn* CCFadeIn::actionWithDuration(float d)
// CCFadeIn* CCFadeIn::actionWithDuration(float d)
// {
// CCFadeIn* pAction = new CCFadeIn();
//
// pAction->initWithDuration(d);
// pAction->autorelease();
//
// return pAction;
// }
CCFadeIn* CCFadeIn::create(float d)
{
CCFadeIn* pAction = new CCFadeIn();
pAction->initWithDuration(d);
pAction->autorelease();
pAction->autorelease();
return pAction;
}
@ -1617,18 +1904,28 @@ void CCFadeIn::update(float time)
CCActionInterval* CCFadeIn::reverse(void)
{
return CCFadeOut::actionWithDuration(m_fDuration);
return CCFadeOut::create(m_fDuration);
}
//
// FadeOut
//
CCFadeOut* CCFadeOut::actionWithDuration(float d)
// CCFadeOut* CCFadeOut::actionWithDuration(float d)
// {
// CCFadeOut* pAction = new CCFadeOut();
//
// pAction->initWithDuration(d);
// pAction->autorelease();
//
// return pAction;
// }
CCFadeOut* CCFadeOut::create(float d)
{
CCFadeOut* pAction = new CCFadeOut();
pAction->initWithDuration(d);
pAction->autorelease();
pAction->autorelease();
return pAction;
}
@ -1667,19 +1964,28 @@ void CCFadeOut::update(float time)
CCActionInterval* CCFadeOut::reverse(void)
{
return CCFadeIn::actionWithDuration(m_fDuration);
return CCFadeIn::create(m_fDuration);
}
//
// FadeTo
//
CCFadeTo* CCFadeTo::actionWithDuration(float duration, GLubyte opacity)
// CCFadeTo* CCFadeTo::actionWithDuration(float duration, GLubyte opacity)
// {
// CCFadeTo *pFadeTo = new CCFadeTo();
// pFadeTo->initWithDuration(duration, opacity);
// pFadeTo->autorelease();
//
// return pFadeTo;
// }
CCFadeTo* CCFadeTo::create(float duration, GLubyte opacity)
{
CCFadeTo *pFadeTo = new CCFadeTo();
pFadeTo->initWithDuration(duration, opacity);
pFadeTo->autorelease();
return pFadeTo;
return pFadeTo;
}
bool CCFadeTo::initWithDuration(float duration, GLubyte opacity)
@ -1741,7 +2047,16 @@ void CCFadeTo::update(float time)
//
// TintTo
//
CCTintTo* CCTintTo::actionWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue)
// CCTintTo* CCTintTo::actionWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue)
// {
// CCTintTo *pTintTo = new CCTintTo();
// pTintTo->initWithDuration(duration, red, green, blue);
// pTintTo->autorelease();
//
// return pTintTo;
// }
CCTintTo* CCTintTo::create(float duration, GLubyte red, GLubyte green, GLubyte blue)
{
CCTintTo *pTintTo = new CCTintTo();
pTintTo->initWithDuration(duration, red, green, blue);
@ -1809,7 +2124,16 @@ void CCTintTo::update(float time)
//
// TintBy
//
CCTintBy* CCTintBy::actionWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
// CCTintBy* CCTintBy::actionWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
// {
// CCTintBy *pTintBy = new CCTintBy();
// pTintBy->initWithDuration(duration, deltaRed, deltaGreen, deltaBlue);
// pTintBy->autorelease();
//
// return pTintBy;
// }
CCTintBy* CCTintBy::create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{
CCTintBy *pTintBy = new CCTintBy();
pTintBy->initWithDuration(duration, deltaRed, deltaGreen, deltaBlue);
@ -1882,13 +2206,23 @@ void CCTintBy::update(float time)
CCActionInterval* CCTintBy::reverse(void)
{
return CCTintBy::actionWithDuration(m_fDuration, -m_deltaR, -m_deltaG, -m_deltaB);
return CCTintBy::create(m_fDuration, -m_deltaR, -m_deltaG, -m_deltaB);
}
//
// DelayTime
//
CCDelayTime* CCDelayTime::actionWithDuration(float d)
// CCDelayTime* CCDelayTime::actionWithDuration(float d)
// {
// CCDelayTime* pAction = new CCDelayTime();
//
// pAction->initWithDuration(d);
// pAction->autorelease();
//
// return pAction;
// }
CCDelayTime* CCDelayTime::create(float d)
{
CCDelayTime* pAction = new CCDelayTime();
@ -1929,13 +2263,23 @@ void CCDelayTime::update(float time)
CCActionInterval* CCDelayTime::reverse(void)
{
return CCDelayTime::actionWithDuration(m_fDuration);
return CCDelayTime::create(m_fDuration);
}
//
// ReverseTime
//
CCReverseTime* CCReverseTime::actionWithAction(CCFiniteTimeAction *pAction)
// CCReverseTime* CCReverseTime::actionWithAction(CCFiniteTimeAction *pAction)
// {
// // casting to prevent warnings
// CCReverseTime *pReverseTime = new CCReverseTime();
// pReverseTime->initWithAction(pAction);
// pReverseTime->autorelease();
//
// return pReverseTime;
// }
CCReverseTime* CCReverseTime::create(CCFiniteTimeAction *pAction)
{
// casting to prevent warnings
CCReverseTime *pReverseTime = new CCReverseTime();
@ -2025,7 +2369,16 @@ CCActionInterval* CCReverseTime::reverse(void)
//
// Animate
//
CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation)
// CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation)
// {
// CCAnimate *pAnimate = new CCAnimate();
// pAnimate->initWithAnimation(pAnimation);
// pAnimate->autorelease();
//
// return pAnimate;
// }
CCAnimate* CCAnimate::create(CCAnimation *pAnimation)
{
CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithAnimation(pAnimation);
@ -2197,9 +2550,9 @@ CCActionInterval* CCAnimate::reverse(void)
}
}
CCAnimation *newAnim = CCAnimation::animationWithAnimationFrames(pNewArray, m_pAnimation->getDelayPerUnit(), m_pAnimation->getLoops());
CCAnimation *newAnim = CCAnimation::createWithAnimationFrames(pNewArray, m_pAnimation->getDelayPerUnit(), m_pAnimation->getLoops());
newAnim->setRestoreOriginalFrame(m_pAnimation->getRestoreOriginalFrame());
return actionWithAnimation(newAnim);
return create(newAnim);
}
// CCTargetedAction
@ -2217,7 +2570,15 @@ CCTargetedAction::~CCTargetedAction()
CC_SAFE_RELEASE(m_pAction);
}
CCTargetedAction* CCTargetedAction::actionWithTarget(CCNode* pTarget, CCFiniteTimeAction* pAction)
// CCTargetedAction* CCTargetedAction::actionWithTarget(CCNode* pTarget, CCFiniteTimeAction* pAction)
// {
// CCTargetedAction* p = new CCTargetedAction();
// p->initWithTarget(pTarget, pAction);
// p->autorelease();
// return p;
// }
CCTargetedAction* CCTargetedAction::create(CCNode* pTarget, CCFiniteTimeAction* pAction)
{
CCTargetedAction* p = new CCTargetedAction();
p->initWithTarget(pTarget, pAction);
@ -2225,6 +2586,7 @@ CCTargetedAction* CCTargetedAction::actionWithTarget(CCNode* pTarget, CCFiniteTi
return p;
}
bool CCTargetedAction::initWithTarget(CCNode* pTarget, CCFiniteTimeAction* pAction)
{
if(CCActionInterval::initWithDuration(pAction->getDuration()))

Просмотреть файл

@ -72,8 +72,13 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCActionInterval* actionWithDuration(float d);
/** creates the action */
static CCActionInterval* actionWithDuration(float d);
static CCActionInterval* create(float d);
public:
//extension in CCGridAction
@ -102,13 +107,26 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** helper constructor to create an array of sequenceable actions */
static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of sequenceable actions given an array */
static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
/** helper constructor to create an array of sequenceable actions
@warning: This interface will be deprecated in future.
*/
//static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of sequenceable actions given an array
@warning: This interface will be deprecated in future.
*/
//static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCSequence* actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
/** helper constructor to create an array of sequenceable actions */
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of sequenceable actions given an array */
static CCFiniteTimeAction* create(CCArray *arrayOfActions);
/** creates the action */
static CCSequence* actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
static CCSequence* create(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
protected:
CCFiniteTimeAction *m_pActions[2];
float m_split;
@ -149,9 +167,13 @@ public:
}
public:
/** creates a CCRepeat action. Times is an unsigned integer between 1 and pow(2,30) */
static CCRepeat* actionWithAction(CCFiniteTimeAction *pAction, unsigned int times);
/** creates a CCRepeat action. Times is an unsigned integer between 1 and pow(2,30)
@warning: This interface will be deprecated in future.
*/
//static CCRepeat* actionWithAction(CCFiniteTimeAction *pAction, unsigned int times);
/** creates a CCRepeat action. Times is an unsigned integer between 1 and pow(2,30) */
static CCRepeat* create(CCFiniteTimeAction *pAction, unsigned int times);
protected:
unsigned int m_uTimes;
unsigned int m_uTotal;
@ -197,9 +219,12 @@ public:
}
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCRepeatForever* actionWithAction(CCActionInterval *pAction);
/** creates the action */
static CCRepeatForever* actionWithAction(CCActionInterval *pAction);
static CCRepeatForever* create(CCActionInterval *pAction);
protected:
/** Inner action */
CCActionInterval *m_pInnerAction;
@ -222,14 +247,29 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** helper constructor to create an array of spawned actions
@warning: This interface will be deprecated in future.
*/
//static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of spawned actions given an array
@warning: This interface will be deprecated in future.
*/
//static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
/** creates the Spawn action
@warning: This interface will be deprecated in future.
*/
//static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
/** helper constructor to create an array of spawned actions */
static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of spawned actions given an array */
static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
static CCFiniteTimeAction* create(CCArray *arrayOfActions);
/** creates the Spawn action */
static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
static CCSpawn* create(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
protected:
CCFiniteTimeAction *m_pOne;
@ -251,9 +291,12 @@ public:
virtual void update(float time);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCRotateTo* actionWithDuration(float duration, float fDeltaAngle);
/** creates the action */
static CCRotateTo* actionWithDuration(float duration, float fDeltaAngle);
static CCRotateTo* create(float duration, float fDeltaAngle);
protected:
float m_fDstAngle;
float m_fStartAngle;
@ -274,9 +317,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCRotateBy* actionWithDuration(float duration, float fDeltaAngle);
/** creates the action */
static CCRotateBy* actionWithDuration(float duration, float fDeltaAngle);
static CCRotateBy* create(float duration, float fDeltaAngle);
protected:
float m_fAngle;
float m_fStartAngle;
@ -295,9 +341,12 @@ public:
virtual void update(float time);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCMoveTo* actionWithDuration(float duration, const CCPoint& position);
/** creates the action */
static CCMoveTo* actionWithDuration(float duration, const CCPoint& position);
static CCMoveTo* create(float duration, const CCPoint& position);
protected:
CCPoint m_endPosition;
CCPoint m_startPosition;
@ -319,8 +368,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCMoveBy* actionWithDuration(float duration, const CCPoint& position);
/** creates the action */
static CCMoveBy* actionWithDuration(float duration, const CCPoint& position);
static CCMoveBy* create(float duration, const CCPoint& position);
};
/** Skews a CCNode object to given angles by modifying it's skewX and skewY attributes
@ -336,8 +389,13 @@ public:
virtual void update(float time);
public:
static CCSkewTo* actionWithDuration(float t, float sx, float sy);
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCSkewTo* actionWithDuration(float t, float sx, float sy);
/** creates the action */
static CCSkewTo* create(float t, float sx, float sy);
protected:
float m_fSkewX;
float m_fSkewY;
@ -360,7 +418,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
static CCSkewBy* actionWithDuration(float t, float deltaSkewX, float deltaSkewY);
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCSkewBy* actionWithDuration(float t, float deltaSkewX, float deltaSkewY);
/** creates the action */
static CCSkewBy* create(float t, float deltaSkewX, float deltaSkewY);
};
/** @brief Moves a CCNode object simulating a parabolic jump movement by modifying it's position attribute.
@ -377,9 +440,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCJumpBy* actionWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps);
/** creates the action */
static CCJumpBy* actionWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps);
static CCJumpBy* create(float duration, const CCPoint& position, float height, unsigned int jumps);
protected:
CCPoint m_startPosition;
CCPoint m_delta;
@ -396,8 +462,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
// static CCJumpTo* actionWithDuration(float duration, const CCPoint& position, float height, int jumps);
/** creates the action */
static CCJumpTo* actionWithDuration(float duration, const CCPoint& position, float height, int jumps);
static CCJumpTo* create(float duration, const CCPoint& position, float height, int jumps);
};
/** @typedef bezier configuration structure
@ -425,9 +495,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action with a duration and a bezier configuration
@warning: This interface will be deprecated in future.
*/
//static CCBezierBy* actionWithDuration(float t, const ccBezierConfig& c);
/** creates the action with a duration and a bezier configuration */
static CCBezierBy* actionWithDuration(float t, const ccBezierConfig& c);
static CCBezierBy* create(float t, const ccBezierConfig& c);
protected:
ccBezierConfig m_sConfig;
CCPoint m_startPosition;
@ -443,8 +516,13 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action with a duration and a bezier configuration
@warning: This interface will be deprecated in future.
*/
//static CCBezierTo* actionWithDuration(float t, const ccBezierConfig& c);
/** creates the action with a duration and a bezier configuration */
static CCBezierTo* actionWithDuration(float t, const ccBezierConfig& c);
static CCBezierTo* create(float t, const ccBezierConfig& c);
};
/** @brief Scales a CCNode object to a zoom factor by modifying it's scale attribute.
@ -464,11 +542,21 @@ public:
virtual void update(float time);
public:
/** creates the action with the same scale factor for X and Y
@warning: This interface will be deprecated in future.
*/
//static CCScaleTo* actionWithDuration(float duration, float s);
/** creates the action with and X factor and a Y factor
@warning: This interface will be deprecated in future.
*/
//static CCScaleTo* actionWithDuration(float duration, float sx, float sy);
/** creates the action with the same scale factor for X and Y */
static CCScaleTo* actionWithDuration(float duration, float s);
static CCScaleTo* create(float duration, float s);
/** creates the action with and X factor and a Y factor */
static CCScaleTo* actionWithDuration(float duration, float sx, float sy);
static CCScaleTo* create(float duration, float sx, float sy);
protected:
float m_fScaleX;
float m_fScaleY;
@ -490,11 +578,21 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action with the same scale factor for X and Y
@warning: This interface will be deprecated in future.
*/
//static CCScaleBy* actionWithDuration(float duration, float s);
/** creates the action with and X factor and a Y factor
@warning: This interface will be deprecated in future.
*/
//static CCScaleBy* actionWithDuration(float duration, float sx, float sy);
/** creates the action with the same scale factor for X and Y */
static CCScaleBy* actionWithDuration(float duration, float s);
static CCScaleBy* create(float duration, float s);
/** creates the action with and X factor and a Y factor */
static CCScaleBy* actionWithDuration(float duration, float sx, float sy);
static CCScaleBy* create(float duration, float sx, float sy);
};
/** @brief Blinks a CCNode object by modifying it's visible attribute
@ -510,8 +608,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCBlink* actionWithDuration(float duration, unsigned int uBlinks);
/** creates the action */
static CCBlink* actionWithDuration(float duration, unsigned int uBlinks);
static CCBlink* create(float duration, unsigned int uBlinks);
protected:
unsigned int m_nTimes;
};
@ -527,8 +629,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCFadeIn* actionWithDuration(float d);
/** creates the action */
static CCFadeIn* actionWithDuration(float d);
static CCFadeIn* create(float d);
};
/** @brief Fades Out an object that implements the CCRGBAProtocol protocol. It modifies the opacity from 255 to 0.
@ -542,8 +648,13 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCFadeOut* actionWithDuration(float d);
/** creates the action */
static CCFadeOut* actionWithDuration(float d);
static CCFadeOut* create(float d);
};
/** @brief Fades an object that implements the CCRGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
@ -560,9 +671,12 @@ public:
virtual void update(float time);
public:
/** creates an action with duration and opacity
@warning: This interface will be deprecated in future.
*/
//static CCFadeTo* actionWithDuration(float duration, GLubyte opacity);
/** creates an action with duration and opacity */
static CCFadeTo* actionWithDuration(float duration, GLubyte opacity);
static CCFadeTo* create(float duration, GLubyte opacity);
protected:
GLubyte m_toOpacity;
GLubyte m_fromOpacity;
@ -583,9 +697,12 @@ public:
virtual void update(float time);
public:
/** creates an action with duration and color
@warning: This interface will be deprecated in future.
*/
//static CCTintTo* actionWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
/** creates an action with duration and color */
static CCTintTo* actionWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
static CCTintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
protected:
ccColor3B m_to;
ccColor3B m_from;
@ -606,9 +723,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates an action with duration and color
@warning: This interface will be deprecated in future.
*/
// static CCTintBy* actionWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
/** creates an action with duration and color */
static CCTintBy* actionWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
static CCTintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
protected:
GLshort m_deltaR;
GLshort m_deltaG;
@ -629,8 +749,13 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCDelayTime* actionWithDuration(float d);
/** creates the action */
static CCDelayTime* actionWithDuration(float d);
static CCDelayTime* create(float d);
};
/** @brief Executes an action in reverse order, from time=duration to time=0
@ -656,9 +781,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action
@warning: This interface will be deprecated in future.
*/
//static CCReverseTime* actionWithAction(CCFiniteTimeAction *pAction);
/** creates the action */
static CCReverseTime* actionWithAction(CCFiniteTimeAction *pAction);
static CCReverseTime* create(CCFiniteTimeAction *pAction);
protected:
CCFiniteTimeAction *m_pOther;
};
@ -682,9 +810,12 @@ public:
virtual CCActionInterval* reverse(void);
public:
/** creates the action with an Animation and will restore the original frame when the animation is over
@warning: This interface will be deprecated in future.
*/
//static CCAnimate* actionWithAnimation(CCAnimation *pAnimation);
/** creates the action with an Animation and will restore the original frame when the animation is over */
static CCAnimate* actionWithAnimation(CCAnimation *pAnimation);
static CCAnimate* create(CCAnimation *pAnimation);
CC_SYNTHESIZE_RETAIN(CCAnimation*, m_pAnimation, Animation)
protected:
std::vector<float>* m_pSplitTimes;
@ -701,8 +832,12 @@ class CC_DLL CCTargetedAction : public CCActionInterval
public:
CCTargetedAction();
virtual ~CCTargetedAction();
/** Create an action with the specified action and forced target
@warning: This interface will be deprecated in future.
*/
//static CCTargetedAction* actionWithTarget(CCNode* pTarget, CCFiniteTimeAction* pAction);
/** Create an action with the specified action and forced target */
static CCTargetedAction* actionWithTarget(CCNode* pTarget, CCFiniteTimeAction* pAction);
static CCTargetedAction* create(CCNode* pTarget, CCFiniteTimeAction* pAction);
/** Init an action with the specified action and forced target */
bool initWithTarget(CCNode* pTarget, CCFiniteTimeAction* pAction);

Просмотреть файл

@ -27,7 +27,26 @@ THE SOFTWARE.
NS_CC_BEGIN
CCPageTurn3D* CCPageTurn3D::actionWithSize(const ccGridSize& gridSize, float time)
// CCPageTurn3D* CCPageTurn3D::actionWithSize(const ccGridSize& gridSize, float time)
// {
// CCPageTurn3D *pAction = new CCPageTurn3D();
//
// if (pAction)
// {
// if (pAction->initWithSize(gridSize, time))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCPageTurn3D* CCPageTurn3D::create(const ccGridSize& gridSize, float time)
{
CCPageTurn3D *pAction = new CCPageTurn3D();

Просмотреть файл

@ -43,8 +43,12 @@ public:
virtual void update(float time);
public:
/** create the action
@warning: This interface will be deprecated in future.
*/
//static CCPageTurn3D* actionWithSize(const ccGridSize& gridSize, float time);
/** create the action */
static CCPageTurn3D* actionWithSize(const ccGridSize& gridSize, float time);
static CCPageTurn3D* create(const ccGridSize& gridSize, float time);
};
NS_CC_END

Просмотреть файл

@ -32,7 +32,16 @@ NS_CC_BEGIN
// implementation of CCProgressTo
CCProgressTo* CCProgressTo::actionWithDuration(float duration, float fPercent)
// CCProgressTo* CCProgressTo::actionWithDuration(float duration, float fPercent)
// {
// CCProgressTo *pProgressTo = new CCProgressTo();
// pProgressTo->initWithDuration(duration, fPercent);
// pProgressTo->autorelease();
//
// return pProgressTo;
// }
CCProgressTo* CCProgressTo::create(float duration, float fPercent)
{
CCProgressTo *pProgressTo = new CCProgressTo();
pProgressTo->initWithDuration(duration, fPercent);
@ -96,7 +105,16 @@ void CCProgressTo::update(float time)
// implementation of CCProgressFromTo
CCProgressFromTo* CCProgressFromTo::actionWithDuration(float duration, float fFromPercentage, float fToPercentage)
// CCProgressFromTo* CCProgressFromTo::actionWithDuration(float duration, float fFromPercentage, float fToPercentage)
// {
// CCProgressFromTo *pProgressFromTo = new CCProgressFromTo();
// pProgressFromTo->initWithDuration(duration, fFromPercentage, fToPercentage);
// pProgressFromTo->autorelease();
//
// return pProgressFromTo;
// }
CCProgressFromTo* CCProgressFromTo::create(float duration, float fFromPercentage, float fToPercentage)
{
CCProgressFromTo *pProgressFromTo = new CCProgressFromTo();
pProgressFromTo->initWithDuration(duration, fFromPercentage, fToPercentage);
@ -143,7 +161,7 @@ CCObject* CCProgressFromTo::copyWithZone(CCZone *pZone)
CCActionInterval* CCProgressFromTo::reverse(void)
{
return CCProgressFromTo::actionWithDuration(m_fDuration, m_fTo, m_fFrom);
return CCProgressFromTo::create(m_fDuration, m_fTo, m_fFrom);
}
void CCProgressFromTo::startWithTarget(CCNode *pTarget)

Просмотреть файл

@ -44,9 +44,12 @@ public:
virtual void update(float time);
public:
/** Creates and initializes with a duration and a percent
@warning: This interface will be deprecated in future.
*/
//static CCProgressTo* actionWithDuration(float duration, float fPercent);
/** Creates and initializes with a duration and a percent */
static CCProgressTo* actionWithDuration(float duration, float fPercent);
static CCProgressTo* create(float duration, float fPercent);
protected:
float m_fTo;
float m_fFrom;
@ -68,9 +71,12 @@ public:
virtual void update(float time);
public:
/** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage
@warning: This interface will be deprecated in future.
*/
//static CCProgressFromTo* actionWithDuration(float duration, float fFromPercentage, float fToPercentage);
/** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */
static CCProgressFromTo* actionWithDuration(float duration, float fFromPercentage, float fToPercentage);
static CCProgressFromTo* create(float duration, float fFromPercentage, float fToPercentage);
protected:
float m_fTo;
float m_fFrom;

Просмотреть файл

@ -41,7 +41,26 @@ struct Tile
// implementation of ShakyTiles3D
CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const ccGridSize& gridSize, float duration)
// CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const ccGridSize& gridSize, float duration)
// {
// CCShakyTiles3D *pAction = new CCShakyTiles3D();
//
// if (pAction)
// {
// if (pAction->initWithRange(nRange, bShakeZ, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCShakyTiles3D* CCShakyTiles3D::create(int nRange, bool bShakeZ,const ccGridSize& gridSize, float duration)
{
CCShakyTiles3D *pAction = new CCShakyTiles3D();
@ -134,7 +153,26 @@ void CCShakyTiles3D::update(float time)
// implementation of CCShatteredTiles3D
CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
// CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
// {
// CCShatteredTiles3D *pAction = new CCShatteredTiles3D();
//
// if (pAction)
// {
// if (pAction->initWithRange(nRange, bShatterZ, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCShatteredTiles3D* CCShatteredTiles3D::create(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
{
CCShatteredTiles3D *pAction = new CCShatteredTiles3D();
@ -233,7 +271,26 @@ void CCShatteredTiles3D::update(float time)
// implementation of CCShuffleTiles
CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize, float duration)
// CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize, float duration)
// {
// CCShuffleTiles *pAction = new CCShuffleTiles();
//
// if (pAction)
// {
// if (pAction->initWithSeed(s, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCShuffleTiles* CCShuffleTiles::create(int s, const ccGridSize& gridSize, float duration)
{
CCShuffleTiles *pAction = new CCShuffleTiles();
@ -397,7 +454,26 @@ void CCShuffleTiles::update(float time)
// implementation of CCFadeOutTRTiles
CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, float time)
// CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, float time)
// {
// CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles();
//
// if (pAction)
// {
// if (pAction->initWithSize(gridSize, time))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCFadeOutTRTiles* CCFadeOutTRTiles::create(const ccGridSize& gridSize, float time)
{
CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles();
@ -485,7 +561,26 @@ void CCFadeOutTRTiles::update(float time)
}
// implementation of CCFadeOutBLTiles
CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, float time)
// CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, float time)
// {
// CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles();
//
// if (pAction)
// {
// if (pAction->initWithSize(gridSize, time))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCFadeOutBLTiles* CCFadeOutBLTiles::create(const ccGridSize& gridSize, float time)
{
CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles();
@ -517,7 +612,26 @@ float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, float time)
// implementation of CCFadeOutUpTiles
CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, float time)
// CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, float time)
// {
// CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles();
//
// if (pAction)
// {
// if (pAction->initWithSize(gridSize, time))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCFadeOutUpTiles* CCFadeOutUpTiles::create(const ccGridSize& gridSize, float time)
{
CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles();
@ -561,7 +675,26 @@ void CCFadeOutUpTiles::transformTile(const ccGridSize& pos, float distance)
}
// implementation of CCFadeOutDownTiles
CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSize, float time)
// CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSize, float time)
// {
// CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles();
//
// if (pAction)
// {
// if (pAction->initWithSize(gridSize, time))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCFadeOutDownTiles* CCFadeOutDownTiles::create(const ccGridSize& gridSize, float time)
{
CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles();
@ -592,7 +725,21 @@ float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, float time)
}
// implementation of TurnOffTiles
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, float d)
// CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, float d)
// {
// CCTurnOffTiles* pAction = new CCTurnOffTiles();
// if (pAction->initWithSize(size, d))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// return pAction;
// }
CCTurnOffTiles* CCTurnOffTiles::create(const ccGridSize& size, float d)
{
CCTurnOffTiles* pAction = new CCTurnOffTiles();
if (pAction->initWithSize(size, d))
@ -606,7 +753,26 @@ CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, float d)
return pAction;
}
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize, float duration)
// CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize, float duration)
// {
// CCTurnOffTiles *pAction = new CCTurnOffTiles();
//
// if (pAction)
// {
// if (pAction->initWithSeed(s, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCTurnOffTiles* CCTurnOffTiles::create(int s, const ccGridSize& gridSize, float duration)
{
CCTurnOffTiles *pAction = new CCTurnOffTiles();
@ -736,7 +902,26 @@ void CCTurnOffTiles::update(float time)
// implementation of CCWavesTiles3D
CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
// CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
// {
// CCWavesTiles3D *pAction = new CCWavesTiles3D();
//
// if (pAction)
// {
// if (pAction->initWithWaves(wav, amp, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCWavesTiles3D* CCWavesTiles3D::create(int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCWavesTiles3D *pAction = new CCWavesTiles3D();
@ -814,7 +999,26 @@ void CCWavesTiles3D::update(float time)
// implementation of CCJumpTiles3D
CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize& gridSize, float duration)
// CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize& gridSize, float duration)
// {
// CCJumpTiles3D *pAction = new CCJumpTiles3D();
//
// if (pAction)
// {
// if (pAction->initWithJumps(j, amp, gridSize, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCJumpTiles3D* CCJumpTiles3D::create(int j, float amp, const ccGridSize& gridSize, float duration)
{
CCJumpTiles3D *pAction = new CCJumpTiles3D();
@ -903,7 +1107,26 @@ void CCJumpTiles3D::update(float time)
// implementation of CCSplitRows
CCSplitRows* CCSplitRows::actionWithRows(int nRows, float duration)
// CCSplitRows* CCSplitRows::actionWithRows(int nRows, float duration)
// {
// CCSplitRows *pAction = new CCSplitRows();
//
// if (pAction)
// {
// if (pAction->initWithRows(nRows, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCSplitRows* CCSplitRows::create(int nRows, float duration)
{
CCSplitRows *pAction = new CCSplitRows();
@ -982,7 +1205,26 @@ void CCSplitRows::update(float time)
// implementation of CCSplitCols
CCSplitCols* CCSplitCols::actionWithCols(int nCols, float duration)
// CCSplitCols* CCSplitCols::actionWithCols(int nCols, float duration)
// {
// CCSplitCols *pAction = new CCSplitCols();
//
// if (pAction)
// {
// if (pAction->initWithCols(nCols, duration))
// {
// pAction->autorelease();
// }
// else
// {
// CC_SAFE_RELEASE_NULL(pAction);
// }
// }
//
// return pAction;
// }
CCSplitCols* CCSplitCols::create(int nCols, float duration)
{
CCSplitCols *pAction = new CCSplitCols();

Просмотреть файл

@ -40,8 +40,14 @@ public:
virtual void update(float time);
public:
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration
@warning: This interface will be deprecated in future.
*/
//static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
// float duration);
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
static CCShakyTiles3D* create(int nRange, bool bShakeZ, const ccGridSize& gridSize,
float duration);
protected:
@ -61,10 +67,15 @@ public:
virtual void update(float time);
public:
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
float duration);
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration
@warning: This interface will be deprecated in future.
*/
//static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
// float duration);
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
static CCShatteredTiles3D* create(int nRange, bool bShatterZ, const ccGridSize& gridSize,
float duration);
protected:
int m_nRandrange;
bool m_bOnce;
@ -90,9 +101,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action with a random seed, the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCShuffleTiles* actionWithSeed(int s, const ccGridSize& gridSize, float duration);
/** creates the action with a random seed, the grid size and the duration */
static CCShuffleTiles* actionWithSeed(int s, const ccGridSize& gridSize, float duration);
static CCShuffleTiles* create(int s, const ccGridSize& gridSize, float duration);
protected:
int m_nSeed;
unsigned int m_nTilesCount;
@ -113,8 +127,13 @@ public:
virtual void update(float time);
public:
/** creates the action with the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCFadeOutTRTiles* actionWithSize(const ccGridSize& gridSize, float time);
/** creates the action with the grid size and the duration */
static CCFadeOutTRTiles* actionWithSize(const ccGridSize& gridSize, float time);
static CCFadeOutTRTiles* create(const ccGridSize& gridSize, float time);
};
/** @brief CCFadeOutBLTiles action.
@ -126,8 +145,13 @@ public:
virtual float testFunc(const ccGridSize& pos, float time);
public:
/** creates the action with the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCFadeOutBLTiles* actionWithSize(const ccGridSize& gridSize, float time);
/** creates the action with the grid size and the duration */
static CCFadeOutBLTiles* actionWithSize(const ccGridSize& gridSize, float time);
static CCFadeOutBLTiles* create(const ccGridSize& gridSize, float time);
};
/** @brief CCFadeOutUpTiles action.
@ -140,8 +164,13 @@ public:
virtual void transformTile(const ccGridSize& pos, float distance);
public:
/** creates the action with the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCFadeOutUpTiles* actionWithSize(const ccGridSize& gridSize, float time);
/** creates the action with the grid size and the duration */
static CCFadeOutUpTiles* actionWithSize(const ccGridSize& gridSize, float time);
static CCFadeOutUpTiles* create(const ccGridSize& gridSize, float time);
};
/** @brief CCFadeOutDownTiles action.
@ -153,8 +182,13 @@ public:
virtual float testFunc(const ccGridSize& pos, float time);
public:
/** creates the action with the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCFadeOutDownTiles* actionWithSize(const ccGridSize& gridSize, float time);
/** creates the action with the grid size and the duration */
static CCFadeOutDownTiles* actionWithSize(const ccGridSize& gridSize, float time);
static CCFadeOutDownTiles* create(const ccGridSize& gridSize, float time);
};
/** @brief CCTurnOffTiles action.
@ -175,10 +209,19 @@ public:
virtual void update(float time);
public:
/** creates the action with the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCTurnOffTiles* actionWithSize(const ccGridSize& size, float d);
/** creates the action with a random seed, the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCTurnOffTiles* actionWithSeed(int s, const ccGridSize& gridSize, float duration);
/** creates the action with the grid size and the duration */
static CCTurnOffTiles* actionWithSize(const ccGridSize& size, float d);
static CCTurnOffTiles* create(const ccGridSize& size, float d);
/** creates the action with a random seed, the grid size and the duration */
static CCTurnOffTiles* actionWithSeed(int s, const ccGridSize& gridSize, float duration);
static CCTurnOffTiles* create(int s, const ccGridSize& gridSize, float duration);
protected:
int m_nSeed;
@ -205,9 +248,12 @@ public:
virtual void update(float time);
public:
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCWavesTiles3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
static CCWavesTiles3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
static CCWavesTiles3D* create(int wav, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nWaves;
float m_fAmplitude;
@ -234,9 +280,12 @@ public:
virtual void update(float time);
public:
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration
@warning: This interface will be deprecated in future.
*/
//static CCJumpTiles3D* actionWithJumps(int j, float amp, const ccGridSize& gridSize, float duration);
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
static CCJumpTiles3D* actionWithJumps(int j, float amp, const ccGridSize& gridSize, float duration);
static CCJumpTiles3D* create(int j, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nJumps;
float m_fAmplitude;
@ -255,9 +304,12 @@ public :
virtual void startWithTarget(CCNode *pTarget);
public:
/** creates the action with the number of rows to split and the duration
@warning: This interface will be deprecated in future.
*/
//static CCSplitRows* actionWithRows(int nRows, float duration);
/** creates the action with the number of rows to split and the duration */
static CCSplitRows* actionWithRows(int nRows, float duration);
static CCSplitRows* create(int nRows, float duration);
protected:
int m_nRows;
CCSize m_winSize;
@ -275,9 +327,12 @@ public:
virtual void startWithTarget(CCNode *pTarget);
public:
/** creates the action with the number of columns to split and the duration
@warning: This interface will be deprecated in future.
*/
//static CCSplitCols* actionWithCols(int nCols, float duration);
/** creates the action with the number of columns to split and the duration */
static CCSplitCols* actionWithCols(int nCols, float duration);
static CCSplitCols* create(int nCols, float duration);
protected:
int m_nCols;
CCSize m_winSize;

Просмотреть файл

@ -27,7 +27,21 @@ THE SOFTWARE.
NS_CC_BEGIN
CCActionTween* CCActionTween::actionWithDuration(float aDuration, const char* key, float from, float to)
// CCActionTween* CCActionTween::actionWithDuration(float aDuration, const char* key, float from, float to)
// {
// CCActionTween* pRet = new CCActionTween();
// if (pRet && pRet->initWithDuration(aDuration, key, from, to))
// {
// pRet->autorelease();
// }
// else
// {
// CC_SAFE_DELETE(pRet);
// }
// return pRet;
// }
CCActionTween* CCActionTween::create(float aDuration, const char* key, float from, float to)
{
CCActionTween* pRet = new CCActionTween();
if (pRet && pRet->initWithDuration(aDuration, key, from, to))
@ -68,7 +82,7 @@ void CCActionTween::update(float dt)
CCActionInterval* CCActionTween::reverse()
{
return CCActionTween::actionWithDuration(m_fDuration, m_strKey.c_str(), m_fTo, m_fFrom);
return CCActionTween::create(m_fDuration, m_strKey.c_str(), m_fTo, m_fFrom);
}

Просмотреть файл

@ -57,9 +57,12 @@ public:
class CCActionTween : public CCActionInterval
{
public:
/** creates an initializes the action with the property name (key), and the from and to parameters.
@warning: This interface will be deprecated in future.
*/
//static CCActionTween* actionWithDuration(float aDuration, const char* key, float from, float to);
/** creates an initializes the action with the property name (key), and the from and to parameters. */
static CCActionTween* actionWithDuration(float aDuration, const char* key, float from, float to);
static CCActionTween* create(float aDuration, const char* key, float from, float to);
/** initializes the action with the property name (key), and the from and to parameters. */
bool initWithDuration(float aDuration, const char* key, float from, float to);

Просмотреть файл

@ -60,17 +60,23 @@ CCAtlasNode::~CCAtlasNode()
CC_SAFE_RELEASE(m_pTextureAtlas);
}
CCAtlasNode * CCAtlasNode::atlasWithTileFile(const char *tile, unsigned int tileWidth, unsigned int tileHeight,
unsigned int itemsToRender)
// CCAtlasNode * CCAtlasNode::atlasWithTileFile(const char *tile, unsigned int tileWidth, unsigned int tileHeight,
// unsigned int itemsToRender)
// {
// return CCAtlasNode::create(tile, tileWidth, tileHeight, itemsToRender);
// }
CCAtlasNode * CCAtlasNode::create(const char *tile, unsigned int tileWidth, unsigned int tileHeight,
unsigned int itemsToRender)
{
CCAtlasNode * pRet = new CCAtlasNode();
if (pRet->initWithTileFile(tile, tileWidth, tileHeight, itemsToRender))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
CCAtlasNode * pRet = new CCAtlasNode();
if (pRet->initWithTileFile(tile, tileWidth, tileHeight, itemsToRender))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, unsigned int tileHeight,

Просмотреть файл

@ -76,9 +76,15 @@ public:
CCAtlasNode();
virtual ~CCAtlasNode();
/** creates a CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
static CCAtlasNode * atlasWithTileFile(const char* tile,unsigned int tileWidth, unsigned int tileHeight,
unsigned int itemsToRender);
/** creates a CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render
@warning: This interface will be deprecated in future.
*/
// static CCAtlasNode * atlasWithTileFile(const char* tile,unsigned int tileWidth, unsigned int tileHeight,
// unsigned int itemsToRender);
/** creates a CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
static CCAtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight,
unsigned int itemsToRender);
/** initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2009 Valentin Milea
Copyright (c) 2011 Zynga Inc.
@ -437,13 +437,17 @@ CCRect CCNode::boundingBox()
return CCRectApplyAffineTransform(rect, nodeToParentTransform());
}
CCNode * CCNode::node(void)
{
CCNode * pRet = new CCNode();
pRet->autorelease();
return pRet;
}
// CCNode * CCNode::node(void)
// {
// return CCNode::create();
// }
CCNode * CCNode::create(void)
{
CCNode * pRet = new CCNode();
pRet->autorelease();
return pRet;
}
void CCNode::cleanup()
{

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2009 Valentin Milea
Copyright (c) 2011 Zynga Inc.
@ -298,8 +298,14 @@ public:
/** allocates and initializes a node.
The node will be created as "autorelease".
@warning: This interface will be deprecated in future.
*/
static CCNode * node(void);
//static CCNode * node(void);
/** allocates and initializes a node.
The node will be created as "autorelease".
*/
static CCNode * create(void);
//scene managment

Просмотреть файл

@ -377,9 +377,12 @@ CCObject* CCArray::copyWithZone(CCZone* pZone)
pArray->initWithCapacity(this->data->num > 0 ? this->data->num : 1);
CCObject* pObj = NULL;
CCObject* pTmpObj = NULL;
CCARRAY_FOREACH(this, pObj)
{
pArray->addObject(pObj->copy()->autorelease());
pTmpObj = pObj->copy();
pArray->addObject(pTmpObj);
pTmpObj->release();
}
return pArray;
}

Просмотреть файл

@ -267,18 +267,24 @@ CCObject* CCDictionary::copyWithZone(CCZone* pZone)
CCDictionary* pNewDict = new CCDictionary();
CCDictElement* pElement = NULL;
CCObject* pTmpObj = NULL;
if (m_eDictType == kCCDictInt)
{
CCDICT_FOREACH(this, pElement)
{
pNewDict->setObject(pElement->getObject()->copy()->autorelease(), pElement->getIntKey());
pTmpObj = pElement->getObject()->copy();
pNewDict->setObject(pTmpObj, pElement->getIntKey());
pTmpObj->release();
}
}
else if (m_eDictType == kCCDictStr)
{
CCDICT_FOREACH(this, pElement)
{
pNewDict->setObject(pElement->getObject()->copy()->autorelease(), pElement->getStrKey());
pTmpObj = pElement->getObject()->copy();
pNewDict->setObject(pTmpObj, pElement->getStrKey());
pTmpObj->release();
}
}

Просмотреть файл

@ -55,6 +55,13 @@ void CCPoint::setPoint(float x, float y)
this->y = y;
}
CCObject* CCPoint::copyWithZone(CCZone* pZone)
{
CCPoint* pRet = new CCPoint();
pRet->setPoint(this->x, this->y);
return pRet;
}
bool CCPoint::CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2)
{
return ((point1.x == point2.x) && (point1.y == point2.y));
@ -89,6 +96,13 @@ void CCSize::setSize(float width, float height)
this->height = height;
}
CCObject* CCSize::copyWithZone(CCZone* pZone)
{
CCSize* pRet = new CCSize();
pRet->setSize(this->width, this->width);
return pRet;
}
bool CCSize::CCSizeEqualToSize(const CCSize& size1, const CCSize& size2)
{
return ((size1.width == size2.width) && (size1.height == size2.height));
@ -129,6 +143,13 @@ void CCRect::setRect(float x, float y, float width, float height)
size.height = height;
}
CCObject* CCRect::copyWithZone(CCZone* pZone)
{
CCRect* pRet = new CCRect();
pRet->setRect(this->origin.x, this->origin.y, this->size.width, this->size.height);
return pRet;
}
bool CCRect::CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2)
{
return (CCPoint::CCPointEqualToPoint(rect1.origin, rect2.origin)

Просмотреть файл

@ -44,6 +44,8 @@ public:
CCPoint(const CCPoint& other);
CCPoint& operator= (const CCPoint& other);
void setPoint(float x, float y);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
};
@ -60,6 +62,7 @@ public:
CCSize(const CCSize& other);
CCSize& operator= (const CCSize& other);
void setSize(float width, float height);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
};
@ -76,6 +79,7 @@ public:
CCRect(const CCRect& other);
CCRect& operator= (const CCRect& other);
void setRect(float x, float y, float width, float height);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
//! return the leftmost x-value of 'rect'
static CCFloat CCRectGetMinX(const CCRect& rect);

Просмотреть файл

@ -39,7 +39,12 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCGridBase
CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize)
// CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize)
// {
// return CCGridBase::create(gridSize);
// }
CCGridBase* CCGridBase::create(const ccGridSize& gridSize)
{
CCGridBase *pGridBase = new CCGridBase();
@ -58,7 +63,12 @@ CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize)
return pGridBase;
}
CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped)
// CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped)
// {
// return CCGridBase::create(gridSize, texture, flipped);
// }
CCGridBase* CCGridBase::create(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped)
{
CCGridBase *pGridBase = new CCGridBase();

Просмотреть файл

@ -76,8 +76,20 @@ public:
virtual void calculateVertexPoints(void);
public:
static CCGridBase* gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped);
static CCGridBase* gridWithSize(const ccGridSize& gridSize);
/** create one Grid
@warning: This interface will be deprecated in future.
*/
//static CCGridBase* gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped);
/** create one Grid
@warning: This interface will be deprecated in future.
*/
//static CCGridBase* gridWithSize(const ccGridSize& gridSize);
/** create one Grid */
static CCGridBase* create(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped);
/** create one Grid */
static CCGridBase* create(const ccGridSize& gridSize);
void set2DProjection(void);
protected:

Просмотреть файл

@ -467,16 +467,16 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
{
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(spriteSheetFile->m_sString.c_str());
spriteNormal = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileNormal"))->getCString());
spriteSelected = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileSelected"))->getCString());
spriteDisabled = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileDisabled"))->getCString());
spriteNormal = CCSprite::createWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileNormal"))->getCString());
spriteSelected = CCSprite::createWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileSelected"))->getCString());
spriteDisabled = CCSprite::createWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileDisabled"))->getCString());
// TBD: how to defense if exception raise here?
}
else
{
spriteNormal = CCSprite::spriteWithFile(spriteFileNormal->m_sString.c_str());
spriteSelected = CCSprite::spriteWithFile(spriteFileSelected->m_sString.c_str());
spriteDisabled = CCSprite::spriteWithFile(spriteFileDisabled->m_sString.c_str());
spriteNormal = CCSprite::create(spriteFileNormal->m_sString.c_str());
spriteSelected = CCSprite::create(spriteFileSelected->m_sString.c_str());
spriteDisabled = CCSprite::create(spriteFileDisabled->m_sString.c_str());
}
//deallocate
@ -484,9 +484,9 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
CC_SAFE_RELEASE_NULL(spriteFileSelected);
CC_SAFE_RELEASE_NULL(spriteFileDisabled);
if (!spriteNormal) spriteNormal = CCSprite::spriteWithFile("missing-texture.png");
if (!spriteSelected) spriteSelected = CCSprite::spriteWithFile("missing-texture.png");
if (!spriteDisabled) spriteDisabled = CCSprite::spriteWithFile("missing-texture.png");
if (!spriteNormal) spriteNormal = CCSprite::create("missing-texture.png");
if (!spriteSelected) spriteSelected = CCSprite::create("missing-texture.png");
if (!spriteDisabled) spriteDisabled = CCSprite::create("missing-texture.png");
CCNode *target = NULL ;
if ( extraProps == NULL )
@ -512,7 +512,7 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
target = NULL ;
}
node = (CCNode*)CCMenuItemImage::itemWithNormalSprite((CCNode*) spriteNormal, (CCNode*) spriteSelected, (CCNode*) spriteDisabled, target, sel);
node = (CCNode*)CCMenuItemSprite::create((CCNode*) spriteNormal, (CCNode*) spriteSelected, (CCNode*) spriteDisabled, target, sel);
setPropsForNode(node, (CCDictionary*) props, extraProps);
setPropsForMenuItem((CCMenuItem*) node, (CCDictionary*) props, extraProps);
@ -520,7 +520,7 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
}
else if (className->m_sString.compare("CCMenu") == 0)
{
node = (CCNode*)CCMenu::menuWithItems(NULL);
node = (CCNode*)CCMenu::create();
setPropsForNode(node, (CCDictionary*) props, extraProps);
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
setPropsForMenu((CCMenu*)node, (CCDictionary*) props, extraProps);
@ -531,12 +531,12 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
fontFile->m_sString += ((CCString*)props->objectForKey("fontFile"))->m_sString;
CCString* stringText = ((CCString*)props->objectForKey("string"));
node = (CCNode*)CCLabelBMFont::labelWithString(stringText->m_sString.c_str(),
node = (CCNode*)CCLabelBMFont::create(stringText->m_sString.c_str(),
fontFile->m_sString.c_str() );
CC_SAFE_RELEASE_NULL(fontFile);
if (!node) node = (CCNode*)CCLabelBMFont::labelWithString(stringText->m_sString.c_str(), "missing-font.fnt");
if (!node) node = (CCNode*)CCLabelBMFont::create(stringText->m_sString.c_str(), "missing-font.fnt");
setPropsForNode(node, (CCDictionary*) props, extraProps);
setPropsForLabelBMFont((CCLabelBMFont*) node, (CCDictionary*) props, extraProps);
@ -555,18 +555,18 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
if (spriteSheetFile && !spriteSheetFile->length())
{
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(spriteSheetFile->m_sString.c_str());
node = (CCNode*)CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFile"))->m_sString.c_str());
node = (CCNode*)CCSprite::createWithSpriteFrameName(((CCString*)props->objectForKey("spriteFile"))->m_sString.c_str());
// TBD: how to defense if exception raise here?
}
else
{
CCLOG("spriteFile->m_string.cstr is %s\n", spriteFile->m_sString.c_str()) ;
node = (CCNode*)CCSprite::spriteWithFile(spriteFile->m_sString.c_str());
node = (CCNode*)CCSprite::create(spriteFile->m_sString.c_str());
}
CC_SAFE_RELEASE_NULL(spriteFile);
if (!node) node = (CCNode*)CCSprite::spriteWithFile("missing-texture.png");
if (!node) node = (CCNode*)CCSprite::create("missing-texture.png");
setPropsForNode(node, (CCDictionary*) props, extraProps);
setPropsForSprite((CCSprite*) node, (CCDictionary*) props, extraProps);
@ -585,7 +585,7 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
}
else
{
node = (CCNode*)CCLayerGradient::node();
node = (CCNode*)CCLayerGradient::create();
}
setPropsForNode(node, (CCDictionary*) props, extraProps);
@ -608,7 +608,7 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
}
else
{
node = (CCNode*)CCLayerColor::node();
node = (CCNode*)CCLayerColor::create();
}
setPropsForNode(node, (CCDictionary*) props, extraProps);
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
@ -628,7 +628,7 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
}
else
{
node = (CCNode*)CCLayer::node();
node = (CCNode*)CCLayer::create();
}
setPropsForNode(node, (CCDictionary*) props, extraProps);
@ -649,7 +649,7 @@ CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extr
}
else
{
node = (CCNode*)CCNode::node();
node = (CCNode*)CCNode::create();
}
setPropsForNode(node, (CCDictionary*) props, extraProps);

Просмотреть файл

@ -202,7 +202,7 @@ public:
void addTargetWithActionForControlEvent(CCObject* target, SEL_MenuHandler action, CCControlEvent controlEvent);
void removeTargetWithActionForControlEvent(CCObject* target, SEL_MenuHandler action, CCControlEvent controlEvent);
LAYER_NODE_FUNC(CCControl);
LAYER_CREATE_FUNC(CCControl);
};

Просмотреть файл

@ -122,7 +122,12 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
return false;
}
CCControlButton* CCControlButton::buttonWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite)
// CCControlButton* CCControlButton::buttonWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite)
// {
// return CCControlButton::create(label, backgroundSprite);
// }
CCControlButton* CCControlButton::create(CCNode* label, CCScale9Sprite* backgroundSprite)
{
CCControlButton *pRet = new CCControlButton();
pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite);
@ -132,11 +137,16 @@ CCControlButton* CCControlButton::buttonWithLabelAndBackgroundSprite(CCNode* lab
bool CCControlButton::initWithTitleAndFontNameAndFontSize(string title, const char * fontName, float fontSize)
{
CCLabelTTF *label = CCLabelTTF::labelWithString(title.c_str(), fontName, fontSize);
return initWithLabelAndBackgroundSprite(label, CCScale9Sprite::node());
CCLabelTTF *label = CCLabelTTF::create(title.c_str(), fontName, fontSize);
return initWithLabelAndBackgroundSprite(label, CCScale9Sprite::create());
}
CCControlButton* CCControlButton::buttonWithTitleAndFontNameAndFontSize(string title, const char * fontName, float fontSize)
// CCControlButton* CCControlButton::buttonWithTitleAndFontNameAndFontSize(string title, const char * fontName, float fontSize)
// {
// return CCControlButton::create(title, fontName, fontSize);
// }
CCControlButton* CCControlButton::create(string title, const char * fontName, float fontSize)
{
CCControlButton *pRet = new CCControlButton();
pRet->initWithTitleAndFontNameAndFontSize(title, fontName, fontSize);
@ -146,11 +156,16 @@ CCControlButton* CCControlButton::buttonWithTitleAndFontNameAndFontSize(string t
bool CCControlButton::initWithBackgroundSprite(CCScale9Sprite* sprite)
{
CCLabelTTF *label = CCLabelTTF::labelWithString("", "Arial", 30);//
CCLabelTTF *label = CCLabelTTF::create("", "Arial", 30);//
return initWithLabelAndBackgroundSprite(label, sprite);
}
CCControlButton* CCControlButton::buttonWithBackgroundSprite(CCScale9Sprite* sprite)
// CCControlButton* CCControlButton::buttonWithBackgroundSprite(CCScale9Sprite* sprite)
// {
// return CCControlButton::create(sprite);
// }
CCControlButton* CCControlButton::create(CCScale9Sprite* sprite)
{
CCControlButton *pRet = new CCControlButton();
pRet->initWithBackgroundSprite(sprite);
@ -191,7 +206,7 @@ void CCControlButton::setIsHighlighted(bool enabled)
if( m_zoomOnTouchDown )
{
float scaleValue = (getIsHighlighted() && getIsEnabled() && !getIsSelected()) ? 1.1f : 1.0f;
CCAction *zoomAction =CCScaleTo::actionWithDuration(0.05f, scaleValue);
CCAction *zoomAction =CCScaleTo::create(0.05f, scaleValue);
zoomAction->setTag(kZoomActionTag);
runAction(zoomAction);
}

Просмотреть файл

@ -94,13 +94,22 @@ protected:
public:
virtual bool initWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite);
static CCControlButton* buttonWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite);
//@warning: This interface will be deprecated in future.
//static CCControlButton* buttonWithLabelAndBackgroundSprite(CCNode* label, CCScale9Sprite* backgroundSprite);
static CCControlButton* create(CCNode* label, CCScale9Sprite* backgroundSprite);
virtual bool initWithTitleAndFontNameAndFontSize(std::string title, const char * fontName, float fontSize);
static CCControlButton* buttonWithTitleAndFontNameAndFontSize(std::string title, const char * fontName, float fontSize);
//@warning: This interface will be deprecated in future.
//static CCControlButton* buttonWithTitleAndFontNameAndFontSize(std::string title, const char * fontName, float fontSize);
static CCControlButton* create(std::string title, const char * fontName, float fontSize);
virtual bool initWithBackgroundSprite(CCScale9Sprite* sprite);
static CCControlButton* buttonWithBackgroundSprite(CCScale9Sprite* sprite);
//@warning: This interface will be deprecated in future.
//static CCControlButton* buttonWithBackgroundSprite(CCScale9Sprite* sprite);
static CCControlButton* create(CCScale9Sprite* sprite);
//events
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);

Просмотреть файл

@ -44,7 +44,7 @@ bool CCControlColourPicker::init()
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("extensions/CCControlColourPickerSpriteSheet.plist");
// Create the sprite batch node
CCSpriteBatchNode *spriteSheet = CCSpriteBatchNode::batchNodeWithFile("extensions/CCControlColourPickerSpriteSheet.png");
CCSpriteBatchNode *spriteSheet = CCSpriteBatchNode::create("extensions/CCControlColourPickerSpriteSheet.png");
addChild(spriteSheet);
// MIPMAP
@ -67,8 +67,8 @@ bool CCControlColourPicker::init()
float hueShift = 8;
float colourShift = 28;
m_huePicker=CCControlHuePicker::pickerWithTargetAndPos(spriteSheet, ccp(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
m_colourPicker=CCControlSaturationBrightnessPicker::pickerWithTargetAndPos(spriteSheet, ccp(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
m_huePicker=CCControlHuePicker::create(spriteSheet, ccp(backgroundPointZero.x + hueShift, backgroundPointZero.y + hueShift));
m_colourPicker=CCControlSaturationBrightnessPicker::create(spriteSheet, ccp(backgroundPointZero.x + colourShift, backgroundPointZero.y + colourShift));
// Setup events
m_huePicker->addTargetWithActionForControlEvents(this, menu_selector(CCControlColourPicker::hueSliderValueChanged), CCControlEventValueChanged);
@ -87,7 +87,12 @@ bool CCControlColourPicker::init()
return false;
}
CCControlColourPicker* CCControlColourPicker::colourPicker()
// CCControlColourPicker* CCControlColourPicker::colourPicker()
// {
// return CCControlColourPicker::create();
// }
CCControlColourPicker* CCControlColourPicker::create()
{
CCControlColourPicker *pRet = new CCControlColourPicker();
pRet->init();

Просмотреть файл

@ -52,7 +52,11 @@ protected:
CC_SYNTHESIZE_READONLY(CCSprite*, m_background, Background);
public:
static CCControlColourPicker* colourPicker();
//@warning: This interface will be deprecated in future.
//static CCControlColourPicker* colourPicker();
static CCControlColourPicker* create();
virtual bool init();
//virtual ~CCControlColourPicker();
void hueSliderValueChanged(CCObject * sender);

Просмотреть файл

@ -37,8 +37,13 @@ CCControlHuePicker::~CCControlHuePicker()
{
}
CCControlHuePicker* CCControlHuePicker::pickerWithTargetAndPos(CCNode* target, CCPoint pos)
// CCControlHuePicker* CCControlHuePicker::pickerWithTargetAndPos(CCNode* target, CCPoint pos)
// {
// return CCControlHuePicker::create(target, pos);
// }
CCControlHuePicker* CCControlHuePicker::create(CCNode* target, CCPoint pos)
{
CCControlHuePicker *pRet = new CCControlHuePicker();
pRet->initWithTargetAndPos(target, pos);

Просмотреть файл

@ -54,8 +54,9 @@ class CC_DLL CCControlHuePicker : public CCControl
public:
virtual ~CCControlHuePicker();
virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos);
static CCControlHuePicker* pickerWithTargetAndPos(CCNode* target, CCPoint pos);
//@warning: This interface will be deprecated in future.
//static CCControlHuePicker* pickerWithTargetAndPos(CCNode* target, CCPoint pos);
static CCControlHuePicker* create(CCNode* target, CCPoint pos);
protected:
void updateSliderPosition(CCPoint location);
bool checkSliderPosition(CCPoint location);

Просмотреть файл

@ -58,7 +58,12 @@ bool CCControlSaturationBrightnessPicker::initWithTargetAndPos(CCNode* target, C
return false;
}
CCControlSaturationBrightnessPicker* CCControlSaturationBrightnessPicker::pickerWithTargetAndPos(CCNode* target, CCPoint pos)
// CCControlSaturationBrightnessPicker* CCControlSaturationBrightnessPicker::pickerWithTargetAndPos(CCNode* target, CCPoint pos)
// {
// return CCControlSaturationBrightnessPicker::create(target, pos);
// }
CCControlSaturationBrightnessPicker* CCControlSaturationBrightnessPicker::create(CCNode* target, CCPoint pos)
{
CCControlSaturationBrightnessPicker *pRet = new CCControlSaturationBrightnessPicker();
pRet->initWithTargetAndPos(target, pos);

Просмотреть файл

@ -56,7 +56,10 @@ protected:
public:
virtual ~CCControlSaturationBrightnessPicker();
virtual bool initWithTargetAndPos(CCNode* target, CCPoint pos);
static CCControlSaturationBrightnessPicker* pickerWithTargetAndPos(CCNode* target, CCPoint pos);
//@warning: This interface will be deprecated in future.
//static CCControlSaturationBrightnessPicker* pickerWithTargetAndPos(CCNode* target, CCPoint pos);
static CCControlSaturationBrightnessPicker* create(CCNode* target, CCPoint pos);
virtual void updateWithHSV(HSV hsv);
virtual void updateDraggerWithHSV(HSV hsv);

Просмотреть файл

@ -38,25 +38,35 @@ CCControlSlider::~CCControlSlider()
}
CCControlSlider* CCControlSlider::sliderWithFiles(const char* bgFile, const char* progressFile, const char* thumbFile)
// CCControlSlider* CCControlSlider::sliderWithFiles(const char* bgFile, const char* progressFile, const char* thumbFile)
// {
// return CCControlSlider::create(bgFile, progressFile, thumbFile);
// }
CCControlSlider* CCControlSlider::create(const char* bgFile, const char* progressFile, const char* thumbFile)
{
// Prepare background for slider
CCSprite *backgroundSprite = CCSprite::spriteWithFile(bgFile);
CCSprite *backgroundSprite = CCSprite::create(bgFile);
// Prepare progress for slider
CCSprite *progressSprite = CCSprite::spriteWithFile(progressFile);
CCSprite *progressSprite = CCSprite::create(progressFile);
// Prepare thumb (menuItem) for slider
CCSprite *thumbNormal = CCSprite::spriteWithFile(thumbFile);
CCSprite *thumbSelected = CCSprite::spriteWithFile(thumbFile);
CCSprite *thumbNormal = CCSprite::create(thumbFile);
CCSprite *thumbSelected = CCSprite::create(thumbFile);
thumbSelected->setColor(ccGRAY);
CCMenuItemSprite* thumbMenuItem =CCMenuItemSprite::itemWithNormalSprite(thumbNormal, thumbSelected);
CCMenuItemSprite* thumbMenuItem =CCMenuItemSprite::create(thumbNormal, thumbSelected);
return CCControlSlider::sliderWithSprites(backgroundSprite, progressSprite, thumbMenuItem);
return CCControlSlider::create(backgroundSprite, progressSprite, thumbMenuItem);
}
CCControlSlider* CCControlSlider::sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem)
// CCControlSlider* CCControlSlider::sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem)
// {
// return CCControlSlider::create(backgroundSprite, pogressSprite, thumbItem);
// }
CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem)
{
CCControlSlider *pRet = new CCControlSlider();
pRet->initWithSprites(backgroundSprite, pogressSprite, thumbItem);

Просмотреть файл

@ -75,8 +75,24 @@ public:
/**
* Creates slider with a background filename, a progress filename and a
* thumb image filename.
@warning: This interface will be deprecated in future.
*/
static CCControlSlider* sliderWithFiles(const char* bgFile, const char* progressFile, const char* thumbFile);
//static CCControlSlider* sliderWithFiles(const char* bgFile, const char* progressFile, const char* thumbFile);
/**
* Creates a slider with a given background sprite and a progress bar and a
* thumb item.
*@warning: This interface will be deprecated in future.
* @see initWithBackgroundSprite:progressSprite:thumbMenuItem:
*/
//static CCControlSlider* sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem);
/**
* Creates slider with a background filename, a progress filename and a
* thumb image filename.
*/
static CCControlSlider* create(const char* bgFile, const char* progressFile, const char* thumbFile);
/**
* Creates a slider with a given background sprite and a progress bar and a
@ -84,9 +100,7 @@ public:
*
* @see initWithBackgroundSprite:progressSprite:thumbMenuItem:
*/
static CCControlSlider* sliderWithSprites(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem);
static CCControlSlider* create(CCSprite * backgroundSprite, CCSprite* pogressSprite, CCMenuItem* thumbItem);
protected:

Просмотреть файл

@ -206,7 +206,7 @@ void CCControlSwitchSprite::needsLayout()
m_pOffSprite->getContentSize().height / 2));
}
CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight((int)m_pMaskTexture->getContentSize().width, (int)m_pMaskTexture->getContentSize().height);
CCRenderTexture *rt = CCRenderTexture::create((int)m_pMaskTexture->getContentSize().width, (int)m_pMaskTexture->getContentSize().height);
rt->begin();
m_pOnSprite->visit();
@ -273,7 +273,12 @@ bool CCControlSwitch::initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSpri
return initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, NULL, NULL);
}
CCControlSwitch* CCControlSwitch::switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite)
// CCControlSwitch* CCControlSwitch::switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite)
// {
// return CCControlSwitch::create(maskSprite, onSprite, offSprite, thumbSprite);
// }
CCControlSwitch* CCControlSwitch::create(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite)
{
CCControlSwitch* pRet = new CCControlSwitch();
if (pRet && pRet->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, NULL, NULL))
@ -317,7 +322,12 @@ bool CCControlSwitch::initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSpri
return false;
}
CCControlSwitch* CCControlSwitch::switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel)
// CCControlSwitch* CCControlSwitch::switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel)
// {
// return CCControlSwitch::create(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel);
// }
CCControlSwitch* CCControlSwitch::create(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel)
{
CCControlSwitch* pRet = new CCControlSwitch();
if (pRet && pRet->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel))
@ -342,7 +352,7 @@ void CCControlSwitch::setOn(bool isOn, bool animated)
m_pSwitchSprite->runAction
(
CCActionTween::actionWithDuration
CCActionTween::create
(
0.2f,
"sliderXPosition",

Просмотреть файл

@ -46,14 +46,26 @@ public:
/** Initializes a switch with a mask sprite, on/off sprites for on/off states and a thumb sprite. */
bool initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite);
/** Creates a switch with a mask sprite, on/off sprites for on/off states and a thumb sprite.
@warning: This interface will be deprecated in future.
*/
//static CCControlSwitch* switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite);
/** Creates a switch with a mask sprite, on/off sprites for on/off states and a thumb sprite. */
static CCControlSwitch* switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite);
static CCControlSwitch* create(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite);
/** Initializes a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */
bool initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel);
/** Creates a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels.
@warning: This interface will be deprecated in future.
*/
//static CCControlSwitch* switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel);
/** Creates a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */
static CCControlSwitch* switchWithMaskSprite(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel);
static CCControlSwitch* create(CCSprite *maskSprite, CCSprite * onSprite, CCSprite * offSprite, CCSprite * thumbSprite, CCLabelTTF* onLabel, CCLabelTTF* offLabel);
/**
* Set the state of the switch to On or Off, optionally animating the transition.

Просмотреть файл

@ -5,7 +5,7 @@ NS_CC_EXT_BEGIN
CCSprite* CCControlUtils::addSpriteToTargetWithPosAndAnchor(const char* spriteName, CCNode * target, CCPoint pos, CCPoint anchor)
{
CCSprite *sprite =CCSprite::spriteWithSpriteFrameName(spriteName);
CCSprite *sprite =CCSprite::createWithSpriteFrameName(spriteName);
if (!sprite)
return NULL;

Просмотреть файл

@ -16,13 +16,33 @@ enum
//
//CCMenu
//
// CCMenuPassive* CCMenuPassive::node()
// {
// return CCMenuPassive::create();
// }
CCMenuPassive* CCMenuPassive::node()
{
return menuWithItem(NULL);
}
CCMenuPassive* CCMenuPassive::create()
{
return create(NULL, NULL);
}
CCMenuPassive * CCMenuPassive::menuWithItems(CCNode* item, ...)
// CCMenuPassive * CCMenuPassive::menuWithItems(CCNode* item, ...)
// {
// va_list args;
// va_start(args,item);
// CCMenuPassive *pRet = new CCMenuPassive();
// if (pRet && pRet->initWithItems(item, args))
// {
// pRet->autorelease();
// va_end(args);
// return pRet;
// }
// va_end(args);
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCMenuPassive * CCMenuPassive::create(CCNode* item, ...)
{
va_list args;
va_start(args,item);
@ -38,9 +58,14 @@ CCMenuPassive * CCMenuPassive::menuWithItems(CCNode* item, ...)
return NULL;
}
CCMenuPassive* CCMenuPassive::menuWithItem(CCNode* item)
// CCMenuPassive* CCMenuPassive::menuWithItem(CCNode* item)
// {
// return CCMenuPassive::createWithItem(item);
// }
CCMenuPassive* CCMenuPassive::createWithItem(CCNode* item)
{
return menuWithItems(item, NULL);
return create(item, NULL);
}
bool CCMenuPassive::initWithItems(CCNode* item, va_list args)

Просмотреть файл

@ -17,17 +17,34 @@ class CC_DLL CCMenuPassive : public CCLayer, public CCRGBAProtocol
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
public:
/** creates an empty CCMenu
@warning: This interface will be deprecated in future.
*/
//static CCMenuPassive* node();
/** creates a CCMenu with it's items
@warning: This interface will be deprecated in future.
*/
//static CCMenuPassive* menuWithItems(CCNode* item, ...);
/** creates a CCMenu with it's item, then use addChild() to add
* other items. It is used for script, it can't init with undetermined
* number of variables.
@warning: This interface will be deprecated in future.
*/
//static CCMenuPassive* menuWithItem(CCNode* item);
/** creates an empty CCMenu */
static CCMenuPassive* node();
static CCMenuPassive* create();
/** creates a CCMenu with it's items */
static CCMenuPassive* menuWithItems(CCNode* item, ...);
static CCMenuPassive* create(CCNode* item, ...);
/** creates a CCMenu with it's item, then use addChild() to add
* other items. It is used for script, it can't init with undetermined
* number of variables.
*/
static CCMenuPassive*menuWithItem(CCNode* item);
static CCMenuPassive* createWithItem(CCNode* item);
/** initializes a CCMenu with it's items */
bool initWithItems(CCNode* item, va_list args);

Просмотреть файл

@ -70,25 +70,25 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
//
// Centre
centre = CCSprite::spriteWithTexture(scale9Image->getTexture(), m_capInsets);
centre = CCSprite::createWithTexture(scale9Image->getTexture(), m_capInsets);
scale9Image->addChild(centre ,0 ,pCentre);
// Top
top = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsets.origin.x,
top = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(m_capInsets.origin.x,
t,
m_capInsets.size.width,
m_capInsets.origin.y - t));
scale9Image->addChild(top, 1, pTop);
// Bottom
bottom = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake( m_capInsets.origin.x,
bottom = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake( m_capInsets.origin.x,
m_capInsets.origin.y + m_capInsets.size.height,
m_capInsets.size.width,
h - (m_capInsets.origin.y - t + m_capInsets.size.height) ));
scale9Image->addChild(bottom, 1, pBottom);
// Left
left = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(
left = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
l,
m_capInsets.origin.y,
m_capInsets.origin.x - l,
@ -96,7 +96,7 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
scale9Image->addChild(left, 1, pLeft);
// Right
right = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(
right = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
m_capInsets.origin.x + m_capInsets.size.width,
m_capInsets.origin.y,
w - (m_capInsets.origin.x - l + m_capInsets.size.width),
@ -104,7 +104,7 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
scale9Image->addChild(right, 1, pRight);
// Top left
topLeft = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(
topLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
l,
t,
m_capInsets.origin.x - l,
@ -113,7 +113,7 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
scale9Image->addChild(topLeft, 2, pTopLeft);
// Top right
topRight = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(
topRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
m_capInsets.origin.x + m_capInsets.size.width,
t,
w - (m_capInsets.origin.x - l + m_capInsets.size.width),
@ -122,7 +122,7 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
scale9Image->addChild(topRight, 2, pTopRight);
// Bottom left
bottomLeft = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(
bottomLeft = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
l,
m_capInsets.origin.y + m_capInsets.size.height,
m_capInsets.origin.x - l,
@ -130,7 +130,7 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
scale9Image->addChild(bottomLeft, 2, pBottomLeft);
// Bottom right
bottomRight = CCSprite::spriteWithTexture(scale9Image->getTexture(), CCRectMake(
bottomRight = CCSprite::createWithTexture(scale9Image->getTexture(), CCRectMake(
m_capInsets.origin.x + m_capInsets.size.width,
m_capInsets.origin.y + m_capInsets.size.height,
w - (m_capInsets.origin.x - l + m_capInsets.size.width),
@ -189,12 +189,17 @@ bool CCScale9Sprite::initWithFile(const char* file, CCRect rect, CCRect capInse
{
CCAssert(file != NULL, "Invalid file for sprite");
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::batchNodeWithFile(file, 9);
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::create(file, 9);
bool pReturn = this->initWithBatchNode(batchnode, rect, capInsets);
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithFile(const char* file, CCRect rect, CCRect capInsets)
// CCScale9Sprite* CCScale9Sprite::spriteWithFile(const char* file, CCRect rect, CCRect capInsets)
// {
// return CCScale9Sprite::create(file, rect, capInsets);
// }
CCScale9Sprite* CCScale9Sprite::create(const char* file, CCRect rect, CCRect capInsets)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithFile(file, rect, capInsets) )
@ -211,7 +216,13 @@ bool CCScale9Sprite::initWithFile(const char* file, CCRect rect)
bool pReturn = this->initWithFile(file, rect, CCRectZero);
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithFile(const char* file, CCRect rect)
// CCScale9Sprite* CCScale9Sprite::spriteWithFile(const char* file, CCRect rect)
// {
// return CCScale9Sprite::create(file, rect);
// }
CCScale9Sprite* CCScale9Sprite::create(const char* file, CCRect rect)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithFile(file, rect) )
@ -230,7 +241,12 @@ bool CCScale9Sprite::initWithFile(CCRect capInsets, const char* file)
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithFile(CCRect capInsets, const char* file)
// CCScale9Sprite* CCScale9Sprite::spriteWithFile(CCRect capInsets, const char* file)
// {
// return CCScale9Sprite::create(capInsets, file);
// }
CCScale9Sprite* CCScale9Sprite::create(CCRect capInsets, const char* file)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithFile(file, capInsets) )
@ -248,7 +264,13 @@ bool CCScale9Sprite::initWithFile(const char* file)
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithFile(const char* file)
// CCScale9Sprite* CCScale9Sprite::spriteWithFile(const char* file)
// {
// return CCScale9Sprite::create(file);
// }
CCScale9Sprite* CCScale9Sprite::create(const char* file)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithFile(file) )
@ -264,12 +286,17 @@ bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capI
{
CCAssert(spriteFrame != NULL, "Sprite frame must be not nil");
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::batchNodeWithTexture(spriteFrame->getTexture(), 9);
CCSpriteBatchNode *batchnode = CCSpriteBatchNode::createWithTexture(spriteFrame->getTexture(), 9);
bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), capInsets);
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets)
// CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets)
// {
// return CCScale9Sprite::createWithSpriteFrame(spriteFrame, capInsets);
// }
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithSpriteFrame(spriteFrame, capInsets) )
@ -286,7 +313,13 @@ bool CCScale9Sprite::initWithSpriteFrame(CCSpriteFrame* spriteFrame)
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrame(CCSpriteFrame* spriteFrame)
// CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrame(CCSpriteFrame* spriteFrame)
// {
// return CCScale9Sprite::createWithSpriteFrame(spriteFrame);
// }
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrame(CCSpriteFrame* spriteFrame)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithSpriteFrame(spriteFrame) )
@ -307,7 +340,12 @@ bool CCScale9Sprite::initWithSpriteFrameName(const char* spriteFrameName, CCRect
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrameName(const char* spriteFrameName, CCRect capInsets)
// CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrameName(const char* spriteFrameName, CCRect capInsets)
// {
// return CCScale9Sprite::createWithSpriteFrameName(spriteFrameName, capInsets);
// }
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrameName(const char* spriteFrameName, CCRect capInsets)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName, capInsets) )
@ -326,7 +364,12 @@ bool CCScale9Sprite::initWithSpriteFrameName(const char* spriteFrameName)
return pReturn;
}
CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrameName(const char* spriteFrameName)
// CCScale9Sprite* CCScale9Sprite::spriteWithSpriteFrameName(const char* spriteFrameName)
// {
// return CCScale9Sprite::createWithSpriteFrameName(spriteFrameName);
// }
CCScale9Sprite* CCScale9Sprite::createWithSpriteFrameName(const char* spriteFrameName)
{
CCScale9Sprite* pReturn = new CCScale9Sprite();
if ( pReturn && pReturn->initWithSpriteFrameName(spriteFrameName) )
@ -351,7 +394,12 @@ CCScale9Sprite* CCScale9Sprite::resizableSpriteWithCapInsets(CCRect capInsets)
return NULL;
}
CCScale9Sprite* CCScale9Sprite::node()
// CCScale9Sprite* CCScale9Sprite::node()
// {
// return CCScale9Sprite::create();
// }
CCScale9Sprite* CCScale9Sprite::create()
{
CCScale9Sprite *pRet = new CCScale9Sprite();
if (pRet)

Просмотреть файл

@ -101,9 +101,18 @@ public:
* with the specified cap insets.
*
* @see initWithFile:rect:centerRegion:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect, CCRect capInsets);
//static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect, CCRect capInsets);
/**
* Creates a 9-slice sprite with a texture file, a delimitation zone and
* with the specified cap insets.
*
* @see initWithFile:rect:centerRegion:
*/
static CCScale9Sprite* create(const char* file, CCRect rect, CCRect capInsets);
/**
* Initializes a 9-slice sprite with a texture file and a delimitation zone. The
* texture will be broken down into a 3×3 grid of equal blocks.
@ -123,9 +132,18 @@ public:
* texture will be broken down into a 3×3 grid of equal blocks.
*
* @see initWithFile:rect:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect);
//static CCScale9Sprite* spriteWithFile(const char* file, CCRect rect);
/**
* Creates a 9-slice sprite with a texture file and a delimitation zone. The
* texture will be broken down into a 3×3 grid of equal blocks.
*
* @see initWithFile:rect:
*/
static CCScale9Sprite* create(const char* file, CCRect rect);
/**
* Initializes a 9-slice sprite with a texture file and with the specified cap
* insets.
@ -143,8 +161,17 @@ public:
* broken down into a 3×3 grid of equal blocks.
*
* @see initWithFile:capInsets:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithFile(CCRect capInsets, const char* file);
//static CCScale9Sprite* spriteWithFile(CCRect capInsets, const char* file);
/**
* Creates a 9-slice sprite with a texture file. The whole texture will be
* broken down into a 3×3 grid of equal blocks.
*
* @see initWithFile:capInsets:
*/
static CCScale9Sprite* create(CCRect capInsets, const char* file);
/**
* Initializes a 9-slice sprite with a texture file. The whole texture will be
@ -162,8 +189,17 @@ public:
* broken down into a 3×3 grid of equal blocks.
*
* @see initWithFile:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithFile(const char* file);
//static CCScale9Sprite* spriteWithFile(const char* file);
/**
* Creates a 9-slice sprite with a texture file. The whole texture will be
* broken down into a 3×3 grid of equal blocks.
*
* @see initWithFile:
*/
static CCScale9Sprite* create(const char* file);
/**
* Initializes a 9-slice sprite with an sprite frame and with the specified
@ -184,8 +220,19 @@ public:
* It respects the anchorPoint too.
*
* @see initWithSpriteFrame:centerRegion:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets);
//static CCScale9Sprite* spriteWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets);
/**
* Creates a 9-slice sprite with an sprite frame and the centre of its zone.
* Once the sprite is created, you can then call its "setContentSize:" method
* to resize the sprite will all it's 9-slice goodness intract.
* It respects the anchorPoint too.
*
* @see initWithSpriteFrame:centerRegion:
*/
static CCScale9Sprite* createWithSpriteFrame(CCSpriteFrame* spriteFrame, CCRect capInsets);
/**
* Initializes a 9-slice sprite with an sprite frame.
* Once the sprite is created, you can then call its "setContentSize:" method
@ -203,8 +250,20 @@ public:
* It respects the anchorPoint too.
*
* @see initWithSpriteFrame:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithSpriteFrame(CCSpriteFrame* spriteFrame);
//static CCScale9Sprite* spriteWithSpriteFrame(CCSpriteFrame* spriteFrame);
/**
* Creates a 9-slice sprite with an sprite frame.
* Once the sprite is created, you can then call its "setContentSize:" method
* to resize the sprite will all it's 9-slice goodness intract.
* It respects the anchorPoint too.
*
* @see initWithSpriteFrame:
*/
static CCScale9Sprite* createWithSpriteFrame(CCSpriteFrame* spriteFrame);
/**
* Initializes a 9-slice sprite with an sprite frame name and with the specified
* cap insets.
@ -224,8 +283,21 @@ public:
* It respects the anchorPoint too.
*
* @see initWithSpriteFrameName:centerRegion:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithSpriteFrameName(const char*spriteFrameName, CCRect capInsets);
//static CCScale9Sprite* spriteWithSpriteFrameName(const char*spriteFrameName, CCRect capInsets);
/**
* Creates a 9-slice sprite with an sprite frame name and the centre of its
* zone.
* Once the sprite is created, you can then call its "setContentSize:" method
* to resize the sprite will all it's 9-slice goodness intract.
* It respects the anchorPoint too.
*
* @see initWithSpriteFrameName:centerRegion:
*/
static CCScale9Sprite* createWithSpriteFrameName(const char*spriteFrameName, CCRect capInsets);
/**
* Initializes a 9-slice sprite with an sprite frame name.
* Once the sprite is created, you can then call its "setContentSize:" method
@ -243,8 +315,19 @@ public:
* It respects the anchorPoint too.
*
* @see initWithSpriteFrameName:
@warning: This interface will be deprecated in future.
*/
static CCScale9Sprite* spriteWithSpriteFrameName(const char*spriteFrameName);
//static CCScale9Sprite* spriteWithSpriteFrameName(const char*spriteFrameName);
/**
* Creates a 9-slice sprite with an sprite frame name.
* Once the sprite is created, you can then call its "setContentSize:" method
* to resize the sprite will all it's 9-slice goodness intract.
* It respects the anchorPoint too.
*
* @see initWithSpriteFrameName:
*/
static CCScale9Sprite* createWithSpriteFrameName(const char*spriteFrameName);
/**
* Creates and returns a new sprite object with the specified cap insets.
@ -257,8 +340,10 @@ public:
CCScale9Sprite* resizableSpriteWithCapInsets(CCRect capInsets);
static CCScale9Sprite* node();
//static CCScale9Sprite* node();
static CCScale9Sprite* create();
// optional
/** sets the premultipliedAlphaOpacity property.

Просмотреть файл

@ -35,7 +35,12 @@ NS_CC_EXT_BEGIN
/******************************************
**************Public Functions*************
*******************************************/
CCListView* CCListView::viewWithMode(CCListViewMode mode)
// CCListView* CCListView::viewWithMode(CCListViewMode mode)
// {
// return CCListView::create(mode);
// }
CCListView* CCListView::create(CCListViewMode mode)
{
CCListView *pRet = new CCListView();
if (pRet && pRet->initWithMode(mode))
@ -52,14 +57,15 @@ CCListView* CCListView::viewWithMode(CCListViewMode mode)
bool CCListView::initWithMode(CCListViewMode mode)
{
bool bRet = false;
m_nMode = mode;
m_layerPanel = CCLayer::node();
this->addChild(m_layerPanel);
bRet = CCLayerColor::initWithColor(ccc4(255, 255, 255, 0), 0, 0);
setIsTouchEnabled(true);
return bRet;
if (CCLayerColor::initWithColor(ccc4(255, 255, 255, 0), 0, 0))
{
setIsTouchEnabled(true);
m_nMode = mode;
m_layerPanel = CCLayer::create();
this->addChild(m_layerPanel);
return true;
}
return false;
}
CCListView::CCListView(void)
@ -563,9 +569,9 @@ void CCListView::scrollCellToFront(unsigned int nRow, bool bAnimated)
if (bAnimated)
{
CCMoveBy *moveBy = CCMoveBy::actionWithDuration(m_fActionDuration, CCPointMake(disX, disY));
CCEaseOut *ease = CCEaseOut::actionWithAction(moveBy, 3);
CCFiniteTimeAction *actions = CCSequence::actions(ease, CCCallFunc::actionWithTarget(this, callfunc_selector(CCListView::finishScroll)), NULL);
CCMoveBy *moveBy = CCMoveBy::create(m_fActionDuration, CCPointMake(disX, disY));
CCEaseOut *ease = CCEaseOut::create(moveBy, 3);
CCFiniteTimeAction *actions = CCSequence::create(ease, CCCallFunc::create(this, callfunc_selector(CCListView::finishScroll)), NULL);
m_layerPanel->runAction(actions);
}
else
@ -896,9 +902,9 @@ void CCListView::scrollCellToBack(unsigned int nRow, bool bAnimated)
if (bAnimated)
{
CCMoveBy *moveBy = CCMoveBy::actionWithDuration(m_fActionDuration, CCPointMake(disX, disY));
CCEaseOut *ease = CCEaseOut::actionWithAction(moveBy, 3);
CCFiniteTimeAction *actions = CCSequence::actions(ease, CCCallFunc::actionWithTarget(this, callfunc_selector(CCListView::finishScroll)), NULL);
CCMoveBy *moveBy = CCMoveBy::create(m_fActionDuration, CCPointMake(disX, disY));
CCEaseOut *ease = CCEaseOut::create(moveBy, 3);
CCFiniteTimeAction *actions = CCSequence::create(ease, CCCallFunc::create(this, callfunc_selector(CCListView::finishScroll)), NULL);
m_layerPanel->runAction(actions);
}
else
@ -1476,9 +1482,9 @@ void CCListView::fixFirstRow(void)
}
m_nState = CCListViewStateFix;
CCMoveBy *moveBy = CCMoveBy::actionWithDuration(m_fActionDuration, CCPointMake(disX, disY));
CCEaseInOut *ease = CCEaseInOut::actionWithAction(moveBy, 2);
CCFiniteTimeAction *actions = CCSequence::actions(ease, CCCallFunc::actionWithTarget(this, callfunc_selector(CCListView::finishFix)), NULL);
CCMoveBy *moveBy = CCMoveBy::create(m_fActionDuration, CCPointMake(disX, disY));
CCEaseInOut *ease = CCEaseInOut::create(moveBy, 2);
CCFiniteTimeAction *actions = CCSequence::create(ease, CCCallFunc::create(this, callfunc_selector(CCListView::finishFix)), NULL);
m_layerPanel->runAction(actions);
}
else
@ -1515,9 +1521,9 @@ void CCListView::fixLastRow(void)
}
m_nState = CCListViewStateFix;
CCMoveBy *moveBy = CCMoveBy::actionWithDuration(m_fActionDuration, CCPointMake(disX, disY));
CCEaseInOut *ease = CCEaseInOut::actionWithAction(moveBy, 2);
CCFiniteTimeAction *actions = CCSequence::actions(ease, CCCallFunc::actionWithTarget(this, callfunc_selector(CCListView::finishFix)), NULL);
CCMoveBy *moveBy = CCMoveBy::create(m_fActionDuration, CCPointMake(disX, disY));
CCEaseInOut *ease = CCEaseInOut::create(moveBy, 2);
CCFiniteTimeAction *actions = CCSequence::create(ease, CCCallFunc::create(this, callfunc_selector(CCListView::finishFix)), NULL);
m_layerPanel->runAction(actions);
}
else
@ -1723,9 +1729,9 @@ void CCListView::easeOutWithDistance(float dis)
}
m_nState = CCListViewStateEaseOut;
CCMoveBy *moveBy = CCMoveBy::actionWithDuration(m_fActionDuration, CCPointMake(disX, disY));
CCEaseOut *ease = CCEaseOut::actionWithAction(moveBy, 3);
CCFiniteTimeAction *actions = CCSequence::actions(ease, CCCallFunc::actionWithTarget(this, callfunc_selector(CCListView::finishEaseOut)), NULL);
CCMoveBy *moveBy = CCMoveBy::create(m_fActionDuration, CCPointMake(disX, disY));
CCEaseOut *ease = CCEaseOut::create(moveBy, 3);
CCFiniteTimeAction *actions = CCSequence::create(ease, CCCallFunc::create(this, callfunc_selector(CCListView::finishEaseOut)), NULL);
m_layerPanel->runAction(actions);
}
@ -1820,6 +1826,8 @@ void CCListView::registerWithTouchDispatcher()
void CCListView::onEnter(void)
{
CCLayerColor::onEnter();
if (0 == m_nNumberOfRows)
{
m_layerPanel->setPosition(CCPointZero);
@ -1828,8 +1836,6 @@ void CCListView::onEnter(void)
m_nNumberOfRows = triggerNumberOfCells();
displayVisibleRows();
}
CCLayerColor::onEnter();
}
void CCListView::onExit(void)

Просмотреть файл

@ -121,7 +121,11 @@ public:
virtual ~CCListView(void);
CCListView(void);
static CCListView* viewWithMode(CCListViewMode mode);
// @warning: This interface will be deprecated in future.
//static CCListView* viewWithMode(CCListViewMode mode);
static CCListView* create(CCListViewMode mode);
bool initWithMode(CCListViewMode mode);
void setDelegateName(const char* pszName);

Просмотреть файл

@ -40,7 +40,7 @@ CCTextureWatcher::CCTextureWatcher()
m_bFresh = true;
m_pTextures = NULL;
m_pszString = NULL;
m_pLayer = CCLayerColor::layerWithColor(ccc4(128, 128, 128, 128));
m_pLayer = CCLayerColor::create(ccc4(128, 128, 128, 128));
m_pLayer->retain();
// layer
@ -50,19 +50,19 @@ CCTextureWatcher::CCTextureWatcher()
// the menu of disabling touch event
//*
CCLabelTTF *label = CCLabelTTF::labelWithString(" ", size, kCCTextAlignmentLeft, "Arial", 12);
CCMenuItemLabel *menuItem = CCMenuItemLabel::itemWithLabel(label);
CCLabelTTF *label = CCLabelTTF::create(" ", size, kCCTextAlignmentLeft, "Arial", 12);
CCMenuItemLabel *menuItem = CCMenuItemLabel::create(label);
menuItem->setAnchorPoint(ccp(0, 0));
menuItem->setPosition(ccp(0, 0));
CCMenu *menu = CCMenu::menuWithItem(menuItem);
CCMenu *menu = CCMenu::create(menuItem, NULL);
menu->setAnchorPoint(ccp(0, 0));
menu->setPosition(ccp(0, 0));
m_pLayer->addChild(menu);
//*/
// list
CCListView *list = CCListView::viewWithMode(CCListViewModeHorizontal);
CCListView *list = CCListView::create(CCListViewModeHorizontal);
list->setContentSize(size);
list->setDelegate(this);
list->setSeparatorStyle(CCListViewCellSeparatorStyleNone);
@ -71,13 +71,13 @@ CCTextureWatcher::CCTextureWatcher()
// 'Hide' button
CCLabelTTF *labelHide = CCLabelTTF::labelWithString("Hide ", "Arial", 24);
CCLabelTTF *labelHide = CCLabelTTF::create("Hide ", "Arial", 24);
labelHide->setColor(ccc3(255, 0, 0));
CCMenuItemLabel *menuItem2 = CCMenuItemLabel::itemWithLabel(labelHide, this, menu_selector(CCTextureWatcher::actionHide));
CCMenuItemLabel *menuItem2 = CCMenuItemLabel::create(labelHide, this, menu_selector(CCTextureWatcher::actionHide));
menuItem2->setAnchorPoint(ccp(0, 0));
menuItem2->setPosition(ccp(0, 0));
CCMenu *menu2 = CCMenu::menuWithItem(menuItem2);
CCMenu *menu2 = CCMenu::create(menuItem2, NULL);
menu2->setAnchorPoint(ccp(0, 0));
menu2->setPosition(ccp(size.width - menuItem2->getContentSize().width, 0));
@ -86,19 +86,19 @@ CCTextureWatcher::CCTextureWatcher()
m_menuHide->retain();
// 'Fresh' button
CCLabelTTF *labelFresh = CCLabelTTF::labelWithString("Fresh", "Arial", 24);
CCLabelTTF *labelFresh = CCLabelTTF::create("Fresh", "Arial", 24);
labelFresh->setColor(ccc3(255, 0, 0));
CCMenuItemLabel *menuItem1 = CCMenuItemLabel::itemWithLabel(labelFresh, this, menu_selector(CCTextureWatcher::actionFresh));
CCMenuItemLabel *menuItem1 = CCMenuItemLabel::create(labelFresh, this, menu_selector(CCTextureWatcher::actionFresh));
menuItem1->setAnchorPoint(ccp(0, 0));
menuItem1->setPosition(ccp(0, 0));
CCMenu *menu1 = CCMenu::menuWithItem(menuItem1);
CCMenu *menu1 = CCMenu::create(menuItem1, NULL);
menu1->setAnchorPoint(ccp(0, 0));
menu1->setPosition(ccp(size.width - menuItem1->getContentSize().width - menuItem2->getContentSize().width * 1.5, 0));
m_pLayer->addChild(menu1);
// label page
m_labelPage = CCLabelTTF::labelWithString(" ", CCSizeMake(size.width * 0.1, labelFresh->getContentSize().height), kCCTextAlignmentCenter, "Arial", 16);
m_labelPage = CCLabelTTF::create(" ", CCSizeMake(size.width * 0.1, labelFresh->getContentSize().height), kCCTextAlignmentCenter, "Arial", 16);
m_labelPage->setAnchorPoint(ccp(0.5, 0));
m_labelPage->setPosition(ccp(size.width/2.0, 0));
m_pLayer->addChild(m_labelPage, 0);
@ -279,7 +279,7 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
{
// reference count
sprintf(m_pszString, "[%d]", textrue->retainCount() - 2);
CCLabelTTF *labelCount = CCLabelTTF::labelWithString(m_pszString, "Arial", 16);
CCLabelTTF *labelCount = CCLabelTTF::create(m_pszString, "Arial", 16);
if (textrue->retainCount() - 2 > 0)
{
labelCount->setColor(ccc3(0, 255, 0));
@ -296,7 +296,7 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
// texture size
sprintf(m_pszString, "%.0f*%.0f", textrue->getContentSize().width, textrue->getContentSize().height);
CCLabelTTF *labelSize = CCLabelTTF::labelWithString(m_pszString, "Arial", 16);
CCLabelTTF *labelSize = CCLabelTTF::create(m_pszString, "Arial", 16);
offX = offsetX + listItemSize.width * 0.5f;
offY = (listItemSize.height - size.height) * 0.5f + size.height;
labelSize->setPosition(ccp(offX, offY));
@ -314,14 +314,14 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
string name = key.substr(pos, len - pos);
sprintf(m_pszString, "%s", name.c_str());
CCSize dimensions = CCSizeMake(listItemSize.width * 0.9f, labelSize->getContentSize().height);
CCLabelTTF *labelName = CCLabelTTF::labelWithString(m_pszString, dimensions, kCCTextAlignmentCenter, "Arial", 16);
CCLabelTTF *labelName = CCLabelTTF::create(m_pszString, dimensions, kCCTextAlignmentCenter, "Arial", 16);
offX = offsetX + listItemSize.width * 0.5f;
offY = offY + labelName->getContentSize().height;
labelName->setPosition(ccp(offX, offY));
labelName->setAnchorPoint(ccp(0.5f, 0));
cell->addChild(labelName);
CCSprite *sprite = CCSprite::spriteWithTexture(textrue);
CCSprite *sprite = CCSprite::createWithTexture(textrue);
sprite->setAnchorPoint(ccp(0, 0));
CCSize spriteSize = sprite->getContentSize();

Просмотреть файл

@ -41,7 +41,12 @@ THE SOFTWARE.
NS_CC_BEGIN
//CCLabelAtlas - Creation & Init
CCLabelAtlas* CCLabelAtlas::labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
// CCLabelAtlas* CCLabelAtlas::labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
// {
// return CCLabelAtlas::create(label, charMapFile, itemWidth, itemHeight, startCharMap);
// }
CCLabelAtlas* CCLabelAtlas::create(const char *label, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
{
CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet && pRet->initWithString(label, charMapFile, itemWidth, itemHeight, startCharMap))
@ -65,7 +70,12 @@ bool CCLabelAtlas::initWithString(const char *label, const char *charMapFile, un
return false;
}
CCLabelAtlas* CCLabelAtlas::labelWithString(const char *string, const char *fntFile)
// CCLabelAtlas* CCLabelAtlas::labelWithString(const char *string, const char *fntFile)
// {
// return CCLabelAtlas::create(string, fntFile);
// }
CCLabelAtlas* CCLabelAtlas::create(const char *string, const char *fntFile)
{
CCLabelAtlas *ret = new CCLabelAtlas();
if (ret)

Просмотреть файл

@ -51,13 +51,24 @@ public:
{
m_sString.clear();
}
/** 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
@warning: This interface will be deprecated in future.
*/
//static CCLabelAtlas * labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap);
/** creates the CCLabelAtlas with a string and a configuration file
@warning: This interface will be deprecated in future.
@since v2.0
*/
//static CCLabelAtlas* labelWithString(const char *sring, const char *fntFile);
/** 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 int startCharMap);
static CCLabelAtlas * create(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap);
/** creates the CCLabelAtlas with a string and a configuration file
@since v2.0
*/
static CCLabelAtlas* labelWithString(const char *sring, const char *fntFile);
static CCLabelAtlas* create(const char *sring, const char *fntFile);
/** 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 int startCharMap);

Просмотреть файл

@ -372,7 +372,7 @@ CCBMFontConfiguration* FNTConfigLoadFile( const char *fntFile)
pRet = (CCBMFontConfiguration*)configurations->objectForKey(fntFile);
if( pRet == NULL )
{
pRet = CCBMFontConfiguration::configurationWithFNTFile(fntFile);
pRet = CCBMFontConfiguration::create(fntFile);
if (pRet)
{
configurations->setObject(pRet, fntFile);
@ -405,7 +405,12 @@ typedef struct _KerningHashElement
//BitmapFontConfiguration
//
CCBMFontConfiguration * CCBMFontConfiguration::configurationWithFNTFile(const char *FNTfile)
// CCBMFontConfiguration * CCBMFontConfiguration::configurationWithFNTFile(const char *FNTfile)
// {
// return CCBMFontConfiguration::create(FNTfile);
// }
CCBMFontConfiguration * CCBMFontConfiguration::create(const char *FNTfile)
{
CCBMFontConfiguration * pRet = new CCBMFontConfiguration();
if (pRet->initWithFNTfile(FNTfile))
@ -713,34 +718,13 @@ void CCLabelBMFont::purgeCachedData()
FNTConfigRemoveCache();
}
//LabelBMFont - Creation & Init
CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile)
{
CCLabelBMFont *pRet = new CCLabelBMFont();
if(pRet && pRet->initWithString(str, fntFile))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
// CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile, float width/* = kCCLabelAutomaticWidth*/, CCTextAlignment alignment/* = kCCTextAlignmentLeft*/, CCPoint imageOffset/* = CCPointZero*/)
// {
// return CCLabelBMFont::create(str, fntFile, width, alignment, imageOffset);
// }
//LabelBMFont - Creation & Init
CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile, float width, CCTextAlignment alignment)
{
CCLabelBMFont *pRet = new CCLabelBMFont();
if(pRet && pRet->initWithString(str, fntFile, width, alignment))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
//LabelBMFont - Creation & Init
CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset)
CCLabelBMFont *CCLabelBMFont::create(const char *str, const char *fntFile, float width/* = kCCLabelAutomaticWidth*/, CCTextAlignment alignment/* = kCCTextAlignmentLeft*/, CCPoint imageOffset/* = CCPointZero*/)
{
CCLabelBMFont *pRet = new CCLabelBMFont();
if(pRet && pRet->initWithString(str, fntFile, width, alignment, imageOffset))
@ -757,17 +741,7 @@ bool CCLabelBMFont::init()
return initWithString(NULL, NULL, kCCLabelAutomaticWidth, kCCTextAlignmentLeft, CCPointZero);
}
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile)
{
return initWithString(theString, fntFile, kCCLabelAutomaticWidth, kCCTextAlignmentLeft, CCPointZero);
}
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile, float width, CCTextAlignment alignment)
{
return initWithString(theString, fntFile, width, alignment, CCPointZero);
}
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset)
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile, float width/* = kCCLabelAutomaticWidth*/, CCTextAlignment alignment/* = kCCTextAlignmentLeft*/, CCPoint imageOffset/* = CCPointZero*/)
{
CCAssert(!m_pConfiguration, "re-init is no longer supported");
CCAssert( (theString && fntFile) || (theString==NULL && fntFile==NULL), "Invalid params for CCLabelBMFont");

Просмотреть файл

@ -103,8 +103,14 @@ public:
CCBMFontConfiguration();
virtual ~CCBMFontConfiguration();
const char * description();
/** allocates a CCBMFontConfiguration with a FNT file
@warning: This interface will be deprecated in future.
*/
//static CCBMFontConfiguration * configurationWithFNTFile(const char *FNTfile);
/** allocates a CCBMFontConfiguration with a FNT file */
static CCBMFontConfiguration * configurationWithFNTFile(const char *FNTfile);
static CCBMFontConfiguration * create(const char *FNTfile);
/** initializes a BitmapFontConfiguration with a FNT file */
bool initWithFNTfile(const char *FNTfile);
@ -187,16 +193,17 @@ public:
@since v0.99.3
*/
static void purgeCachedData();
/** creates a bitmap font altas with an initial string and the FNT file
@warning: This interface will be deprecated in future.
*/
//static CCLabelBMFont * labelWithString(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero);
/** creates a bitmap font altas with an initial string and the FNT file */
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile);
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile, float width, CCTextAlignment alignment);
static CCLabelBMFont * labelWithString(const char *str, const char *fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset);
static CCLabelBMFont * create(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero);
bool init();
/** init a bitmap font altas with an initial string and the FNT file */
bool initWithString(const char *str, const char *fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset);
bool initWithString(const char *str, const char *fntFile, float width, CCTextAlignment alignment);
bool initWithString(const char *str, const char *fntFile);
bool initWithString(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero);
/** updates the font chars based on the string to render */
void createFontChars();
// super method

Просмотреть файл

@ -53,17 +53,32 @@ CCLabelTTF::~CCLabelTTF()
CC_SAFE_DELETE(m_pFontName);
}
CCLabelTTF * CCLabelTTF::labelWithString(const char *string, const char *fontName, float fontSize)
// CCLabelTTF * CCLabelTTF::labelWithString(const char *string, const char *fontName, float fontSize)
// {
// return CCLabelTTF::create(string, fontName, fontSize);
// }
CCLabelTTF * CCLabelTTF::create(const char *string, const char *fontName, float fontSize)
{
return labelWithString(string, CCSizeZero, kCCTextAlignmentCenter, kCCVerticalTextAlignmentTop, fontName, fontSize);
return CCLabelTTF::create(string, CCSizeZero, kCCTextAlignmentCenter, kCCVerticalTextAlignmentTop, fontName, fontSize);
}
CCLabelTTF * CCLabelTTF::labelWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment, const char *fontName, float fontSize)
// CCLabelTTF * CCLabelTTF::labelWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment, const char *fontName, float fontSize)
// {
// return CCLabelTTF::create(string, dimensions, hAlignment, kCCVerticalTextAlignmentTop, fontName, fontSize);
// }
CCLabelTTF * CCLabelTTF::create(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment, const char *fontName, float fontSize)
{
return labelWithString(string, dimensions, hAlignment, kCCVerticalTextAlignmentTop, fontName, fontSize);
return CCLabelTTF::create(string, dimensions, hAlignment, kCCVerticalTextAlignmentTop, fontName, fontSize);
}
CCLabelTTF* CCLabelTTF::labelWithString(const char *string, const cocos2d::CCSize &dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize)
// CCLabelTTF* CCLabelTTF::labelWithString(const char *string, const cocos2d::CCSize &dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize)
// {
// return CCLabelTTF::create(string, dimensions, hAlignment, vAlignment, fontName, fontSize);
// }
CCLabelTTF* CCLabelTTF::create(const char *string, const cocos2d::CCSize &dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize)
{
CCLabelTTF *pRet = new CCLabelTTF();
if(pRet && pRet->initWithString(string, dimensions, hAlignment, vAlignment, fontName, fontSize))

Просмотреть файл

@ -43,19 +43,37 @@ public:
virtual ~CCLabelTTF();
const char* description();
/** creates a CCLabelTTF with a font name and font size in points
@warning: This interface will be deprecated in future.
*/
//static CCLabelTTF * labelWithString(const char *string, const char *fontName, float fontSize);
/** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, and font size in points.
@warning: This interface will be deprecated in future.
@since v1.0
*/
//static CCLabelTTF * labelWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment,
// const char *fontName, float fontSize);
/** creates a CCLabel from a fontname, alignment, dimension in points and font size in points
@warning: This interface will be deprecated in future.
*/
//static CCLabelTTF * labelWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment,
// CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize);
/** creates a CCLabelTTF with a font name and font size in points*/
static CCLabelTTF * labelWithString(const char *string, const char *fontName, float fontSize);
static CCLabelTTF * create(const char *string, const char *fontName, float fontSize);
/** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, and font size in points.
@since v1.0
*/
static CCLabelTTF * labelWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment,
static CCLabelTTF * create(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment,
const char *fontName, float fontSize);
/** creates a CCLabel from a fontname, alignment, dimension in points and font size in points*/
static CCLabelTTF * labelWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment,
static CCLabelTTF * create(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment,
CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize);
/** initializes the CCLabelTTF with a font name, alignment, dimension and font size */
bool initWithString(const char *string, const CCSize& dimensions, CCTextAlignment hAlignment, const char *fontName, float fontSize);

Просмотреть файл

@ -73,7 +73,12 @@ bool CCLayer::init()
return bRet;
}
CCLayer *CCLayer::node()
// CCLayer *CCLayer::node()
// {
// return CCLayer::create();
// }
CCLayer *CCLayer::create()
{
CCLayer *pRet = new CCLayer();
if (pRet && pRet->init())
@ -421,8 +426,12 @@ void CCLayerColor::setBlendFunc(ccBlendFunc var)
m_tBlendFunc = var;
}
// CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color, GLfloat width, GLfloat height)
// {
// return CCLayerColor::create(color,width,height);
// }
CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color, GLfloat width, GLfloat height)
CCLayerColor * CCLayerColor::create(const ccColor4B& color, GLfloat width, GLfloat height)
{
CCLayerColor * pLayer = new CCLayerColor();
if( pLayer && pLayer->initWithColor(color,width,height))
@ -433,7 +442,13 @@ CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color, GLfloat widt
CC_SAFE_DELETE(pLayer);
return NULL;
}
CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color)
// CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color)
// {
// return CCLayerColor::create(color);
// }
CCLayerColor * CCLayerColor::create(const ccColor4B& color)
{
CCLayerColor * pLayer = new CCLayerColor();
if(pLayer && pLayer->initWithColor(color))
@ -543,7 +558,12 @@ void CCLayerColor::draw()
//
// CCLayerGradient
//
CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end)
// CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end)
// {
// return CCLayerGradient::create(start, end);
// }
CCLayerGradient* CCLayerGradient::create(const ccColor4B& start, const ccColor4B& end)
{
CCLayerGradient * pLayer = new CCLayerGradient();
if( pLayer && pLayer->initWithColor(start, end))
@ -555,7 +575,12 @@ CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const c
return NULL;
}
CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
// CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
// {
// return CCLayerGradient::create(start, end, v);
// }
CCLayerGradient* CCLayerGradient::create(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
{
CCLayerGradient * pLayer = new CCLayerGradient();
if( pLayer && pLayer->initWithColor(start, end, v))
@ -720,7 +745,24 @@ CCLayerMultiplex::~CCLayerMultiplex()
CC_SAFE_RELEASE(m_pLayers);
}
CCLayerMultiplex * CCLayerMultiplex::layerWithLayers(CCLayer * layer, ...)
// CCLayerMultiplex * CCLayerMultiplex::layerWithLayers(CCLayer * layer, ...)
// {
// va_list args;
// va_start(args,layer);
//
// CCLayerMultiplex * pMultiplexLayer = new CCLayerMultiplex();
// if(pMultiplexLayer && pMultiplexLayer->initWithLayers(layer, args))
// {
// pMultiplexLayer->autorelease();
// va_end(args);
// return pMultiplexLayer;
// }
// va_end(args);
// CC_SAFE_DELETE(pMultiplexLayer);
// return NULL;
// }
CCLayerMultiplex * CCLayerMultiplex::create(CCLayer * layer, ...)
{
va_list args;
va_start(args,layer);
@ -737,13 +779,19 @@ CCLayerMultiplex * CCLayerMultiplex::layerWithLayers(CCLayer * layer, ...)
return NULL;
}
CCLayerMultiplex * CCLayerMultiplex::layerWithLayer(CCLayer* layer)
// CCLayerMultiplex * CCLayerMultiplex::layerWithLayer(CCLayer* layer)
// {
// return CCLayerMultiplex::create(layer);
// }
CCLayerMultiplex * CCLayerMultiplex::create(CCLayer* layer)
{
CCLayerMultiplex * pMultiplexLayer = new CCLayerMultiplex();
pMultiplexLayer->initWithLayer(layer);
pMultiplexLayer->autorelease();
return pMultiplexLayer;
}
void CCLayerMultiplex::addLayer(CCLayer* layer)
{
CCAssert(m_pLayers, "");

Просмотреть файл

@ -53,7 +53,11 @@ public:
CCLayer();
virtual ~CCLayer();
bool init();
static CCLayer *node(void);
// @warning: This interface will be deprecated in future.
//static CCLayer *node(void);
/** create one layer */
static CCLayer *create(void);
virtual void onEnter();
virtual void onExit();
@ -115,25 +119,64 @@ private:
};
// for the subclass of CCLayer, each has to implement the static "node" method
#define LAYER_NODE_FUNC(layer) \
static layer* node() \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
};
// @warning: This interface will be deprecated in future.
//#define LAYER_NODE_FUNC(layer) \
// static layer* node() \
// { \
// layer *pRet = new layer(); \
// if (pRet && pRet->init()) \
// { \
// pRet->autorelease(); \
// return pRet; \
// } \
// else \
// { \
// delete pRet; \
// pRet = NULL; \
// return NULL; \
// } \
// }
#define LAYER_NODE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
static layer* node(__PARAMTYPE__ __PARAM__) \
// for the subclass of CCLayer, each has to implement the static "node" method
#define LAYER_CREATE_FUNC(layer) \
static layer* create() \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
// @warning: This interface will be deprecated in future.
//#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; \
// } \
// }
#define LAYER_CREATE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
static layer* create(__PARAMTYPE__ __PARAM__) \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init(__PARAM__)) \
@ -148,8 +191,6 @@ return NULL; \
return NULL; \
} \
}
//
// CCLayerColor
//
@ -173,10 +214,19 @@ public:
virtual void draw();
virtual void setContentSize(const CCSize& var);
/** creates a CCLayer with color, width and height in Points
@warning: This interface will be deprecated in future.
*/
//static CCLayerColor * layerWithColor(const ccColor4B& color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size.
@warning: This interface will be deprecated in future.
*/
//static CCLayerColor * layerWithColor(const ccColor4B& color);
/** creates a CCLayer with color, width and height in Points */
static CCLayerColor * layerWithColor(const ccColor4B& color, GLfloat width, GLfloat height);
static CCLayerColor * create(const ccColor4B& color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size. */
static CCLayerColor * layerWithColor(const ccColor4B& color);
static CCLayerColor * create(const ccColor4B& color);
virtual bool init();
/** initializes a CCLayer with color, width and height in Points */
@ -202,7 +252,7 @@ public:
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
LAYER_NODE_FUNC(CCLayerColor);
LAYER_CREATE_FUNC(CCLayerColor);
protected:
virtual void updateColor();
@ -234,11 +284,21 @@ If ' compressedInterpolation' is enabled (default mode) you will see both the st
class CC_DLL CCLayerGradient : public CCLayerColor
{
public:
/** Creates a full-screen CCLayer with a gradient between start and end.
@warning: This interface will be deprecated in future.
*/
//static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v.
@warning: This interface will be deprecated in future.
*/
//static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
/** Creates a full-screen CCLayer with a gradient between start and end. */
static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end);
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
/** Initializes the CCLayer with a gradient between start and end. */
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end);
@ -257,7 +317,7 @@ public:
*/
CC_PROPERTY(bool, m_bCompressedInterpolation, IsCompressedInterpolation)
LAYER_NODE_FUNC(CCLayerGradient);
LAYER_CREATE_FUNC(CCLayerGradient);
protected:
virtual void updateColor();
};
@ -277,14 +337,27 @@ public:
CCLayerMultiplex();
virtual ~CCLayerMultiplex();
/** creates a CCLayerMultiplex with one or more layers using a variable argument list.
@warning: This interface will be deprecated in future.
*/
//static CCLayerMultiplex * layerWithLayers(CCLayer* layer, ... );
/**
* lua script can not init with undetermined number of variables
* so add these functinons to be used with lua.
@warning: This interface will be deprecated in future.
*/
//static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
/** creates a CCLayerMultiplex with one or more layers using a variable argument list. */
static CCLayerMultiplex * layerWithLayers(CCLayer* layer, ... );
static CCLayerMultiplex * create(CCLayer* layer, ... );
/**
* lua script can not init with undetermined number of variables
* so add these functinons to be used with lua.
*/
static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
static CCLayerMultiplex * create(CCLayer* layer);
void addLayer(CCLayer* layer);
bool initWithLayer(CCLayer* layer);
@ -299,7 +372,7 @@ public:
*/
void switchToAndReleaseMe(unsigned int n);
LAYER_NODE_FUNC(CCLayerMultiplex);
LAYER_CREATE_FUNC(CCLayerMultiplex);
};
NS_CC_END

Просмотреть файл

@ -54,7 +54,12 @@ bool CCScene::init()
return bRet;
}
CCScene *CCScene::node()
// CCScene *CCScene::node()
// {
// return CCScene::create();
// }
CCScene *CCScene::create()
{
CCScene *pRet = new CCScene();
if (pRet && pRet->init())

Просмотреть файл

@ -47,14 +47,50 @@ public:
CCScene();
virtual ~CCScene();
bool init();
static CCScene *node(void);
//static CCScene *node(void);
static CCScene *create(void);
};
NS_CC_END
// for the subclass of CCScene, each has to implement the static "node" method
// @warning: This interface will be deprecated in future.
// #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; \
// } \
// };
// @warning: This interface will be deprecated in future.
// #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; \
// }
// for the subclass of CCScene, each has to implement the static "node" method
#define SCENE_NODE_FUNC(scene) \
static scene* node() \
#define SCENE_CREATE_FUNC(scene) \
static scene* create() \
{ \
scene *pRet = new scene(); \
if (pRet && pRet->init()) \
@ -70,20 +106,19 @@ static scene* node() \
} \
};
#define SCENE_FUNC_PARAM(__TYPE__,__PARAMTYPE__,__PARAM__) \
static cocos2d::CCScene* node(__PARAMTYPE__ __PARAM__) \
#define SCENE_CREATE_FUNC_PARAM(__TYPE__,__PARAMTYPE__,__PARAM__) \
static cocos2d::CCScene* create(__PARAMTYPE__ __PARAM__) \
{ \
cocos2d::CCScene * scene = NULL; \
do \
{ \
scene = cocos2d::CCScene::node(); \
scene = cocos2d::CCScene::create(); \
CC_BREAK_IF(! scene); \
__TYPE__ *layer = __TYPE__::node(__PARAM__); \
__TYPE__ *layer = __TYPE__::create(__PARAM__); \
CC_BREAK_IF(! layer); \
scene->addChild(layer); \
} while (0); \
return scene; \
}
#endif // __CCSCENE_H__

Просмотреть файл

@ -51,7 +51,12 @@ CCTransitionScene::~CCTransitionScene()
m_pOutScene->release();
}
CCTransitionScene * CCTransitionScene::transitionWithDuration(float t, CCScene *scene)
// CCTransitionScene * CCTransitionScene::transitionWithDuration(float t, CCScene *scene)
// {
// return CCTransitionScene::create(t,scene);
// }
CCTransitionScene * CCTransitionScene::create(float t, CCScene *scene)
{
CCTransitionScene * pScene = new CCTransitionScene();
if(pScene && pScene->initWithDuration(t,scene))
@ -77,7 +82,7 @@ bool CCTransitionScene::initWithDuration(float t, CCScene *scene)
m_pOutScene = CCDirector::sharedDirector()->getRunningScene();
if (m_pOutScene == NULL)
{
m_pOutScene = CCScene::node();
m_pOutScene = CCScene::create();
m_pOutScene->init();
}
m_pOutScene->retain();
@ -190,14 +195,21 @@ void CCTransitionScene::cleanup()
//
// Oriented Transition
//
CCTransitionSceneOriented::CCTransitionSceneOriented()
{
}
CCTransitionSceneOriented::~CCTransitionSceneOriented()
{
}
CCTransitionSceneOriented * CCTransitionSceneOriented::transitionWithDuration(float t, CCScene *scene, tOrientation orientation)
// CCTransitionSceneOriented * CCTransitionSceneOriented::transitionWithDuration(float t, CCScene *scene, tOrientation orientation)
// {
// return CCTransitionSceneOriented::create(t,scene,orientation);
// }
CCTransitionSceneOriented * CCTransitionSceneOriented::create(float t, CCScene *scene, tOrientation orientation)
{
CCTransitionSceneOriented * pScene = new CCTransitionSceneOriented();
pScene->initWithDuration(t,scene,orientation);
@ -220,6 +232,7 @@ bool CCTransitionSceneOriented::initWithDuration(float t, CCScene *scene, tOrien
CCTransitionRotoZoom::CCTransitionRotoZoom()
{
}
CCTransitionRotoZoom::~CCTransitionRotoZoom()
{
}
@ -234,33 +247,30 @@ void CCTransitionRotoZoom:: onEnter()
m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f));
m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f));
CCActionInterval *rotozoom = (CCActionInterval*)(CCSequence::actions
CCActionInterval *rotozoom = (CCActionInterval*)(CCSequence::create
(
CCSpawn::actions
CCSpawn::create
(
CCScaleBy::actionWithDuration(m_fDuration/2, 0.001f),
CCRotateBy::actionWithDuration(m_fDuration/2, 360 * 2),
CCScaleBy::create(m_fDuration/2, 0.001f),
CCRotateBy::create(m_fDuration/2, 360 * 2),
NULL
),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCDelayTime::create(m_fDuration/2),
NULL
));
m_pOutScene->runAction(rotozoom);
m_pInScene->runAction
(
CCSequence::actions
CCSequence::create
(
rotozoom->reverse(),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
)
);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionRotoZoom)
//
// JumpZoom
//
@ -281,36 +291,35 @@ void CCTransitionJumpZoom::onEnter()
m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f));
m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f));
CCActionInterval *jump = CCJumpBy::actionWithDuration(m_fDuration/4, ccp(-s.width,0), s.width/4, 2);
CCActionInterval *scaleIn = CCScaleTo::actionWithDuration(m_fDuration/4, 1.0f);
CCActionInterval *scaleOut = CCScaleTo::actionWithDuration(m_fDuration/4, 0.5f);
CCActionInterval *jump = CCJumpBy::create(m_fDuration/4, ccp(-s.width,0), s.width/4, 2);
CCActionInterval *scaleIn = CCScaleTo::create(m_fDuration/4, 1.0f);
CCActionInterval *scaleOut = CCScaleTo::create(m_fDuration/4, 0.5f);
CCActionInterval *jumpZoomOut = (CCActionInterval*)(CCSequence::actions(scaleOut, jump, NULL));
CCActionInterval *jumpZoomIn = (CCActionInterval*)(CCSequence::actions(jump, scaleIn, NULL));
CCActionInterval *jumpZoomOut = (CCActionInterval*)(CCSequence::create(scaleOut, jump, NULL));
CCActionInterval *jumpZoomIn = (CCActionInterval*)(CCSequence::create(jump, scaleIn, NULL));
CCActionInterval *delay = CCDelayTime::actionWithDuration(m_fDuration/2);
CCActionInterval *delay = CCDelayTime::create(m_fDuration/2);
m_pOutScene->runAction(jumpZoomOut);
m_pInScene->runAction
(
CCSequence::actions
CCSequence::create
(
delay,
jumpZoomIn,
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
)
);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionJumpZoom)
//
// MoveInL
//
CCTransitionMoveInL::CCTransitionMoveInL()
{
}
CCTransitionMoveInL::~CCTransitionMoveInL()
{
}
@ -324,10 +333,10 @@ void CCTransitionMoveInL::onEnter()
m_pInScene->runAction
(
CCSequence::actions
CCSequence::create
(
this->easeActionWithAction(a),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
)
);
@ -335,12 +344,12 @@ void CCTransitionMoveInL::onEnter()
CCActionInterval* CCTransitionMoveInL::action()
{
return CCMoveTo::actionWithDuration(m_fDuration, ccp(0,0));
return CCMoveTo::create(m_fDuration, ccp(0,0));
}
CCActionInterval* CCTransitionMoveInL::easeActionWithAction(CCActionInterval* action)
{
return CCEaseOut::actionWithAction(action, 2.0f);
return CCEaseOut::create(action, 2.0f);
// return [EaseElasticOut actionWithAction:action period:0.4f];
}
@ -350,8 +359,6 @@ void CCTransitionMoveInL::initScenes()
m_pInScene->setPosition( ccp(-s.width,0) );
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInL)
//
// MoveInR
//
@ -368,8 +375,6 @@ void CCTransitionMoveInR::initScenes()
m_pInScene->setPosition( ccp(s.width,0) );
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInR)
//
// MoveInT
//
@ -386,8 +391,6 @@ void CCTransitionMoveInT::initScenes()
m_pInScene->setPosition( ccp(0,s.height) );
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInT)
//
// MoveInB
//
@ -404,8 +407,6 @@ void CCTransitionMoveInB::initScenes()
m_pInScene->setPosition( ccp(0,-s.height) );
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionMoveInB)
//
// SlideInL
@ -432,10 +433,10 @@ void CCTransitionSlideInL::onEnter()
CCActionInterval *out = this->action();
CCActionInterval* inAction = easeActionWithAction(in);
CCActionInterval* outAction = (CCActionInterval*)CCSequence::actions
CCActionInterval* outAction = (CCActionInterval*)CCSequence::create
(
easeActionWithAction(out),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
m_pInScene->runAction(inAction);
@ -456,17 +457,15 @@ void CCTransitionSlideInL:: initScenes()
CCActionInterval* CCTransitionSlideInL::action()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
return CCMoveBy::actionWithDuration(m_fDuration, ccp(s.width-ADJUST_FACTOR,0));
return CCMoveBy::create(m_fDuration, ccp(s.width-ADJUST_FACTOR,0));
}
CCActionInterval* CCTransitionSlideInL::easeActionWithAction(CCActionInterval* action)
{
return CCEaseOut::actionWithAction(action, 2.0f);
return CCEaseOut::create(action, 2.0f);
// return [EaseElasticOut actionWithAction:action period:0.4f];
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInL)
//
// SlideInR
@ -493,11 +492,9 @@ void CCTransitionSlideInR::initScenes()
CCActionInterval* CCTransitionSlideInR:: action()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
return CCMoveBy::actionWithDuration(m_fDuration, ccp(-(s.width-ADJUST_FACTOR),0));
return CCMoveBy::create(m_fDuration, ccp(-(s.width-ADJUST_FACTOR),0));
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInR)
//
// SlideInT
@ -524,11 +521,9 @@ void CCTransitionSlideInT::initScenes()
CCActionInterval* CCTransitionSlideInT::action()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
return CCMoveBy::actionWithDuration(m_fDuration, ccp(0,-(s.height-ADJUST_FACTOR)));
return CCMoveBy::create(m_fDuration, ccp(0,-(s.height-ADJUST_FACTOR)));
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInT)
//
// SlideInB
//
@ -554,11 +549,9 @@ void CCTransitionSlideInB:: initScenes()
CCActionInterval* CCTransitionSlideInB:: action()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
return CCMoveBy::actionWithDuration(m_fDuration, ccp(0,s.height-ADJUST_FACTOR));
return CCMoveBy::create(m_fDuration, ccp(0,s.height-ADJUST_FACTOR));
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSlideInB)
//
// ShrinkGrow Transition
//
@ -579,28 +572,26 @@ void CCTransitionShrinkGrow::onEnter()
m_pInScene->setAnchorPoint(ccp(2/3.0f,0.5f));
m_pOutScene->setAnchorPoint(ccp(1/3.0f,0.5f));
CCActionInterval* scaleOut = CCScaleTo::actionWithDuration(m_fDuration, 0.01f);
CCActionInterval* scaleIn = CCScaleTo::actionWithDuration(m_fDuration, 1.0f);
CCActionInterval* scaleOut = CCScaleTo::create(m_fDuration, 0.01f);
CCActionInterval* scaleIn = CCScaleTo::create(m_fDuration, 1.0f);
m_pInScene->runAction(this->easeActionWithAction(scaleIn));
m_pOutScene->runAction
(
CCSequence::actions
CCSequence::create
(
this->easeActionWithAction(scaleOut),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
)
);
}
CCActionInterval* CCTransitionShrinkGrow:: easeActionWithAction(CCActionInterval* action)
{
return CCEaseOut::actionWithAction(action, 2.0f);
return CCEaseOut::create(action, 2.0f);
// return [EaseElasticOut actionWithAction:action period:0.3f];
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionShrinkGrow)
//
// FlipX Transition
//
@ -636,20 +627,20 @@ void CCTransitionFlipX::onEnter()
outAngleZ = 0;
}
inA = (CCActionInterval*)CCSequence::actions
inA = (CCActionInterval*)CCSequence::create
(
CCDelayTime::actionWithDuration(m_fDuration/2),
CCShow::action(),
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCDelayTime::create(m_fDuration/2),
CCShow::create(),
CCOrbitCamera::create(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
outA = (CCActionInterval *)CCSequence::actions
outA = (CCActionInterval *)CCSequence::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
CCHide::action(),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCOrbitCamera::create(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
CCHide::create(),
CCDelayTime::create(m_fDuration/2),
NULL
);
@ -657,7 +648,12 @@ void CCTransitionFlipX::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionFlipX* CCTransitionFlipX::transitionWithDuration(float t, CCScene* s, tOrientation o)
// CCTransitionFlipX* CCTransitionFlipX::transitionWithDuration(float t, CCScene* s, tOrientation o)
// {
// return CCTransitionFlipX::create(t, s, o);
// }
CCTransitionFlipX* CCTransitionFlipX::create(float t, CCScene* s, tOrientation o)
{
CCTransitionFlipX* pScene = new CCTransitionFlipX();
pScene->initWithDuration(t, s, o);
@ -701,19 +697,19 @@ void CCTransitionFlipY::onEnter()
outAngleZ = 0;
}
inA = (CCActionInterval*)CCSequence::actions
inA = (CCActionInterval*)CCSequence::create
(
CCDelayTime::actionWithDuration(m_fDuration/2),
CCShow::action(),
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCDelayTime::create(m_fDuration/2),
CCShow::create(),
CCOrbitCamera::create(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
outA = (CCActionInterval*)CCSequence::actions
outA = (CCActionInterval*)CCSequence::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
CCHide::action(),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCOrbitCamera::create(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
CCHide::create(),
CCDelayTime::create(m_fDuration/2),
NULL
);
@ -722,7 +718,12 @@ void CCTransitionFlipY::onEnter()
}
CCTransitionFlipY* CCTransitionFlipY::transitionWithDuration(float t, CCScene* s, tOrientation o)
// CCTransitionFlipY* CCTransitionFlipY::transitionWithDuration(float t, CCScene* s, tOrientation o)
// {
// return CCTransitionFlipY::create(t, s, o);
// }
CCTransitionFlipY* CCTransitionFlipY::create(float t, CCScene* s, tOrientation o)
{
CCTransitionFlipY* pScene = new CCTransitionFlipY();
pScene->initWithDuration(t, s, o);
@ -737,6 +738,7 @@ CCTransitionFlipY* CCTransitionFlipY::transitionWithDuration(float t, CCScene* s
CCTransitionFlipAngular::CCTransitionFlipAngular()
{
}
CCTransitionFlipAngular::~CCTransitionFlipAngular()
{
}
@ -766,19 +768,19 @@ void CCTransitionFlipAngular::onEnter()
outAngleZ = 0;
}
inA = (CCActionInterval *)CCSequence::actions
inA = (CCActionInterval *)CCSequence::create
(
CCDelayTime::actionWithDuration(m_fDuration/2),
CCShow::action(),
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCDelayTime::create(m_fDuration/2),
CCShow::create(),
CCOrbitCamera::create(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
outA = (CCActionInterval *)CCSequence::actions
outA = (CCActionInterval *)CCSequence::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 45, 0),
CCHide::action(),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCOrbitCamera::create(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 45, 0),
CCHide::create(),
CCDelayTime::create(m_fDuration/2),
NULL
);
@ -786,7 +788,12 @@ void CCTransitionFlipAngular::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionFlipAngular* CCTransitionFlipAngular::transitionWithDuration(float t, CCScene* s, tOrientation o)
// CCTransitionFlipAngular* CCTransitionFlipAngular::transitionWithDuration(float t, CCScene* s, tOrientation o)
// {
// return CCTransitionFlipAngular::create(t, s, o);
// }
CCTransitionFlipAngular* CCTransitionFlipAngular::create(float t, CCScene* s, tOrientation o)
{
CCTransitionFlipAngular* pScene = new CCTransitionFlipAngular();
pScene->initWithDuration(t, s, o);
@ -828,29 +835,29 @@ void CCTransitionZoomFlipX::onEnter()
outDeltaZ = -90;
outAngleZ = 0;
}
inA = (CCActionInterval *)CCSequence::actions
inA = (CCActionInterval *)CCSequence::create
(
CCDelayTime::actionWithDuration(m_fDuration/2),
CCSpawn::actions
CCDelayTime::create(m_fDuration/2),
CCSpawn::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
CCScaleTo::actionWithDuration(m_fDuration/2, 1),
CCShow::action(),
CCOrbitCamera::create(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
CCScaleTo::create(m_fDuration/2, 1),
CCShow::create(),
NULL
),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
outA = (CCActionInterval *)CCSequence::actions
outA = (CCActionInterval *)CCSequence::create
(
CCSpawn::actions
CCSpawn::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
CCScaleTo::actionWithDuration(m_fDuration/2, 0.5f),
CCOrbitCamera::create(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
CCScaleTo::create(m_fDuration/2, 0.5f),
NULL
),
CCHide::action(),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCHide::create(),
CCDelayTime::create(m_fDuration/2),
NULL
);
@ -859,7 +866,12 @@ void CCTransitionZoomFlipX::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionZoomFlipX* CCTransitionZoomFlipX::transitionWithDuration(float t, CCScene* s, tOrientation o)
// CCTransitionZoomFlipX* CCTransitionZoomFlipX::transitionWithDuration(float t, CCScene* s, tOrientation o)
// {
// return CCTransitionZoomFlipX::create(t, s, o);
// }
CCTransitionZoomFlipX* CCTransitionZoomFlipX::create(float t, CCScene* s, tOrientation o)
{
CCTransitionZoomFlipX* pScene = new CCTransitionZoomFlipX();
pScene->initWithDuration(t, s, o);
@ -874,6 +886,7 @@ CCTransitionZoomFlipX* CCTransitionZoomFlipX::transitionWithDuration(float t, CC
CCTransitionZoomFlipY::CCTransitionZoomFlipY()
{
}
CCTransitionZoomFlipY::~CCTransitionZoomFlipY()
{
}
@ -900,30 +913,30 @@ void CCTransitionZoomFlipY::onEnter()
outAngleZ = 0;
}
inA = (CCActionInterval *)CCSequence::actions
inA = (CCActionInterval *)CCSequence::create
(
CCDelayTime::actionWithDuration(m_fDuration/2),
CCSpawn::actions
CCDelayTime::create(m_fDuration/2),
CCSpawn::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
CCScaleTo::actionWithDuration(m_fDuration/2, 1),
CCShow::action(),
CCOrbitCamera::create(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
CCScaleTo::create(m_fDuration/2, 1),
CCShow::create(),
NULL
),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
outA = (CCActionInterval *)CCSequence::actions
outA = (CCActionInterval *)CCSequence::create
(
CCSpawn::actions
CCSpawn::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
CCScaleTo::actionWithDuration(m_fDuration/2, 0.5f),
CCOrbitCamera::create(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
CCScaleTo::create(m_fDuration/2, 0.5f),
NULL
),
CCHide::action(),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCHide::create(),
CCDelayTime::create(m_fDuration/2),
NULL
);
@ -932,7 +945,12 @@ void CCTransitionZoomFlipY::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionZoomFlipY* CCTransitionZoomFlipY::transitionWithDuration(float t, CCScene* s, tOrientation o)
// CCTransitionZoomFlipY* CCTransitionZoomFlipY::transitionWithDuration(float t, CCScene* s, tOrientation o)
// {
// return CCTransitionZoomFlipY::create(t, s, o);
// }
CCTransitionZoomFlipY* CCTransitionZoomFlipY::create(float t, CCScene* s, tOrientation o)
{
CCTransitionZoomFlipY* pScene = new CCTransitionZoomFlipY();
pScene->initWithDuration(t, s, o);
@ -976,30 +994,30 @@ void CCTransitionZoomFlipAngular::onEnter()
outAngleZ = 0;
}
inA = (CCActionInterval *)CCSequence::actions
inA = (CCActionInterval *)CCSequence::create
(
CCDelayTime::actionWithDuration(m_fDuration/2),
CCSpawn::actions
CCDelayTime::create(m_fDuration/2),
CCSpawn::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
CCScaleTo::actionWithDuration(m_fDuration/2, 1),
CCShow::action(),
CCOrbitCamera::create(m_fDuration/2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
CCScaleTo::create(m_fDuration/2, 1),
CCShow::create(),
NULL
),
CCShow::action(),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCShow::create(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
outA = (CCActionInterval *)CCSequence::actions
outA = (CCActionInterval *)CCSequence::create
(
CCSpawn::actions
CCSpawn::create
(
CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0 , outAngleZ, outDeltaZ, 45, 0),
CCScaleTo::actionWithDuration(m_fDuration/2, 0.5f),
CCOrbitCamera::create(m_fDuration/2, 1, 0 , outAngleZ, outDeltaZ, 45, 0),
CCScaleTo::create(m_fDuration/2, 0.5f),
NULL
),
CCHide::action(),
CCDelayTime::actionWithDuration(m_fDuration/2),
CCHide::create(),
CCDelayTime::create(m_fDuration/2),
NULL
);
@ -1008,7 +1026,12 @@ void CCTransitionZoomFlipAngular::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::transitionWithDuration(float t, CCScene* s, tOrientation o)
// CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::transitionWithDuration(float t, CCScene* s, tOrientation o)
// {
// return CCTransitionZoomFlipAngular::create(t, s, o);
// }
CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::create(float t, CCScene* s, tOrientation o)
{
CCTransitionZoomFlipAngular* pScene = new CCTransitionZoomFlipAngular();
pScene->initWithDuration(t, s, o);
@ -1027,8 +1050,12 @@ CCTransitionFade::~CCTransitionFade()
{
}
// CCTransitionFade * CCTransitionFade::transitionWithDuration(float duration, CCScene *scene, const ccColor3B& color)
// {
// return CCTransitionFade::create(duration, scene, color);
// }
CCTransitionFade * CCTransitionFade::transitionWithDuration(float duration, CCScene *scene, const ccColor3B& color)
CCTransitionFade * CCTransitionFade::create(float duration, CCScene *scene, const ccColor3B& color)
{
CCTransitionFade * pTransition = new CCTransitionFade();
pTransition->initWithDuration(duration, scene, color);
@ -1058,18 +1085,18 @@ void CCTransitionFade :: onEnter()
{
CCTransitionScene::onEnter();
CCLayerColor* l = CCLayerColor::layerWithColor(m_tColor);
CCLayerColor* l = CCLayerColor::create(m_tColor);
m_pInScene->setIsVisible(false);
addChild(l, 2, kSceneFade);
CCNode* f = getChildByTag(kSceneFade);
CCActionInterval* a = (CCActionInterval *)CCSequence::actions
CCActionInterval* a = (CCActionInterval *)CCSequence::create
(
CCFadeIn::actionWithDuration(m_fDuration/2),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),//CCCallFunc::actionWithTarget:self selector:@selector(hideOutShowIn)],
CCFadeOut::actionWithDuration(m_fDuration/2),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), //:self selector:@selector(finish)],
CCFadeIn::create(m_fDuration/2),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),//CCCallFunc::create:self selector:@selector(hideOutShowIn)],
CCFadeOut::create(m_fDuration/2),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)), //:self selector:@selector(finish)],
NULL
);
f->runAction(a);
@ -1105,10 +1132,10 @@ void CCTransitionCrossFade::onEnter()
// in which we are going to add our rendertextures
ccColor4B color = {0,0,0,0};
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCLayerColor* layer = CCLayerColor::layerWithColor(color);
CCLayerColor* layer = CCLayerColor::create(color);
// create the first render texture for inScene
CCRenderTexture* inTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
CCRenderTexture* inTexture = CCRenderTexture::create((int)size.width, (int)size.height);
if (NULL == inTexture)
{
@ -1125,7 +1152,7 @@ void CCTransitionCrossFade::onEnter()
inTexture->end();
// create the second render texture for outScene
CCRenderTexture* outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
CCRenderTexture* outTexture = CCRenderTexture::create((int)size.width, (int)size.height);
outTexture->getSprite()->setAnchorPoint( ccp(0.5f,0.5f) );
outTexture->setPosition( ccp(size.width/2, size.height/2) );
outTexture->setAnchorPoint( ccp(0.5f,0.5f) );
@ -1153,11 +1180,11 @@ void CCTransitionCrossFade::onEnter()
outTexture->getSprite()->setOpacity(255);
// create the blend action
CCAction* layerAction = CCSequence::actions
CCAction* layerAction = CCSequence::create
(
CCFadeTo::actionWithDuration(m_fDuration, 0),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCFadeTo::create(m_fDuration, 0),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
);
@ -1177,21 +1204,13 @@ void CCTransitionCrossFade::onExit()
CCTransitionScene::onExit();
}
CCTransitionCrossFade* CCTransitionCrossFade::transitionWithDuration(float d, CCScene* s)
{
CCTransitionCrossFade* Transition = new CCTransitionCrossFade();
Transition->initWithDuration(d, s);
Transition->autorelease();
return Transition;
}
//
// TurnOffTilesTransition
//
CCTransitionTurnOffTiles::CCTransitionTurnOffTiles()
{
}
CCTransitionTurnOffTiles::~CCTransitionTurnOffTiles()
{
}
@ -1211,15 +1230,15 @@ void CCTransitionTurnOffTiles::onEnter()
int x = (int)(12 * aspect);
int y = 12;
CCTurnOffTiles* toff = CCTurnOffTiles::actionWithSize( ccg(x,y), m_fDuration);
CCTurnOffTiles* toff = CCTurnOffTiles::create( ccg(x,y), m_fDuration);
CCActionInterval* action = easeActionWithAction(toff);
m_pOutScene->runAction
(
CCSequence::actions
CCSequence::create
(
action,
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::action(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
@ -1231,8 +1250,6 @@ CCActionInterval* CCTransitionTurnOffTiles:: easeActionWithAction(CCActionInterv
return action;
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionTurnOffTiles)
//
// SplitCols Transition
//
@ -1250,21 +1267,21 @@ void CCTransitionSplitCols::onEnter()
m_pInScene->setIsVisible(false);
CCActionInterval* split = action();
CCActionInterval* seq = (CCActionInterval*)CCSequence::actions
CCActionInterval* seq = (CCActionInterval*)CCSequence::create
(
split,
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),
split->reverse(),
NULL
);
this->runAction
(
CCSequence::actions
CCSequence::create
(
easeActionWithAction(seq),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::action(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
@ -1273,17 +1290,15 @@ void CCTransitionSplitCols::onEnter()
CCActionInterval* CCTransitionSplitCols:: action()
{
return CCSplitCols::actionWithCols(3, m_fDuration/2.0f);
return CCSplitCols::create(3, m_fDuration/2.0f);
}
CCActionInterval* CCTransitionSplitCols::easeActionWithAction(CCActionInterval * action)
{
return CCEaseInOut::actionWithAction(action, 3.0f);
return CCEaseInOut::create(action, 3.0f);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSplitCols)
//
// SplitRows Transition
@ -1298,11 +1313,9 @@ CCTransitionSplitRows::~CCTransitionSplitRows()
CCActionInterval* CCTransitionSplitRows::action()
{
return CCSplitRows::actionWithRows(3, m_fDuration/2.0f);
return CCSplitRows::create(3, m_fDuration/2.0f);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionSplitRows)
//
// FadeTR Transition
//
@ -1332,11 +1345,11 @@ void CCTransitionFadeTR::onEnter()
m_pOutScene->runAction
(
CCSequence::actions
CCSequence::create
(
easeActionWithAction(action),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::action(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
@ -1345,7 +1358,7 @@ void CCTransitionFadeTR::onEnter()
CCActionInterval* CCTransitionFadeTR::actionWithSize(const ccGridSize& size)
{
return CCFadeOutTRTiles::actionWithSize(size, m_fDuration);
return CCFadeOutTRTiles::create(size, m_fDuration);
}
CCActionInterval* CCTransitionFadeTR:: easeActionWithAction(CCActionInterval* action)
@ -1353,8 +1366,6 @@ CCActionInterval* CCTransitionFadeTR:: easeActionWithAction(CCActionInterval* ac
return action;
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeTR)
//
// FadeBL Transition
@ -1369,11 +1380,9 @@ CCTransitionFadeBL::~CCTransitionFadeBL()
CCActionInterval* CCTransitionFadeBL::actionWithSize(const ccGridSize& size)
{
return CCFadeOutBLTiles::actionWithSize(size, m_fDuration);
return CCFadeOutBLTiles::create(size, m_fDuration);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeBL)
//
// FadeUp Transition
//
@ -1386,11 +1395,9 @@ CCTransitionFadeUp::~CCTransitionFadeUp()
CCActionInterval* CCTransitionFadeUp::actionWithSize(const ccGridSize& size)
{
return CCFadeOutUpTiles::actionWithSize(size, m_fDuration);
return CCFadeOutUpTiles::create(size, m_fDuration);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeUp)
//
// FadeDown Transition
//
@ -1403,9 +1410,7 @@ CCTransitionFadeDown::~CCTransitionFadeDown()
CCActionInterval* CCTransitionFadeDown::actionWithSize(const ccGridSize& size)
{
return CCFadeOutDownTiles::actionWithSize(size, m_fDuration);
return CCFadeOutDownTiles::create(size, m_fDuration);
}
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionFadeDown)
NS_CC_END

Просмотреть файл

@ -35,20 +35,47 @@ NS_CC_BEGIN
//static creation function macro
//c/c++ don't support object creation of using class name
//so, all classes need creation method.
#define DECLEAR_TRANSITIONWITHDURATION(_Type)\
static _Type* transitionWithDuration(float t, CCScene* scene);
#define IMPLEMENT_TRANSITIONWITHDURATION(_Type)\
_Type* _Type::transitionWithDuration(float t, CCScene* scene)\
{\
_Type* pScene = new _Type();\
if(pScene && pScene->initWithDuration(t, scene)){\
pScene->autorelease();\
return pScene;}\
CC_SAFE_DELETE(pScene);\
return NULL;\
}
// @warning: This interface will be deprecated in future.
// #define DECLEAR_TRANSITIONWITHDURATION(_Type)\
// static _Type* transitionWithDuration(float t, CCScene* scene);
//
// #define IMPLEMENT_TRANSITIONWITHDURATION(_Type)\
// _Type* _Type::transitionWithDuration(float t, CCScene* scene)\
// {\
// _Type* pScene = new _Type();\
// if(pScene && pScene->initWithDuration(t, scene)){\
// pScene->autorelease();\
// return pScene;}\
// CC_SAFE_DELETE(pScene);\
// return NULL;\
//
#define OLD_TRANSITION_CREATE_FUNC(_Type) \
static _Type* transitionWithDuration(float t, CCScene* scene) \
{ \
_Type* pScene = new _Type(); \
if(pScene && pScene->initWithDuration(t, scene)) \
{ \
pScene->autorelease(); \
return pScene; \
} \
CC_SAFE_DELETE(pScene); \
return NULL; \
}
#define TRANSITION_CREATE_FUNC(_Type) \
static _Type* create(float t, CCScene* scene) \
{ \
_Type* pScene = new _Type(); \
if(pScene && pScene->initWithDuration(t, scene)) \
{ \
pScene->autorelease(); \
return pScene; \
} \
CC_SAFE_DELETE(pScene); \
return NULL; \
}
class CCActionInterval;
class CCNode;
@ -99,8 +126,13 @@ public:
virtual void onExit();
virtual void cleanup();
/** creates a base transition with duration and incoming scene
@warning: This interface will be deprecated in future.
*/
//static CCTransitionScene * transitionWithDuration(float t, CCScene *scene);
/** creates a base transition with duration and incoming scene */
static CCTransitionScene * transitionWithDuration(float t, CCScene *scene);
static CCTransitionScene * create(float t, CCScene *scene);
/** initializes a transition with duration and incoming scene */
virtual bool initWithDuration(float t,CCScene* scene);
@ -130,8 +162,14 @@ public:
CCTransitionSceneOriented();
virtual ~CCTransitionSceneOriented();
/** creates a base transition with duration and incoming scene
@warning: This interface will be deprecated in future.
*/
// static CCTransitionSceneOriented * transitionWithDuration(float t,CCScene* scene, tOrientation orientation);
/** creates a base transition with duration and incoming scene */
static CCTransitionSceneOriented * transitionWithDuration(float t,CCScene* scene, tOrientation orientation);
static CCTransitionSceneOriented * create(float t,CCScene* scene, tOrientation orientation);
/** initializes a transition with duration and incoming scene */
virtual bool initWithDuration(float t,CCScene* scene,tOrientation orientation);
};
@ -146,7 +184,8 @@ public:
virtual ~CCTransitionRotoZoom();
virtual void onEnter();
DECLEAR_TRANSITIONWITHDURATION(CCTransitionRotoZoom);
TRANSITION_CREATE_FUNC(CCTransitionRotoZoom);
OLD_TRANSITION_CREATE_FUNC(CCTransitionRotoZoom);
};
/** @brief CCTransitionJumpZoom:
@ -159,7 +198,8 @@ public:
virtual ~CCTransitionJumpZoom();
virtual void onEnter();
DECLEAR_TRANSITIONWITHDURATION(CCTransitionJumpZoom);
TRANSITION_CREATE_FUNC(CCTransitionJumpZoom);
OLD_TRANSITION_CREATE_FUNC(CCTransitionJumpZoom);
};
/** @brief CCTransitionMoveInL:
@ -179,7 +219,8 @@ public:
virtual void onEnter();
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInL);
TRANSITION_CREATE_FUNC(CCTransitionMoveInL);
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInL);
};
/** @brief CCTransitionMoveInR:
@ -192,7 +233,8 @@ public:
virtual ~CCTransitionMoveInR();
virtual void initScenes();
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInR);
TRANSITION_CREATE_FUNC(CCTransitionMoveInR);
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInR);
};
/** @brief CCTransitionMoveInT:
@ -205,7 +247,8 @@ public:
virtual ~CCTransitionMoveInT();
virtual void initScenes();
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInT);
TRANSITION_CREATE_FUNC(CCTransitionMoveInT);
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInT);
};
/** @brief CCTransitionMoveInB:
@ -218,7 +261,8 @@ public:
virtual ~CCTransitionMoveInB();
virtual void initScenes();
DECLEAR_TRANSITIONWITHDURATION(CCTransitionMoveInB);
TRANSITION_CREATE_FUNC(CCTransitionMoveInB);
OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInB);
};
/** @brief CCTransitionSlideInL:
@ -239,7 +283,8 @@ public:
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInL);
TRANSITION_CREATE_FUNC(CCTransitionSlideInL);
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInL);
protected:
virtual void sceneOrder();
};
@ -258,7 +303,8 @@ public:
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCActionInterval* action(void);
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInR);
TRANSITION_CREATE_FUNC(CCTransitionSlideInR);
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInR);
protected:
virtual void sceneOrder();
};
@ -277,7 +323,8 @@ public:
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCActionInterval* action(void);
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInB);
TRANSITION_CREATE_FUNC(CCTransitionSlideInB);
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInB);
protected:
virtual void sceneOrder();
};
@ -296,7 +343,8 @@ public:
/** returns the action that will be performed by the incomming and outgoing scene */
virtual CCActionInterval* action(void);
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSlideInT);
TRANSITION_CREATE_FUNC(CCTransitionSlideInT);
OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInT);
protected:
virtual void sceneOrder();
};
@ -313,7 +361,8 @@ public:
virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
DECLEAR_TRANSITIONWITHDURATION(CCTransitionShrinkGrow);
TRANSITION_CREATE_FUNC(CCTransitionShrinkGrow);
OLD_TRANSITION_CREATE_FUNC(CCTransitionShrinkGrow);
};
/** @brief CCTransitionFlipX:
@ -328,7 +377,9 @@ public:
virtual void onEnter();
static CCTransitionFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
// @warning: This interface will be deprecated in future.
//static CCTransitionFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionFlipX* create(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionFlipY:
@ -343,7 +394,9 @@ public:
virtual void onEnter();
static CCTransitionFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver);
//@warning: This interface will be deprecated in future.
//static CCTransitionFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver);
static CCTransitionFlipY* create(float t, CCScene* s, tOrientation o = kOrientationUpOver);
};
/** @brief CCTransitionFlipAngular:
@ -358,7 +411,9 @@ public:
virtual void onEnter();
static CCTransitionFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
//@warning: This interface will be deprecated in future.
//static CCTransitionFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionFlipAngular* create(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionZoomFlipX:
@ -373,7 +428,9 @@ public:
virtual void onEnter();
static CCTransitionZoomFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
//@warning: This interface will be deprecated in future.
//static CCTransitionZoomFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionZoomFlipX* create(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionZoomFlipY:
@ -388,7 +445,9 @@ public:
virtual void onEnter();
static CCTransitionZoomFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver);
//@warning: This interface will be deprecated in future.
//static CCTransitionZoomFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver);
static CCTransitionZoomFlipY* create(float t, CCScene* s, tOrientation o = kOrientationUpOver);
};
/** @brief CCTransitionZoomFlipAngular:
@ -403,7 +462,9 @@ public:
virtual void onEnter();
static CCTransitionZoomFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
//@warning: This interface will be deprecated in future.
//static CCTransitionZoomFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionZoomFlipAngular* create(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionFade:
@ -421,8 +482,15 @@ public:
/** creates the transition with a duration and with an RGB color
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
@warning: This interface will be deprecated in future.
*/
static CCTransitionFade* transitionWithDuration(float duration,CCScene* scene, const ccColor3B& color = ccBLACK);
//static CCTransitionFade* transitionWithDuration(float duration,CCScene* scene, const ccColor3B& color = ccBLACK);
/** creates the transition with a duration and with an RGB color
* Example: FadeTransition::create(2, scene, ccc3(255,0,0); // red color
*/
static CCTransitionFade* create(float duration,CCScene* scene, const ccColor3B& color = ccBLACK);
/** initializes the transition with a duration and with an RGB color */
virtual bool initWithDuration(float t, CCScene*scene ,const ccColor3B& color);
@ -447,7 +515,8 @@ public :
virtual void onExit();
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionCrossFade);
TRANSITION_CREATE_FUNC(CCTransitionCrossFade);
OLD_TRANSITION_CREATE_FUNC(CCTransitionCrossFade);
};
/** @brief CCTransitionTurnOffTiles:
@ -463,7 +532,8 @@ public :
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionTurnOffTiles);
TRANSITION_CREATE_FUNC(CCTransitionTurnOffTiles);
OLD_TRANSITION_CREATE_FUNC(CCTransitionTurnOffTiles);
protected:
virtual void sceneOrder();
};
@ -482,7 +552,8 @@ public:
virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSplitCols);
TRANSITION_CREATE_FUNC(CCTransitionSplitCols);
OLD_TRANSITION_CREATE_FUNC(CCTransitionSplitCols);
};
/** @brief CCTransitionSplitRows:
@ -497,7 +568,8 @@ public:
virtual CCActionInterval* action(void);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionSplitRows)
TRANSITION_CREATE_FUNC(CCTransitionSplitRows)
OLD_TRANSITION_CREATE_FUNC(CCTransitionSplitRows)
};
/** @brief CCTransitionFadeTR:
@ -513,7 +585,8 @@ public:
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeTR)
TRANSITION_CREATE_FUNC(CCTransitionFadeTR)
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeTR)
protected:
virtual void sceneOrder();
@ -530,7 +603,8 @@ public:
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeBL)
TRANSITION_CREATE_FUNC(CCTransitionFadeBL)
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeBL)
};
/** @brief CCTransitionFadeUp:
@ -544,7 +618,8 @@ public:
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeUp)
TRANSITION_CREATE_FUNC(CCTransitionFadeUp)
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeUp)
};
/** @brief CCTransitionFadeDown:
@ -558,7 +633,8 @@ public:
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeDown)
TRANSITION_CREATE_FUNC(CCTransitionFadeDown)
OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeDown)
};
NS_CC_END

Просмотреть файл

@ -40,8 +40,13 @@ CCTransitionPageTurn::~CCTransitionPageTurn()
{
}
// CCTransitionPageTurn * CCTransitionPageTurn::transitionWithDuration(float t, CCScene *scene, bool backwards)
// {
// return CCTransitionPageTurn::create(t,scene,backwards);
// }
/** creates a base transition with duration and incoming scene */
CCTransitionPageTurn * CCTransitionPageTurn::transitionWithDuration(float t, CCScene *scene, bool backwards)
CCTransitionPageTurn * CCTransitionPageTurn::create(float t, CCScene *scene, bool backwards)
{
CCTransitionPageTurn * pTransition = new CCTransitionPageTurn();
pTransition->initWithDuration(t,scene,backwards);
@ -89,11 +94,11 @@ void CCTransitionPageTurn::onEnter()
{
m_pOutScene->runAction
(
CCSequence::actions
CCSequence::create
(
action,
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::action(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
@ -104,12 +109,12 @@ void CCTransitionPageTurn::onEnter()
m_pInScene->setIsVisible(false);
m_pInScene->runAction
(
CCSequence::actions
CCSequence::create
(
CCShow::action(),
CCShow::create(),
action,
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::action(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
CCStopGrid::create(),
NULL
)
);
@ -122,15 +127,15 @@ CCActionInterval* CCTransitionPageTurn:: actionWithSize(const ccGridSize& vector
if( m_bBack )
{
// Get hold of the PageTurn3DAction
return CCReverseTime::actionWithAction
return CCReverseTime::create
(
CCPageTurn3D::actionWithSize(vector, m_fDuration)
CCPageTurn3D::create(vector, m_fDuration)
);
}
else
{
// Get hold of the PageTurn3DAction
return CCPageTurn3D::actionWithSize(vector, m_fDuration);
return CCPageTurn3D::create(vector, m_fDuration);
}
}

Просмотреть файл

@ -54,8 +54,16 @@ public:
* Creates a base transition with duration and incoming scene.
* If back is true then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene.
@warning: This interface will be deprecated in future.
*/
static CCTransitionPageTurn* transitionWithDuration(float t,CCScene* scene,bool backwards);
//static CCTransitionPageTurn* transitionWithDuration(float t,CCScene* scene,bool backwards);
/**
* Creates a base transition with duration and incoming scene.
* If back is true then the effect is reversed to appear as if the incoming
* scene is being turned from left over the outgoing scene.
*/
static CCTransitionPageTurn* create(float t,CCScene* scene,bool backwards);
/**
* Creates a base transition with duration and incoming scene.

Просмотреть файл

@ -40,8 +40,6 @@ enum {
kCCSceneRadial = 0xc001,
};
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgress)
CCTransitionProgress::CCTransitionProgress()
: to_(0.0f)
, from_(0.0f)
@ -62,7 +60,7 @@ void CCTransitionProgress::onEnter()
CCSize size = CCDirector::sharedDirector()->getWinSize();
// create the second render texture for outScene
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
CCRenderTexture *texture = CCRenderTexture::create((int)size.width, (int)size.height);
texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
texture->setPosition(ccp(size.width/2, size.height/2));
texture->setAnchorPoint(ccp(0.5f,0.5f));
@ -83,9 +81,9 @@ void CCTransitionProgress::onEnter()
CCProgressTimer *pNode = progressTimerNodeWithRenderTexture(texture);
// create the blend action
CCActionInterval* layerAction = (CCActionInterval*)CCSequence::actions(
CCProgressFromTo::actionWithDuration(m_fDuration, from_, to_),
CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionProgress::finish)),
CCActionInterval* layerAction = (CCActionInterval*)CCSequence::create(
CCProgressFromTo::create(m_fDuration, from_, to_),
CCCallFunc::create(this, callfunc_selector(CCTransitionProgress::finish)),
NULL);
// run the blend action
pNode->runAction(layerAction);
@ -122,13 +120,12 @@ CCProgressTimer* CCTransitionProgress::progressTimerNodeWithRenderTexture(CCRend
// CCTransitionProgressRadialCCW
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgressRadialCCW)
CCProgressTimer* CCTransitionProgressRadialCCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::progressWithSprite(texture->getSprite());
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);
@ -145,13 +142,11 @@ CCProgressTimer* CCTransitionProgressRadialCCW::progressTimerNodeWithRenderTextu
// CCTransitionProgressRadialCW
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgressRadialCW)
CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::progressWithSprite(texture->getSprite());
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);
@ -168,13 +163,11 @@ CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTextur
// CCTransitionProgressHorizontal
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgressHorizontal)
CCProgressTimer* CCTransitionProgressHorizontal::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::progressWithSprite(texture->getSprite());
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);
@ -192,13 +185,11 @@ CCProgressTimer* CCTransitionProgressHorizontal::progressTimerNodeWithRenderText
// CCTransitionProgressVertical
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgressVertical)
CCProgressTimer* CCTransitionProgressVertical::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::progressWithSprite(texture->getSprite());
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);
@ -217,8 +208,6 @@ CCProgressTimer* CCTransitionProgressVertical::progressTimerNodeWithRenderTextur
// CCTransitionProgressInOut
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgressInOut)
void CCTransitionProgressInOut::sceneOrder()
{
m_bIsInSceneOnTop = false;
@ -235,7 +224,7 @@ CCProgressTimer* CCTransitionProgressInOut::progressTimerNodeWithRenderTexture(C
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::progressWithSprite(texture->getSprite());
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);
@ -254,13 +243,11 @@ CCProgressTimer* CCTransitionProgressInOut::progressTimerNodeWithRenderTexture(C
// CCTransitionProgressOutIn
IMPLEMENT_TRANSITIONWITHDURATION(CCTransitionProgressOutIn)
CCProgressTimer* CCTransitionProgressOutIn::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCProgressTimer* pNode = CCProgressTimer::progressWithSprite(texture->getSprite());
CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
// but it is flipped upside down so we flip the sprite
pNode->getSprite()->setFlipY(true);

Просмотреть файл

@ -37,7 +37,7 @@ class CCRenderTexture;
class CC_DLL CCTransitionProgress : public CCTransitionScene
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgress)
TRANSITION_CREATE_FUNC(CCTransitionProgress)
CCTransitionProgress();
virtual void onEnter();
@ -58,7 +58,7 @@ protected:
class CC_DLL CCTransitionProgressRadialCCW : public CCTransitionProgress
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgressRadialCCW)
TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW)
protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);
@ -71,7 +71,7 @@ protected:
class CC_DLL CCTransitionProgressRadialCW : public CCTransitionProgress
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgressRadialCW)
TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW)
protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);
@ -83,7 +83,7 @@ protected:
class CC_DLL CCTransitionProgressHorizontal : public CCTransitionProgress
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgressHorizontal)
TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal)
protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);
@ -92,7 +92,7 @@ protected:
class CC_DLL CCTransitionProgressVertical : public CCTransitionProgress
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgressVertical)
TRANSITION_CREATE_FUNC(CCTransitionProgressVertical)
protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);
@ -101,7 +101,7 @@ protected:
class CC_DLL CCTransitionProgressInOut : public CCTransitionProgress
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgressInOut)
TRANSITION_CREATE_FUNC(CCTransitionProgressInOut)
protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);
virtual void sceneOrder();
@ -111,7 +111,7 @@ protected:
class CC_DLL CCTransitionProgressOutIn : public CCTransitionProgress
{
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionProgressOutIn)
TRANSITION_CREATE_FUNC(CCTransitionProgressOutIn)
protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org
@ -46,12 +46,33 @@ enum
//CCMenu
//
CCMenu* CCMenu::node()
// CCMenu* CCMenu::node()
// {
// return CCMenu::create();
// }
CCMenu* CCMenu::create()
{
return menuWithItem(NULL);
return CCMenu::create(NULL, NULL);
}
CCMenu * CCMenu::menuWithItems(CCMenuItem* item, ...)
// CCMenu * CCMenu::menuWithItems(CCMenuItem* item, ...)
// {
// va_list args;
// va_start(args,item);
// CCMenu *pRet = new CCMenu();
// if (pRet && pRet->initWithItems(item, args))
// {
// pRet->autorelease();
// va_end(args);
// return pRet;
// }
// va_end(args);
// CC_SAFE_DELETE(pRet);
// return NULL;
// }
CCMenu * CCMenu::create(CCMenuItem* item, ...)
{
va_list args;
va_start(args,item);
@ -67,7 +88,12 @@ CCMenu * CCMenu::menuWithItems(CCMenuItem* item, ...)
return NULL;
}
CCMenu* CCMenu::menuWithArray(CCArray* pArrayOfItems)
// CCMenu* CCMenu::menuWithArray(CCArray* pArrayOfItems)
// {
// return CCMenu::create(pArrayOfItems);
// }
CCMenu* CCMenu::create(CCArray* pArrayOfItems)
{
CCMenu *pRet = new CCMenu();
if (pRet && pRet->initWithArray(pArrayOfItems))
@ -82,9 +108,14 @@ CCMenu* CCMenu::menuWithArray(CCArray* pArrayOfItems)
return pRet;
}
CCMenu* CCMenu::menuWithItem(CCMenuItem* item)
// CCMenu* CCMenu::menuWithItem(CCMenuItem* item)
// {
// return CCMenu::createWithItem(item);
// }
CCMenu* CCMenu::createWithItem(CCMenuItem* item)
{
return menuWithItems(item, NULL);
return CCMenu::create(item, NULL);
}
bool CCMenu::init()

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org
@ -62,20 +62,42 @@ public:
{}
virtual ~CCMenu(){}
/** creates an empty CCMenu
@warning: This interface will be deprecated in future.
*/
//static CCMenu* node();
/** creates a CCMenu with it's items
@warning: This interface will be deprecated in future.
*/
//static CCMenu* menuWithItems(CCMenuItem* item, ...);
/** creates a CCMenu with a NSArray of CCMenuItem objects
@warning: This interface will be deprecated in future.
*/
//static CCMenu* menuWithArray(CCArray* pArrayOfItems);
/** creates a CCMenu with it's item, then use addChild() to add
* other items. It is used for script, it can't init with undetermined
* number of variables.
@warning: This interface will be deprecated in future.
*/
//static CCMenu* menuWithItem(CCMenuItem* item);
/** creates an empty CCMenu */
static CCMenu* node();
static CCMenu* create();
/** creates a CCMenu with it's items */
static CCMenu* menuWithItems(CCMenuItem* item, ...);
static CCMenu* create(CCMenuItem* item, ...);
/** creates a CCMenu with a NSArray of CCMenuItem objects */
static CCMenu* menuWithArray(CCArray* pArrayOfItems);
static CCMenu* create(CCArray* pArrayOfItems);
/** creates a CCMenu with it's item, then use addChild() to add
* other items. It is used for script, it can't init with undetermined
* number of variables.
*/
static CCMenu* menuWithItem(CCMenuItem* item);
static CCMenu* createWithItem(CCMenuItem* item);
/** initializes an empty CCMenu */
bool init();

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2011 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -48,13 +48,19 @@ const unsigned int kDisableTag = 0x3;
//
// CCMenuItem
//
CCMenuItem * CCMenuItem::itemWithTarget(CCObject *rec, SEL_MenuHandler selector)
// CCMenuItem * CCMenuItem::itemWithTarget(CCObject *rec, SEL_MenuHandler selector)
// {
// return CCMenuItem::create(rec, selector);
// }
CCMenuItem * CCMenuItem::create(CCObject *rec, SEL_MenuHandler selector)
{
CCMenuItem *pRet = new CCMenuItem();
pRet->initWithTarget(rec, selector);
pRet->autorelease();
return pRet;
}
bool CCMenuItem::initWithTarget(CCObject *rec, SEL_MenuHandler selector)
{
setAnchorPoint(ccp(0.5f, 0.5f));
@ -172,20 +178,33 @@ void CCMenuItemLabel::setLabel(CCNode* var)
m_pLabel = var;
}
CCMenuItemLabel * CCMenuItemLabel::itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector)
// CCMenuItemLabel * CCMenuItemLabel::itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector)
// {
// return CCMenuItemLabel::create(label, target, selector);
// }
CCMenuItemLabel * CCMenuItemLabel::create(CCNode*label, CCObject* target, SEL_MenuHandler selector)
{
CCMenuItemLabel *pRet = new CCMenuItemLabel();
pRet->initWithLabel(label, target, selector);
pRet->autorelease();
return pRet;
}
CCMenuItemLabel* CCMenuItemLabel::itemWithLabel(CCNode *label)
// CCMenuItemLabel* CCMenuItemLabel::itemWithLabel(CCNode *label)
// {
// return CCMenuItemLabel::create(label);
// }
CCMenuItemLabel* CCMenuItemLabel::create(CCNode *label)
{
CCMenuItemLabel *pRet = new CCMenuItemLabel();
pRet->initWithLabel(label, NULL, NULL);
pRet->autorelease();
return pRet;
}
bool CCMenuItemLabel::initWithLabel(CCNode* label, CCObject* target, SEL_MenuHandler selector)
{
CCMenuItem::initWithTarget(target, selector);
@ -195,14 +214,17 @@ bool CCMenuItemLabel::initWithLabel(CCNode* label, CCObject* target, SEL_MenuHan
this->setLabel(label);
return true;
}
CCMenuItemLabel::~CCMenuItemLabel()
{
}
void CCMenuItemLabel::setString(const char * label)
{
dynamic_cast<CCLabelProtocol*>(m_pLabel)->setString(label);
this->setContentSize(m_pLabel->getContentSize());
}
void CCMenuItemLabel::activate()
{
if(m_bIsEnabled)
@ -212,6 +234,7 @@ void CCMenuItemLabel::activate()
CCMenuItem::activate();
}
}
void CCMenuItemLabel::selected()
{
// subclass to change the default action
@ -229,11 +252,12 @@ void CCMenuItemLabel::selected()
m_fOriginalScale = this->getScale();
}
CCAction *zoomAction = CCScaleTo::actionWithDuration(0.1f, m_fOriginalScale * 1.2f);
CCAction *zoomAction = CCScaleTo::create(0.1f, m_fOriginalScale * 1.2f);
zoomAction->setTag(kZoomActionTag);
this->runAction(zoomAction);
}
}
void CCMenuItemLabel::unselected()
{
// subclass to change the default action
@ -241,11 +265,12 @@ void CCMenuItemLabel::unselected()
{
CCMenuItem::unselected();
this->stopActionByTag(kZoomActionTag);
CCAction *zoomAction = CCScaleTo::actionWithDuration(0.1f, m_fOriginalScale);
CCAction *zoomAction = CCScaleTo::create(0.1f, m_fOriginalScale);
zoomAction->setTag(kZoomActionTag);
this->runAction(zoomAction);
}
}
void CCMenuItemLabel::setIsEnabled(bool enabled)
{
if( m_bIsEnabled != enabled )
@ -262,18 +287,22 @@ void CCMenuItemLabel::setIsEnabled(bool enabled)
}
CCMenuItem::setIsEnabled(enabled);
}
void CCMenuItemLabel::setOpacity(GLubyte opacity)
{
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setOpacity(opacity);
}
GLubyte CCMenuItemLabel::getOpacity()
{
return dynamic_cast<CCRGBAProtocol*>(m_pLabel)->getOpacity();
}
void CCMenuItemLabel::setColor(const ccColor3B& color)
{
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setColor(color);
}
const ccColor3B& CCMenuItemLabel::getColor()
{
return dynamic_cast<CCRGBAProtocol*>(m_pLabel)->getColor();
@ -282,18 +311,29 @@ const ccColor3B& CCMenuItemLabel::getColor()
//
//CCMenuItemAtlasFont
//
CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap)
// CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap)
// {
// return CCMenuItemAtlasFont::create(value, charMapFile, itemWidth, itemHeight, startCharMap);
// }
CCMenuItemAtlasFont * CCMenuItemAtlasFont::create(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap)
{
return CCMenuItemAtlasFont::itemWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, NULL, NULL);
return CCMenuItemAtlasFont::create(value, charMapFile, itemWidth, itemHeight, startCharMap, NULL, NULL);
}
CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
// CCMenuItemAtlasFont * CCMenuItemAtlasFont::itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
// {
// return CCMenuItemAtlasFont::create(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector);
// }
CCMenuItemAtlasFont * CCMenuItemAtlasFont::create(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
{
CCMenuItemAtlasFont *pRet = new CCMenuItemAtlasFont();
pRet->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector);
pRet->autorelease();
return pRet;
}
bool CCMenuItemAtlasFont::initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector)
{
CCAssert( value != NULL && strlen(value) != 0, "value length must be greater than 0");
@ -313,10 +353,12 @@ void CCMenuItemFont::setFontSize(unsigned int s)
{
_fontSize = s;
}
unsigned int CCMenuItemFont::fontSize()
{
return _fontSize;
}
void CCMenuItemFont::setFontName(const char *name)
{
if( _fontNameRelease )
@ -326,24 +368,38 @@ void CCMenuItemFont::setFontName(const char *name)
_fontName = name;
_fontNameRelease = true;
}
const char * CCMenuItemFont::fontName()
{
return _fontName.c_str();
}
CCMenuItemFont * CCMenuItemFont::itemWithString(const char *value, CCObject* target, SEL_MenuHandler selector)
// CCMenuItemFont * CCMenuItemFont::itemWithString(const char *value, CCObject* target, SEL_MenuHandler selector)
// {
// return CCMenuItemFont::create(value, target, selector);
// }
CCMenuItemFont * CCMenuItemFont::create(const char *value, CCObject* target, SEL_MenuHandler selector)
{
CCMenuItemFont *pRet = new CCMenuItemFont();
pRet->initWithString(value, target, selector);
pRet->autorelease();
return pRet;
}
CCMenuItemFont * CCMenuItemFont::itemWithString(const char *value)
// CCMenuItemFont * CCMenuItemFont::itemWithString(const char *value)
// {
// return CCMenuItemFont::create(value);
// }
CCMenuItemFont * CCMenuItemFont::create(const char *value)
{
CCMenuItemFont *pRet = new CCMenuItemFont();
pRet->initWithString(value, NULL, NULL);
pRet->autorelease();
return pRet;
}
bool CCMenuItemFont::initWithString(const char *value, CCObject* target, SEL_MenuHandler selector)
{
CCAssert( value != NULL && strlen(value) != 0, "Value length must be greater than 0");
@ -351,7 +407,7 @@ bool CCMenuItemFont::initWithString(const char *value, CCObject* target, SEL_Men
m_strFontName = _fontName;
m_uFontSize = _fontSize;
CCLabelTTF *label = CCLabelTTF::labelWithString(value, m_strFontName.c_str(), (float)m_uFontSize);
CCLabelTTF *label = CCLabelTTF::create(value, m_strFontName.c_str(), (float)m_uFontSize);
if (CCMenuItemLabel::initWithLabel(label, target, selector))
{
// do something ?
@ -361,7 +417,7 @@ bool CCMenuItemFont::initWithString(const char *value, CCObject* target, SEL_Men
void CCMenuItemFont::recreateLabel()
{
CCLabelTTF *label = CCLabelTTF::labelWithString(dynamic_cast<CCLabelProtocol*>(m_pLabel)->getString(),
CCLabelTTF *label = CCLabelTTF::create(dynamic_cast<CCLabelProtocol*>(m_pLabel)->getString(),
m_strFontName.c_str(), (float)m_uFontSize);
this->setLabel(label);
}
@ -395,6 +451,7 @@ CCNode * CCMenuItemSprite::getNormalImage()
{
return m_pNormalImage;
}
void CCMenuItemSprite::setNormalImage(CCNode* pImage)
{
if (pImage != m_pNormalImage)
@ -415,10 +472,12 @@ void CCMenuItemSprite::setNormalImage(CCNode* pImage)
this->updateImagesVisibility();
}
}
CCNode * CCMenuItemSprite::getSelectedImage()
{
return m_pSelectedImage;
}
void CCMenuItemSprite::setSelectedImage(CCNode* pImage)
{
if (pImage != m_pNormalImage)
@ -464,6 +523,7 @@ void CCMenuItemSprite::setDisabledImage(CCNode* pImage)
this->updateImagesVisibility();
}
}
//
//CCMenuItemSprite - CCRGBAProtocol protocol
//
@ -481,6 +541,7 @@ void CCMenuItemSprite::setOpacity(GLubyte opacity)
dynamic_cast<CCRGBAProtocol*>(m_pDisabledImage)->setOpacity(opacity);
}
}
void CCMenuItemSprite::setColor(const ccColor3B& color)
{
dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->setColor(color);
@ -495,29 +556,50 @@ void CCMenuItemSprite::setColor(const ccColor3B& color)
dynamic_cast<CCRGBAProtocol*>(m_pDisabledImage)->setColor(color);
}
}
GLubyte CCMenuItemSprite::getOpacity()
{
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getOpacity();
}
const ccColor3B& CCMenuItemSprite::getColor()
{
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getColor();
}
CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite)
// CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite)
// {
// return CCMenuItemSprite::create(normalSprite, selectedSprite, disabledSprite);
// }
CCMenuItemSprite * CCMenuItemSprite::create(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite)
{
return CCMenuItemSprite::itemWithNormalSprite(normalSprite, selectedSprite, disabledSprite, NULL, NULL);
return CCMenuItemSprite::create(normalSprite, selectedSprite, disabledSprite, NULL, NULL);
}
CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector)
// CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector)
// {
// return CCMenuItemSprite::create(normalSprite, selectedSprite, target, selector);
// }
CCMenuItemSprite * CCMenuItemSprite::create(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector)
{
return CCMenuItemSprite::itemWithNormalSprite(normalSprite, selectedSprite, NULL, target, selector);
return CCMenuItemSprite::create(normalSprite, selectedSprite, NULL, target, selector);
}
CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode *normalSprite, CCNode *selectedSprite, CCNode *disabledSprite, CCObject *target, SEL_MenuHandler selector)
// CCMenuItemSprite * CCMenuItemSprite::itemWithNormalSprite(CCNode *normalSprite, CCNode *selectedSprite, CCNode *disabledSprite, CCObject *target, SEL_MenuHandler selector)
// {
// return CCMenuItemSprite::create(normalSprite, selectedSprite, disabledSprite, target, selector);
// }
CCMenuItemSprite * CCMenuItemSprite::create(CCNode *normalSprite, CCNode *selectedSprite, CCNode *disabledSprite, CCObject *target, SEL_MenuHandler selector)
{
CCMenuItemSprite *pRet = new CCMenuItemSprite();
pRet->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
pRet->autorelease();
return pRet;
}
bool CCMenuItemSprite::initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector)
{
CCAssert(normalSprite != NULL, "");
@ -605,17 +687,32 @@ void CCMenuItemSprite::updateImagesVisibility()
}
}
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage)
// CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage)
// {
// CCMenuItemImage::create(normalImage, selectedImage);
// }
CCMenuItemImage * CCMenuItemImage::create(const char *normalImage, const char *selectedImage)
{
return CCMenuItemImage::itemWithNormalImage(normalImage, selectedImage, NULL, NULL, NULL);
return CCMenuItemImage::create(normalImage, selectedImage, NULL, NULL, NULL);
}
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector)
// CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector)
// {
// return CCMenuItemImage::create(normalImage, selectedImage, target, selector);
// }
CCMenuItemImage * CCMenuItemImage::create(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector)
{
return CCMenuItemImage::itemWithNormalImage(normalImage, selectedImage, NULL, target, selector);
return CCMenuItemImage::create(normalImage, selectedImage, NULL, target, selector);
}
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
// CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
// {
// return CCMenuItemImage::create(normalImage, selectedImage, disabledImage, target, selector);
// }
CCMenuItemImage * CCMenuItemImage::create(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
{
CCMenuItemImage *pRet = new CCMenuItemImage();
if (pRet && pRet->initWithNormalImage(normalImage, selectedImage, disabledImage, target, selector))
@ -627,7 +724,12 @@ CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage,
return NULL;
}
CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage)
// CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage)
// {
// return CCMenuItemImage::create(normalImage, selectedImage, disabledImage);
// }
CCMenuItemImage * CCMenuItemImage::create(const char *normalImage, const char *selectedImage, const char *disabledImage)
{
CCMenuItemImage *pRet = new CCMenuItemImage();
if (pRet && pRet->initWithNormalImage(normalImage, selectedImage, disabledImage, NULL, NULL))
@ -641,18 +743,18 @@ CCMenuItemImage * CCMenuItemImage::itemWithNormalImage(const char *normalImage,
bool CCMenuItemImage::initWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector)
{
CCNode *normalSprite = CCSprite::spriteWithFile(normalImage);
CCNode *normalSprite = CCSprite::create(normalImage);
CCNode *selectedSprite = NULL;
CCNode *disabledSprite = NULL;
if (selectedImage)
{
selectedSprite = CCSprite::spriteWithFile(selectedImage);
selectedSprite = CCSprite::create(selectedImage);
}
if(disabledImage)
{
disabledSprite = CCSprite::spriteWithFile(disabledImage);
disabledSprite = CCSprite::create(disabledImage);
}
return initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
}
@ -661,17 +763,17 @@ bool CCMenuItemImage::initWithNormalImage(const char *normalImage, const char *s
//
void CCMenuItemImage::setNormalSpriteFrame(CCSpriteFrame * frame)
{
setNormalImage(CCSprite::spriteWithSpriteFrame(frame));
setNormalImage(CCSprite::createWithSpriteFrame(frame));
}
void CCMenuItemImage::setSelectedSpriteFrame(CCSpriteFrame * frame)
{
setSelectedImage(CCSprite::spriteWithSpriteFrame(frame));
setSelectedImage(CCSprite::createWithSpriteFrame(frame));
}
void CCMenuItemImage::setDisabledSpriteFrame(CCSpriteFrame * frame)
{
setDisabledImage(CCSprite::spriteWithSpriteFrame(frame));
setDisabledImage(CCSprite::createWithSpriteFrame(frame));
}
//
@ -688,7 +790,19 @@ CCArray* CCMenuItemToggle::getSubItems()
{
return m_pSubItems;
}
CCMenuItemToggle * CCMenuItemToggle::itemWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...)
// CCMenuItemToggle * CCMenuItemToggle::itemWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...)
// {
// va_list args;
// va_start(args, item);
// CCMenuItemToggle *pRet = new CCMenuItemToggle();
// pRet->initWithTarget(target, selector, item, args);
// pRet->autorelease();
// va_end(args);
// return pRet;
// }
CCMenuItemToggle * CCMenuItemToggle::create(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...)
{
va_list args;
va_start(args, item);
@ -717,7 +831,12 @@ bool CCMenuItemToggle::initWithTarget(CCObject* target, SEL_MenuHandler selector
return true;
}
CCMenuItemToggle* CCMenuItemToggle::itemWithItem(CCMenuItem *item)
// CCMenuItemToggle* CCMenuItemToggle::itemWithItem(CCMenuItem *item)
// {
// return CCMenuItemToggle::create(item);
// }
CCMenuItemToggle* CCMenuItemToggle::create(CCMenuItem *item)
{
CCMenuItemToggle *pRet = new CCMenuItemToggle();
pRet->initWithItem(item);

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2011 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -59,8 +59,12 @@ public:
, m_nScriptHandler(0)
{}
virtual ~CCMenuItem();
/** Creates a CCMenuItem with a target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItem * itemWithTarget(CCObject *rec, SEL_MenuHandler selector);
/** Creates a CCMenuItem with a target/selector */
static CCMenuItem * itemWithTarget(CCObject *rec, SEL_MenuHandler selector);
static CCMenuItem * create(CCObject *rec, SEL_MenuHandler selector);
/** Initializes a CCMenuItem with a target/selector */
bool initWithTarget(CCObject *rec, SEL_MenuHandler selector);
/** Returns the outside box */
@ -103,10 +107,20 @@ public:
, m_fOriginalScale(0.0)
{}
virtual ~CCMenuItemLabel();
/** creates a CCMenuItemLabel with a Label, target and selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemLabel * itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector);
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemLabel* itemWithLabel(CCNode *label);
/** creates a CCMenuItemLabel with a Label, target and selector */
static CCMenuItemLabel * itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemLabel * create(CCNode*label, CCObject* target, SEL_MenuHandler selector);
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill */
static CCMenuItemLabel* itemWithLabel(CCNode *label);
static CCMenuItemLabel* create(CCNode *label);
/** initializes a CCMenuItemLabel with a Label, target and selector */
bool initWithLabel(CCNode* label, CCObject* target, SEL_MenuHandler selector);
/** sets a new string to the inner label */
@ -139,10 +153,19 @@ class CC_DLL CCMenuItemAtlasFont : public CCMenuItemLabel
public:
CCMenuItemAtlasFont(){}
virtual ~CCMenuItemAtlasFont(){}
/** creates a menu item from a string and atlas with a target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemAtlasFont* itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
/** creates a menu item from a string and atlas. Use it with MenuItemToggle
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemAtlasFont* itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item from a string and atlas with a target/selector */
static CCMenuItemAtlasFont* itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
static CCMenuItemAtlasFont* create(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap);
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
static CCMenuItemAtlasFont* itemWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemAtlasFont* create(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
/** initializes a menu item from a string and atlas with a target/selector */
bool initWithString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, CCObject* target, SEL_MenuHandler selector);
};
@ -163,10 +186,20 @@ public:
static void setFontName(const char *name);
/** get the default font name */
static const char *fontName();
/** creates a menu item from a string without target/selector. To be used with CCMenuItemToggle
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemFont * itemWithString(const char *value);
/** creates a menu item from a string with a target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemFont * itemWithString(const char *value, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item from a string without target/selector. To be used with CCMenuItemToggle */
static CCMenuItemFont * itemWithString(const char *value);
static CCMenuItemFont * create(const char *value);
/** creates a menu item from a string with a target/selector */
static CCMenuItemFont * itemWithString(const char *value, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemFont * create(const char *value, CCObject* target, SEL_MenuHandler selector);
/** initializes a menu item from a string with a target/selector */
bool initWithString(const char *value, CCObject* target, SEL_MenuHandler selector);
@ -216,12 +249,26 @@ public:
,m_pSelectedImage(NULL)
,m_pDisabledImage(NULL)
{}
/** creates a menu item with a normal, selected and disabled image
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite = NULL);
/** creates a menu item with a normal and selected image with target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item with a normal,selected and disabled image with target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item with a normal, selected and disabled image*/
static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite = NULL);
static CCMenuItemSprite * create(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite = NULL);
/** creates a menu item with a normal and selected image with target/selector */
static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemSprite * create(CCNode* normalSprite, CCNode* selectedSprite, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item with a normal,selected and disabled image with target/selector */
static CCMenuItemSprite * itemWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemSprite * create(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
/** initializes a menu item with a normal, selected and disabled image with target/selector */
bool initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
// super methods
@ -256,14 +303,32 @@ class CC_DLL CCMenuItemImage : public CCMenuItemSprite
public:
CCMenuItemImage(){}
virtual ~CCMenuItemImage(){}
/** creates a menu item with a normal and selected image
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage);
/** creates a menu item with a normal,selected and disabled image
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage);
/** creates a menu item with a normal and selected image with target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item with a normal,selected and disabled image with target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item with a normal and selected image*/
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage);
static CCMenuItemImage* create(const char *normalImage, const char *selectedImage);
/** creates a menu item with a normal,selected and disabled image*/
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage);
static CCMenuItemImage* create(const char *normalImage, const char *selectedImage, const char *disabledImage);
/** creates a menu item with a normal and selected image with target/selector */
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemImage* create(const char *normalImage, const char *selectedImage, CCObject* target, SEL_MenuHandler selector);
/** creates a menu item with a normal,selected and disabled image with target/selector */
static CCMenuItemImage* itemWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
static CCMenuItemImage* create(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
/** initializes a menu item with a normal, selected and disabled image with target/selector */
bool initWithNormalImage(const char *normalImage, const char *selectedImage, const char *disabledImage, CCObject* target, SEL_MenuHandler selector);
/** sets the sprite frame for the normal image */
@ -297,14 +362,27 @@ public:
, m_pSubItems(NULL)
{}
virtual ~CCMenuItemToggle();
/** creates a menu item from a list of items with a target/selector
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemToggle* itemWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...);
/** creates a menu item from a list of items with a target/selector */
static CCMenuItemToggle* itemWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...);
static CCMenuItemToggle* create(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...);
/** initializes a menu item from a list of items with a target selector */
bool initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, va_list args);
// The follow methods offered to lua
/** creates a menu item with a item
@warning: This interface will be deprecated in future.
*/
//static CCMenuItemToggle* itemWithItem(CCMenuItem *item);
/** creates a menu item with a item */
static CCMenuItemToggle* itemWithItem(CCMenuItem *item);
static CCMenuItemToggle* create(CCMenuItem *item);
/** initializes a menu item with a item */
bool initWithItem(CCMenuItem *item);
/** add more menu item */

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 ForzeField Studios S.L.
http://www.cocos2d-x.org
@ -66,7 +66,12 @@ CCMotionStreak::~CCMotionStreak()
CC_SAFE_FREE(m_pTexCoords);
}
CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path)
// CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path)
// {
// return CCMotionStreak::create(fade, minSeg, stroke, color, path);
// }
CCMotionStreak* CCMotionStreak::create(float fade, float minSeg, float stroke, ccColor3B color, const char* path)
{
CCMotionStreak *pRet = new CCMotionStreak();
if (pRet && pRet->initWithFade(fade, minSeg, stroke, color, path))
@ -79,7 +84,12 @@ CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float s
return NULL;
}
CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture)
// CCMotionStreak* CCMotionStreak::streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture)
// {
// return CCMotionStreak::create(fade, minSeg, stroke, color, texture);
// }
CCMotionStreak* CCMotionStreak::create(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture)
{
CCMotionStreak *pRet = new CCMotionStreak();
if (pRet && pRet->initWithFade(fade, minSeg, stroke, color, texture))

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 ForzeField Studios S.L.
http://www.cocos2d-x.org
@ -41,10 +41,19 @@ class CC_DLL CCMotionStreak : public CCNode, public CCTextureProtocol, public CC
public:
CCMotionStreak();
virtual ~CCMotionStreak();
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename
@warning: This interface will be deprecated in future.
*/
//static CCMotionStreak* streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path);
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture
@warning: This interface will be deprecated in future.
*/
//static CCMotionStreak* streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture);
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename */
static CCMotionStreak* streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path);
static CCMotionStreak* create(float fade, float minSeg, float stroke, ccColor3B color, const char* path);
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
static CCMotionStreak* streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture);
static CCMotionStreak* create(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D* texture);
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, const char* path);

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2010 Lam Pham
http://www.cocos2d-x.org
@ -56,7 +56,12 @@ CCProgressTimer::CCProgressTimer()
,m_bReverseDirection(false)
{}
CCProgressTimer* CCProgressTimer::progressWithSprite(CCSprite* sp)
// CCProgressTimer* CCProgressTimer::progressWithSprite(CCSprite* sp)
// {
// return CCProgressTimer::create(sp);
// }
CCProgressTimer* CCProgressTimer::create(CCSprite* sp)
{
CCProgressTimer *pProgressTimer = new CCProgressTimer();
if (pProgressTimer->initWithSprite(sp))

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2010 Lam Pham
http://www.cocos2d-x.org
@ -79,9 +79,12 @@ public:
virtual bool getIsOpacityModifyRGB(void);
public:
/** Creates a progress timer with the sprite as the shape the timer goes through
@warning: This interface will be deprecated in future.
*/
//static CCProgressTimer* progressWithSprite(CCSprite* sp);
/** Creates a progress timer with the sprite as the shape the timer goes through */
static CCProgressTimer* progressWithSprite(CCSprite* sp);
static CCProgressTimer* create(CCSprite* sp);
protected:
ccTex2F textureCoordFromAlphaPoint(CCPoint alpha);
ccVertex2F vertexFromAlphaPoint(CCPoint alpha);

Просмотреть файл

@ -67,12 +67,18 @@ CCSprite * CCRenderTexture::getSprite()
{
return m_pSprite;
}
void CCRenderTexture::setSprite(CCSprite* var)
{
m_pSprite = var;
}
CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat)
// CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat)
// {
// return CCRenderTexture::create(w, h, eFormat);
// }
CCRenderTexture * CCRenderTexture::create(int w, int h, CCTexture2DPixelFormat eFormat)
{
CCRenderTexture *pRet = new CCRenderTexture();
@ -85,7 +91,12 @@ CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w, int h,
return NULL;
}
CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat)
// CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat)
// {
// return CCRenderTexture::create(w, h, eFormat, uDepthStencilFormat);
// }
CCRenderTexture * CCRenderTexture::create(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat)
{
CCRenderTexture *pRet = new CCRenderTexture();
@ -98,7 +109,12 @@ CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w ,int h,
return NULL;
}
CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w, int h)
// CCRenderTexture * CCRenderTexture::renderTextureWithWidthAndHeight(int w, int h)
// {
// return CCRenderTexture::create(w, h);
// }
CCRenderTexture * CCRenderTexture::create(int w, int h)
{
CCRenderTexture *pRet = new CCRenderTexture();
@ -181,7 +197,7 @@ bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelForma
m_pTexture->setAliasTexParameters();
m_pSprite = CCSprite::spriteWithTexture(m_pTexture);
m_pSprite = CCSprite::createWithTexture(m_pTexture);
m_pTexture->release();
m_pSprite->setScaleY(-1);

Просмотреть файл

@ -59,14 +59,29 @@ public:
CCRenderTexture();
virtual ~CCRenderTexture();
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format
@warning: This interface will be deprecated in future.
*/
//static CCRenderTexture * renderTextureWithWidthAndHeight(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat);
/** creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid
@warning: This interface will be deprecated in future.
*/
//static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888
@warning: This interface will be deprecated in future.
*/
//static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h);
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
static CCRenderTexture * renderTextureWithWidthAndHeight(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat);
static CCRenderTexture * create(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat);
/** creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);
static CCRenderTexture * create(int w, int h, CCTexture2DPixelFormat eFormat);
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
static CCRenderTexture * renderTextureWithWidthAndHeight(int w, int h);
static CCRenderTexture * create(int w, int h);
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
bool initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat);

Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2011 cocos2d-x.org
* Copyright (c) 2010-2012 cocos2d-x.org
* Copyright (C) 2009 Matt Oswald
* Copyright (c) 2009-2010 Ricardo Quesada
* Copyright (c) 2011 Zynga Inc.
@ -45,8 +45,6 @@
NS_CC_BEGIN
#define kCCParticleDefaultCapacity 500
CCParticleBatchNode::CCParticleBatchNode()
: m_pTextureAtlas(NULL)
{
@ -60,19 +58,12 @@ CCParticleBatchNode::~CCParticleBatchNode()
/*
* creation with CCTexture2D
*/
CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D * tex)
{
CCParticleBatchNode * p = new CCParticleBatchNode();
if( p && p->initWithTexture(tex, kCCParticleDefaultCapacity))
{
p->autorelease();
return p;
}
CC_SAFE_DELETE(p);
return NULL;
}
// CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/)
// {
// return CCParticleBatchNode::createWithTexture(tex, capacity);
// }
CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity)
CCParticleBatchNode* CCParticleBatchNode::createWithTexture(CCTexture2D *tex, unsigned int capacity/* = kCCParticleDefaultCapacity*/)
{
CCParticleBatchNode * p = new CCParticleBatchNode();
if( p && p->initWithTexture(tex, capacity))
@ -87,7 +78,12 @@ CCParticleBatchNode* CCParticleBatchNode::batchNodeWithTexture(CCTexture2D *tex,
/*
* creation with File Image
*/
CCParticleBatchNode* CCParticleBatchNode::batchNodeWithFile(const char* imageFile, unsigned int capacity)
// CCParticleBatchNode* CCParticleBatchNode::batchNodeWithFile(const char* imageFile, unsigned int capacity/* = kCCParticleDefaultCapacity*/)
// {
// return CCParticleBatchNode::create(imageFile, capacity);
// }
CCParticleBatchNode* CCParticleBatchNode::create(const char* imageFile, unsigned int capacity/* = kCCParticleDefaultCapacity*/)
{
CCParticleBatchNode * p = new CCParticleBatchNode();
if( p && p->initWithFile(imageFile, capacity))
@ -99,18 +95,6 @@ CCParticleBatchNode* CCParticleBatchNode::batchNodeWithFile(const char* imageFil
return NULL;
}
CCParticleBatchNode* CCParticleBatchNode::batchNodeWithFile(const char* imageFile)
{
CCParticleBatchNode * p = new CCParticleBatchNode();
if( p && p->initWithFile(imageFile, kCCParticleDefaultCapacity))
{
p->autorelease();
return p;
}
CC_SAFE_DELETE(p);
return NULL;
}
/*
* init with CCTexture2D
*/

Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2011 cocos2d-x.org
* Copyright (c) 2010-2012 cocos2d-x.org
* Copyright (C) 2009 Matt Oswald
* Copyright (c) 2009-2010 Ricardo Quesada
* Copyright (c) 2011 Zynga Inc.
@ -38,6 +38,8 @@ class CCTexture2D;
class CCTextureAtlas;
class CCParticleSystem;
#define kCCParticleDefaultCapacity 500
/** CCParticleBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call
* (often known as "batch draw").
*
@ -62,17 +64,22 @@ class CC_DLL CCParticleBatchNode : public CCNode, public CCTextureProtocol
public:
CCParticleBatchNode();
virtual ~CCParticleBatchNode();
/** initializes the particle system with CCTexture2D, a default capacity of 500 */
static CCParticleBatchNode* batchNodeWithTexture(CCTexture2D * tex);
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a default capacity of 500 particles */
static CCParticleBatchNode* batchNodeWithFile(const char* imageFile);
/** initializes the particle system with CCTexture2D, a capacity of particles, which particle system to use
@warning: This interface will be deprecated in future.
*/
//static CCParticleBatchNode* batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity);
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles
@warning: This interface will be deprecated in future.
*/
//static CCParticleBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);
/** initializes the particle system with CCTexture2D, a capacity of particles, which particle system to use */
static CCParticleBatchNode* batchNodeWithTexture(CCTexture2D *tex, unsigned int capacity);
static CCParticleBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity);
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles */
static CCParticleBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity);
static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);
/** initializes the particle system with CCTexture2D, a capacity of particles */
bool initWithTexture(CCTexture2D *tex, unsigned int capacity);

Просмотреть файл

@ -39,7 +39,12 @@ public:
virtual ~CCParticleFire(){}
bool init(){ return initWithTotalParticles(250); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleFire * node()
// static CCParticleFire * node()
// {
// return create();
// }
static CCParticleFire * create()
{
CCParticleFire *pRet = new CCParticleFire();
if (pRet->init())
@ -60,7 +65,12 @@ public:
virtual ~CCParticleFireworks(){}
bool init(){ return initWithTotalParticles(1500); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleFireworks * node()
// static CCParticleFireworks * node()
// {
// return create();
// }
static CCParticleFireworks * create()
{
CCParticleFireworks *pRet = new CCParticleFireworks();
if (pRet->init())
@ -81,7 +91,11 @@ public:
virtual ~CCParticleSun(){}
bool init(){ return initWithTotalParticles(350); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSun * node()
// static CCParticleSun * node()
// {
// return create();
// }
static CCParticleSun * create()
{
CCParticleSun *pRet = new CCParticleSun();
if (pRet->init())
@ -102,7 +116,12 @@ public:
virtual ~CCParticleGalaxy(){}
bool init(){ return initWithTotalParticles(200); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleGalaxy * node()
// static CCParticleGalaxy * node()
// {
// return create();
// }
static CCParticleGalaxy * create()
{
CCParticleGalaxy *pRet = new CCParticleGalaxy();
if (pRet->init())
@ -123,7 +142,12 @@ public:
virtual ~CCParticleFlower(){}
bool init(){ return initWithTotalParticles(250); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleFlower * node()
// static CCParticleFlower * node()
// {
// return create();
// }
static CCParticleFlower * create()
{
CCParticleFlower *pRet = new CCParticleFlower();
if (pRet->init())
@ -144,7 +168,11 @@ public:
virtual ~CCParticleMeteor(){}
bool init(){ return initWithTotalParticles(150); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleMeteor * node()
// static CCParticleMeteor * node()
// {
// return create();
// }
static CCParticleMeteor * create()
{
CCParticleMeteor *pRet = new CCParticleMeteor();
if (pRet->init())
@ -165,7 +193,11 @@ public:
virtual ~CCParticleSpiral(){}
bool init(){ return initWithTotalParticles(500); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSpiral * node()
// static CCParticleSpiral * node()
// {
// return create();
// }
static CCParticleSpiral * create()
{
CCParticleSpiral *pRet = new CCParticleSpiral();
if (pRet->init())
@ -186,7 +218,11 @@ public:
virtual ~CCParticleExplosion(){}
bool init(){ return initWithTotalParticles(700); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleExplosion * node()
// static CCParticleExplosion * node()
// {
// return create();
// }
static CCParticleExplosion * create()
{
CCParticleExplosion *pRet = new CCParticleExplosion();
if (pRet->init())
@ -207,7 +243,11 @@ public:
virtual ~CCParticleSmoke(){}
bool init(){ return initWithTotalParticles(200); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSmoke * node()
// static CCParticleSmoke * node()
// {
// return create();
// }
static CCParticleSmoke * create()
{
CCParticleSmoke *pRet = new CCParticleSmoke();
if (pRet->init())
@ -228,7 +268,12 @@ public:
virtual ~CCParticleSnow(){}
bool init(){ return initWithTotalParticles(700); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleSnow * node()
// static CCParticleSnow * node()
// {
// return create();
// }
static CCParticleSnow * create()
{
CCParticleSnow *pRet = new CCParticleSnow();
if (pRet->init())
@ -249,7 +294,11 @@ public:
virtual ~CCParticleRain(){}
bool init(){ return initWithTotalParticles(1000); }
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
static CCParticleRain * node()
// static CCParticleRain * node()
// {
// return create();
// }
static CCParticleRain * create()
{
CCParticleRain *pRet = new CCParticleRain();
if (pRet->init())

Просмотреть файл

@ -130,7 +130,12 @@ CCParticleSystem::CCParticleSystem()
m_tBlendFunc.dst = CC_BLEND_DST;
}
// implementation CCParticleSystem
CCParticleSystem * CCParticleSystem::particleWithFile(const char *plistFile)
// CCParticleSystem * CCParticleSystem::particleWithFile(const char *plistFile)
// {
// return CCParticleSystem::create(plistFile);
// }
CCParticleSystem * CCParticleSystem::create(const char *plistFile)
{
CCParticleSystem *pRet = new CCParticleSystem();
if (pRet && pRet->initWithFile(plistFile))

Просмотреть файл

@ -356,9 +356,17 @@ public:
/** creates an initializes a CCParticleSystem from a plist file.
This plist files can be creted manually or with Particle Designer:
http://particledesigner.71squared.com/
@warning: This interface will be deprecated in future.
@since v0.99.3
*/
static CCParticleSystem * particleWithFile(const char *plistFile);
//static CCParticleSystem * particleWithFile(const char *plistFile);
/** creates an initializes a CCParticleSystem from a plist file.
This plist files can be creted manually or with Particle Designer:
http://particledesigner.71squared.com/
@since v2.0
*/
static CCParticleSystem * create(const char *plistFile);
/** initializes a CCParticleSystem*/
bool init();

Просмотреть файл

@ -103,7 +103,12 @@ CCParticleSystemQuad::~CCParticleSystemQuad()
}
// implementation CCParticleSystemQuad
CCParticleSystemQuad * CCParticleSystemQuad::particleWithFile(const char *plistFile)
// CCParticleSystemQuad * CCParticleSystemQuad::particleWithFile(const char *plistFile)
// {
// return CCParticleSystemQuad::create(plistFile);
// }
CCParticleSystemQuad * CCParticleSystemQuad::create(const char *plistFile)
{
CCParticleSystemQuad *pRet = new CCParticleSystemQuad();
if (pRet && pRet->initWithFile(plistFile))

Просмотреть файл

@ -63,8 +63,14 @@ public:
/** creates an initializes a CCParticleSystemQuad from a plist file.
This plist files can be creted manually or with Particle Designer:
@warning: This interface will be deprecated in future.
*/
static CCParticleSystemQuad * particleWithFile(const char *plistFile);
//static CCParticleSystemQuad * particleWithFile(const char *plistFile);
/** creates an initializes a CCParticleSystemQuad from a plist file.
This plist files can be creted manually or with Particle Designer:
*/
static CCParticleSystemQuad * create(const char *plistFile);
/** initialices the indices for the vertices*/
void setupIndices();

Просмотреть файл

@ -81,7 +81,12 @@ CCObject* CCAnimationFrame::copyWithZone(CCZone* pZone)
// implementation of CCAnimation
CCAnimation* CCAnimation::animation(void)
// CCAnimation* CCAnimation::animation(void)
// {
// return CCAnimation::create();
// }
CCAnimation* CCAnimation::create(void)
{
CCAnimation *pAnimation = new CCAnimation();
pAnimation->init();
@ -90,16 +95,12 @@ CCAnimation* CCAnimation::animation(void)
return pAnimation;
}
CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames)
{
CCAnimation *pAnimation = new CCAnimation();
pAnimation->initWithSpriteFrames(frames);
pAnimation->autorelease();
// CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/)
// {
// return CCAnimation::createWithSpriteFrames(frames, delay);
// }
return pAnimation;
}
CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames, float delay)
CCAnimation* CCAnimation::createWithSpriteFrames(CCArray *frames, float delay/* = 0.0f*/)
{
CCAnimation *pAnimation = new CCAnimation();
pAnimation->initWithSpriteFrames(frames, delay);
@ -108,10 +109,15 @@ CCAnimation* CCAnimation::animationWithSpriteFrames(CCArray *frames, float delay
return pAnimation;
}
CCAnimation* CCAnimation::animationWithAnimationFrames(CCArray* arrayOfSpriteFrameNames, float delayPerUnit, unsigned int loops)
// CCAnimation* CCAnimation::animationWithAnimationFrames(CCArray* arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops)
// {
// return CCAnimation::createWithAnimationFrames(arrayOfAnimationFrameNames, delayPerUnit, loops);
// }
CCAnimation* CCAnimation::createWithAnimationFrames(CCArray* arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops)
{
CCAnimation *pAnimation = new CCAnimation();
pAnimation->initWithAnimationFrames(arrayOfSpriteFrameNames, delayPerUnit, loops);
pAnimation->initWithAnimationFrames(arrayOfAnimationFrameNames, delayPerUnit, loops);
pAnimation->autorelease();
return pAnimation;
}
@ -121,12 +127,7 @@ bool CCAnimation::init()
return initWithSpriteFrames(NULL, 0.0f);
}
bool CCAnimation::initWithSpriteFrames(CCArray* pFrames)
{
return initWithSpriteFrames(pFrames, 0.0f);
}
bool CCAnimation::initWithSpriteFrames(CCArray *pFrames, float delay)
bool CCAnimation::initWithSpriteFrames(CCArray *pFrames, float delay/* = 0.0f*/)
{
CCARRAY_VERIFY_TYPE(pFrames, CCSpriteFrame*);
@ -204,13 +205,13 @@ void CCAnimation::addSpriteFrameWithFileName(const char *pszFileName)
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage(pszFileName);
CCRect rect = CCRectZero;
rect.size = pTexture->getContentSize();
CCSpriteFrame *pFrame = CCSpriteFrame::frameWithTexture(pTexture, rect);
CCSpriteFrame *pFrame = CCSpriteFrame::create(pTexture, rect);
addSpriteFrame(pFrame);
}
void CCAnimation::addSpriteFrameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{
CCSpriteFrame *pFrame = CCSpriteFrame::frameWithTexture(pobTexture, rect);
CCSpriteFrame *pFrame = CCSpriteFrame::create(pobTexture, rect);
addSpriteFrame(pFrame);
}

Просмотреть файл

@ -84,26 +84,39 @@ public:
~CCAnimation(void);
public:
/** Creates an animation
@warning: This interface will be deprecated in future.
@since v0.99.5
*/
static CCAnimation* animation(void);
//static CCAnimation* animation(void);
/** Creates an animation with an array of CCSpriteFrame.
The frames will be created with one "delay unit".
/* Creates an animation with an array of CCSpriteFrame and a delay between frames in seconds.
The frames will be added with one "delay unit".
@warning: This interface will be deprecated in future.
@since v0.99.5
*/
//static CCAnimation* animationWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay = 0.0f);
/* Creates an animation with an array of CCAnimationFrame, the delay per units in seconds and and how many times it should be executed.
@warning: This interface will be deprecated in future.
@since v2.0
*/
//static CCAnimation* animationWithAnimationFrames(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops);
/** Creates an animation
@since v0.99.5
*/
static CCAnimation* animationWithSpriteFrames(CCArray* arrayOfSpriteFrameNames);
static CCAnimation* create(void);
/* Creates an animation with an array of CCSpriteFrame and a delay between frames in seconds.
The frames will be added with one "delay unit".
@since v0.99.5
*/
static CCAnimation* animationWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay);
static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay = 0.0f);
/* Creates an animation with an array of CCAnimationFrame, the delay per units in seconds and and how many times it should be executed.
@since v2.0
*/
static CCAnimation* animationWithAnimationFrames(CCArray *arrayOfSpriteFrameNames, float delayPerUnit, unsigned int loops);
static CCAnimation* createWithAnimationFrames(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops);
/** Adds a CCSpriteFrame to a CCAnimation.
The frame will be added with one "delay unit".
@ -123,15 +136,11 @@ public:
void addSpriteFrameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
bool init();
/** Initializes a CCAnimation with frames.
@since v0.99.5
*/
bool initWithSpriteFrames(CCArray *pFrames);
/** Initializes a CCAnimation with frames and a delay between frames
@since v0.99.5
*/
bool initWithSpriteFrames(CCArray *pFrames, float delay);
bool initWithSpriteFrames(CCArray *pFrames, float delay = 0.0f);
/** Initializes a CCAnimation with CCAnimationFrame
@since v2.0

Просмотреть файл

@ -136,7 +136,7 @@ void CCAnimationCache::parseVersion1(CCDictionary* animations)
CCLOG("cocos2d: CCAnimationCache: An animation in your dictionary refers to a frame which is not in the CCSpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.", pElement->getStrKey());
}
animation = CCAnimation::animationWithAnimationFrames(frames, delay, 1);
animation = CCAnimation::createWithAnimationFrames(frames, delay, 1);
CCAnimationCache::sharedAnimationCache()->addAnimation(animation, pElement->getStrKey());
frames->release();

Просмотреть файл

@ -58,7 +58,12 @@ NS_CC_BEGIN
#define RENDER_IN_SUBPIXEL(__A__) ( (int)(__A__))
#endif
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
// CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
// {
// return CCSprite::createWithTexture(pTexture);
// }
CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture))
@ -70,7 +75,12 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
return NULL;
}
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect)
// CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect)
// {
// return CCSprite::createWithTexture(pTexture, rect);
// }
CCSprite* CCSprite::createWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
@ -82,17 +92,12 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect)
return NULL;
}
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect, const CCPoint& offset)
{
CC_UNUSED_PARAM(pTexture);
CC_UNUSED_PARAM(rect);
CC_UNUSED_PARAM(offset);
// not implement
CCAssert(0, "");
return NULL;
}
// CCSprite* CCSprite::spriteWithFile(const char *pszFileName)
// {
// CCSprite::create(pszFileName);
// }
CCSprite* CCSprite::spriteWithFile(const char *pszFileName)
CCSprite* CCSprite::create(const char *pszFileName)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithFile(pszFileName))
@ -104,7 +109,12 @@ CCSprite* CCSprite::spriteWithFile(const char *pszFileName)
return NULL;
}
CCSprite* CCSprite::spriteWithFile(const char *pszFileName, const CCRect& rect)
// CCSprite* CCSprite::spriteWithFile(const char *pszFileName, const CCRect& rect)
// {
// return CCSprite::create(pszFileName, rect);
// }
CCSprite* CCSprite::create(const char *pszFileName, const CCRect& rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithFile(pszFileName, rect))
@ -116,7 +126,12 @@ CCSprite* CCSprite::spriteWithFile(const char *pszFileName, const CCRect& rect)
return NULL;
}
CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
// CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
// {
// return CCSprite::createWithSpriteFrame(pSpriteFrame);
// }
CCSprite* CCSprite::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame))
@ -128,17 +143,27 @@ CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
return NULL;
}
CCSprite* CCSprite::spriteWithSpriteFrameName(const char *pszSpriteFrameName)
// CCSprite* CCSprite::spriteWithSpriteFrameName(const char *pszSpriteFrameName)
// {
// return CCSprite::createWithSpriteFrameName(pszSpriteFrameName);
// }
CCSprite* CCSprite::createWithSpriteFrameName(const char *pszSpriteFrameName)
{
CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(pszSpriteFrameName);
char msg[256] = {0};
sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName);
CCAssert(pFrame != NULL, msg);
return spriteWithSpriteFrame(pFrame);
return createWithSpriteFrame(pFrame);
}
CCSprite* CCSprite::node()
// CCSprite* CCSprite::node()
// {
// return CCSprite::create();
// }
CCSprite* CCSprite::create()
{
CCSprite *pSprite = new CCSprite();
if (pSprite && pSprite->init())
@ -1000,7 +1025,7 @@ bool CCSprite::isFrameDisplayed(CCSpriteFrame *pFrame)
CCSpriteFrame* CCSprite::displayFrame(void)
{
return CCSpriteFrame::frameWithTexture(m_pobTexture,
return CCSpriteFrame::create(m_pobTexture,
CC_RECT_POINTS_TO_PIXELS(m_obRect),
m_bRectRotated,
m_obUnflippedOffsetPositionFromCenter,

Просмотреть файл

@ -123,41 +123,81 @@ public:
/** Creates an sprite with a texture.
The rect used will be the size of the texture.
The offset will be (0,0).
@warning: This interface will be deprecated in future.
*/
static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
//static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
/** Creates an sprite with a texture and a rect.
The offset will be (0,0).
@warning: This interface will be deprecated in future.
*/
//static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
/** Creates an sprite with a texture.
The rect used will be the size of the texture.
The offset will be (0,0).
*/
static CCSprite* createWithTexture(CCTexture2D *pTexture);
/** Creates an sprite with a texture and a rect.
The offset will be (0,0).
*/
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
static CCSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect);
/** Creates an sprite with a texture, a rect and offset. */
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect, const CCPoint& offset);
/** Creates an sprite with an sprite frame.
@warning: This interface will be deprecated in future.
*/
// static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
/** Creates an sprite with an sprite frame name.
An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name.
If the CCSpriteFrame doesn't exist it will raise an exception.
@warning: This interface will be deprecated in future.
@since v0.9
*/
//static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
/** Creates an sprite with an sprite frame. */
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
static CCSprite* createWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
/** Creates an sprite with an sprite frame name.
An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name.
If the CCSpriteFrame doesn't exist it will raise an exception.
@since v0.9
*/
static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
static CCSprite* createWithSpriteFrameName(const char *pszSpriteFrameName);
/** Creates an sprite with an image filename.
The rect used will be the size of the image.
@warning: This interface will be deprecated in future.
The offset will be (0,0).
*/
//static CCSprite* spriteWithFile(const char *pszFileName);
/** Creates an sprite with an image filename and a rect.
The offset will be (0,0).
@warning: This interface will be deprecated in future.
*/
//static CCSprite* spriteWithFile(const char *pszFileName, const CCRect& rect);
/** Creates an sprite with an image filename.
The rect used will be the size of the image.
The offset will be (0,0).
*/
static CCSprite* spriteWithFile(const char *pszFileName);
static CCSprite* create(const char *pszFileName);
/** Creates an sprite with an image filename and a rect.
The offset will be (0,0).
*/
static CCSprite* spriteWithFile(const char *pszFileName, const CCRect& rect);
static CCSprite* create(const char *pszFileName, const CCRect& rect);
/** Creates an sprite.
@warning: This interface will be deprecated in future.
*/
//static CCSprite* node();
/** Creates an sprite.
*/
static CCSprite* node();
static CCSprite* create();
public:
CCSprite(void);
virtual ~CCSprite(void);

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009-2010 Ricardo Quesada
Copyright (c) 2009 Matt Oswald
Copyright (c) 2011 Zynga Inc.
@ -42,20 +42,16 @@ THE SOFTWARE.
NS_CC_BEGIN
static const int defaultCapacity = 29;
/*
* creation with CCTexture2D
*/
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D *tex)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, defaultCapacity);
batchNode->autorelease();
return batchNode;
}
// CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
// {
// return CCSpriteBatchNode::createWithTexture(tex, capacity);
// }
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity)
CCSpriteBatchNode* CCSpriteBatchNode::createWithTexture(CCTexture2D* tex, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, capacity);
@ -67,7 +63,12 @@ CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D* tex, uns
/*
* creation with File Image
*/
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithFile(const char *fileImage, unsigned int capacity)
// CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithFile(const char *fileImage, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
// {
// return CCSpriteBatchNode::create(fileImage, capacity);
// }
CCSpriteBatchNode* CCSpriteBatchNode::create(const char *fileImage, unsigned int capacity/* = kDefaultSpriteBatchCapacity*/)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithFile(fileImage, capacity);
@ -76,15 +77,6 @@ CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithFile(const char *fileImage, u
return batchNode;
}
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithFile(const char *fileImage)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithFile(fileImage, defaultCapacity);
batchNode->autorelease();
return batchNode;
}
/*
* init with CCTexture2D
*/
@ -96,7 +88,7 @@ bool CCSpriteBatchNode::initWithTexture(CCTexture2D *tex, unsigned int capacity)
if (0 == capacity)
{
capacity = defaultCapacity;
capacity = kDefaultSpriteBatchCapacity;
}
m_pobTextureAtlas->initWithTexture(tex, capacity);

Просмотреть файл

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009-2010 Ricardo Quesada
Copyright (C) 2009 Matt Oswald
Copyright (c) 2011 Zynga Inc.
@ -36,6 +36,8 @@ THE SOFTWARE.
NS_CC_BEGIN
#define kDefaultSpriteBatchCapacity 29
class CCSprite;
/** CCSpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call
@ -74,27 +76,29 @@ public:
inline CCArray* getDescendants(void) { return m_pobDescendants; }
/** creates a CCSpriteBatchNode with a texture2d and a default capacity of 29 children.
/** 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.
@warning: This interface will be deprecated in future.
*/
static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D *tex);
//static CCSpriteBatchNode* batchNodeWithTexture(CCTexture2D* tex, unsigned int capacity = kDefaultSpriteBatchCapacity);
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
The capacity will be increased in 33% in runtime if it run out of space.
The file will be loaded using the TextureMgr.
@warning: This interface will be deprecated in future.
*/
//static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity = kDefaultSpriteBatchCapacity);
/** 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);
/** 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* createWithTexture(CCTexture2D* tex, unsigned int capacity = kDefaultSpriteBatchCapacity);
/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
The capacity will be increased in 33% in runtime if it run out of space.
The file will be loaded using the TextureMgr.
*/
static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity);
static CCSpriteBatchNode* create(const char* fileImage, unsigned int capacity = kDefaultSpriteBatchCapacity);
/** 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.

Просмотреть файл

@ -31,7 +31,12 @@ NS_CC_BEGIN
// implementation of CCSpriteFrame
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
// CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
// {
// return CCSpriteFrame::create(pobTexture, rect);
// }
CCSpriteFrame* CCSpriteFrame::create(CCTexture2D *pobTexture, const CCRect& rect)
{
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect);
@ -40,7 +45,12 @@ CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CC
return pSpriteFrame;
}
CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, const CCRect& rect)
// CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, const CCRect& rect)
// {
// return createWithTextureFilename(filename, rect);
// }
CCSpriteFrame* CCSpriteFrame::createWithTextureFilename(const char* filename, const CCRect& rect)
{
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTextureFilename(filename, rect);
@ -49,7 +59,12 @@ CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, con
return pSpriteFrame;
}
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
// CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
// {
// return CCSpriteFrame::create(pobTexture, rect, rotated, offset, originalSize);
// }
CCSpriteFrame* CCSpriteFrame::create(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect, rotated, offset, originalSize);
@ -58,7 +73,12 @@ CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CC
return pSpriteFrame;
}
CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
// CCSpriteFrame* CCSpriteFrame::frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
// {
// return CCSpriteFrame::createWithTextureFilename(filename, rect, rotated, offset, originalSize);
// }
CCSpriteFrame* CCSpriteFrame::createWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTextureFilename(filename, rect, rotated, offset, originalSize);

Просмотреть файл

@ -91,24 +91,49 @@ public:
virtual CCObject* copyWithZone(CCZone *pZone);
/** Create a CCSpriteFrame with a texture, rect in points.
@warning: This interface will be deprecated in future.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
//static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
@warning: This interface will be deprecated in future.
*/
//static CCSpriteFrame* frameWithTextureFilename(const char* filename, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
@warning: This interface will be deprecated in future.
*/
//static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
@warning: This interface will be deprecated in future.
*/
//static CCSpriteFrame* frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* create(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* frameWithTextureFilename(const char* filename, const CCRect& rect);
static CCSpriteFrame* createWithTextureFilename(const char* filename, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
static CCSpriteFrame* create(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
*/
static CCSpriteFrame* frameWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
static CCSpriteFrame* createWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
public:
/** Initializes a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше