issue #1310: syncronize actions

This commit is contained in:
minggo 2012-06-08 13:55:28 +08:00
parent 2b55a76970
commit cc16320445
106 changed files with 1423 additions and 784 deletions

View File

@ -138,7 +138,7 @@ bool CCDirector::init(void)
m_pScheduler = new CCScheduler();
// action manager
m_pActionManager = new CCActionManager();
m_pScheduler->scheduleUpdateForTarget(m_pActionManager, kCCActionManagerPriority, false);
m_pScheduler->scheduleUpdateForTarget(m_pActionManager, kCCPrioritySystem, false);
// touchDispatcher
m_pTouchDispatcher = new CCTouchDispatcher();
m_pTouchDispatcher->init();

View File

@ -329,8 +329,8 @@ protected:
bool m_bLandscape;
bool m_bDisplayStats;
ccTime m_fAccumDt;
ccTime m_fFrameRate;
float m_fAccumDt;
float m_fFrameRate;
CCLabelBMFont *m_pFPSLabel;
CCLabelBMFont *m_pSPFLabel;
@ -342,7 +342,7 @@ protected:
/* How many frames were called since the director started */
unsigned int m_uTotalFrames;
unsigned int m_uFrames;
ccTime m_fSecondsPerFrame;
float m_fSecondsPerFrame;
/* The running scene */
CCScene *m_pRunningScene;
@ -361,7 +361,7 @@ protected:
struct cc_timeval *m_pLastUpdate;
/* delta time since last tick to main loop */
ccTime m_fDeltaTime;
float m_fDeltaTime;
/* whether or not the next delta time will be zero */
bool m_bNextDeltaTimeZero;

View File

@ -63,15 +63,15 @@ typedef struct _hashSelectorEntry
ccArray *timers;
CCObject *target; // hash key (retained)
unsigned int timerIndex;
CCTimer *currentTimer;
floatr *currentTimer;
bool currentTimerSalvaged;
bool paused;
UT_hash_handle hh;
} tHashSelectorEntry;
// implementation CCTimer
// implementation floatr
CCTimer::CCTimer()
floatr::floatr()
: m_pfnSelector(NULL)
, m_fInterval(0.0f)
, m_pTarget(NULL)
@ -86,9 +86,9 @@ CCTimer::CCTimer()
}
CCTimer* CCTimer::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector)
floatr* floatr::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector)
{
CCTimer *pTimer = new CCTimer();
floatr *pTimer = new floatr();
pTimer->initWithTarget(pTarget, pfnSelector, 0.0f, kCCRepeatForever, 0.0f);
pTimer->autorelease();
@ -96,9 +96,9 @@ CCTimer* CCTimer::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector)
return pTimer;
}
CCTimer* CCTimer::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds)
floatr* floatr::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds)
{
CCTimer *pTimer = new CCTimer();
floatr *pTimer = new floatr();
pTimer->initWithTarget(pTarget, pfnSelector, fSeconds, kCCRepeatForever, 0.0f);
pTimer->autorelease();
@ -106,9 +106,9 @@ CCTimer* CCTimer::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, c
return pTimer;
}
CCTimer* CCTimer::timerWithScriptHandler(int nHandler, ccTime fSeconds)
floatr* floatr::timerWithScriptHandler(int nHandler, float fSeconds)
{
CCTimer *pTimer = new CCTimer();
floatr *pTimer = new floatr();
pTimer->initWithScriptHandler(nHandler, fSeconds);
pTimer->autorelease();
@ -116,7 +116,7 @@ CCTimer* CCTimer::timerWithScriptHandler(int nHandler, ccTime fSeconds)
return pTimer;
}
bool CCTimer::initWithScriptHandler(int nHandler, ccTime fSeconds)
bool floatr::initWithScriptHandler(int nHandler, float fSeconds)
{
m_nScriptHandler = nHandler;
m_fElapsed = -1;
@ -125,12 +125,12 @@ bool CCTimer::initWithScriptHandler(int nHandler, ccTime fSeconds)
return true;
}
bool CCTimer::initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector)
bool floatr::initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector)
{
return initWithTarget(pTarget, pfnSelector, 0, kCCRepeatForever, 0.0f);
}
bool CCTimer::initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds, unsigned int nRepeat, ccTime fDelay)
bool floatr::initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds, unsigned int nRepeat, float fDelay)
{
m_pTarget = pTarget;
m_pfnSelector = pfnSelector;
@ -143,7 +143,7 @@ bool CCTimer::initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime
return true;
}
void CCTimer::update(ccTime dt)
void floatr::update(float dt)
{
if (m_fElapsed == -1)
{
@ -254,7 +254,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget,
this->scheduleSelector(pfnSelector, pTarget, fInterval, bPaused, kCCRepeatForever, 0.0f);
}
void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, ccTime fInterval, bool bPaused, unsigned int repeat, ccTime delay)
void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, bool bPaused, unsigned int repeat, float delay)
{
CCAssert(pfnSelector, "");
CCAssert(pTarget, "");
@ -288,7 +288,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget,
{
for (unsigned int i = 0; i < pElement->timers->num; ++i)
{
CCTimer *timer = (CCTimer*)pElement->timers->arr[i];
floatr *timer = (floatr*)pElement->timers->arr[i];
if (pfnSelector == timer->m_pfnSelector)
{
@ -300,7 +300,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget,
ccArrayEnsureExtraCapacity(pElement->timers, 1);
}
CCTimer *pTimer = new CCTimer();
floatr *pTimer = new floatr();
pTimer->initWithTarget(pTarget, pfnSelector, fInterval, repeat, delay);
ccArrayAppendObject(pElement->timers, pTimer);
pTimer->release();
@ -324,7 +324,7 @@ void CCScheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget
{
for (unsigned int i = 0; i < pElement->timers->num; ++i)
{
CCTimer *pTimer = (CCTimer*)(pElement->timers->arr[i]);
floatr *pTimer = (floatr*)(pElement->timers->arr[i]);
if (pfnSelector == pTimer->m_pfnSelector)
{
@ -580,7 +580,7 @@ void CCScheduler::unscheduleAllSelectorsForTarget(CCObject *pTarget)
unscheduleUpdateForTarget(pTarget);
}
unsigned int CCScheduler::scheduleScriptFunc(unsigned int nHandler, ccTime fInterval, bool bPaused)
unsigned int CCScheduler::scheduleScriptFunc(unsigned int nHandler, float fInterval, bool bPaused)
{
CCSchedulerScriptHandlerEntry* pEntry = CCSchedulerScriptHandlerEntry::entryWithHandler(nHandler, fInterval, bPaused);
if (!m_pScriptHandlerEntries)
@ -664,7 +664,7 @@ bool CCScheduler::isTargetPaused(CCObject *pTarget)
}
// main loop
void CCScheduler::update(ccTime dt)
void CCScheduler::update(float dt)
{
m_bUpdateHashLocked = true;
@ -714,7 +714,7 @@ void CCScheduler::update(ccTime dt)
// The 'timers' array may change while inside this loop
for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex))
{
elt->currentTimer = (CCTimer*)(elt->timers->arr[elt->timerIndex]);
elt->currentTimer = (floatr*)(elt->timers->arr[elt->timerIndex]);
elt->currentTimerSalvaged = false;
elt->currentTimer->update(dt);

View File

@ -32,54 +32,60 @@ THE SOFTWARE.
NS_CC_BEGIN
// Priority level reserved for system services.
#define kCCPrioritySystem INT_MIN
// Minimum priority level for user scheduling.
#define kCCPriorityNonSystemMin (kCCPrioritySystem+1)
//
// CCTimer
// floatr
//
/** @brief Light weight timer */
class CC_DLL CCTimer : public CCObject
class CC_DLL floatr : public CCObject
{
public:
CCTimer(void);
floatr(void);
/** get interval in seconds */
inline ccTime getInterval(void) { return m_fInterval; }
inline float getInterval(void) { return m_fInterval; }
/** set interval in seconds */
inline void setInterval(ccTime fInterval){ m_fInterval = fInterval; }
inline void setInterval(float fInterval){ m_fInterval = fInterval; }
/** Initializes a timer with a target and a selector. */
bool initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector);
/** 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(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds, unsigned int nRepeat, ccTime fDelay);
bool initWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds, unsigned int nRepeat, float fDelay);
/** Initializes a timer with a script callback function and an interval in seconds. */
bool initWithScriptHandler(int nHandler, ccTime fSeconds);
bool initWithScriptHandler(int nHandler, float fSeconds);
/** triggers the timer */
void update(ccTime dt);
void update(float dt);
public:
/** Allocates a timer with a target and a selector. */
static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector);
static floatr* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector);
/** Allocates a timer with a target, a selector and an interval in seconds. */
static CCTimer* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds);
static floatr* timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds);
/** Allocates a timer with a script callback function and an interval in seconds. */
static CCTimer* timerWithScriptHandler(int nHandler, ccTime fSeconds);
static floatr* timerWithScriptHandler(int nHandler, float fSeconds);
public:
SEL_SCHEDULE m_pfnSelector;
ccTime m_fInterval;
float m_fInterval;
protected:
CCObject *m_pTarget;
ccTime m_fElapsed;
float m_fElapsed;
bool m_bRunForever;
bool m_bUseDelay;
unsigned int m_nTimesExecuted;
unsigned int m_nRepeat; //0 = once, 1 is 2 x executed
ccTime m_fDelay;
float m_fDelay;
int m_nScriptHandler;
};
@ -110,7 +116,7 @@ public:
CCScheduler();
~CCScheduler(void);
inline ccTime getTimeScale(void) { return m_fTimeScale; }
inline float getTimeScale(void) { return m_fTimeScale; }
/** 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.
@ -118,12 +124,12 @@ public:
@since v0.8
@warning It will affect EVERY scheduled selector / action.
*/
inline void setTimeScale(ccTime fTimeScale) { m_fTimeScale = fTimeScale; }
inline void setTimeScale(float fTimeScale) { m_fTimeScale = fTimeScale; }
/** 'update' the scheduler.
You should NEVER call this method, unless you know what you are doing.
*/
void update(ccTime dt);
void update(float dt);
/** The scheduled method will be called every 'interval' seconds.
If paused is YES, then it won't be called until it is resumed.
@ -134,10 +140,10 @@ public:
@since v0.99.3, repeat and delay added in v1.1
*/
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, ccTime fInterval, bool bPaused, unsigned int repeat, ccTime delay);
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, bool bPaused, unsigned int repeat, float delay);
/** calls scheduleSelector with kCCRepeatForever and a 0 delay */
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, ccTime fInterval, bool bPaused);
void scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, bool bPaused);
/** 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.
@ -174,7 +180,7 @@ public:
If 'interval' is 0, it will be called every frame.
return schedule script entry ID, used for unscheduleScriptFunc().
*/
unsigned int scheduleScriptFunc(unsigned int nHandler, ccTime fInterval, bool bPaused);
unsigned int scheduleScriptFunc(unsigned int nHandler, float fInterval, bool bPaused);
/** Unschedule a script entry. */
void unscheduleScriptEntry(unsigned int uScheduleScriptEntryID);
@ -208,7 +214,7 @@ private:
void appendIn(struct _listEntry **ppList, CCObject *pTarget, bool bPaused);
protected:
ccTime m_fTimeScale;
float m_fTimeScale;
//
// "updates with priority" stuff

View File

@ -94,13 +94,13 @@ bool CCAction::isDone()
return true;
}
void CCAction::step(ccTime dt)
void CCAction::step(float dt)
{
CC_UNUSED_PARAM(dt);
CCLOG("[Action step]. override me");
}
void CCAction::update(ccTime time)
void CCAction::update(float time)
{
CC_UNUSED_PARAM(time);
CCLOG("[Action update]. override me");
@ -178,7 +178,7 @@ void CCSpeed::stop()
CCAction::stop();
}
void CCSpeed::step(ccTime dt)
void CCSpeed::step(float dt)
{
m_pInnerAction->step(dt * m_fSpeed);
}
@ -303,7 +303,7 @@ CCObject *CCFollow::copyWithZone(CCZone *pZone)
CC_SAFE_DELETE(pNewZone);
return pRet;
}
void CCFollow::step(ccTime dt)
void CCFollow::step(float dt)
{
CC_UNUSED_PARAM(dt);

View File

@ -28,6 +28,7 @@ THE SOFTWARE.
#define __ACTIONS_CCACTION_H__
#include "CCObject.h"
#include "CCGeometry.h"
NS_CC_BEGIN
@ -62,7 +63,7 @@ public:
virtual void stop(void);
//! called every frame with it's delta time. DON'T override unless you know what you are doing.
virtual void step(ccTime dt);
virtual void step(float dt);
/**
called once per frame. time a value between 0 and 1
@ -72,7 +73,7 @@ public:
- 0.5 means that the action is in the middle
- 1 means that the action is over
*/
virtual void update(ccTime time);
virtual void update(float time);
inline CCNode* getTarget(void) { return m_pTarget; }
/** The action will modify the target properties. */
@ -122,15 +123,15 @@ public:
{}
virtual ~CCFiniteTimeAction(){}
//! get duration in seconds of the action
inline ccTime getDuration(void) { return m_fDuration; }
inline float getDuration(void) { return m_fDuration; }
//! set duration in seconds of the action
inline void setDuration(ccTime duration) { m_fDuration = duration; }
inline void setDuration(float duration) { m_fDuration = duration; }
/** returns a reversed action */
virtual CCFiniteTimeAction* reverse(void);
protected:
//! duration in seconds
ccTime m_fDuration;
float m_fDuration;
};
class CCActionInterval;
@ -161,7 +162,7 @@ public:
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void startWithTarget(CCNode* pTarget);
virtual void stop();
virtual void step(ccTime dt);
virtual void step(float dt);
virtual bool isDone(void);
virtual CCActionInterval* reverse(void);
@ -181,10 +182,6 @@ protected:
CCActionInterval *m_pInnerAction;
};
class CCNode;
class CCPoint;
class CCRect;
/**
@brief CCFollow is an action that "follows" a node.
@ -219,7 +216,7 @@ public:
bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void step(ccTime dt);
virtual void step(float dt);
virtual bool isDone(void);
virtual void stop(void);

View File

@ -116,7 +116,7 @@ void CCOrbitCamera::startWithTarget(CCNode *pTarget)
m_fRadX = (CCFloat)CC_DEGREES_TO_RADIANS(m_fAngleX);
}
void CCOrbitCamera::update(ccTime dt)
void CCOrbitCamera::update(float dt)
{
float r = (m_fRadius + m_fDeltaRadius * dt) * CCCamera::getZEye();
float za = m_fRadZ + m_fRadDeltaZ * dt;

View File

@ -96,7 +96,7 @@ public:
// super methods
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
protected:
float m_fRadius;

View File

@ -0,0 +1,415 @@
/*
* Copyright (c) 2010-2012 cocos2d-x.org
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2008 Radu Gruian
*
* Copyright (c) 2011 Vit Valentin
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
* Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
*
* Adapted to cocos2d-x by Vit Valentin
*
* Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada
*/
#include "ccMacros.h"
#include "support/CCPointExtension.h"
#include "CCActionCatmullRom.h"
NS_CC_BEGIN;
/*
* Implementation of CCPointArray
*/
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;
}
bool CCPointArray::initWithCapacity(unsigned int capacity)
{
m_pControlPoints = new CCArray(capacity);
return true;
}
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);
points->setControlPoints(newArray);
newArray->release();
return points;
}
CCPointArray::~CCPointArray()
{
CC_SAFE_RELEASE_NULL(m_pControlPoints);
}
CCPointArray::CCPointArray() :m_pControlPoints(NULL){}
void CCPointArray::addControlPoint(CCPoint &controlPoint)
{
m_pControlPoints->addObject(&controlPoint);
}
void CCPointArray::insertControlPoint(CCPoint &controlPoint, unsigned int index)
{
m_pControlPoints->insertObject(&controlPoint, index);
}
CCPoint CCPointArray::getControlPointAtIndex(unsigned int index)
{
index = MIN(m_pControlPoints->count()-1, MAX(index, 0));
CCPoint point = *((CCPoint*)m_pControlPoints->objectAtIndex(index));
return point;
}
void CCPointArray::replaceControlPoint(cocos2d::CCPoint &controlPoint, unsigned int index)
{
m_pControlPoints->replaceObjectAtIndex(index, &controlPoint);
}
void CCPointArray::removeControlPointAtIndex(unsigned int index)
{
m_pControlPoints->removeObjectAtIndex(index);
}
unsigned int CCPointArray::count()
{
return m_pControlPoints->count();
}
CCPointArray* CCPointArray::reverse()
{
CCArray *newArray = new CCArray(m_pControlPoints->count());
for (int i = m_pControlPoints->count()-1; i >= 0; --i)
{
newArray->addObject(m_pControlPoints->objectAtIndex(i));
}
CCPointArray *config = CCPointArray::arrayWithCapacity(0);
config->setControlPoints(newArray);
newArray->release();
config->autorelease();
return config;
}
void CCPointArray::reverseInline()
{
unsigned int l = m_pControlPoints->count();
for (unsigned int i = 0; i < l/2; ++i)
{
m_pControlPoints->exchangeObjectAtIndex(i, l-i-1);
}
}
// CatmullRom Spline formula:
inline CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, CCFloat tension, float t)
{
float t2 = t * t;
float t3 = t2 * t;
/*
* Formula: s(-ttt + 2tt t)P1 + s(-ttt + tt)P2 + (2ttt 3tt + 1)P2 + s(ttt 2tt + t)P3 + (-2ttt + 3tt)P3 + s(ttt tt)P4
*/
float s = (1 - tension) / 2;
float b1 = s * ((-t3 + (2 * t2)) - t); // s(-t3 + 2 t2 t)P1
float b2 = s * (-t3 + t2) + (2 * t3 - 3 * t2 + 1); // s(-t3 + t2)P2 + (2 t3 3 t2 + 1)P2
float b3 = s * (t3 - 2 * t2 + t) + (-2 * t3 + 3 * t2); // s(t3 2 t2 + t)P3 + (-2 t3 + 3 t2)P3
float b4 = s * (t3 - t2); // s(t3 t2)P4
float x = (p0.x*b1 + p1.x*b2 + p2.x*b3 + p3.x*b4);
float y = (p0.y*b1 + p1.y*b2 + p2.y*b3 + p3.y*b4);
return ccp(x,y);
}
/* Implementation of CCCardinalSplineTo
*/
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;
}
bool CCCardinalSplineTo::initWithDuration(float duration, cocos2d::CCPointArray *points, float tension)
{
CCAssert(points->count() > 0, "Invalid configuration. It must at least have one control point");
if (CCActionInterval::initWithDuration(duration))
{
this->setPoints(points);
this->m_fTension = tension;
return true;
}
return false;
}
CCCardinalSplineTo::~CCCardinalSplineTo()
{
CC_SAFE_RELEASE_NULL(m_pPoints);
}
CCCardinalSplineTo::CCCardinalSplineTo()
: m_pPoints(NULL)
, m_fTension(0.f)
, m_fDeltaT(0.f)
{
}
void CCCardinalSplineTo::startWithTarget(cocos2d::CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
m_fDeltaT = (float) 1 / m_pPoints->count();
}
CCCardinalSplineTo* CCCardinalSplineTo::copyWithZone(cocos2d::CCZone *pZone)
{
CCCardinalSplineTo *copy = CCCardinalSplineTo::actionWithDuration(this->getDuration(), this->m_pPoints, this->m_fTension);
return copy;
}
void CCCardinalSplineTo::update(float time)
{
unsigned int p;
float lt;
// border
if (time == 1)
{
p = m_pPoints->count() - 1;
lt = 1;
}
else
{
p = time / m_fDeltaT;
lt = (time - m_fDeltaT * (float)p) / m_fDeltaT;
}
// Interpolate
CCPoint pp0 = m_pPoints->getControlPointAtIndex(p-1);
CCPoint pp1 = m_pPoints->getControlPointAtIndex(p+0);
CCPoint pp2 = m_pPoints->getControlPointAtIndex(p+1);
CCPoint pp3 = m_pPoints->getControlPointAtIndex(p+2);
CCPoint newPos = ccCardinalSplineAt(pp0, pp1, pp2, pp3, m_fTension, lt);
this->updatePosition(newPos);
}
void CCCardinalSplineTo::updatePosition(cocos2d::CCPoint &newPos)
{
m_pTarget->setPosition(newPos);
}
CCActionInterval* CCCardinalSplineTo::reverse()
{
CCPointArray *reverse = m_pPoints->reverse();
return CCCardinalSplineTo::actionWithDuration(m_fDuration, reverse, m_fTension);
}
/* CCCardinalSplineBy
*/
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() : m_startPosition(0,0)
{
}
void CCCardinalSplineBy::updatePosition(cocos2d::CCPoint &newPos)
{
m_pTarget->setPosition(ccpAdd(newPos, m_startPosition));
}
CCActionInterval* CCCardinalSplineBy::reverse()
{
CCPointArray *copyConfig = (CCPointArray*)m_pPoints->copy();
//
// convert "absolutes" to "diffs"
//
CCPoint p = copyConfig->getControlPointAtIndex(0);
for (unsigned int i = 1; i < copyConfig->count(); ++i)
{
CCPoint current = copyConfig->getControlPointAtIndex(i);
CCPoint diff = ccpSub(current, p);
copyConfig->replaceControlPoint(diff, i);
p = current;
}
// convert to "diffs" to "reverse absolute"
CCPointArray *reverse = 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 = ccpNeg(p);
reverse->insertControlPoint(p, 0);
for (unsigned int i = 1; i < reverse->count(); ++i)
{
CCPoint current = reverse->getControlPointAtIndex(i);
current = ccpNeg(current);
CCPoint abs = ccpAdd(current, p);
reverse->replaceControlPoint(abs, i);
p = abs;
}
return CCCardinalSplineBy::actionWithDuration(m_fDuration, reverse, m_fTension);
}
void CCCardinalSplineBy::startWithTarget(cocos2d::CCNode *pTarget)
{
CCCardinalSplineTo::startWithTarget(pTarget);
m_startPosition = pTarget->getPosition();
}
/* CCCatmullRomTo
*/
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;
}
bool CCCatmullRomTo::initWithDuration(float dt, cocos2d::CCPointArray *points)
{
if (CCCardinalSplineTo::initWithDuration(dt, points, 0.5f))
{
return true;
}
return false;
}
/* CCCatmullRomBy
*/
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;
}
bool CCCatmullRomBy::initWithDuration(float dt, cocos2d::CCPointArray *points)
{
if (CCCardinalSplineTo::initWithDuration(dt, points, 0.5f))
{
return true;
}
return false;
}
NS_CC_END;

