Merge pull request #1794 from dumganhar/sync

fixed #1625: Added stackable action support. Exchanged the order of parameter for 3d actions.
This commit is contained in:
James Chen 2012-12-26 20:50:32 -08:00
commit f07987418c
40 changed files with 791 additions and 773 deletions

View File

@ -249,6 +249,9 @@ void CCCardinalSplineTo::startWithTarget(cocos2d::CCNode *pTarget)
// Issue #1441
m_fDeltaT = (float) 1 / (m_pPoints->count() - 1);
m_previousPosition = pTarget->getPosition();
m_accumulatedDiff = CCPointZero;
}
CCCardinalSplineTo* CCCardinalSplineTo::copyWithZone(cocos2d::CCZone *pZone)
@ -301,12 +304,21 @@ void CCCardinalSplineTo::update(float time)
CCPoint newPos = ccCardinalSplineAt(pp0, pp1, pp2, pp3, m_fTension, lt);
// Support for stacked actions
CCNode *node = m_pTarget;
CCPoint diff = ccpSub( node->getPosition(), m_previousPosition);
if( diff.x !=0 || diff.y != 0 ) {
m_accumulatedDiff = ccpAdd( m_accumulatedDiff, diff);
newPos = ccpAdd( newPos, m_accumulatedDiff);
}
this->updatePosition(newPos);
}
void CCCardinalSplineTo::updatePosition(cocos2d::CCPoint &newPos)
{
m_pTarget->setPosition(newPos);
m_previousPosition = newPos;
}
CCActionInterval* CCCardinalSplineTo::reverse()
@ -343,7 +355,9 @@ CCCardinalSplineBy::CCCardinalSplineBy() : m_startPosition(0,0)
void CCCardinalSplineBy::updatePosition(cocos2d::CCPoint &newPos)
{
m_pTarget->setPosition(ccpAdd(newPos, m_startPosition));
CCPoint p = ccpAdd(newPos, m_startPosition);
m_pTarget->setPosition(p);
m_previousPosition = p;
}
CCActionInterval* CCCardinalSplineBy::reverse()

View File

@ -141,6 +141,8 @@ protected:
CCPointArray *m_pPoints;
float m_fDeltaT;
float m_fTension;
CCPoint m_previousPosition;
CCPoint m_accumulatedDiff;
};
/** Cardinal Spline path.

View File

@ -67,7 +67,7 @@ bool CCActionEase::initWithAction(CCActionInterval *pAction)
if (CCActionInterval::initWithDuration(pAction->getDuration()))
{
m_pOther = pAction;
m_pInner = pAction;
pAction->retain();
return true;
@ -93,7 +93,7 @@ CCObject* CCActionEase::copyWithZone(CCZone *pZone)
CCActionInterval::copyWithZone(pZone);
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -101,29 +101,29 @@ CCObject* CCActionEase::copyWithZone(CCZone *pZone)
CCActionEase::~CCActionEase(void)
{
CC_SAFE_RELEASE(m_pOther);
CC_SAFE_RELEASE(m_pInner);
}
void CCActionEase::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
m_pOther->startWithTarget(m_pTarget);
m_pInner->startWithTarget(m_pTarget);
}
void CCActionEase::stop(void)
{
m_pOther->stop();
m_pInner->stop();
CCActionInterval::stop();
}
void CCActionEase::update(float time)
{
m_pOther->update(time);
m_pInner->update(time);
}
CCActionInterval* CCActionEase::reverse(void)
{
return CCActionEase::create(m_pOther->reverse());
return CCActionEase::create(m_pInner->reverse());
}
//
@ -174,7 +174,7 @@ CCObject* CCEaseRateAction::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
pCopy->initWithAction((CCActionInterval*)(m_pInner->copy()->autorelease()), m_fRate);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -186,7 +186,7 @@ CCEaseRateAction::~CCEaseRateAction(void)
CCActionInterval* CCEaseRateAction::reverse(void)
{
return CCEaseRateAction::create(m_pOther->reverse(), 1 / m_fRate);
return CCEaseRateAction::create(m_pInner->reverse(), 1 / m_fRate);
}
//
@ -226,7 +226,7 @@ CCObject* CCEaseIn::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
pCopy->initWithAction((CCActionInterval*)(m_pInner->copy()->autorelease()), m_fRate);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -234,12 +234,12 @@ CCObject* CCEaseIn::copyWithZone(CCZone *pZone)
void CCEaseIn::update(float time)
{
m_pOther->update(powf(time, m_fRate));
m_pInner->update(powf(time, m_fRate));
}
CCActionInterval* CCEaseIn::reverse(void)
{
return CCEaseIn::create(m_pOther->reverse(), 1 / m_fRate);
return CCEaseIn::create(m_pInner->reverse(), 1 / m_fRate);
}
//
@ -278,7 +278,7 @@ CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
pCopy->initWithAction((CCActionInterval*)(m_pInner->copy()->autorelease()), m_fRate);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -286,12 +286,12 @@ CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
void CCEaseOut::update(float time)
{
m_pOther->update(powf(time, 1 / m_fRate));
m_pInner->update(powf(time, 1 / m_fRate));
}
CCActionInterval* CCEaseOut::reverse()
{
return CCEaseOut::create(m_pOther->reverse(), 1 / m_fRate);
return CCEaseOut::create(m_pInner->reverse(), 1 / m_fRate);
}
//
@ -330,7 +330,7 @@ CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate);
pCopy->initWithAction((CCActionInterval*)(m_pInner->copy()->autorelease()), m_fRate);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -341,18 +341,18 @@ void CCEaseInOut::update(float time)
time *= 2;
if (time < 1)
{
m_pOther->update(0.5f * powf(time, m_fRate));
m_pInner->update(0.5f * powf(time, m_fRate));
}
else
{
m_pOther->update(1.0f - 0.5f * powf(2-time, m_fRate));
m_pInner->update(1.0f - 0.5f * powf(2-time, m_fRate));
}
}
// InOut and OutIn are symmetrical
CCActionInterval* CCEaseInOut::reverse(void)
{
return CCEaseInOut::create(m_pOther->reverse(), m_fRate);
return CCEaseInOut::create(m_pInner->reverse(), m_fRate);
}
//
@ -391,7 +391,7 @@ CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -399,12 +399,12 @@ CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
void CCEaseExponentialIn::update(float time)
{
m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
m_pInner->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
}
CCActionInterval* CCEaseExponentialIn::reverse(void)
{
return CCEaseExponentialOut::create(m_pOther->reverse());
return CCEaseExponentialOut::create(m_pInner->reverse());
}
//
@ -443,7 +443,7 @@ CCObject* CCEaseExponentialOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -451,12 +451,12 @@ CCObject* CCEaseExponentialOut::copyWithZone(CCZone *pZone)
void CCEaseExponentialOut::update(float time)
{
m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
m_pInner->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
}
CCActionInterval* CCEaseExponentialOut::reverse(void)
{
return CCEaseExponentialIn::create(m_pOther->reverse());
return CCEaseExponentialIn::create(m_pInner->reverse());
}
//
@ -496,7 +496,7 @@ CCObject* CCEaseExponentialInOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -514,12 +514,12 @@ void CCEaseExponentialInOut::update(float time)
time = 0.5f * (-powf(2, -10 * (time - 1)) + 2);
}
m_pOther->update(time);
m_pInner->update(time);
}
CCActionInterval* CCEaseExponentialInOut::reverse()
{
return CCEaseExponentialInOut::create(m_pOther->reverse());
return CCEaseExponentialInOut::create(m_pInner->reverse());
}
//
@ -559,7 +559,7 @@ CCObject* CCEaseSineIn::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -567,12 +567,12 @@ CCObject* CCEaseSineIn::copyWithZone(CCZone *pZone)
void CCEaseSineIn::update(float time)
{
m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1);
m_pInner->update(-1 * cosf(time * (float)M_PI_2) + 1);
}
CCActionInterval* CCEaseSineIn::reverse(void)
{
return CCEaseSineOut::create(m_pOther->reverse());
return CCEaseSineOut::create(m_pInner->reverse());
}
//
@ -612,7 +612,7 @@ CCObject* CCEaseSineOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -620,12 +620,12 @@ CCObject* CCEaseSineOut::copyWithZone(CCZone *pZone)
void CCEaseSineOut::update(float time)
{
m_pOther->update(sinf(time * (float)M_PI_2));
m_pInner->update(sinf(time * (float)M_PI_2));
}
CCActionInterval* CCEaseSineOut::reverse(void)
{
return CCEaseSineIn::create(m_pOther->reverse());
return CCEaseSineIn::create(m_pInner->reverse());
}
//
@ -665,7 +665,7 @@ CCObject* CCEaseSineInOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -673,12 +673,12 @@ CCObject* CCEaseSineInOut::copyWithZone(CCZone *pZone)
void CCEaseSineInOut::update(float time)
{
m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1));
m_pInner->update(-0.5f * (cosf((float)M_PI * time) - 1));
}
CCActionInterval* CCEaseSineInOut::reverse()
{
return CCEaseSineInOut::create(m_pOther->reverse());
return CCEaseSineInOut::create(m_pInner->reverse());
}
//
@ -734,7 +734,7 @@ CCObject* CCEaseElastic::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()), m_fPeriod);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -789,7 +789,7 @@ CCObject* CCEaseElasticIn::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()), m_fPeriod);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -809,12 +809,12 @@ void CCEaseElasticIn::update(float time)
newT = -powf(2, 10 * time) * sinf((time - s) * M_PI_X_2 / m_fPeriod);
}
m_pOther->update(newT);
m_pInner->update(newT);
}
CCActionInterval* CCEaseElasticIn::reverse(void)
{
return CCEaseElasticOut::create(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticOut::create(m_pInner->reverse(), m_fPeriod);
}
//
@ -859,7 +859,7 @@ CCObject *CCEaseElasticOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()), m_fPeriod);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -878,12 +878,12 @@ void CCEaseElasticOut::update(float time)
newT = powf(2, -10 * time) * sinf((time - s) * M_PI_X_2 / m_fPeriod) + 1;
}
m_pOther->update(newT);
m_pInner->update(newT);
}
CCActionInterval* CCEaseElasticOut::reverse(void)
{
return CCEaseElasticIn::create(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticIn::create(m_pInner->reverse(), m_fPeriod);
}
//
@ -928,7 +928,7 @@ CCObject* CCEaseElasticInOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod);
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()), m_fPeriod);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -963,12 +963,12 @@ void CCEaseElasticInOut::update(float time)
}
}
m_pOther->update(newT);
m_pInner->update(newT);
}
CCActionInterval* CCEaseElasticInOut::reverse(void)
{
return CCEaseElasticInOut::create(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticInOut::create(m_pInner->reverse(), m_fPeriod);
}
//
@ -1008,7 +1008,7 @@ CCObject* CCEaseBounce::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1037,7 +1037,7 @@ float CCEaseBounce::bounceTime(float time)
CCActionInterval* CCEaseBounce::reverse()
{
return CCEaseBounce::create(m_pOther->reverse());
return CCEaseBounce::create(m_pInner->reverse());
}
//
@ -1077,7 +1077,7 @@ CCObject* CCEaseBounceIn::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1086,12 +1086,12 @@ CCObject* CCEaseBounceIn::copyWithZone(CCZone *pZone)
void CCEaseBounceIn::update(float time)
{
float newT = 1 - bounceTime(1 - time);
m_pOther->update(newT);
m_pInner->update(newT);
}
CCActionInterval* CCEaseBounceIn::reverse(void)
{
return CCEaseBounceOut::create(m_pOther->reverse());
return CCEaseBounceOut::create(m_pInner->reverse());
}
//
@ -1131,7 +1131,7 @@ CCObject* CCEaseBounceOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1140,12 +1140,12 @@ CCObject* CCEaseBounceOut::copyWithZone(CCZone *pZone)
void CCEaseBounceOut::update(float time)
{
float newT = bounceTime(time);
m_pOther->update(newT);
m_pInner->update(newT);
}
CCActionInterval* CCEaseBounceOut::reverse(void)
{
return CCEaseBounceIn::create(m_pOther->reverse());
return CCEaseBounceIn::create(m_pInner->reverse());
}
//
@ -1185,7 +1185,7 @@ CCObject* CCEaseBounceInOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1204,12 +1204,12 @@ void CCEaseBounceInOut::update(float time)
newT = bounceTime(time * 2 - 1) * 0.5f + 0.5f;
}
m_pOther->update(newT);
m_pInner->update(newT);
}
CCActionInterval* CCEaseBounceInOut::reverse()
{
return CCEaseBounceInOut::create(m_pOther->reverse());
return CCEaseBounceInOut::create(m_pInner->reverse());
}
//
@ -1249,7 +1249,7 @@ CCObject* CCEaseBackIn::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1258,12 +1258,12 @@ CCObject* CCEaseBackIn::copyWithZone(CCZone *pZone)
void CCEaseBackIn::update(float time)
{
float overshoot = 1.70158f;
m_pOther->update(time * time * ((overshoot + 1) * time - overshoot));
m_pInner->update(time * time * ((overshoot + 1) * time - overshoot));
}
CCActionInterval* CCEaseBackIn::reverse(void)
{
return CCEaseBackOut::create(m_pOther->reverse());
return CCEaseBackOut::create(m_pInner->reverse());
}
//
@ -1303,7 +1303,7 @@ CCObject* CCEaseBackOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1314,12 +1314,12 @@ void CCEaseBackOut::update(float time)
float overshoot = 1.70158f;
time = time - 1;
m_pOther->update(time * time * ((overshoot + 1) * time + overshoot) + 1);
m_pInner->update(time * time * ((overshoot + 1) * time + overshoot) + 1);
}
CCActionInterval* CCEaseBackOut::reverse(void)
{
return CCEaseBackIn::create(m_pOther->reverse());
return CCEaseBackIn::create(m_pInner->reverse());
}
//
@ -1359,7 +1359,7 @@ CCObject* CCEaseBackInOut::copyWithZone(CCZone *pZone)
pNewZone = new CCZone(pCopy);
}
pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()));
pCopy->initWithAction((CCActionInterval *)(m_pInner->copy()->autorelease()));
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1372,18 +1372,18 @@ void CCEaseBackInOut::update(float time)
time = time * 2;
if (time < 1)
{
m_pOther->update((time * time * ((overshoot + 1) * time - overshoot)) / 2);
m_pInner->update((time * time * ((overshoot + 1) * time - overshoot)) / 2);
}
else
{
time = time - 2;
m_pOther->update((time * time * ((overshoot + 1) * time + overshoot)) / 2 + 1);
m_pInner->update((time * time * ((overshoot + 1) * time + overshoot)) / 2 + 1);
}
}
CCActionInterval* CCEaseBackInOut::reverse()
{
return CCEaseBackInOut::create(m_pOther->reverse());
return CCEaseBackInOut::create(m_pInner->reverse());
}
NS_CC_END

View File

@ -62,7 +62,8 @@ public:
static CCActionEase* create(CCActionInterval *pAction);
protected:
CCActionInterval *m_pOther;
/** The inner action */
CCActionInterval *m_pInner;
};
/**

View File

@ -30,12 +30,12 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCGridAction
CCGridAction* CCGridAction::create(const ccGridSize& gridSize, float duration)
CCGridAction* CCGridAction::create(float duration, const CCSize& gridSize)
{
CCGridAction *pAction = new CCGridAction();
if (pAction)
{
if (pAction->initWithSize(gridSize, duration))
if (pAction->initWithDuration(duration, gridSize))
{
pAction->autorelease();
}
@ -48,7 +48,7 @@ CCGridAction* CCGridAction::create(const ccGridSize& gridSize, float duration)
return pAction;
}
bool CCGridAction::initWithSize(const ccGridSize& gridSize, float duration)
bool CCGridAction::initWithDuration(float duration, const CCSize& gridSize)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -71,8 +71,8 @@ void CCGridAction::startWithTarget(CCNode *pTarget)
if (targetGrid && targetGrid->getReuseGrid() > 0)
{
if (targetGrid->isActive() && targetGrid->getGridSize().x == m_sGridSize.x
&& targetGrid->getGridSize().y == m_sGridSize.y /*&& dynamic_cast<CCGridBase*>(targetGrid) != NULL*/)
if (targetGrid->isActive() && targetGrid->getGridSize().width == m_sGridSize.width
&& targetGrid->getGridSize().height == m_sGridSize.height /*&& dynamic_cast<CCGridBase*>(targetGrid) != NULL*/)
{
targetGrid->reuse();
}
@ -123,7 +123,7 @@ CCObject* CCGridAction::copyWithZone(CCZone *pZone)
CCActionInterval::copyWithZone(pZone);
pCopy->initWithSize(m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -136,22 +136,22 @@ CCGridBase* CCGrid3DAction::getGrid(void)
return CCGrid3D::create(m_sGridSize);
}
ccVertex3F CCGrid3DAction::vertex(const ccGridSize& pos)
ccVertex3F CCGrid3DAction::vertex(const CCPoint& position)
{
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
return g->vertex(pos);
return g->vertex(position);
}
ccVertex3F CCGrid3DAction::originalVertex(const ccGridSize& pos)
ccVertex3F CCGrid3DAction::originalVertex(const CCPoint& position)
{
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
return g->originalVertex(pos);
return g->originalVertex(position);
}
void CCGrid3DAction::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
void CCGrid3DAction::setVertex(const CCPoint& position, const ccVertex3F& vertex)
{
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
g->setVertex(pos, vertex);
g->setVertex(position, vertex);
}
// implementation of TiledGrid3DAction
@ -161,24 +161,38 @@ CCGridBase* CCTiledGrid3DAction::getGrid(void)
return CCTiledGrid3D::create(m_sGridSize);
}
ccQuad3 CCTiledGrid3DAction::tile(const ccGridSize& pos)
ccQuad3 CCTiledGrid3DAction::tile(const CCPoint& pos)
{
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->tile(pos);
}
ccQuad3 CCTiledGrid3DAction::originalTile(const ccGridSize& pos)
ccQuad3 CCTiledGrid3DAction::originalTile(const CCPoint& pos)
{
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->originalTile(pos);
}
void CCTiledGrid3DAction::setTile(const ccGridSize& pos, const ccQuad3& coords)
void CCTiledGrid3DAction::setTile(const CCPoint& pos, const ccQuad3& coords)
{
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->setTile(pos, coords);
}
CCTiledGrid3DAction* CCTiledGrid3DAction::create(float duration, const CCSize& gridSize)
{
CCTiledGrid3DAction* pRet = new CCTiledGrid3DAction();
if (pRet && pRet->initWithDuration(duration, gridSize))
{
pRet->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
}
return pRet;
}
// implementation CCAccelDeccelAmplitude
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::create(CCAction *pAction, float duration)

