Merge commit '95e7373dad8591b11c9bedefe159878210e12e56' into iss2771_physical

This commit is contained in:
boyu0 2013-11-18 11:22:20 +08:00
commit 90f07f680f
28 changed files with 679 additions and 689 deletions

View File

@ -35,8 +35,8 @@ NS_CC_BEGIN
//
Action::Action()
:_originalTarget(NULL)
,_target(NULL)
:_originalTarget(nullptr)
,_target(nullptr)
,_tag(Action::INVALID_TAG)
{
}
@ -58,7 +58,7 @@ void Action::startWithTarget(Node *aTarget)
void Action::stop()
{
_target = NULL;
_target = nullptr;
}
bool Action::isDone() const
@ -83,7 +83,7 @@ void Action::update(float time)
//
Speed::Speed()
: _speed(0.0)
, _innerAction(NULL)
, _innerAction(nullptr)
{
}
@ -92,24 +92,24 @@ Speed::~Speed()
CC_SAFE_RELEASE(_innerAction);
}
Speed* Speed::create(ActionInterval* pAction, float fSpeed)
Speed* Speed::create(ActionInterval* action, float speed)
{
Speed *pRet = new Speed();
if (pRet && pRet->initWithAction(pAction, fSpeed))
Speed *ret = new Speed();
if (ret && ret->initWithAction(action, speed))
{
pRet->autorelease();
return pRet;
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool Speed::initWithAction(ActionInterval *pAction, float fSpeed)
bool Speed::initWithAction(ActionInterval *action, float speed)
{
CCASSERT(pAction != NULL, "");
pAction->retain();
_innerAction = pAction;
_speed = fSpeed;
CCASSERT(action != nullptr, "");
action->retain();
_innerAction = action;
_speed = speed;
return true;
}
@ -150,12 +150,12 @@ Speed *Speed::reverse() const
return Speed::create(_innerAction->reverse(), _speed);
}
void Speed::setInnerAction(ActionInterval *pAction)
void Speed::setInnerAction(ActionInterval *action)
{
if (_innerAction != pAction)
if (_innerAction != action)
{
CC_SAFE_RELEASE(_innerAction);
_innerAction = pAction;
_innerAction = action;
CC_SAFE_RETAIN(_innerAction);
}
}
@ -168,16 +168,16 @@ Follow::~Follow()
CC_SAFE_RELEASE(_followedNode);
}
Follow* Follow::create(Node *pFollowedNode, const Rect& rect/* = Rect::ZERO*/)
Follow* Follow::create(Node *followedNode, const Rect& rect/* = Rect::ZERO*/)
{
Follow *pRet = new Follow();
if (pRet && pRet->initWithTarget(pFollowedNode, rect))
Follow *follow = new Follow();
if (follow && follow->initWithTarget(followedNode, rect))
{
pRet->autorelease();
return pRet;
follow->autorelease();
return follow;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(follow);
return nullptr;
}
Follow* Follow::clone() const
@ -194,12 +194,12 @@ Follow* Follow::reverse() const
return clone();
}
bool Follow::initWithTarget(Node *pFollowedNode, const Rect& rect/* = Rect::ZERO*/)
bool Follow::initWithTarget(Node *followedNode, const Rect& rect/* = Rect::ZERO*/)
{
CCASSERT(pFollowedNode != NULL, "");
CCASSERT(followedNode != nullptr, "");
pFollowedNode->retain();
_followedNode = pFollowedNode;
followedNode->retain();
_followedNode = followedNode;
_worldRect = rect;
if (rect.equals(Rect::ZERO))
{
@ -273,7 +273,7 @@ bool Follow::isDone() const
void Follow::stop()
{
_target = NULL;
_target = nullptr;
Action::stop();
}

View File

@ -49,12 +49,12 @@ public:
/**
* @js ctor
*/
Action(void);
Action();
/**
* @js NA
* @lua NA
*/
virtual ~Action(void);
virtual ~Action();
/**
* @js NA
* @lua NA
@ -68,7 +68,7 @@ public:
virtual Action* reverse() const = 0;
//! return true if the action has finished
virtual bool isDone(void) const;
virtual bool isDone() const;
//! called before the action start. It will also set the target.
virtual void startWithTarget(Node *target);
@ -77,7 +77,7 @@ public:
called after the action has finished. It will set the 'target' to nil.
IMPORTANT: You should never call "[action stop]" manually. Instead, use: "target->stopAction(action);"
*/
virtual void stop(void);
virtual void stop();
//! called every frame with it's delta time. DON'T override unless you know what you are doing.
virtual void step(float dt);
@ -92,20 +92,20 @@ public:
*/
virtual void update(float time);
inline Node* getTarget(void) const { return _target; }
inline Node* getTarget() const { return _target; }
/** The action will modify the target properties. */
inline void setTarget(Node *target) { _target = target; }
inline Node* getOriginalTarget(void) const { return _originalTarget; }
inline Node* getOriginalTarget() const { return _originalTarget; }
/** Set the original target, since target can be nil.
Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method.
The target is 'assigned', it is not 'retained'.
@since v0.8.2
*/
inline void setOriginalTarget(Node *pOriginalTarget) { _originalTarget = pOriginalTarget; }
inline void setOriginalTarget(Node *originalTarget) { _originalTarget = originalTarget; }
inline int getTag(void) const { return _tag; }
inline void setTag(int nTag) { _tag = nTag; }
inline int getTag() const { return _tag; }
inline void setTag(int tag) { _tag = tag; }
protected:
Node *_originalTarget;
@ -143,7 +143,7 @@ public:
*/
virtual ~FiniteTimeAction(){}
//! get duration in seconds of the action
inline float getDuration(void) const { return _duration; }
inline float getDuration() const { return _duration; }
//! set duration in seconds of the action
inline void setDuration(float duration) { _duration = duration; }
@ -171,7 +171,7 @@ class CC_DLL Speed : public Action
{
public:
/** create the action */
static Speed* create(ActionInterval* pAction, float fSpeed);
static Speed* create(ActionInterval* action, float speed);
/**
* @js ctor
*/
@ -184,12 +184,12 @@ public:
inline float getSpeed(void) const { return _speed; }
/** alter the speed of the inner function in runtime */
inline void setSpeed(float fSpeed) { _speed = fSpeed; }
inline void setSpeed(float speed) { _speed = speed; }
/** initializes the action */
bool initWithAction(ActionInterval *pAction, float fSpeed);
bool initWithAction(ActionInterval *action, float speed);
void setInnerAction(ActionInterval *pAction);
void setInnerAction(ActionInterval *action);
inline ActionInterval* getInnerAction() const { return _innerAction; }
@ -201,7 +201,7 @@ public:
virtual void startWithTarget(Node* target) override;
virtual void stop() override;
virtual void step(float dt) override;
virtual bool isDone(void) const override;
virtual bool isDone() const override;
protected:
float _speed;
@ -234,7 +234,7 @@ public:
* @js ctor
*/
Follow()
: _followedNode(NULL)
: _followedNode(nullptr)
, _boundarySet(false)
, _boundaryFullyCovered(false)
, _leftBoundary(0.0)
@ -247,11 +247,11 @@ public:
* @js NA
* @lua NA
*/
virtual ~Follow(void);
virtual ~Follow();
inline bool isBoundarySet(void) const { return _boundarySet; }
inline bool isBoundarySet() const { return _boundarySet; }
/** alter behavior - turn on/off boundary */
inline void setBoudarySet(bool bValue) { _boundarySet = bValue; }
inline void setBoudarySet(bool value) { _boundarySet = value; }
/**
* Initializes the action with a set boundary or with no boundary.
@ -268,8 +268,8 @@ public:
virtual Follow* clone() const override;
virtual Follow* reverse() const override;
virtual void step(float dt) override;
virtual bool isDone(void) const override;
virtual void stop(void) override;
virtual bool isDone() const override;
virtual void stop() override;
protected:
// node to follow

View File

@ -62,13 +62,13 @@ ActionCamera * ActionCamera::reverse() const
OrbitCamera * OrbitCamera::create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX)
{
OrbitCamera * pRet = new OrbitCamera();
if(pRet->initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX))
OrbitCamera * obitCamera = new OrbitCamera();
if(obitCamera->initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX))
{
pRet->autorelease();
return pRet;
obitCamera->autorelease();
return obitCamera;
}
CC_SAFE_DELETE(pRet);
CC_SAFE_DELETE(obitCamera);
return NULL;
}
@ -134,9 +134,9 @@ void OrbitCamera::sphericalRadius(float *newRadius, float *zenith, float *azimut
float r; // radius
float s;
Camera* pCamera = _target->getCamera();
pCamera->getEye(&ex, &ey, &ez);
pCamera->getCenter(&cx, &cy, &cz);
Camera* camera = _target->getCamera();
camera->getEye(&ex, &ey, &ez);
camera->getCenter(&cx, &cy, &cz);
x = ex-cx;
y = ey-cy;

View File

@ -45,21 +45,21 @@ NS_CC_BEGIN;
PointArray* PointArray::create(unsigned int capacity)
{
PointArray* ret = new PointArray();
if (ret)
PointArray* pointArray = new PointArray();
if (pointArray)
{
if (ret->initWithCapacity(capacity))
if (pointArray->initWithCapacity(capacity))
{
ret->autorelease();
pointArray->autorelease();
}
else
{
delete ret;
ret = NULL;
delete pointArray;
pointArray = nullptr;
}
}
return ret;
return pointArray;
}
@ -99,7 +99,7 @@ PointArray::~PointArray()
delete _controlPoints;
}
PointArray::PointArray() :_controlPoints(NULL){}
PointArray::PointArray() :_controlPoints(nullptr){}
const std::vector<Point*>* PointArray::getControlPoints() const
{
@ -108,7 +108,7 @@ const std::vector<Point*>* PointArray::getControlPoints() const
void PointArray::setControlPoints(vector<Point*> *controlPoints)
{
CCASSERT(controlPoints != NULL, "control points should not be NULL");
CCASSERT(controlPoints != nullptr, "control points should not be nullptr");
// delete old points
vector<Point*>::iterator iter;
@ -163,7 +163,7 @@ PointArray* PointArray::reverse() const
{
vector<Point*> *newArray = new vector<Point*>();
vector<Point*>::reverse_iterator iter;
Point *point = NULL;
Point *point = nullptr;
for (iter = _controlPoints->rbegin(); iter != _controlPoints->rend(); ++iter)
{
point = *iter;
@ -178,8 +178,8 @@ PointArray* PointArray::reverse() const
void PointArray::reverseInline()
{
unsigned long l = _controlPoints->size();
Point *p1 = NULL;
Point *p2 = NULL;
Point *p1 = nullptr;
Point *p2 = nullptr;
int x, y;
for (unsigned int i = 0; i < l/2; ++i)
{
@ -261,7 +261,7 @@ CardinalSplineTo::~CardinalSplineTo()
}
CardinalSplineTo::CardinalSplineTo()
: _points(NULL)
: _points(nullptr)
, _deltaT(0.f)
, _tension(0.f)
{
@ -540,27 +540,27 @@ CatmullRomBy* CatmullRomBy::reverse() const
// convert to "diffs" to "reverse absolute"
PointArray *pReverse = copyConfig->reverse();
PointArray *reverse = copyConfig->reverse();
// 1st element (which should be 0,0) should be here too
p = pReverse->getControlPointAtIndex(pReverse->count()-1);
pReverse->removeControlPointAtIndex(pReverse->count()-1);
p = reverse->getControlPointAtIndex(reverse->count()-1);
reverse->removeControlPointAtIndex(reverse->count()-1);
p = -p;
pReverse->insertControlPoint(p, 0);
reverse->insertControlPoint(p, 0);
for (unsigned int i = 1; i < pReverse->count(); ++i)
for (unsigned int i = 1; i < reverse->count(); ++i)
{
Point current = pReverse->getControlPointAtIndex(i);
Point current = reverse->getControlPointAtIndex(i);
current = -current;
Point abs = current + p;
pReverse->replaceControlPoint(abs, i);
reverse->replaceControlPoint(abs, i);
p = abs;
}
return CatmullRomBy::create(_duration, pReverse);
return CatmullRomBy::create(_duration, reverse);
}
NS_CC_END;

View File

@ -42,14 +42,14 @@ NS_CC_BEGIN
// EaseAction
//
bool ActionEase::initWithAction(ActionInterval *pAction)
bool ActionEase::initWithAction(ActionInterval *action)
{
CCASSERT(pAction != NULL, "");
CCASSERT(action != nullptr, "");
if (ActionInterval::initWithDuration(pAction->getDuration()))
if (ActionInterval::initWithDuration(action->getDuration()))
{
_inner = pAction;
pAction->retain();
_inner = action;
action->retain();
return true;
}
@ -88,18 +88,18 @@ ActionInterval* ActionEase::getInnerAction()
// EaseRateAction
//
bool EaseRateAction::initWithAction(ActionInterval *pAction, float fRate)
bool EaseRateAction::initWithAction(ActionInterval *action, float rate)
{
if (ActionEase::initWithAction(pAction))
if (ActionEase::initWithAction(action))
{
_rate = fRate;
_rate = rate;
return true;
}
return false;
}
EaseRateAction::~EaseRateAction(void)
EaseRateAction::~EaseRateAction()
{
}
@ -107,22 +107,22 @@ EaseRateAction::~EaseRateAction(void)
// EeseIn
//
EaseIn* EaseIn::create(ActionInterval *pAction, float fRate)
EaseIn* EaseIn::create(ActionInterval *action, float rate)
{
EaseIn *pRet = new EaseIn();
if (pRet)
EaseIn *easeIn = new EaseIn();
if (easeIn)
{
if (pRet->initWithAction(pAction, fRate))
if (easeIn->initWithAction(action, rate))
{
pRet->autorelease();
easeIn->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(easeIn);
}
}
return pRet;
return easeIn;
}
EaseIn* EaseIn::clone() const
@ -147,22 +147,22 @@ EaseIn* EaseIn::reverse() const
//
// EaseOut
//
EaseOut* EaseOut::create(ActionInterval *pAction, float fRate)
EaseOut* EaseOut::create(ActionInterval *action, float rate)
{
EaseOut *pRet = new EaseOut();
if (pRet)
EaseOut *easeOut = new EaseOut();
if (easeOut)
{
if (pRet->initWithAction(pAction, fRate))
if (easeOut->initWithAction(action, rate))
{
pRet->autorelease();
easeOut->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(easeOut);
}
}
return pRet;
return easeOut;
}
EaseOut* EaseOut::clone() const
@ -187,22 +187,22 @@ EaseOut* EaseOut::reverse() const
//
// EaseInOut
//
EaseInOut* EaseInOut::create(ActionInterval *pAction, float fRate)
EaseInOut* EaseInOut::create(ActionInterval *action, float rate)
{
EaseInOut *pRet = new EaseInOut();
if (pRet)
EaseInOut *easeInOut = new EaseInOut();
if (easeInOut)
{
if (pRet->initWithAction(pAction, fRate))
if (easeInOut->initWithAction(action, rate))
{
pRet->autorelease();
easeInOut->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(easeInOut);
}
}
return pRet;
return easeInOut;
}
EaseInOut* EaseInOut::clone() const
@ -236,22 +236,22 @@ EaseInOut* EaseInOut::reverse() const
//
// EaseExponentialIn
//
EaseExponentialIn* EaseExponentialIn::create(ActionInterval* pAction)
EaseExponentialIn* EaseExponentialIn::create(ActionInterval* action)
{
EaseExponentialIn *pRet = new EaseExponentialIn();
if (pRet)
EaseExponentialIn *ret = new EaseExponentialIn();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseExponentialIn* EaseExponentialIn::clone() const
@ -276,22 +276,22 @@ ActionEase * EaseExponentialIn::reverse() const
//
// EaseExponentialOut
//
EaseExponentialOut* EaseExponentialOut::create(ActionInterval* pAction)
EaseExponentialOut* EaseExponentialOut::create(ActionInterval* action)
{
EaseExponentialOut *pRet = new EaseExponentialOut();
if (pRet)
EaseExponentialOut *ret = new EaseExponentialOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseExponentialOut* EaseExponentialOut::clone() const
@ -317,22 +317,22 @@ ActionEase* EaseExponentialOut::reverse() const
// EaseExponentialInOut
//
EaseExponentialInOut* EaseExponentialInOut::create(ActionInterval *pAction)
EaseExponentialInOut* EaseExponentialInOut::create(ActionInterval *action)
{
EaseExponentialInOut *pRet = new EaseExponentialInOut();
if (pRet)
EaseExponentialInOut *ret = new EaseExponentialInOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseExponentialInOut* EaseExponentialInOut::clone() const
@ -368,22 +368,22 @@ EaseExponentialInOut* EaseExponentialInOut::reverse() const
// EaseSineIn
//
EaseSineIn* EaseSineIn::create(ActionInterval* pAction)
EaseSineIn* EaseSineIn::create(ActionInterval* action)
{
EaseSineIn *pRet = new EaseSineIn();
if (pRet)
EaseSineIn *ret = new EaseSineIn();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseSineIn* EaseSineIn::clone() const
@ -409,22 +409,22 @@ ActionEase* EaseSineIn::reverse() const
// EaseSineOut
//
EaseSineOut* EaseSineOut::create(ActionInterval* pAction)
EaseSineOut* EaseSineOut::create(ActionInterval* action)
{
EaseSineOut *pRet = new EaseSineOut();
if (pRet)
EaseSineOut *ret = new EaseSineOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseSineOut* EaseSineOut::clone() const
@ -450,22 +450,22 @@ ActionEase* EaseSineOut::reverse(void) const
// EaseSineInOut
//
EaseSineInOut* EaseSineInOut::create(ActionInterval* pAction)
EaseSineInOut* EaseSineInOut::create(ActionInterval* action)
{
EaseSineInOut *pRet = new EaseSineInOut();
if (pRet)
EaseSineInOut *ret = new EaseSineInOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseSineInOut* EaseSineInOut::clone() const
@ -491,11 +491,11 @@ EaseSineInOut* EaseSineInOut::reverse() const
// EaseElastic
//
bool EaseElastic::initWithAction(ActionInterval *pAction, float fPeriod/* = 0.3f*/)
bool EaseElastic::initWithAction(ActionInterval *action, float period/* = 0.3f*/)
{
if (ActionEase::initWithAction(pAction))
if (ActionEase::initWithAction(action))
{
_period = fPeriod;
_period = period;
return true;
}
@ -506,27 +506,27 @@ bool EaseElastic::initWithAction(ActionInterval *pAction, float fPeriod/* = 0.3f
// EaseElasticIn
//
EaseElasticIn* EaseElasticIn::create(ActionInterval *pAction)
EaseElasticIn* EaseElasticIn::create(ActionInterval *action)
{
return EaseElasticIn::create(pAction, 0.3f);
return EaseElasticIn::create(action, 0.3f);
}
EaseElasticIn* EaseElasticIn::create(ActionInterval *pAction, float fPeriod/* = 0.3f*/)
EaseElasticIn* EaseElasticIn::create(ActionInterval *action, float period/* = 0.3f*/)
{
EaseElasticIn *pRet = new EaseElasticIn();
if (pRet)
EaseElasticIn *ret = new EaseElasticIn();
if (ret)
{
if (pRet->initWithAction(pAction, fPeriod))
if (ret->initWithAction(action, period))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseElasticIn* EaseElasticIn::clone() const
@ -564,27 +564,27 @@ EaseElastic* EaseElasticIn::reverse() const
// EaseElasticOut
//
EaseElasticOut* EaseElasticOut::create(ActionInterval *pAction)
EaseElasticOut* EaseElasticOut::create(ActionInterval *action)
{
return EaseElasticOut::create(pAction, 0.3f);
return EaseElasticOut::create(action, 0.3f);
}
EaseElasticOut* EaseElasticOut::create(ActionInterval *pAction, float fPeriod/* = 0.3f*/)
EaseElasticOut* EaseElasticOut::create(ActionInterval *action, float period/* = 0.3f*/)
{
EaseElasticOut *pRet = new EaseElasticOut();
if (pRet)
EaseElasticOut *ret = new EaseElasticOut();
if (ret)
{
if (pRet->initWithAction(pAction, fPeriod))
if (ret->initWithAction(action, period))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseElasticOut* EaseElasticOut::clone() const
@ -621,27 +621,27 @@ EaseElastic* EaseElasticOut::reverse() const
// EaseElasticInOut
//
EaseElasticInOut* EaseElasticInOut::create(ActionInterval *pAction)
EaseElasticInOut* EaseElasticInOut::create(ActionInterval *action)
{
return EaseElasticInOut::create(pAction, 0.3f);
return EaseElasticInOut::create(action, 0.3f);
}
EaseElasticInOut* EaseElasticInOut::create(ActionInterval *pAction, float fPeriod/* = 0.3f*/)
EaseElasticInOut* EaseElasticInOut::create(ActionInterval *action, float period/* = 0.3f*/)
{
EaseElasticInOut *pRet = new EaseElasticInOut();
if (pRet)
EaseElasticInOut *ret = new EaseElasticInOut();
if (ret)
{
if (pRet->initWithAction(pAction, fPeriod))
if (ret->initWithAction(action, period))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseElasticInOut* EaseElasticInOut::clone() const
@ -718,22 +718,22 @@ float EaseBounce::bounceTime(float time)
// EaseBounceIn
//
EaseBounceIn* EaseBounceIn::create(ActionInterval* pAction)
EaseBounceIn* EaseBounceIn::create(ActionInterval* action)
{
EaseBounceIn *pRet = new EaseBounceIn();
if (pRet)
EaseBounceIn *ret = new EaseBounceIn();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseBounceIn* EaseBounceIn::clone() const
@ -760,22 +760,22 @@ EaseBounce* EaseBounceIn::reverse() const
// EaseBounceOut
//
EaseBounceOut* EaseBounceOut::create(ActionInterval* pAction)
EaseBounceOut* EaseBounceOut::create(ActionInterval* action)
{
EaseBounceOut *pRet = new EaseBounceOut();
if (pRet)
EaseBounceOut *ret = new EaseBounceOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseBounceOut* EaseBounceOut::clone() const
@ -802,22 +802,22 @@ EaseBounce* EaseBounceOut::reverse() const
// EaseBounceInOut
//
EaseBounceInOut* EaseBounceInOut::create(ActionInterval* pAction)
EaseBounceInOut* EaseBounceInOut::create(ActionInterval* action)
{
EaseBounceInOut *pRet = new EaseBounceInOut();
if (pRet)
EaseBounceInOut *ret = new EaseBounceInOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseBounceInOut* EaseBounceInOut::clone() const
@ -854,22 +854,22 @@ EaseBounceInOut* EaseBounceInOut::reverse() const
// EaseBackIn
//
EaseBackIn* EaseBackIn::create(ActionInterval *pAction)
EaseBackIn* EaseBackIn::create(ActionInterval *action)
{
EaseBackIn *pRet = new EaseBackIn();
if (pRet)
EaseBackIn *ret = new EaseBackIn();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseBackIn* EaseBackIn::clone() const
@ -896,22 +896,22 @@ ActionEase* EaseBackIn::reverse() const
// EaseBackOut
//
EaseBackOut* EaseBackOut::create(ActionInterval* pAction)
EaseBackOut* EaseBackOut::create(ActionInterval* action)
{
EaseBackOut *pRet = new EaseBackOut();
if (pRet)
EaseBackOut *ret = new EaseBackOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseBackOut* EaseBackOut::clone() const
@ -940,22 +940,22 @@ ActionEase* EaseBackOut::reverse() const
// EaseBackInOut
//
EaseBackInOut* EaseBackInOut::create(ActionInterval* pAction)
EaseBackInOut* EaseBackInOut::create(ActionInterval* action)
{
EaseBackInOut *pRet = new EaseBackInOut();
if (pRet)
EaseBackInOut *ret = new EaseBackInOut();
if (ret)
{
if (pRet->initWithAction(pAction))
if (ret->initWithAction(action))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
CC_SAFE_RELEASE_NULL(ret);
}
}
return pRet;
return ret;
}
EaseBackInOut* EaseBackInOut::clone() const

View File

@ -51,7 +51,7 @@ public:
virtual ~ActionEase(void);
/** initializes the action */
bool initWithAction(ActionInterval *pAction);
bool initWithAction(ActionInterval *action);
virtual ActionInterval* getInnerAction();
@ -61,7 +61,7 @@ public:
virtual ActionEase* clone() const override = 0;
virtual ActionEase* reverse() const override = 0;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
virtual void stop() override;
virtual void update(float time) override;
protected:
@ -80,7 +80,7 @@ public:
* @js NA
* @lua NA
*/
virtual ~EaseRateAction(void);
virtual ~EaseRateAction();
/** Initializes the action with the inner action and the rate parameter */
bool initWithAction(ActionInterval *pAction, float fRate);
@ -88,7 +88,7 @@ public:
/** set rate value for the actions */
inline void setRate(float rate) { _rate = rate; }
/** get rate value for the actions */
inline float getRate(void) const { return _rate; }
inline float getRate() const { return _rate; }
//
// Overrides
@ -108,7 +108,7 @@ class CC_DLL EaseIn : public EaseRateAction
{
public:
/** Creates the action with the inner action and the rate parameter */
static EaseIn* create(ActionInterval* pAction, float fRate);
static EaseIn* create(ActionInterval* action, float rate);
// Overrides
virtual void update(float time) override;
@ -124,7 +124,7 @@ class CC_DLL EaseOut : public EaseRateAction
{
public:
/** Creates the action with the inner action and the rate parameter */
static EaseOut* create(ActionInterval* pAction, float fRate);
static EaseOut* create(ActionInterval* action, float rate);
// Overrides
virtual void update(float time) override;
@ -140,7 +140,7 @@ class CC_DLL EaseInOut : public EaseRateAction
{
public:
/** Creates the action with the inner action and the rate parameter */
static EaseInOut* create(ActionInterval* pAction, float fRate);
static EaseInOut* create(ActionInterval* action, float rate);
// Overrides
virtual void update(float time) override;
@ -156,7 +156,7 @@ class CC_DLL EaseExponentialIn : public ActionEase
{
public:
/** creates the action */
static EaseExponentialIn* create(ActionInterval* pAction);
static EaseExponentialIn* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -172,7 +172,7 @@ class CC_DLL EaseExponentialOut : public ActionEase
{
public:
/** creates the action */
static EaseExponentialOut* create(ActionInterval* pAction);
static EaseExponentialOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -188,7 +188,7 @@ class CC_DLL EaseExponentialInOut : public ActionEase
{
public:
/** creates the action */
static EaseExponentialInOut* create(ActionInterval* pAction);
static EaseExponentialInOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -204,7 +204,7 @@ class CC_DLL EaseSineIn : public ActionEase
{
public:
/** creates the action */
static EaseSineIn* create(ActionInterval* pAction);
static EaseSineIn* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -220,7 +220,7 @@ class CC_DLL EaseSineOut : public ActionEase
{
public:
/** creates the action */
static EaseSineOut* create(ActionInterval* pAction);
static EaseSineOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -236,7 +236,7 @@ class CC_DLL EaseSineInOut : public ActionEase
{
public:
/** creates the action */
static EaseSineInOut* create(ActionInterval* pAction);
static EaseSineInOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -253,10 +253,10 @@ class CC_DLL EaseElastic : public ActionEase
{
public:
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
bool initWithAction(ActionInterval *pAction, float fPeriod = 0.3f);
bool initWithAction(ActionInterval *action, float period = 0.3f);
/** get period of the wave in radians. default is 0.3 */
inline float getPeriod(void) const { return _period; }
inline float getPeriod() const { return _period; }
/** set period of the wave in radians. */
inline void setPeriod(float fPeriod) { _period = fPeriod; }
@ -280,8 +280,8 @@ class CC_DLL EaseElasticIn : public EaseElastic
{
public:
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static EaseElasticIn* create(ActionInterval *pAction, float fPeriod);
static EaseElasticIn* create(ActionInterval *pAction);
static EaseElasticIn* create(ActionInterval *action, float period);
static EaseElasticIn* create(ActionInterval *action);
// Overrides
virtual void update(float time) override;
@ -299,8 +299,8 @@ class CC_DLL EaseElasticOut : public EaseElastic
{
public:
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static EaseElasticOut* create(ActionInterval *pAction, float fPeriod);
static EaseElasticOut* create(ActionInterval *pAction);
static EaseElasticOut* create(ActionInterval *action, float period);
static EaseElasticOut* create(ActionInterval *action);
// Overrides
virtual void update(float time) override;
@ -318,8 +318,8 @@ class CC_DLL EaseElasticInOut : public EaseElastic
{
public:
/** Creates the action with the inner action and the period in radians (default is 0.3) */
static EaseElasticInOut* create(ActionInterval *pAction, float fPeriod);
static EaseElasticInOut* create(ActionInterval *pAction);
static EaseElasticInOut* create(ActionInterval *action, float period);
static EaseElasticInOut* create(ActionInterval *action);
// Overrides
virtual void update(float time) override;
@ -352,7 +352,7 @@ class CC_DLL EaseBounceIn : public EaseBounce
{
public:
/** creates the action */
static EaseBounceIn* create(ActionInterval* pAction);
static EaseBounceIn* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -370,7 +370,7 @@ class CC_DLL EaseBounceOut : public EaseBounce
{
public:
/** creates the action */
static EaseBounceOut* create(ActionInterval* pAction);
static EaseBounceOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -388,7 +388,7 @@ class CC_DLL EaseBounceInOut : public EaseBounce
{
public:
/** creates the action */
static EaseBounceInOut* create(ActionInterval* pAction);
static EaseBounceInOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -406,7 +406,7 @@ class CC_DLL EaseBackIn : public ActionEase
{
public:
/** creates the action */
static EaseBackIn* create(ActionInterval* pAction);
static EaseBackIn* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -424,7 +424,7 @@ class CC_DLL EaseBackOut : public ActionEase
{
public:
/** creates the action */
static EaseBackOut* create(ActionInterval* pAction);
static EaseBackOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;
@ -442,7 +442,7 @@ class CC_DLL EaseBackInOut : public ActionEase
{
public:
/** creates the action */
static EaseBackInOut* create(ActionInterval* pAction);
static EaseBackInOut* create(ActionInterval* action);
// Overrides
virtual void update(float time) override;

View File

@ -80,17 +80,17 @@ GridAction* GridAction::reverse() const
return (GridAction*)ReverseTime::create( this->clone() );
}
GridBase* GridAction::getGrid(void)
GridBase* GridAction::getGrid()
{
// Abstract class needs implementation
CCASSERT(0, "");
return NULL;
return nullptr;
}
// implementation of Grid3DAction
GridBase* Grid3DAction::getGrid(void)
GridBase* Grid3DAction::getGrid()
{
return Grid3D::create(_gridSize);
}
@ -140,31 +140,31 @@ void TiledGrid3DAction::setTile(const Point& pos, const Quad3& coords)
// implementation AccelDeccelAmplitude
AccelDeccelAmplitude* AccelDeccelAmplitude::create(Action *pAction, float duration)
AccelDeccelAmplitude* AccelDeccelAmplitude::create(Action *action, float duration)
{
AccelDeccelAmplitude *pRet = new AccelDeccelAmplitude();
if (pRet)
AccelDeccelAmplitude *ret = new AccelDeccelAmplitude();
if (ret)
{
if (pRet->initWithAction(pAction, duration))
if (ret->initWithAction(action, duration))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
CC_SAFE_DELETE(ret);
}
}
return pRet;
return ret;
}
bool AccelDeccelAmplitude::initWithAction(Action *pAction, float duration)
bool AccelDeccelAmplitude::initWithAction(Action *action, float duration)
{
if (ActionInterval::initWithDuration(duration))
{
_rate = 1.0f;
_other = (ActionInterval*)(pAction);
pAction->retain();
_other = (ActionInterval*)(action);
action->retain();
return true;
}
@ -181,7 +181,7 @@ AccelDeccelAmplitude* AccelDeccelAmplitude::clone() const
return a;
}
AccelDeccelAmplitude::~AccelDeccelAmplitude(void)
AccelDeccelAmplitude::~AccelDeccelAmplitude()
{
CC_SAFE_RELEASE(_other);
}
@ -212,31 +212,31 @@ AccelDeccelAmplitude* AccelDeccelAmplitude::reverse() const
// implementation of AccelAmplitude
AccelAmplitude* AccelAmplitude::create(Action *pAction, float duration)
AccelAmplitude* AccelAmplitude::create(Action *action, float duration)
{
AccelAmplitude *pRet = new AccelAmplitude();
if (pRet)
AccelAmplitude *ret = new AccelAmplitude();
if (ret)
{
if (pRet->initWithAction(pAction, duration))
if (ret->initWithAction(action, duration))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
CC_SAFE_DELETE(ret);
}
}
return pRet;
return ret;
}
bool AccelAmplitude::initWithAction(Action *pAction, float duration)
bool AccelAmplitude::initWithAction(Action *action, float duration)
{
if (ActionInterval::initWithDuration(duration))
{
_rate = 1.0f;
_other = (ActionInterval*)(pAction);
pAction->retain();
_other = (ActionInterval*)(action);
action->retain();
return true;
}
@ -277,31 +277,31 @@ AccelAmplitude* AccelAmplitude::reverse() const
// DeccelAmplitude
DeccelAmplitude* DeccelAmplitude::create(Action *pAction, float duration)
DeccelAmplitude* DeccelAmplitude::create(Action *action, float duration)
{
DeccelAmplitude *pRet = new DeccelAmplitude();
if (pRet)
DeccelAmplitude *ret = new DeccelAmplitude();
if (ret)
{
if (pRet->initWithAction(pAction, duration))
if (ret->initWithAction(action, duration))
{
pRet->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
CC_SAFE_DELETE(ret);
}
}
return pRet;
return ret;
}
bool DeccelAmplitude::initWithAction(Action *pAction, float duration)
bool DeccelAmplitude::initWithAction(Action *action, float duration)
{
if (ActionInterval::initWithDuration(duration))
{
_rate = 1.0f;
_other = (ActionInterval*)(pAction);
pAction->retain();
_other = (ActionInterval*)(action);
action->retain();
return true;
}
@ -309,7 +309,7 @@ bool DeccelAmplitude::initWithAction(Action *pAction, float duration)
return false;
}
DeccelAmplitude::~DeccelAmplitude(void)
DeccelAmplitude::~DeccelAmplitude()
{
CC_SAFE_RELEASE(_other);
}
@ -346,14 +346,14 @@ void StopGrid::startWithTarget(Node *target)
{
ActionInstant::startWithTarget(target);
GridBase *pGrid = _target->getGrid();
if (pGrid && pGrid->isActive())
GridBase *grid = _target->getGrid();
if (grid && grid->isActive())
{
pGrid->setActive(false);
grid->setActive(false);
}
}
StopGrid* StopGrid::create(void)
StopGrid* StopGrid::create()
{
StopGrid* pAction = new StopGrid();
pAction->autorelease();
@ -376,20 +376,20 @@ StopGrid* StopGrid::reverse() const
ReuseGrid* ReuseGrid::create(int times)
{
ReuseGrid *pAction = new ReuseGrid();
if (pAction)
ReuseGrid *action = new ReuseGrid();
if (action)
{
if (pAction->initWithTimes(times))
if (action->initWithTimes(times))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_DELETE(pAction);
CC_SAFE_DELETE(action);
}
}
return pAction;
return action;
}
bool ReuseGrid::initWithTimes(int times)

View File

@ -65,7 +65,7 @@ class CC_DLL Grid3DAction : public GridAction
public:
/** returns the grid */
virtual GridBase* getGrid(void);
virtual GridBase* getGrid();
/** returns the vertex than belongs to certain position in the grid
* @js NA
* @lua NA
@ -141,7 +141,7 @@ public:
void setTile(const Point& position, const Quad3& coords);
/** returns the grid */
virtual GridBase* getGrid(void);
virtual GridBase* getGrid();
// Override
virtual TiledGrid3DAction * clone() const override = 0;
@ -152,12 +152,12 @@ class CC_DLL AccelDeccelAmplitude : public ActionInterval
{
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
static AccelDeccelAmplitude* create(Action *pAction, float duration);
static AccelDeccelAmplitude* create(Action *action, float duration);
/**
* @js NA
* @lua NA
*/
virtual ~AccelDeccelAmplitude(void);
virtual ~AccelDeccelAmplitude();
/** initializes the action with an inner action that has the amplitude property, and a duration time */
bool initWithAction(Action *pAction, float duration);
@ -185,20 +185,20 @@ class CC_DLL AccelAmplitude : public ActionInterval
{
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
static AccelAmplitude* create(Action *pAction, float duration);
static AccelAmplitude* create(Action *action, float duration);
/**
* @js NA
* @lua NA
*/
virtual ~AccelAmplitude(void);
virtual ~AccelAmplitude();
/** initializes the action with an inner action that has the amplitude property, and a duration time */
bool initWithAction(Action *pAction, float duration);
bool initWithAction(Action *action, float duration);
/** get amplitude rate */
inline float getRate(void) const { return _rate; }
inline float getRate() const { return _rate; }
/** set amplitude rate */
inline void setRate(float fRate) { _rate = fRate; }
inline void setRate(float rate) { _rate = rate; }
// Overrides
virtual void startWithTarget(Node *target) override;
@ -216,19 +216,19 @@ class CC_DLL DeccelAmplitude : public ActionInterval
{
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
static DeccelAmplitude* create(Action *pAction, float duration);
static DeccelAmplitude* create(Action *action, float duration);
/**
* @js NA
* @lua NA
*/
virtual ~DeccelAmplitude();
/** initializes the action with an inner action that has the amplitude property, and a duration time */
bool initWithAction(Action *pAction, float duration);
bool initWithAction(Action *action, float duration);
/** get amplitude rate */
inline float getRate(void) const { return _rate; }
/** set amplitude rate */
inline void setRate(float fRate) { _rate = fRate; }
inline void setRate(float rate) { _rate = rate; }
// overrides
virtual void startWithTarget(Node *target) override;
@ -250,7 +250,7 @@ class CC_DLL StopGrid : public ActionInstant
{
public:
/** Allocates and initializes the action */
static StopGrid* create(void);
static StopGrid* create();
// Overrides
virtual void startWithTarget(Node *target) override;

View File

@ -90,21 +90,21 @@ void Waves3D::update(float time)
FlipX3D* FlipX3D::create(float duration)
{
FlipX3D *pAction = new FlipX3D();
FlipX3D *action = new FlipX3D();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration))
if (action->initWithDuration(duration))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool FlipX3D::initWithDuration(float duration)
@ -148,7 +148,7 @@ void FlipX3D::update(float time)
float x0 = v0.x;
float x1 = v1.x;
float x;
float x;
Point a, b, c, d;
if ( x0 > x1 )
@ -211,21 +211,21 @@ FlipY3D* FlipY3D::clone() const
FlipY3D* FlipY3D::create(float duration)
{
FlipY3D *pAction = new FlipY3D();
FlipY3D *action = new FlipY3D();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration))
if (action->initWithDuration(duration))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
void FlipY3D::update(float time)
@ -297,21 +297,21 @@ void FlipY3D::update(float time)
Lens3D* Lens3D::create(float duration, const Size& gridSize, const Point& position, float radius)
{
Lens3D *pAction = new Lens3D();
Lens3D *action = new Lens3D();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration, gridSize, position, radius))
if (action->initWithDuration(duration, gridSize, position, radius))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool Lens3D::initWithDuration(float duration, const Size& gridSize, const Point& position, float radius)
@ -396,21 +396,21 @@ void Lens3D::update(float time)
Ripple3D* Ripple3D::create(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude)
{
Ripple3D *pAction = new Ripple3D();
Ripple3D *action = new Ripple3D();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration, gridSize, position, radius, waves, amplitude))
if (action->initWithDuration(duration, gridSize, position, radius, waves, amplitude))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool Ripple3D::initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude)
@ -472,21 +472,21 @@ void Ripple3D::update(float time)
Shaky3D* Shaky3D::create(float duration, const Size& gridSize, int range, bool shakeZ)
{
Shaky3D *pAction = new Shaky3D();
Shaky3D *action = new Shaky3D();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration, gridSize, range, shakeZ))
if (action->initWithDuration(duration, gridSize, range, shakeZ))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool Shaky3D::initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ)
@ -537,21 +537,21 @@ void Shaky3D::update(float time)
Liquid* Liquid::create(float duration, const Size& gridSize, unsigned int waves, float amplitude)
{
Liquid *pAction = new Liquid();
Liquid *action = new Liquid();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration, gridSize, waves, amplitude))
if (action->initWithDuration(duration, gridSize, waves, amplitude))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool Liquid::initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude)
@ -597,21 +597,21 @@ void Liquid::update(float time)
Waves* Waves::create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical)
{
Waves *pAction = new Waves();
Waves *action = new Waves();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration, gridSize, waves, amplitude, horizontal, vertical))
if (action->initWithDuration(duration, gridSize, waves, amplitude, horizontal, vertical))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool Waves::initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical)
@ -668,21 +668,21 @@ void Waves::update(float time)
Twirl* Twirl::create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude)
{
Twirl *pAction = new Twirl();
Twirl *action = new Twirl();
if (pAction)
if (action)
{
if (pAction->initWithDuration(duration, gridSize, position, twirls, amplitude))
if (action->initWithDuration(duration, gridSize, position, twirls, amplitude))
{
pAction->autorelease();
action->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pAction);
CC_SAFE_RELEASE_NULL(action);
}
}
return pAction;
return action;
}
bool Twirl::initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude)

View File

@ -44,14 +44,14 @@ public:
static Waves3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
/** returns the amplitude of the effect */
inline float getAmplitude(void) const { return _amplitude; }
inline float getAmplitude() const { return _amplitude; }
/** sets the amplitude to the effect */
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
/** returns the amplitude rate */
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
inline float getAmplitudeRate() const { return _amplitudeRate; }
/** sets the ampliture rate */
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
/** initializes an action with duration, grid size, waves and amplitude */
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
@ -102,13 +102,13 @@ public:
static Lens3D* create(float duration, const Size& gridSize, const Point& position, float radius);
/** Get lens center position */
inline float getLensEffect(void) const { return _lensEffect; }
inline float getLensEffect() const { return _lensEffect; }
/** Set lens center position */
inline void setLensEffect(float fLensEffect) { _lensEffect = fLensEffect; }
inline void setLensEffect(float lensEffect) { _lensEffect = lensEffect; }
/** Set whether lens is concave */
inline void setConcave(bool bConcave) { _concave = bConcave; }
inline void setConcave(bool concave) { _concave = concave; }
inline const Point& getPosition(void) const { return _position; }
inline const Point& getPosition() const { return _position; }
void setPosition(const Point& position);
/** initializes the action with center position, radius, a grid size and duration */
@ -138,14 +138,14 @@ public:
static Ripple3D* create(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
/** get center position */
inline const Point& getPosition(void) const { return _position; }
inline const Point& getPosition() const { return _position; }
/** set center position */
void setPosition(const Point& position);
inline float getAmplitude(void) const { return _amplitude; }
inline float getAmplitude() const { return _amplitude; }
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
inline float getAmplitudeRate() const { return _amplitudeRate; }
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
@ -190,11 +190,11 @@ public:
/** creates the action with amplitude, a grid and duration */
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
inline float getAmplitude(void) const { return _amplitude; }
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
inline float getAmplitude() const { return _amplitude; }
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
inline float getAmplitudeRate() const { return _amplitudeRate; }
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
/** initializes the action with amplitude, a grid and duration */
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
@ -216,11 +216,11 @@ public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
inline float getAmplitude(void) const { return _amplitude; }
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
inline float getAmplitude() const { return _amplitude; }
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
inline float getAmplitudeRate() const { return _amplitudeRate; }
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
@ -245,15 +245,15 @@ public:
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
/** get twirl center */
inline const Point& getPosition(void) const { return _position; }
inline const Point& getPosition() const { return _position; }
/** set twirl center */
void setPosition(const Point& position);
inline float getAmplitude(void) const { return _amplitude; }
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
inline float getAmplitude() const { return _amplitude; }
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
inline float getAmplitudeRate(void) const { return _amplitudeRate; }
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
inline float getAmplitudeRate() const { return _amplitudeRate; }
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);

View File

@ -61,13 +61,13 @@ void ActionInstant::update(float time) {
Show* Show::create()
{
Show* pRet = new Show();
Show* ret = new Show();
if (pRet) {
pRet->autorelease();
if (ret) {
ret->autorelease();
}
return pRet;
return ret;
}
void Show::update(float time) {
@ -93,13 +93,13 @@ Show * Show::clone() const
//
Hide * Hide::create()
{
Hide *pRet = new Hide();
Hide *ret = new Hide();
if (pRet) {
pRet->autorelease();
if (ret) {
ret->autorelease();
}
return pRet;
return ret;
}
void Hide::update(float time) {
@ -125,14 +125,14 @@ Hide * Hide::clone() const
//
ToggleVisibility * ToggleVisibility::create()
{
ToggleVisibility *pRet = new ToggleVisibility();
ToggleVisibility *ret = new ToggleVisibility();
if (pRet)
if (ret)
{
pRet->autorelease();
ret->autorelease();
}
return pRet;
return ret;
}
void ToggleVisibility::update(float time)
@ -159,13 +159,13 @@ ToggleVisibility * ToggleVisibility::clone() const
//
RemoveSelf * RemoveSelf::create(bool isNeedCleanUp /*= true*/)
{
RemoveSelf *pRet = new RemoveSelf();
RemoveSelf *ret = new RemoveSelf();
if (pRet && pRet->init(isNeedCleanUp)) {
pRet->autorelease();
if (ret && ret->init(isNeedCleanUp)) {
ret->autorelease();
}
return pRet;
return ret;
}
bool RemoveSelf::init(bool isNeedCleanUp) {
@ -198,15 +198,15 @@ RemoveSelf * RemoveSelf::clone() const
FlipX *FlipX::create(bool x)
{
FlipX *pRet = new FlipX();
FlipX *ret = new FlipX();
if (pRet && pRet->initWithFlipX(x)) {
pRet->autorelease();
return pRet;
if (ret && ret->initWithFlipX(x)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool FlipX::initWithFlipX(bool x) {
@ -238,15 +238,15 @@ FlipX * FlipX::clone() const
FlipY * FlipY::create(bool y)
{
FlipY *pRet = new FlipY();
FlipY *ret = new FlipY();
if (pRet && pRet->initWithFlipY(y)) {
pRet->autorelease();
return pRet;
if (ret && ret->initWithFlipY(y)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool FlipY::initWithFlipY(bool y) {
@ -279,15 +279,15 @@ FlipY * FlipY::clone() const
Place* Place::create(const Point& pos)
{
Place *pRet = new Place();
Place *ret = new Place();
if (pRet && pRet->initWithPosition(pos)) {
pRet->autorelease();
return pRet;
if (ret && ret->initWithPosition(pos)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool Place::initWithPosition(const Point& pos) {
@ -321,29 +321,29 @@ void Place::update(float time) {
CallFunc * CallFunc::create(const std::function<void()> &func)
{
CallFunc *pRet = new CallFunc();
CallFunc *ret = new CallFunc();
if (pRet && pRet->initWithFunction(func) ) {
pRet->autorelease();
return pRet;
if (ret && ret->initWithFunction(func) ) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
CallFunc * CallFunc::create(Object* selectorTarget, SEL_CallFunc selector)
{
CallFunc *pRet = new CallFunc();
CallFunc *ret = new CallFunc();
if (pRet && pRet->initWithTarget(selectorTarget)) {
pRet->_callFunc = selector;
pRet->autorelease();
return pRet;
if (ret && ret->initWithTarget(selectorTarget)) {
ret->_callFunc = selector;
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool CallFunc::initWithFunction(const std::function<void()> &func)
@ -352,22 +352,22 @@ bool CallFunc::initWithFunction(const std::function<void()> &func)
return true;
}
bool CallFunc::initWithTarget(Object* selectorTarget) {
if (selectorTarget)
bool CallFunc::initWithTarget(Object* target) {
if (target)
{
selectorTarget->retain();
target->retain();
}
if (_selectorTarget)
if (target)
{
_selectorTarget->release();
target->release();
}
_selectorTarget = selectorTarget;
_selectorTarget = target;
return true;
}
CallFunc::~CallFunc(void)
CallFunc::~CallFunc()
{
CC_SAFE_RELEASE(_selectorTarget);
}
@ -427,16 +427,16 @@ CallFuncN * CallFuncN::create(const std::function<void(Node*)> &func)
// XXX deprecated
CallFuncN * CallFuncN::create(Object* selectorTarget, SEL_CallFuncN selector)
{
CallFuncN *pRet = new CallFuncN();
CallFuncN *ret = new CallFuncN();
if (pRet && pRet->initWithTarget(selectorTarget, selector))
if (ret && ret->initWithTarget(selectorTarget, selector))
{
pRet->autorelease();
return pRet;
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
void CallFuncN::execute() {
@ -486,15 +486,15 @@ CallFuncN * CallFuncN::clone() const
__CCCallFuncND * __CCCallFuncND::create(Object* selectorTarget, SEL_CallFuncND selector, void* d)
{
__CCCallFuncND* pRet = new __CCCallFuncND();
__CCCallFuncND* ret = new __CCCallFuncND();
if (pRet && pRet->initWithTarget(selectorTarget, selector, d)) {
pRet->autorelease();
return pRet;
if (ret && ret->initWithTarget(selectorTarget, selector, d)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool __CCCallFuncND::initWithTarget(Object* selectorTarget, SEL_CallFuncND selector, void* d)
@ -535,7 +535,7 @@ __CCCallFuncND * __CCCallFuncND::clone() const
// CallFuncO
//
__CCCallFuncO::__CCCallFuncO() :
_object(NULL)
_object(nullptr)
{
}
@ -553,15 +553,15 @@ void __CCCallFuncO::execute()
__CCCallFuncO * __CCCallFuncO::create(Object* selectorTarget, SEL_CallFuncO selector, Object* object)
{
__CCCallFuncO *pRet = new __CCCallFuncO();
__CCCallFuncO *ret = new __CCCallFuncO();
if (pRet && pRet->initWithTarget(selectorTarget, selector, object)) {
pRet->autorelease();
return pRet;
if (ret && ret->initWithTarget(selectorTarget, selector, object)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(pRet);
return NULL;
CC_SAFE_DELETE(ret);
return nullptr;
}
bool __CCCallFuncO::initWithTarget(Object* selectorTarget, SEL_CallFuncO selector, Object* object)

View File

@ -51,8 +51,8 @@ public:
// Overrides
//
virtual ActionInstant* clone() const override = 0;
virtual ActionInstant * reverse(void) const override = 0;
virtual bool isDone(void) const override;
virtual ActionInstant * reverse() const override = 0;
virtual bool isDone() const override;
virtual void step(float dt) override;
virtual void update(float time) override;
};
@ -71,7 +71,7 @@ public:
// Overrides
//
virtual void update(float time) override;
virtual ActionInstant* reverse(void) const override;
virtual ActionInstant* reverse() const override;
virtual Show* clone() const override;
};
@ -238,7 +238,7 @@ public:
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE static CallFunc * create(Object* pSelectorTarget, SEL_CallFunc selector);
CC_DEPRECATED_ATTRIBUTE static CallFunc * create(Object* target, SEL_CallFunc selector);
public:
/**
@ -260,7 +260,7 @@ public:
typedef void (Object::*SEL_CallFunc)();
@deprecated Use the std::function API instead.
*/
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* pSelectorTarget);
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target);
/** initializes the action with the std::function<void()>
* @js NK
@ -276,13 +276,13 @@ public:
return _selectorTarget;
}
inline void setTargetCallback(Object* pSel)
inline void setTargetCallback(Object* sel)
{
if (pSel != _selectorTarget)
if (sel != _selectorTarget)
{
CC_SAFE_RETAIN(pSel);
CC_SAFE_RETAIN(sel);
CC_SAFE_RELEASE(_selectorTarget);
_selectorTarget = pSel;
_selectorTarget = sel;
}
}
//
@ -323,7 +323,7 @@ public:
typedef void (Object::*SEL_CallFuncN)(Node*);
@deprecated Use the std::function API instead.
*/
CC_DEPRECATED_ATTRIBUTE static CallFuncN * create(Object* pSelectorTarget, SEL_CallFuncN selector);
CC_DEPRECATED_ATTRIBUTE static CallFuncN * create(Object* target, SEL_CallFuncN selector);
public:
CallFuncN():_functionN(nullptr){}
@ -336,7 +336,7 @@ public:
typedef void (Object::*SEL_CallFuncN)(Node*);
@deprecated Use the std::function API instead.
*/
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* pSelectorTarget, SEL_CallFuncN selector);
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_CallFuncN selector);
//
// Overrides
@ -359,11 +359,11 @@ class CC_DLL __CCCallFuncND : public CallFunc
{
public:
/** creates the action with the callback and the data to pass as an argument */
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncND * create(Object* selectorTarget, SEL_CallFuncND selector, void* d);
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncND * create(Object* target, SEL_CallFuncND selector, void* d);
protected:
/** initializes the action with the callback and the data to pass as an argument */
bool initWithTarget(Object* selectorTarget, SEL_CallFuncND selector, void* d);
bool initWithTarget(Object* target, SEL_CallFuncND selector, void* d);
public:
//
@ -392,7 +392,7 @@ public:
typedef void (Object::*SEL_CallFuncO)(Object*);
*/
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncO * create(Object* selectorTarget, SEL_CallFuncO selector, Object* object);
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncO * create(Object* target, SEL_CallFuncO selector, Object* object);
/**
* @js ctor
*/
@ -408,7 +408,7 @@ protected:
typedef void (Object::*SEL_CallFuncO)(Object*);
*/
bool initWithTarget(Object* selectorTarget, SEL_CallFuncO selector, Object* object);
bool initWithTarget(Object* target, SEL_CallFuncO selector, Object* object);
public:
//

View File

@ -92,52 +92,52 @@ float Camera::getZEye(void)
return FLT_EPSILON;
}
void Camera::setEye(float fEyeX, float fEyeY, float fEyeZ)
void Camera::setEye(float eyeX, float eyeY, float eyeZ)
{
_eyeX = fEyeX;
_eyeY = fEyeY;
_eyeZ = fEyeZ;
_eyeX = eyeX;
_eyeY = eyeY;
_eyeZ = eyeZ;
_dirty = true;
}
void Camera::setCenter(float fCenterX, float fCenterY, float fCenterZ)
void Camera::setCenter(float centerX, float centerY, float centerZ)
{
_centerX = fCenterX;
_centerY = fCenterY;
_centerZ = fCenterZ;
_centerX = centerX;
_centerY = centerY;
_centerZ = centerZ;
_dirty = true;
}
void Camera::setUp(float fUpX, float fUpY, float fUpZ)
void Camera::setUp(float upX, float upY, float upZ)
{
_upX = fUpX;
_upY = fUpY;
_upZ = fUpZ;
_upX = upX;
_upY = upY;
_upZ = upZ;
_dirty = true;
}
void Camera::getEye(float *pEyeX, float *pEyeY, float *pEyeZ) const
void Camera::getEye(float *eyeX, float *eyeY, float *eyeZ) const
{
*pEyeX = _eyeX;
*pEyeY = _eyeY;
*pEyeZ = _eyeZ;
*eyeX = _eyeX;
*eyeY = _eyeY;
*eyeZ = _eyeZ;
}
void Camera::getCenter(float *pCenterX, float *pCenterY, float *pCenterZ) const
void Camera::getCenter(float *centerX, float *centerY, float *centerZ) const
{
*pCenterX = _centerX;
*pCenterY = _centerY;
*pCenterZ = _centerZ;
*centerX = _centerX;
*centerY = _centerY;
*centerZ = _centerZ;
}
void Camera::getUp(float *pUpX, float *pUpY, float *pUpZ) const
void Camera::getUp(float *upX, float *upY, float *upZ) const
{
*pUpX = _upX;
*pUpY = _upY;
*pUpZ = _upZ;
*upX = _upX;
*upY = _upY;
*upZ = _upZ;
}
NS_CC_END

View File

@ -71,53 +71,53 @@ public:
/**
* @js ctor
*/
Camera(void);
Camera();
/**
* @js NA
* @lua NA
*/
~Camera(void);
~Camera();
void init(void);
void init();
/**
* @js NA
* @lua NA
*/
const char* description(void) const;
const char* description() const;
/** sets the dirty value */
inline void setDirty(bool bValue) { _dirty = bValue; }
inline void setDirty(bool value) { _dirty = value; }
/** get the dirty value */
inline bool isDirty(void) const { return _dirty; }
inline bool isDirty() const { return _dirty; }
/** sets the camera in the default position */
void restore(void);
void restore();
/** Sets the camera using gluLookAt using its eye, center and up_vector */
void locate(void);
void locate();
/** sets the eye values in points */
void setEye(float fEyeX, float fEyeY, float fEyeZ);
void setEye(float eyeX, float eyeY, float eyeZ);
/**
@deprecated. Use setEye() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void setEyeXYZ(float fEyeX, float fEyeY, float fEyeZ){ setEye(fEyeX, fEyeY, fEyeZ);}
CC_DEPRECATED_ATTRIBUTE void setEyeXYZ(float eyeX, float eyeY, float eyeZ){ setEye(eyeX, eyeY, eyeZ);}
/** sets the center values in points */
void setCenter(float fCenterX, float fCenterY, float fCenterZ);
void setCenter(float centerX, float centerY, float centerZ);
/**
@deprecated. Use setCenter() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void setCenterXYZ(float fCenterX, float fCenterY, float fCenterZ){ setCenter(fCenterX,fCenterY,fCenterZ);}
CC_DEPRECATED_ATTRIBUTE void setCenterXYZ(float centerX, float centerY, float centerZ){ setCenter(centerX,centerY,centerZ);}
/** sets the up values */
void setUp(float fUpX, float fUpY, float fUpZ);
void setUp(float upX, float upY, float upZ);
/**
@deprecated. Use setUp() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void setUpXYZ(float fUpX, float fUpY, float fUpZ){ setUp(fUpX,fUpY,fUpZ); }
CC_DEPRECATED_ATTRIBUTE void setUpXYZ(float upX, float upY, float upZ){ setUp(upX,upY,upZ); }
/** get the eye vector values in points
* @code
@ -126,37 +126,37 @@ public:
* in lua:local getEye()
* @endcode
*/
void getEye(float *pEyeX, float *pEyeY, float *pEyeZ) const;
void getEye(float *eyeX, float *eyeY, float *eyeZ) const;
/**
@deprecated. Use getEye() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void getEyeXYZ(float *pEyeX, float *pEyeY, float *pEyeZ) const { getEye(pEyeX, pEyeY, pEyeZ); }
CC_DEPRECATED_ATTRIBUTE void getEyeXYZ(float *eyeX, float *eyeY, float *eyeZ) const { getEye(eyeX, eyeY, eyeZ); }
/** get the center vector values int points
* when this function bound to js or lua,the input params are changed
* in js: var getCenter()
* in lua:local getCenter()
*/
void getCenter(float *pCenterX, float *pCenterY, float *pCenterZ) const;
void getCenter(float *centerX, float *centerY, float *centerZ) const;
/**
@deprecated. Use getCenter() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void getCenterXYZ(float *pCenterX, float *pCenterY, float *pCenterZ) const{ getCenter(pCenterX,pCenterY,pCenterZ); }
CC_DEPRECATED_ATTRIBUTE void getCenterXYZ(float *centerX, float *centerY, float *centerZ) const{ getCenter(centerX,centerY,centerZ); }
/** get the up vector values
* when this function bound to js or lua,the input params are changed
* in js: var getUp()
* in lua:local getUp()
*/
void getUp(float *pUpX, float *pUpY, float *pUpZ) const;
void getUp(float *upX, float *upY, float *upZ) const;
/**
@deprecated. Use getUp() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void getUpXYZ(float *pUpX, float *pUpY, float *pUpZ) const{ getUp(pUpX, pUpY, pUpZ); }
CC_DEPRECATED_ATTRIBUTE void getUpXYZ(float *upX, float *upY, float *upZ) const{ getUp(upX, upY, upZ); }
protected:
float _eyeX;

View File

@ -330,11 +330,11 @@ float Director::getDeltaTime() const
{
return _deltaTime;
}
void Director::setOpenGLView(EGLView *pobOpenGLView)
void Director::setOpenGLView(EGLView *openGLView)
{
CCASSERT(pobOpenGLView, "opengl view should not be null");
CCASSERT(openGLView, "opengl view should not be null");
if (_openGLView != pobOpenGLView)
if (_openGLView != openGLView)
{
// Configuration. Gather GPU info
Configuration *conf = Configuration::getInstance();
@ -343,7 +343,7 @@ void Director::setOpenGLView(EGLView *pobOpenGLView)
// EAGLView is not a Object
delete _openGLView; // [openGLView_ release]
_openGLView = pobOpenGLView;
_openGLView = openGLView;
// set size
_winSizeInPoints = _openGLView->getDesignResolutionSize();
@ -1052,9 +1052,9 @@ void DisplayLinkDirector::stopAnimation()
_invalid = true;
}
void DisplayLinkDirector::setAnimationInterval(double value)
void DisplayLinkDirector::setAnimationInterval(double interval)
{
_animationInterval = value;
_animationInterval = interval;
if (! _invalid)
{
stopAnimation();

View File

@ -121,7 +121,7 @@ public:
/** Get the FPS value */
inline double getAnimationInterval() { return _animationInterval; }
/** Set the FPS value. */
virtual void setAnimationInterval(double dValue) = 0;
virtual void setAnimationInterval(double interval) = 0;
/** Whether or not to display the FPS on the bottom-left corner */
inline bool isDisplayStats() { return _displayStats; }
@ -136,7 +136,7 @@ public:
* @lua NA
*/
inline EGLView* getOpenGLView() { return _openGLView; }
void setOpenGLView(EGLView *pobOpenGLView);
void setOpenGLView(EGLView *openGLView);
TextureCache* getTextureCache() const;

View File

@ -71,7 +71,7 @@ typedef struct _hashSelectorEntry
// implementation Timer
Timer::Timer()
: _target(NULL)
: _target(nullptr)
, _elapsed(-1)
, _runForever(false)
, _useDelay(false)
@ -79,39 +79,39 @@ Timer::Timer()
, _repeat(0)
, _delay(0.0f)
, _interval(0.0f)
, _selector(NULL)
, _selector(nullptr)
, _scriptHandler(0)
{
}
Timer* Timer::create(Object *target, SEL_SCHEDULE selector)
{
Timer *pTimer = new Timer();
Timer *timer = new Timer();
pTimer->initWithTarget(target, selector, 0.0f, kRepeatForever, 0.0f);
pTimer->autorelease();
timer->initWithTarget(target, selector, 0.0f, kRepeatForever, 0.0f);
timer->autorelease();
return pTimer;
return timer;
}
Timer* Timer::create(Object *target, SEL_SCHEDULE selector, float seconds)
{
Timer *pTimer = new Timer();
Timer *timer = new Timer();
pTimer->initWithTarget(target, selector, seconds, kRepeatForever, 0.0f);
pTimer->autorelease();
timer->initWithTarget(target, selector, seconds, kRepeatForever, 0.0f);
timer->autorelease();
return pTimer;
return timer;
}
Timer* Timer::createWithScriptHandler(int handler, float seconds)
{
Timer *pTimer = new Timer();
Timer *timer = new Timer();
pTimer->initWithScriptHandler(handler, seconds);
pTimer->autorelease();
timer->initWithScriptHandler(handler, seconds);
timer->autorelease();
return pTimer;
return timer;
}
bool Timer::initWithScriptHandler(int handler, float seconds)
@ -248,15 +248,15 @@ const int Scheduler::PRIORITY_NON_SYSTEM_MIN = PRIORITY_SYSTEM + 1;
Scheduler::Scheduler(void)
: _timeScale(1.0f)
, _updatesNegList(NULL)
, _updates0List(NULL)
, _updatesPosList(NULL)
, _hashForUpdates(NULL)
, _hashForTimers(NULL)
, _currentTarget(NULL)
, _updatesNegList(nullptr)
, _updates0List(nullptr)
, _updatesPosList(nullptr)
, _hashForUpdates(nullptr)
, _hashForTimers(nullptr)
, _currentTarget(nullptr)
, _currentTargetSalvaged(false)
, _updateHashLocked(false)
, _scriptHandlerEntries(NULL)
, _scriptHandlerEntries(nullptr)
{
}
@ -290,10 +290,10 @@ void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float in
void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float interval, unsigned int repeat, float delay, bool paused)
{
CCASSERT(selector, "Argument selector must be non-NULL");
CCASSERT(target, "Argument target must be non-NULL");
CCASSERT(selector, "Argument selector must be non-nullptr");
CCASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if (! element)
@ -314,7 +314,7 @@ void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float in
CCASSERT(element->paused == paused, "");
}
if (element->timers == NULL)
if (element->timers == nullptr)
{
element->timers = ccArrayNew(10);
}
@ -351,18 +351,18 @@ void Scheduler::unscheduleSelector(SEL_SCHEDULE selector, Object *target)
//CCASSERT(target);
//CCASSERT(selector);
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
for (int i = 0; i < element->timers->num; ++i)
{
Timer *pTimer = (Timer*)(element->timers->arr[i]);
Timer *timer = static_cast<Timer*>(element->timers->arr[i]);
if (selector == pTimer->getSelector())
if (selector == timer->getSelector())
{
if (pTimer == element->currentTimer && (! element->currentTimerSalvaged))
if (timer == element->currentTimer && (! element->currentTimerSalvaged))
{
element->currentTimer->retain();
element->currentTimerSalvaged = true;
@ -401,7 +401,7 @@ void Scheduler::priorityIn(tListEntry **list, Object *target, int priority, bool
listElement->target = target;
listElement->priority = priority;
listElement->paused = paused;
listElement->next = listElement->prev = NULL;
listElement->next = listElement->prev = nullptr;
listElement->markedForDeletion = false;
// empty list ?
@ -411,7 +411,7 @@ void Scheduler::priorityIn(tListEntry **list, Object *target, int priority, bool
}
else
{
bool bAdded = false;
bool added = false;
for (tListEntry *element = *list; element; element = element->next)
{
@ -430,25 +430,25 @@ void Scheduler::priorityIn(tListEntry **list, Object *target, int priority, bool
element->prev = listElement;
}
bAdded = true;
added = true;
break;
}
}
// Not added? priority has the higher value. Append it.
if (! bAdded)
if (! added)
{
DL_APPEND(*list, listElement);
}
}
// update hash entry for quick access
tHashUpdateEntry *pHashElement = (tHashUpdateEntry *)calloc(sizeof(*pHashElement), 1);
pHashElement->target = target;
tHashUpdateEntry *hashElement = (tHashUpdateEntry *)calloc(sizeof(*hashElement), 1);
hashElement->target = target;
target->retain();
pHashElement->list = list;
pHashElement->entry = listElement;
HASH_ADD_PTR(_hashForUpdates, target, pHashElement);
hashElement->list = list;
hashElement->entry = listElement;
HASH_ADD_PTR(_hashForUpdates, target, hashElement);
}
void Scheduler::appendIn(_listEntry **list, Object *target, bool paused)
@ -473,16 +473,16 @@ void Scheduler::appendIn(_listEntry **list, Object *target, bool paused)
void Scheduler::scheduleUpdateForTarget(Object *target, int priority, bool paused)
{
tHashUpdateEntry *pHashElement = NULL;
HASH_FIND_PTR(_hashForUpdates, &target, pHashElement);
if (pHashElement)
tHashUpdateEntry *hashElement = nullptr;
HASH_FIND_PTR(_hashForUpdates, &target, hashElement);
if (hashElement)
{
#if COCOS2D_DEBUG >= 1
CCASSERT(pHashElement->entry->markedForDeletion,"");
CCASSERT(hashElement->entry->markedForDeletion,"");
#endif
// TODO: check if priority has changed!
pHashElement->entry->markedForDeletion = false;
hashElement->entry->markedForDeletion = false;
return;
}
@ -505,10 +505,10 @@ void Scheduler::scheduleUpdateForTarget(Object *target, int priority, bool pause
bool Scheduler::isScheduledForTarget(SEL_SCHEDULE selector, Object *target)
{
CCASSERT(selector, "Argument selector must be non-NULL");
CCASSERT(target, "Argument target must be non-NULL");
CCASSERT(selector, "Argument selector must be non-nullptr");
CCASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if (!element)
@ -516,7 +516,7 @@ bool Scheduler::isScheduledForTarget(SEL_SCHEDULE selector, Object *target)
return false;
}
if (element->timers == NULL)
if (element->timers == nullptr)
{
return false;
}else
@ -539,7 +539,7 @@ bool Scheduler::isScheduledForTarget(SEL_SCHEDULE selector, Object *target)
void Scheduler::removeUpdateFromHash(struct _listEntry *entry)
{
tHashUpdateEntry *element = NULL;
tHashUpdateEntry *element = nullptr;
HASH_FIND_PTR(_hashForUpdates, &entry->target, element);
if (element)
@ -561,12 +561,12 @@ void Scheduler::removeUpdateFromHash(struct _listEntry *entry)
void Scheduler::unscheduleUpdateForTarget(const Object *target)
{
if (target == NULL)
if (target == nullptr)
{
return;
}
tHashUpdateEntry *element = NULL;
tHashUpdateEntry *element = nullptr;
HASH_FIND_PTR(_hashForUpdates, &target, element);
if (element)
{
@ -586,34 +586,34 @@ void Scheduler::unscheduleAll(void)
unscheduleAllWithMinPriority(PRIORITY_SYSTEM);
}
void Scheduler::unscheduleAllWithMinPriority(int nMinPriority)
void Scheduler::unscheduleAllWithMinPriority(int minPriority)
{
// Custom Selectors
tHashTimerEntry *element = NULL;
tHashTimerEntry *pNextElement = NULL;
for (element = _hashForTimers; element != NULL;)
tHashTimerEntry *element = nullptr;
tHashTimerEntry *nextElement = nullptr;
for (element = _hashForTimers; element != nullptr;)
{
// element may be removed in unscheduleAllSelectorsForTarget
pNextElement = (tHashTimerEntry *)element->hh.next;
nextElement = (tHashTimerEntry *)element->hh.next;
unscheduleAllForTarget(element->target);
element = pNextElement;
element = nextElement;
}
// Updates selectors
tListEntry *entry, *tmp;
if(nMinPriority < 0)
if(minPriority < 0)
{
DL_FOREACH_SAFE(_updatesNegList, entry, tmp)
{
if(entry->priority >= nMinPriority)
if(entry->priority >= minPriority)
{
unscheduleUpdateForTarget(entry->target);
}
}
}
if(nMinPriority <= 0)
if(minPriority <= 0)
{
DL_FOREACH_SAFE(_updates0List, entry, tmp)
{
@ -623,7 +623,7 @@ void Scheduler::unscheduleAllWithMinPriority(int nMinPriority)
DL_FOREACH_SAFE(_updatesPosList, entry, tmp)
{
if(entry->priority >= nMinPriority)
if(entry->priority >= minPriority)
{
unscheduleUpdateForTarget(entry->target);
}
@ -637,14 +637,14 @@ void Scheduler::unscheduleAllWithMinPriority(int nMinPriority)
void Scheduler::unscheduleAllForTarget(Object *target)
{
// explicit NULL handling
if (target == NULL)
// explicit nullptr handling
if (target == nullptr)
{
return;
}
// Custom Selectors
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
@ -673,24 +673,24 @@ void Scheduler::unscheduleAllForTarget(Object *target)
unsigned int Scheduler::scheduleScriptFunc(unsigned int handler, float interval, bool paused)
{
SchedulerScriptHandlerEntry* pEntry = SchedulerScriptHandlerEntry::create(handler, interval, paused);
SchedulerScriptHandlerEntry* entry = SchedulerScriptHandlerEntry::create(handler, interval, paused);
if (!_scriptHandlerEntries)
{
_scriptHandlerEntries = Array::createWithCapacity(20);
_scriptHandlerEntries->retain();
}
_scriptHandlerEntries->addObject(pEntry);
return pEntry->getEntryId();
_scriptHandlerEntries->addObject(entry);
return entry->getEntryId();
}
void Scheduler::unscheduleScriptEntry(unsigned int uScheduleScriptEntryID)
void Scheduler::unscheduleScriptEntry(unsigned int scheduleScriptEntryID)
{
for (int i = _scriptHandlerEntries->count() - 1; i >= 0; i--)
{
SchedulerScriptHandlerEntry* pEntry = static_cast<SchedulerScriptHandlerEntry*>(_scriptHandlerEntries->getObjectAtIndex(i));
if (pEntry->getEntryId() == (int)uScheduleScriptEntryID)
SchedulerScriptHandlerEntry* entry = static_cast<SchedulerScriptHandlerEntry*>(_scriptHandlerEntries->getObjectAtIndex(i));
if (entry->getEntryId() == (int)scheduleScriptEntryID)
{
pEntry->markedForDeletion();
entry->markedForDeletion();
break;
}
}
@ -698,10 +698,10 @@ void Scheduler::unscheduleScriptEntry(unsigned int uScheduleScriptEntryID)
void Scheduler::resumeTarget(Object *target)
{
CCASSERT(target != NULL, "");
CCASSERT(target != nullptr, "");
// custom selectors
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
@ -709,21 +709,21 @@ void Scheduler::resumeTarget(Object *target)
}
// update selector
tHashUpdateEntry *elementUpdate = NULL;
tHashUpdateEntry *elementUpdate = nullptr;
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if (elementUpdate)
{
CCASSERT(elementUpdate->entry != NULL, "");
CCASSERT(elementUpdate->entry != nullptr, "");
elementUpdate->entry->paused = false;
}
}
void Scheduler::pauseTarget(Object *target)
{
CCASSERT(target != NULL, "");
CCASSERT(target != nullptr, "");
// custom selectors
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
@ -731,21 +731,21 @@ void Scheduler::pauseTarget(Object *target)
}
// update selector
tHashUpdateEntry *elementUpdate = NULL;
tHashUpdateEntry *elementUpdate = nullptr;
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if (elementUpdate)
{
CCASSERT(elementUpdate->entry != NULL, "");
CCASSERT(elementUpdate->entry != nullptr, "");
elementUpdate->entry->paused = true;
}
}
bool Scheduler::isTargetPaused(Object *target)
{
CCASSERT( target != NULL, "target must be non nil" );
CCASSERT( target != nullptr, "target must be non nil" );
// Custom selectors
tHashTimerEntry *element = NULL;
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
if( element )
{
@ -753,7 +753,7 @@ bool Scheduler::isTargetPaused(Object *target)
}
// We should check update selectors if target does not have custom selectors
tHashUpdateEntry *elementUpdate = NULL;
tHashUpdateEntry *elementUpdate = nullptr;
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if ( elementUpdate )
{
@ -768,13 +768,13 @@ Set* Scheduler::pauseAllTargets()
return pauseAllTargetsWithMinPriority(PRIORITY_SYSTEM);
}
Set* Scheduler::pauseAllTargetsWithMinPriority(int nMinPriority)
Set* Scheduler::pauseAllTargetsWithMinPriority(int minPriority)
{
Set* idsWithSelectors = new Set();// setWithCapacity:50];
idsWithSelectors->autorelease();
// Custom Selectors
for(tHashTimerEntry *element = _hashForTimers; element != NULL;
for(tHashTimerEntry *element = _hashForTimers; element != nullptr;
element = (tHashTimerEntry*)element->hh.next)
{
element->paused = true;
@ -783,11 +783,11 @@ Set* Scheduler::pauseAllTargetsWithMinPriority(int nMinPriority)
// Updates selectors
tListEntry *entry, *tmp;
if(nMinPriority < 0)
if(minPriority < 0)
{
DL_FOREACH_SAFE( _updatesNegList, entry, tmp )
{
if(entry->priority >= nMinPriority)
if(entry->priority >= minPriority)
{
entry->paused = true;
idsWithSelectors->addObject(entry->target);
@ -795,7 +795,7 @@ Set* Scheduler::pauseAllTargetsWithMinPriority(int nMinPriority)
}
}
if(nMinPriority <= 0)
if(minPriority <= 0)
{
DL_FOREACH_SAFE( _updates0List, entry, tmp )
{
@ -806,7 +806,7 @@ Set* Scheduler::pauseAllTargetsWithMinPriority(int nMinPriority)
DL_FOREACH_SAFE( _updatesPosList, entry, tmp )
{
if(entry->priority >= nMinPriority)
if(entry->priority >= minPriority)
{
entry->paused = true;
idsWithSelectors->addObject(entry->target);
@ -866,7 +866,7 @@ void Scheduler::update(float dt)
}
// Iterate over all the custom selectors
for (tHashTimerEntry *elt = _hashForTimers; elt != NULL; )
for (tHashTimerEntry *elt = _hashForTimers; elt != nullptr; )
{
_currentTarget = elt;
_currentTargetSalvaged = false;
@ -889,7 +889,7 @@ void Scheduler::update(float dt)
elt->currentTimer->release();
}
elt->currentTimer = NULL;
elt->currentTimer = nullptr;
}
}
@ -951,7 +951,7 @@ void Scheduler::update(float dt)
_updateHashLocked = false;
_currentTarget = NULL;
_currentTarget = nullptr;
}

View File

@ -54,20 +54,20 @@ public:
* @js NA
* @lua NA
*/
static Timer* createWithScriptHandler(int nHandler, float seconds);
static Timer* createWithScriptHandler(int handler, float seconds);
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithTarget(Object *target, SEL_SCHEDULE selector) { return Timer::create(target, selector); }
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithTarget(Object *target, SEL_SCHEDULE selector, float seconds) { return Timer::create(target, selector, seconds); }
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithScriptHandler(int nHandler, float seconds) { return Timer::createWithScriptHandler(nHandler, seconds); }
CC_DEPRECATED_ATTRIBUTE static Timer* timerWithScriptHandler(int handler, float seconds) { return Timer::createWithScriptHandler(handler, seconds); }
Timer(void);
/** Initializes a timer with a target and a selector. */
bool initWithTarget(Object *target, SEL_SCHEDULE selector);
/** Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds. */
bool initWithTarget(Object *target, SEL_SCHEDULE selector, float seconds, unsigned int nRepeat, float fDelay);
bool initWithTarget(Object *target, SEL_SCHEDULE selector, float seconds, unsigned int repeat, float delay);
/** Initializes a timer with a script callback function and an interval in seconds. */
bool initWithScriptHandler(int nHandler, float seconds);
bool initWithScriptHandler(int handler, float seconds);
/** get interval in seconds */
float getInterval() const;
@ -136,7 +136,7 @@ public:
*/
~Scheduler(void);
inline float getTimeScale(void) { return _timeScale; }
inline float getTimeScale() { return _timeScale; }
/** Modifies the time of all scheduled callbacks.
You can use this property to create a 'slow motion' or 'fast forward' effect.
Default is 1.0. To create a 'slow motion' effect, use values below 1.0.
@ -144,7 +144,7 @@ public:
@since v0.8
@warning It will affect EVERY scheduled selector / action.
*/
inline void setTimeScale(float fTimeScale) { _timeScale = fTimeScale; }
inline void setTimeScale(float timeScale) { _timeScale = timeScale; }
/** 'update' the scheduler.
You should NEVER call this method, unless you know what you are doing.
@ -162,16 +162,16 @@ public:
@since v0.99.3, repeat and delay added in v1.1
*/
void scheduleSelector(SEL_SCHEDULE selector, Object *target, float fInterval, unsigned int repeat, float delay, bool bPaused);
void scheduleSelector(SEL_SCHEDULE selector, Object *target, float interval, unsigned int repeat, float delay, bool paused);
/** calls scheduleSelector with kRepeatForever and a 0 delay */
void scheduleSelector(SEL_SCHEDULE selector, Object *target, float fInterval, bool bPaused);
void scheduleSelector(SEL_SCHEDULE selector, Object *target, float interval, bool paused);
/** Schedules the 'update' selector for a given target with a given priority.
The 'update' selector will be called every frame.
The lower the priority, the earlier it is called.
@since v0.99.3
*/
void scheduleUpdateForTarget(Object *target, int nPriority, bool bPaused);
void scheduleUpdateForTarget(Object *target, int priority, bool paused);
/** Checks whether a selector for a given taget is scheduled.
@since v3.0.0
@ -206,17 +206,17 @@ public:
You should only call this with kPriorityNonSystemMin or higher.
@since v2.0.0
*/
void unscheduleAllWithMinPriority(int nMinPriority);
void unscheduleAllWithMinPriority(int minPriority);
/** The scheduled script callback will be called every 'interval' seconds.
If paused is true, then it won't be called until it is resumed.
If 'interval' is 0, it will be called every frame.
return schedule script entry ID, used for unscheduleScriptFunc().
*/
unsigned int scheduleScriptFunc(unsigned int nHandler, float fInterval, bool bPaused);
unsigned int scheduleScriptFunc(unsigned int handler, float interval, bool paused);
/** Unschedule a script entry. */
void unscheduleScriptEntry(unsigned int uScheduleScriptEntryID);
void unscheduleScriptEntry(unsigned int scheduleScriptEntryID);
/** Pauses the target.
All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.
@ -249,7 +249,7 @@ public:
You should only call this with kPriorityNonSystemMin or higher.
@since v2.0.0
*/
Set* pauseAllTargetsWithMinPriority(int nMinPriority);
Set* pauseAllTargetsWithMinPriority(int minPriority);
/** Resume selectors on a set of targets.
This can be useful for undoing a call to pauseAllSelectors.
@ -258,13 +258,13 @@ public:
void resumeTargets(Set* targetsToResume);
private:
void removeHashElement(struct _hashSelectorEntry *pElement);
void removeHashElement(struct _hashSelectorEntry *element);
void removeUpdateFromHash(struct _listEntry *entry);
// update specific
void priorityIn(struct _listEntry **ppList, Object *target, int nPriority, bool bPaused);
void appendIn(struct _listEntry **ppList, Object *target, bool bPaused);
void priorityIn(struct _listEntry **list, Object *target, int priority, bool paused);
void appendIn(struct _listEntry **list, Object *target, bool paused);
protected:
float _timeScale;

View File

@ -30,7 +30,7 @@ NS_CC_BEGIN
const char* cocos2dVersion()
{
return "3.0-alpha0";
return "3.0-alpha1";
}
NS_CC_END

View File

@ -674,6 +674,7 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
}
else
{
// XXX: how to fix this warning?
CallFuncN *callback = CallFuncN::create(target, selCallFunc);
actions->addObject(callback);
}

View File

@ -42,7 +42,7 @@ ActionObject::ActionObject()
_actionNodeList = Array::create();
_actionNodeList->retain();
_pScheduler = new Scheduler();
Director::sharedDirector()->getScheduler()->scheduleUpdateForTarget(_pScheduler, 0, false);
Director::getInstance()->getScheduler()->scheduleUpdateForTarget(_pScheduler, 0, false);
}
ActionObject::~ActionObject()
@ -193,7 +193,7 @@ void ActionObject::simulationActionUpdate(float dt)
for ( int i = 0; i < nodeNum; i++ )
{
ActionNode* actionNode = (ActionNode*)_actionNodeList->objectAtIndex(i);
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
if (actionNode->isActionDoneOnce() == false)
{

View File

@ -1028,7 +1028,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
while(acc < file_info.size_file_extra)
{
uLong headerId;
uLong dataSize;
uLong dataSize;
if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)
err=UNZ_ERRNO;
@ -1039,33 +1039,33 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
/* ZIP64 extra fields */
if (headerId == 0x0001)
{
uLong uL;
uLong uL2;
if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
if (file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
if (file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
{
/* Relative Header offset */
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
err=UNZ_ERRNO;
}
if (file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
{
/* Relative Header offset */
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info.disk_num_start == (unsigned long)-1)
{
/* Disk Start Number */
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info.disk_num_start == (unsigned long)-1)
{
/* Disk Start Number */
if (unz64local_getLong(&s->z_filefunc, s->filestream, &uL2) != UNZ_OK)
err=UNZ_ERRNO;
}
}
else

View File

@ -62,24 +62,6 @@ namespace
bool PhysicsTestScene::_debugDraw = false;
bool PhysicsTestScene::initTest()
{
#ifdef CC_USE_PHYSICS
if(TestScene::initWithPhysics())
{
if (_debugDraw)
{
getPhysicsWorld()->setDebugDrawMask(_debugDraw ? PhysicsWorld::DEBUGDRAW_ALL : PhysicsWorld::DEBUGDRAW_NONE);
}
return true;
}
#else
return TestScene::init();
#endif
return false;
}
void PhysicsTestScene::runThisTest()
{
#ifdef CC_USE_PHYSICS
@ -122,7 +104,6 @@ std::string PhysicsDemo::subtitle()
void PhysicsDemo::restartCallback(Object* sender)
{
auto s = new PhysicsTestScene();
s->initTest();
s->addChild( restart() );
Director::getInstance()->replaceScene(s);
s->release();
@ -131,7 +112,6 @@ void PhysicsDemo::restartCallback(Object* sender)
void PhysicsDemo::nextCallback(Object* sender)
{
auto s = new PhysicsTestScene();
s->initTest();
s->addChild( next() );
Director::getInstance()->replaceScene(s);
s->release();
@ -140,7 +120,6 @@ void PhysicsDemo::nextCallback(Object* sender)
void PhysicsDemo::backCallback(Object* sender)
{
auto s = new PhysicsTestScene();
s->initTest();
s->addChild( back() );
Director::getInstance()->replaceScene(s);
s->release();
@ -1142,4 +1121,4 @@ std::string PhysicsDemoSlice::title()
std::string PhysicsDemoSlice::subtitle()
{
return "click and drag to slice up the block, open debug to see it";
}
}

View File

@ -11,7 +11,9 @@
class PhysicsTestScene : public TestScene
{
public:
virtual bool initTest() override;
PhysicsTestScene():TestScene(false, true){}
public:
virtual void runThisTest();
void toggleDebug();

View File

@ -158,7 +158,7 @@ void TestController::menuCallback(Object * sender)
// create the test scene and run it
auto scene = g_aTestNames[idx].callback();
if (scene && scene->initTest())
if (scene)
{
scene->runThisTest();
scene->release();

View File

@ -3,13 +3,20 @@
#include "extensions/cocos-ext.h"
#include "cocostudio/CocoStudio.h"
TestScene::TestScene(bool bPortrait)
TestScene::TestScene(bool bPortrait, bool physics/* = false*/)
{
}
bool TestScene::initTest()
{
return Scene::init();
if (physics)
{
#ifdef CC_USE_PHYSICS
TestScene::initWithPhysics();
#else
Scene::init();
#endif
}
else
{
Scene::init();
}
}
void TestScene::onEnter()

View File

@ -11,8 +11,7 @@ using namespace std;
class TestScene : public Scene
{
public:
TestScene(bool bPortrait = false);
virtual bool initTest();
TestScene(bool bPortrait = false, bool physics = false);
virtual void onEnter();
virtual void runThisTest() = 0;

View File

@ -33,9 +33,11 @@ def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
# generate file list string
filestrio = cStringIO.StringIO()
mkfilepath = os.path.dirname(os.path.join(COCOS_ROOT, mkfile))
for filename in filelst:
filestrio.write(' \\\n')
filestrio.write(os.path.relpath(filename, os.path.dirname(os.path.join(COCOS_ROOT, mkfile))))
filepath = os.path.relpath(filename, mkfilepath)
filestrio.write(filepath.replace('\\', '/'))
filestrio.write('\n')
# read mk file