View File

@ -0,0 +1,188 @@
/*
* Copyright (c) 2012 cocos2d-x.org
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2008 Radu Gruian
*
* Copyright (c) 2011 Vit Valentin
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
* Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
*
* Adapted to cocos2d-x by Vit Valentin
*
* Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada
*/
#ifndef __CCACTION_CATMULLROM_H__
#define __CCACTION_CATMULLROM_H__
#include "CCActionInterval.h"
#include "CCNode.h"
#include "CCGeometry.h"
NS_CC_BEGIN;
/** An Array that contain control points.
Used by CCCardinalSplineTo and (By) and CCCatmullRomTo (and By) actions.
*/
class CC_DLL CCPointArray : public CCNode
{
public:
/** creates and initializes a Points array with capacity */
static CCPointArray* arrayWithCapacity(unsigned int capacity);
virtual ~CCPointArray();
CCPointArray();
/** initializes a Catmull Rom config with a capacity hint */
bool initWithCapacity(unsigned int capacity);
/** appends a control point */
void addControlPoint(CCPoint &controlPoint);
/** inserts a controlPoint at index */
void insertControlPoint(CCPoint &controlPoint, unsigned int index);
/** replaces an existing controlPoint at index */
void replaceControlPoint(CCPoint &controlPoint, unsigned int index);
/** get the value of a controlPoint at a given index */
CCPoint getControlPointAtIndex(unsigned int index);
/** deletes a control point at a given index */
void removeControlPointAtIndex(unsigned int index);
/** returns the number of objects of the control point array */
unsigned int count();
/** returns a new copy of the array reversed. User is responsible for releasing this copy */
CCPointArray* reverse();
/** reverse the current control point array inline, without generating a new one */
void reverseInline();
virtual CCObject* copyWithZone(CCZone *zone);
inline CCArray* getControlPoints(){ return m_pControlPoints; }
inline void setControlPoints(CCArray *controlPoints)
{
CC_SAFE_RETAIN(controlPoints);
CC_SAFE_RELEASE(m_pControlPoints);
m_pControlPoints = controlPoints;
}
private:
/** Array that contains the control points */
CCArray *m_pControlPoints;
};
/** Cardinal Spline path.
http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
*/
class CC_DLL CCCardinalSplineTo : public CCActionInterval
{
public:
/** creates an action with a Cardinal Spline array of points and tension */
static CCCardinalSplineTo* actionWithDuration(float duration, CCPointArray* points, float tension);
virtual ~CCCardinalSplineTo();
CCCardinalSplineTo();
/** initializes the action with a duration and an array of points */
bool initWithDuration(float duration, CCPointArray* points, float tension);
// super virtual functions
virtual CCCardinalSplineTo* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(float time);
virtual CCActionInterval* reverse();
virtual void updatePosition(CCPoint &newPos);
inline CCPointArray* getPoints() { return m_pPoints; }
inline void setPoints(CCPointArray* points)
{
CC_SAFE_RETAIN(points);
CC_SAFE_RELEASE(m_pPoints);
m_pPoints = points;
}
protected:
/** Array of control points */
CCPointArray *m_pPoints;
float m_fDeltaT;
float m_fTension;
};
/** Cardinal Spline path.
http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
*/
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);
CCCardinalSplineBy();
virtual void startWithTarget(CCNode *pTarget);
virtual CCActionInterval* reverse();
virtual void updatePosition(CCPoint &newPos);
protected:
CCPoint m_startPosition;
};
/** An action that moves the target with a CatmullRom curve to a destination point.
A Catmull Rom is a Cardinal Spline with a tension of 0.5.
http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
*/
class CCCatmullRomTo : public CCCardinalSplineTo
{
public:
/** creates an action with a Cardinal Spline array of points and tension */
static CCCatmullRomTo* actionWithDuration(float dt, CCPointArray* points);
/** initializes the action with a duration and an array of points */
bool initWithDuration(float dt, CCPointArray* points);
};
/** An action that moves the target with a CatmullRom curve by a certain distance.
A Catmull Rom is a Cardinal Spline with a tension of 0.5.
http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
*/
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);
/** initializes the action with a duration and an array of points */
bool initWithDuration(float dt, CCPointArray* points);
};
/** Returns the Cardinal Spline position for a given set of control points, tension and time */
extern CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, CCFloat tension, float t);
NS_CC_END;
#endif // __CCACTION_CATMULLROM_H__

View File

@ -115,7 +115,7 @@ void CCActionEase::stop(void)
CCActionInterval::stop();
}
void CCActionEase::update(ccTime time)
void CCActionEase::update(float time)
{
m_pOther->update(time);
}
@ -229,7 +229,7 @@ CCObject* CCEaseIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseIn::update(ccTime time)
void CCEaseIn::update(float time)
{
m_pOther->update(powf(time, m_fRate));
}
@ -281,7 +281,7 @@ CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseOut::update(ccTime time)
void CCEaseOut::update(float time)
{
m_pOther->update(powf(time, 1 / m_fRate));
}
@ -333,7 +333,7 @@ CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseInOut::update(ccTime time)
void CCEaseInOut::update(float time)
{
time *= 2;
if (time < 1)
@ -394,7 +394,7 @@ CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseExponentialIn::update(ccTime time)
void CCEaseExponentialIn::update(float time)
{
m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
}
@ -446,7 +446,7 @@ CCObject* CCEaseExponentialOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseExponentialOut::update(ccTime time)
void CCEaseExponentialOut::update(float time)
{
m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
}
@ -498,7 +498,7 @@ CCObject* CCEaseExponentialInOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseExponentialInOut::update(ccTime time)
void CCEaseExponentialInOut::update(float time)
{
time /= 0.5f;
if (time < 1)
@ -560,7 +560,7 @@ CCObject* CCEaseSineIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseSineIn::update(ccTime time)
void CCEaseSineIn::update(float time)
{
m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1);
}
@ -612,7 +612,7 @@ CCObject* CCEaseSineOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseSineOut::update(ccTime time)
void CCEaseSineOut::update(float time)
{
m_pOther->update(sinf(time * (float)M_PI_2));
}
@ -664,7 +664,7 @@ CCObject* CCEaseSineInOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseSineInOut::update(ccTime time)
void CCEaseSineInOut::update(float time)
{
m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1));
}
@ -817,9 +817,9 @@ CCObject* CCEaseElasticIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseElasticIn::update(ccTime time)
void CCEaseElasticIn::update(float time)
{
ccTime newT = 0;
float newT = 0;
if (time == 0 || time == 1)
{
newT = time;
@ -899,9 +899,9 @@ CCObject *CCEaseElasticOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseElasticOut::update(ccTime time)
void CCEaseElasticOut::update(float time)
{
ccTime newT = 0;
float newT = 0;
if (time == 0 || time == 1)
{
newT = time;
@ -981,9 +981,9 @@ CCObject* CCEaseElasticInOut::copyWithZone(CCZone *pZone)
}
void CCEaseElasticInOut::update(ccTime time)
void CCEaseElasticInOut::update(float time)
{
ccTime newT = 0;
float newT = 0;
if (time == 0 || time == 1)
{
newT = time;
@ -996,7 +996,7 @@ void CCEaseElasticInOut::update(ccTime time)
m_fPeriod = 0.3f * 1.5f;
}
ccTime s = m_fPeriod / 4;
float s = m_fPeriod / 4;
time = time - 1;
if (time < 0)
@ -1059,7 +1059,7 @@ CCObject* CCEaseBounce::copyWithZone(CCZone *pZone)
return pCopy;
}
ccTime CCEaseBounce::bounceTime(ccTime time)
float CCEaseBounce::bounceTime(float time)
{
if (time < 1 / 2.75)
{
@ -1127,9 +1127,9 @@ CCObject* CCEaseBounceIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseBounceIn::update(ccTime time)
void CCEaseBounceIn::update(float time)
{
ccTime newT = 1 - bounceTime(1 - time);
float newT = 1 - bounceTime(1 - time);
m_pOther->update(newT);
}
@ -1180,9 +1180,9 @@ CCObject* CCEaseBounceOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseBounceOut::update(ccTime time)
void CCEaseBounceOut::update(float time)
{
ccTime newT = bounceTime(time);
float newT = bounceTime(time);
m_pOther->update(newT);
}
@ -1233,9 +1233,9 @@ CCObject* CCEaseBounceInOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseBounceInOut::update(ccTime time)
void CCEaseBounceInOut::update(float time)
{
ccTime newT = 0;
float newT = 0;
if (time < 0.5f)
{
time = time * 2;
@ -1296,9 +1296,9 @@ CCObject* CCEaseBackIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseBackIn::update(ccTime time)
void CCEaseBackIn::update(float time)
{
ccTime overshoot = 1.70158f;
float overshoot = 1.70158f;
m_pOther->update(time * time * ((overshoot + 1) * time - overshoot));
}
@ -1349,9 +1349,9 @@ CCObject* CCEaseBackOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseBackOut::update(ccTime time)
void CCEaseBackOut::update(float time)
{
ccTime overshoot = 1.70158f;
float overshoot = 1.70158f;
time = time - 1;
m_pOther->update(time * time * ((overshoot + 1) * time + overshoot) + 1);
@ -1404,9 +1404,9 @@ CCObject* CCEaseBackInOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCEaseBackInOut::update(ccTime time)
void CCEaseBackInOut::update(float time)
{
ccTime overshoot = 1.70158f * 1.525f;
float overshoot = 1.70158f * 1.525f;
time = time * 2;
if (time < 1)

View File

@ -47,7 +47,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
@ -91,7 +91,7 @@ protected:
class CC_DLL CCEaseIn : public CCEaseRateAction
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
@ -105,7 +105,7 @@ public:
class CC_DLL CCEaseOut : public CCEaseRateAction
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse();
virtual CCObject* copyWithZone(CCZone* pZone);
@ -120,7 +120,7 @@ public:
class CC_DLL CCEaseInOut : public CCEaseRateAction
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse(void);
@ -135,7 +135,7 @@ public:
class CC_DLL CCEaseExponentialIn : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -150,7 +150,7 @@ public:
class CC_DLL CCEaseExponentialOut : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -166,7 +166,7 @@ public:
class CC_DLL CCEaseExponentialInOut : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
@ -182,7 +182,7 @@ public:
class CC_DLL CCEaseSineIn : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -197,7 +197,7 @@ public:
class CC_DLL CCEaseSineOut : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -212,7 +212,7 @@ public:
class CC_DLL CCEaseSineInOut : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
@ -259,7 +259,7 @@ protected:
class CC_DLL CCEaseElasticIn : public CCEaseElastic
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -278,7 +278,7 @@ public:
class CC_DLL CCEaseElasticOut : public CCEaseElastic
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -297,7 +297,7 @@ public:
class CC_DLL CCEaseElasticInOut : public CCEaseElastic
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -315,7 +315,7 @@ public:
class CC_DLL CCEaseBounce : public CCActionEase
{
public:
ccTime bounceTime(ccTime time);
float bounceTime(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
@ -332,7 +332,7 @@ public:
class CC_DLL CCEaseBounceIn : public CCEaseBounce
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -349,7 +349,7 @@ public:
class CC_DLL CCEaseBounceOut : public CCEaseBounce
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -366,7 +366,7 @@ public:
class CC_DLL CCEaseBounceInOut : public CCEaseBounce
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
@ -383,7 +383,7 @@ public:
class CC_DLL CCEaseBackIn : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -400,7 +400,7 @@ public:
class CC_DLL CCEaseBackOut : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -417,7 +417,7 @@ public:
class CC_DLL CCEaseBackInOut : public CCActionEase
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();

View File

@ -30,7 +30,7 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCGridAction
CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, ccTime duration)
CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, float duration)
{
CCGridAction *pAction = new CCGridAction();
if (pAction)
@ -48,7 +48,7 @@ CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, ccTime du
return pAction;
}
bool CCGridAction::initWithSize(const ccGridSize& gridSize, ccTime duration)
bool CCGridAction::initWithSize(const ccGridSize& gridSize, float duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -181,7 +181,7 @@ void CCTiledGrid3DAction::setTile(const ccGridSize& pos, const ccQuad3& coords)
// implementation CCAccelDeccelAmplitude
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pAction, float duration)
{
CCAccelDeccelAmplitude *pRet = new CCAccelDeccelAmplitude();
if (pRet)
@ -199,7 +199,7 @@ CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pActi
return pRet;
}
bool CCAccelDeccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
bool CCAccelDeccelAmplitude::initWithAction(CCAction *pAction, float duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -224,7 +224,7 @@ void CCAccelDeccelAmplitude::startWithTarget(CCNode *pTarget)
m_pOther->startWithTarget(pTarget);
}
void CCAccelDeccelAmplitude::update(ccTime time)
void CCAccelDeccelAmplitude::update(float time)
{
float f = time * 2;
@ -244,7 +244,7 @@ CCActionInterval* CCAccelDeccelAmplitude::reverse(void)
// implementation of AccelAmplitude
CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, float duration)
{
CCAccelAmplitude *pRet = new CCAccelAmplitude();
if (pRet)
@ -262,7 +262,7 @@ CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, ccTime d
return pRet;
}
bool CCAccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
bool CCAccelAmplitude::initWithAction(CCAction *pAction, float duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -287,7 +287,7 @@ void CCAccelAmplitude::startWithTarget(CCNode *pTarget)
m_pOther->startWithTarget(pTarget);
}
void CCAccelAmplitude::update(ccTime time)
void CCAccelAmplitude::update(float time)
{
((CCAccelAmplitude*)(m_pOther))->setAmplitudeRate(powf(time, m_fRate));
m_pOther->update(time);
@ -300,7 +300,7 @@ CCActionInterval* CCAccelAmplitude::reverse(void)
// DeccelAmplitude
CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, float duration)
{
CCDeccelAmplitude *pRet = new CCDeccelAmplitude();
if (pRet)
@ -318,7 +318,7 @@ CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime
return pRet;
}
bool CCDeccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
bool CCDeccelAmplitude::initWithAction(CCAction *pAction, float duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -343,7 +343,7 @@ void CCDeccelAmplitude::startWithTarget(CCNode *pTarget)
m_pOther->startWithTarget(pTarget);
}
void CCDeccelAmplitude::update(ccTime time)
void CCDeccelAmplitude::update(float time)
{
((CCDeccelAmplitude*)(m_pOther))->setAmplitudeRate(powf((1 - time), m_fRate));
m_pOther->update(time);

View File

@ -41,13 +41,13 @@ public:
virtual CCActionInterval* reverse(void);
/** initializes the action with size and duration */
virtual bool initWithSize(const ccGridSize& gridSize, ccTime duration);
virtual bool initWithSize(const ccGridSize& gridSize, float duration);
/** returns the grid */
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration */
static CCGridAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
static CCGridAction* actionWithSize(const ccGridSize& gridSize, float duration);
protected:
ccGridSize m_sGridSize;
@ -71,7 +71,7 @@ public:
public:
/** creates the action with size and duration */
static CCGrid3DAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
static CCGrid3DAction* actionWithSize(const ccGridSize& gridSize, float duration);
};
/** @brief Base class for CCTiledGrid3D actions */
@ -90,7 +90,7 @@ public:
public:
/** creates the action with size and duration */
static CCTiledGrid3DAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
static CCTiledGrid3DAction* actionWithSize(const ccGridSize& gridSize, float duration);
};
/** @brief CCAccelDeccelAmplitude action */
@ -99,10 +99,10 @@ class CC_DLL CCAccelDeccelAmplitude : public CCActionInterval
public:
virtual ~CCAccelDeccelAmplitude(void);
/** initializes the action with an inner action that has the amplitude property, and a duration time */
bool initWithAction(CCAction *pAction, ccTime duration);
bool initWithAction(CCAction *pAction, float duration);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
/** get amplitude rate */
@ -112,7 +112,7 @@ public:
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
static CCAccelDeccelAmplitude* actionWithAction(CCAction *pAction, float duration);
protected:
float m_fRate;
@ -125,7 +125,7 @@ class CC_DLL CCAccelAmplitude : public CCActionInterval
public:
~CCAccelAmplitude(void);
/** initializes the action with an inner action that has the amplitude property, and a duration time */
bool initWithAction(CCAction *pAction, ccTime duration);
bool initWithAction(CCAction *pAction, float duration);
/** get amplitude rate */
inline float getRate(void) { return m_fRate; }
@ -133,12 +133,12 @@ public:
inline void setRate(float fRate) { m_fRate = fRate; }
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
static CCAccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
static CCAccelAmplitude* actionWithAction(CCAction *pAction, float duration);
protected:
float m_fRate;
@ -151,7 +151,7 @@ class CC_DLL CCDeccelAmplitude : public CCActionInterval
public:
~CCDeccelAmplitude(void);
/** initializes the action with an inner action that has the amplitude property, and a duration time */
bool initWithAction(CCAction *pAction, ccTime duration);
bool initWithAction(CCAction *pAction, float duration);
/** get amplitude rate */
inline float getRate(void) { return m_fRate; }
@ -159,12 +159,12 @@ public:
inline void setRate(float fRate) { m_fRate = fRate; }
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
static CCDeccelAmplitude* actionWithAction(CCAction *pAction, ccTime duration);
static CCDeccelAmplitude* actionWithAction(CCAction *pAction, float duration);
protected:
float m_fRate;

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCWaves3D
CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCWaves3D *pAction = new CCWaves3D();
@ -50,7 +50,7 @@ CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& grid
return pAction;
}
bool CCWaves3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
bool CCWaves3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -88,7 +88,7 @@ CCObject* CCWaves3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCWaves3D::update(ccTime time)
void CCWaves3D::update(float time)
{
int i, j;
for (i = 0; i < m_sGridSize.x + 1; ++i)
@ -105,7 +105,7 @@ void CCWaves3D::update(ccTime time)
// implementation of CCFlipX3D
CCFlipX3D* CCFlipX3D::actionWithDuration(ccTime duration)
CCFlipX3D* CCFlipX3D::actionWithDuration(float duration)
{
CCFlipX3D *pAction = new CCFlipX3D();
@ -124,12 +124,12 @@ CCFlipX3D* CCFlipX3D::actionWithDuration(ccTime duration)
return pAction;
}
bool CCFlipX3D::initWithDuration(ccTime duration)
bool CCFlipX3D::initWithDuration(float duration)
{
return CCGrid3DAction::initWithSize(ccg(1, 1), duration);
}
bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, ccTime duration)
bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, float duration)
{
if (gridSize.x != 1 || gridSize.y != 1)
{
@ -165,7 +165,7 @@ CCObject* CCFlipX3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCFlipX3D::update(ccTime time)
void CCFlipX3D::update(float time)
{
CCFloat angle = (CCFloat)M_PI * time; // 180 degrees
CCFloat mz = sinf(angle);
@ -231,7 +231,7 @@ void CCFlipX3D::update(ccTime time)
// implementation of FlipY3D
CCFlipY3D* CCFlipY3D::actionWithDuration(ccTime duration)
CCFlipY3D* CCFlipY3D::actionWithDuration(float duration)
{
CCFlipY3D *pAction = new CCFlipY3D();
@ -273,7 +273,7 @@ CCObject* CCFlipY3D::copyWithZone(CCZone* pZone)
return pCopy;
}
void CCFlipY3D::update(ccTime time)
void CCFlipY3D::update(float time)
{
CCFloat angle = (CCFloat)M_PI * time; // 180 degrees
CCFloat mz = sinf( angle );
@ -340,7 +340,7 @@ void CCFlipY3D::update(ccTime time)
// implementation of Lens3D
CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration)
CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
{
CCLens3D *pAction = new CCLens3D();
@ -359,7 +359,7 @@ CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGrid
return pAction;
}
bool CCLens3D::initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration)
bool CCLens3D::initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -409,7 +409,7 @@ void CCLens3D::setPosition(const CCPoint& pos)
}
}
void CCLens3D::update(ccTime time)
void CCLens3D::update(float time)
{
CC_UNUSED_PARAM(time);
if (m_bDirty)
@ -454,7 +454,7 @@ void CCLens3D::update(ccTime time)
// implementation of Ripple3D
CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, ccTime duration)
CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCRipple3D *pAction = new CCRipple3D();
@ -473,7 +473,7 @@ CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav,
return pAction;
}
bool CCRipple3D::initWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, ccTime duration)
bool CCRipple3D::initWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -519,7 +519,7 @@ CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCRipple3D::update(ccTime time)
void CCRipple3D::update(float time)
{
int i, j;
@ -545,7 +545,7 @@ void CCRipple3D::update(ccTime time)
// implementation of Shaky3D
CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration)
CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
{
CCShaky3D *pAction = new CCShaky3D();
@ -564,7 +564,7 @@ CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize&
return pAction;
}
bool CCShaky3D::initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration)
bool CCShaky3D::initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -600,7 +600,7 @@ CCObject* CCShaky3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCShaky3D::update(ccTime time)
void CCShaky3D::update(float time)
{
CC_UNUSED_PARAM(time);
int i, j;
@ -624,7 +624,7 @@ void CCShaky3D::update(ccTime time)
// implementation of Liquid
CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCLiquid *pAction = new CCLiquid();
@ -643,7 +643,7 @@ CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSi
return pAction;
}
bool CCLiquid::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
bool CCLiquid::initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -680,7 +680,7 @@ CCObject* CCLiquid::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCLiquid::update(ccTime time)
void CCLiquid::update(float time)
{
int i, j;
@ -698,7 +698,7 @@ void CCLiquid::update(ccTime time)
// implementation of Waves
CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, ccTime duration)
CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
{
CCWaves *pAction = new CCWaves();
@ -717,7 +717,7 @@ CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGr
return pAction;
}
bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, ccTime duration)
bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -756,7 +756,7 @@ CCObject* CCWaves::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCWaves::update(ccTime time)
void CCWaves::update(float time)
{
int i, j;
@ -783,7 +783,7 @@ void CCWaves::update(ccTime time)
// implementation of Twirl
CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize, ccTime duration)
CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize, float duration)
{
CCTwirl *pAction = new CCTwirl();
@ -802,7 +802,7 @@ CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGrid
return pAction;
}
bool CCTwirl::initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize, ccTime duration)
bool CCTwirl::initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize, float duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -848,7 +848,7 @@ CCObject* CCTwirl::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCTwirl::update(ccTime time)
void CCTwirl::update(float time)
{
int i, j;
CCPoint c = m_positionInPixels;

View File

@ -41,14 +41,14 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** init the action */
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** create the action */
static CCWaves3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
static CCWaves3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nWaves;
@ -61,26 +61,26 @@ class CC_DLL CCFlipX3D : public CCGrid3DAction
{
public:
/** initializes the action with duration */
bool initWithDuration(ccTime duration);
virtual bool initWithSize(const ccGridSize& gridSize, ccTime duration);
bool initWithDuration(float duration);
virtual bool initWithSize(const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with duration */
static CCFlipX3D* actionWithDuration(ccTime duration);
static CCFlipX3D* actionWithDuration(float duration);
};
/** @brief CCFlipY3D action */
class CC_DLL CCFlipY3D : public CCFlipX3D
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action with duration */
static CCFlipY3D* actionWithDuration(ccTime duration);
static CCFlipY3D* actionWithDuration(float duration);
};
/** @brief CCLens3D action */
@ -96,13 +96,13 @@ public:
void setPosition(const CCPoint& position);
/** initializes the action with center position, radius, a grid size and duration */
bool initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration);
bool initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with center position, radius, a grid size and duration */
static CCLens3D* actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration);
static CCLens3D* actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration);
protected:
/* lens center position */
CCPoint m_position;
@ -133,14 +133,14 @@ public:
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
bool initWithPosition(const CCPoint& pos, float r, int wav, float amp,
const ccGridSize& gridSize, ccTime duration);
const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** 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,
const ccGridSize& gridSize, ccTime duration);
const ccGridSize& gridSize, float duration);
protected:
/* center position */
CCPoint m_position;
@ -158,13 +158,13 @@ class CC_DLL CCShaky3D : public CCGrid3DAction
{
public:
/** initializes the action with a range, shake Z vertices, a grid and duration */
bool initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration);
bool initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with a range, shake Z vertices, a grid and duration */
static CCShaky3D* actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration);
static CCShaky3D* actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration);
protected:
int m_nRandrange;
@ -182,13 +182,13 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with amplitude, a grid and duration */
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with amplitude, a grid and duration */
static CCLiquid* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
static CCLiquid* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nWaves;
@ -208,14 +208,14 @@ public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
bool initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
ccTime duration);
float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** 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,
ccTime duration);
float duration);
protected:
int m_nWaves;
float m_fAmplitude;
@ -241,14 +241,14 @@ public:
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
bool initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize,
ccTime duration);
float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** 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,
ccTime duration);
float duration);
protected:
/* twirl center */
CCPoint m_position;