View File

@ -46,15 +46,21 @@ public:
virtual CCActionInterval* reverse(void);
/** initializes the action with size and duration */
virtual bool initWithSize(const ccGridSize& gridSize, float duration);
virtual bool initWithDuration(float duration, const CCSize& gridSize);
/** returns the grid */
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration */
static CCGridAction* create(const ccGridSize& gridSize, float duration);
// We can't make this create function compatible with previous version, cxx-generator will be confused since they
// have the same function name and the same number of arguments. So sorry about that.
//CC_DEPRECATED_ATTRIBUTE static CCGridAction* create(const CCSize& gridSize, float duration);
/** creates the action with size and duration */
static CCGridAction* create(float duration, const CCSize& gridSize);
protected:
ccGridSize m_sGridSize;
CCSize m_sGridSize;
};
/**
@ -67,15 +73,15 @@ public:
/** returns the grid */
virtual CCGridBase* getGrid(void);
/** returns the vertex than belongs to certain position in the grid */
ccVertex3F vertex(const ccGridSize& pos);
ccVertex3F vertex(const CCPoint& position);
/** returns the non-transformed vertex than belongs to certain position in the grid */
ccVertex3F originalVertex(const ccGridSize& pos);
ccVertex3F originalVertex(const CCPoint& position);
/** sets a new vertex to a certain position of the grid */
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
void setVertex(const CCPoint& position, const ccVertex3F& vertex);
public:
/** creates the action with size and duration */
static CCGrid3DAction* create(const ccGridSize& gridSize, float duration);
static CCGrid3DAction* create(float duration, const CCSize& gridSize);
};
/** @brief Base class for CCTiledGrid3D actions */
@ -83,18 +89,18 @@ class CC_DLL CCTiledGrid3DAction : public CCGridAction
{
public:
/** returns the tile that belongs to a certain position of the grid */
ccQuad3 tile(const ccGridSize& pos);
ccQuad3 tile(const CCPoint& position);
/** returns the non-transformed tile that belongs to a certain position of the grid */
ccQuad3 originalTile(const ccGridSize& pos);
ccQuad3 originalTile(const CCPoint& position);
/** sets a new tile to a certain position of the grid */
void setTile(const ccGridSize& pos, const ccQuad3& coords);
void setTile(const CCPoint& position, const ccQuad3& coords);
/** returns the grid */
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration */
static CCTiledGrid3DAction* create(const ccGridSize& gridSize, float duration);
static CCTiledGrid3DAction* create(float duration, const CCSize& gridSize);
};
/** @brief CCAccelDeccelAmplitude action */

View File

@ -31,13 +31,13 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCWaves3D
CCWaves3D* CCWaves3D::create(int wav, float amp, const ccGridSize& gridSize, float duration)
CCWaves3D* CCWaves3D::create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude)
{
CCWaves3D *pAction = new CCWaves3D();
if (pAction)
{
if (pAction->initWithWaves(wav, amp, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, waves, amplitude))
{
pAction->autorelease();
}
@ -50,12 +50,12 @@ CCWaves3D* CCWaves3D::create(int wav, float amp, const ccGridSize& gridSize, flo
return pAction;
}
bool CCWaves3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
bool CCWaves3D::initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
m_nWaves = wav;
m_fAmplitude = amp;
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
@ -82,7 +82,7 @@ CCObject* CCWaves3D::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithWaves(m_nWaves, m_fAmplitude, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nWaves, m_fAmplitude);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -91,14 +91,14 @@ CCObject* CCWaves3D::copyWithZone(CCZone *pZone)
void CCWaves3D::update(float time)
{
int i, j;
for (i = 0; i < m_sGridSize.x + 1; ++i)
for (i = 0; i < m_sGridSize.width + 1; ++i)
{
for (j = 0; j < m_sGridSize.y + 1; ++j)
for (j = 0; j < m_sGridSize.height + 1; ++j)
{
ccVertex3F v = originalVertex(ccg(i ,j));
v.z += (sinf((float)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate);
CCLog("v.z offset is %f\n", (sinf((float)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate));
setVertex(ccg(i, j), v);
ccVertex3F v = originalVertex(ccp(i ,j));
v.z += (sinf((float)M_PI * time * m_nWaves * 2 + (v.y+v.x) * 0.01f) * m_fAmplitude * m_fAmplitudeRate);
//CCLOG("v.z offset is %f\n", (sinf((float)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate));
setVertex(ccp(i, j), v);
}
}
}
@ -111,7 +111,7 @@ CCFlipX3D* CCFlipX3D::create(float duration)
if (pAction)
{
if (pAction->initWithSize(ccg(1, 1), duration))
if (pAction->initWithDuration(duration))
{
pAction->autorelease();
}
@ -126,12 +126,12 @@ CCFlipX3D* CCFlipX3D::create(float duration)
bool CCFlipX3D::initWithDuration(float duration)
{
return CCGrid3DAction::initWithSize(ccg(1, 1), duration);
return CCGrid3DAction::initWithDuration(duration, CCSizeMake(1, 1));
}
bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, float duration)
bool CCFlipX3D::initWithSize(const CCSize& gridSize, float duration)
{
if (gridSize.x != 1 || gridSize.y != 1)
if (gridSize.width != 1 || gridSize.height != 1)
{
// Grid size must be (1,1)
CCAssert(0, "Grid size must be (1,1)");
@ -139,7 +139,7 @@ bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, float duration)
return false;
}
return CCGrid3DAction::initWithSize(gridSize, duration);
return CCGrid3DAction::initWithDuration(duration, gridSize);
}
CCObject* CCFlipX3D::copyWithZone(CCZone *pZone)
@ -174,30 +174,30 @@ void CCFlipX3D::update(float time)
ccVertex3F v0, v1, v, diff;
v0 = originalVertex(ccg(1, 1));
v1 = originalVertex(ccg(0, 0));
v0 = originalVertex(ccp(1, 1));
v1 = originalVertex(ccp(0, 0));
float x0 = v0.x;
float x1 = v1.x;
float x;
ccGridSize a, b, c, d;
CCPoint a, b, c, d;
if ( x0 > x1 )
{
// Normal Grid
a = ccg(0,0);
b = ccg(0,1);
c = ccg(1,0);
d = ccg(1,1);
a = ccp(0,0);
b = ccp(0,1);
c = ccp(1,0);
d = ccp(1,1);
x = x0;
}
else
{
// Reversed Grid
c = ccg(0,0);
d = ccg(0,1);
a = ccg(1,0);
b = ccg(1,1);
c = ccp(0,0);
d = ccp(0,1);
a = ccp(1,0);
b = ccp(1,1);
x = x1;
}
@ -237,7 +237,7 @@ CCFlipY3D* CCFlipY3D::create(float duration)
if (pAction)
{
if (pAction->initWithSize(ccg(1, 1), duration))
if (pAction->initWithDuration(duration))
{
pAction->autorelease();
}
@ -282,30 +282,30 @@ void CCFlipY3D::update(float time)
ccVertex3F v0, v1, v, diff;
v0 = originalVertex(ccg(1, 1));
v1 = originalVertex(ccg(0, 0));
v0 = originalVertex(ccp(1, 1));
v1 = originalVertex(ccp(0, 0));
float y0 = v0.y;
float y1 = v1.y;
float y;
ccGridSize a, b, c, d;
CCPoint a, b, c, d;
if (y0 > y1)
{
// Normal Grid
a = ccg(0,0);
b = ccg(0,1);
c = ccg(1,0);
d = ccg(1,1);
a = ccp(0,0);
b = ccp(0,1);
c = ccp(1,0);
d = ccp(1,1);
y = y0;
}
else
{
// Reversed Grid
b = ccg(0,0);
a = ccg(0,1);
d = ccg(1,0);
c = ccg(1,1);
b = ccp(0,0);
a = ccp(0,1);
d = ccp(1,0);
c = ccp(1,1);
y = y1;
}
@ -340,13 +340,13 @@ void CCFlipY3D::update(float time)
// implementation of Lens3D
CCLens3D* CCLens3D::create(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
CCLens3D* CCLens3D::create(float duration, const CCSize& gridSize, const CCPoint& position, float radius)
{
CCLens3D *pAction = new CCLens3D();
if (pAction)
{
if (pAction->initWithPosition(pos, r, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, position, radius))
{
pAction->autorelease();
}
@ -359,13 +359,13 @@ CCLens3D* CCLens3D::create(const CCPoint& pos, float r, const ccGridSize& gridSi
return pAction;
}
bool CCLens3D::initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration)
bool CCLens3D::initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
m_position = ccp(-1, -1);
setPosition(pos);
m_fRadius = r;
setPosition(position);
m_fRadius = radius;
m_fLensEffect = 0.7f;
m_bDirty = true;
@ -392,7 +392,7 @@ CCObject* CCLens3D::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithPosition(m_position, m_fRadius, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_position, m_fRadius);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -414,11 +414,11 @@ void CCLens3D::update(float time)
{
int i, j;
for (i = 0; i < m_sGridSize.x + 1; ++i)
for (i = 0; i < m_sGridSize.width + 1; ++i)
{
for (j = 0; j < m_sGridSize.y + 1; ++j)
for (j = 0; j < m_sGridSize.height + 1; ++j)
{
ccVertex3F v = originalVertex(ccg(i, j));
ccVertex3F v = originalVertex(ccp(i, j));
CCPoint vect = ccpSub(m_position, ccp(v.x, v.y));
float r = ccpLength(vect);
@ -442,7 +442,7 @@ void CCLens3D::update(float time)
}
}
setVertex(ccg(i, j), v);
setVertex(ccp(i, j), v);
}
}
@ -452,13 +452,13 @@ void CCLens3D::update(float time)
// implementation of Ripple3D
CCRipple3D* CCRipple3D::create(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
CCRipple3D* CCRipple3D::create(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude)
{
CCRipple3D *pAction = new CCRipple3D();
if (pAction)
{
if (pAction->initWithPosition(pos, r, wav, amp, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, position, radius, waves, amplitude))
{
pAction->autorelease();
}
@ -471,14 +471,14 @@ CCRipple3D* CCRipple3D::create(const CCPoint& pos, float r, int wav, float amp,
return pAction;
}
bool CCRipple3D::initWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, float duration)
bool CCRipple3D::initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
setPosition(pos);
m_fRadius = r;
m_nWaves = wav;
m_fAmplitude = amp;
setPosition(position);
m_fRadius = radius;
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
@ -509,7 +509,7 @@ CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithPosition(m_position, m_fRadius, m_nWaves, m_fAmplitude, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_position, m_fRadius, m_nWaves, m_fAmplitude);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -519,11 +519,11 @@ void CCRipple3D::update(float time)
{
int i, j;
for (i = 0; i < (m_sGridSize.x+1); ++i)
for (i = 0; i < (m_sGridSize.width+1); ++i)
{
for (j = 0; j < (m_sGridSize.y+1); ++j)
for (j = 0; j < (m_sGridSize.height+1); ++j)
{
ccVertex3F v = originalVertex(ccg(i, j));
ccVertex3F v = originalVertex(ccp(i, j));
CCPoint vect = ccpSub(m_position, ccp(v.x,v.y));
float r = ccpLength(vect);
@ -534,20 +534,20 @@ void CCRipple3D::update(float time)
v.z += (sinf( time*(float)M_PI * m_nWaves * 2 + r * 0.1f) * m_fAmplitude * m_fAmplitudeRate * rate);
}
setVertex(ccg(i, j), v);
setVertex(ccp(i, j), v);
}
}
}
// implementation of Shaky3D
CCShaky3D* CCShaky3D::create(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
CCShaky3D* CCShaky3D::create(float duration, const CCSize& gridSize, int range, bool shakeZ)
{
CCShaky3D *pAction = new CCShaky3D();
if (pAction)
{
if (pAction->initWithRange(range, shakeZ, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, range, shakeZ))
{
pAction->autorelease();
}
@ -560,9 +560,9 @@ CCShaky3D* CCShaky3D::create(int range, bool shakeZ, const ccGridSize& gridSize,
return pAction;
}
bool CCShaky3D::initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, float duration)
bool CCShaky3D::initWithDuration(float duration, const CCSize& gridSize, int range, bool shakeZ)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
m_nRandrange = range;
m_bShakeZ = shakeZ;
@ -590,7 +590,7 @@ CCObject* CCShaky3D::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithRange(m_nRandrange, m_bShakeZ, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nRandrange, m_bShakeZ);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -601,11 +601,11 @@ void CCShaky3D::update(float time)
CC_UNUSED_PARAM(time);
int i, j;
for (i = 0; i < (m_sGridSize.x+1); ++i)
for (i = 0; i < (m_sGridSize.width+1); ++i)
{
for (j = 0; j < (m_sGridSize.y+1); ++j)
for (j = 0; j < (m_sGridSize.height+1); ++j)
{
ccVertex3F v = originalVertex(ccg(i ,j));
ccVertex3F v = originalVertex(ccp(i ,j));
v.x += (rand() % (m_nRandrange*2)) - m_nRandrange;
v.y += (rand() % (m_nRandrange*2)) - m_nRandrange;
if (m_bShakeZ)
@ -613,20 +613,20 @@ void CCShaky3D::update(float time)
v.z += (rand() % (m_nRandrange*2)) - m_nRandrange;
}
setVertex(ccg(i, j), v);
setVertex(ccp(i, j), v);
}
}
}
// implementation of Liquid
CCLiquid* CCLiquid::create(int wav, float amp, const ccGridSize& gridSize, float duration)
CCLiquid* CCLiquid::create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude)
{
CCLiquid *pAction = new CCLiquid();
if (pAction)
{
if (pAction->initWithWaves(wav, amp, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, waves, amplitude))
{
pAction->autorelease();
}
@ -639,12 +639,12 @@ CCLiquid* CCLiquid::create(int wav, float amp, const ccGridSize& gridSize, float
return pAction;
}
bool CCLiquid::initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
bool CCLiquid::initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
m_nWaves = wav;
m_fAmplitude = amp;
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
@ -670,7 +670,7 @@ CCObject* CCLiquid::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithWaves(m_nWaves, m_fAmplitude, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nWaves, m_fAmplitude);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -680,27 +680,27 @@ void CCLiquid::update(float time)
{
int i, j;
for (i = 1; i < m_sGridSize.x; ++i)
for (i = 1; i < m_sGridSize.width; ++i)
{
for (j = 1; j < m_sGridSize.y; ++j)
for (j = 1; j < m_sGridSize.height; ++j)
{
ccVertex3F v = originalVertex(ccg(i, j));
ccVertex3F v = originalVertex(ccp(i, j));
v.x = (v.x + (sinf(time * (float)M_PI * m_nWaves * 2 + v.x * .01f) * m_fAmplitude * m_fAmplitudeRate));
v.y = (v.y + (sinf(time * (float)M_PI * m_nWaves * 2 + v.y * .01f) * m_fAmplitude * m_fAmplitudeRate));
setVertex(ccg(i, j), v);
setVertex(ccp(i, j), v);
}
}
}
// implementation of Waves
CCWaves* CCWaves::create(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
CCWaves* CCWaves::create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical)
{
CCWaves *pAction = new CCWaves();
if (pAction)
{
if (pAction->initWithWaves(wav, amp, h, v, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, waves, amplitude, horizontal, vertical))
{
pAction->autorelease();
}
@ -713,15 +713,15 @@ CCWaves* CCWaves::create(int wav, float amp, bool h, bool v, const ccGridSize& g
return pAction;
}
bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, float duration)
bool CCWaves::initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
m_nWaves = wav;
m_fAmplitude = amp;
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
m_bHorizontal = h;
m_bVertical = v;
m_bHorizontal = horizontal;
m_bVertical = vertical;
return true;
}
@ -746,7 +746,7 @@ CCObject* CCWaves::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithWaves(m_nWaves, m_fAmplitude, m_bHorizontal, m_bVertical, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nWaves, m_fAmplitude, m_bHorizontal, m_bVertical);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -756,11 +756,11 @@ void CCWaves::update(float time)
{
int i, j;
for (i = 0; i < m_sGridSize.x + 1; ++i)
for (i = 0; i < m_sGridSize.width + 1; ++i)
{
for (j = 0; j < m_sGridSize.y + 1; ++j)
for (j = 0; j < m_sGridSize.height + 1; ++j)
{
ccVertex3F v = originalVertex(ccg(i, j));
ccVertex3F v = originalVertex(ccp(i, j));
if (m_bVertical)
{
@ -772,20 +772,20 @@ void CCWaves::update(float time)
v.y = (v.y + (sinf(time * (float)M_PI * m_nWaves * 2 + v.x * .01f) * m_fAmplitude * m_fAmplitudeRate));
}
setVertex(ccg(i, j), v);
setVertex(ccp(i, j), v);
}
}
}
// implementation of Twirl
CCTwirl* CCTwirl::create(CCPoint pos, int t, float amp, const ccGridSize& gridSize, float duration)
CCTwirl* CCTwirl::create(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude)
{
CCTwirl *pAction = new CCTwirl();
if (pAction)
{
if (pAction->initWithPosition(pos, t, amp, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, position, twirls, amplitude))
{
pAction->autorelease();
}
@ -798,13 +798,13 @@ CCTwirl* CCTwirl::create(CCPoint pos, int t, float amp, const ccGridSize& gridSi
return pAction;
}
bool CCTwirl::initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize, float duration)
bool CCTwirl::initWithDuration(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
if (CCGrid3DAction::initWithDuration(duration, gridSize))
{
setPosition(pos);
m_nTwirls = t;
m_fAmplitude = amp;
setPosition(position);
m_nTwirls = twirls;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
@ -836,7 +836,7 @@ CCObject* CCTwirl::copyWithZone(CCZone *pZone)
CCGrid3DAction::copyWithZone(pZone);
pCopy->initWithPosition(m_position, m_nTwirls, m_fAmplitude, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_position, m_nTwirls, m_fAmplitude);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -847,13 +847,13 @@ void CCTwirl::update(float time)
int i, j;
CCPoint c = m_position;
for (i = 0; i < (m_sGridSize.x+1); ++i)
for (i = 0; i < (m_sGridSize.width+1); ++i)
{
for (j = 0; j < (m_sGridSize.y+1); ++j)
for (j = 0; j < (m_sGridSize.height+1); ++j)
{
ccVertex3F v = originalVertex(ccg(i ,j));
ccVertex3F v = originalVertex(ccp(i ,j));
CCPoint avg = ccp(i-(m_sGridSize.x/2.0f), j-(m_sGridSize.y/2.0f));
CCPoint avg = ccp(i-(m_sGridSize.width/2.0f), j-(m_sGridSize.height/2.0f));
float r = ccpLength(avg);
float amp = 0.1f * m_fAmplitude * m_fAmplitudeRate;
@ -866,7 +866,7 @@ void CCTwirl::update(float time)
v.x = c.x + d.x;
v.y = c.y + d.y;
setVertex(ccg(i ,j), v);
setVertex(ccp(i ,j), v);
}
}
}

View File

@ -46,17 +46,17 @@ public:
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** init the action */
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
/** initializes an action with duration, grid size, waves and amplitude */
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** create the action */
static CCWaves3D* create(int wav, float amp, const ccGridSize& gridSize, float duration);
/** creates an action with duration, grid size, waves and amplitude */
static CCWaves3D* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
protected:
int m_nWaves;
unsigned int m_nWaves;
float m_fAmplitude;
float m_fAmplitudeRate;
};
@ -66,8 +66,8 @@ class CC_DLL CCFlipX3D : public CCGrid3DAction
{
public:
/** initializes the action with duration */
bool initWithDuration(float duration);
virtual bool initWithSize(const ccGridSize& gridSize, float duration);
virtual bool initWithDuration(float duration);
virtual bool initWithSize(const CCSize& gridSize, float duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
@ -101,13 +101,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, float duration);
bool initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** creates the action with center position, radius, a grid size and duration */
static CCLens3D* create(const CCPoint& pos, float r, const ccGridSize& gridSize, float duration);
static CCLens3D* create(float duration, const CCSize& gridSize, const CCPoint& position, float radius);
protected:
/* lens center position */
CCPoint m_position;
@ -134,20 +134,18 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** 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, float duration);
bool initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
static CCRipple3D* create(const CCPoint& pos, float r, int wav, float amp,
const ccGridSize& gridSize, float duration);
static CCRipple3D* create(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude);
protected:
/* center position */
CCPoint m_position;
float m_fRadius;
int m_nWaves;
unsigned int m_nWaves;
float m_fAmplitude;
float m_fAmplitudeRate;
};
@ -157,13 +155,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, float duration);
bool initWithDuration(float duration, const CCSize& gridSize, int range, bool shakeZ);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** creates the action with a range, shake Z vertices, a grid and duration */
static CCShaky3D* create(int range, bool shakeZ, const ccGridSize& gridSize, float duration);
static CCShaky3D* create(float duration, const CCSize& gridSize, int range, bool shakeZ);
protected:
int m_nRandrange;
bool m_bShakeZ;
@ -180,15 +178,15 @@ 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, float duration);
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** creates the action with amplitude, a grid and duration */
static CCLiquid* create(int wav, float amp, const ccGridSize& gridSize, float duration);
static CCLiquid* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
protected:
int m_nWaves;
unsigned int m_nWaves;
float m_fAmplitude;
float m_fAmplitudeRate;
};
@ -204,18 +202,16 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** 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,
float duration);
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
static CCWaves* create(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
float duration);
static CCWaves* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
protected:
int m_nWaves;
unsigned int m_nWaves;
float m_fAmplitude;
float m_fAmplitudeRate;
bool m_bVertical;
@ -238,19 +234,17 @@ public:
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** 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,
float duration);
bool initWithDuration(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
public:
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
static CCTwirl* create(CCPoint pos, int t, float amp, const ccGridSize& gridSize,
float duration);
static CCTwirl* create(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude);
protected:
/* twirl center */
CCPoint m_position;
int m_nTwirls;
unsigned int m_nTwirls;
float m_fAmplitude;
float m_fAmplitudeRate;
};

View File

@ -851,7 +851,15 @@ void CCRotateTo::startWithTarget(CCNode *pTarget)
// Calculate X
m_fStartAngleX = pTarget->getRotationX();
if (m_fStartAngleX > 0)
{
m_fStartAngleX = fmodf(m_fStartAngleX, 360.0f);
}
else
{
m_fStartAngleX = fmodf(m_fStartAngleX, -360.0f);
}
m_fDiffAngleX = m_fDstAngleX - m_fStartAngleX;
if (m_fDiffAngleX > 180)
{
@ -862,7 +870,7 @@ void CCRotateTo::startWithTarget(CCNode *pTarget)
m_fDiffAngleX += 360;
}
// Calculate Y
//Calculate Y: It's duplicated from calculating X since the rotation wrap should be the same
m_fStartAngleY = m_pTarget->getRotationY();
if (m_fStartAngleY > 0)
@ -985,17 +993,89 @@ CCActionInterval* CCRotateBy::reverse(void)
return CCRotateBy::create(m_fDuration, -m_fAngleX, -m_fAngleY);
}
//
// MoveBy
//
CCMoveBy* CCMoveBy::create(float duration, const CCPoint& deltaPosition)
{
CCMoveBy *pRet = new CCMoveBy();
pRet->initWithDuration(duration, deltaPosition);
pRet->autorelease();
return pRet;
}
bool CCMoveBy::initWithDuration(float duration, const CCPoint& deltaPosition)
{
if (CCActionInterval::initWithDuration(duration))
{
m_positionDelta = deltaPosition;
return true;
}
return false;
}
CCObject* CCMoveBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCMoveBy* pCopy = NULL;
if(pZone && pZone->m_pCopyObject)
{
//in case of being called at sub class
pCopy = (CCMoveBy*)(pZone->m_pCopyObject);
}
else
{
pCopy = new CCMoveBy();
pZone = pNewZone = new CCZone(pCopy);
}
CCActionInterval::copyWithZone(pZone);
pCopy->initWithDuration(m_fDuration, m_positionDelta);
CC_SAFE_DELETE(pNewZone);
return pCopy;
}
void CCMoveBy::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
m_previousPosition = m_startPosition = pTarget->getPosition();
}
CCActionInterval* CCMoveBy::reverse(void)
{
return CCMoveBy::create(m_fDuration, ccp( -m_positionDelta.x, -m_positionDelta.y));
}
void CCMoveBy::update(float t)
{
if (m_pTarget)
{
CCPoint currentPos = m_pTarget->getPosition();
CCPoint diff = ccpSub(currentPos, m_previousPosition);
m_startPosition = ccpAdd( m_startPosition, diff);
CCPoint newPos = ccpAdd( m_startPosition, ccpMult(m_positionDelta, t) );
m_pTarget->setPosition(newPos);
m_previousPosition = newPos;
}
}
//
// MoveTo
//
CCMoveTo* CCMoveTo::create(float duration, const CCPoint& position)
{
CCMoveTo *pMoveTo = new CCMoveTo();
pMoveTo->initWithDuration(duration, position);
pMoveTo->autorelease();
CCMoveTo *pRet = new CCMoveTo();
pRet->initWithDuration(duration, position);
pRet->autorelease();
return pMoveTo;
return pRet;
}
bool CCMoveTo::initWithDuration(float duration, const CCPoint& position)
@ -1024,88 +1104,20 @@ CCObject* CCMoveTo::copyWithZone(CCZone *pZone)
pZone = pNewZone = new CCZone(pCopy);
}
CCActionInterval::copyWithZone(pZone);
CCMoveBy::copyWithZone(pZone);
pCopy->initWithDuration(m_fDuration, m_endPosition);
CC_SAFE_DELETE(pNewZone);
return pCopy;
}
void CCMoveTo::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
m_startPosition = pTarget->getPosition();
m_delta = ccpSub(m_endPosition, m_startPosition);
CCMoveBy::startWithTarget(pTarget);
m_positionDelta = ccpSub( m_endPosition, pTarget->getPosition() );
}
void CCMoveTo::update(float time)
{
if (m_pTarget)
{
m_pTarget->setPosition(ccp(m_startPosition.x + m_delta.x * time,
m_startPosition.y + m_delta.y * time));
}
}
//
// MoveBy
//
CCMoveBy* CCMoveBy::create(float duration, const CCPoint& position)
{
CCMoveBy *pMoveBy = new CCMoveBy();
pMoveBy->initWithDuration(duration, position);
pMoveBy->autorelease();
return pMoveBy;
}
bool CCMoveBy::initWithDuration(float duration, const CCPoint& position)
{
if (CCActionInterval::initWithDuration(duration))
{
m_delta = position;
return true;
}
return false;
}
CCObject* CCMoveBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCMoveBy* pCopy = NULL;
if(pZone && pZone->m_pCopyObject)
{
//in case of being called at sub class
pCopy = (CCMoveBy*)(pZone->m_pCopyObject);
}
else
{
pCopy = new CCMoveBy();
pZone = pNewZone = new CCZone(pCopy);
}
CCMoveTo::copyWithZone(pZone);
pCopy->initWithDuration(m_fDuration, m_delta);
CC_SAFE_DELETE(pNewZone);
return pCopy;
}
void CCMoveBy::startWithTarget(CCNode *pTarget)
{
CCPoint dTmp = m_delta;
CCMoveTo::startWithTarget(pTarget);
m_delta = dTmp;
}
CCActionInterval* CCMoveBy::reverse(void)
{
return CCMoveBy::create(m_fDuration, ccp(-m_delta.x, -m_delta.y));
}
//
// CCSkewTo
@ -1336,19 +1348,29 @@ CCObject* CCJumpBy::copyWithZone(CCZone *pZone)
void CCJumpBy::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
m_startPosition = pTarget->getPosition();
m_previousPos = m_startPosition = pTarget->getPosition();
}
void CCJumpBy::update(float time)
void CCJumpBy::update(float t)
{
// parabolic jump (since v0.8.2)
if (m_pTarget)
{
float frac = fmodf(time * m_nJumps, 1.0f);
float y = m_height * 4 * frac * (1 - frac);
y += m_delta.y * time;
float x = m_delta.x * time;
m_pTarget->setPosition(ccp(m_startPosition.x + x, m_startPosition.y + y));
float frac = fmodf( t * m_nJumps, 1.0f );
float y = m_height * 4 * frac * (1 - frac);
y += m_delta.y * t;
float x = m_delta.x * t;
CCPoint currentPos = m_pTarget->getPosition();
CCPoint diff = ccpSub( currentPos, m_previousPos );
m_startPosition = ccpAdd( diff, m_startPosition);
CCPoint newPos = ccpAdd( m_startPosition, ccp(x,y));
m_pTarget->setPosition(newPos);
m_previousPos = newPos;
}
}
@ -1439,7 +1461,7 @@ bool CCBezierBy::initWithDuration(float t, const ccBezierConfig& c)
void CCBezierBy::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
m_startPosition = pTarget->getPosition();
m_previousPosition = m_startPosition = pTarget->getPosition();
}
CCObject* CCBezierBy::copyWithZone(CCZone *pZone)
@ -1481,7 +1503,15 @@ void CCBezierBy::update(float time)
float x = bezierat(xa, xb, xc, xd, time);
float y = bezierat(ya, yb, yc, yd, time);
m_pTarget->setPosition(ccpAdd(m_startPosition, ccp(x, y)));
CCPoint currentPos = m_pTarget->getPosition();
CCPoint diff = ccpSub(currentPos, m_previousPosition);
m_startPosition = ccpAdd( m_startPosition, diff);
CCPoint newPos = ccpAdd( m_startPosition, ccp(x,y));
m_pTarget->setPosition(newPos);
m_previousPosition = newPos;
}
}
@ -2380,7 +2410,9 @@ void CCAnimate::update(float t)
//TODO: [[NSNotificationCenter defaultCenter] postNotificationName:CCAnimationFrameDisplayedNotification object:target_ userInfo:dict];
}
m_nNextFrame = i+1;
}
// Issue 1438. Could be more than one frame per tick, due to low frame rate or frame delta < 1/FPS
else {
break;
}
}

View File

@ -304,9 +304,38 @@ protected:
float m_fStartAngleY;
};
/** @brief Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
*/
class CC_DLL CCMoveTo : public CCActionInterval
/** Moves a CCNode object x,y pixels by modifying it's position attribute.
x and y are relative to the position of the object.
Several CCMoveBy actions can be concurrently called, and the resulting
movement will be the sum of individual movements.
@since v2.1beta2-custom
*/
class CC_DLL CCMoveBy : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(float duration, const CCPoint& deltaPosition);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual CCActionInterval* reverse(void);
virtual void update(float time);
public:
/** creates the action */
static CCMoveBy* create(float duration, const CCPoint& deltaPosition);
protected:
CCPoint m_positionDelta;
CCPoint m_startPosition;
CCPoint m_previousPosition;
};
/** Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
Several CCMoveTo actions can be concurrently called, and the resulting
movement will be the sum of individual movements.
@since v2.1beta2-custom
*/
class CC_DLL CCMoveTo : public CCMoveBy
{
public:
/** initializes the action */
@ -314,34 +343,12 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(float time);
public:
/** creates the action */
static CCMoveTo* create(float duration, const CCPoint& position);
protected:
CCPoint m_endPosition;
CCPoint m_startPosition;
CCPoint m_delta;
};
/** @brief Moves a CCNode object x,y pixels by modifying it's position attribute.
x and y are relative to the position of the object.
Duration is is seconds.
*/
class CC_DLL CCMoveBy : public CCMoveTo
{
public:
/** initializes the action */
bool initWithDuration(float duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
virtual CCActionInterval* reverse(void);
public:
/** creates the action */
static CCMoveBy* create(float duration, const CCPoint& position);
};
/** Skews a CCNode object to given angles by modifying it's skewX and skewY attributes
@ -404,10 +411,11 @@ public:
/** creates the action */
static CCJumpBy* create(float duration, const CCPoint& position, float height, unsigned int jumps);
protected:
CCPoint m_startPosition;
CCPoint m_delta;
float m_height;
CCPoint m_startPosition;
CCPoint m_delta;
float m_height;
unsigned int m_nJumps;
CCPoint m_previousPos;
};
/** @brief Moves a CCNode object to a parabolic position simulating a jump movement by modifying it's position attribute.
@ -453,6 +461,7 @@ public:
protected:
ccBezierConfig m_sConfig;
CCPoint m_startPosition;
CCPoint m_previousPosition;
};
/** @brief An action that moves the target with a cubic Bezier curve to a destination point.

View File

@ -24,16 +24,17 @@ THE SOFTWARE.
****************************************************************************/
#include "CCActionPageTurn3D.h"
#include "cocoa/CCZone.h"
#include "support/CCPointExtension.h"
NS_CC_BEGIN
CCPageTurn3D* CCPageTurn3D::create(const ccGridSize& gridSize, float time)
CCPageTurn3D* CCPageTurn3D::create(float duration, const CCSize& gridSize)
{
CCPageTurn3D *pAction = new CCPageTurn3D();
if (pAction)
{
if (pAction->initWithSize(gridSize, time))
if (pAction->initWithDuration(duration, gridSize))
{
pAction->autorelease();
}
@ -62,12 +63,12 @@ void CCPageTurn3D::update(float time)
float sinTheta = sinf(theta);
float cosTheta = cosf(theta);
for (int i = 0; i <= m_sGridSize.x; ++i)
for (int i = 0; i <= m_sGridSize.width; ++i)
{
for (int j = 0; j <= m_sGridSize.y; ++j)
for (int j = 0; j <= m_sGridSize.height; ++j)
{
// Get original vertex
ccVertex3F p = originalVertex(ccg(i ,j));
ccVertex3F p = originalVertex(ccp(i ,j));
float R = sqrtf((p.x * p.x) + ((p.y - ay) * (p.y - ay)));
float r = R * sinTheta;
@ -102,7 +103,7 @@ void CCPageTurn3D::update(float time)
}
// Set new coords
setVertex(ccg(i, j), p);
setVertex(ccp(i, j), p);
}
}

View File

@ -51,7 +51,7 @@ public:
public:
/** create the action */
static CCPageTurn3D* create(const ccGridSize& gridSize, float time);
static CCPageTurn3D* create(float duration, const CCSize& gridSize);
};
// end of actions group