View File

@ -56,12 +56,12 @@ bool CCActionInstant::isDone() {
return true;
}
void CCActionInstant::step(ccTime dt) {
void CCActionInstant::step(float dt) {
CC_UNUSED_PARAM(dt);
update(1);
}
void CCActionInstant::update(ccTime time) {
void CCActionInstant::update(float time) {
CC_UNUSED_PARAM(time);
// nothing
}
@ -83,7 +83,7 @@ CCShow* CCShow::action() {
return pRet;
}
void CCShow::update(ccTime time) {
void CCShow::update(float time) {
CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(true);
}
@ -121,7 +121,7 @@ CCHide * CCHide::action() {
return pRet;
}
void CCHide::update(ccTime time) {
void CCHide::update(float time) {
CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(false);
}
@ -161,7 +161,7 @@ CCToggleVisibility * CCToggleVisibility::action()
return pRet;
}
void CCToggleVisibility::update(ccTime time)
void CCToggleVisibility::update(float time)
{
CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(!m_pTarget->getIsVisible());
@ -204,7 +204,7 @@ bool CCFlipX::initWithFlipX(bool x) {
return true;
}
void CCFlipX::update(ccTime time) {
void CCFlipX::update(float time) {
CC_UNUSED_PARAM(time);
((CCSprite*) (m_pTarget))->setFlipX(m_bFlipX);
}
@ -250,7 +250,7 @@ bool CCFlipY::initWithFlipY(bool y) {
return true;
}
void CCFlipY::update(ccTime time) {
void CCFlipY::update(float time) {
CC_UNUSED_PARAM(time);
((CCSprite*) (m_pTarget))->setFlipY(m_bFlipY);
}
@ -313,7 +313,7 @@ CCObject * CCPlace::copyWithZone(CCZone *pZone) {
return pRet;
}
void CCPlace::update(ccTime time) {
void CCPlace::update(float time) {
CC_UNUSED_PARAM(time);
m_pTarget->setPosition(m_tPosition);
}
@ -370,7 +370,7 @@ CCObject * CCCallFunc::copyWithZone(CCZone *pZone) {
return pRet;
}
void CCCallFunc::update(ccTime time) {
void CCCallFunc::update(float time) {
CC_UNUSED_PARAM(time);
this->execute();
}

View File

@ -44,8 +44,8 @@ public:
// CCAction methods
virtual CCObject* copyWithZone(CCZone *pZone);
virtual bool isDone(void);
virtual void step(ccTime dt);
virtual void update(ccTime time);
virtual void step(float dt);
virtual void update(float time);
//CCFiniteTimeAction method
virtual CCFiniteTimeAction * reverse(void);
};
@ -58,7 +58,7 @@ public:
CCShow(){}
virtual ~CCShow(){}
//super methods
virtual void update(ccTime time);
virtual void update(float time);
virtual CCFiniteTimeAction * reverse(void);
virtual CCObject* copyWithZone(CCZone *pZone);
public:
@ -78,7 +78,7 @@ public:
CCHide(){}
virtual ~CCHide(){}
//super methods
virtual void update(ccTime time);
virtual void update(float time);
virtual CCFiniteTimeAction * reverse(void);
virtual CCObject* copyWithZone(CCZone *pZone);
public:
@ -95,7 +95,7 @@ public:
CCToggleVisibility(){}
virtual ~CCToggleVisibility(){}
//super method
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone *pZone);
public:
//override static method
@ -120,7 +120,7 @@ public:
/** init the action */
bool initWithFlipX(bool x);
//super methods
virtual void update(ccTime time);
virtual void update(float time);
virtual CCFiniteTimeAction * reverse(void);
virtual CCObject* copyWithZone(CCZone *pZone);
@ -145,7 +145,7 @@ public:
/** init the action */
bool initWithFlipY(bool y);
//super methods
virtual void update(ccTime time);
virtual void update(float time);
virtual CCFiniteTimeAction * reverse(void);
virtual CCObject* copyWithZone(CCZone *pZone);
@ -165,7 +165,7 @@ public:
/** Initializes a Place action with a position */
bool initWithPosition(const CCPoint& pos);
//super methods
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone *pZone);
protected:
CCPoint m_tPosition;
@ -202,7 +202,7 @@ public:
/** executes the callback */
virtual void execute();
//super methods
virtual void update(ccTime time);
virtual void update(float time);
CCObject * copyWithZone(CCZone *pZone);
inline CCObject* getTargetCallback()

View File

@ -38,7 +38,7 @@ NS_CC_BEGIN
//
// IntervalAction
//
CCActionInterval* CCActionInterval::actionWithDuration(ccTime d)
CCActionInterval* CCActionInterval::actionWithDuration(float d)
{
CCActionInterval *pAction = new CCActionInterval();
pAction->initWithDuration(d);
@ -47,7 +47,7 @@ CCActionInterval* CCActionInterval::actionWithDuration(ccTime d)
return pAction;
}
bool CCActionInterval::initWithDuration(ccTime d)
bool CCActionInterval::initWithDuration(float d)
{
m_fDuration = d;
@ -95,7 +95,7 @@ bool CCActionInterval::isDone(void)
return m_elapsed >= m_fDuration;
}
void CCActionInterval::step(ccTime dt)
void CCActionInterval::step(float dt)
{
if (m_bFirstTick)
{
@ -180,7 +180,7 @@ CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
return pPrev;
}
CCFiniteTimeAction* CCSequence::actionsWithArray(CCArray *actions)
CCFiniteTimeAction* CCSequence::actionWithArray(CCArray *actions)
{
CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
@ -197,7 +197,7 @@ bool CCSequence::initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *
CCAssert(pActionOne != NULL, "");
CCAssert(pActionTwo != NULL, "");
ccTime d = pActionOne->getDuration() + pActionTwo->getDuration();
float d = pActionOne->getDuration() + pActionTwo->getDuration();
CCActionInterval::initWithDuration(d);
m_pActions[0] = pActionOne;
@ -257,10 +257,10 @@ void CCSequence::stop(void)
CCActionInterval::stop();
}
void CCSequence::update(ccTime t)
void CCSequence::update(float t)
{
int found = 0;
ccTime new_t = 0.0f;
float new_t = 0.0f;
if( t < m_split ) {
// action[0]
@ -324,7 +324,7 @@ CCRepeat* CCRepeat::actionWithAction(CCFiniteTimeAction *pAction, unsigned int t
bool CCRepeat::initWithAction(CCFiniteTimeAction *pAction, unsigned int times)
{
ccTime d = pAction->getDuration() * times;
float d = pAction->getDuration() * times;
if (CCActionInterval::initWithDuration(d))
{
@ -391,7 +391,7 @@ void CCRepeat::stop(void)
// issue #80. Instead of hooking step:, hook update: since it can be called by any
// container action like CCRepeat, CCSequence, CCEase, etc..
void CCRepeat::update(ccTime dt)
void CCRepeat::update(float dt)
{
if (dt >= m_fNextDt)
{
@ -495,12 +495,12 @@ void CCRepeatForever::startWithTarget(CCNode* pTarget)
m_pInnerAction->startWithTarget(pTarget);
}
void CCRepeatForever::step(ccTime dt)
void CCRepeatForever::step(float dt)
{
m_pInnerAction->step(dt);
if (m_pInnerAction->isDone())
{
ccTime diff = m_pInnerAction->getElapsed() - m_pInnerAction->getDuration();
float diff = m_pInnerAction->getElapsed() - m_pInnerAction->getDuration();
m_pInnerAction->startWithTarget(m_pTarget);
// to prevent jerk. issue #390, 1247
m_pInnerAction->step(0.0f);
@ -546,7 +546,7 @@ CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
return pPrev;
}
CCFiniteTimeAction* CCSpawn::actionsWithArray(CCArray *actions)
CCFiniteTimeAction* CCSpawn::actionWithArray(CCArray *actions)
{
CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
@ -574,8 +574,8 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
bool bRet = false;
ccTime d1 = pAction1->getDuration();
ccTime d2 = pAction2->getDuration();
float d1 = pAction1->getDuration();
float d2 = pAction2->getDuration();
if (CCActionInterval::initWithDuration(MAX(d1, d2)))
{
@ -646,7 +646,7 @@ void CCSpawn::stop(void)
CCActionInterval::stop();
}
void CCSpawn::update(ccTime time)
void CCSpawn::update(float time)
{
if (m_pOne)
{
@ -666,7 +666,7 @@ CCActionInterval* CCSpawn::reverse(void)
//
// RotateTo
//
CCRotateTo* CCRotateTo::actionWithDuration(ccTime duration, float fDeltaAngle)
CCRotateTo* CCRotateTo::actionWithDuration(float duration, float fDeltaAngle)
{
CCRotateTo* pRotateTo = new CCRotateTo();
pRotateTo->initWithDuration(duration, fDeltaAngle);
@ -675,7 +675,7 @@ CCRotateTo* CCRotateTo::actionWithDuration(ccTime duration, float fDeltaAngle)
return pRotateTo;
}
bool CCRotateTo::initWithDuration(ccTime duration, float fDeltaAngle)
bool CCRotateTo::initWithDuration(float duration, float fDeltaAngle)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -737,7 +737,7 @@ void CCRotateTo::startWithTarget(CCNode *pTarget)
}
}
void CCRotateTo::update(ccTime time)
void CCRotateTo::update(float time)
{
if (m_pTarget)
{
@ -748,7 +748,7 @@ void CCRotateTo::update(ccTime time)
//
// RotateBy
//
CCRotateBy* CCRotateBy::actionWithDuration(ccTime duration, float fDeltaAngle)
CCRotateBy* CCRotateBy::actionWithDuration(float duration, float fDeltaAngle)
{
CCRotateBy *pRotateBy = new CCRotateBy();
pRotateBy->initWithDuration(duration, fDeltaAngle);
@ -757,7 +757,7 @@ CCRotateBy* CCRotateBy::actionWithDuration(ccTime duration, float fDeltaAngle)
return pRotateBy;
}
bool CCRotateBy::initWithDuration(ccTime duration, float fDeltaAngle)
bool CCRotateBy::initWithDuration(float duration, float fDeltaAngle)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -797,7 +797,7 @@ void CCRotateBy::startWithTarget(CCNode *pTarget)
m_fStartAngle = pTarget->getRotation();
}
void CCRotateBy::update(ccTime time)
void CCRotateBy::update(float time)
{
// XXX: shall I add % 360
if (m_pTarget)
@ -814,7 +814,7 @@ CCActionInterval* CCRotateBy::reverse(void)
//
// MoveTo
//
CCMoveTo* CCMoveTo::actionWithDuration(ccTime duration, const CCPoint& position)
CCMoveTo* CCMoveTo::actionWithDuration(float duration, const CCPoint& position)
{
CCMoveTo *pMoveTo = new CCMoveTo();
pMoveTo->initWithDuration(duration, position);
@ -823,7 +823,7 @@ CCMoveTo* CCMoveTo::actionWithDuration(ccTime duration, const CCPoint& position)
return pMoveTo;
}
bool CCMoveTo::initWithDuration(ccTime duration, const CCPoint& position)
bool CCMoveTo::initWithDuration(float duration, const CCPoint& position)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -864,7 +864,7 @@ void CCMoveTo::startWithTarget(CCNode *pTarget)
m_delta = ccpSub(m_endPosition, m_startPosition);
}
void CCMoveTo::update(ccTime time)
void CCMoveTo::update(float time)
{
if (m_pTarget)
{
@ -876,7 +876,7 @@ void CCMoveTo::update(ccTime time)
//
// MoveBy
//
CCMoveBy* CCMoveBy::actionWithDuration(ccTime duration, const CCPoint& position)
CCMoveBy* CCMoveBy::actionWithDuration(float duration, const CCPoint& position)
{
CCMoveBy *pMoveBy = new CCMoveBy();
pMoveBy->initWithDuration(duration, position);
@ -885,7 +885,7 @@ CCMoveBy* CCMoveBy::actionWithDuration(ccTime duration, const CCPoint& position)
return pMoveBy;
}
bool CCMoveBy::initWithDuration(ccTime duration, const CCPoint& position)
bool CCMoveBy::initWithDuration(float duration, const CCPoint& position)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -934,7 +934,7 @@ CCActionInterval* CCMoveBy::reverse(void)
//
// CCSkewTo
//
CCSkewTo* CCSkewTo::actionWithDuration(ccTime t, float sx, float sy)
CCSkewTo* CCSkewTo::actionWithDuration(float t, float sx, float sy)
{
CCSkewTo *pSkewTo = new CCSkewTo();
if (pSkewTo)
@ -952,7 +952,7 @@ CCSkewTo* CCSkewTo::actionWithDuration(ccTime t, float sx, float sy)
return pSkewTo;
}
bool CCSkewTo::initWithDuration(ccTime t, float sx, float sy)
bool CCSkewTo::initWithDuration(float t, float sx, float sy)
{
bool bRet = false;
@ -1039,7 +1039,7 @@ void CCSkewTo::startWithTarget(CCNode *pTarget)
}
}
void CCSkewTo::update(ccTime t)
void CCSkewTo::update(float t)
{
m_pTarget->setSkewX(m_fStartSkewX + m_fDeltaX * t);
m_pTarget->setSkewY(m_fStartSkewY + m_fDeltaY * t);
@ -1060,7 +1060,7 @@ CCSkewTo::CCSkewTo()
//
// CCSkewBy
//
CCSkewBy* CCSkewBy::actionWithDuration(ccTime t, float sx, float sy)
CCSkewBy* CCSkewBy::actionWithDuration(float t, float sx, float sy)
{
CCSkewBy *pSkewBy = new CCSkewBy();
if (pSkewBy)
@ -1078,7 +1078,7 @@ CCSkewBy* CCSkewBy::actionWithDuration(ccTime t, float sx, float sy)
return pSkewBy;
}
bool CCSkewBy::initWithDuration(ccTime t, float deltaSkewX, float deltaSkewY)
bool CCSkewBy::initWithDuration(float t, float deltaSkewX, float deltaSkewY)
{
bool bRet = false;
@ -1110,7 +1110,7 @@ CCActionInterval* CCSkewBy::reverse()
//
// JumpBy
//
CCJumpBy* CCJumpBy::actionWithDuration(ccTime duration, const CCPoint& position, ccTime 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);
@ -1119,7 +1119,7 @@ CCJumpBy* CCJumpBy::actionWithDuration(ccTime duration, const CCPoint& position,
return pJumpBy;
}
bool CCJumpBy::initWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps)
bool CCJumpBy::initWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1162,15 +1162,15 @@ void CCJumpBy::startWithTarget(CCNode *pTarget)
m_startPosition = pTarget->getPosition();
}
void CCJumpBy::update(ccTime time)
void CCJumpBy::update(float time)
{
// parabolic jump (since v0.8.2)
if (m_pTarget)
{
ccTime frac = fmodf(time * m_nJumps, 1.0f);
ccTime y = m_height * 4 * frac * (1 - frac);
float frac = fmodf(time * m_nJumps, 1.0f);
float y = m_height * 4 * frac * (1 - frac);
y += m_delta.y * time;
ccTime x = m_delta.x * time;
float x = m_delta.x * time;
m_pTarget->setPosition(ccp(m_startPosition.x + x, m_startPosition.y + y));
}
}
@ -1184,7 +1184,7 @@ CCActionInterval* CCJumpBy::reverse(void)
//
// JumpTo
//
CCJumpTo* CCJumpTo::actionWithDuration(ccTime duration, const CCPoint& position, ccTime 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);
@ -1226,7 +1226,7 @@ void CCJumpTo::startWithTarget(CCNode *pTarget)
// ((1 - t) + t)3 = 1
// Expands to¡­
// (1 - t)3 + 3t(1-t)2 + 3t2(1 - t) + t3 = 1
static inline float bezierat( float a, float b, float c, float d, ccTime t )
static inline float bezierat( float a, float b, float c, float d, float t )
{
return (powf(1-t,3) * a +
3*t*(powf(1-t,2))*b +
@ -1237,7 +1237,7 @@ static inline float bezierat( float a, float b, float c, float d, ccTime t )
//
// BezierBy
//
CCBezierBy* CCBezierBy::actionWithDuration(ccTime t, const ccBezierConfig& c)
CCBezierBy* CCBezierBy::actionWithDuration(float t, const ccBezierConfig& c)
{
CCBezierBy *pBezierBy = new CCBezierBy();
pBezierBy->initWithDuration(t, c);
@ -1246,7 +1246,7 @@ CCBezierBy* CCBezierBy::actionWithDuration(ccTime t, const ccBezierConfig& c)
return pBezierBy;
}
bool CCBezierBy::initWithDuration(ccTime t, const ccBezierConfig& c)
bool CCBezierBy::initWithDuration(float t, const ccBezierConfig& c)
{
if (CCActionInterval::initWithDuration(t))
{
@ -1286,7 +1286,7 @@ CCObject* CCBezierBy::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCBezierBy::update(ccTime time)
void CCBezierBy::update(float time)
{
if (m_pTarget)
{
@ -1321,7 +1321,7 @@ CCActionInterval* CCBezierBy::reverse(void)
//
// BezierTo
//
CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, const ccBezierConfig& c)
CCBezierTo* CCBezierTo::actionWithDuration(float t, const ccBezierConfig& c)
{
CCBezierTo *pBezierTo = new CCBezierTo();
pBezierTo->initWithDuration(t, c);
@ -1364,7 +1364,7 @@ void CCBezierTo::startWithTarget(CCNode *pTarget)
//
// ScaleTo
//
CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float s)
CCScaleTo* CCScaleTo::actionWithDuration(float duration, float s)
{
CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, s);
@ -1373,7 +1373,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float s)
return pScaleTo;
}
bool CCScaleTo::initWithDuration(ccTime duration, float s)
bool CCScaleTo::initWithDuration(float duration, float s)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1386,7 +1386,7 @@ bool CCScaleTo::initWithDuration(ccTime duration, float s)
return false;
}
CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float sx, float sy)
CCScaleTo* CCScaleTo::actionWithDuration(float duration, float sx, float sy)
{
CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, sx, sy);
@ -1395,7 +1395,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float sx, float sy)
return pScaleTo;
}
bool CCScaleTo::initWithDuration(ccTime duration, float sx, float sy)
bool CCScaleTo::initWithDuration(float duration, float sx, float sy)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1441,7 +1441,7 @@ void CCScaleTo::startWithTarget(CCNode *pTarget)
m_fDeltaY = m_fEndScaleY - m_fStartScaleY;
}
void CCScaleTo::update(ccTime time)
void CCScaleTo::update(float time)
{
if (m_pTarget)
{
@ -1453,7 +1453,7 @@ void CCScaleTo::update(ccTime time)
//
// ScaleBy
//
CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float s)
CCScaleBy* CCScaleBy::actionWithDuration(float duration, float s)
{
CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, s);
@ -1462,7 +1462,7 @@ CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float s)
return pScaleBy;
}
CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float sx, float sy)
CCScaleBy* CCScaleBy::actionWithDuration(float duration, float sx, float sy)
{
CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, sx, sy);
@ -1510,7 +1510,7 @@ CCActionInterval* CCScaleBy::reverse(void)
//
// Blink
//
CCBlink* CCBlink::actionWithDuration(ccTime duration, unsigned int uBlinks)
CCBlink* CCBlink::actionWithDuration(float duration, unsigned int uBlinks)
{
CCBlink *pBlink = new CCBlink();
pBlink->initWithDuration(duration, uBlinks);
@ -1519,7 +1519,7 @@ CCBlink* CCBlink::actionWithDuration(ccTime duration, unsigned int uBlinks)
return pBlink;
}
bool CCBlink::initWithDuration(ccTime duration, unsigned int uBlinks)
bool CCBlink::initWithDuration(float duration, unsigned int uBlinks)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1554,12 +1554,12 @@ CCObject* CCBlink::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCBlink::update(ccTime time)
void CCBlink::update(float time)
{
if (m_pTarget && ! isDone())
{
ccTime slice = 1.0f / m_nTimes;
ccTime m = fmodf(time, slice);
float slice = 1.0f / m_nTimes;
float m = fmodf(time, slice);
m_pTarget->setIsVisible(m > slice / 2 ? true : false);
}
}
@ -1573,7 +1573,7 @@ CCActionInterval* CCBlink::reverse(void)
//
// FadeIn
//
CCFadeIn* CCFadeIn::actionWithDuration(ccTime d)
CCFadeIn* CCFadeIn::actionWithDuration(float d)
{
CCFadeIn* pAction = new CCFadeIn();
@ -1605,7 +1605,7 @@ CCObject* CCFadeIn::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCFadeIn::update(ccTime time)
void CCFadeIn::update(float time)
{
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTarget);
if (pRGBAProtocol)
@ -1623,7 +1623,7 @@ CCActionInterval* CCFadeIn::reverse(void)
//
// FadeOut
//
CCFadeOut* CCFadeOut::actionWithDuration(ccTime d)
CCFadeOut* CCFadeOut::actionWithDuration(float d)
{
CCFadeOut* pAction = new CCFadeOut();
@ -1655,7 +1655,7 @@ CCObject* CCFadeOut::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCFadeOut::update(ccTime time)
void CCFadeOut::update(float time)
{
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTarget);
if (pRGBAProtocol)
@ -1673,7 +1673,7 @@ CCActionInterval* CCFadeOut::reverse(void)
//
// FadeTo
//
CCFadeTo* CCFadeTo::actionWithDuration(ccTime duration, GLubyte opacity)
CCFadeTo* CCFadeTo::actionWithDuration(float duration, GLubyte opacity)
{
CCFadeTo *pFadeTo = new CCFadeTo();
pFadeTo->initWithDuration(duration, opacity);
@ -1682,7 +1682,7 @@ CCFadeTo* CCFadeTo::actionWithDuration(ccTime duration, GLubyte opacity)
return pFadeTo;
}
bool CCFadeTo::initWithDuration(ccTime duration, GLubyte opacity)
bool CCFadeTo::initWithDuration(float duration, GLubyte opacity)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1728,7 +1728,7 @@ void CCFadeTo::startWithTarget(CCNode *pTarget)
/*m_fromOpacity = pTarget->getOpacity();*/
}
void CCFadeTo::update(ccTime time)
void CCFadeTo::update(float time)
{
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTarget);
if (pRGBAProtocol)
@ -1741,7 +1741,7 @@ void CCFadeTo::update(ccTime time)
//
// TintTo
//
CCTintTo* CCTintTo::actionWithDuration(ccTime 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);
@ -1750,7 +1750,7 @@ CCTintTo* CCTintTo::actionWithDuration(ccTime duration, GLubyte red, GLubyte gre
return pTintTo;
}
bool CCTintTo::initWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
bool CCTintTo::initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1795,7 +1795,7 @@ void CCTintTo::startWithTarget(CCNode *pTarget)
/*m_from = pTarget->getColor();*/
}
void CCTintTo::update(ccTime time)
void CCTintTo::update(float time)
{
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTarget);
if (pRGBAProtocol)
@ -1809,7 +1809,7 @@ void CCTintTo::update(ccTime time)
//
// TintBy
//
CCTintBy* CCTintBy::actionWithDuration(ccTime 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);
@ -1818,7 +1818,7 @@ CCTintBy* CCTintBy::actionWithDuration(ccTime duration, GLshort deltaRed, GLshor
return pTintBy;
}
bool CCTintBy::initWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
bool CCTintBy::initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1869,7 +1869,7 @@ void CCTintBy::startWithTarget(CCNode *pTarget)
}
}
void CCTintBy::update(ccTime time)
void CCTintBy::update(float time)
{
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(m_pTarget);
if (pRGBAProtocol)
@ -1888,7 +1888,7 @@ CCActionInterval* CCTintBy::reverse(void)
//
// DelayTime
//
CCDelayTime* CCDelayTime::actionWithDuration(ccTime d)
CCDelayTime* CCDelayTime::actionWithDuration(float d)
{
CCDelayTime* pAction = new CCDelayTime();
@ -1921,7 +1921,7 @@ CCObject* CCDelayTime::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCDelayTime::update(ccTime time)
void CCDelayTime::update(float time)
{
CC_UNUSED_PARAM(time);
return;
@ -2009,7 +2009,7 @@ void CCReverseTime::stop(void)
CCActionInterval::stop();
}
void CCReverseTime::update(ccTime time)
void CCReverseTime::update(float time)
{
if (m_pOther)
{
@ -2134,7 +2134,7 @@ void CCAnimate::stop(void)
CCActionInterval::stop();
}
void CCAnimate::update(ccTime t)
void CCAnimate::update(float t)
{
// if t==1, ignore. Animation should finish with t==1
if( t < 1.0f ) {
@ -2269,7 +2269,7 @@ void CCTargetedAction::stop(void)
m_pAction->stop();
}
void CCTargetedAction::update(ccTime time)
void CCTargetedAction::update(float time)
{
m_pAction->update(time);
}

View File

@ -57,23 +57,23 @@ class CC_DLL CCActionInterval : public CCFiniteTimeAction
{
public:
/** how many seconds had elapsed since the actions started to run. */
inline ccTime getElapsed(void) { return m_elapsed; }
inline float getElapsed(void) { return m_elapsed; }
/** initializes the action */
bool initWithDuration(ccTime d);
bool initWithDuration(float d);
/** returns true if the action has finished */
virtual bool isDone(void);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void step(ccTime dt);
virtual void step(float dt);
virtual void startWithTarget(CCNode *pTarget);
/** returns a reversed action */
virtual CCActionInterval* reverse(void);
public:
/** creates the action */
static CCActionInterval* actionWithDuration(ccTime d);
static CCActionInterval* actionWithDuration(float d);
public:
//extension in CCGridAction
@ -81,7 +81,7 @@ public:
CCFloat getAmplitudeRate(void);
protected:
ccTime m_elapsed;
float m_elapsed;
bool m_bFirstTick;
};
@ -98,20 +98,20 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime t);
virtual void update(float t);
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* actionsWithArray(CCArray *actions);
static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
/** creates the action */
static CCSequence* actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
protected:
CCFiniteTimeAction *m_pActions[2];
ccTime m_split;
float m_split;
int m_last;
};
@ -129,7 +129,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime dt);
virtual void update(float dt);
virtual bool isDone(void);
virtual CCActionInterval* reverse(void);
@ -155,7 +155,7 @@ public:
protected:
unsigned int m_uTimes;
unsigned int m_uTotal;
ccTime m_fNextDt;
float m_fNextDt;
bool m_bActionInstant;
/** Inner action */
CCFiniteTimeAction *m_pInnerAction;
@ -177,7 +177,7 @@ public:
bool initWithAction(CCActionInterval *pAction);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void startWithTarget(CCNode* pTarget);
virtual void step(ccTime dt);
virtual void step(float dt);
virtual bool isDone(void);
virtual CCActionInterval* reverse(void);
@ -218,7 +218,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
@ -226,7 +226,7 @@ public:
static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of spawned actions given an array */
static CCFiniteTimeAction* actionsWithArray(CCArray *actions);
static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
/** creates the Spawn action */
static CCSpawn* actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
@ -244,15 +244,15 @@ class CC_DLL CCRotateTo : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, float fDeltaAngle);
bool initWithDuration(float duration, float fDeltaAngle);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action */
static CCRotateTo* actionWithDuration(ccTime duration, float fDeltaAngle);
static CCRotateTo* actionWithDuration(float duration, float fDeltaAngle);
protected:
float m_fDstAngle;
@ -266,16 +266,16 @@ class CC_DLL CCRotateBy : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, float fDeltaAngle);
bool initWithDuration(float duration, float fDeltaAngle);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates the action */
static CCRotateBy* actionWithDuration(ccTime duration, float fDeltaAngle);
static CCRotateBy* actionWithDuration(float duration, float fDeltaAngle);
protected:
float m_fAngle;
@ -288,15 +288,15 @@ class CC_DLL CCMoveTo : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, const CCPoint& position);
bool initWithDuration(float duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action */
static CCMoveTo* actionWithDuration(ccTime duration, const CCPoint& position);
static CCMoveTo* actionWithDuration(float duration, const CCPoint& position);
protected:
CCPoint m_endPosition;
@ -312,7 +312,7 @@ class CC_DLL CCMoveBy : public CCMoveTo
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, const CCPoint& position);
bool initWithDuration(float duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -320,7 +320,7 @@ public:
public:
/** creates the action */
static CCMoveBy* actionWithDuration(ccTime duration, const CCPoint& position);
static CCMoveBy* actionWithDuration(float duration, const CCPoint& position);
};
/** Skews a CCNode object to given angles by modifying it's skewX and skewY attributes
@ -330,13 +330,13 @@ class CC_DLL CCSkewTo : public CCActionInterval
{
public:
CCSkewTo();
virtual bool initWithDuration(ccTime t, float sx, float sy);
virtual bool initWithDuration(float t, float sx, float sy);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
static CCSkewTo* actionWithDuration(ccTime t, float sx, float sy);
static CCSkewTo* actionWithDuration(float t, float sx, float sy);
protected:
float m_fSkewX;
@ -355,12 +355,12 @@ protected:
class CC_DLL CCSkewBy : public CCSkewTo
{
public:
virtual bool initWithDuration(ccTime t, float sx, float sy);
virtual bool initWithDuration(float t, float sx, float sy);
virtual void startWithTarget(CCNode *pTarget);
virtual CCActionInterval* reverse(void);
public:
static CCSkewBy* actionWithDuration(ccTime t, float deltaSkewX, float deltaSkewY);
static CCSkewBy* actionWithDuration(float t, float deltaSkewX, float deltaSkewY);
};
/** @brief Moves a CCNode object simulating a parabolic jump movement by modifying it's position attribute.
@ -369,21 +369,21 @@ class CC_DLL CCJumpBy : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps);
bool initWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates the action */
static CCJumpBy* actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps);
static CCJumpBy* actionWithDuration(float duration, const CCPoint& position, float height, unsigned int jumps);
protected:
CCPoint m_startPosition;
CCPoint m_delta;
ccTime m_height;
float m_height;
unsigned int m_nJumps;
};
@ -397,7 +397,7 @@ public:
public:
/** creates the action */
static CCJumpTo* actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, int jumps);
static CCJumpTo* actionWithDuration(float duration, const CCPoint& position, float height, int jumps);
};
/** @typedef bezier configuration structure
@ -417,16 +417,16 @@ class CC_DLL CCBezierBy : public CCActionInterval
{
public:
/** initializes the action with a duration and a bezier configuration */
bool initWithDuration(ccTime t, const ccBezierConfig& c);
bool initWithDuration(float t, const ccBezierConfig& c);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates the action with a duration and a bezier configuration */
static CCBezierBy* actionWithDuration(ccTime t, const ccBezierConfig& c);
static CCBezierBy* actionWithDuration(float t, const ccBezierConfig& c);
protected:
ccBezierConfig m_sConfig;
@ -444,7 +444,7 @@ public:
public:
/** creates the action with a duration and a bezier configuration */
static CCBezierTo* actionWithDuration(ccTime t, const ccBezierConfig& c);
static CCBezierTo* actionWithDuration(float t, const ccBezierConfig& c);
};
/** @brief Scales a CCNode object to a zoom factor by modifying it's scale attribute.
@ -454,21 +454,21 @@ class CC_DLL CCScaleTo : public CCActionInterval
{
public:
/** initializes the action with the same scale factor for X and Y */
bool initWithDuration(ccTime duration, float s);
bool initWithDuration(float duration, float s);
/** initializes the action with and X factor and a Y factor */
bool initWithDuration(ccTime duration, float sx, float sy);
bool initWithDuration(float duration, float sx, float sy);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with the same scale factor for X and Y */
static CCScaleTo* actionWithDuration(ccTime duration, float s);
static CCScaleTo* actionWithDuration(float duration, float s);
/** creates the action with and X factor and a Y factor */
static CCScaleTo* actionWithDuration(ccTime duration, float sx, float sy);
static CCScaleTo* actionWithDuration(float duration, float sx, float sy);
protected:
float m_fScaleX;
float m_fScaleY;
@ -491,10 +491,10 @@ public:
public:
/** creates the action with the same scale factor for X and Y */
static CCScaleBy* actionWithDuration(ccTime duration, float s);
static CCScaleBy* actionWithDuration(float duration, float s);
/** creates the action with and X factor and a Y factor */
static CCScaleBy* actionWithDuration(ccTime duration, float sx, float sy);
static CCScaleBy* actionWithDuration(float duration, float sx, float sy);
};
/** @brief Blinks a CCNode object by modifying it's visible attribute
@ -503,15 +503,15 @@ class CC_DLL CCBlink : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, unsigned int uBlinks);
bool initWithDuration(float duration, unsigned int uBlinks);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates the action */
static CCBlink* actionWithDuration(ccTime duration, unsigned int uBlinks);
static CCBlink* actionWithDuration(float duration, unsigned int uBlinks);
protected:
unsigned int m_nTimes;
};
@ -522,13 +522,13 @@ protected:
class CC_DLL CCFadeIn : public CCActionInterval
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCFadeIn* actionWithDuration(ccTime d);
static CCFadeIn* actionWithDuration(float d);
};
/** @brief Fades Out an object that implements the CCRGBAProtocol protocol. It modifies the opacity from 255 to 0.
@ -537,13 +537,13 @@ public:
class CC_DLL CCFadeOut : public CCActionInterval
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCFadeOut* actionWithDuration(ccTime d);
static CCFadeOut* actionWithDuration(float d);
};
/** @brief Fades an object that implements the CCRGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
@ -553,15 +553,15 @@ class CC_DLL CCFadeTo : public CCActionInterval
{
public:
/** initializes the action with duration and opacity */
bool initWithDuration(ccTime duration, GLubyte opacity);
bool initWithDuration(float duration, GLubyte opacity);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates an action with duration and opacity */
static CCFadeTo* actionWithDuration(ccTime duration, GLubyte opacity);
static CCFadeTo* actionWithDuration(float duration, GLubyte opacity);
protected:
GLubyte m_toOpacity;
@ -576,15 +576,15 @@ class CC_DLL CCTintTo : public CCActionInterval
{
public:
/** initializes the action with duration and color */
bool initWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue);
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates an action with duration and color */
static CCTintTo* actionWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue);
static CCTintTo* actionWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
protected:
ccColor3B m_to;
@ -598,16 +598,16 @@ class CC_DLL CCTintBy : public CCActionInterval
{
public:
/** initializes the action with duration and color */
bool initWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
/** creates an action with duration and color */
static CCTintBy* actionWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
static CCTintBy* actionWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
protected:
GLshort m_deltaR;
@ -624,13 +624,13 @@ protected:
class CC_DLL CCDelayTime : public CCActionInterval
{
public:
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action */
static CCDelayTime* actionWithDuration(ccTime d);
static CCDelayTime* actionWithDuration(float d);
};
/** @brief Executes an action in reverse order, from time=duration to time=0
@ -652,7 +652,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCActionInterval* reverse(void);
public:
@ -678,7 +678,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime t);
virtual void update(float t);
virtual CCActionInterval* reverse(void);
public:
@ -710,7 +710,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void stop(void);
virtual void update(ccTime time);
virtual void update(float time);
/** This is the target that the action will be forced to run with */
CC_SYNTHESIZE_RETAIN(CCNode*, m_pForcedTarget, ForcedTarget);

View File

@ -31,6 +31,7 @@ THE SOFTWARE.
#include "ccMacros.h"
#include "support/data_support/ccCArray.h"
#include "support/data_support/uthash.h"
#include "CCSet.h"
NS_CC_BEGIN
//
@ -139,6 +140,32 @@ void CCActionManager::resumeTarget(CCObject *pTarget)
}
}
CCSet* CCActionManager::pauseAlllRunningActions()
{
CCSet *idsWithActions = new CCSet();
idsWithActions->autorelease();
for (tHashElement *element=m_pTargets; element != NULL; element = (tHashElement *)element->hh.next)
{
if (! element->paused)
{
element->paused = true;
idsWithActions->addObject(element->target);
}
}
return idsWithActions;
}
void CCActionManager::resumeTargets(cocos2d::CCSet *targetsToResume)
{
CCSetIterator iter;
for (iter = targetsToResume->begin(); iter != targetsToResume->end(); ++iter)
{
resumeTarget(*iter);
}
}
// run
void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused)
@ -309,7 +336,7 @@ unsigned int CCActionManager::numberOfRunningActionsInTarget(CCObject *pTarget)
}
// main loop
void CCActionManager::update(ccTime dt)
void CCActionManager::update(float dt)
{
for (tHashElement *elt = m_pTargets; elt != NULL; )
{

View File

@ -34,7 +34,7 @@ THE SOFTWARE.
NS_CC_BEGIN
#define kCCActionManagerPriority 0
class CCSet;
struct _hashElement;
/**
@ -98,6 +98,14 @@ public:
/** Resumes the target. All queued actions will be resumed.
*/
void resumeTarget(CCObject *pTarget);
/** Pauses all running actions, returning a list of targets whose actions were paused.
*/
CCSet* pauseAlllRunningActions();
/** Resume a set of targets (convenience function to reverse a pauseAllRunningActions call)
*/
void resumeTargets(CCSet *targetsToResume);
protected:
// declared in CCActionManager.m
@ -105,7 +113,7 @@ protected:
void removeActionAtIndex(unsigned int uIndex, struct _hashElement *pElement);
void deleteHashElement(struct _hashElement *pElement);
void actionAllocWithHashElement(struct _hashElement *pElement);
void update(ccTime dt);
void update(float dt);
protected:
struct _hashElement *m_pTargets;

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
NS_CC_BEGIN
CCPageTurn3D* CCPageTurn3D::actionWithSize(const ccGridSize& gridSize, ccTime time)
CCPageTurn3D* CCPageTurn3D::actionWithSize(const ccGridSize& gridSize, float time)
{
CCPageTurn3D *pAction = new CCPageTurn3D();
@ -50,7 +50,7 @@ CCPageTurn3D* CCPageTurn3D::actionWithSize(const ccGridSize& gridSize, ccTime ti
* Update each tick
* Time is the percentage of the way through the duration
*/
void CCPageTurn3D::update(ccTime time)
void CCPageTurn3D::update(float time)
{
float tt = MAX(0, time - 0.25f);
float deltaAy = (tt * tt * 500);

View File

@ -40,11 +40,11 @@ NS_CC_BEGIN
class CC_DLL CCPageTurn3D : public CCGrid3DAction
{
public:
virtual void update(ccTime time);
virtual void update(float time);
public:
/** create the action */
static CCPageTurn3D* actionWithSize(const ccGridSize& gridSize, ccTime time);
static CCPageTurn3D* actionWithSize(const ccGridSize& gridSize, float time);
};
NS_CC_END

View File

@ -32,7 +32,7 @@ NS_CC_BEGIN
// implementation of CCProgressTo
CCProgressTo* CCProgressTo::actionWithDuration(ccTime duration, float fPercent)
CCProgressTo* CCProgressTo::actionWithDuration(float duration, float fPercent)
{
CCProgressTo *pProgressTo = new CCProgressTo();
pProgressTo->initWithDuration(duration, fPercent);
@ -41,7 +41,7 @@ CCProgressTo* CCProgressTo::actionWithDuration(ccTime duration, float fPercent)
return pProgressTo;
}
bool CCProgressTo::initWithDuration(ccTime duration, float fPercent)
bool CCProgressTo::initWithDuration(float duration, float fPercent)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -89,14 +89,14 @@ void CCProgressTo::startWithTarget(CCNode *pTarget)
}
}
void CCProgressTo::update(ccTime time)
void CCProgressTo::update(float time)
{
((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time);
}
// implementation of CCProgressFromTo
CCProgressFromTo* CCProgressFromTo::actionWithDuration(ccTime duration, float fFromPercentage, float fToPercentage)
CCProgressFromTo* CCProgressFromTo::actionWithDuration(float duration, float fFromPercentage, float fToPercentage)
{
CCProgressFromTo *pProgressFromTo = new CCProgressFromTo();
pProgressFromTo->initWithDuration(duration, fFromPercentage, fToPercentage);
@ -105,7 +105,7 @@ CCProgressFromTo* CCProgressFromTo::actionWithDuration(ccTime duration, float fF
return pProgressFromTo;
}
bool CCProgressFromTo::initWithDuration(ccTime duration, float fFromPercentage, float fToPercentage)
bool CCProgressFromTo::initWithDuration(float duration, float fFromPercentage, float fToPercentage)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -151,7 +151,7 @@ void CCProgressFromTo::startWithTarget(CCNode *pTarget)
CCActionInterval::startWithTarget(pTarget);
}
void CCProgressFromTo::update(ccTime time)
void CCProgressFromTo::update(float time)
{
((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time);
}

View File

@ -37,15 +37,15 @@ class CC_DLL CCProgressTo : public CCActionInterval
{
public:
/** Initializes with a duration and a percent */
bool initWithDuration(ccTime duration, float fPercent);
bool initWithDuration(float duration, float fPercent);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** Creates and initializes with a duration and a percent */
static CCProgressTo* actionWithDuration(ccTime duration, float fPercent);
static CCProgressTo* actionWithDuration(float duration, float fPercent);
protected:
float m_fTo;
@ -60,16 +60,16 @@ class CC_DLL CCProgressFromTo : public CCActionInterval
{
public:
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
bool initWithDuration(ccTime duration, float fFromPercentage, float fToPercentage);
bool initWithDuration(float duration, float fFromPercentage, float fToPercentage);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual CCActionInterval* reverse(void);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */
static CCProgressFromTo* actionWithDuration(ccTime duration, float fFromPercentage, float fToPercentage);
static CCProgressFromTo* actionWithDuration(float duration, float fFromPercentage, float fToPercentage);
protected:
float m_fTo;

View File

@ -41,7 +41,7 @@ struct Tile
// implementation of ShakyTiles3D
CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const ccGridSize& gridSize, ccTime duration)
CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const ccGridSize& gridSize, float duration)
{
CCShakyTiles3D *pAction = new CCShakyTiles3D();
@ -60,7 +60,7 @@ CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const c
return pAction;
}
bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize, ccTime duration)
bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize, float duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -96,7 +96,7 @@ CCObject* CCShakyTiles3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCShakyTiles3D::update(ccTime time)
void CCShakyTiles3D::update(float time)
{
CC_UNUSED_PARAM(time);
int i, j;
@ -134,7 +134,7 @@ void CCShakyTiles3D::update(ccTime time)
// implementation of CCShatteredTiles3D
CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, ccTime duration)
CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
{
CCShatteredTiles3D *pAction = new CCShatteredTiles3D();
@ -153,7 +153,7 @@ CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatte
return pAction;
}
bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, ccTime duration)
bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -190,7 +190,7 @@ CCObject* CCShatteredTiles3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCShatteredTiles3D::update(ccTime time)
void CCShatteredTiles3D::update(float time)
{
CC_UNUSED_PARAM(time);
int i, j;
@ -233,7 +233,7 @@ void CCShatteredTiles3D::update(ccTime time)
// implementation of CCShuffleTiles
CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize, float duration)
{
CCShuffleTiles *pAction = new CCShuffleTiles();
@ -252,7 +252,7 @@ CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize
return pAction;
}
bool CCShuffleTiles::initWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
bool CCShuffleTiles::initWithSeed(int s, const ccGridSize& gridSize, float duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -378,7 +378,7 @@ void CCShuffleTiles::startWithTarget(CCNode *pTarget)
}
}
void CCShuffleTiles::update(ccTime time)
void CCShuffleTiles::update(float time)
{
int i, j;
@ -397,7 +397,7 @@ void CCShuffleTiles::update(ccTime time)
// implementation of CCFadeOutTRTiles
CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, float time)
{
CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles();
@ -416,7 +416,7 @@ CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, c
return pAction;
}
float CCFadeOutTRTiles::testFunc(const ccGridSize& pos, ccTime time)
float CCFadeOutTRTiles::testFunc(const ccGridSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
if ((n.x + n.y) == 0.0f)
@ -459,7 +459,7 @@ void CCFadeOutTRTiles::transformTile(const ccGridSize& pos, float distance)
setTile(pos, coords);
}
void CCFadeOutTRTiles::update(ccTime time)
void CCFadeOutTRTiles::update(float time)
{
int i, j;
@ -485,7 +485,7 @@ void CCFadeOutTRTiles::update(ccTime time)
}
// implementation of CCFadeOutBLTiles
CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, float time)
{
CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles();
@ -504,7 +504,7 @@ CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, c
return pAction;
}
float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, ccTime time)
float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if ((pos.x + pos.y) == 0)
@ -517,7 +517,7 @@ float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, ccTime time)
// implementation of CCFadeOutUpTiles
CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, float time)
{
CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles();
@ -536,7 +536,7 @@ CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, c
return pAction;
}
float CCFadeOutUpTiles::testFunc(const ccGridSize& pos, ccTime time)
float CCFadeOutUpTiles::testFunc(const ccGridSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
if (n.y == 0.0f)
@ -561,7 +561,7 @@ void CCFadeOutUpTiles::transformTile(const ccGridSize& pos, float distance)
}
// implementation of CCFadeOutDownTiles
CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSize, float time)
{
CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles();
@ -580,7 +580,7 @@ CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSiz
return pAction;
}
float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, ccTime time)
float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if (pos.y == 0)
@ -592,7 +592,7 @@ float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, ccTime time)
}
// implementation of TurnOffTiles
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, ccTime d)
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, float d)
{
CCTurnOffTiles* pAction = new CCTurnOffTiles();
if (pAction->initWithSize(size, d))
@ -606,7 +606,7 @@ CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, ccTime d)
return pAction;
}
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize, float duration)
{
CCTurnOffTiles *pAction = new CCTurnOffTiles();
@ -625,7 +625,7 @@ CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize
return pAction;
}
bool CCTurnOffTiles::initWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
bool CCTurnOffTiles::initWithSeed(int s, const ccGridSize& gridSize, float duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -712,7 +712,7 @@ void CCTurnOffTiles::startWithTarget(CCNode *pTarget)
shuffle(m_pTilesOrder, m_nTilesCount);
}
void CCTurnOffTiles::update(ccTime time)
void CCTurnOffTiles::update(float time)
{
unsigned int i, l, t;
@ -736,7 +736,7 @@ void CCTurnOffTiles::update(ccTime time)
// implementation of CCWavesTiles3D
CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
{
CCWavesTiles3D *pAction = new CCWavesTiles3D();
@ -755,7 +755,7 @@ CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGrid
return pAction;
}
bool CCWavesTiles3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
bool CCWavesTiles3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -791,7 +791,7 @@ CCObject* CCWavesTiles3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCWavesTiles3D::update(ccTime time)
void CCWavesTiles3D::update(float time)
{
int i, j;
@ -814,7 +814,7 @@ void CCWavesTiles3D::update(ccTime time)
// implementation of CCJumpTiles3D
CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration)
CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize& gridSize, float duration)
{
CCJumpTiles3D *pAction = new CCJumpTiles3D();
@ -833,7 +833,7 @@ CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize
return pAction;
}
bool CCJumpTiles3D::initWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration)
bool CCJumpTiles3D::initWithJumps(int j, float amp, const ccGridSize& gridSize, float duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -868,7 +868,7 @@ CCObject* CCJumpTiles3D::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCJumpTiles3D::update(ccTime time)
void CCJumpTiles3D::update(float time)
{
int i, j;
@ -903,7 +903,7 @@ void CCJumpTiles3D::update(ccTime time)
// implementation of CCSplitRows
CCSplitRows* CCSplitRows::actionWithRows(int nRows, ccTime duration)
CCSplitRows* CCSplitRows::actionWithRows(int nRows, float duration)
{
CCSplitRows *pAction = new CCSplitRows();
@ -922,7 +922,7 @@ CCSplitRows* CCSplitRows::actionWithRows(int nRows, ccTime duration)
return pAction;
}
bool CCSplitRows::initWithRows(int nRows, ccTime duration)
bool CCSplitRows::initWithRows(int nRows, float duration)
{
m_nRows = nRows;
@ -957,7 +957,7 @@ void CCSplitRows::startWithTarget(CCNode *pTarget)
m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
}
void CCSplitRows::update(ccTime time)
void CCSplitRows::update(float time)
{
int j;
@ -982,7 +982,7 @@ void CCSplitRows::update(ccTime time)
// implementation of CCSplitCols
CCSplitCols* CCSplitCols::actionWithCols(int nCols, ccTime duration)
CCSplitCols* CCSplitCols::actionWithCols(int nCols, float duration)
{
CCSplitCols *pAction = new CCSplitCols();
@ -1001,7 +1001,7 @@ CCSplitCols* CCSplitCols::actionWithCols(int nCols, ccTime duration)
return pAction;
}
bool CCSplitCols::initWithCols(int nCols, ccTime duration)
bool CCSplitCols::initWithCols(int nCols, float duration)
{
m_nCols = nCols;
return CCTiledGrid3DAction::initWithSize(ccg(nCols, 1), duration);
@ -1034,7 +1034,7 @@ void CCSplitCols::startWithTarget(CCNode *pTarget)
m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
}
void CCSplitCols::update(ccTime time)
void CCSplitCols::update(float time)
{
int i;

View File

@ -34,15 +34,15 @@ class CC_DLL CCShakyTiles3D : public CCTiledGrid3DAction
public:
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
bool initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
ccTime duration);
float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** 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,
ccTime duration);
float duration);
protected:
int m_nRandrange;
@ -55,15 +55,15 @@ class CC_DLL CCShatteredTiles3D : public CCTiledGrid3DAction
public:
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
bool initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
ccTime duration);
float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
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,
ccTime duration);
float duration);
protected:
int m_nRandrange;
@ -80,18 +80,18 @@ class CC_DLL CCShuffleTiles : public CCTiledGrid3DAction
public:
~CCShuffleTiles(void);
/** initializes the action with a random seed, the grid size and the duration */
bool initWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
bool initWithSeed(int s, const ccGridSize& gridSize, float duration);
void shuffle(int *pArray, unsigned int nLen);
ccGridSize getDelta(const ccGridSize& pos);
void placeTile(const ccGridSize& pos, Tile *t);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** creates the action with a random seed, the grid size and the duration */
static CCShuffleTiles* actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
static CCShuffleTiles* actionWithSeed(int s, const ccGridSize& gridSize, float duration);
protected:
int m_nSeed;
@ -106,15 +106,15 @@ protected:
class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction
{
public:
virtual float testFunc(const ccGridSize& pos, ccTime time);
virtual float testFunc(const ccGridSize& pos, float time);
void turnOnTile(const ccGridSize& pos);
void turnOffTile(const ccGridSize& pos);
virtual void transformTile(const ccGridSize& pos, float distance);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutTRTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
static CCFadeOutTRTiles* actionWithSize(const ccGridSize& gridSize, float time);
};
/** @brief CCFadeOutBLTiles action.
@ -123,11 +123,11 @@ public:
class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
{
public:
virtual float testFunc(const ccGridSize& pos, ccTime time);
virtual float testFunc(const ccGridSize& pos, float time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutBLTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
static CCFadeOutBLTiles* actionWithSize(const ccGridSize& gridSize, float time);
};
/** @brief CCFadeOutUpTiles action.
@ -136,12 +136,12 @@ public:
class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles
{
public:
virtual float testFunc(const ccGridSize& pos, ccTime time);
virtual float testFunc(const ccGridSize& pos, float time);
virtual void transformTile(const ccGridSize& pos, float distance);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutUpTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
static CCFadeOutUpTiles* actionWithSize(const ccGridSize& gridSize, float time);
};
/** @brief CCFadeOutDownTiles action.
@ -150,11 +150,11 @@ public:
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
{
public:
virtual float testFunc(const ccGridSize& pos, ccTime time);
virtual float testFunc(const ccGridSize& pos, float time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutDownTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
static CCFadeOutDownTiles* actionWithSize(const ccGridSize& gridSize, float time);
};
/** @brief CCTurnOffTiles action.
@ -165,20 +165,20 @@ class CC_DLL CCTurnOffTiles : public CCTiledGrid3DAction
public:
~CCTurnOffTiles(void);
/** initializes the action with a random seed, the grid size and the duration */
bool initWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
bool initWithSeed(int s, const ccGridSize& gridSize, float duration);
void shuffle(int *pArray, unsigned int nLen);
void turnOnTile(const ccGridSize& pos);
void turnOffTile(const ccGridSize& pos);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** creates the action with the grid size and the duration */
static CCTurnOffTiles* actionWithSize(const ccGridSize& size, ccTime d);
static CCTurnOffTiles* actionWithSize(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, ccTime duration);
static CCTurnOffTiles* actionWithSeed(int s, const ccGridSize& gridSize, float duration);
protected:
int m_nSeed;
@ -199,14 +199,14 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** 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, ccTime duration);
static CCWavesTiles3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nWaves;
@ -229,13 +229,13 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
bool initWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration);
bool initWithJumps(int j, float amp, const ccGridSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
public:
/** 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, ccTime duration);
static CCJumpTiles3D* actionWithJumps(int j, float amp, const ccGridSize& gridSize, float duration);
protected:
int m_nJumps;
@ -248,15 +248,15 @@ class CC_DLL CCSplitRows : public CCTiledGrid3DAction
{
public :
/** initializes the action with the number of rows to split and the duration */
bool initWithRows(int nRows, ccTime duration);
bool initWithRows(int nRows, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
virtual void startWithTarget(CCNode *pTarget);
public:
/** creates the action with the number of rows to split and the duration */
static CCSplitRows* actionWithRows(int nRows, ccTime duration);
static CCSplitRows* actionWithRows(int nRows, float duration);
protected:
int m_nRows;
@ -268,15 +268,15 @@ class CC_DLL CCSplitCols : public CCTiledGrid3DAction
{
public:
/** initializes the action with the number of columns to split and the duration */
bool initWithCols(int nCols, ccTime duration);
bool initWithCols(int nCols, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
virtual void update(float time);
virtual void startWithTarget(CCNode *pTarget);
public:
/** creates the action with the number of columns to split and the duration */
static CCSplitCols* actionWithCols(int nCols, ccTime duration);
static CCSplitCols* actionWithCols(int nCols, float duration);
protected:
int m_nCols;

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
NS_CC_BEGIN
CCActionTween* CCActionTween::actionWithDuration(ccTime 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))
@ -41,7 +41,7 @@ CCActionTween* CCActionTween::actionWithDuration(ccTime aDuration, const char* k
return pRet;
}
bool CCActionTween::initWithDuration(ccTime aDuration, const char* key, float from, float to)
bool CCActionTween::initWithDuration(float aDuration, const char* key, float from, float to)
{
if (CCActionInterval::initWithDuration(aDuration))
{
@ -61,7 +61,7 @@ void CCActionTween::startWithTarget(CCNode *pTarget)
m_fDelta = m_fTo - m_fFrom;
}
void CCActionTween::update(ccTime dt)
void CCActionTween::update(float dt)
{
dynamic_cast<CCActionTweenDelegate*>(m_pTarget)->updateTweenAction(m_fTo - m_fDelta * (1 - dt), m_strKey.c_str());
}

View File

@ -58,13 +58,13 @@ class CCActionTween : public CCActionInterval
{
public:
/** creates an initializes the action with the property name (key), and the from and to parameters. */
static CCActionTween* actionWithDuration(ccTime aDuration, const char* key, float from, float to);
static CCActionTween* actionWithDuration(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(ccTime aDuration, const char* key, float from, float to);
bool initWithDuration(float aDuration, const char* key, float from, float to);
void startWithTarget(CCNode *pTarget);
void update(ccTime dt);
void update(float dt);
CCActionInterval* reverse();
std::string m_strKey;

View File

@ -923,12 +923,12 @@ void CCNode::schedule(SEL_SCHEDULE selector)
this->schedule(selector, 0.0f, kCCRepeatForever, 0.0f);
}
void CCNode::schedule(SEL_SCHEDULE selector, ccTime interval)
void CCNode::schedule(SEL_SCHEDULE selector, float interval)
{
this->schedule(selector, interval, kCCRepeatForever, 0.0f);
}
void CCNode::schedule(SEL_SCHEDULE selector, ccTime interval, unsigned int repeat, ccTime delay)
void CCNode::schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay)
{
CCAssert( selector, "Argument must be non-nil");
CCAssert( interval >=0, "Argument must be positive");
@ -936,7 +936,7 @@ void CCNode::schedule(SEL_SCHEDULE selector, ccTime interval, unsigned int repea
m_pScheduler->scheduleSelector(selector, this, interval, !m_bIsRunning, repeat, delay);
}
void CCNode::scheduleOnce(SEL_SCHEDULE selector, ccTime delay)
void CCNode::scheduleOnce(SEL_SCHEDULE selector, float delay)
{
this->schedule(selector, 0.0f, 0, delay);
}

View File

@ -544,18 +544,18 @@ public:
If the selector is already scheduled, then the interval parameter
will be updated without scheduling it again.
*/
void schedule(SEL_SCHEDULE selector, ccTime interval);
void schedule(SEL_SCHEDULE selector, float interval);
/**
repeat will execute the action repeat + 1 times, for a continues action use kCCRepeatForever
delay is the amount of time the action will wait before execution
*/
void schedule(SEL_SCHEDULE selector, ccTime interval, unsigned int repeat, ccTime delay);
void schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay);
/**
Schedules a selector that runs only once, with a delay of 0 or larger
*/
void scheduleOnce(SEL_SCHEDULE selector, ccTime delay);
void scheduleOnce(SEL_SCHEDULE selector, float delay);
/** unschedules a custom selector.*/
void unschedule(SEL_SCHEDULE selector);

View File

@ -26,12 +26,13 @@ THE SOFTWARE.
#define __CCGEMETRY_H__
#include "CCPlatformMacros.h"
#include "CCObject.h"
NS_CC_BEGIN
typedef float CCFloat;
class CC_DLL CCPoint
class CC_DLL CCPoint : public CCObject
{
public:
float x;
@ -47,7 +48,7 @@ public:
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
};
class CC_DLL CCSize
class CC_DLL CCSize : public CCObject
{
public:
float width;
@ -63,7 +64,7 @@ public:
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
};
class CC_DLL CCRect
class CC_DLL CCRect : public CCObject
{
public:
CCPoint origin;

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __CCOBJECT_H__
#define __CCOBJECT_H__
#include "ccTypes.h"
#include "CCCommon.h"
NS_CC_BEGIN
@ -66,13 +65,13 @@ public:
unsigned int retainCount(void);
virtual bool isEqual(const CCObject* pObject);
virtual void update(ccTime dt) {CC_UNUSED_PARAM(dt);};
virtual void update(float dt) {CC_UNUSED_PARAM(dt);};
friend class CCAutoreleasePool;
};
typedef void (CCObject::*SEL_SCHEDULE)(ccTime);
typedef void (CCObject::*SEL_SCHEDULE)(float);
typedef void (CCObject::*SEL_CallFunc)();
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
typedef void (CCObject::*SEL_CallFuncND)(CCNode*, void*);

View File

@ -321,11 +321,6 @@ typedef enum
} ccResolutionType;
//! delta time type
//! if you want more resolution redefine it as a double
typedef float ccTime;
//typedef double ccTime;
typedef enum
{
CCTextAlignmentLeft,
@ -352,7 +347,7 @@ typedef struct _ccT2F_Quad
typedef struct
{
ccT2F_Quad texCoords;
ccTime delay;
float delay;
CCSize size;
} ccAnimationFrameData;

View File

@ -51,7 +51,7 @@ CCTransitionScene::~CCTransitionScene()
m_pOutScene->release();
}
CCTransitionScene * CCTransitionScene::transitionWithDuration(ccTime t, CCScene *scene)
CCTransitionScene * CCTransitionScene::transitionWithDuration(float t, CCScene *scene)
{
CCTransitionScene * pScene = new CCTransitionScene();
if(pScene && pScene->initWithDuration(t,scene))
@ -63,7 +63,7 @@ CCTransitionScene * CCTransitionScene::transitionWithDuration(ccTime t, CCScene
return NULL;
}
bool CCTransitionScene::initWithDuration(ccTime t, CCScene *scene)
bool CCTransitionScene::initWithDuration(float t, CCScene *scene)
{
CCAssert( scene != NULL, "Argument scene must be non-nil");
@ -135,7 +135,7 @@ void CCTransitionScene::finish()
}
void CCTransitionScene::setNewScene(ccTime dt)
void CCTransitionScene::setNewScene(float dt)
{
CC_UNUSED_PARAM(dt);
// [self unschedule:_cmd];
@ -197,7 +197,7 @@ CCTransitionSceneOriented::~CCTransitionSceneOriented()
{
}
CCTransitionSceneOriented * CCTransitionSceneOriented::transitionWithDuration(ccTime t, CCScene *scene, tOrientation orientation)
CCTransitionSceneOriented * CCTransitionSceneOriented::transitionWithDuration(float t, CCScene *scene, tOrientation orientation)
{
CCTransitionSceneOriented * pScene = new CCTransitionSceneOriented();
pScene->initWithDuration(t,scene,orientation);
@ -205,7 +205,7 @@ CCTransitionSceneOriented * CCTransitionSceneOriented::transitionWithDuration(cc
return pScene;
}
bool CCTransitionSceneOriented::initWithDuration(ccTime t, CCScene *scene, tOrientation orientation)
bool CCTransitionSceneOriented::initWithDuration(float t, CCScene *scene, tOrientation orientation)
{
if ( CCTransitionScene::initWithDuration(t, scene) )
{
@ -657,7 +657,7 @@ void CCTransitionFlipX::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionFlipX* CCTransitionFlipX::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
CCTransitionFlipX* CCTransitionFlipX::transitionWithDuration(float t, CCScene* s, tOrientation o)
{
CCTransitionFlipX* pScene = new CCTransitionFlipX();
pScene->initWithDuration(t, s, o);
@ -722,7 +722,7 @@ void CCTransitionFlipY::onEnter()
}
CCTransitionFlipY* CCTransitionFlipY::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
CCTransitionFlipY* CCTransitionFlipY::transitionWithDuration(float t, CCScene* s, tOrientation o)
{
CCTransitionFlipY* pScene = new CCTransitionFlipY();
pScene->initWithDuration(t, s, o);
@ -786,7 +786,7 @@ void CCTransitionFlipAngular::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionFlipAngular* CCTransitionFlipAngular::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
CCTransitionFlipAngular* CCTransitionFlipAngular::transitionWithDuration(float t, CCScene* s, tOrientation o)
{
CCTransitionFlipAngular* pScene = new CCTransitionFlipAngular();
pScene->initWithDuration(t, s, o);
@ -859,7 +859,7 @@ void CCTransitionZoomFlipX::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionZoomFlipX* CCTransitionZoomFlipX::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
CCTransitionZoomFlipX* CCTransitionZoomFlipX::transitionWithDuration(float t, CCScene* s, tOrientation o)
{
CCTransitionZoomFlipX* pScene = new CCTransitionZoomFlipX();
pScene->initWithDuration(t, s, o);
@ -932,7 +932,7 @@ void CCTransitionZoomFlipY::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionZoomFlipY* CCTransitionZoomFlipY::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
CCTransitionZoomFlipY* CCTransitionZoomFlipY::transitionWithDuration(float t, CCScene* s, tOrientation o)
{
CCTransitionZoomFlipY* pScene = new CCTransitionZoomFlipY();
pScene->initWithDuration(t, s, o);
@ -1008,7 +1008,7 @@ void CCTransitionZoomFlipAngular::onEnter()
m_pOutScene->runAction(outA);
}
CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::transitionWithDuration(ccTime t, CCScene* s, tOrientation o)
CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::transitionWithDuration(float t, CCScene* s, tOrientation o)
{
CCTransitionZoomFlipAngular* pScene = new CCTransitionZoomFlipAngular();
pScene->initWithDuration(t, s, o);
@ -1028,7 +1028,7 @@ CCTransitionFade::~CCTransitionFade()
}
CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCScene *scene, const ccColor3B& color)
CCTransitionFade * CCTransitionFade::transitionWithDuration(float duration, CCScene *scene, const ccColor3B& color)
{
CCTransitionFade * pTransition = new CCTransitionFade();
pTransition->initWithDuration(duration, scene, color);
@ -1036,7 +1036,7 @@ CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCS
return pTransition;
}
bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, const ccColor3B& color)
bool CCTransitionFade::initWithDuration(float duration, CCScene *scene, const ccColor3B& color)
{
if (CCTransitionScene::initWithDuration(duration, scene))
{
@ -1048,7 +1048,7 @@ bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, const c
return true;
}
bool CCTransitionFade::initWithDuration(ccTime t, CCScene *scene)
bool CCTransitionFade::initWithDuration(float t, CCScene *scene)
{
this->initWithDuration(t, scene, ccBLACK);
return true;
@ -1177,7 +1177,7 @@ void CCTransitionCrossFade::onExit()
CCTransitionScene::onExit();
}
CCTransitionCrossFade* CCTransitionCrossFade::transitionWithDuration(ccTime d, CCScene* s)
CCTransitionCrossFade* CCTransitionCrossFade::transitionWithDuration(float d, CCScene* s)
{
CCTransitionCrossFade* Transition = new CCTransitionCrossFade();
Transition->initWithDuration(d, s);

View File

@ -28,6 +28,7 @@ THE SOFTWARE.
#define __CCTRANSITION_H__
#include "CCScene.h"
#include "ccTypes.h"
NS_CC_BEGIN
@ -35,10 +36,10 @@ NS_CC_BEGIN
//c/c++ don't support object creation of using class name
//so, all classes need creation method.
#define DECLEAR_TRANSITIONWITHDURATION(_Type)\
static _Type* transitionWithDuration(ccTime t, CCScene* scene);
static _Type* transitionWithDuration(float t, CCScene* scene);
#define IMPLEMENT_TRANSITIONWITHDURATION(_Type)\
_Type* _Type::transitionWithDuration(ccTime t, CCScene* scene)\
_Type* _Type::transitionWithDuration(float t, CCScene* scene)\
{\
_Type* pScene = new _Type();\
if(pScene && pScene->initWithDuration(t, scene)){\
@ -85,7 +86,7 @@ class CC_DLL CCTransitionScene : public CCScene
protected:
CCScene * m_pInScene;
CCScene * m_pOutScene;
ccTime m_fDuration;
float m_fDuration;
bool m_bIsInSceneOnTop;
bool m_bIsSendCleanupToScene;
@ -99,10 +100,10 @@ public:
virtual void cleanup();
/** creates a base transition with duration and incoming scene */
static CCTransitionScene * transitionWithDuration(ccTime t, CCScene *scene);
static CCTransitionScene * transitionWithDuration(float t, CCScene *scene);
/** initializes a transition with duration and incoming scene */
virtual bool initWithDuration(ccTime t,CCScene* scene);
virtual bool initWithDuration(float t,CCScene* scene);
/** called after the transition finishes */
void finish(void);
@ -113,7 +114,7 @@ public:
protected:
virtual void sceneOrder();
private:
void setNewScene(ccTime dt);
void setNewScene(float dt);
};
@ -130,9 +131,9 @@ public:
virtual ~CCTransitionSceneOriented();
/** creates a base transition with duration and incoming scene */
static CCTransitionSceneOriented * transitionWithDuration(ccTime t,CCScene* scene, tOrientation orientation);
static CCTransitionSceneOriented * transitionWithDuration(float t,CCScene* scene, tOrientation orientation);
/** initializes a transition with duration and incoming scene */
virtual bool initWithDuration(ccTime t,CCScene* scene,tOrientation orientation);
virtual bool initWithDuration(float t,CCScene* scene,tOrientation orientation);
};
/** @brief CCTransitionRotoZoom:
@ -327,7 +328,7 @@ public:
virtual void onEnter();
static CCTransitionFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionFlipY:
@ -342,7 +343,7 @@ public:
virtual void onEnter();
static CCTransitionFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
static CCTransitionFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver);
};
/** @brief CCTransitionFlipAngular:
@ -357,7 +358,7 @@ public:
virtual void onEnter();
static CCTransitionFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionZoomFlipX:
@ -372,7 +373,7 @@ public:
virtual void onEnter();
static CCTransitionZoomFlipX* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionZoomFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionZoomFlipY:
@ -387,7 +388,7 @@ public:
virtual void onEnter();
static CCTransitionZoomFlipY* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationUpOver);
static CCTransitionZoomFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver);
};
/** @brief CCTransitionZoomFlipAngular:
@ -402,7 +403,7 @@ public:
virtual void onEnter();
static CCTransitionZoomFlipAngular* transitionWithDuration(ccTime t, CCScene* s, tOrientation o = kOrientationRightOver);
static CCTransitionZoomFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver);
};
/** @brief CCTransitionFade:
@ -421,11 +422,11 @@ public:
/** creates the transition with a duration and with an RGB color
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
*/
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, const ccColor3B& color = ccBLACK);
static CCTransitionFade* transitionWithDuration(float duration,CCScene* scene, const ccColor3B& color = ccBLACK);
/** initializes the transition with a duration and with an RGB color */
virtual bool initWithDuration(ccTime t, CCScene*scene ,const ccColor3B& color);
virtual bool initWithDuration(float t, CCScene*scene ,const ccColor3B& color);
virtual bool initWithDuration(ccTime t,CCScene* scene);
virtual bool initWithDuration(float t,CCScene* scene);
virtual void onEnter();
virtual void onExit();
};

View File

@ -41,7 +41,7 @@ CCTransitionPageTurn::~CCTransitionPageTurn()
}
/** creates a base transition with duration and incoming scene */
CCTransitionPageTurn * CCTransitionPageTurn::transitionWithDuration(ccTime t, CCScene *scene, bool backwards)
CCTransitionPageTurn * CCTransitionPageTurn::transitionWithDuration(float t, CCScene *scene, bool backwards)
{
CCTransitionPageTurn * pTransition = new CCTransitionPageTurn();
pTransition->initWithDuration(t,scene,backwards);
@ -50,7 +50,7 @@ CCTransitionPageTurn * CCTransitionPageTurn::transitionWithDuration(ccTime t, CC
}
/** initializes a transition with duration and incoming scene */
bool CCTransitionPageTurn::initWithDuration(ccTime t, CCScene *scene, bool backwards)
bool CCTransitionPageTurn::initWithDuration(float t, CCScene *scene, bool backwards)
{
// XXX: needed before [super init]
m_bBack = backwards;

View File

@ -55,14 +55,14 @@ public:
* 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* transitionWithDuration(ccTime 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.
*/
virtual bool initWithDuration(ccTime t,CCScene* scene,bool backwards);
virtual bool initWithDuration(float t,CCScene* scene,bool backwards);
CCActionInterval* actionWithSize(const ccGridSize& vector);

View File

@ -207,7 +207,7 @@ bool CCMotionStreak::getIsOpacityModifyRGB(void)
return false;
}
void CCMotionStreak::update(ccTime delta)
void CCMotionStreak::update(float delta)
{
delta *= m_fFadeDelta;

View File

@ -60,7 +60,7 @@ public:
/** Override super methods */
virtual void setPosition(const CCPoint& position);
virtual void draw();
virtual void update(ccTime delta);
virtual void update(float delta);
/* Implement interfaces */
virtual CCTexture2D* getTexture(void);

View File

@ -534,7 +534,7 @@ bool CCParticleSystem::isFull()
}
// ParticleSystem - MainLoop
void CCParticleSystem::update(ccTime dt)
void CCParticleSystem::update(float dt)
{
CC_PROFILER_START_CATEGORY(kCCProfilerCategoryParticles , "CCParticleSystem - update");

View File

@ -99,7 +99,7 @@ typedef struct sCCParticle {
float rotation;
float deltaRotation;
ccTime timeToLive;
float timeToLive;
unsigned int atlasIndex;
@ -389,7 +389,7 @@ public:
//! should be overriden by subclasses
virtual void postStep();
virtual void update(ccTime dt);
virtual void update(float dt);
virtual void updateWithNoTime(void);
};

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
NS_CC_BEGIN
CCSchedulerScriptHandlerEntry* CCSchedulerScriptHandlerEntry::entryWithHandler(int nHandler, ccTime fInterval, bool bPaused)
CCSchedulerScriptHandlerEntry* CCSchedulerScriptHandlerEntry::entryWithHandler(int nHandler, float fInterval, bool bPaused)
{
CCSchedulerScriptHandlerEntry* pEntry = new CCSchedulerScriptHandlerEntry();
pEntry->initWithHandler(nHandler, fInterval, bPaused);
@ -35,9 +35,9 @@ CCSchedulerScriptHandlerEntry* CCSchedulerScriptHandlerEntry::entryWithHandler(i
return pEntry;
}
bool CCSchedulerScriptHandlerEntry::initWithHandler(int nHandler, ccTime fInterval, bool bPaused)
bool CCSchedulerScriptHandlerEntry::initWithHandler(int nHandler, float fInterval, bool bPaused)
{
m_pTimer = new CCTimer();
m_pTimer = new floatr();
m_pTimer->initWithScriptHandler(nHandler, fInterval);
m_pTimer->autorelease();
m_pTimer->retain();

View File

@ -33,17 +33,17 @@ typedef struct lua_State lua_State;
NS_CC_BEGIN
class CCTimer;
class floatr;
// Lua support for CCScheduler
class CCSchedulerScriptHandlerEntry : public CCObject
{
public:
// nHandler return by tolua_ref_function(), called from LuaCocos2d.cpp
static CCSchedulerScriptHandlerEntry* entryWithHandler(int nHandler, ccTime fInterval, bool bPaused);
static CCSchedulerScriptHandlerEntry* entryWithHandler(int nHandler, float fInterval, bool bPaused);
~CCSchedulerScriptHandlerEntry(void);
inline cocos2d::CCTimer* getTimer(void) {
inline cocos2d::floatr* getTimer(void) {
return m_pTimer;
}
@ -65,9 +65,9 @@ public:
private:
CCSchedulerScriptHandlerEntry(void);
bool initWithHandler(int nHandler, ccTime fInterval, bool bPaused);
bool initWithHandler(int nHandler, float fInterval, bool bPaused);
cocos2d::CCTimer* m_pTimer;
cocos2d::floatr* m_pTimer;
bool m_bPaused;
bool m_bMarkedForDeletion;
int m_nHandler;
@ -178,7 +178,7 @@ public:
virtual int executeTouchesEvent(int nHandler, int eventType, CCSet *pTouches) = 0;
// execute a schedule function
virtual int executeSchedule(int nHandler, ccTime dt) = 0;
virtual int executeSchedule(int nHandler, float dt) = 0;
};
/**

View File

@ -31,6 +31,8 @@ THE SOFTWARE.
#include "ccMacros.h"
#include "CCObject.h"
#include "CCGL.h"
NS_CC_BEGIN
enum {

View File

@ -330,7 +330,7 @@ void CCTextureCache::addImageAsync(const char *path, CCObject *target, SEL_CallF
sem_post(s_pSem);
}
void CCTextureCache::addImageAsyncCallBack(ccTime dt)
void CCTextureCache::addImageAsyncCallBack(float dt)
{
// the image is generated in loading thread
std::queue<ImageInfo*> *imagesQueue = s_pImageQueue;

View File

@ -56,7 +56,7 @@ protected:
private:
// @todo void addImageWithAsyncObject(CCAsyncObject* async);
void addImageAsyncCallBack(ccTime dt);
void addImageAsyncCallBack(float dt);
public:

View File

@ -1 +1 @@
10a5824d2ea7fd21b1d844f95393c267a2c9f61e
277bc57b726290085c72db62cf656b66594440dc

View File

@ -240,7 +240,7 @@ void PauseTest::onEnter()
schedule( schedule_selector(PauseTest::unpause), 3);
}
void PauseTest::unpause(ccTime dt)
void PauseTest::unpause(float dt)
{
unschedule( schedule_selector(PauseTest::unpause) );
CCNode* node = getChildByTag( kTagGrossini );
@ -324,7 +324,7 @@ void ResumeTest::onEnter()
this->schedule(schedule_selector(ResumeTest::resumeGrossini), 3.0f);
}
void ResumeTest::resumeGrossini(ccTime time)
void ResumeTest::resumeGrossini(float time)
{
this->unschedule(schedule_selector(ResumeTest::resumeGrossini));

View File

@ -43,7 +43,7 @@ class PauseTest : public ActionManagerTest
public:
virtual std::string title();
virtual void onEnter();
void unpause(ccTime dt);
void unpause(float dt);
};
class RemoveTest : public ActionManagerTest
@ -59,7 +59,7 @@ class ResumeTest : public ActionManagerTest
public:
virtual std::string title();
virtual void onEnter();
void resumeGrossini(ccTime time);
void resumeGrossini(float time);
};
class ActionManagerTestScene : public TestScene

View File

@ -51,7 +51,7 @@ void SpriteEase::onEnter()
schedule(schedule_selector(SpriteEase::testStopAction), 6.25f);
}
void SpriteEase::testStopAction(ccTime dt)
void SpriteEase::testStopAction(float dt)
{
unschedule(schedule_selector(SpriteEase::testStopAction));
m_tamara->stopActionByTag(1);
@ -515,7 +515,7 @@ void SpeedTest::onEnter()
this->schedule(schedule_selector(SpeedTest::altertime), 1.0f);//:@selector(altertime:) interval:1.0f];
}
void SpeedTest::altertime(ccTime dt)
void SpeedTest::altertime(float dt)
{
CCSpeed* action1 = (CCSpeed*)(m_grossini->getActionByTag(kTagAction1));
CCSpeed* action2 = (CCSpeed*)(m_tamara->getActionByTag(kTagAction1));

View File

@ -35,7 +35,7 @@ public:
void onEnter();
virtual std::string title();
void testStopAction(ccTime dt);
void testStopAction(float dt);
};
class SpriteEaseInOut : public EaseSpriteDemo
@ -121,7 +121,7 @@ public:
void onEnter();
virtual std::string title();
void altertime(ccTime dt);
void altertime(float dt);
};
class ActionsEaseTestScene : public TestScene

View File

@ -1263,7 +1263,7 @@ void Issue1305::onExit()
ActionsDemo::onExit();
}
void Issue1305::addSprite(ccTime dt)
void Issue1305::addSprite(float dt)
{
m_pSpriteTmp->setPosition(ccp(250,250));
addChild(m_pSpriteTmp);

View File

@ -290,7 +290,7 @@ public:
virtual void onEnter();
virtual void onExit();
void log(CCNode* pSender);
void addSprite(ccTime dt);
void addSprite(float dt);
virtual std::string title();
virtual std::string subtitle();
private:

View File

@ -237,7 +237,7 @@ void Box2DTestLayer::addNewSpriteAtPosition(CCPoint p)
}
void Box2DTestLayer::update(ccTime dt)
void Box2DTestLayer::update(float dt)
{
//It is recommended that a fixed time step is used with Box2D for stability
//of the simulation, however, we are using a variable time step here.

View File

@ -32,7 +32,7 @@ public:
virtual void draw();
void addNewSpriteAtPosition(CCPoint p);
void update(ccTime dt);
void update(float dt);
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);
//CREATE_NODE(Box2DTestLayer);

View File

@ -187,7 +187,7 @@ std::string Box2DView::title()
return std::string(m_entry->name);
}
void Box2DView::tick(ccTime dt)
void Box2DView::tick(float dt)
{
m_test->Step(&settings);
}

View File

@ -40,7 +40,7 @@ public:
bool initWithEntryID(int entryId);
std::string title();
void tick(ccTime dt);
void tick(float dt);
void draw();
virtual void registerWithTouchDispatcher();

View File

@ -28,7 +28,7 @@ bool Bug624Layer::init()
return false;
}
void Bug624Layer::switchLayer(ccTime dt)
void Bug624Layer::switchLayer(float dt)
{
unschedule(schedule_selector(Bug624Layer::switchLayer));
@ -65,7 +65,7 @@ bool Bug624Layer2::init()
return false;
}
void Bug624Layer2::switchLayer(ccTime dt)
void Bug624Layer2::switchLayer(float dt)
{
unschedule(schedule_selector(Bug624Layer::switchLayer));

View File

@ -7,7 +7,7 @@ class Bug624Layer : public BugsTestBaseLayer
{
public:
virtual bool init();
void switchLayer(ccTime dt);
void switchLayer(float dt);
virtual void didAccelerate(CCAcceleration* pAccelerationValue);
LAYER_NODE_FUNC(Bug624Layer);
@ -17,7 +17,7 @@ class Bug624Layer2 : public BugsTestBaseLayer
{
public:
virtual bool init();
void switchLayer(ccTime dt);
void switchLayer(float dt);
virtual void didAccelerate(CCAcceleration* pAccelerationValue);
LAYER_NODE_FUNC(Bug624Layer2);

View File

@ -148,7 +148,7 @@ void ChipmunkAccelTouchTestLayer::initPhysics()
}
}
void ChipmunkAccelTouchTestLayer::update(ccTime delta)
void ChipmunkAccelTouchTestLayer::update(float delta)
{
// Should use a fixed size step based on the animation interval.
int steps = 2;

View File

@ -19,7 +19,7 @@ public:
void reset(CCObject* sender);
void addNewSpriteAtPosition(CCPoint p);
void update(ccTime dt);
void update(float dt);
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);
virtual void didAccelerate(CCAcceleration* pAccelerationValue);

View File

@ -39,7 +39,7 @@ static std::string effectsList[] =
class Shaky3DDemo : public CCShaky3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCShaky3D::actionWithRange(5, false, ccg(15,10), t);
}
@ -48,7 +48,7 @@ public:
class Waves3DDemo : public CCWaves3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCWaves3D::actionWithWaves(5, 40, ccg(15,10), t);
}
@ -57,7 +57,7 @@ public:
class FlipX3DDemo : public CCFlipX3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCFlipX3D* flipx = CCFlipX3D::actionWithDuration(t);
CCActionInterval* flipx_back = flipx->reverse();
@ -70,7 +70,7 @@ public:
class FlipY3DDemo : public CCFlipY3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCFlipY3D* flipy = CCFlipY3D::actionWithDuration(t);
CCActionInterval* flipy_back = flipy->reverse();
@ -83,7 +83,7 @@ public:
class Lens3DDemo : public CCLens3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCLens3D::actionWithPosition(CCPointMake(size.width/2,size.height/2), 240, ccg(15,10), t);
@ -94,7 +94,7 @@ public:
class Ripple3DDemo : public CCRipple3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCRipple3D::actionWithPosition(CCPointMake(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t);
@ -105,7 +105,7 @@ public:
class LiquidDemo : public CCLiquid
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCLiquid::actionWithWaves(4, 20, ccg(16,12), t);
}
@ -115,7 +115,7 @@ public:
class WavesDemo : public CCWaves
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCWaves::actionWithWaves(4, 20, true, true, ccg(16,12), t);
}
@ -125,7 +125,7 @@ public:
class TwirlDemo : public CCTwirl
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCTwirl::actionWithPosition(CCPointMake(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t);
@ -136,7 +136,7 @@ public:
class ShakyTiles3DDemo : public CCShakyTiles3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCShakyTiles3D::actionWithRange(5, false, ccg(16,12), t) ;
}
@ -146,7 +146,7 @@ public:
class ShatteredTiles3DDemo : public CCShatteredTiles3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCShatteredTiles3D::actionWithRange(5, false, ccg(16,12), t);
}
@ -156,7 +156,7 @@ public:
class ShuffleTilesDemo : public CCShuffleTiles
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCShuffleTiles* shuffle = CCShuffleTiles::actionWithSeed(25, ccg(16,12), t);
CCActionInterval* shuffle_back = shuffle->reverse();
@ -170,7 +170,7 @@ public:
class FadeOutTRTilesDemo : public CCFadeOutTRTiles
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCFadeOutTRTiles* fadeout = CCFadeOutTRTiles::actionWithSize(ccg(16,12), t);
CCActionInterval* back = fadeout->reverse();
@ -184,7 +184,7 @@ public:
class FadeOutBLTilesDemo : public CCFadeOutBLTiles
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCFadeOutBLTiles* fadeout = CCFadeOutBLTiles::actionWithSize(ccg(16,12), t);
CCActionInterval* back = fadeout->reverse();
@ -198,7 +198,7 @@ public:
class FadeOutUpTilesDemo : public CCFadeOutUpTiles
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCFadeOutUpTiles* fadeout = CCFadeOutUpTiles::actionWithSize(ccg(16,12), t);
CCActionInterval* back = fadeout->reverse();
@ -211,7 +211,7 @@ public:
class FadeOutDownTilesDemo : public CCFadeOutDownTiles
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCFadeOutDownTiles* fadeout = CCFadeOutDownTiles::actionWithSize(ccg(16,12), t);
CCActionInterval* back = fadeout->reverse();
@ -224,7 +224,7 @@ public:
class TurnOffTilesDemo : public CCTurnOffTiles
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCTurnOffTiles* fadeout = CCTurnOffTiles::actionWithSeed(25, ccg(48,32) , t);
CCActionInterval* back = fadeout->reverse();
@ -237,7 +237,7 @@ public:
class WavesTiles3DDemo : public CCWavesTiles3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCWavesTiles3D::actionWithWaves(4, 120, ccg(15,10), t);
}
@ -246,7 +246,7 @@ public:
class JumpTiles3DDemo : public CCJumpTiles3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCJumpTiles3D::actionWithJumps(2, 30, ccg(15,10), t);
@ -256,7 +256,7 @@ public:
class SplitRowsDemo : public CCSplitRows
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCSplitRows::actionWithRows(9, t);
}
@ -265,7 +265,7 @@ public:
class SplitColsDemo : public CCSplitCols
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
return CCSplitCols::actionWithCols(9, t);
}
@ -274,7 +274,7 @@ public:
class PageTurn3DDemo : public CCPageTurn3D
{
public:
static CCActionInterval* actionWithDuration(ccTime t)
static CCActionInterval* actionWithDuration(float t)
{
CCDirector::sharedDirector()->setDepthTest(true);
return CCPageTurn3D::actionWithSize(ccg(15,10), t);
@ -288,7 +288,7 @@ public:
//------------------------------------------------------------------
#define MAX_LAYER 22
CCActionInterval* createEffect(int nIndex, ccTime t)
CCActionInterval* createEffect(int nIndex, float t)
{
CCDirector::sharedDirector()->setDepthTest(false);
@ -393,7 +393,7 @@ TextLayer::TextLayer(void)
schedule( schedule_selector(TextLayer::checkAnim) );
}
void TextLayer::checkAnim(ccTime dt)
void TextLayer::checkAnim(float dt)
{
CCNode* s2 = getChildByTag(kTagBackground);
if ( s2->numberOfRunningActions() == 0 && s2->getGrid() != NULL)

View File

@ -18,7 +18,7 @@ public:
TextLayer(void);
~TextLayer(void);
void checkAnim(ccTime dt);
void checkAnim(float dt);
virtual void onEnter();

View File

@ -75,7 +75,7 @@ IntervalLayer::~IntervalLayer()
}
}
void IntervalLayer::update(ccTime dt)
void IntervalLayer::update(float dt)
{
m_time0 +=dt;
char time[10] = {0};
@ -92,7 +92,7 @@ void IntervalLayer::onPause(CCObject* pSender)
}
void IntervalLayer::step1(ccTime dt)
void IntervalLayer::step1(float dt)
{
m_time1 +=dt;
@ -101,7 +101,7 @@ void IntervalLayer::step1(ccTime dt)
m_label1->setString( str );
}
void IntervalLayer::step2(ccTime dt)
void IntervalLayer::step2(float dt)
{
m_time2 +=dt;
@ -110,7 +110,7 @@ void IntervalLayer::step2(ccTime dt)
m_label2->setString( str );
}
void IntervalLayer::step3(ccTime dt)
void IntervalLayer::step3(float dt)
{
m_time3 +=dt;
@ -119,7 +119,7 @@ void IntervalLayer::step3(ccTime dt)
m_label3->setString( str );
}
void IntervalLayer::step4(ccTime dt)
void IntervalLayer::step4(float dt)
{
m_time4 +=dt;

View File

@ -12,7 +12,7 @@ protected:
CCLabelBMFont* m_label3;
CCLabelBMFont* m_label4;
ccTime m_time0, m_time1, m_time2, m_time3, m_time4;
float m_time0, m_time1, m_time2, m_time3, m_time4;
public:
IntervalLayer(void);
@ -20,11 +20,11 @@ public:
public:
void onPause(CCObject* pSender);
void step1(ccTime dt);
void step2(ccTime dt);
void step3(ccTime dt);
void step4(ccTime dt);
void update(ccTime dt);
void step1(float dt);
void step2(float dt);
void step3(float dt);
void step4(float dt);
void update(float dt);
//CREATE_NODE(IntervalLayer);
};

View File

@ -279,7 +279,7 @@ LabelAtlasTest::LabelAtlasTest()
}
void LabelAtlasTest::step(ccTime dt)
void LabelAtlasTest::step(float dt)
{
m_time += dt;
char string[12] = {0};
@ -333,7 +333,7 @@ LabelAtlasColorTest::LabelAtlasColorTest()
schedule( schedule_selector(LabelAtlasColorTest::step) ); //:@selector(step:)];
}
void LabelAtlasColorTest::step(ccTime dt)
void LabelAtlasColorTest::step(float dt)
{
m_time += dt;
char string[12] = {0};
@ -413,7 +413,7 @@ Atlas3::Atlas3()
schedule( schedule_selector(Atlas3::step) );//:@selector(step:)];
}
void Atlas3::step(ccTime dt)
void Atlas3::step(float dt)
{
m_time += dt;
//std::string string;
@ -512,7 +512,7 @@ void Atlas4::draw()
ccDrawLine( ccp(s.width/2, 0), ccp(s.width/2, s.height) );
}
void Atlas4::step(ccTime dt)
void Atlas4::step(float dt)
{
m_time += dt;
char string[10] = {0};
@ -780,7 +780,7 @@ LabelsEmpty::LabelsEmpty()
setEmpty = false;
}
void LabelsEmpty::updateStrings(ccTime dt)
void LabelsEmpty::updateStrings(float dt)
{
CCLabelBMFont* label1 = (CCLabelBMFont*) getChildByTag(kTagBitmapAtlas1);
CCLabelTTF* label2 = (CCLabelTTF*) getChildByTag(kTagBitmapAtlas2);

View File

@ -34,11 +34,11 @@ public:
class LabelAtlasTest : public AtlasDemo
{
ccTime m_time;
float m_time;
public:
LabelAtlasTest();
virtual void step(ccTime dt);
virtual void step(float dt);
virtual std::string title();
virtual std::string subtitle();
@ -46,21 +46,21 @@ public:
class LabelAtlasColorTest : public AtlasDemo
{
ccTime m_time;
float m_time;
public:
LabelAtlasColorTest();
virtual void step(ccTime dt);
virtual void step(float dt);
virtual std::string title();
virtual std::string subtitle();
};
class Atlas3 : public AtlasDemo
{
ccTime m_time;
float m_time;
public:
Atlas3();
virtual void step(ccTime dt);
virtual void step(float dt);
virtual std::string title();
virtual std::string subtitle();
@ -68,10 +68,10 @@ public:
class Atlas4 : public AtlasDemo
{
ccTime m_time;
float m_time;
public:
Atlas4();
virtual void step(ccTime dt);
virtual void step(float dt);
virtual void draw();
virtual std::string title();
@ -124,7 +124,7 @@ class LabelsEmpty : public AtlasDemo
{
public:
LabelsEmpty();
void updateStrings(ccTime dt);
void updateStrings(float dt);
virtual std::string title();
virtual std::string subtitle();

View File

@ -267,7 +267,7 @@ LayerTestBlend::LayerTestBlend()
schedule( schedule_selector(LayerTestBlend::newBlend), 1.0f);
}
void LayerTestBlend::newBlend(ccTime dt)
void LayerTestBlend::newBlend(float dt)
{
CCLayerColor *layer = (CCLayerColor*)getChildByTag(kTagLayer);

View File

@ -48,7 +48,7 @@ class LayerTestBlend : public LayerTest
{
public:
LayerTestBlend();
void newBlend(ccTime dt);
void newBlend(float dt);
virtual std::string title();
};

View File

@ -151,7 +151,7 @@ void MenuLayerMainMenu::menuCallbackConfig(CCObject* sender)
((CCLayerMultiplex*)m_pParent)->switchTo(3);
}
void MenuLayerMainMenu::allowTouches(ccTime dt)
void MenuLayerMainMenu::allowTouches(float dt)
{
CCDirector* pDirector = CCDirector::sharedDirector();
pDirector->getTouchDispatcher()->setPriority(kCCMenuHandlerPriority+1, this);

View File

@ -20,7 +20,7 @@ public:
virtual void ccTouchCancelled(CCTouch *touch, CCEvent * pEvent);
virtual void ccTouchMoved(CCTouch *touch, CCEvent * pEvent);
void allowTouches(ccTime dt);
void allowTouches(float dt);
void menuCallback(CCObject* pSender);
void menuCallbackConfig(CCObject* pSender);
void menuCallbackDisabled(CCObject* pSender);

View File

@ -56,7 +56,7 @@ void MotionStreakTest1::onEnter()
streak = m_streak;
}
void MotionStreakTest1::onUpdate(ccTime delta)
void MotionStreakTest1::onUpdate(float delta)
{
m_streak->setPosition( m_target->convertToWorldSpace(CCPointZero) );
}

View File

@ -32,7 +32,7 @@ protected:
public:
virtual void onEnter();
void onUpdate(ccTime delta);
void onUpdate(float delta);
virtual std::string title();
};

View File

@ -232,14 +232,14 @@ Test4::Test4()
schedule( schedule_selector(Test4::delay4), 4.0f);
}
void Test4::delay2(ccTime dt)
void Test4::delay2(float dt)
{
CCSprite* node = (CCSprite*)(getChildByTag(2));
CCAction* action1 = CCRotateBy::actionWithDuration(1, 360);
node->runAction(action1);
}
void Test4::delay4(ccTime dt)
void Test4::delay4(float dt)
{
unschedule(schedule_selector(Test4::delay4));
removeChildByTag(3, false);
@ -282,7 +282,7 @@ Test5::Test5()
schedule( schedule_selector(Test5::addAndRemove), 2.0f);
}
void Test5::addAndRemove(ccTime dt)
void Test5::addAndRemove(float dt)
{
CCNode* sp1 = getChildByTag(kTagSprite1);
CCNode* sp2 = getChildByTag(kTagSprite2);
@ -343,7 +343,7 @@ Test6::Test6()
schedule( schedule_selector(Test6::addAndRemove), 2.0f);
}
void Test6::addAndRemove(ccTime dt)
void Test6::addAndRemove(float dt)
{
CCNode* sp1 = getChildByTag(kTagSprite1);
CCNode* sp2 = getChildByTag(kTagSprite2);
@ -384,7 +384,7 @@ StressTest1::StressTest1()
schedule( schedule_selector(StressTest1::shouldNotCrash), 1.0f);
}
void StressTest1::shouldNotCrash(ccTime dt)
void StressTest1::shouldNotCrash(float dt)
{
unschedule(schedule_selector(StressTest1::shouldNotCrash));
@ -455,7 +455,7 @@ StressTest2::StressTest2()
addChild(sublayer, 0, kTagSprite1);
}
void StressTest2::shouldNotLeak(ccTime dt)
void StressTest2::shouldNotLeak(float dt)
{
unschedule( schedule_selector(StressTest2::shouldNotLeak) );
CCLayer* sublayer = (CCLayer*)getChildByTag(kTagSprite1);
@ -482,13 +482,13 @@ SchedulerTest1::SchedulerTest1()
//UXLOG("retain count after addChild is %d", layer->retainCount()); // 2
layer->schedule( schedule_selector(SchedulerTest1::doSomething) );
//UXLOG("retain count after schedule is %d", layer->retainCount()); // 3 : (object-c viersion), but win32 version is still 2, because CCTimer class don't save target.
//UXLOG("retain count after schedule is %d", layer->retainCount()); // 3 : (object-c viersion), but win32 version is still 2, because floatr class don't save target.
layer->unschedule(schedule_selector(SchedulerTest1::doSomething));
//UXLOG("retain count after unschedule is %d", layer->retainCount()); // STILL 3! (win32 is '2')
}
void SchedulerTest1::doSomething(ccTime dt)
void SchedulerTest1::doSomething(float dt)
{
}
@ -657,7 +657,7 @@ CameraZoomTest::CameraZoomTest()
scheduleUpdate();
}
void CameraZoomTest::update(ccTime dt)
void CameraZoomTest::update(float dt)
{
CCNode *sprite;
CCCamera *cam;

View File

@ -30,8 +30,8 @@ class Test4 : public TestCocosNodeDemo
{
public:
Test4();
void delay2(ccTime dt);
void delay4(ccTime dt);
void delay2(float dt);
void delay4(float dt);
virtual std::string title();
};
@ -40,7 +40,7 @@ class Test5 : public TestCocosNodeDemo
{
public:
Test5();
void addAndRemove(ccTime dt);
void addAndRemove(float dt);
virtual std::string title();
};
@ -49,14 +49,14 @@ class Test6 : public TestCocosNodeDemo
{
public:
Test6();
void addAndRemove(ccTime dt);
void addAndRemove(float dt);
virtual std::string title();
};
class StressTest1 : public TestCocosNodeDemo
{
void shouldNotCrash(ccTime dt);
void shouldNotCrash(float dt);
void removeMe(CCNode* node);
public:
StressTest1();
@ -66,7 +66,7 @@ public:
class StressTest2 : public TestCocosNodeDemo
{
void shouldNotLeak(ccTime dt);
void shouldNotLeak(float dt);
public:
StressTest2();
@ -77,7 +77,7 @@ class SchedulerTest1 : public TestCocosNodeDemo
{
public:
SchedulerTest1();
void doSomething(ccTime dt);
void doSomething(float dt);
virtual std::string title();
};
@ -104,7 +104,7 @@ class CameraZoomTest : public TestCocosNodeDemo
float m_z;
public:
CameraZoomTest();
void update(ccTime dt);
void update(float dt);
virtual void onEnter();
virtual void onExit();

View File

@ -914,7 +914,7 @@ void Issue870::onEnter()
schedule(schedule_selector(Issue870::updateQuads), 2.0f);
}
void Issue870::updateQuads(ccTime dt)
void Issue870::updateQuads(float dt)
{
m_nIndex = (m_nIndex + 1) % 4;
CCRect rect = CCRectMake(m_nIndex * 32, 0, 32, 32);
@ -1168,7 +1168,7 @@ void ParticleDemo::ccTouchEnded(CCTouch* touch, CCEvent* event)
}
}
void ParticleDemo::update(ccTime dt)
void ParticleDemo::update(float dt)
{
if (m_emitter)
{
@ -1252,7 +1252,7 @@ void ParticleBatchHybrid::onEnter()
m_pParent2 = node;
}
void ParticleBatchHybrid::switchRender(ccTime dt)
void ParticleBatchHybrid::switchRender(float dt)
{
bool usingBatch = ( m_emitter->getBatchNode() != NULL );
m_emitter->removeFromParentAndCleanup(false);
@ -1373,7 +1373,7 @@ std::string ParticleReorder::subtitle()
return "Reordering particles with and without batches batches";
}
void ParticleReorder::reorderParticles(ccTime dt)
void ParticleReorder::reorderParticles(float dt)
{
for( int i=0; i<2;i++) {
CCNode *parent = getChildByTag(1000+i);
@ -1407,7 +1407,7 @@ class RainbowEffect : public CCParticleSystemQuad
public:
bool init();
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
virtual void update(ccTime dt);
virtual void update(float dt);
};
bool RainbowEffect::init()
@ -1481,7 +1481,7 @@ bool RainbowEffect::initWithTotalParticles(unsigned int numberOfParticles)
return false;
}
void RainbowEffect::update(ccTime dt)
void RainbowEffect::update(float dt)
{
m_fEmitCounter = 0;
CCParticleSystemQuad::update(dt);
@ -1551,7 +1551,7 @@ std::string MultipleParticleSystems::subtitle()
return "v1.1 test: FPS should be lower than next test";
}
void MultipleParticleSystems::update(ccTime dt)
void MultipleParticleSystems::update(float dt)
{
CCLabelAtlas *atlas = (CCLabelAtlas*) getChildByTag(kTagParticleCount);
@ -1602,7 +1602,7 @@ void MultipleParticleSystemsBatched::onEnter()
m_emitter = NULL;
}
void MultipleParticleSystemsBatched::update(ccTime dt)
void MultipleParticleSystemsBatched::update(float dt)
{
CCLabelAtlas *atlas = (CCLabelAtlas*) getChildByTag(kTagParticleCount);
@ -1668,7 +1668,7 @@ void AddAndDeleteParticleSystems::onEnter()
}
void AddAndDeleteParticleSystems::removeSystem(ccTime dt)
void AddAndDeleteParticleSystems::removeSystem(float dt)
{
int nChildrenCount = m_pBatchNode->getChildren()->count();
if (nChildrenCount > 0)
@ -1691,7 +1691,7 @@ void AddAndDeleteParticleSystems::removeSystem(ccTime dt)
}
}
void AddAndDeleteParticleSystems::update(ccTime dt)
void AddAndDeleteParticleSystems::update(float dt)
{
CCLabelAtlas *atlas = (CCLabelAtlas*) getChildByTag(kTagParticleCount);
@ -1820,14 +1820,14 @@ void ReorderParticleSystems::onEnter()
}
void ReorderParticleSystems::reorderSystem(ccTime time)
void ReorderParticleSystems::reorderSystem(float time)
{
CCParticleSystem* system = (CCParticleSystem*)m_pBatchNode->getChildren()->objectAtIndex(1);
m_pBatchNode->reorderChild(system, system->getZOrder() - 1);
}
void ReorderParticleSystems::update(ccTime dt)
void ReorderParticleSystems::update(float dt)
{
CCLabelAtlas *atlas = (CCLabelAtlas*) getChildByTag(kTagParticleCount);

View File

@ -36,7 +36,7 @@ public:
virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
virtual void update(ccTime dt);
virtual void update(float dt);
void setEmitterPosition();
};
@ -195,7 +195,7 @@ public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
void updateQuads(ccTime dt);
void updateQuads(float dt);
private:
int m_nIndex;
@ -213,7 +213,7 @@ class ParticleBatchHybrid : public ParticleDemo
{
public:
virtual void onEnter();
void switchRender(ccTime dt);
void switchRender(float dt);
virtual std::string title();
virtual std::string subtitle();
private:
@ -233,7 +233,7 @@ class ParticleReorder : public ParticleDemo
{
public:
virtual void onEnter();
void reorderParticles(ccTime dt);
void reorderParticles(float dt);
virtual std::string title();
virtual std::string subtitle();
private:
@ -246,14 +246,14 @@ public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
virtual void update(ccTime dt);
virtual void update(float dt);
};
class MultipleParticleSystemsBatched : public ParticleDemo
{
public:
virtual void onEnter();
virtual void update(ccTime dt);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();
private:
@ -264,8 +264,8 @@ class AddAndDeleteParticleSystems : public ParticleDemo
{
public:
virtual void onEnter();
virtual void update(ccTime dt);
void removeSystem(ccTime dt);
virtual void update(float dt);
void removeSystem(float dt);
virtual std::string title();
virtual std::string subtitle();
private:
@ -276,8 +276,8 @@ class ReorderParticleSystems : public ParticleDemo
{
public:
virtual void onEnter();
void reorderSystem(ccTime time);
virtual void update(ccTime dt);
void reorderSystem(float time);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();
private:

View File

@ -223,7 +223,7 @@ std::string IterateSpriteSheet::profilerName()
// IterateSpriteSheetFastEnum
//
////////////////////////////////////////////////////////
void IterateSpriteSheetFastEnum::update(ccTime dt)
void IterateSpriteSheetFastEnum::update(float dt)
{
// iterate using fast enumeration protocol
CCArray* pChildren = batchNode->getChildren();
@ -264,7 +264,7 @@ std::string IterateSpriteSheetFastEnum::profilerName()
// IterateSpriteSheetCArray
//
////////////////////////////////////////////////////////
void IterateSpriteSheetCArray::update(ccTime dt)
void IterateSpriteSheetCArray::update(float dt)
{
// iterate using fast enumeration protocol
CCArray* pChildren = batchNode->getChildren();
@ -366,7 +366,7 @@ std::string AddRemoveSpriteSheet::profilerName()
// AddSpriteSheet
//
////////////////////////////////////////////////////////
void AddSpriteSheet::update(ccTime dt)
void AddSpriteSheet::update(float dt)
{
// reset seed
//srandom(0);
@ -431,7 +431,7 @@ std::string AddSpriteSheet::profilerName()
// RemoveSpriteSheet
//
////////////////////////////////////////////////////////
void RemoveSpriteSheet::update(ccTime dt)
void RemoveSpriteSheet::update(float dt)
{
//srandom(0);
@ -491,7 +491,7 @@ std::string RemoveSpriteSheet::profilerName()
// ReorderSpriteSheet
//
////////////////////////////////////////////////////////
void ReorderSpriteSheet::update(ccTime dt)
void ReorderSpriteSheet::update(float dt)
{
//srandom(0);

View File

@ -37,7 +37,7 @@ public:
~IterateSpriteSheet();
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(ccTime dt) = 0;
virtual void update(float dt) = 0;
virtual std::string profilerName();
protected:
@ -51,7 +51,7 @@ protected:
class IterateSpriteSheetFastEnum : public IterateSpriteSheet
{
public:
virtual void update(ccTime dt);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();
@ -61,7 +61,7 @@ public:
class IterateSpriteSheetCArray : public IterateSpriteSheet
{
public:
virtual void update(ccTime dt);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();
@ -74,7 +74,7 @@ public:
~AddRemoveSpriteSheet();
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(ccTime dt) = 0;
virtual void update(float dt) = 0;
virtual std::string profilerName();
protected:
@ -88,7 +88,7 @@ protected:
class AddSpriteSheet : public AddRemoveSpriteSheet
{
public:
virtual void update(ccTime dt);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();
@ -98,7 +98,7 @@ public:
class RemoveSpriteSheet : public AddRemoveSpriteSheet
{
public:
virtual void update(ccTime dt);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();
@ -108,7 +108,7 @@ public:
class ReorderSpriteSheet : public AddRemoveSpriteSheet
{
public:
virtual void update(ccTime dt);
virtual void update(float dt);
virtual std::string title();
virtual std::string subtitle();

View File

@ -144,7 +144,7 @@ std::string ParticleMainScene::title()
return "No title";
}
void ParticleMainScene::step(ccTime dt)
void ParticleMainScene::step(float dt)
{
CCLabelAtlas *atlas = (CCLabelAtlas*) getChildByTag(kTagLabelAtlas);
CCParticleSystem *emitter = (CCParticleSystem*) getChildByTag(kTagParticleSystem);

View File

@ -16,7 +16,7 @@ public:
virtual void initWithSubTest(int subtest, int particles);
virtual std::string title();
void step(ccTime dt);
void step(float dt);
void createParticleSystem();
void onDecrease(CCObject* pSender);
void onIncrease(CCObject* pSender);

View File

@ -57,7 +57,7 @@ void TouchesMainScene::onEnter()
numberOfTouchesB = numberOfTouchesM = numberOfTouchesE = numberOfTouchesC = 0;
}
void TouchesMainScene::update(ccTime dt)
void TouchesMainScene::update(float dt)
{
elapsedTime += dt;

View File

@ -14,7 +14,7 @@ public:
virtual void showCurrentTest();
virtual void onEnter();
virtual std::string title();
virtual void update(ccTime dt);
virtual void update(float dt);
protected:
CCLabelBMFont * m_plabel;
@ -22,7 +22,7 @@ protected:
int numberOfTouchesM;
int numberOfTouchesE;
int numberOfTouchesC;
ccTime elapsedTime;
float elapsedTime;
};
class TouchesPerformTest1 : public TouchesMainScene

View File

@ -38,7 +38,7 @@ SceneTestLayer1::SceneTestLayer1()
schedule( schedule_selector(SceneTestLayer1::testDealloc) );
}
void SceneTestLayer1::testDealloc(ccTime dt)
void SceneTestLayer1::testDealloc(float dt)
{
//UXLOG("SceneTestLayer1:testDealloc");
}
@ -123,7 +123,7 @@ SceneTestLayer2::SceneTestLayer2()
schedule( schedule_selector(SceneTestLayer2::testDealloc) );
}
void SceneTestLayer2::testDealloc(ccTime dt)
void SceneTestLayer2::testDealloc(float dt)
{
//m_timeCounter += dt;
//if( m_timeCounter > 10 )
@ -180,7 +180,7 @@ SceneTestLayer3::SceneTestLayer3()
//schedule();
}
void SceneTestLayer3::testDealloc(ccTime dt)
void SceneTestLayer3::testDealloc(float dt)
{
}

View File

@ -13,7 +13,7 @@ public:
virtual void onEnter();
virtual void onEnterTransitionDidFinish();
void testDealloc(ccTime dt);
void testDealloc(float dt);
void onPushScene(CCObject* pSender);
void onPushSceneTran(CCObject* pSender);
void onQuit(CCObject* pSender);
@ -27,7 +27,7 @@ class SceneTestLayer2 : public CCLayer
public:
SceneTestLayer2();
void testDealloc(ccTime dt);
void testDealloc(float dt);
void onGoBack(CCObject* pSender);
void onReplaceScene(CCObject* pSender);
void onReplaceSceneTran(CCObject* pSender);
@ -40,7 +40,7 @@ class SceneTestLayer3 : public CCLayerColor
public:
SceneTestLayer3();
virtual void testDealloc(ccTime dt);
virtual void testDealloc(float dt);
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);

View File

@ -161,7 +161,7 @@ void SchedulerAutoremove::onEnter()
accum = 0;
}
void SchedulerAutoremove::autoremove(ccTime dt)
void SchedulerAutoremove::autoremove(float dt)
{
accum += dt;
CCLOG("Time: %f", accum);
@ -173,7 +173,7 @@ void SchedulerAutoremove::autoremove(ccTime dt)
}
}
void SchedulerAutoremove::tick(ccTime dt)
void SchedulerAutoremove::tick(float dt)
{
CCLOG("This scheduler should not be removed");
}
@ -202,17 +202,17 @@ void SchedulerPauseResume::onEnter()
schedule(schedule_selector(SchedulerPauseResume::pause), 0.5f);
}
void SchedulerPauseResume::tick1(ccTime dt)
void SchedulerPauseResume::tick1(float dt)
{
CCLOG("tick1");
}
void SchedulerPauseResume::tick2(ccTime dt)
void SchedulerPauseResume::tick2(float dt)
{
CCLOG("tick2");
}
void SchedulerPauseResume::pause(ccTime dt)
void SchedulerPauseResume::pause(float dt)
{
CCDirector::sharedDirector()->getScheduler()->pauseTarget(this);
}
@ -243,27 +243,27 @@ void SchedulerUnscheduleAll::onEnter()
schedule(schedule_selector(SchedulerUnscheduleAll::unscheduleAll), 4);
}
void SchedulerUnscheduleAll::tick1(ccTime dt)
void SchedulerUnscheduleAll::tick1(float dt)
{
CCLOG("tick1");
}
void SchedulerUnscheduleAll::tick2(ccTime dt)
void SchedulerUnscheduleAll::tick2(float dt)
{
CCLOG("tick2");
}
void SchedulerUnscheduleAll::tick3(ccTime dt)
void SchedulerUnscheduleAll::tick3(float dt)
{
CCLOG("tick3");
}
void SchedulerUnscheduleAll::tick4(ccTime dt)
void SchedulerUnscheduleAll::tick4(float dt)
{
CCLOG("tick4");
}
void SchedulerUnscheduleAll::unscheduleAll(ccTime dt)
void SchedulerUnscheduleAll::unscheduleAll(float dt)
{
unscheduleAllSelectors();
}
@ -294,27 +294,27 @@ void SchedulerUnscheduleAllHard::onEnter()
schedule(schedule_selector(SchedulerUnscheduleAllHard::unscheduleAll), 4);
}
void SchedulerUnscheduleAllHard::tick1(ccTime dt)
void SchedulerUnscheduleAllHard::tick1(float dt)
{
CCLOG("tick1");
}
void SchedulerUnscheduleAllHard::tick2(ccTime dt)
void SchedulerUnscheduleAllHard::tick2(float dt)
{
CCLOG("tick2");
}
void SchedulerUnscheduleAllHard::tick3(ccTime dt)
void SchedulerUnscheduleAllHard::tick3(float dt)
{
CCLOG("tick3");
}
void SchedulerUnscheduleAllHard::tick4(ccTime dt)
void SchedulerUnscheduleAllHard::tick4(float dt)
{
CCLOG("tick4");
}
void SchedulerUnscheduleAllHard::unscheduleAll(ccTime dt)
void SchedulerUnscheduleAllHard::unscheduleAll(float dt)
{
CCDirector::sharedDirector()->getScheduler()->unscheduleAllSelectors();
}
@ -343,22 +343,22 @@ void SchedulerSchedulesAndRemove::onEnter()
schedule(schedule_selector(SchedulerSchedulesAndRemove::scheduleAndUnschedule), 4.0f);
}
void SchedulerSchedulesAndRemove::tick1(ccTime dt)
void SchedulerSchedulesAndRemove::tick1(float dt)
{
CCLOG("tick1");
}
void SchedulerSchedulesAndRemove::tick2(ccTime dt)
void SchedulerSchedulesAndRemove::tick2(float dt)
{
CCLOG("tick2");
}
void SchedulerSchedulesAndRemove::tick3(ccTime dt)
void SchedulerSchedulesAndRemove::tick3(float dt)
{
CCLOG("tick3");
}
void SchedulerSchedulesAndRemove::tick4(ccTime dt)
void SchedulerSchedulesAndRemove::tick4(float dt)
{
CCLOG("tick4");
}
@ -373,7 +373,7 @@ std::string SchedulerSchedulesAndRemove::subtitle()
return "Will unschedule and schedule selectors in 4s. See console";
}
void SchedulerSchedulesAndRemove::scheduleAndUnschedule(ccTime dt)
void SchedulerSchedulesAndRemove::scheduleAndUnschedule(float dt)
{
unschedule(schedule_selector(SchedulerSchedulesAndRemove::tick1));
unschedule(schedule_selector(SchedulerSchedulesAndRemove::tick2));
@ -454,7 +454,7 @@ void SchedulerUpdate::onEnter()
schedule(schedule_selector(SchedulerUpdate::removeUpdates), 4.0f);
}
void SchedulerUpdate::removeUpdates(ccTime dt)
void SchedulerUpdate::removeUpdates(float dt)
{
CCArray* children = getChildren();
CCNode* pNode;
@ -495,17 +495,17 @@ void SchedulerUpdateAndCustom::onEnter()
schedule(schedule_selector(SchedulerUpdateAndCustom::stopSelectors), 0.4f);
}
void SchedulerUpdateAndCustom::update(ccTime dt)
void SchedulerUpdateAndCustom::update(float dt)
{
CCLOG("update called:%f", dt);
}
void SchedulerUpdateAndCustom::tick(ccTime dt)
void SchedulerUpdateAndCustom::tick(float dt)
{
CCLOG("custom selector called:%f",dt);
}
void SchedulerUpdateAndCustom::stopSelectors(ccTime dt)
void SchedulerUpdateAndCustom::stopSelectors(float dt)
{
unscheduleAllSelectors();
}
@ -532,19 +532,19 @@ void SchedulerUpdateFromCustom::onEnter()
schedule(schedule_selector(SchedulerUpdateFromCustom::schedUpdate), 2.0f);
}
void SchedulerUpdateFromCustom::update(ccTime dt)
void SchedulerUpdateFromCustom::update(float dt)
{
CCLOG("update called:%f", dt);
}
void SchedulerUpdateFromCustom::schedUpdate(ccTime dt)
void SchedulerUpdateFromCustom::schedUpdate(float dt)
{
unschedule(schedule_selector(SchedulerUpdateFromCustom::schedUpdate));
scheduleUpdate();
schedule(schedule_selector(SchedulerUpdateFromCustom::stopUpdate), 2.0f);
}
void SchedulerUpdateFromCustom::stopUpdate(ccTime dt)
void SchedulerUpdateFromCustom::stopUpdate(float dt)
{
unscheduleUpdate();
unschedule(schedule_selector(SchedulerUpdateFromCustom::stopUpdate));
@ -584,7 +584,7 @@ std::string RescheduleSelector::subtitle()
return "Interval is 1 second, then 2, then 3...";
}
void RescheduleSelector::schedUpdate(ccTime dt)
void RescheduleSelector::schedUpdate(float dt)
{
m_nTicks++;
@ -616,7 +616,7 @@ std::string SchedulerDelayAndRepeat::subtitle()
return "After 5 x executed, method unscheduled. See console";
}
void SchedulerDelayAndRepeat::update(ccTime dt)
void SchedulerDelayAndRepeat::update(float dt)
{
CCLog("update called:%f", dt);
}
@ -639,7 +639,7 @@ CCControlSlider* SchedulerTimeScale::sliderCtl()
void SchedulerTimeScale::sliderAction(CCObject* pSender)
{
CCControlSlider* pSliderCtl = (CCControlSlider*)pSender;
ccTime scale;
float scale;
scale = pSliderCtl->getValue();
CCDirector::sharedDirector()->getScheduler()->setTimeScale(scale);
@ -730,7 +730,7 @@ CCControlSlider *TwoSchedulers::sliderCtl()
void TwoSchedulers::sliderAction(CCObject* sender)
{
ccTime scale;
float scale;
CCControlSlider *slider = (CCControlSlider*) sender;
scale = slider->getValue();

View File

@ -36,10 +36,10 @@ public:
virtual std::string title();
virtual std::string subtitle();
void autoremove(ccTime dt);
void tick(ccTime dt);
void autoremove(float dt);
void tick(float dt);
private:
ccTime accum;
float accum;
};
class SchedulerPauseResume : public SchedulerTestLayer
@ -49,9 +49,9 @@ public:
virtual std::string title();
virtual std::string subtitle();
void tick1(ccTime dt);
void tick2(ccTime dt);
void pause(ccTime dt);
void tick1(float dt);
void tick2(float dt);
void pause(float dt);
};
class SchedulerUnscheduleAll : public SchedulerTestLayer
@ -61,11 +61,11 @@ public:
virtual std::string title();
virtual std::string subtitle();
void tick1(ccTime dt);
void tick2(ccTime dt);
void tick3(ccTime dt);
void tick4(ccTime dt);
void unscheduleAll(ccTime dt);
void tick1(float dt);
void tick2(float dt);
void tick3(float dt);
void tick4(float dt);
void unscheduleAll(float dt);
};
class SchedulerUnscheduleAllHard : public SchedulerTestLayer
@ -75,11 +75,11 @@ public:
virtual std::string title();
virtual std::string subtitle();
void tick1(ccTime dt);
void tick2(ccTime dt);
void tick3(ccTime dt);
void tick4(ccTime dt);
void unscheduleAll(ccTime dt);
void tick1(float dt);
void tick2(float dt);
void tick3(float dt);
void tick4(float dt);
void unscheduleAll(float dt);
};
class SchedulerSchedulesAndRemove : public SchedulerTestLayer
@ -89,11 +89,11 @@ public:
virtual std::string title();
virtual std::string subtitle();
void tick1(ccTime dt);
void tick2(ccTime dt);
void tick3(ccTime dt);
void tick4(ccTime dt);
void scheduleAndUnschedule(ccTime dt);
void tick1(float dt);
void tick2(float dt);
void tick3(float dt);
void tick4(float dt);
void scheduleAndUnschedule(float dt);
};
class SchedulerUpdate : public SchedulerTestLayer
@ -103,7 +103,7 @@ public:
virtual std::string title();
virtual std::string subtitle();
void removeUpdates(ccTime dt);
void removeUpdates(float dt);
};
class SchedulerUpdateAndCustom : public SchedulerTestLayer
@ -113,9 +113,9 @@ public:
virtual std::string title();
virtual std::string subtitle();
void update(ccTime dt);
void tick(ccTime dt);
void stopSelectors(ccTime dt);
void update(float dt);
void tick(float dt);
void stopSelectors(float dt);
};
class SchedulerUpdateFromCustom : public SchedulerTestLayer
@ -125,9 +125,9 @@ public:
virtual std::string title();
virtual std::string subtitle();
void update(ccTime dt);
void schedUpdate(ccTime dt);
void stopUpdate(ccTime dt);
void update(float dt);
void schedUpdate(float dt);
void stopUpdate(float dt);
};
class TestNode : public CCNode
@ -147,7 +147,7 @@ public:
virtual std::string title();
virtual std::string subtitle();
void schedUpdate(ccTime dt);
void schedUpdate(float dt);
private:
float m_fInterval;
int m_nTicks;
@ -159,7 +159,7 @@ public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
void update(ccTime dt);
void update(float dt);
};
class SchedulerTimeScale : public SchedulerTestLayer

View File

@ -194,7 +194,7 @@ void ShaderNode::loadShaderVertex(const char *vert, const char *frag)
shader->release();
}
void ShaderNode::update(ccTime dt)
void ShaderNode::update(float dt)
{
m_time += dt;
}
@ -662,7 +662,7 @@ bool ShaderRetroEffect::init()
return false;
}
void ShaderRetroEffect::update(ccTime dt)
void ShaderRetroEffect::update(float dt)
{
m_fAccum += dt;

View File

@ -102,10 +102,10 @@ public:
virtual std::string title();
virtual std::string subtitle();
bool init();
void update(ccTime dt);
void update(float dt);
protected:
CCLabelBMFont* m_pLabel;
ccTime m_fAccum;
float m_fAccum;
};
class ShaderNode : public CCNode
@ -116,7 +116,7 @@ public:
bool initWithVertex(const char *vert, const char *frag);
void loadShaderVertex(const char *vert, const char *frag);
virtual void update(ccTime dt);
virtual void update(float dt);
virtual void setPosition(const CCPoint &newPosition);
virtual void draw();

View File

@ -1 +1 @@
2e6b4ecbc083689855217489786150bb669823ed
32985150da64bb4070f46022a1fb52ec24c22451

View File

@ -46,7 +46,7 @@ class SpriteColorOpacity : public SpriteTestDemo
{
public:
SpriteColorOpacity();
void removeAndAddSprite(ccTime dt);
void removeAndAddSprite(float dt);
virtual std::string title();
};
@ -54,7 +54,7 @@ class SpriteBatchNodeColorOpacity : public SpriteTestDemo
{
public:
SpriteBatchNodeColorOpacity();
void removeAndAddSprite(ccTime dt);
void removeAndAddSprite(float dt);
virtual std::string title();
};
@ -63,7 +63,7 @@ class SpriteZOrder : public SpriteTestDemo
int m_dir;
public:
SpriteZOrder();
void reorderSprite(ccTime dt);
void reorderSprite(float dt);
virtual std::string title();
};
@ -72,7 +72,7 @@ class SpriteBatchNodeZOrder: public SpriteTestDemo
int m_dir;
public:
SpriteBatchNodeZOrder();
void reorderSprite(ccTime dt);
void reorderSprite(float dt);
virtual std::string title();
};
@ -98,7 +98,7 @@ public:
SpriteBatchNodeReorderIssue766();
virtual std::string title();
virtual std::string subtitle();
void reorderSprite(ccTime dt);
void reorderSprite(float dt);
CCSprite* makeSpriteZ(int aZ);
private:
@ -114,7 +114,7 @@ public:
SpriteBatchNodeReorderIssue767();
virtual std::string title();
virtual std::string subtitle();
void reorderSprites(ccTime dt);
void reorderSprites(float dt);
};
class SpriteZVertex: public SpriteTestDemo
@ -164,7 +164,7 @@ class SpriteFlip : public SpriteTestDemo
{
public:
SpriteFlip();
void flipSprites(ccTime dt);
void flipSprites(float dt);
virtual std::string title();
};
@ -172,7 +172,7 @@ class SpriteBatchNodeFlip : public SpriteTestDemo
{
public:
SpriteBatchNodeFlip();
void flipSprites(ccTime dt);
void flipSprites(float dt);
virtual std::string title();
};
@ -229,8 +229,8 @@ public:
virtual std::string title();
virtual std::string subtitle();
void startIn05Secs(ccTime dt);
void flipSprites(ccTime dt);
void startIn05Secs(float dt);
void flipSprites(float dt);
private:
CCSprite *m_pSprite1;
CCSprite *m_pSprite2;
@ -341,7 +341,7 @@ class SpriteHybrid: public SpriteTestDemo
bool m_usingSpriteBatchNode;
public:
SpriteHybrid();
void reparentSprite(ccTime dt);
void reparentSprite(float dt);
virtual std::string title();
virtual void onExit();
};
@ -448,7 +448,7 @@ public:
virtual std::string title();
virtual std::string subtitle();
void reorderSprite(ccTime dt);
void reorderSprite(float dt);
private:
CCNode *m_pNode;
@ -466,7 +466,7 @@ public:
virtual std::string title();
virtual std::string subtitle();
void reorderSprite(ccTime dt);
void reorderSprite(float dt);
private:
CCSpriteBatchNode *m_pBatchNode;
@ -481,7 +481,7 @@ class SpriteBatchNodeReorderOneChild : public SpriteTestDemo
{
public:
SpriteBatchNodeReorderOneChild();
void reorderSprite(ccTime dt);
void reorderSprite(float dt);
virtual std::string title();
private:
CCSpriteBatchNode *m_pBatchNode;

View File

@ -409,7 +409,7 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(CCTextFieldTTF * pSender, con
CCSize inputTextSize = label->getContentSize();
CCPoint beginPos(endPos.x, CCDirector::sharedDirector()->getWinSize().height - inputTextSize.height * 2);
ccTime duration = 0.5;
float duration = 0.5;
label->setPosition(beginPos);
label->setScale(8);
@ -440,8 +440,8 @@ bool TextFieldTTFActionTest::onTextFieldDeleteBackward(CCTextFieldTTF * pSender,
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCPoint endPos(- winSize.width / 4.0f, winSize.height * (0.5 + (float)rand() / (2.0f * RAND_MAX)));
ccTime duration = 1;
ccTime rotateDuration = 0.2f;
float duration = 1;
float rotateDuration = 0.2f;
int repeatTime = 5;
label->setPosition(beginPos);

View File

@ -1133,7 +1133,7 @@ TextureAsync::~TextureAsync()
CCTextureCache::sharedTextureCache()->removeAllTextures();
}
void TextureAsync::loadImages(ccTime dt)
void TextureAsync::loadImages(float dt)
{
for( int i=0;i < 8;i++) {
for( int j=0;j < 8; j++) {

View File

@ -234,7 +234,7 @@ class TextureAsync : public TextureDemo
{
public:
virtual ~TextureAsync();
void loadImages(ccTime dt);
void loadImages(float dt);
void imageLoaded(CCObject* pObj);
virtual std::string title();
virtual std::string subtitle();

View File

@ -70,7 +70,7 @@ TileMapEditTest::TileMapEditTest()
map->setPosition( ccp(-20,-200) );
}
void TileMapEditTest::updateMap(ccTime dt)
void TileMapEditTest::updateMap(float dt)
{
// IMPORTANT
// The only limitation is that you cannot change an empty, or assign an empty tile to a tile
@ -278,7 +278,7 @@ TMXOrthoTest4::TMXOrthoTest4()
}
void TMXOrthoTest4::removeSprite(ccTime dt)
void TMXOrthoTest4::removeSprite(float dt)
{
unschedule(schedule_selector(TMXOrthoTest4::removeSprite));
@ -376,7 +376,7 @@ void TMXReadWriteTest::removeSprite(CCNode* sender)
//////----UXLOG("atlas quantity: %d", p->textureAtlas()->totalQuads());
}
void TMXReadWriteTest::updateCol(ccTime dt)
void TMXReadWriteTest::updateCol(float dt)
{
CCTMXTiledMap* map = (CCTMXTiledMap*)getChildByTag(kTagTileMap);
CCTMXLayer *layer = (CCTMXLayer*)map->getChildByTag(0);
@ -395,7 +395,7 @@ void TMXReadWriteTest::updateCol(ccTime dt)
m_gid2 = (m_gid2 + 1) % 80;
}
void TMXReadWriteTest::repaintWithGID(ccTime dt)
void TMXReadWriteTest::repaintWithGID(float dt)
{
// unschedule:_cmd);
@ -411,7 +411,7 @@ void TMXReadWriteTest::repaintWithGID(ccTime dt)
}
}
void TMXReadWriteTest::removeTiles(ccTime dt)
void TMXReadWriteTest::removeTiles(float dt)
{
unschedule(schedule_selector(TMXReadWriteTest::removeTiles));
@ -835,7 +835,7 @@ void TMXIsoZorder::onExit()
TileDemo::onExit();
}
void TMXIsoZorder::repositionSprite(ccTime dt)
void TMXIsoZorder::repositionSprite(float dt)
{
CCPoint p = m_tamara->getPosition();
p = CC_POINT_POINTS_TO_PIXELS(p);
@ -895,7 +895,7 @@ TMXOrthoZorder::~TMXOrthoZorder()
m_tamara->release();
}
void TMXOrthoZorder::repositionSprite(ccTime dt)
void TMXOrthoZorder::repositionSprite(float dt)
{
CCPoint p = m_tamara->getPosition();
p = CC_POINT_POINTS_TO_PIXELS(p);
@ -958,7 +958,7 @@ TMXIsoVertexZ::~TMXIsoVertexZ()
m_tamara->release();
}
void TMXIsoVertexZ::repositionSprite(ccTime dt)
void TMXIsoVertexZ::repositionSprite(float dt)
{
// tile height is 64x32
// map size: 30x30
@ -1028,7 +1028,7 @@ TMXOrthoVertexZ::~TMXOrthoVertexZ()
m_tamara->release();
}
void TMXOrthoVertexZ::repositionSprite(ccTime dt)
void TMXOrthoVertexZ::repositionSprite(float dt)
{
// tile height is 101x81
// map size: 12x12
@ -1207,7 +1207,7 @@ std::string TMXOrthoFlipRunTimeTest::subtitle()
return "in 2 sec bottom left tiles will flip";
}
void TMXOrthoFlipRunTimeTest::flipIt(ccTime dt)
void TMXOrthoFlipRunTimeTest::flipIt(float dt)
{
CCTMXTiledMap *map = (CCTMXTiledMap*) getChildByTag(kTagTileMap);
CCTMXLayer *layer = map->layerNamed("Layer 0");

View File

@ -41,7 +41,7 @@ public:
TileMapEditTest (void);
virtual std::string title();
void updateMap(ccTime dt);
void updateMap(float dt);
};
class TMXOrthoTest : public TileDemo
@ -72,7 +72,7 @@ class TMXOrthoTest4 : public TileDemo
{
public:
TMXOrthoTest4(void);
void removeSprite(ccTime dt);
void removeSprite(float dt);
virtual std::string title();
};
@ -85,9 +85,9 @@ public:
virtual std::string title();
void removeSprite(CCNode* sender);
void updateCol(ccTime dt);
void repaintWithGID(ccTime dt);
void removeTiles(ccTime dt);
void updateCol(float dt);
void repaintWithGID(float dt);
void removeTiles(float dt);
};
class TMXHexTest : public TileDemo
@ -173,7 +173,7 @@ public:
virtual void onExit(void);
~TMXIsoZorder();
void repositionSprite(ccTime dt);
void repositionSprite(float dt);
};
class TMXOrthoZorder : public TileDemo
@ -185,7 +185,7 @@ public:
virtual std::string subtitle();
virtual ~TMXOrthoZorder();
void repositionSprite(ccTime dt);
void repositionSprite(float dt);
};
class TMXIsoVertexZ : public TileDemo
@ -197,7 +197,7 @@ public:
virtual std::string subtitle();
~TMXIsoVertexZ();
void repositionSprite(ccTime dt);
void repositionSprite(float dt);
virtual void onEnter();
virtual void onExit();
};
@ -211,7 +211,7 @@ public:
virtual std::string subtitle();
~TMXOrthoVertexZ();
void repositionSprite(ccTime dt);
void repositionSprite(float dt);
virtual void onEnter();
virtual void onExit();
};
@ -253,7 +253,7 @@ public:
TMXOrthoFlipRunTimeTest();
virtual std::string title();
virtual std::string subtitle();
void flipIt(ccTime dt);
void flipIt(float dt);
};
class TMXOrthoFromXMLTest : public TileDemo

View File

@ -23,7 +23,7 @@ Ball* Ball::ballWithTexture(CCTexture2D* aTexture)
return pBall;
}
void Ball::move(ccTime delta)
void Ball::move(float delta)
{
this->setPosition( ccpAdd(getPosition(), ccpMult(m_velocity, delta)) );

View File

@ -17,7 +17,7 @@ public:
float radius();
//BOOL initWithTexture(CCTexture2D* aTexture);
//virtual void setTexture(CCTexture2D* newTexture);
void move(ccTime delta);
void move(float delta);
void collideWithPaddle(Paddle* paddle);

Some files were not shown because too many files have changed in this diff Show More