View File

@ -36,18 +36,18 @@ struct Tile
{
CCPoint position;
CCPoint startPosition;
ccGridSize delta;
CCSize delta;
};
// implementation of ShakyTiles3D
CCShakyTiles3D* CCShakyTiles3D::create(int nRange, bool bShakeZ,const ccGridSize& gridSize, float duration)
CCShakyTiles3D* CCShakyTiles3D::create(float duration, const CCSize& gridSize, int nRange, bool bShakeZ)
{
CCShakyTiles3D *pAction = new CCShakyTiles3D();
if (pAction)
{
if (pAction->initWithRange(nRange, bShakeZ, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, nRange, bShakeZ))
{
pAction->autorelease();
}
@ -60,9 +60,9 @@ CCShakyTiles3D* CCShakyTiles3D::create(int nRange, bool bShakeZ,const ccGridSize
return pAction;
}
bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize, float duration)
bool CCShakyTiles3D::initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShakeZ)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
if (CCTiledGrid3DAction::initWithDuration(duration, gridSize))
{
m_nRandrange = nRange;
m_bShakeZ = bShakeZ;
@ -90,7 +90,7 @@ CCObject* CCShakyTiles3D::copyWithZone(CCZone *pZone)
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithRange(m_nRandrange, m_bShakeZ, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nRandrange, m_bShakeZ);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -101,11 +101,11 @@ void CCShakyTiles3D::update(float time)
CC_UNUSED_PARAM(time);
int i, j;
for (i = 0; i < m_sGridSize.x; ++i)
for (i = 0; i < m_sGridSize.width; ++i)
{
for (j = 0; j < m_sGridSize.y; ++j)
for (j = 0; j < m_sGridSize.height; ++j)
{
ccQuad3 coords = originalTile(ccg(i, j));
ccQuad3 coords = originalTile(ccp(i, j));
// X
coords.bl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
@ -127,20 +127,20 @@ void CCShakyTiles3D::update(float time)
coords.tr.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
}
setTile(ccg(i, j), coords);
setTile(ccp(i, j), coords);
}
}
}
// implementation of CCShatteredTiles3D
CCShatteredTiles3D* CCShatteredTiles3D::create(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
CCShatteredTiles3D* CCShatteredTiles3D::create(float duration, const CCSize& gridSize, int nRange, bool bShatterZ)
{
CCShatteredTiles3D *pAction = new CCShatteredTiles3D();
if (pAction)
{
if (pAction->initWithRange(nRange, bShatterZ, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, nRange, bShatterZ))
{
pAction->autorelease();
}
@ -153,9 +153,9 @@ CCShatteredTiles3D* CCShatteredTiles3D::create(int nRange, bool bShatterZ, const
return pAction;
}
bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, float duration)
bool CCShatteredTiles3D::initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShatterZ)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
if (CCTiledGrid3DAction::initWithDuration(duration, gridSize))
{
m_bOnce = false;
m_nRandrange = nRange;
@ -184,7 +184,7 @@ CCObject* CCShatteredTiles3D::copyWithZone(CCZone *pZone)
//copy super class's member
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithRange(m_nRandrange, m_bShatterZ, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nRandrange, m_bShatterZ);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -197,11 +197,11 @@ void CCShatteredTiles3D::update(float time)
if (m_bOnce == false)
{
for (i = 0; i < m_sGridSize.x; ++i)
for (i = 0; i < m_sGridSize.width; ++i)
{
for (j = 0; j < m_sGridSize.y; ++j)
for (j = 0; j < m_sGridSize.height; ++j)
{
ccQuad3 coords = originalTile(ccg(i ,j));
ccQuad3 coords = originalTile(ccp(i ,j));
// X
coords.bl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
@ -223,7 +223,7 @@ void CCShatteredTiles3D::update(float time)
coords.tr.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange;
}
setTile(ccg(i, j), coords);
setTile(ccp(i, j), coords);
}
}
@ -233,13 +233,13 @@ void CCShatteredTiles3D::update(float time)
// implementation of CCShuffleTiles
CCShuffleTiles* CCShuffleTiles::create(int s, const ccGridSize& gridSize, float duration)
CCShuffleTiles* CCShuffleTiles::create(float duration, const CCSize& gridSize, unsigned int seed)
{
CCShuffleTiles *pAction = new CCShuffleTiles();
if (pAction)
{
if (pAction->initWithSeed(s, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, seed))
{
pAction->autorelease();
}
@ -252,11 +252,11 @@ CCShuffleTiles* CCShuffleTiles::create(int s, const ccGridSize& gridSize, float
return pAction;
}
bool CCShuffleTiles::initWithSeed(int s, const ccGridSize& gridSize, float duration)
bool CCShuffleTiles::initWithDuration(float duration, const CCSize& gridSize, unsigned int seed)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
if (CCTiledGrid3DAction::initWithDuration(duration, gridSize))
{
m_nSeed = s;
m_nSeed = seed;
m_pTilesOrder = NULL;
m_pTiles = NULL;
@ -282,7 +282,7 @@ CCObject* CCShuffleTiles::copyWithZone(CCZone *pZone)
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithSeed(m_nSeed, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nSeed);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -294,31 +294,31 @@ CCShuffleTiles::~CCShuffleTiles(void)
CC_SAFE_DELETE_ARRAY(m_pTiles);
}
void CCShuffleTiles::shuffle(int *pArray, unsigned int nLen)
void CCShuffleTiles::shuffle(unsigned int *pArray, unsigned int nLen)
{
int i;
for( i = nLen - 1; i >= 0; i-- )
{
unsigned int j = rand() % (i+1);
int v = pArray[i];
unsigned int v = pArray[i];
pArray[i] = pArray[j];
pArray[j] = v;
}
}
ccGridSize CCShuffleTiles::getDelta(const ccGridSize& pos)
CCSize CCShuffleTiles::getDelta(const CCSize& pos)
{
CCPoint pos2;
unsigned int idx = pos.x * m_sGridSize.y + pos.y;
unsigned int idx = pos.width * m_sGridSize.height + pos.height;
pos2.x = (float)(m_pTilesOrder[idx] / (int)m_sGridSize.y);
pos2.y = (float)(m_pTilesOrder[idx] % (int)m_sGridSize.y);
pos2.x = (float)(m_pTilesOrder[idx] / (int)m_sGridSize.height);
pos2.y = (float)(m_pTilesOrder[idx] % (int)m_sGridSize.height);
return ccg((int)(pos2.x - pos.x), (int)(pos2.y - pos.y));
return CCSizeMake((int)(pos2.x - pos.width), (int)(pos2.y - pos.height));
}
void CCShuffleTiles::placeTile(const ccGridSize& pos, Tile *t)
void CCShuffleTiles::placeTile(const CCPoint& pos, Tile *t)
{
ccQuad3 coords = originalTile(pos);
@ -347,8 +347,8 @@ void CCShuffleTiles::startWithTarget(CCNode *pTarget)
srand(m_nSeed);
}
m_nTilesCount = m_sGridSize.x * m_sGridSize.y;
m_pTilesOrder = new int[m_nTilesCount];
m_nTilesCount = m_sGridSize.width * m_sGridSize.height;
m_pTilesOrder = new unsigned int[m_nTilesCount];
int i, j;
unsigned int k;
@ -366,13 +366,13 @@ void CCShuffleTiles::startWithTarget(CCNode *pTarget)
m_pTiles = (struct Tile *)new Tile[m_nTilesCount];
Tile *tileArray = (Tile*) m_pTiles;
for (i = 0; i < m_sGridSize.x; ++i)
for (i = 0; i < m_sGridSize.width; ++i)
{
for (j = 0; j < m_sGridSize.y; ++j)
for (j = 0; j < m_sGridSize.height; ++j)
{
tileArray->position = ccp((float)i, (float)j);
tileArray->startPosition = ccp((float)i, (float)j);
tileArray->delta = getDelta(ccg(i, j));
tileArray->delta = getDelta(CCSizeMake(i, j));
++tileArray;
}
}
@ -384,12 +384,12 @@ void CCShuffleTiles::update(float time)
Tile *tileArray = (Tile*)m_pTiles;
for (i = 0; i < m_sGridSize.x; ++i)
for (i = 0; i < m_sGridSize.width; ++i)
{
for (j = 0; j < m_sGridSize.y; ++j)
for (j = 0; j < m_sGridSize.height; ++j)
{
tileArray->position = ccpMult(ccp((float)tileArray->delta.x, (float)tileArray->delta.y), time);
placeTile(ccg(i, j), tileArray);
tileArray->position = ccpMult(ccp((float)tileArray->delta.width, (float)tileArray->delta.height), time);
placeTile(ccp(i, j), tileArray);
++tileArray;
}
}
@ -397,13 +397,13 @@ void CCShuffleTiles::update(float time)
// implementation of CCFadeOutTRTiles
CCFadeOutTRTiles* CCFadeOutTRTiles::create(const ccGridSize& gridSize, float time)
CCFadeOutTRTiles* CCFadeOutTRTiles::create(float duration, const CCSize& gridSize)
{
CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles();
if (pAction)
{
if (pAction->initWithSize(gridSize, time))
if (pAction->initWithDuration(duration, gridSize))
{
pAction->autorelease();
}
@ -416,30 +416,30 @@ CCFadeOutTRTiles* CCFadeOutTRTiles::create(const ccGridSize& gridSize, float tim
return pAction;
}
float CCFadeOutTRTiles::testFunc(const ccGridSize& pos, float time)
float CCFadeOutTRTiles::testFunc(const CCSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
CCPoint n = ccpMult(ccp((float)m_sGridSize.width, (float)m_sGridSize.height), time);
if ((n.x + n.y) == 0.0f)
{
return 1.0f;
}
return powf((pos.x + pos.y) / (n.x + n.y), 6);
return powf((pos.width + pos.height) / (n.x + n.y), 6);
}
void CCFadeOutTRTiles::turnOnTile(const ccGridSize& pos)
void CCFadeOutTRTiles::turnOnTile(const CCPoint& pos)
{
setTile(pos, originalTile(pos));
}
void CCFadeOutTRTiles::turnOffTile(const ccGridSize& pos)
void CCFadeOutTRTiles::turnOffTile(const CCPoint& pos)
{
ccQuad3 coords;
memset(&coords, 0, sizeof(ccQuad3));
setTile(pos, coords);
}
void CCFadeOutTRTiles::transformTile(const ccGridSize& pos, float distance)
void CCFadeOutTRTiles::transformTile(const CCPoint& pos, float distance)
{
ccQuad3 coords = originalTile(pos);
CCPoint step = m_pTarget->getGrid()->getStep();
@ -463,22 +463,22 @@ void CCFadeOutTRTiles::update(float time)
{
int i, j;
for (i = 0; i < m_sGridSize.x; ++i)
for (i = 0; i < m_sGridSize.width; ++i)
{
for (j = 0; j < m_sGridSize.y; ++j)
for (j = 0; j < m_sGridSize.height; ++j)
{
float distance = testFunc(ccg(i, j), time);
float distance = testFunc(CCSizeMake(i, j), time);
if ( distance == 0 )
{
turnOffTile(ccg(i, j));
turnOffTile(ccp(i, j));
} else
if (distance < 1)
{
transformTile(ccg(i, j), distance);
transformTile(ccp(i, j), distance);
}
else
{
turnOnTile(ccg(i, j));
turnOnTile(ccp(i, j));
}
}
}
@ -486,13 +486,13 @@ void CCFadeOutTRTiles::update(float time)
// implementation of CCFadeOutBLTiles
CCFadeOutBLTiles* CCFadeOutBLTiles::create(const ccGridSize& gridSize, float time)
CCFadeOutBLTiles* CCFadeOutBLTiles::create(float duration, const CCSize& gridSize)
{
CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles();
if (pAction)
{
if (pAction->initWithSize(gridSize, time))
if (pAction->initWithDuration(duration, gridSize))
{
pAction->autorelease();
}
@ -505,26 +505,26 @@ CCFadeOutBLTiles* CCFadeOutBLTiles::create(const ccGridSize& gridSize, float tim
return pAction;
}
float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, float time)
float CCFadeOutBLTiles::testFunc(const CCSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if ((pos.x + pos.y) == 0)
CCPoint n = ccpMult(ccp((float)m_sGridSize.width, (float)m_sGridSize.height), (1.0f - time));
if ((pos.width + pos.height) == 0)
{
return 1.0f;
}
return powf((n.x + n.y) / (pos.x + pos.y), 6);
return powf((n.x + n.y) / (pos.width + pos.height), 6);
}
// implementation of CCFadeOutUpTiles
CCFadeOutUpTiles* CCFadeOutUpTiles::create(const ccGridSize& gridSize, float time)
CCFadeOutUpTiles* CCFadeOutUpTiles::create(float duration, const CCSize& gridSize)
{
CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles();
if (pAction)
{
if (pAction->initWithSize(gridSize, time))
if (pAction->initWithDuration(duration, gridSize))
{
pAction->autorelease();
}
@ -537,18 +537,18 @@ CCFadeOutUpTiles* CCFadeOutUpTiles::create(const ccGridSize& gridSize, float tim
return pAction;
}
float CCFadeOutUpTiles::testFunc(const ccGridSize& pos, float time)
float CCFadeOutUpTiles::testFunc(const CCSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
CCPoint n = ccpMult(ccp((float)m_sGridSize.width, (float)m_sGridSize.height), time);
if (n.y == 0.0f)
{
return 1.0f;
}
return powf(pos.y / n.y, 6);
return powf(pos.height / n.y, 6);
}
void CCFadeOutUpTiles::transformTile(const ccGridSize& pos, float distance)
void CCFadeOutUpTiles::transformTile(const CCPoint& pos, float distance)
{
ccQuad3 coords = originalTile(pos);
CCPoint step = m_pTarget->getGrid()->getStep();
@ -563,13 +563,13 @@ void CCFadeOutUpTiles::transformTile(const ccGridSize& pos, float distance)
// implementation of CCFadeOutDownTiles
CCFadeOutDownTiles* CCFadeOutDownTiles::create(const ccGridSize& gridSize, float time)
CCFadeOutDownTiles* CCFadeOutDownTiles::create(float duration, const CCSize& gridSize)
{
CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles();
if (pAction)
{
if (pAction->initWithSize(gridSize, time))
if (pAction->initWithDuration(duration, gridSize))
{
pAction->autorelease();
}
@ -582,23 +582,23 @@ CCFadeOutDownTiles* CCFadeOutDownTiles::create(const ccGridSize& gridSize, float
return pAction;
}
float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, float time)
float CCFadeOutDownTiles::testFunc(const CCSize& pos, float time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if (pos.y == 0)
CCPoint n = ccpMult(ccp((float)m_sGridSize.width, (float)m_sGridSize.height), (1.0f - time));
if (pos.height == 0)
{
return 1.0f;
}
return powf(n.y / pos.y, 6);
return powf(n.y / pos.height, 6);
}
// implementation of TurnOffTiles
CCTurnOffTiles* CCTurnOffTiles::create(const ccGridSize& size, float d)
CCTurnOffTiles* CCTurnOffTiles::create(float duration, const CCSize& gridSize)
{
CCTurnOffTiles* pAction = new CCTurnOffTiles();
if (pAction->initWithSize(size, d))
if (pAction->initWithDuration(duration, gridSize, 0))
{
pAction->autorelease();
}
@ -609,13 +609,13 @@ CCTurnOffTiles* CCTurnOffTiles::create(const ccGridSize& size, float d)
return pAction;
}
CCTurnOffTiles* CCTurnOffTiles::create(int s, const ccGridSize& gridSize, float duration)
CCTurnOffTiles* CCTurnOffTiles::create(float duration, const CCSize& gridSize, unsigned int seed)
{
CCTurnOffTiles *pAction = new CCTurnOffTiles();
if (pAction)
{
if (pAction->initWithSeed(s, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, seed))
{
pAction->autorelease();
}
@ -628,11 +628,11 @@ CCTurnOffTiles* CCTurnOffTiles::create(int s, const ccGridSize& gridSize, float
return pAction;
}
bool CCTurnOffTiles::initWithSeed(int s, const ccGridSize& gridSize, float duration)
bool CCTurnOffTiles::initWithDuration(float duration, const CCSize& gridSize, unsigned int seed)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
if (CCTiledGrid3DAction::initWithDuration(duration, gridSize))
{
m_nSeed = s;
m_nSeed = seed;
m_pTilesOrder = NULL;
return true;
@ -657,7 +657,7 @@ CCObject* CCTurnOffTiles::copyWithZone(CCZone *pZone)
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithSeed(m_nSeed, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nSeed );
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -668,24 +668,24 @@ CCTurnOffTiles::~CCTurnOffTiles(void)
CC_SAFE_DELETE_ARRAY(m_pTilesOrder);
}
void CCTurnOffTiles::shuffle(int *pArray, unsigned int nLen)
void CCTurnOffTiles::shuffle(unsigned int *pArray, unsigned int nLen)
{
int i;
for (i = nLen - 1; i >= 0; i--)
{
unsigned int j = rand() % (i+1);
int v = pArray[i];
unsigned int v = pArray[i];
pArray[i] = pArray[j];
pArray[j] = v;
}
}
void CCTurnOffTiles::turnOnTile(const ccGridSize& pos)
void CCTurnOffTiles::turnOnTile(const CCPoint& pos)
{
setTile(pos, originalTile(pos));
}
void CCTurnOffTiles::turnOffTile(const ccGridSize& pos)
void CCTurnOffTiles::turnOffTile(const CCPoint& pos)
{
ccQuad3 coords;
@ -704,8 +704,8 @@ void CCTurnOffTiles::startWithTarget(CCNode *pTarget)
srand(m_nSeed);
}
m_nTilesCount = m_sGridSize.x * m_sGridSize.y;
m_pTilesOrder = new int[m_nTilesCount];
m_nTilesCount = m_sGridSize.width * m_sGridSize.height;
m_pTilesOrder = new unsigned int[m_nTilesCount];
for (i = 0; i < m_nTilesCount; ++i)
{
@ -719,12 +719,12 @@ void CCTurnOffTiles::update(float time)
{
unsigned int i, l, t;
l = (int)(time * (float)m_nTilesCount);
l = (unsigned int)(time * (float)m_nTilesCount);
for( i = 0; i < m_nTilesCount; i++ )
{
t = m_pTilesOrder[i];
ccGridSize tilePos = ccg( t / m_sGridSize.y, t % m_sGridSize.y );
CCPoint tilePos = ccp( (unsigned int)(t / m_sGridSize.height), t % (unsigned int)m_sGridSize.height );
if ( i < l )
{
@ -739,13 +739,13 @@ void CCTurnOffTiles::update(float time)
// implementation of CCWavesTiles3D
CCWavesTiles3D* CCWavesTiles3D::create(int wav, float amp, const ccGridSize& gridSize, float duration)
CCWavesTiles3D* CCWavesTiles3D::create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude)
{
CCWavesTiles3D *pAction = new CCWavesTiles3D();
if (pAction)
{
if (pAction->initWithWaves(wav, amp, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, waves, amplitude))
{
pAction->autorelease();
}
@ -758,12 +758,12 @@ CCWavesTiles3D* CCWavesTiles3D::create(int wav, float amp, const ccGridSize& gri
return pAction;
}
bool CCWavesTiles3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration)
bool CCWavesTiles3D::initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
if (CCTiledGrid3DAction::initWithDuration(duration, gridSize))
{
m_nWaves = wav;
m_fAmplitude = amp;
m_nWaves = waves;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
@ -788,7 +788,7 @@ CCObject* CCWavesTiles3D::copyWithZone(CCZone *pZone)
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithWaves(m_nWaves, m_fAmplitude, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nWaves, m_fAmplitude);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -798,11 +798,11 @@ void CCWavesTiles3D::update(float time)
{
int i, j;
for( i = 0; i < m_sGridSize.x; i++ )
for( i = 0; i < m_sGridSize.width; i++ )
{
for( j = 0; j < m_sGridSize.y; j++ )
for( j = 0; j < m_sGridSize.height; j++ )
{
ccQuad3 coords = originalTile(ccg(i, j));
ccQuad3 coords = originalTile(ccp(i, j));
coords.bl.z = (sinf(time * (float)M_PI *m_nWaves * 2 +
(coords.bl.y+coords.bl.x) * .01f) * m_fAmplitude * m_fAmplitudeRate );
@ -810,20 +810,20 @@ void CCWavesTiles3D::update(float time)
coords.tl.z = coords.bl.z;
coords.tr.z = coords.bl.z;
setTile(ccg(i, j), coords);
setTile(ccp(i, j), coords);
}
}
}
// implementation of CCJumpTiles3D
CCJumpTiles3D* CCJumpTiles3D::create(int j, float amp, const ccGridSize& gridSize, float duration)
CCJumpTiles3D* CCJumpTiles3D::create(float duration, const CCSize& gridSize, unsigned int numberOfJumps, float amplitude)
{
CCJumpTiles3D *pAction = new CCJumpTiles3D();
if (pAction)
{
if (pAction->initWithJumps(j, amp, gridSize, duration))
if (pAction->initWithDuration(duration, gridSize, numberOfJumps, amplitude))
{
pAction->autorelease();
}
@ -836,12 +836,12 @@ CCJumpTiles3D* CCJumpTiles3D::create(int j, float amp, const ccGridSize& gridSiz
return pAction;
}
bool CCJumpTiles3D::initWithJumps(int j, float amp, const ccGridSize& gridSize, float duration)
bool CCJumpTiles3D::initWithDuration(float duration, const CCSize& gridSize, unsigned int numberOfJumps, float amplitude)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
if (CCTiledGrid3DAction::initWithDuration(duration, gridSize))
{
m_nJumps = j;
m_fAmplitude = amp;
m_nJumps = numberOfJumps;
m_fAmplitude = amplitude;
m_fAmplitudeRate = 1.0f;
return true;
@ -865,7 +865,7 @@ CCObject* CCJumpTiles3D::copyWithZone(CCZone *pZone)
}
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithJumps(m_nJumps, m_fAmplitude, m_sGridSize, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_sGridSize, m_nJumps, m_fAmplitude);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -878,11 +878,11 @@ void CCJumpTiles3D::update(float time)
float sinz = (sinf((float)M_PI * time * m_nJumps * 2) * m_fAmplitude * m_fAmplitudeRate );
float sinz2 = (sinf((float)M_PI * (time * m_nJumps * 2 + 1)) * m_fAmplitude * m_fAmplitudeRate );
for( i = 0; i < m_sGridSize.x; i++ )
for( i = 0; i < m_sGridSize.width; i++ )
{
for( j = 0; j < m_sGridSize.y; j++ )
for( j = 0; j < m_sGridSize.height; j++ )
{
ccQuad3 coords = originalTile(ccg(i, j));
ccQuad3 coords = originalTile(ccp(i, j));
if ( ((i+j) % 2) == 0 )
{
@ -899,20 +899,20 @@ void CCJumpTiles3D::update(float time)
coords.tr.z += sinz2;
}
setTile(ccg(i, j), coords);
setTile(ccp(i, j), coords);
}
}
}
// implementation of CCSplitRows
CCSplitRows* CCSplitRows::create(int nRows, float duration)
CCSplitRows* CCSplitRows::create(float duration, unsigned int nRows)
{
CCSplitRows *pAction = new CCSplitRows();
if (pAction)
{
if (pAction->initWithRows(nRows, duration))
if (pAction->initWithDuration(duration, nRows))
{
pAction->autorelease();
}
@ -925,11 +925,11 @@ CCSplitRows* CCSplitRows::create(int nRows, float duration)
return pAction;
}
bool CCSplitRows::initWithRows(int nRows, float duration)
bool CCSplitRows::initWithDuration(float duration, unsigned int nRows)
{
m_nRows = nRows;
return CCTiledGrid3DAction::initWithSize(ccg(1, nRows), duration);
return CCTiledGrid3DAction::initWithDuration(duration, CCSizeMake(1, nRows));
}
CCObject* CCSplitRows::copyWithZone(CCZone *pZone)
@ -948,7 +948,7 @@ CCObject* CCSplitRows::copyWithZone(CCZone *pZone)
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithRows(m_nRows, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_nRows);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -962,11 +962,11 @@ void CCSplitRows::startWithTarget(CCNode *pTarget)
void CCSplitRows::update(float time)
{
int j;
unsigned int j;
for (j = 0; j < m_sGridSize.y; ++j)
for (j = 0; j < m_sGridSize.height; ++j)
{
ccQuad3 coords = originalTile(ccg(0, j));
ccQuad3 coords = originalTile(ccp(0, j));
float direction = 1;
if ( (j % 2 ) == 0 )
@ -979,19 +979,19 @@ void CCSplitRows::update(float time)
coords.tl.x += direction * m_winSize.width * time;
coords.tr.x += direction * m_winSize.width * time;
setTile(ccg(0, j), coords);
setTile(ccp(0, j), coords);
}
}
// implementation of CCSplitCols
CCSplitCols* CCSplitCols::create(int nCols, float duration)
CCSplitCols* CCSplitCols::create(float duration, unsigned int nCols)
{
CCSplitCols *pAction = new CCSplitCols();
if (pAction)
{
if (pAction->initWithCols(nCols, duration))
if (pAction->initWithDuration(duration, nCols))
{
pAction->autorelease();
}
@ -1004,10 +1004,10 @@ CCSplitCols* CCSplitCols::create(int nCols, float duration)
return pAction;
}
bool CCSplitCols::initWithCols(int nCols, float duration)
bool CCSplitCols::initWithDuration(float duration, unsigned int nCols)
{
m_nCols = nCols;
return CCTiledGrid3DAction::initWithSize(ccg(nCols, 1), duration);
return CCTiledGrid3DAction::initWithDuration(duration, CCSizeMake(nCols, 1));
}
CCObject* CCSplitCols::copyWithZone(CCZone *pZone)
@ -1025,7 +1025,7 @@ CCObject* CCSplitCols::copyWithZone(CCZone *pZone)
}
CCTiledGrid3DAction::copyWithZone(pZone);
pCopy->initWithCols(m_nCols, m_fDuration);
pCopy->initWithDuration(m_fDuration, m_nCols);
CC_SAFE_DELETE(pNewZone);
return pCopy;
@ -1039,11 +1039,11 @@ void CCSplitCols::startWithTarget(CCNode *pTarget)
void CCSplitCols::update(float time)
{
int i;
unsigned int i;
for (i = 0; i < m_sGridSize.x; ++i)
for (i = 0; i < m_sGridSize.width; ++i)
{
ccQuad3 coords = originalTile(ccg(i, 0));
ccQuad3 coords = originalTile(ccp(i, 0));
float direction = 1;
if ( (i % 2 ) == 0 )
@ -1056,7 +1056,7 @@ void CCSplitCols::update(float time)
coords.tl.y += direction * m_winSize.height * time;
coords.tr.y += direction * m_winSize.height * time;
setTile(ccg(i, 0), coords);
setTile(ccp(i, 0), coords);
}
}

View File

@ -39,8 +39,7 @@ 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,
float duration);
virtual bool initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShakeZ);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
@ -48,7 +47,7 @@ public:
public:
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
static CCShakyTiles3D* create(int nRange, bool bShakeZ, const ccGridSize& gridSize, float duration);
static CCShakyTiles3D* create(float duration, const CCSize& gridSize, int nRange, bool bShakeZ);
protected:
int m_nRandrange;
@ -60,8 +59,7 @@ 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,
float duration);
virtual bool initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShatterZ);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
@ -69,8 +67,7 @@ public:
public:
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
static CCShatteredTiles3D* create(int nRange, bool bShatterZ, const ccGridSize& gridSize,
float duration);
static CCShatteredTiles3D* create(float duration, const CCSize& gridSize, int nRange, bool bShatterZ);
protected:
int m_nRandrange;
bool m_bOnce;
@ -86,10 +83,10 @@ 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, float duration);
void shuffle(int *pArray, unsigned int nLen);
ccGridSize getDelta(const ccGridSize& pos);
void placeTile(const ccGridSize& pos, Tile *t);
virtual bool initWithDuration(float duration, const CCSize& gridSize, unsigned int seed);
void shuffle(unsigned int *pArray, unsigned int nLen);
CCSize getDelta(const CCSize& pos);
void placeTile(const CCPoint& pos, Tile *t);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(float time);
@ -97,12 +94,12 @@ public:
public:
/** creates the action with a random seed, the grid size and the duration */
static CCShuffleTiles* create(int s, const ccGridSize& gridSize, float duration);
static CCShuffleTiles* create(float duration, const CCSize& gridSize, unsigned int seed);
protected:
int m_nSeed;
unsigned int m_nSeed;
unsigned int m_nTilesCount;
int *m_pTilesOrder;
Tile *m_pTiles;
unsigned int* m_pTilesOrder;
Tile* m_pTiles;
};
/** @brief CCFadeOutTRTiles action
@ -111,16 +108,16 @@ protected:
class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction
{
public:
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 float testFunc(const CCSize& pos, float time);
void turnOnTile(const CCPoint& pos);
void turnOffTile(const CCPoint& pos);
virtual void transformTile(const CCPoint& pos, float distance);
virtual void update(float time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutTRTiles* create(const ccGridSize& gridSize, float time);
static CCFadeOutTRTiles* create(float duration, const CCSize& gridSize);
};
/** @brief CCFadeOutBLTiles action.
@ -129,12 +126,12 @@ public:
class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
{
public:
virtual float testFunc(const ccGridSize& pos, float time);
virtual float testFunc(const CCSize& pos, float time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutBLTiles* create(const ccGridSize& gridSize, float time);
static CCFadeOutBLTiles* create(float duration, const CCSize& gridSize);
};
/** @brief CCFadeOutUpTiles action.
@ -143,12 +140,12 @@ public:
class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles
{
public:
virtual float testFunc(const ccGridSize& pos, float time);
virtual void transformTile(const ccGridSize& pos, float distance);
virtual float testFunc(const CCSize& pos, float time);
virtual void transformTile(const CCPoint& pos, float distance);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutUpTiles* create(const ccGridSize& gridSize, float time);
static CCFadeOutUpTiles* create(float duration, const CCSize& gridSize);
};
@ -158,12 +155,12 @@ public:
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
{
public:
virtual float testFunc(const ccGridSize& pos, float time);
virtual float testFunc(const CCSize& pos, float time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutDownTiles* create(const ccGridSize& gridSize, float time);
static CCFadeOutDownTiles* create(float duration, const CCSize& gridSize);
};
/** @brief CCTurnOffTiles action.
@ -174,10 +171,10 @@ 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, float duration);
void shuffle(int *pArray, unsigned int nLen);
void turnOnTile(const ccGridSize& pos);
void turnOffTile(const ccGridSize& pos);
virtual bool initWithDuration(float duration, const CCSize& gridSize, unsigned int seed);
void shuffle(unsigned int *pArray, unsigned int nLen);
void turnOnTile(const CCPoint& pos);
void turnOffTile(const CCPoint& pos);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -186,14 +183,14 @@ public:
public:
/** creates the action with the grid size and the duration */
static CCTurnOffTiles* create(const ccGridSize& size, float d);
static CCTurnOffTiles* create(float duration, const CCSize& gridSize);
/** creates the action with a random seed, the grid size and the duration */
static CCTurnOffTiles* create(int s, const ccGridSize& gridSize, float duration);
static CCTurnOffTiles* create(float duration, const CCSize& gridSize, unsigned int seed);
protected:
int m_nSeed;
unsigned int m_nSeed;
unsigned int m_nTilesCount;
int *m_pTilesOrder;
unsigned int* m_pTilesOrder;
};
/** @brief CCWavesTiles3D action. */
@ -209,16 +206,16 @@ 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, float duration);
virtual bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
virtual CCObject* copyWithZone(CCZone* pZone);
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* create(int wav, float amp, const ccGridSize& gridSize, float duration);
static CCWavesTiles3D* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
protected:
int m_nWaves;
unsigned int m_nWaves;
float m_fAmplitude;
float m_fAmplitudeRate;
};
@ -238,16 +235,16 @@ 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, float duration);
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int numberOfJumps, float amplitude);
virtual CCObject* copyWithZone(CCZone* pZone);
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* create(int j, float amp, const ccGridSize& gridSize, float duration);
static CCJumpTiles3D* create(float duration, const CCSize& gridSize, unsigned int numberOfJumps, float amplitude);
protected:
int m_nJumps;
unsigned int m_nJumps;
float m_fAmplitude;
float m_fAmplitudeRate;
};
@ -257,7 +254,7 @@ class CC_DLL CCSplitRows : public CCTiledGrid3DAction
{
public :
/** initializes the action with the number of rows to split and the duration */
bool initWithRows(int nRows, float duration);
virtual bool initWithDuration(float duration, unsigned int nRows);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
@ -266,9 +263,9 @@ public :
public:
/** creates the action with the number of rows to split and the duration */
static CCSplitRows* create(int nRows, float duration);
static CCSplitRows* create(float duration, unsigned int nRows);
protected:
int m_nRows;
unsigned int m_nRows;
CCSize m_winSize;
};
@ -277,7 +274,7 @@ class CC_DLL CCSplitCols : public CCTiledGrid3DAction
{
public:
/** initializes the action with the number of columns to split and the duration */
bool initWithCols(int nCols, float duration);
virtual bool initWithDuration(float duration, unsigned int nCols);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(float time);
@ -285,9 +282,9 @@ public:
public:
/** creates the action with the number of columns to split and the duration */
static CCSplitCols* create(int nCols, float duration);
static CCSplitCols* create(float duration, unsigned int nCols);
protected:
int m_nCols;
unsigned int m_nCols;
CCSize m_winSize;
};

View File

@ -39,7 +39,7 @@ THE SOFTWARE.
NS_CC_BEGIN
// implementation of CCGridBase
CCGridBase* CCGridBase::create(const ccGridSize& gridSize)
CCGridBase* CCGridBase::create(const CCSize& gridSize)
{
CCGridBase *pGridBase = new CCGridBase();
@ -58,7 +58,7 @@ CCGridBase* CCGridBase::create(const ccGridSize& gridSize)
return pGridBase;
}
CCGridBase* CCGridBase::create(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped)
CCGridBase* CCGridBase::create(const CCSize& gridSize, CCTexture2D *texture, bool flipped)
{
CCGridBase *pGridBase = new CCGridBase();
@ -77,7 +77,7 @@ CCGridBase* CCGridBase::create(const ccGridSize& gridSize, CCTexture2D *texture,
return pGridBase;
}
bool CCGridBase::initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
bool CCGridBase::initWithSize(const CCSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
bool bRet = true;
@ -90,8 +90,8 @@ bool CCGridBase::initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture,
m_bIsTextureFlipped = bFlipped;
CCSize texSize = m_pTexture->getContentSize();
m_obStep.x = texSize.width / m_sGridSize.x;
m_obStep.y = texSize.height / m_sGridSize.y;
m_obStep.x = texSize.width / m_sGridSize.width;
m_obStep.y = texSize.height / m_sGridSize.height;
m_pGrabber = new CCGrabber();
if (m_pGrabber)
@ -109,7 +109,7 @@ bool CCGridBase::initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture,
return bRet;
}
bool CCGridBase::initWithSize(const ccGridSize& gridSize)
bool CCGridBase::initWithSize(const CCSize& gridSize)
{
CCDirector *pDirector = CCDirector::sharedDirector();
CCSize s = pDirector->getWinSizeInPixels();
@ -254,7 +254,7 @@ void CCGridBase::calculateVertexPoints(void)
// implementation of CCGrid3D
CCGrid3D* CCGrid3D::create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
CCGrid3D* CCGrid3D::create(const CCSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
CCGrid3D *pRet= new CCGrid3D();
@ -274,7 +274,7 @@ CCGrid3D* CCGrid3D::create(const ccGridSize& gridSize, CCTexture2D *pTexture, bo
return pRet;
}
CCGrid3D* CCGrid3D::create(const ccGridSize& gridSize)
CCGrid3D* CCGrid3D::create(const CCSize& gridSize)
{
CCGrid3D *pRet= new CCGrid3D();
@ -314,7 +314,7 @@ CCGrid3D::~CCGrid3D(void)
void CCGrid3D::blit(void)
{
int n = m_sGridSize.x * m_sGridSize.y;
int n = m_sGridSize.width * m_sGridSize.height;
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords );
m_pShaderProgram->use();
@ -346,32 +346,32 @@ void CCGrid3D::calculateVertexPoints(void)
CC_SAFE_FREE(m_pTexCoordinates);
CC_SAFE_FREE(m_pIndices);
unsigned int numOfPoints = (m_sGridSize.x+1) * (m_sGridSize.y+1);
unsigned int numOfPoints = (m_sGridSize.width+1) * (m_sGridSize.height+1);
m_pVertices = malloc(numOfPoints * sizeof(ccVertex3F));
m_pOriginalVertices = malloc(numOfPoints * sizeof(ccVertex3F));
m_pTexCoordinates = malloc(numOfPoints * sizeof(ccVertex2F));
m_pIndices = (GLushort*)malloc(m_sGridSize.x * m_sGridSize.y * sizeof(GLushort) * 6);
m_pIndices = (GLushort*)malloc(m_sGridSize.width * m_sGridSize.height * sizeof(GLushort) * 6);
GLfloat *vertArray = (GLfloat*)m_pVertices;
GLfloat *texArray = (GLfloat*)m_pTexCoordinates;
GLushort *idxArray = m_pIndices;
for (x = 0; x < m_sGridSize.x; ++x)
for (x = 0; x < m_sGridSize.width; ++x)
{
for (y = 0; y < m_sGridSize.y; ++y)
for (y = 0; y < m_sGridSize.height; ++y)
{
int idx = (y * m_sGridSize.x) + x;
int idx = (y * m_sGridSize.width) + x;
GLfloat x1 = x * m_obStep.x;
GLfloat x2 = x1 + m_obStep.x;
GLfloat y1 = y * m_obStep.y;
GLfloat y2= y1 + m_obStep.y;
GLushort a = (GLushort)(x * (m_sGridSize.y + 1) + y);
GLushort b = (GLushort)((x + 1) * (m_sGridSize.y + 1) + y);
GLushort c = (GLushort)((x + 1) * (m_sGridSize.y + 1) + (y + 1));
GLushort d = (GLushort)(x * (m_sGridSize.y + 1) + (y + 1));
GLushort a = (GLushort)(x * (m_sGridSize.height + 1) + y);
GLushort b = (GLushort)((x + 1) * (m_sGridSize.height + 1) + y);
GLushort c = (GLushort)((x + 1) * (m_sGridSize.height + 1) + (y + 1));
GLushort d = (GLushort)(x * (m_sGridSize.height + 1) + (y + 1));
GLushort tempidx[6] = {a, b, d, b, c, d};
@ -407,12 +407,12 @@ void CCGrid3D::calculateVertexPoints(void)
}
}
memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.x+1) * (m_sGridSize.y+1) * sizeof(ccVertex3F));
memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.width+1) * (m_sGridSize.height+1) * sizeof(ccVertex3F));
}
ccVertex3F CCGrid3D::vertex(const ccGridSize& pos)
ccVertex3F CCGrid3D::vertex(const CCPoint& pos)
{
int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3;
int index = (pos.x * (m_sGridSize.height+1) + pos.y) * 3;
float *vertArray = (float*)m_pVertices;
ccVertex3F vert = {vertArray[index], vertArray[index+1], vertArray[index+2]};
@ -420,9 +420,9 @@ ccVertex3F CCGrid3D::vertex(const ccGridSize& pos)
return vert;
}
ccVertex3F CCGrid3D::originalVertex(const ccGridSize& pos)
ccVertex3F CCGrid3D::originalVertex(const CCPoint& pos)
{
int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3;
int index = (pos.x * (m_sGridSize.height+1) + pos.y) * 3;
float *vertArray = (float*)m_pOriginalVertices;
ccVertex3F vert = {vertArray[index], vertArray[index+1], vertArray[index+2]};
@ -430,9 +430,9 @@ ccVertex3F CCGrid3D::originalVertex(const ccGridSize& pos)
return vert;
}
void CCGrid3D::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
void CCGrid3D::setVertex(const CCPoint& pos, const ccVertex3F& vertex)
{
int index = (pos.x * (m_sGridSize.y + 1) + pos.y) * 3;
int index = (pos.x * (m_sGridSize.height + 1) + pos.y) * 3;
float *vertArray = (float*)m_pVertices;
vertArray[index] = vertex.x;
vertArray[index+1] = vertex.y;
@ -443,7 +443,7 @@ void CCGrid3D::reuse(void)
{
if (m_nReuseGrid > 0)
{
memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.x+1) * (m_sGridSize.y+1) * sizeof(ccVertex3F));
memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.width+1) * (m_sGridSize.height+1) * sizeof(ccVertex3F));
--m_nReuseGrid;
}
}
@ -467,7 +467,7 @@ CCTiledGrid3D::~CCTiledGrid3D(void)
CC_SAFE_FREE(m_pIndices);
}
CCTiledGrid3D* CCTiledGrid3D::create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
CCTiledGrid3D* CCTiledGrid3D::create(const CCSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -487,7 +487,7 @@ CCTiledGrid3D* CCTiledGrid3D::create(const ccGridSize& gridSize, CCTexture2D *pT
return pRet;
}
CCTiledGrid3D* CCTiledGrid3D::create(const ccGridSize& gridSize)
CCTiledGrid3D* CCTiledGrid3D::create(const CCSize& gridSize)
{
CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -509,7 +509,7 @@ CCTiledGrid3D* CCTiledGrid3D::create(const ccGridSize& gridSize)
void CCTiledGrid3D::blit(void)
{
int n = m_sGridSize.x * m_sGridSize.y;
int n = m_sGridSize.width * m_sGridSize.height;
m_pShaderProgram->use();
@ -536,7 +536,7 @@ void CCTiledGrid3D::calculateVertexPoints(void)
float height = (float)m_pTexture->getPixelsHigh();
float imageH = m_pTexture->getContentSizeInPixels().height;
int numQuads = m_sGridSize.x * m_sGridSize.y;
int numQuads = m_sGridSize.width * m_sGridSize.height;
CC_SAFE_FREE(m_pVertices);
CC_SAFE_FREE(m_pOriginalVertices);
CC_SAFE_FREE(m_pTexCoordinates);
@ -553,9 +553,9 @@ void CCTiledGrid3D::calculateVertexPoints(void)
int x, y;
for( x = 0; x < m_sGridSize.x; x++ )
for( x = 0; x < m_sGridSize.width; x++ )
{
for( y = 0; y < m_sGridSize.y; y++ )
for( y = 0; y < m_sGridSize.height; y++ )
{
float x1 = x * m_obStep.x;
float x2 = x1 + m_obStep.x;
@ -609,16 +609,16 @@ void CCTiledGrid3D::calculateVertexPoints(void)
memcpy(m_pOriginalVertices, m_pVertices, numQuads * 12 * sizeof(GLfloat));
}
void CCTiledGrid3D::setTile(const ccGridSize& pos, const ccQuad3& coords)
void CCTiledGrid3D::setTile(const CCPoint& pos, const ccQuad3& coords)
{
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
int idx = (m_sGridSize.height * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pVertices;
memcpy(&vertArray[idx], &coords, sizeof(ccQuad3));
}
ccQuad3 CCTiledGrid3D::originalTile(const ccGridSize& pos)
ccQuad3 CCTiledGrid3D::originalTile(const CCPoint& pos)
{
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
int idx = (m_sGridSize.height * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pOriginalVertices;
ccQuad3 ret;
@ -627,9 +627,9 @@ ccQuad3 CCTiledGrid3D::originalTile(const ccGridSize& pos)
return ret;
}
ccQuad3 CCTiledGrid3D::tile(const ccGridSize& pos)
ccQuad3 CCTiledGrid3D::tile(const CCPoint& pos)
{
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
int idx = (m_sGridSize.height * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pVertices;
ccQuad3 ret;
@ -642,7 +642,7 @@ void CCTiledGrid3D::reuse(void)
{
if (m_nReuseGrid > 0)
{
int numQuads = m_sGridSize.x * m_sGridSize.y;
int numQuads = m_sGridSize.width * m_sGridSize.height;
memcpy(m_pOriginalVertices, m_pVertices, numQuads * 12 * sizeof(GLfloat));
--m_nReuseGrid;

View File

@ -60,8 +60,8 @@ public:
inline void setReuseGrid(int nReuseGrid) { m_nReuseGrid = nReuseGrid; }
/** size of the grid */
inline const ccGridSize& getGridSize(void) { return m_sGridSize; }
inline void setGridSize(const ccGridSize& gridSize) { m_sGridSize = gridSize; }
inline const CCSize& getGridSize(void) { return m_sGridSize; }
inline void setGridSize(const CCSize& gridSize) { m_sGridSize = gridSize; }
/** pixels between the grids */
inline const CCPoint& getStep(void) { return m_obStep; }
@ -71,8 +71,8 @@ public:
inline bool isTextureFlipped(void) { return m_bIsTextureFlipped; }
void setTextureFlipped(bool bFlipped);
bool initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
bool initWithSize(const ccGridSize& gridSize);
bool initWithSize(const CCSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
bool initWithSize(const CCSize& gridSize);
void beforeDraw(void);
void afterDraw(CCNode *pTarget);
@ -83,16 +83,16 @@ public:
public:
/** create one Grid */
static CCGridBase* create(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped);
static CCGridBase* create(const CCSize& gridSize, CCTexture2D *texture, bool flipped);
/** create one Grid */
static CCGridBase* create(const ccGridSize& gridSize);
static CCGridBase* create(const CCSize& gridSize);
void set2DProjection(void);
protected:
bool m_bActive;
int m_nReuseGrid;
ccGridSize m_sGridSize;
CCSize m_sGridSize;
CCTexture2D *m_pTexture;
CCPoint m_obStep;
CCGrabber *m_pGrabber;
@ -111,11 +111,11 @@ public:
~CCGrid3D(void);
/** returns the vertex at a given position */
ccVertex3F vertex(const ccGridSize& pos);
ccVertex3F vertex(const CCPoint& pos);
/** returns the original (non-transformed) vertex at a given position */
ccVertex3F originalVertex(const ccGridSize& pos);
ccVertex3F originalVertex(const CCPoint& pos);
/** sets a new vertex at a given position */
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
void setVertex(const CCPoint& pos, const ccVertex3F& vertex);
virtual void blit(void);
virtual void reuse(void);
@ -123,9 +123,9 @@ public:
public:
/** create one Grid */
static CCGrid3D* create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCGrid3D* create(const CCSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
/** create one Grid */
static CCGrid3D* create(const ccGridSize& gridSize);
static CCGrid3D* create(const CCSize& gridSize);
protected:
GLvoid *m_pTexCoordinates;
@ -145,11 +145,11 @@ public:
~CCTiledGrid3D(void);
/** returns the tile at the given position */
ccQuad3 tile(const ccGridSize& pos);
ccQuad3 tile(const CCPoint& pos);
/** returns the original tile (untransformed) at the given position */
ccQuad3 originalTile(const ccGridSize& pos);
ccQuad3 originalTile(const CCPoint& pos);
/** sets a new tile */
void setTile(const ccGridSize& pos, const ccQuad3& coords);
void setTile(const CCPoint& pos, const ccQuad3& coords);
virtual void blit(void);
virtual void reuse(void);
@ -158,9 +158,9 @@ public:
public:
/** create one Grid */
static CCTiledGrid3D* create(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCTiledGrid3D* create(const CCSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
/** create one Grid */
static CCTiledGrid3D* create(const ccGridSize& gridSize);
static CCTiledGrid3D* create(const CCSize& gridSize);
protected:
GLvoid *m_pTexCoordinates;

View File

@ -211,21 +211,6 @@ typedef struct _ccQuad3 {
ccVertex3F tr;
} ccQuad3;
//! A 2D grid size
typedef struct _ccGridSize
{
int x;
int y;
} ccGridSize;
//! helper function to create a ccGridSize
static inline ccGridSize
ccg(const int x, const int y)
{
ccGridSize v = {x, y};
return v;
}
//! a Point with a vertex point, a tex coord point and a color 4B
typedef struct _ccV2F_C4B_T2F
{

View File

@ -34,7 +34,6 @@ THE SOFTWARE.
//
// all cocos2d include files
//
#include "ccConfig.h"
// actions

View File

@ -1374,7 +1374,7 @@ void CCTransitionTurnOffTiles::onEnter()
int x = (int)(12 * aspect);
int y = 12;
CCTurnOffTiles* toff = CCTurnOffTiles::create( ccg(x,y), m_fDuration);
CCTurnOffTiles* toff = CCTurnOffTiles::create( m_fDuration, CCSizeMake(x,y));
CCActionInterval* action = easeActionWithAction(toff);
m_pOutScene->runAction
(
@ -1518,7 +1518,7 @@ void CCTransitionFadeTR::onEnter()
int x = (int)(12 * aspect);
int y = 12;
CCActionInterval* action = actionWithSize(ccg(x,y));
CCActionInterval* action = actionWithSize(CCSizeMake(x,y));
m_pOutScene->runAction
(
@ -1533,9 +1533,9 @@ void CCTransitionFadeTR::onEnter()
}
CCActionInterval* CCTransitionFadeTR::actionWithSize(const ccGridSize& size)
CCActionInterval* CCTransitionFadeTR::actionWithSize(const CCSize& size)
{
return CCFadeOutTRTiles::create(size, m_fDuration);
return CCFadeOutTRTiles::create(m_fDuration, size);
}
CCActionInterval* CCTransitionFadeTR:: easeActionWithAction(CCActionInterval* action)
@ -1567,9 +1567,9 @@ CCTransitionFadeBL* CCTransitionFadeBL::create(float t, CCScene* scene)
return NULL;
}
CCActionInterval* CCTransitionFadeBL::actionWithSize(const ccGridSize& size)
CCActionInterval* CCTransitionFadeBL::actionWithSize(const CCSize& size)
{
return CCFadeOutBLTiles::create(size, m_fDuration);
return CCFadeOutBLTiles::create(m_fDuration, size);
}
//
@ -1595,9 +1595,9 @@ CCTransitionFadeUp* CCTransitionFadeUp::create(float t, CCScene* scene)
return NULL;
}
CCActionInterval* CCTransitionFadeUp::actionWithSize(const ccGridSize& size)
CCActionInterval* CCTransitionFadeUp::actionWithSize(const CCSize& size)
{
return CCFadeOutUpTiles::create(size, m_fDuration);
return CCFadeOutUpTiles::create(m_fDuration, size);
}
//
@ -1622,9 +1622,9 @@ CCTransitionFadeDown* CCTransitionFadeDown::create(float t, CCScene* scene)
return NULL;
}
CCActionInterval* CCTransitionFadeDown::actionWithSize(const ccGridSize& size)
CCActionInterval* CCTransitionFadeDown::actionWithSize(const CCSize& size)
{
return CCFadeOutDownTiles::create(size, m_fDuration);
return CCFadeOutDownTiles::create(m_fDuration, size);
}
NS_CC_END

View File

@ -516,7 +516,7 @@ class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTransition
public:
CCTransitionFadeTR();
virtual ~CCTransitionFadeTR();
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual CCActionInterval* actionWithSize(const CCSize& size);
virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
@ -535,7 +535,7 @@ class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR
public:
CCTransitionFadeBL();
virtual ~CCTransitionFadeBL();
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual CCActionInterval* actionWithSize(const CCSize& size);
public:
@ -550,7 +550,7 @@ class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR
public:
CCTransitionFadeUp();
virtual ~CCTransitionFadeUp();
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual CCActionInterval* actionWithSize(const CCSize& size);
public:
@ -565,7 +565,7 @@ class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR
public:
CCTransitionFadeDown();
virtual ~CCTransitionFadeDown();
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual CCActionInterval* actionWithSize(const CCSize& size);
public:

View File

@ -83,7 +83,7 @@ void CCTransitionPageTurn::onEnter()
y=16;
}
CCActionInterval *action = this->actionWithSize(ccg(x,y));
CCActionInterval *action = this->actionWithSize(CCSizeMake(x,y));
if(! m_bBack )
{
@ -117,20 +117,20 @@ void CCTransitionPageTurn::onEnter()
}
CCActionInterval* CCTransitionPageTurn:: actionWithSize(const ccGridSize& vector)
CCActionInterval* CCTransitionPageTurn:: actionWithSize(const CCSize& vector)
{
if( m_bBack )
{
// Get hold of the PageTurn3DAction
return CCReverseTime::create
(
CCPageTurn3D::create(vector, m_fDuration)
CCPageTurn3D::create(m_fDuration, vector)
);
}
else
{
// Get hold of the PageTurn3DAction
return CCPageTurn3D::create(vector, m_fDuration);
return CCPageTurn3D::create(m_fDuration, vector);
}
}

View File

@ -69,7 +69,7 @@ public:
*/
virtual bool initWithDuration(float t,CCScene* scene,bool backwards);
CCActionInterval* actionWithSize(const ccGridSize& vector);
CCActionInterval* actionWithSize(const CCSize& vector);
virtual void onEnter();

View File

@ -31,6 +31,7 @@ THE SOFTWARE.
#include "cocoa/CCDictionary.h"
#include "cocoa/CCInteger.h"
#include "CCDirector.h"
#include "support/CCPointExtension.h"
NS_CC_BEGIN
@ -132,7 +133,7 @@ void CCTileMapAtlas::loadTGAfile(const char *file)
}
// CCTileMapAtlas - Atlas generation / updates
void CCTileMapAtlas::setTile(const ccColor3B& tile, const ccGridSize& position)
void CCTileMapAtlas::setTile(const ccColor3B& tile, const CCPoint& position)
{
CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil");
CCAssert( m_pPosToAtlasIndex != NULL, "posToAtlasIndex must not be nil");
@ -141,14 +142,14 @@ void CCTileMapAtlas::setTile(const ccColor3B& tile, const ccGridSize& position)
CCAssert( tile.r != 0, "R component must be non 0");
ccColor3B *ptr = (ccColor3B*)m_pTGAInfo->imageData;
ccColor3B value = ptr[position.x + position.y * m_pTGAInfo->width];
ccColor3B value = ptr[(unsigned int)(position.x + position.y * m_pTGAInfo->width)];
if( value.r == 0 )
{
CCLOG("cocos2d: Value.r must be non 0.");
}
else
{
ptr[position.x + position.y * m_pTGAInfo->width] = tile;
ptr[(unsigned int)(position.x + position.y * m_pTGAInfo->width)] = tile;
// XXX: this method consumes a lot of memory
// XXX: a tree of something like that shall be implemented
@ -159,19 +160,19 @@ void CCTileMapAtlas::setTile(const ccColor3B& tile, const ccGridSize& position)
}
}
ccColor3B CCTileMapAtlas::tileAt(const ccGridSize& position)
ccColor3B CCTileMapAtlas::tileAt(const CCPoint& position)
{
CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil");
CCAssert( position.x < m_pTGAInfo->width, "Invalid position.x");
CCAssert( position.y < m_pTGAInfo->height, "Invalid position.y");
ccColor3B *ptr = (ccColor3B*)m_pTGAInfo->imageData;
ccColor3B value = ptr[position.x + position.y * m_pTGAInfo->width];
ccColor3B value = ptr[(unsigned int)(position.x + position.y * m_pTGAInfo->width)];
return value;
}
void CCTileMapAtlas::updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index)
void CCTileMapAtlas::updateAtlasValueAt(const CCPoint& pos, const ccColor3B& value, unsigned int index)
{
ccV3F_C4B_T2F_Quad quad;
@ -246,7 +247,7 @@ void CCTileMapAtlas::updateAtlasValues()
if( value.r != 0 )
{
this->updateAtlasValueAt(ccg(x,y), value, total);
this->updateAtlasValueAt(ccp(x,y), value, total);
CCString *key = CCString::createWithFormat("%d,%d", x,y);
CCInteger *num = CCInteger::create(total);

View File

@ -74,17 +74,17 @@ public:
/** returns a tile from position x,y.
For the moment only channel R is used
*/
ccColor3B tileAt(const ccGridSize& position);
ccColor3B tileAt(const CCPoint& position);
/** sets a tile at position x,y.
For the moment only channel R is used
*/
void setTile(const ccColor3B& tile, const ccGridSize& position);
void setTile(const ccColor3B& tile, const CCPoint& position);
/** dealloc the map from memory */
void releaseMap();
private:
void loadTGAfile(const char *file);
void calculateItemsToRender();
void updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index);
void updateAtlasValueAt(const CCPoint& pos, const ccColor3B& value, unsigned int index);
void updateAtlasValues();
protected:

View File

@ -28,8 +28,8 @@ void Effect1::onEnter()
// Waves3D is Grid3D and it's size is (15,10)
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* lens = CCLens3D::create(ccp(size.width/2,size.height/2), 240, ccg(15,10), 0.0f);
CCActionInterval* waves = CCWaves3D::create(18, 15, ccg(15,10), 10);
CCActionInterval* lens = CCLens3D::create(0.0f, CCSizeMake(15,10), ccp(size.width/2,size.height/2), 240);
CCActionInterval* waves = CCWaves3D::create(10, CCSizeMake(15,10), 18, 15);
CCFiniteTimeAction* reuse = CCReuseGrid::create(1);
CCActionInterval* delay = CCDelayTime::create(8);
@ -62,9 +62,9 @@ void Effect2::onEnter()
// ShakyTiles is TiledGrid3D and it's size is (15,10)
// Shuffletiles is TiledGrid3D and it's size is (15,10)
// TurnOfftiles is TiledGrid3D and it's size is (15,10)
CCActionInterval* shaky = CCShakyTiles3D::create(4, false, ccg(15,10), 5);
CCActionInterval* shuffle = CCShuffleTiles::create(0, ccg(15,10), 3);
CCActionInterval* turnoff = CCTurnOffTiles::create(0, ccg(15,10), 3);
CCActionInterval* shaky = CCShakyTiles3D::create(5, CCSizeMake(15,10), 4, false);
CCActionInterval* shuffle = CCShuffleTiles::create(0, CCSizeMake(15,10), 3);
CCActionInterval* turnoff = CCTurnOffTiles::create(0, CCSizeMake(15,10), 3);
CCActionInterval* turnon = turnoff->reverse();
// reuse 2 times:
@ -101,8 +101,8 @@ void Effect3::onEnter()
CCNode* target1 = bg->getChildByTag(kTagSprite1);
CCNode* target2 = bg->getChildByTag(kTagSprite2);
CCActionInterval* waves = CCWaves::create(5, 20, true, false, ccg(15,10), 5);
CCActionInterval* shaky = CCShaky3D::create(4, false, ccg(15,10), 5);
CCActionInterval* waves = CCWaves::create(5, CCSizeMake(15,10), 5, 20, true, false);
CCActionInterval* shaky = CCShaky3D::create(5, CCSizeMake(15,10), 4, false);
target1->runAction( CCRepeatForever::create( waves ) );
target2->runAction( CCRepeatForever::create( shaky ) );
@ -152,7 +152,7 @@ void Effect4::onEnter()
{
EffectAdvanceTextLayer::onEnter();
CCLens3D* lens = CCLens3D::create(ccp(100,180), 150, ccg(32,24), 10);
CCLens3D* lens = CCLens3D::create(10, CCSizeMake(32,24), ccp(100,180), 150);
CCActionInterval* move = CCJumpBy::create(5, ccp(380,0), 100, 4);
CCActionInterval* move_back = move->reverse();
CCActionInterval* seq = CCSequence::create( move, move_back, NULL);
@ -187,7 +187,7 @@ void Effect5::onEnter()
//CCDirector::sharedDirector()->setProjection(CCDirectorProjection2D);
CCActionInterval* effect = CCLiquid::create(1, 20, ccg(32,24), 2);
CCActionInterval* effect = CCLiquid::create(2, CCSizeMake(32,24), 1, 20);
CCActionInterval* stopEffect = CCSequence::create(
effect,
@ -222,7 +222,7 @@ void Issue631::onEnter()
{
EffectAdvanceTextLayer::onEnter();
CCActionInterval* effect = CCSequence::create( CCDelayTime::create(2.0f), CCShaky3D::create(16, false, ccg(5, 5), 5.0f), NULL);
CCActionInterval* effect = CCSequence::create( CCDelayTime::create(2.0f), CCShaky3D::create(5.0f, CCSizeMake(5, 5), 16, false), NULL);
// cleanup
CCNode* bg = getChildByTag(kTagBackground);

View File

@ -41,7 +41,7 @@ class Shaky3DDemo : public CCShaky3D
public:
static CCActionInterval* create(float t)
{
return CCShaky3D::create(5, false, ccg(15,10), t);
return CCShaky3D::create(t, CCSizeMake(15,10), 5, false);
}
};
@ -50,7 +50,7 @@ class Waves3DDemo : public CCWaves3D
public:
static CCActionInterval* create(float t)
{
return CCWaves3D::create(5, 40, ccg(15,10), t);
return CCWaves3D::create(t, CCSizeMake(15,10), 5, 40);
}
};
@ -86,7 +86,7 @@ public:
static CCActionInterval* create(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCLens3D::create(ccp(size.width/2,size.height/2), 240, ccg(15,10), t);
return CCLens3D::create(t, CCSizeMake(15,10), ccp(size.width/2,size.height/2), 240);
}
};
@ -97,7 +97,7 @@ public:
static CCActionInterval* create(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCRipple3D::create(ccp(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t);
return CCRipple3D::create(t, CCSizeMake(32,24), ccp(size.width/2,size.height/2), 240, 4, 160);
}
};
@ -107,7 +107,7 @@ class LiquidDemo : public CCLiquid
public:
static CCActionInterval* create(float t)
{
return CCLiquid::create(4, 20, ccg(16,12), t);
return CCLiquid::create(t, CCSizeMake(16,12), 4, 20);
}
};
@ -117,7 +117,7 @@ class WavesDemo : public CCWaves
public:
static CCActionInterval* create(float t)
{
return CCWaves::create(4, 20, true, true, ccg(16,12), t);
return CCWaves::create(t, CCSizeMake(16,12), 4, 20, true, true);
}
};
@ -128,7 +128,7 @@ public:
static CCActionInterval* create(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCTwirl::create(ccp(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t);
return CCTwirl::create(t, CCSizeMake(12,8), ccp(size.width/2, size.height/2), 1, 2.5f);
}
};
@ -138,7 +138,7 @@ class ShakyTiles3DDemo : public CCShakyTiles3D
public:
static CCActionInterval* create(float t)
{
return CCShakyTiles3D::create(5, false, ccg(16,12), t) ;
return CCShakyTiles3D::create(t, CCSizeMake(16,12), 5, false) ;
}
};
@ -148,7 +148,7 @@ class ShatteredTiles3DDemo : public CCShatteredTiles3D
public:
static CCActionInterval* create(float t)
{
return CCShatteredTiles3D::create(5, false, ccg(16,12), t);
return CCShatteredTiles3D::create(t, CCSizeMake(16,12), 5, false);
}
};
@ -158,7 +158,7 @@ class ShuffleTilesDemo : public CCShuffleTiles
public:
static CCActionInterval* create(float t)
{
CCShuffleTiles* shuffle = CCShuffleTiles::create(25, ccg(16,12), t);
CCShuffleTiles* shuffle = CCShuffleTiles::create(t, CCSizeMake(16,12), 25);
CCActionInterval* shuffle_back = shuffle->reverse();
CCDelayTime* delay = CCDelayTime::create(2);
@ -172,7 +172,7 @@ class FadeOutTRTilesDemo : public CCFadeOutTRTiles
public:
static CCActionInterval* create(float t)
{
CCFadeOutTRTiles* fadeout = CCFadeOutTRTiles::create(ccg(16,12), t);
CCFadeOutTRTiles* fadeout = CCFadeOutTRTiles::create(t, CCSizeMake(16,12));
CCActionInterval* back = fadeout->reverse();
CCDelayTime* delay = CCDelayTime::create(0.5f);
@ -186,7 +186,7 @@ class FadeOutBLTilesDemo : public CCFadeOutBLTiles
public:
static CCActionInterval* create(float t)
{
CCFadeOutBLTiles* fadeout = CCFadeOutBLTiles::create(ccg(16,12), t);
CCFadeOutBLTiles* fadeout = CCFadeOutBLTiles::create(t, CCSizeMake(16,12));
CCActionInterval* back = fadeout->reverse();
CCDelayTime* delay = CCDelayTime::create(0.5f);
@ -200,7 +200,7 @@ class FadeOutUpTilesDemo : public CCFadeOutUpTiles
public:
static CCActionInterval* create(float t)
{
CCFadeOutUpTiles* fadeout = CCFadeOutUpTiles::create(ccg(16,12), t);
CCFadeOutUpTiles* fadeout = CCFadeOutUpTiles::create(t, CCSizeMake(16,12));
CCActionInterval* back = fadeout->reverse();
CCDelayTime* delay = CCDelayTime::create(0.5f);
@ -213,7 +213,7 @@ class FadeOutDownTilesDemo : public CCFadeOutDownTiles
public:
static CCActionInterval* create(float t)
{
CCFadeOutDownTiles* fadeout = CCFadeOutDownTiles::create(ccg(16,12), t);
CCFadeOutDownTiles* fadeout = CCFadeOutDownTiles::create(t, CCSizeMake(16,12));
CCActionInterval* back = fadeout->reverse();
CCDelayTime* delay = CCDelayTime::create(0.5f);
@ -226,7 +226,7 @@ class TurnOffTilesDemo : public CCTurnOffTiles
public:
static CCActionInterval* create(float t)
{
CCTurnOffTiles* fadeout = CCTurnOffTiles::create(25, ccg(48,32) , t);
CCTurnOffTiles* fadeout = CCTurnOffTiles::create(t, CCSizeMake(48,32), 25);
CCActionInterval* back = fadeout->reverse();
CCDelayTime* delay = CCDelayTime::create(0.5f);
@ -239,7 +239,7 @@ class WavesTiles3DDemo : public CCWavesTiles3D
public:
static CCActionInterval* create(float t)
{
return CCWavesTiles3D::create(4, 120, ccg(15,10), t);
return CCWavesTiles3D::create(t, CCSizeMake(15,10), 4, 120);
}
};
@ -249,7 +249,7 @@ public:
static CCActionInterval* create(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCJumpTiles3D::create(2, 30, ccg(15,10), t);
return CCJumpTiles3D::create(t, CCSizeMake(15,10), 2, 30);
}
};
@ -258,7 +258,7 @@ class SplitRowsDemo : public CCSplitRows
public:
static CCActionInterval* create(float t)
{
return CCSplitRows::create(9, t);
return CCSplitRows::create(t, 9);
}
};
@ -267,7 +267,7 @@ class SplitColsDemo : public CCSplitCols
public:
static CCActionInterval* create(float t)
{
return CCSplitCols::create(9, t);
return CCSplitCols::create(t, 9);
}
};
@ -277,7 +277,7 @@ public:
static CCActionInterval* create(float t)
{
CCDirector::sharedDirector()->setDepthTest(true);
return CCPageTurn3D::create(ccg(15,10), t);
return CCPageTurn3D::create(t, CCSizeMake(15,10));
}
};

View File

@ -84,7 +84,7 @@ void TileMapEditTest::updateMap(float dt)
// over all your tiles in every frame. It's very expensive
// for(int x=0; x < tilemap.tgaInfo->width; x++) {
// for(int y=0; y < tilemap.tgaInfo->height; y++) {
// ccColor3B c =[tilemap tileAt:ccg(x,y));
// ccColor3B c =[tilemap tileAt:CCSizeMake(x,y));
// if( c.r != 0 ) {
// ////----UXLOG("%d,%d = %d", x,y,c.r);
// }
@ -92,14 +92,14 @@ void TileMapEditTest::updateMap(float dt)
// }
// NEW since v0.7
ccColor3B c = tilemap->tileAt(ccg(13,21));
ccColor3B c = tilemap->tileAt(ccp(13,21));
c.r++;
c.r %= 50;
if( c.r==0)
c.r=1;
// NEW since v0.7
tilemap->setTile(c, ccg(13,21) );
tilemap->setTile(c, ccp(13,21) );
}
std::string TileMapEditTest::title()

@ -1 +1 @@
Subproject commit f840e3b6ae33bc000d22f9e87d85b23236426dbc
Subproject commit e8e25fd1b8bea9cf8b65fd04f625abcbff4c022e

View File

@ -85,14 +85,14 @@ end
-- Shaky3DDemo
--------------------------------------
local function Shaky3DDemo(t)
return CCShaky3D:create(5, false, ccg(15,10), t)
return CCShaky3D:create(t, CCSizeMake(15,10), 5, false);
end
--------------------------------------
-- Waves3DDemo
--------------------------------------
local function Waves3DDemo(t)
return CCWaves3D:create(5, 40, ccg(15,10), t)
return CCWaves3D:create(t, CCSizeMake(15,10), 5, 40);
end
--------------------------------------
@ -129,56 +129,56 @@ end
-- Lens3DDemo
--------------------------------------
local function Lens3DDemo(t)
return CCLens3D:create(CCPointMake(size.width / 2,size.height / 2), 240, ccg(15,10), t)
return CCLens3D:create(t, CCSizeMake(15,10), ccp(size.width/2,size.height/2), 240);
end
--------------------------------------
-- Ripple3DDemo
--------------------------------------
local function Ripple3DDemo(t)
return CCRipple3D:create(CCPointMake(size.width / 2,size.height / 2), 240, 4, 160, ccg(32,24), t)
return CCRipple3D:create(t, CCSizeMake(32,24), ccp(size.width/2,size.height/2), 240, 4, 160);
end
--------------------------------------
-- LiquidDemo
--------------------------------------
local function LiquidDemo(t)
return CCLiquid:create(4, 20, ccg(16,12), t)
return CCLiquid:create(t, CCSizeMake(16,12), 4, 20);
end
--------------------------------------
-- WavesDemo
--------------------------------------
local function WavesDemo(t)
return CCWaves:create(4, 20, true, true, ccg(16, 12), t)
return CCWaves:create(t, CCSizeMake(16,12), 4, 20, true, true);
end
--------------------------------------
-- TwirlDemo
--------------------------------------
local function TwirlDemo(t)
return CCTwirl:create(CCPointMake(size.width / 2, size.height / 2), 1, 2.5, ccg(12, 8), t)
return CCTwirl:create(t, CCSizeMake(12,8), ccp(size.width/2, size.height/2), 1, 2.5);
end
--------------------------------------
-- ShakyTiles3DDemo
--------------------------------------
local function ShakyTiles3DDemo(t)
return CCShakyTiles3D:create(5, false, ccg(16,12), t)
return CCShakyTiles3D:create(t, CCSizeMake(16,12), 5, false) ;
end
--------------------------------------
-- ShatteredTiles3DDemo
--------------------------------------
local function ShatteredTiles3DDemo(t)
return CCShatteredTiles3D:create(5, false, ccg(16,12), t)
return CCShatteredTiles3D:create(t, CCSizeMake(16,12), 5, false);
end
--------------------------------------
-- ShuffleTilesDemo
--------------------------------------
local function ShuffleTilesDemo(t)
local shuffle = CCShuffleTiles:create(25, ccg(16,12), t)
local shuffle = CCShuffleTiles:create(t, CCSizeMake(16,12), 25);
local shuffle_back = shuffle:reverse()
local delay = CCDelayTime:create(2)
@ -193,7 +193,7 @@ end
-- FadeOutTRTilesDemo
--------------------------------------
local function FadeOutTRTilesDemo(t)
local fadeout = CCFadeOutTRTiles:create(ccg(16,12), t)
local fadeout = CCFadeOutTRTiles:create(t, CCSizeMake(16,12));
local back = fadeout:reverse()
local delay = CCDelayTime:create(0.5)
@ -208,7 +208,7 @@ end
-- FadeOutBLTilesDemo
--------------------------------------
local function FadeOutBLTilesDemo(t)
local fadeout = CCFadeOutBLTiles:create(ccg(16,12), t)
local fadeout = CCFadeOutBLTiles:create(t, CCSizeMake(16,12));
local back = fadeout:reverse()
local delay = CCDelayTime:create(0.5)
@ -223,7 +223,7 @@ end
-- FadeOutUpTilesDemo
--------------------------------------
local function FadeOutUpTilesDemo(t)
local fadeout = CCFadeOutUpTiles:create(ccg(16,12), t)
local fadeout = CCFadeOutUpTiles:create(t, CCSizeMake(16,12));
local back = fadeout:reverse()
local delay = CCDelayTime:create(0.5)
@ -238,7 +238,7 @@ end
-- FadeOutDownTilesDemo
--------------------------------------
local function FadeOutDownTilesDemo(t)
local fadeout = CCFadeOutDownTiles:create(ccg(16,12), t)
local fadeout = CCFadeOutDownTiles:create(t, CCSizeMake(16,12));
local back = fadeout:reverse()
local delay = CCDelayTime:create(0.5)
@ -253,7 +253,7 @@ end
-- TurnOffTilesDemo
--------------------------------------
local function TurnOffTilesDemo(t)
local fadeout = CCTurnOffTiles:create(25, ccg(48, 32), t)
local fadeout = CCTurnOffTiles:create(t, CCSizeMake(48,32), 25);
local back = fadeout:reverse()
local delay = CCDelayTime:create(0.5)
@ -268,28 +268,28 @@ end
-- WavesTiles3DDemo
--------------------------------------
local function WavesTiles3DDemo(t)
return CCWavesTiles3D:create(4, 120, ccg(15,10), t)
return CCWavesTiles3D:create(t, CCSizeMake(15,10), 4, 120);
end
--------------------------------------
-- JumpTiles3DDemo
--------------------------------------
local function JumpTiles3DDemo(t)
return CCJumpTiles3D:create(2, 30, ccg(15,10), t)
return CCJumpTiles3D:create(t, CCSizeMake(15,10), 2, 30);
end
--------------------------------------
-- SplitRowsDemo
--------------------------------------
local function SplitRowsDemo(t)
return CCSplitRows:create(9, t)
return CCSplitRows:create(t, 9);
end
--------------------------------------
-- SplitColsDemo
--------------------------------------
local function SplitColsDemo(t)
return CCSplitCols:create(9, t)
return CCSplitCols:create(t, 9);
end
--------------------------------------
@ -297,7 +297,7 @@ end
--------------------------------------
local function PageTurn3DDemo(t)
CCDirector:sharedDirector():setDepthTest(true)
return CCPageTurn3D:create(ccg(15,10), t)
return CCPageTurn3D:create(t, CCSizeMake(15,10));
end
--------------------------------------

View File

@ -992,19 +992,6 @@ CCSize jsval_to_ccsize(JSContext *cx, jsval v) {
return cocos2d::CCSize(w, h);
}
ccGridSize jsval_to_ccgridsize(JSContext *cx, jsval v) {
JSObject *tmp;
jsval jsx, jsy;
double x, y;
JSBool ok = JS_ValueToObject(cx, v, &tmp) &&
JS_GetProperty(cx, tmp, "x", &jsx) &&
JS_GetProperty(cx, tmp, "y", &jsy) &&
JS_ValueToNumber(cx, jsx, &x) &&
JS_ValueToNumber(cx, jsy, &y);
assert(ok == JS_TRUE);
return cocos2d::ccg(x, y);
}
ccColor4B jsval_to_cccolor4b(JSContext *cx, jsval v) {
JSObject *tmp;
jsval jsr, jsg, jsb, jsa;
@ -1270,17 +1257,6 @@ jsval ccsize_to_jsval(JSContext* cx, CCSize& v) {
return JSVAL_NULL;
}
jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v) {
JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL);
if (!tmp) return JSVAL_NULL;
JSBool ok = JS_DefineProperty(cx, tmp, "x", DOUBLE_TO_JSVAL(v.x), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
JS_DefineProperty(cx, tmp, "y", DOUBLE_TO_JSVAL(v.y), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT);
if (ok) {
return OBJECT_TO_JSVAL(tmp);
}
return JSVAL_NULL;
}
jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v) {
JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL);
if (!tmp) return JSVAL_NULL;

View File

@ -190,7 +190,6 @@ const char* jsval_to_c_string(JSContext *cx, jsval v);
CCPoint jsval_to_ccpoint(JSContext *cx, jsval v);
CCRect jsval_to_ccrect(JSContext *cx, jsval v);
CCSize jsval_to_ccsize(JSContext *cx, jsval v);
ccGridSize jsval_to_ccgridsize(JSContext *cx, jsval v);
ccColor4B jsval_to_cccolor4b(JSContext *cx, jsval v);
ccColor4F jsval_to_cccolor4f(JSContext *cx, jsval v);
ccColor3B jsval_to_cccolor3b(JSContext *cx, jsval v);
@ -207,7 +206,6 @@ jsval c_string_to_jsval(JSContext* cx, const char* v);
jsval ccpoint_to_jsval(JSContext* cx, CCPoint& v);
jsval ccrect_to_jsval(JSContext* cx, CCRect& v);
jsval ccsize_to_jsval(JSContext* cx, CCSize& v);
jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v);
jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v);
jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v);
jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v);

View File

@ -1 +1 @@
f09e24cf19f818625edbdcec75b3e55cdd900020
9b26185a204b9e8e5d2d207a7b312ef5f007560d

View File

@ -121,7 +121,7 @@ class CCMoveBy : public CCActionInterval
CCObject* copyWithZone(CCZone* pZone);
CCActionInterval* reverse(void);
static CCMoveBy* create(float duration, CCPoint position);
static CCMoveBy* create(float duration, CCPoint deltaPosition);
};
class CCSkewTo : public CCActionInterval

View File

@ -6,7 +6,7 @@ class CCGridAction : public CCActionInterval
CCGridBase* getGrid(void);
static CCGridAction* create(ccGridSize gridSize, float duration);
static CCGridAction* create(float duration, CCSize gridSize);
};
class CCAccelDeccelAmplitude : public CCActionInterval
@ -22,21 +22,21 @@ class CCAccelDeccelAmplitude : public CCActionInterval
class CCGrid3DAction : public CCGridAction
{
virtual CCGridBase* getGrid(void);
ccVertex3F vertex(const ccGridSize& pos);
ccVertex3F originalVertex(const ccGridSize& pos);
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
ccVertex3F vertex(const CCPoint& pos);
ccVertex3F originalVertex(const CCPoint& pos);
void setVertex(const CCPoint& pos, const ccVertex3F& vertex);
//static CCGrid3DAction* create(const ccGridSize& gridSize, float duration);
//static CCGrid3DAction* create(float duration, CCSize gridSize);
};
class CCTiledGrid3DAction : public CCGridAction
{
ccQuad3 tile(ccGridSize pos);
ccQuad3 originalTile(ccGridSize pos);
void setTile(ccGridSize pos, ccQuad3 coords);
ccQuad3 tile(CCPoint pos);
ccQuad3 originalTile(CCPoint pos);
void setTile(CCPoint pos, ccQuad3 coords);
CCGridBase* getGrid(void);
//static CCTiledGrid3DAction* create(ccGridSize gridSize, float duration);
//static CCTiledGrid3DAction* create(float duration, const CCSize& gridSize);
};
class CCAccelAmplitude : public CCActionInterval

View File

@ -8,7 +8,7 @@ class CCWaves3D : public CCGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCWaves3D* create(int wav, float amp, ccGridSize gridSize, float duration);
static CCWaves3D* create(float duration, CCSize gridSize, unsigned int waves, float amplitude);
};
class CCFlipX3D : public CCGrid3DAction
@ -34,7 +34,7 @@ class CCLens3D : public CCGrid3DAction
CCPoint getPosition(void);
void setPosition(CCPoint position);
static CCLens3D* create(CCPoint pos, float r, ccGridSize gridSize, float duration);
static CCLens3D* create(float duration, CCSize gridSize, CCPoint position, float radius);
};
class CCRipple3D : public CCGrid3DAction
@ -48,14 +48,14 @@ class CCRipple3D : public CCGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCRipple3D* create(CCPoint pos, float r, int wav, float amp, ccGridSize gridSize, float duration);
static CCRipple3D* create(float duration, CCSize gridSize, CCPoint position, float radius, unsigned int waves, float amplitude);
};
class CCShaky3D : public CCGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
static CCShaky3D* create(int range, bool shakeZ, ccGridSize gridSize, float duration);
static CCShaky3D* create(float duration, CCSize gridSize, int range, bool shakeZ);
};
class CCLiquid : public CCGrid3DAction
@ -67,7 +67,7 @@ class CCLiquid : public CCGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCLiquid* create(int wav, float amp, ccGridSize gridSize, float duration);
static CCLiquid* create(float duration, CCSize gridSize, unsigned int waves, float amplitude);
};
class CCWaves : public CCGrid3DAction
@ -79,7 +79,7 @@ class CCWaves : public CCGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCWaves* create(int wav, float amp, bool h, bool v, ccGridSize gridSize,float duration);
static CCWaves* create(float duration, CCSize gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
};
class CCTwirl : public CCGrid3DAction
@ -93,5 +93,5 @@ class CCTwirl : public CCGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCTwirl* create(CCPoint pos, int t, float amp, ccGridSize gridSize,float duration);
static CCTwirl* create(float duration, CCSize gridSize, CCPoint position, unsigned int twirls, float amplitude);
};

View File

@ -1,5 +1,5 @@
class CCPageTurn3D : public CCGrid3DAction
{
static CCPageTurn3D* create(ccGridSize gridSize, float time);
static CCPageTurn3D* create(float duration, CCSize gridSize);
};

View File

@ -3,63 +3,63 @@ class CCShakyTiles3D : public CCTiledGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
static CCShakyTiles3D* create(int nRange, bool bShakeZ, ccGridSize gridSize, float duration);
CCShakyTiles3D* create(float duration, CCSize gridSize, int nRange, bool bShakeZ);
};
class CCShatteredTiles3D : public CCTiledGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
static CCShatteredTiles3D* create(int nRange, bool bShatterZ, ccGridSize gridSize, float duration);
static CCShatteredTiles3D* create(float duration, CCSize gridSize, int nRange, bool bShatterZ);
};
class CCShuffleTiles : public CCTiledGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
void shuffle(int *pArray, int nLen);
ccGridSize getDelta(ccGridSize pos);
void placeTile(ccGridSize pos, Tile *t);
void shuffle(unsigned int *pArray, int nLen);
CCSize getDelta(CCSize pos);
void placeTile(CCPoint pos, Tile *t);
static CCShuffleTiles* create(int s, ccGridSize gridSize, float duration);
static CCShuffleTiles* create(float duration, CCSize gridSize, unsigned int seed);
};
class CCFadeOutTRTiles : public CCTiledGrid3DAction
{
void turnOnTile(ccGridSize pos);
void turnOffTile(ccGridSize pos);
void transformTile(ccGridSize pos, float distance);
void turnOnTile(CCPoint pos);
void turnOffTile(CCPoint pos);
void transformTile(CCPoint pos, float distance);
static CCFadeOutTRTiles* create(ccGridSize gridSize, float time);
static CCFadeOutTRTiles* create(float duration, CCSize gridSize);
};
class CCFadeOutBLTiles : public CCFadeOutTRTiles
{
static CCFadeOutBLTiles* create(ccGridSize gridSize, float time);
static CCFadeOutBLTiles* create(float duration, CCSize gridSize);
};
class CCFadeOutUpTiles : public CCFadeOutTRTiles
{
void transformTile(ccGridSize pos, float distance);
void transformTile(CCPoint pos, float distance);
static CCFadeOutUpTiles* create(ccGridSize gridSize, float time);
static CCFadeOutUpTiles* create(float duration, CCSize gridSize);
};
class CCFadeOutDownTiles : public CCFadeOutUpTiles
{
static CCFadeOutDownTiles* create(ccGridSize gridSize, float time);
static CCFadeOutDownTiles* create(float duration, CCSize gridSize);
};
class CCTurnOffTiles : public CCTiledGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
void shuffle(int *pArray, int nLen);
void turnOnTile(ccGridSize pos);
void turnOffTile(ccGridSize pos);
void shuffle(unsigned int *pArray, int nLen);
void turnOnTile(CCPoint pos);
void turnOffTile(CCPoint pos);
static CCTurnOffTiles* create(int s, ccGridSize gridSize, float duration);
static CCTurnOffTiles* create(ccGridSize size, float d);
static CCTurnOffTiles* create(float duration, CCSize gridSize);
static CCTurnOffTiles* create(float duration, CCSize gridSize, unsigned int seed);
};
class CCWavesTiles3D : public CCTiledGrid3DAction
@ -71,7 +71,7 @@ class CCWavesTiles3D : public CCTiledGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCWavesTiles3D* create(int wav, float amp, ccGridSize gridSize, float duration);
static CCWavesTiles3D* create(float duration, CCSize gridSize, unsigned int waves, float amplitude);
};
class CCJumpTiles3D : public CCTiledGrid3DAction
@ -83,19 +83,19 @@ class CCJumpTiles3D : public CCTiledGrid3DAction
float getAmplitudeRate(void);
void setAmplitudeRate(float fAmplitudeRate);
static CCJumpTiles3D* create(int j, float amp, ccGridSize gridSize, float duration);
static CCJumpTiles3D* create(float duration, CCSize gridSize, unsigned int numberOfJumps, float amplitude);
};
class CCSplitRows : public CCTiledGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
static CCSplitRows* create(int nRows, float duration);
static CCSplitRows* create(float duration, unsigned int nRows);
};
class CCSplitCols : public CCTiledGrid3DAction
{
CCObject* copyWithZone(CCZone* pZone);
static CCSplitCols* create(int nCols, float duration);
static CCSplitCols* create(float duration, unsigned int nCols);
};

View File

@ -7,10 +7,10 @@ class CCTileMapAtlas : public CCAtlasNode
// struct sImageTGA* getTGAInfo();
// void setTGAInfo(struct sImageTGA* val);
void setTile(ccColor3B tile, ccGridSize position);
void setTile(ccColor3B tile, CCPoint position);
void releaseMap();
ccColor3B tileAt(const ccGridSize & pos);
ccColor3B tileAt(const CCPoint & pos);
static CCTileMapAtlas * create(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
};

View File

@ -162,7 +162,7 @@ class CCTransitionProgressRadialCW : public CCScene
class CCTransitionPageTurn : public CCScene
{
CCActionInterval* actionWithSize(ccGridSize vector);
CCActionInterval* actionWithSize(CCSize vector);
static CCTransitionPageTurn* create(float t,CCScene* scene,bool backwards);
};

View File

@ -144,17 +144,6 @@ class ccQuad3
ccVertex3F tr;
};
//! A 2D grid size
class ccGridSize
{
ccGridSize(void);
int x;
int y;
};
//! helper function to create a ccGridSize
static ccGridSize ccg(const int x, const int y);
//! a Point with a vertex point, a tex coord point and a color 4B
class ccV2F_C4B_T2F
{