Non-trivial arguments passed by reference now.

Removed unnecessary cocos2d:: prefix inside namespace.
This commit is contained in:
moadib 2011-08-17 17:19:57 +04:00
parent 82afec843b
commit a8d87a9976
84 changed files with 739 additions and 728 deletions

View File

@ -393,7 +393,7 @@ void CCDirector::setDepthTest(bool bOn)
}
}
CCPoint CCDirector::convertToGL(CCPoint obPoint)
CCPoint CCDirector::convertToGL(const CCPoint& obPoint)
{
CCSize s = m_obWinSizeInPoints;
float newY = s.height - obPoint.y;
@ -421,7 +421,7 @@ CCPoint CCDirector::convertToGL(CCPoint obPoint)
return ret;
}
CCPoint CCDirector::convertToUI(CCPoint obPoint)
CCPoint CCDirector::convertToUI(const CCPoint& obPoint)
{
CCSize winSize = m_obWinSizeInPoints;
float oppositeX = winSize.width - obPoint.x;
@ -480,7 +480,7 @@ CCSize CCDirector::getDisplaySizeInPixels(void)
return m_obWinSizeInPixels;
}
void CCDirector::reshapeProjection(CCSize newWindowSize)
void CCDirector::reshapeProjection(const CCSize& newWindowSize)
{
CC_UNUSED_PARAM(newWindowSize);
m_obWinSizeInPoints = m_pobOpenGLView->getSize();

View File

@ -39,7 +39,7 @@ THE SOFTWARE.
namespace cocos2d {
void ccDrawPoint(CCPoint point)
void ccDrawPoint(const CCPoint& point)
{
ccVertex2F p = {point.x * CC_CONTENT_SCALE_FACTOR(), point.y * CC_CONTENT_SCALE_FACTOR() };
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
@ -112,7 +112,7 @@ void ccDrawPoints(const CCPoint *points, unsigned int numberOfPoints)
glEnable(GL_TEXTURE_2D);
}
void ccDrawLine(CCPoint origin, CCPoint destination)
void ccDrawLine(const CCPoint& origin, const CCPoint& destination)
{
ccVertex2F vertices[2] =
{
@ -204,7 +204,7 @@ void ccDrawPoly(const CCPoint *poli, int numberOfPoints, bool closePolygon)
delete[] newPoint;
}
void ccDrawCircle(CCPoint center, float r, float a, int segs, bool drawLineToCenter)
void ccDrawCircle(const CCPoint& center, float r, float a, int segs, bool drawLineToCenter)
{
int additionalSegment = 1;
if (drawLineToCenter)
@ -252,7 +252,7 @@ void ccDrawCircle(CCPoint center, float r, float a, int segs, bool drawLineToCen
delete[] vertices; // free(vertices);
}
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int segments)
void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments)
{
CCPoint *vertices = new CCPoint[segments + 1];
@ -283,7 +283,7 @@ void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int
glEnable(GL_TEXTURE_2D);
}
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, int segments)
void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments)
{
CCPoint *vertices = new CCPoint[segments + 1];

View File

@ -121,7 +121,7 @@ CCTimer* CCTimer::timerWithTarget(SelectorProtocol *pTarget, SEL_SCHEDULE pfnSel
return pTimer;
}
bool CCTimer::initWithScriptFuncName(const char *pszFuncName, cocos2d::ccTime fSeconds)
bool CCTimer::initWithScriptFuncName(const char *pszFuncName, ccTime fSeconds)
{
m_scriptFunc = string(pszFuncName);
m_fInterval = fSeconds;

View File

@ -221,7 +221,7 @@ CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode)
CC_SAFE_DELETE(pRet)
return NULL;
}
CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, CCRect rect)
CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect)
{
CCFollow *pRet = new CCFollow();
if (pRet && pRet->initWithTarget(pFollowedNode, rect))
@ -247,7 +247,7 @@ bool CCFollow::initWithTarget(CCNode *pFollowedNode)
return true;
}
bool CCFollow::initWithTarget(CCNode *pFollowedNode, CCRect rect)
bool CCFollow::initWithTarget(CCNode *pFollowedNode, const CCRect& rect)
{
assert(pFollowedNode != NULL);
pFollowedNode->retain();

View File

@ -42,7 +42,7 @@ namespace cocos2d {
//
// EaseAction
//
CCActionEase* CCActionEase::actionWithAction(cocos2d::CCActionInterval *pAction)
CCActionEase* CCActionEase::actionWithAction(CCActionInterval *pAction)
{
CCActionEase *pRet = new CCActionEase();
if (pRet)
@ -60,7 +60,7 @@ namespace cocos2d {
return pRet;
}
bool CCActionEase::initWithAction(cocos2d::CCActionInterval *pAction)
bool CCActionEase::initWithAction(CCActionInterval *pAction)
{
assert(pAction != NULL);
@ -75,7 +75,7 @@ namespace cocos2d {
return false;
}
CCObject* CCActionEase::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCActionEase::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCActionEase* pCopy = NULL;
@ -115,7 +115,7 @@ namespace cocos2d {
CCActionInterval::stop();
}
void CCActionEase::update(cocos2d::ccTime time)
void CCActionEase::update(ccTime time)
{
m_pOther->update(time);
}
@ -128,7 +128,7 @@ namespace cocos2d {
//
// EaseRateAction
//
CCEaseRateAction* CCEaseRateAction::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate)
CCEaseRateAction* CCEaseRateAction::actionWithAction(CCActionInterval *pAction, float fRate)
{
CCEaseRateAction *pRet = new CCEaseRateAction();
if (pRet)
@ -146,7 +146,7 @@ namespace cocos2d {
return pRet;
}
bool CCEaseRateAction::initWithAction(cocos2d::CCActionInterval *pAction, float fRate)
bool CCEaseRateAction::initWithAction(CCActionInterval *pAction, float fRate)
{
if (CCActionEase::initWithAction(pAction))
{
@ -157,7 +157,7 @@ namespace cocos2d {
return false;
}
CCObject* CCEaseRateAction::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseRateAction::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseRateAction* pCopy = NULL;
@ -190,7 +190,7 @@ namespace cocos2d {
//
// EeseIn
//
CCEaseIn* CCEaseIn::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate)
CCEaseIn* CCEaseIn::actionWithAction(CCActionInterval *pAction, float fRate)
{
CCEaseIn *pRet = new CCEaseIn();
if (pRet)
@ -208,7 +208,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseIn* pCopy = NULL;
@ -229,7 +229,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseIn::update(cocos2d::ccTime time)
void CCEaseIn::update(ccTime time)
{
m_pOther->update(powf(time, m_fRate));
}
@ -237,7 +237,7 @@ namespace cocos2d {
//
// EaseOut
//
CCEaseOut* CCEaseOut::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate)
CCEaseOut* CCEaseOut::actionWithAction(CCActionInterval *pAction, float fRate)
{
CCEaseOut *pRet = new CCEaseOut();
if (pRet)
@ -255,7 +255,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseOut* pCopy = NULL;
@ -276,7 +276,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseOut::update(cocos2d::ccTime time)
void CCEaseOut::update(ccTime time)
{
m_pOther->update(powf(time, 1 / m_fRate));
}
@ -284,7 +284,7 @@ namespace cocos2d {
//
// EaseInOut
//
CCEaseInOut* CCEaseInOut::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate)
CCEaseInOut* CCEaseInOut::actionWithAction(CCActionInterval *pAction, float fRate)
{
CCEaseInOut *pRet = new CCEaseInOut();
if (pRet)
@ -302,7 +302,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseInOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseInOut* pCopy = NULL;
@ -323,7 +323,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseInOut::update(cocos2d::ccTime time)
void CCEaseInOut::update(ccTime time)
{
int sign = 1;
int r = (int) m_fRate;
@ -371,7 +371,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseExponentialIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseExponentialIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseExponentialIn* pCopy = NULL;
@ -392,7 +392,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseExponentialIn::update(cocos2d::ccTime time)
void CCEaseExponentialIn::update(ccTime time)
{
m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
}
@ -423,7 +423,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseExponentialOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseExponentialOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseExponentialOut* pCopy = NULL;
@ -444,7 +444,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseExponentialOut::update(cocos2d::ccTime time)
void CCEaseExponentialOut::update(ccTime time)
{
m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
}
@ -457,7 +457,7 @@ namespace cocos2d {
//
// EaseExponentialInOut
//
CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(cocos2d::CCActionInterval *pAction)
CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(CCActionInterval *pAction)
{
CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut();
if (pRet)
@ -475,7 +475,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseExponentialInOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseExponentialInOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseExponentialInOut* pCopy = NULL;
@ -496,7 +496,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseExponentialInOut::update(cocos2d::ccTime time)
void CCEaseExponentialInOut::update(ccTime time)
{
time /= 0.5f;
if (time < 1)
@ -532,7 +532,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseSineIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseSineIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseSineIn* pCopy = NULL;
@ -553,7 +553,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseSineIn::update(cocos2d::ccTime time)
void CCEaseSineIn::update(ccTime time)
{
m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1);
}
@ -584,7 +584,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseSineOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseSineOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseSineOut* pCopy = NULL;
@ -605,7 +605,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseSineOut::update(cocos2d::ccTime time)
void CCEaseSineOut::update(ccTime time)
{
m_pOther->update(sinf(time * (float)M_PI_2));
}
@ -636,7 +636,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseSineInOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseSineInOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseSineInOut* pCopy = NULL;
@ -657,7 +657,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseSineInOut::update(cocos2d::ccTime time)
void CCEaseSineInOut::update(ccTime time)
{
m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1));
}
@ -665,7 +665,7 @@ namespace cocos2d {
//
// EaseElastic
//
CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCActionInterval *pAction)
CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction)
{
CCEaseElastic *pRet = new CCEaseElastic();
if (pRet)
@ -683,7 +683,7 @@ namespace cocos2d {
return pRet;
}
CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCActionInterval *pAction, float fPeriod)
CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float fPeriod)
{
CCEaseElastic *pRet = new CCEaseElastic();
if (pRet)
@ -701,12 +701,12 @@ namespace cocos2d {
return pRet;
}
bool CCEaseElastic::initWithAction(cocos2d::CCActionInterval *pAction)
bool CCEaseElastic::initWithAction(CCActionInterval *pAction)
{
return initWithAction(pAction, 0.3f);
}
bool CCEaseElastic::initWithAction(cocos2d::CCActionInterval *pAction, float fPeriod)
bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod)
{
if (CCActionEase::initWithAction(pAction))
{
@ -717,7 +717,7 @@ namespace cocos2d {
return false;
}
CCObject* CCEaseElastic::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseElastic::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseElastic* pCopy = NULL;
@ -784,7 +784,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseElasticIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseElasticIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseElasticIn* pCopy = NULL;
@ -805,7 +805,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseElasticIn::update(cocos2d::ccTime time)
void CCEaseElasticIn::update(ccTime time)
{
ccTime newT = 0;
if (time == 0 || time == 1)
@ -866,7 +866,7 @@ namespace cocos2d {
return pRet;
}
CCObject *CCEaseElasticOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject *CCEaseElasticOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseElasticOut* pCopy = NULL;
@ -887,7 +887,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseElasticOut::update(cocos2d::ccTime time)
void CCEaseElasticOut::update(ccTime time)
{
ccTime newT = 0;
if (time == 0 || time == 1)
@ -947,7 +947,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseElasticInOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseElasticInOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseElasticInOut* pCopy = NULL;
@ -969,7 +969,7 @@ namespace cocos2d {
}
void CCEaseElasticInOut::update(cocos2d::ccTime time)
void CCEaseElasticInOut::update(ccTime time)
{
ccTime newT = 0;
if (time == 0 || time == 1)
@ -1026,7 +1026,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBounce::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBounce::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBounce* pCopy = NULL;
@ -1047,7 +1047,7 @@ namespace cocos2d {
return pCopy;
}
ccTime CCEaseBounce::bounceTime(cocos2d::ccTime time)
ccTime CCEaseBounce::bounceTime(ccTime time)
{
if (time < 1 / 2.75)
{
@ -1089,7 +1089,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBounceIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBounceIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBounceIn* pCopy = NULL;
@ -1110,7 +1110,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseBounceIn::update(cocos2d::ccTime time)
void CCEaseBounceIn::update(ccTime time)
{
ccTime newT = 1 - bounceTime(1 - time);
m_pOther->update(newT);
@ -1142,7 +1142,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBounceOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBounceOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBounceOut* pCopy = NULL;
@ -1163,7 +1163,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseBounceOut::update(cocos2d::ccTime time)
void CCEaseBounceOut::update(ccTime time)
{
ccTime newT = bounceTime(time);
m_pOther->update(newT);
@ -1195,7 +1195,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBounceInOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBounceInOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBounceInOut* pCopy = NULL;
@ -1216,7 +1216,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseBounceInOut::update(cocos2d::ccTime time)
void CCEaseBounceInOut::update(ccTime time)
{
ccTime newT = 0;
if (time < 0.5f)
@ -1235,7 +1235,7 @@ namespace cocos2d {
//
// EaseBackIn
//
CCEaseBackIn* CCEaseBackIn::actionWithAction(cocos2d::CCActionInterval *pAction)
CCEaseBackIn* CCEaseBackIn::actionWithAction(CCActionInterval *pAction)
{
CCEaseBackIn *pRet = new CCEaseBackIn();
if (pRet)
@ -1253,7 +1253,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBackIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBackIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBackIn* pCopy = NULL;
@ -1274,7 +1274,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseBackIn::update(cocos2d::ccTime time)
void CCEaseBackIn::update(ccTime time)
{
ccTime overshoot = 1.70158f;
m_pOther->update(time * time * ((overshoot + 1) * time - overshoot));
@ -1306,7 +1306,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBackOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBackOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBackOut* pCopy = NULL;
@ -1327,7 +1327,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseBackOut::update(cocos2d::ccTime time)
void CCEaseBackOut::update(ccTime time)
{
ccTime overshoot = 1.70158f;
@ -1361,7 +1361,7 @@ namespace cocos2d {
return pRet;
}
CCObject* CCEaseBackInOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCEaseBackInOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCEaseBackInOut* pCopy = NULL;
@ -1382,7 +1382,7 @@ namespace cocos2d {
return pCopy;
}
void CCEaseBackInOut::update(cocos2d::ccTime time)
void CCEaseBackInOut::update(ccTime time)
{
ccTime overshoot = 1.70158f * 1.525f;

View File

@ -30,7 +30,7 @@ namespace cocos2d
{
// implementation of CCGridAction
CCGridAction* CCGridAction::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCGridAction* CCGridAction::actionWithSize(const ccGridSize& gridSize, ccTime duration)
{
CCGridAction *pAction = new CCGridAction();
if (pAction)
@ -48,7 +48,7 @@ namespace cocos2d
return pAction;
}
bool CCGridAction::initWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCGridAction::initWithSize(const ccGridSize& gridSize, ccTime duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -106,7 +106,7 @@ namespace cocos2d
return CCReverseTime::actionWithAction(this);
}
CCObject* CCGridAction::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCGridAction::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCGridAction* pCopy = NULL;
@ -136,19 +136,19 @@ namespace cocos2d
return CCGrid3D::gridWithSize(m_sGridSize);
}
ccVertex3F CCGrid3DAction::vertex(cocos2d::ccGridSize pos)
ccVertex3F CCGrid3DAction::vertex(const ccGridSize& pos)
{
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
return g->vertex(pos);
}
ccVertex3F CCGrid3DAction::originalVertex(cocos2d::ccGridSize pos)
ccVertex3F CCGrid3DAction::originalVertex(const ccGridSize& pos)
{
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
return g->originalVertex(pos);
}
void CCGrid3DAction::setVertex(cocos2d::ccGridSize pos, cocos2d::ccVertex3F vertex)
void CCGrid3DAction::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
{
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
g->setVertex(pos, vertex);
@ -161,19 +161,19 @@ namespace cocos2d
return CCTiledGrid3D::gridWithSize(m_sGridSize);
}
ccQuad3 CCTiledGrid3DAction::tile(cocos2d::ccGridSize pos)
ccQuad3 CCTiledGrid3DAction::tile(const ccGridSize& pos)
{
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->tile(pos);
}
ccQuad3 CCTiledGrid3DAction::originalTile(cocos2d::ccGridSize pos)
ccQuad3 CCTiledGrid3DAction::originalTile(const ccGridSize& pos)
{
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->originalTile(pos);
}
void CCTiledGrid3DAction::setTile(cocos2d::ccGridSize pos, cocos2d::ccQuad3 coords)
void CCTiledGrid3DAction::setTile(const ccGridSize& pos, const ccQuad3& coords)
{
CCTiledGrid3D *g = (CCTiledGrid3D*)m_pTarget->getGrid();
return g->setTile(pos, coords);
@ -181,7 +181,7 @@ namespace cocos2d
// implementation CCAccelDeccelAmplitude
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration)
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
{
CCAccelDeccelAmplitude *pRet = new CCAccelDeccelAmplitude();
if (pRet)
@ -199,7 +199,7 @@ namespace cocos2d
return pRet;
}
bool CCAccelDeccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration)
bool CCAccelDeccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -224,7 +224,7 @@ namespace cocos2d
m_pOther->startWithTarget(pTarget);
}
void CCAccelDeccelAmplitude::update(cocos2d::ccTime time)
void CCAccelDeccelAmplitude::update(ccTime time)
{
float f = time * 2;
@ -244,7 +244,7 @@ namespace cocos2d
// implementation of AccelAmplitude
CCAccelAmplitude* CCAccelAmplitude::actionWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration)
CCAccelAmplitude* CCAccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
{
CCAccelAmplitude *pRet = new CCAccelAmplitude();
if (pRet)
@ -262,7 +262,7 @@ namespace cocos2d
return pRet;
}
bool CCAccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration)
bool CCAccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -287,7 +287,7 @@ namespace cocos2d
m_pOther->startWithTarget(pTarget);
}
void CCAccelAmplitude::update(cocos2d::ccTime time)
void CCAccelAmplitude::update(ccTime time)
{
((CCAccelAmplitude*)(m_pOther))->setAmplitudeRate(powf(time, m_fRate));
m_pOther->update(time);
@ -300,7 +300,7 @@ namespace cocos2d
// DeccelAmplitude
CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration)
CCDeccelAmplitude* CCDeccelAmplitude::actionWithAction(CCAction *pAction, ccTime duration)
{
CCDeccelAmplitude *pRet = new CCDeccelAmplitude();
if (pRet)
@ -318,7 +318,7 @@ namespace cocos2d
return pRet;
}
bool CCDeccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration)
bool CCDeccelAmplitude::initWithAction(CCAction *pAction, ccTime duration)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -343,7 +343,7 @@ namespace cocos2d
m_pOther->startWithTarget(pTarget);
}
void CCDeccelAmplitude::update(cocos2d::ccTime time)
void CCDeccelAmplitude::update(ccTime time)
{
((CCDeccelAmplitude*)(m_pOther))->setAmplitudeRate(powf((1 - time), m_fRate));
m_pOther->update(time);

View File

@ -31,7 +31,7 @@ namespace cocos2d
{
// implementation of CCWaves3D
CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCWaves3D* CCWaves3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
CCWaves3D *pAction = new CCWaves3D();
@ -50,7 +50,7 @@ namespace cocos2d
return pAction;
}
bool CCWaves3D::initWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCWaves3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -64,7 +64,7 @@ namespace cocos2d
return false;
}
CCObject* CCWaves3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCWaves3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCWaves3D* pCopy = NULL;
@ -88,7 +88,7 @@ namespace cocos2d
return pCopy;
}
void CCWaves3D::update(cocos2d::ccTime time)
void CCWaves3D::update(ccTime time)
{
int i, j;
@ -105,7 +105,7 @@ namespace cocos2d
// implementation of CCFlipX3D
CCFlipX3D* CCFlipX3D::actionWithDuration(cocos2d::ccTime duration)
CCFlipX3D* CCFlipX3D::actionWithDuration(ccTime duration)
{
CCFlipX3D *pAction = new CCFlipX3D();
@ -124,12 +124,12 @@ namespace cocos2d
return pAction;
}
bool CCFlipX3D::initWithDuration(cocos2d::ccTime duration)
bool CCFlipX3D::initWithDuration(ccTime duration)
{
return CCGrid3DAction::initWithSize(ccg(1, 1), duration);
}
bool CCFlipX3D::initWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, ccTime duration)
{
if (gridSize.x != 1 || gridSize.y != 1)
{
@ -142,7 +142,7 @@ namespace cocos2d
return CCGrid3DAction::initWithSize(gridSize, duration);
}
CCObject* CCFlipX3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCFlipX3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCFlipX3D* pCopy = NULL;
@ -165,7 +165,7 @@ namespace cocos2d
return pCopy;
}
void CCFlipX3D::update(cocos2d::ccTime time)
void CCFlipX3D::update(ccTime time)
{
CGFloat angle = (CGFloat)M_PI * time; // 180 degrees
CGFloat mz = sinf(angle);
@ -273,7 +273,7 @@ namespace cocos2d
return pCopy;
}
void CCFlipY3D::update(cocos2d::ccTime time)
void CCFlipY3D::update(ccTime time)
{
CGFloat angle = (CGFloat)M_PI * time; // 180 degrees
CGFloat mz = sinf( angle );
@ -340,7 +340,7 @@ namespace cocos2d
// implementation of Lens3D
CCLens3D* CCLens3D::actionWithPosition(cocos2d::CCPoint pos, float r, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCLens3D* CCLens3D::actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration)
{
CCLens3D *pAction = new CCLens3D();
@ -359,7 +359,7 @@ namespace cocos2d
return pAction;
}
bool CCLens3D::initWithPosition(cocos2d::CCPoint pos, float r, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCLens3D::initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -375,7 +375,7 @@ namespace cocos2d
return false;
}
CCObject* CCLens3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCLens3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCLens3D* pCopy = NULL;
@ -398,7 +398,7 @@ namespace cocos2d
return pCopy;
}
void CCLens3D::setPosition(CCPoint pos)
void CCLens3D::setPosition(const CCPoint& pos)
{
if( ! CCPoint::CCPointEqualToPoint(pos, m_position) ) {
m_position = pos;
@ -409,7 +409,7 @@ namespace cocos2d
}
}
void CCLens3D::update(cocos2d::ccTime time)
void CCLens3D::update(ccTime time)
{
CC_UNUSED_PARAM(time);
if (m_bDirty)
@ -454,7 +454,7 @@ namespace cocos2d
// implementation of Ripple3D
CCRipple3D* CCRipple3D::actionWithPosition(cocos2d::CCPoint pos, float r, int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCRipple3D* CCRipple3D::actionWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
CCRipple3D *pAction = new CCRipple3D();
@ -473,7 +473,7 @@ namespace cocos2d
return pAction;
}
bool CCRipple3D::initWithPosition(cocos2d::CCPoint pos, float r, int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCRipple3D::initWithPosition(const CCPoint& pos, float r, int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -489,14 +489,14 @@ namespace cocos2d
return false;
}
void CCRipple3D::setPosition(CCPoint position)
void CCRipple3D::setPosition(const CCPoint& position)
{
m_position = position;
m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR();
m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR();
}
CCObject* CCRipple3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCRipple3D* pCopy = NULL;
@ -519,7 +519,7 @@ namespace cocos2d
return pCopy;
}
void CCRipple3D::update(cocos2d::ccTime time)
void CCRipple3D::update(ccTime time)
{
int i, j;
@ -545,7 +545,7 @@ namespace cocos2d
// implementation of Shaky3D
CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCShaky3D* CCShaky3D::actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration)
{
CCShaky3D *pAction = new CCShaky3D();
@ -564,7 +564,7 @@ namespace cocos2d
return pAction;
}
bool CCShaky3D::initWithRange(int range, bool shakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCShaky3D::initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -577,7 +577,7 @@ namespace cocos2d
return false;
}
CCObject* CCShaky3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCShaky3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCShaky3D* pCopy = NULL;
@ -600,7 +600,7 @@ namespace cocos2d
return pCopy;
}
void CCShaky3D::update(cocos2d::ccTime time)
void CCShaky3D::update(ccTime time)
{
CC_UNUSED_PARAM(time);
int i, j;
@ -624,7 +624,7 @@ namespace cocos2d
// implementation of Liquid
CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCLiquid* CCLiquid::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
CCLiquid *pAction = new CCLiquid();
@ -643,7 +643,7 @@ namespace cocos2d
return pAction;
}
bool CCLiquid::initWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCLiquid::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -657,7 +657,7 @@ namespace cocos2d
return false;
}
CCObject* CCLiquid::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCLiquid::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCLiquid* pCopy = NULL;
@ -680,7 +680,7 @@ namespace cocos2d
return pCopy;
}
void CCLiquid::update(cocos2d::ccTime time)
void CCLiquid::update(ccTime time)
{
int i, j;
@ -698,7 +698,7 @@ namespace cocos2d
// implementation of Waves
CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCWaves* CCWaves::actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, ccTime duration)
{
CCWaves *pAction = new CCWaves();
@ -717,7 +717,7 @@ namespace cocos2d
return pAction;
}
bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCWaves::initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -733,7 +733,7 @@ namespace cocos2d
return false;
}
CCObject* CCWaves::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCWaves::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCWaves* pCopy = NULL;
@ -756,7 +756,7 @@ namespace cocos2d
return pCopy;
}
void CCWaves::update(cocos2d::ccTime time)
void CCWaves::update(ccTime time)
{
int i, j;
@ -783,7 +783,7 @@ namespace cocos2d
// implementation of Twirl
CCTwirl* CCTwirl::actionWithPosition(cocos2d::CCPoint pos, int t, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCTwirl* CCTwirl::actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize, ccTime duration)
{
CCTwirl *pAction = new CCTwirl();
@ -802,7 +802,7 @@ namespace cocos2d
return pAction;
}
bool CCTwirl::initWithPosition(cocos2d::CCPoint pos, int t, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCTwirl::initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize, ccTime duration)
{
if (CCGrid3DAction::initWithSize(gridSize, duration))
{
@ -817,14 +817,14 @@ namespace cocos2d
return false;
}
void CCTwirl::setPosition(CCPoint position)
void CCTwirl::setPosition(const CCPoint& position)
{
m_position = position;
m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR();
m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR();
}
CCObject* CCTwirl::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCTwirl::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCTwirl* pCopy = NULL;
@ -848,7 +848,7 @@ namespace cocos2d
return pCopy;
}
void CCTwirl::update(cocos2d::ccTime time)
void CCTwirl::update(ccTime time)
{
int i, j;
CCPoint c = m_positionInPixels;

View File

@ -36,7 +36,7 @@ namespace cocos2d {
CCActionInstant::CCActionInstant()
{}
CCObject * CCActionInstant::copyWithZone(cocos2d::CCZone *pZone)
CCObject * CCActionInstant::copyWithZone(CCZone *pZone)
{
CCZone *pNewZone = NULL;
CCActionInstant *pRet = NULL;
@ -218,14 +218,14 @@ namespace cocos2d {
//
// Place
//
CCPlace * CCPlace::actionWithPosition(CCPoint pos)
CCPlace * CCPlace::actionWithPosition(const CCPoint& pos)
{
CCPlace *pRet = new CCPlace();
pRet->initWithPosition(pos);
pRet->autorelease();
return pRet;
}
bool CCPlace::initWithPosition(CCPoint pos)
bool CCPlace::initWithPosition(const CCPoint& pos)
{
m_tPosition = pos;
return true;
@ -305,7 +305,7 @@ namespace cocos2d {
return true;
}
CCObject * CCCallFunc::copyWithZone(cocos2d::CCZone *pZone)
CCObject * CCCallFunc::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCCallFunc* pRet = NULL;

View File

@ -46,7 +46,7 @@ CCActionInterval* CCActionInterval::actionWithDuration(ccTime d)
return pAction;
}
bool CCActionInterval::initWithDuration(cocos2d::ccTime d)
bool CCActionInterval::initWithDuration(ccTime d)
{
m_fDuration = d;
@ -150,7 +150,7 @@ CCActionInterval* CCActionInterval::reverse(void)
//
// Sequence
//
CCSequence* CCSequence::actionOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, cocos2d::CCFiniteTimeAction *pActionTwo)
CCSequence* CCSequence::actionOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{
CCSequence *pSequence = new CCSequence();
pSequence->initOneTwo(pActionOne, pActionTwo);
@ -159,7 +159,7 @@ CCSequence* CCSequence::actionOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, co
return pSequence;
}
CCFiniteTimeAction* CCSequence::actions(cocos2d::CCFiniteTimeAction *pAction1, ...)
CCFiniteTimeAction* CCSequence::actions(CCFiniteTimeAction *pAction1, ...)
{
va_list params;
va_start(params, pAction1);
@ -196,7 +196,7 @@ CCFiniteTimeAction* CCSequence::actionsWithArray(CCArray *actions)
return prev;
}
bool CCSequence::initOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, cocos2d::CCFiniteTimeAction *pActionTwo)
bool CCSequence::initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
{
assert(pActionOne != NULL);
assert(pActionTwo != NULL);
@ -257,7 +257,7 @@ void CCSequence::stop(void)
CCActionInterval::stop();
}
void CCSequence::update(cocos2d::ccTime time)
void CCSequence::update(ccTime time)
{
int found = 0;
ccTime new_t = 0.0f;
@ -317,7 +317,7 @@ CCActionInterval* CCSequence::reverse(void)
//
// Repeat
//
CCRepeat* CCRepeat::actionWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int times)
CCRepeat* CCRepeat::actionWithAction(CCFiniteTimeAction *pAction, unsigned int times)
{
CCRepeat* pRepeat = new CCRepeat();
pRepeat->initWithAction(pAction, times);
@ -326,7 +326,7 @@ CCRepeat* CCRepeat::actionWithAction(cocos2d::CCFiniteTimeAction *pAction, unsig
return pRepeat;
}
bool CCRepeat::initWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int times)
bool CCRepeat::initWithAction(CCFiniteTimeAction *pAction, unsigned int times)
{
ccTime d = pAction->getDuration() * times;
@ -344,7 +344,7 @@ bool CCRepeat::initWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int
return false;
}
CCObject* CCRepeat::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCRepeat::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
@ -388,7 +388,7 @@ void CCRepeat::stop(void)
// issue #80. Instead of hooking step:, hook update: since it can be called by any
// container action like Repeat, Sequence, AccelDeccel, etc..
void CCRepeat::update(cocos2d::ccTime time)
void CCRepeat::update(ccTime time)
{
ccTime t = time * m_uTimes;
if (t > m_uTotal + 1)
@ -515,7 +515,7 @@ CCActionInterval *CCRepeatForever::reverse()
//
// Spawn
//
CCFiniteTimeAction* CCSpawn::actions(cocos2d::CCFiniteTimeAction *pAction1, ...)
CCFiniteTimeAction* CCSpawn::actions(CCFiniteTimeAction *pAction1, ...)
{
va_list params;
va_start(params, pAction1);
@ -540,7 +540,7 @@ CCFiniteTimeAction* CCSpawn::actions(cocos2d::CCFiniteTimeAction *pAction1, ...)
return pPrev;
}
CCFiniteTimeAction* CCSpawn::actionsWithArray(cocos2d::CCArray *actions)
CCFiniteTimeAction* CCSpawn::actionsWithArray(CCArray *actions)
{
CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0);
@ -552,7 +552,7 @@ CCFiniteTimeAction* CCSpawn::actionsWithArray(cocos2d::CCArray *actions)
return prev;
}
CCSpawn* CCSpawn::actionOneTwo(cocos2d::CCFiniteTimeAction *pAction1, cocos2d::CCFiniteTimeAction *pAction2)
CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
{
CCSpawn *pSpawn = new CCSpawn();
pSpawn->initOneTwo(pAction1, pAction2);
@ -595,7 +595,7 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
return bRet;
}
CCObject* CCSpawn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCSpawn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCSpawn* pCopy = NULL;
@ -640,7 +640,7 @@ void CCSpawn::stop(void)
CCActionInterval::stop();
}
void CCSpawn::update(cocos2d::ccTime time)
void CCSpawn::update(ccTime time)
{
if (m_pOne)
{
@ -660,7 +660,7 @@ CCActionInterval* CCSpawn::reverse(void)
//
// RotateTo
//
CCRotateTo* CCRotateTo::actionWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
CCRotateTo* CCRotateTo::actionWithDuration(ccTime duration, float fDeltaAngle)
{
CCRotateTo* pRotateTo = new CCRotateTo();
pRotateTo->initWithDuration(duration, fDeltaAngle);
@ -669,7 +669,7 @@ CCRotateTo* CCRotateTo::actionWithDuration(cocos2d::ccTime duration, float fDelt
return pRotateTo;
}
bool CCRotateTo::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
bool CCRotateTo::initWithDuration(ccTime duration, float fDeltaAngle)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -680,7 +680,7 @@ bool CCRotateTo::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
return false;
}
CCObject* CCRotateTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCRotateTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCRotateTo* pCopy = NULL;
@ -731,7 +731,7 @@ void CCRotateTo::startWithTarget(CCNode *pTarget)
}
}
void CCRotateTo::update(cocos2d::ccTime time)
void CCRotateTo::update(ccTime time)
{
if (m_pTarget)
{
@ -742,7 +742,7 @@ void CCRotateTo::update(cocos2d::ccTime time)
//
// RotateBy
//
CCRotateBy* CCRotateBy::actionWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
CCRotateBy* CCRotateBy::actionWithDuration(ccTime duration, float fDeltaAngle)
{
CCRotateBy *pRotateBy = new CCRotateBy();
pRotateBy->initWithDuration(duration, fDeltaAngle);
@ -751,7 +751,7 @@ CCRotateBy* CCRotateBy::actionWithDuration(cocos2d::ccTime duration, float fDelt
return pRotateBy;
}
bool CCRotateBy::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
bool CCRotateBy::initWithDuration(ccTime duration, float fDeltaAngle)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -762,7 +762,7 @@ bool CCRotateBy::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle)
return false;
}
CCObject* CCRotateBy::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCRotateBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCRotateBy* pCopy = NULL;
@ -791,7 +791,7 @@ void CCRotateBy::startWithTarget(CCNode *pTarget)
m_fStartAngle = pTarget->getRotation();
}
void CCRotateBy::update(cocos2d::ccTime time)
void CCRotateBy::update(ccTime time)
{
// XXX: shall I add % 360
if (m_pTarget)
@ -808,7 +808,7 @@ CCActionInterval* CCRotateBy::reverse(void)
//
// MoveTo
//
CCMoveTo* CCMoveTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position)
CCMoveTo* CCMoveTo::actionWithDuration(ccTime duration, const CCPoint& position)
{
CCMoveTo *pMoveTo = new CCMoveTo();
pMoveTo->initWithDuration(duration, position);
@ -817,7 +817,7 @@ CCMoveTo* CCMoveTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoin
return pMoveTo;
}
bool CCMoveTo::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position)
bool CCMoveTo::initWithDuration(ccTime duration, const CCPoint& position)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -828,7 +828,7 @@ bool CCMoveTo::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint posit
return false;
}
CCObject* CCMoveTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCMoveTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCMoveTo* pCopy = NULL;
@ -858,7 +858,7 @@ void CCMoveTo::startWithTarget(CCNode *pTarget)
m_delta = ccpSub(m_endPosition, m_startPosition);
}
void CCMoveTo::update(cocos2d::ccTime time)
void CCMoveTo::update(ccTime time)
{
if (m_pTarget)
{
@ -870,7 +870,7 @@ void CCMoveTo::update(cocos2d::ccTime time)
//
// MoveBy
//
CCMoveBy* CCMoveBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position)
CCMoveBy* CCMoveBy::actionWithDuration(ccTime duration, const CCPoint& position)
{
CCMoveBy *pMoveBy = new CCMoveBy();
pMoveBy->initWithDuration(duration, position);
@ -879,7 +879,7 @@ CCMoveBy* CCMoveBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoin
return pMoveBy;
}
bool CCMoveBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position)
bool CCMoveBy::initWithDuration(ccTime duration, const CCPoint& position)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -890,7 +890,7 @@ bool CCMoveBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint posit
return false;
}
CCObject* CCMoveBy::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCMoveBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCMoveBy* pCopy = NULL;
@ -928,7 +928,7 @@ CCActionInterval* CCMoveBy::reverse(void)
//
// CCSkewTo
//
CCSkewTo* CCSkewTo::actionWithDuration(cocos2d::ccTime t, float sx, float sy)
CCSkewTo* CCSkewTo::actionWithDuration(ccTime t, float sx, float sy)
{
CCSkewTo *pSkewTo = new CCSkewTo();
if (pSkewTo)
@ -984,7 +984,7 @@ CCObject* CCSkewTo::copyWithZone(CCZone* pZone)
return pCopy;
}
void CCSkewTo::startWithTarget(cocos2d::CCNode *pTarget)
void CCSkewTo::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
@ -1072,7 +1072,7 @@ CCSkewBy* CCSkewBy::actionWithDuration(ccTime t, float sx, float sy)
return pSkewBy;
}
bool CCSkewBy::initWithDuration(cocos2d::ccTime t, float deltaSkewX, float deltaSkewY)
bool CCSkewBy::initWithDuration(ccTime t, float deltaSkewX, float deltaSkewY)
{
bool bRet = false;
@ -1087,7 +1087,7 @@ bool CCSkewBy::initWithDuration(cocos2d::ccTime t, float deltaSkewX, float delta
return bRet;
}
void CCSkewBy::startWithTarget(cocos2d::CCNode *pTarget)
void CCSkewBy::startWithTarget(CCNode *pTarget)
{
CCSkewTo::startWithTarget(pTarget);
m_fDeltaX = m_fSkewX;
@ -1104,7 +1104,7 @@ CCActionInterval* CCSkewBy::reverse()
//
// JumpBy
//
CCJumpBy* CCJumpBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position, cocos2d::ccTime height, unsigned int jumps)
CCJumpBy* CCJumpBy::actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps)
{
CCJumpBy *pJumpBy = new CCJumpBy();
pJumpBy->initWithDuration(duration, position, height, jumps);
@ -1113,7 +1113,7 @@ CCJumpBy* CCJumpBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoin
return pJumpBy;
}
bool CCJumpBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position, cocos2d::ccTime height, unsigned int jumps)
bool CCJumpBy::initWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1127,7 +1127,7 @@ bool CCJumpBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint posit
return false;
}
CCObject* CCJumpBy::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCJumpBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCJumpBy* pCopy = NULL;
@ -1156,7 +1156,7 @@ void CCJumpBy::startWithTarget(CCNode *pTarget)
m_startPosition = pTarget->getPosition();
}
void CCJumpBy::update(cocos2d::ccTime time)
void CCJumpBy::update(ccTime time)
{
// parabolic jump (since v0.8.2)
if (m_pTarget)
@ -1178,7 +1178,7 @@ CCActionInterval* CCJumpBy::reverse(void)
//
// JumpTo
//
CCJumpTo* CCJumpTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCPoint position, cocos2d::ccTime height, int jumps)
CCJumpTo* CCJumpTo::actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, int jumps)
{
CCJumpTo *pJumpTo = new CCJumpTo();
pJumpTo->initWithDuration(duration, position, height, jumps);
@ -1231,7 +1231,7 @@ static inline float bezierat( float a, float b, float c, float d, ccTime t )
//
// BezierBy
//
CCBezierBy* CCBezierBy::actionWithDuration(cocos2d::ccTime t, cocos2d::ccBezierConfig c)
CCBezierBy* CCBezierBy::actionWithDuration(ccTime t, const ccBezierConfig& c)
{
CCBezierBy *pBezierBy = new CCBezierBy();
pBezierBy->initWithDuration(t, c);
@ -1240,7 +1240,7 @@ CCBezierBy* CCBezierBy::actionWithDuration(cocos2d::ccTime t, cocos2d::ccBezierC
return pBezierBy;
}
bool CCBezierBy::initWithDuration(cocos2d::ccTime t, cocos2d::ccBezierConfig c)
bool CCBezierBy::initWithDuration(ccTime t, const ccBezierConfig& c)
{
if (CCActionInterval::initWithDuration(t))
{
@ -1257,7 +1257,7 @@ void CCBezierBy::startWithTarget(CCNode *pTarget)
m_startPosition = pTarget->getPosition();
}
CCObject* CCBezierBy::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCBezierBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCBezierBy* pCopy = NULL;
@ -1280,7 +1280,7 @@ CCObject* CCBezierBy::copyWithZone(cocos2d::CCZone *pZone)
return pCopy;
}
void CCBezierBy::update(cocos2d::ccTime time)
void CCBezierBy::update(ccTime time)
{
if (m_pTarget)
{
@ -1315,7 +1315,7 @@ CCActionInterval* CCBezierBy::reverse(void)
//
// BezierTo
//
CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, ccBezierConfig c)
CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, const ccBezierConfig& c)
{
CCBezierTo *pBezierTo = new CCBezierTo();
pBezierTo->initWithDuration(t, c);
@ -1324,7 +1324,7 @@ CCBezierTo* CCBezierTo::actionWithDuration(ccTime t, ccBezierConfig c)
return pBezierTo;
}
CCObject* CCBezierTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCBezierTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCBezierBy* pCopy = NULL;
@ -1358,7 +1358,7 @@ void CCBezierTo::startWithTarget(CCNode *pTarget)
//
// ScaleTo
//
CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float s)
CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float s)
{
CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, s);
@ -1367,7 +1367,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float s)
return pScaleTo;
}
bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float s)
bool CCScaleTo::initWithDuration(ccTime duration, float s)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1380,7 +1380,7 @@ bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float s)
return false;
}
CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float sx, float sy)
CCScaleTo* CCScaleTo::actionWithDuration(ccTime duration, float sx, float sy)
{
CCScaleTo *pScaleTo = new CCScaleTo();
pScaleTo->initWithDuration(duration, sx, sy);
@ -1389,7 +1389,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float sx, flo
return pScaleTo;
}
bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float sx, float sy)
bool CCScaleTo::initWithDuration(ccTime duration, float sx, float sy)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1402,7 +1402,7 @@ bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float sx, float sy)
return false;
}
CCObject* CCScaleTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCScaleTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCScaleTo* pCopy = NULL;
@ -1435,7 +1435,7 @@ void CCScaleTo::startWithTarget(CCNode *pTarget)
m_fDeltaY = m_fEndScaleY - m_fStartScaleY;
}
void CCScaleTo::update(cocos2d::ccTime time)
void CCScaleTo::update(ccTime time)
{
if (m_pTarget)
{
@ -1447,7 +1447,7 @@ void CCScaleTo::update(cocos2d::ccTime time)
//
// ScaleBy
//
CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float s)
CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float s)
{
CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, s);
@ -1456,7 +1456,7 @@ CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float s)
return pScaleBy;
}
CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float sx, float sy)
CCScaleBy* CCScaleBy::actionWithDuration(ccTime duration, float sx, float sy)
{
CCScaleBy *pScaleBy = new CCScaleBy();
pScaleBy->initWithDuration(duration, sx, sy);
@ -1465,7 +1465,7 @@ CCScaleBy* CCScaleBy::actionWithDuration(cocos2d::ccTime duration, float sx, flo
return pScaleBy;
}
CCObject* CCScaleBy::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCScaleBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCScaleTo* pCopy = NULL;
@ -1504,7 +1504,7 @@ CCActionInterval* CCScaleBy::reverse(void)
//
// Blink
//
CCBlink* CCBlink::actionWithDuration(cocos2d::ccTime duration, unsigned int uBlinks)
CCBlink* CCBlink::actionWithDuration(ccTime duration, unsigned int uBlinks)
{
CCBlink *pBlink = new CCBlink();
pBlink->initWithDuration(duration, uBlinks);
@ -1513,7 +1513,7 @@ CCBlink* CCBlink::actionWithDuration(cocos2d::ccTime duration, unsigned int uBli
return pBlink;
}
bool CCBlink::initWithDuration(cocos2d::ccTime duration, unsigned int uBlinks)
bool CCBlink::initWithDuration(ccTime duration, unsigned int uBlinks)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1524,7 +1524,7 @@ bool CCBlink::initWithDuration(cocos2d::ccTime duration, unsigned int uBlinks)
return false;
}
CCObject* CCBlink::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCBlink::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCBlink* pCopy = NULL;
@ -1548,7 +1548,7 @@ CCObject* CCBlink::copyWithZone(cocos2d::CCZone *pZone)
return pCopy;
}
void CCBlink::update(cocos2d::ccTime time)
void CCBlink::update(ccTime time)
{
if (m_pTarget && ! isDone())
{
@ -1567,7 +1567,7 @@ CCActionInterval* CCBlink::reverse(void)
//
// FadeIn
//
CCFadeIn* CCFadeIn::actionWithDuration(cocos2d::ccTime d)
CCFadeIn* CCFadeIn::actionWithDuration(ccTime d)
{
CCFadeIn* pAction = new CCFadeIn();
@ -1577,7 +1577,7 @@ CCFadeIn* CCFadeIn::actionWithDuration(cocos2d::ccTime d)
return pAction;
}
CCObject* CCFadeIn::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCFadeIn::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCFadeIn* pCopy = NULL;
@ -1599,7 +1599,7 @@ CCObject* CCFadeIn::copyWithZone(cocos2d::CCZone *pZone)
return pCopy;
}
void CCFadeIn::update(cocos2d::ccTime time)
void CCFadeIn::update(ccTime time)
{
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol)
@ -1617,7 +1617,7 @@ CCActionInterval* CCFadeIn::reverse(void)
//
// FadeOut
//
CCFadeOut* CCFadeOut::actionWithDuration(cocos2d::ccTime d)
CCFadeOut* CCFadeOut::actionWithDuration(ccTime d)
{
CCFadeOut* pAction = new CCFadeOut();
@ -1627,7 +1627,7 @@ CCFadeOut* CCFadeOut::actionWithDuration(cocos2d::ccTime d)
return pAction;
}
CCObject* CCFadeOut::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCFadeOut::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCFadeOut* pCopy = NULL;
@ -1649,7 +1649,7 @@ CCObject* CCFadeOut::copyWithZone(cocos2d::CCZone *pZone)
return pCopy;
}
void CCFadeOut::update(cocos2d::ccTime time)
void CCFadeOut::update(ccTime time)
{
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol)
@ -1667,7 +1667,7 @@ CCActionInterval* CCFadeOut::reverse(void)
//
// FadeTo
//
CCFadeTo* CCFadeTo::actionWithDuration(cocos2d::ccTime duration, GLubyte opacity)
CCFadeTo* CCFadeTo::actionWithDuration(ccTime duration, GLubyte opacity)
{
CCFadeTo *pFadeTo = new CCFadeTo();
pFadeTo->initWithDuration(duration, opacity);
@ -1676,7 +1676,7 @@ CCFadeTo* CCFadeTo::actionWithDuration(cocos2d::ccTime duration, GLubyte opacity
return pFadeTo;
}
bool CCFadeTo::initWithDuration(cocos2d::ccTime duration, GLubyte opacity)
bool CCFadeTo::initWithDuration(ccTime duration, GLubyte opacity)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1687,7 +1687,7 @@ bool CCFadeTo::initWithDuration(cocos2d::ccTime duration, GLubyte opacity)
return false;
}
CCObject* CCFadeTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCFadeTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCFadeTo* pCopy = NULL;
@ -1722,7 +1722,7 @@ void CCFadeTo::startWithTarget(CCNode *pTarget)
/*m_fromOpacity = pTarget->getOpacity();*/
}
void CCFadeTo::update(cocos2d::ccTime time)
void CCFadeTo::update(ccTime time)
{
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol)
@ -1735,7 +1735,7 @@ void CCFadeTo::update(cocos2d::ccTime time)
//
// TintTo
//
CCTintTo* CCTintTo::actionWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
CCTintTo* CCTintTo::actionWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
{
CCTintTo *pTintTo = new CCTintTo();
pTintTo->initWithDuration(duration, red, green, blue);
@ -1744,7 +1744,7 @@ CCTintTo* CCTintTo::actionWithDuration(cocos2d::ccTime duration, GLubyte red, GL
return pTintTo;
}
bool CCTintTo::initWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
bool CCTintTo::initWithDuration(ccTime duration, GLubyte red, GLubyte green, GLubyte blue)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1755,7 +1755,7 @@ bool CCTintTo::initWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte g
return false;
}
CCObject* CCTintTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCTintTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCTintTo* pCopy = NULL;
@ -1789,7 +1789,7 @@ void CCTintTo::startWithTarget(CCNode *pTarget)
/*m_from = pTarget->getColor();*/
}
void CCTintTo::update(cocos2d::ccTime time)
void CCTintTo::update(ccTime time)
{
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol)
@ -1803,7 +1803,7 @@ void CCTintTo::update(cocos2d::ccTime time)
//
// TintBy
//
CCTintBy* CCTintBy::actionWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
CCTintBy* CCTintBy::actionWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{
CCTintBy *pTintBy = new CCTintBy();
pTintBy->initWithDuration(duration, deltaRed, deltaGreen, deltaBlue);
@ -1812,7 +1812,7 @@ CCTintBy* CCTintBy::actionWithDuration(cocos2d::ccTime duration, GLshort deltaRe
return pTintBy;
}
bool CCTintBy::initWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
bool CCTintBy::initWithDuration(ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -1826,7 +1826,7 @@ bool CCTintBy::initWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLsh
return false;
}
CCObject* CCTintBy::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCTintBy::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCTintBy* pCopy = NULL;
@ -1863,7 +1863,7 @@ void CCTintBy::startWithTarget(CCNode *pTarget)
}
}
void CCTintBy::update(cocos2d::ccTime time)
void CCTintBy::update(ccTime time)
{
CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol();
if (pRGBAProtocol)
@ -1882,7 +1882,7 @@ CCActionInterval* CCTintBy::reverse(void)
//
// DelayTime
//
CCDelayTime* CCDelayTime::actionWithDuration(cocos2d::ccTime d)
CCDelayTime* CCDelayTime::actionWithDuration(ccTime d)
{
CCDelayTime* pAction = new CCDelayTime();
@ -1892,7 +1892,7 @@ CCDelayTime* CCDelayTime::actionWithDuration(cocos2d::ccTime d)
return pAction;
}
CCObject* CCDelayTime::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCDelayTime::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCDelayTime* pCopy = NULL;
@ -1915,7 +1915,7 @@ CCObject* CCDelayTime::copyWithZone(cocos2d::CCZone *pZone)
return pCopy;
}
void CCDelayTime::update(cocos2d::ccTime time)
void CCDelayTime::update(ccTime time)
{
CC_UNUSED_PARAM(time);
return;
@ -1929,7 +1929,7 @@ CCActionInterval* CCDelayTime::reverse(void)
//
// ReverseTime
//
CCReverseTime* CCReverseTime::actionWithAction(cocos2d::CCFiniteTimeAction *pAction)
CCReverseTime* CCReverseTime::actionWithAction(CCFiniteTimeAction *pAction)
{
// casting to prevent warnings
CCReverseTime *pReverseTime = new CCReverseTime();
@ -1939,7 +1939,7 @@ CCReverseTime* CCReverseTime::actionWithAction(cocos2d::CCFiniteTimeAction *pAct
return pReverseTime;
}
bool CCReverseTime::initWithAction(cocos2d::CCFiniteTimeAction *pAction)
bool CCReverseTime::initWithAction(CCFiniteTimeAction *pAction)
{
assert(pAction != NULL);
assert(pAction != m_pOther);
@ -1958,7 +1958,7 @@ bool CCReverseTime::initWithAction(cocos2d::CCFiniteTimeAction *pAction)
return false;
}
CCObject* CCReverseTime::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCReverseTime::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCReverseTime* pCopy = NULL;
@ -2003,7 +2003,7 @@ void CCReverseTime::stop(void)
CCActionInterval::stop();
}
void CCReverseTime::update(cocos2d::ccTime time)
void CCReverseTime::update(ccTime time)
{
if (m_pOther)
{
@ -2019,7 +2019,7 @@ CCActionInterval* CCReverseTime::reverse(void)
//
// Animate
//
CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation)
CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation)
{
CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithAnimation(pAnimation, true);
@ -2028,14 +2028,14 @@ CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation)
return pAnimate;
}
bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation)
bool CCAnimate::initWithAnimation(CCAnimation *pAnimation)
{
assert(pAnimation != NULL);
return initWithAnimation(pAnimation, true);
}
CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame)
CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{
CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithAnimation(pAnimation, bRestoreOriginalFrame);
@ -2044,7 +2044,7 @@ CCAnimate* CCAnimate::actionWithAnimation(cocos2d::CCAnimation *pAnimation, bool
return pAnimate;
}
bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame)
bool CCAnimate::initWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{
assert(pAnimation);
@ -2061,7 +2061,7 @@ bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestor
return false;
}
CCAnimate* CCAnimate::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame)
CCAnimate* CCAnimate::actionWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{
CCAnimate *pAnimate = new CCAnimate();
pAnimate->initWithDuration(duration, pAnimation, bRestoreOriginalFrame);
@ -2070,7 +2070,7 @@ CCAnimate* CCAnimate::actionWithDuration(cocos2d::ccTime duration, cocos2d::CCAn
return pAnimate;
}
bool CCAnimate::initWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation *pAnimation, bool bRestoreOriginalFrame)
bool CCAnimate::initWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame)
{
assert(pAnimation != NULL);
@ -2087,7 +2087,7 @@ bool CCAnimate::initWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation
return false;
}
CCObject* CCAnimate::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCAnimate::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCAnimate* pCopy = NULL;
@ -2140,7 +2140,7 @@ void CCAnimate::stop(void)
CCActionInterval::stop();
}
void CCAnimate::update(cocos2d::ccTime time)
void CCAnimate::update(ccTime time)
{
CCMutableArray<CCSpriteFrame*> *pFrames = m_pAnimation->getFrames();
unsigned int numberOfFrames = pFrames->count();

View File

@ -189,7 +189,7 @@ void CCActionManager::resumeTarget(CCObject *pTarget)
// run
void CCActionManager::addAction(cocos2d::CCAction *pAction, CCNode *pTarget, bool paused)
void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused)
{
assert(pAction != NULL);
assert(pTarget != NULL);
@ -261,7 +261,7 @@ void CCActionManager::removeAllActionsFromTarget(CCObject *pTarget)
}
}
void CCActionManager::removeAction(cocos2d::CCAction *pAction)
void CCActionManager::removeAction(CCAction *pAction)
{
// explicit null handling
if (pAction == NULL)
@ -357,7 +357,7 @@ unsigned int CCActionManager::numberOfRunningActionsInTarget(CCObject *pTarget)
}
// main loop
void CCActionManager::update(cocos2d::ccTime dt)
void CCActionManager::update(ccTime dt)
{
for (tHashElement *elt = m_pTargets; elt != NULL; )
{

View File

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

View File

@ -31,7 +31,7 @@ namespace cocos2d
// implementation of CCProgressTo
CCProgressTo* CCProgressTo::actionWithDuration(cocos2d::ccTime duration, float fPercent)
CCProgressTo* CCProgressTo::actionWithDuration(ccTime duration, float fPercent)
{
CCProgressTo *pProgressTo = new CCProgressTo();
pProgressTo->initWithDuration(duration, fPercent);
@ -40,7 +40,7 @@ namespace cocos2d
return pProgressTo;
}
bool CCProgressTo::initWithDuration(cocos2d::ccTime duration, float fPercent)
bool CCProgressTo::initWithDuration(ccTime duration, float fPercent)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -52,7 +52,7 @@ namespace cocos2d
return false;
}
CCObject* CCProgressTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCProgressTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCProgressTo* pCopy = NULL;
@ -88,14 +88,14 @@ namespace cocos2d
}
}
void CCProgressTo::update(cocos2d::ccTime time)
void CCProgressTo::update(ccTime time)
{
((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time);
}
// implementation of CCProgressFromTo
CCProgressFromTo* CCProgressFromTo::actionWithDuration(cocos2d::ccTime duration, float fFromPercentage, float fToPercentage)
CCProgressFromTo* CCProgressFromTo::actionWithDuration(ccTime duration, float fFromPercentage, float fToPercentage)
{
CCProgressFromTo *pProgressFromTo = new CCProgressFromTo();
pProgressFromTo->initWithDuration(duration, fFromPercentage, fToPercentage);
@ -104,7 +104,7 @@ namespace cocos2d
return pProgressFromTo;
}
bool CCProgressFromTo::initWithDuration(cocos2d::ccTime duration, float fFromPercentage, float fToPercentage)
bool CCProgressFromTo::initWithDuration(ccTime duration, float fFromPercentage, float fToPercentage)
{
if (CCActionInterval::initWithDuration(duration))
{
@ -117,7 +117,7 @@ namespace cocos2d
return false;
}
CCObject* CCProgressFromTo::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCProgressFromTo::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCProgressFromTo* pCopy = NULL;
@ -150,7 +150,7 @@ namespace cocos2d
CCActionInterval::startWithTarget(pTarget);
}
void CCProgressFromTo::update(cocos2d::ccTime time)
void CCProgressFromTo::update(ccTime time)
{
((kProgressTimerCast)(m_pTarget))->setPercentage(m_fFrom + (m_fTo - m_fFrom) * time);
}

View File

@ -41,7 +41,7 @@ namespace cocos2d
// implementation of ShakyTiles3D
CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCShakyTiles3D* CCShakyTiles3D::actionWithRange(int nRange, bool bShakeZ,const ccGridSize& gridSize, ccTime duration)
{
CCShakyTiles3D *pAction = new CCShakyTiles3D();
@ -60,7 +60,7 @@ namespace cocos2d
return pAction;
}
bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCShakyTiles3D::initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize, ccTime duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -73,7 +73,7 @@ namespace cocos2d
return false;
}
CCObject* CCShakyTiles3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCShakyTiles3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCShakyTiles3D* pCopy = NULL;
@ -96,7 +96,7 @@ namespace cocos2d
return pCopy;
}
void CCShakyTiles3D::update(cocos2d::ccTime time)
void CCShakyTiles3D::update(ccTime time)
{
CC_UNUSED_PARAM(time);
int i, j;
@ -134,7 +134,7 @@ namespace cocos2d
// implementation of CCShatteredTiles3D
CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCShatteredTiles3D* CCShatteredTiles3D::actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, ccTime duration)
{
CCShatteredTiles3D *pAction = new CCShatteredTiles3D();
@ -153,7 +153,7 @@ namespace cocos2d
return pAction;
}
bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCShatteredTiles3D::initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize, ccTime duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -167,7 +167,7 @@ namespace cocos2d
return false;
}
CCObject* CCShatteredTiles3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCShatteredTiles3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCShatteredTiles3D* pCopy = NULL;
@ -190,7 +190,7 @@ namespace cocos2d
return pCopy;
}
void CCShatteredTiles3D::update(cocos2d::ccTime time)
void CCShatteredTiles3D::update(ccTime time)
{
CC_UNUSED_PARAM(time);
int i, j;
@ -233,7 +233,7 @@ namespace cocos2d
// implementation of CCShuffleTiles
CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCShuffleTiles* CCShuffleTiles::actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{
CCShuffleTiles *pAction = new CCShuffleTiles();
@ -252,7 +252,7 @@ namespace cocos2d
return pAction;
}
bool CCShuffleTiles::initWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCShuffleTiles::initWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -266,7 +266,7 @@ namespace cocos2d
return false;
}
CCObject* CCShuffleTiles::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCShuffleTiles::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCShuffleTiles* pCopy = NULL;
@ -306,7 +306,7 @@ namespace cocos2d
}
}
ccGridSize CCShuffleTiles::getDelta(cocos2d::ccGridSize pos)
ccGridSize CCShuffleTiles::getDelta(const ccGridSize& pos)
{
CCPoint pos2;
@ -318,7 +318,7 @@ namespace cocos2d
return ccg((int)(pos2.x - pos.x), (int)(pos2.y - pos.y));
}
void CCShuffleTiles::placeTile(ccGridSize pos, Tile *t)
void CCShuffleTiles::placeTile(const ccGridSize& pos, Tile *t)
{
ccQuad3 coords = originalTile(pos);
@ -378,7 +378,7 @@ namespace cocos2d
}
}
void CCShuffleTiles::update(cocos2d::ccTime time)
void CCShuffleTiles::update(ccTime time)
{
int i, j;
@ -397,7 +397,7 @@ namespace cocos2d
// implementation of CCFadeOutTRTiles
CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time)
CCFadeOutTRTiles* CCFadeOutTRTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{
CCFadeOutTRTiles *pAction = new CCFadeOutTRTiles();
@ -416,7 +416,7 @@ namespace cocos2d
return pAction;
}
float CCFadeOutTRTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time)
float CCFadeOutTRTiles::testFunc(const ccGridSize& pos, ccTime time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
if ((n.x + n.y) == 0.0f)
@ -427,19 +427,19 @@ namespace cocos2d
return powf((pos.x + pos.y) / (n.x + n.y), 6);
}
void CCFadeOutTRTiles::turnOnTile(cocos2d::ccGridSize pos)
void CCFadeOutTRTiles::turnOnTile(const ccGridSize& pos)
{
setTile(pos, originalTile(pos));
}
void CCFadeOutTRTiles::turnOffTile(cocos2d::ccGridSize pos)
void CCFadeOutTRTiles::turnOffTile(const ccGridSize& pos)
{
ccQuad3 coords;
memset(&coords, 0, sizeof(ccQuad3));
setTile(pos, coords);
}
void CCFadeOutTRTiles::transformTile(cocos2d::ccGridSize pos, float distance)
void CCFadeOutTRTiles::transformTile(const ccGridSize& pos, float distance)
{
ccQuad3 coords = originalTile(pos);
CCPoint step = m_pTarget->getGrid()->getStep();
@ -459,7 +459,7 @@ namespace cocos2d
setTile(pos, coords);
}
void CCFadeOutTRTiles::update(cocos2d::ccTime time)
void CCFadeOutTRTiles::update(ccTime time)
{
int i, j;
@ -485,7 +485,7 @@ namespace cocos2d
}
// implementation of CCFadeOutBLTiles
CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time)
CCFadeOutBLTiles* CCFadeOutBLTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{
CCFadeOutBLTiles *pAction = new CCFadeOutBLTiles();
@ -504,7 +504,7 @@ namespace cocos2d
return pAction;
}
float CCFadeOutBLTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time)
float CCFadeOutBLTiles::testFunc(const ccGridSize& pos, ccTime time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if ((pos.x + pos.y) == 0)
@ -517,7 +517,7 @@ namespace cocos2d
// implementation of CCFadeOutUpTiles
CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time)
CCFadeOutUpTiles* CCFadeOutUpTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{
CCFadeOutUpTiles *pAction = new CCFadeOutUpTiles();
@ -536,7 +536,7 @@ namespace cocos2d
return pAction;
}
float CCFadeOutUpTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time)
float CCFadeOutUpTiles::testFunc(const ccGridSize& pos, ccTime time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), time);
if (n.y == 0.0f)
@ -547,7 +547,7 @@ namespace cocos2d
return powf(pos.y / n.y, 6);
}
void CCFadeOutUpTiles::transformTile(cocos2d::ccGridSize pos, float distance)
void CCFadeOutUpTiles::transformTile(const ccGridSize& pos, float distance)
{
ccQuad3 coords = originalTile(pos);
CCPoint step = m_pTarget->getGrid()->getStep();
@ -561,7 +561,7 @@ namespace cocos2d
}
// implementation of CCFadeOutDownTiles
CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime time)
CCFadeOutDownTiles* CCFadeOutDownTiles::actionWithSize(const ccGridSize& gridSize, ccTime time)
{
CCFadeOutDownTiles *pAction = new CCFadeOutDownTiles();
@ -580,7 +580,7 @@ namespace cocos2d
return pAction;
}
float CCFadeOutDownTiles::testFunc(cocos2d::ccGridSize pos, cocos2d::ccTime time)
float CCFadeOutDownTiles::testFunc(const ccGridSize& pos, ccTime time)
{
CCPoint n = ccpMult(ccp((float)m_sGridSize.x, (float)m_sGridSize.y), (1.0f - time));
if (pos.y == 0)
@ -592,7 +592,7 @@ namespace cocos2d
}
// implementation of TurnOffTiles
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(ccGridSize size, ccTime d)
CCTurnOffTiles* CCTurnOffTiles::actionWithSize(const ccGridSize& size, ccTime d)
{
CCTurnOffTiles* pAction = new CCTurnOffTiles();
if (pAction->initWithSize(size, d))
@ -606,7 +606,7 @@ namespace cocos2d
return pAction;
}
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCTurnOffTiles* CCTurnOffTiles::actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{
CCTurnOffTiles *pAction = new CCTurnOffTiles();
@ -625,7 +625,7 @@ namespace cocos2d
return pAction;
}
bool CCTurnOffTiles::initWithSeed(int s, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCTurnOffTiles::initWithSeed(int s, const ccGridSize& gridSize, ccTime duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -638,7 +638,7 @@ namespace cocos2d
return false;
}
CCObject* CCTurnOffTiles::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCTurnOffTiles::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCTurnOffTiles* pCopy = NULL;
@ -677,12 +677,12 @@ namespace cocos2d
}
}
void CCTurnOffTiles::turnOnTile(cocos2d::ccGridSize pos)
void CCTurnOffTiles::turnOnTile(const ccGridSize& pos)
{
setTile(pos, originalTile(pos));
}
void CCTurnOffTiles::turnOffTile(cocos2d::ccGridSize pos)
void CCTurnOffTiles::turnOffTile(const ccGridSize& pos)
{
ccQuad3 coords;
@ -712,7 +712,7 @@ namespace cocos2d
shuffle(m_pTilesOrder, m_nTilesCount);
}
void CCTurnOffTiles::update(cocos2d::ccTime time)
void CCTurnOffTiles::update(ccTime time)
{
unsigned int i, l, t;
@ -736,7 +736,7 @@ namespace cocos2d
// implementation of CCWavesTiles3D
CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCWavesTiles3D* CCWavesTiles3D::actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
CCWavesTiles3D *pAction = new CCWavesTiles3D();
@ -755,7 +755,7 @@ namespace cocos2d
return pAction;
}
bool CCWavesTiles3D::initWithWaves(int wav, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCWavesTiles3D::initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -769,7 +769,7 @@ namespace cocos2d
return false;
}
CCObject* CCWavesTiles3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCWavesTiles3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCWavesTiles3D* pCopy = NULL;
@ -791,7 +791,7 @@ namespace cocos2d
return pCopy;
}
void CCWavesTiles3D::update(cocos2d::ccTime time)
void CCWavesTiles3D::update(ccTime time)
{
int i, j;
@ -814,7 +814,7 @@ namespace cocos2d
// implementation of CCJumpTiles3D
CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
CCJumpTiles3D* CCJumpTiles3D::actionWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration)
{
CCJumpTiles3D *pAction = new CCJumpTiles3D();
@ -833,7 +833,7 @@ namespace cocos2d
return pAction;
}
bool CCJumpTiles3D::initWithJumps(int j, float amp, cocos2d::ccGridSize gridSize, cocos2d::ccTime duration)
bool CCJumpTiles3D::initWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration)
{
if (CCTiledGrid3DAction::initWithSize(gridSize, duration))
{
@ -847,7 +847,7 @@ namespace cocos2d
return false;
}
CCObject* CCJumpTiles3D::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCJumpTiles3D::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCJumpTiles3D* pCopy = NULL;
@ -868,7 +868,7 @@ namespace cocos2d
return pCopy;
}
void CCJumpTiles3D::update(cocos2d::ccTime time)
void CCJumpTiles3D::update(ccTime time)
{
int i, j;
@ -903,7 +903,7 @@ namespace cocos2d
// implementation of CCSplitRows
CCSplitRows* CCSplitRows::actionWithRows(int nRows, cocos2d::ccTime duration)
CCSplitRows* CCSplitRows::actionWithRows(int nRows, ccTime duration)
{
CCSplitRows *pAction = new CCSplitRows();
@ -922,14 +922,14 @@ namespace cocos2d
return pAction;
}
bool CCSplitRows::initWithRows(int nRows, cocos2d::ccTime duration)
bool CCSplitRows::initWithRows(int nRows, ccTime duration)
{
m_nRows = nRows;
return CCTiledGrid3DAction::initWithSize(ccg(1, nRows), duration);
}
CCObject* CCSplitRows::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCSplitRows::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCSplitRows* pCopy = NULL;
@ -957,7 +957,7 @@ namespace cocos2d
m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
}
void CCSplitRows::update(cocos2d::ccTime time)
void CCSplitRows::update(ccTime time)
{
int j;
@ -982,7 +982,7 @@ namespace cocos2d
// implementation of CCSplitCols
CCSplitCols* CCSplitCols::actionWithCols(int nCols, cocos2d::ccTime duration)
CCSplitCols* CCSplitCols::actionWithCols(int nCols, ccTime duration)
{
CCSplitCols *pAction = new CCSplitCols();
@ -1001,13 +1001,13 @@ namespace cocos2d
return pAction;
}
bool CCSplitCols::initWithCols(int nCols, cocos2d::ccTime duration)
bool CCSplitCols::initWithCols(int nCols, ccTime duration)
{
m_nCols = nCols;
return CCTiledGrid3DAction::initWithSize(ccg(nCols, 1), duration);
}
CCObject* CCSplitCols::copyWithZone(cocos2d::CCZone *pZone)
CCObject* CCSplitCols::copyWithZone(CCZone *pZone)
{
CCZone* pNewZone = NULL;
CCSplitCols* pCopy = NULL;
@ -1034,7 +1034,7 @@ namespace cocos2d
m_winSize = CCDirector::sharedDirector()->getWinSizeInPixels();
}
void CCSplitCols::update(cocos2d::ccTime time)
void CCSplitCols::update(ccTime time)
{
int i;

View File

@ -104,7 +104,7 @@ bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, uns
void CCAtlasNode::calculateMaxItems()
{
CCSize s = m_pTextureAtlas->getTexture()->getContentSizeInPixels();
const CCSize& s = m_pTextureAtlas->getTexture()->getContentSizeInPixels();
m_uItemsPerColumn = (int)(s.height / m_uItemHeight);
m_uItemsPerRow = (int)(s.width / m_uItemWidth);
}
@ -151,7 +151,7 @@ void CCAtlasNode::draw()
// CCAtlasNode - RGBA protocol
ccColor3B CCAtlasNode:: getColor()
const ccColor3B& CCAtlasNode:: getColor()
{
if(m_bIsOpacityModifyRGB)
{
@ -160,7 +160,7 @@ ccColor3B CCAtlasNode:: getColor()
return m_tColor;
}
void CCAtlasNode::setColor(ccColor3B color3)
void CCAtlasNode::setColor(const ccColor3B& color3)
{
m_tColor = m_tColorUnmodified = color3;

View File

@ -243,13 +243,13 @@ void CCNode::setScaleY(float newScaleY)
}
/// position getter
CCPoint CCNode::getPosition()
const CCPoint& CCNode::getPosition()
{
return m_tPosition;
}
/// position setter
void CCNode::setPosition(CCPoint newPosition)
void CCNode::setPosition(const CCPoint& newPosition)
{
m_tPosition = newPosition;
if (CC_CONTENT_SCALE_FACTOR() == 1)
@ -267,7 +267,7 @@ void CCNode::setPosition(CCPoint newPosition)
#endif
}
void CCNode::setPositionInPixels(CCPoint newPosition)
void CCNode::setPositionInPixels(const CCPoint& newPosition)
{
m_tPositionInPixels = newPosition;
@ -287,7 +287,7 @@ void CCNode::setPositionInPixels(CCPoint newPosition)
#endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX
}
CCPoint CCNode::getPositionInPixels()
const CCPoint& CCNode::getPositionInPixels()
{
return m_tPositionInPixels;
}
@ -339,12 +339,12 @@ void CCNode::setIsVisible(bool var)
/// anchorPoint getter
CCPoint CCNode::getAnchorPoint()
const CCPoint& CCNode::getAnchorPoint()
{
return m_tAnchorPoint;
}
void CCNode::setAnchorPoint(CCPoint point)
void CCNode::setAnchorPoint(const CCPoint& point)
{
if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) )
{
@ -358,18 +358,18 @@ void CCNode::setAnchorPoint(CCPoint point)
}
/// anchorPointInPixels getter
CCPoint CCNode::getAnchorPointInPixels()
const CCPoint& CCNode::getAnchorPointInPixels()
{
return m_tAnchorPointInPixels;
}
/// contentSize getter
CCSize CCNode::getContentSize()
const CCSize& CCNode::getContentSize()
{
return m_tContentSize;
}
void CCNode::setContentSize(CCSize size)
void CCNode::setContentSize(const CCSize& size)
{
if( ! CCSize::CCSizeEqualToSize(size, m_tContentSize) )
{
@ -392,7 +392,7 @@ void CCNode::setContentSize(CCSize size)
}
}
void CCNode::setContentSizeInPixels(CCSize size)
void CCNode::setContentSizeInPixels(const CCSize& size)
{
if (! CCSize::CCSizeEqualToSize(size, m_tContentSizeInPixels))
{
@ -416,7 +416,7 @@ void CCNode::setContentSizeInPixels(CCSize size)
}
}
CCSize CCNode::getContentSizeInPixels()
const CCSize& CCNode::getContentSizeInPixels()
{
return m_tContentSizeInPixels;
}
@ -1071,7 +1071,7 @@ CCAffineTransform CCNode::worldToNodeTransform(void)
return CCAffineTransformInvert(this->nodeToWorldTransform());
}
CCPoint CCNode::convertToNodeSpace(CCPoint worldPoint)
CCPoint CCNode::convertToNodeSpace(const CCPoint& worldPoint)
{
CCPoint ret;
if(CC_CONTENT_SCALE_FACTOR() == 1)
@ -1088,7 +1088,7 @@ CCPoint CCNode::convertToNodeSpace(CCPoint worldPoint)
return ret;
}
CCPoint CCNode::convertToWorldSpace(CCPoint nodePoint)
CCPoint CCNode::convertToWorldSpace(const CCPoint& nodePoint)
{
CCPoint ret;
if(CC_CONTENT_SCALE_FACTOR() == 1)
@ -1105,7 +1105,7 @@ CCPoint CCNode::convertToWorldSpace(CCPoint nodePoint)
return ret;
}
CCPoint CCNode::convertToNodeSpaceAR(CCPoint worldPoint)
CCPoint CCNode::convertToNodeSpaceAR(const CCPoint& worldPoint)
{
CCPoint nodePoint = convertToNodeSpace(worldPoint);
CCPoint anchorInPoints;
@ -1121,7 +1121,7 @@ CCPoint CCNode::convertToNodeSpaceAR(CCPoint worldPoint)
return ccpSub(nodePoint, anchorInPoints);
}
CCPoint CCNode::convertToWorldSpaceAR(CCPoint nodePoint)
CCPoint CCNode::convertToWorldSpaceAR(const CCPoint& nodePoint)
{
CCPoint anchorInPoints;
if( CC_CONTENT_SCALE_FACTOR() == 1 )
@ -1133,10 +1133,10 @@ CCPoint CCNode::convertToWorldSpaceAR(CCPoint nodePoint)
anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() );
}
nodePoint = ccpAdd(nodePoint, anchorInPoints);
return convertToWorldSpace(nodePoint);
CCPoint pt = ccpAdd(nodePoint, anchorInPoints);
return convertToWorldSpace(pt);
}
CCPoint CCNode::convertToWindowSpace(CCPoint nodePoint)
CCPoint CCNode::convertToWindowSpace(const CCPoint& nodePoint)
{
CCPoint worldPoint = this->convertToWorldSpace(nodePoint);
return CCDirector::sharedDirector()->convertToUI(worldPoint);

View File

@ -37,7 +37,7 @@ CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFlo
return t;
}
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t)
CCPoint __CCPointApplyAffineTransform(const CCPoint& point, const CCAffineTransform& t)
{
CCPoint p;
p.x = (CGFloat)((double)t.a * point.x + (double)t.c * point.y + t.tx);
@ -45,7 +45,7 @@ CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t)
return p;
}
CCSize __CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t)
CCSize __CCSizeApplyAffineTransform(const CCSize& size, const CCAffineTransform& t)
{
CCSize s;
s.width = (CGFloat)((double)t.a * size.width + (double)t.c * size.height);
@ -62,7 +62,7 @@ CCAffineTransform CCAffineTransformMakeIdentity()
extern const CCAffineTransform CCAffineTransformIdentity = CCAffineTransformMakeIdentity();
CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransform)
CCRect CCRectApplyAffineTransform(const CCRect& rect, const CCAffineTransform& anAffineTransform)
{
CGFloat top = CCRect::CCRectGetMinY(rect);
CGFloat left = CCRect::CCRectGetMinX(rect);
@ -82,17 +82,17 @@ CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransfo
return CCRectMake(minX, minY, (maxX - minX), (maxY - minY));
}
CCAffineTransform CCAffineTransformTranslate(CCAffineTransform t, float tx, float ty)
CCAffineTransform CCAffineTransformTranslate(const CCAffineTransform& t, float tx, float ty)
{
return __CCAffineTransformMake(t.a, t.b, t.c, t.d, t.tx + t.a * tx + t.c * ty, t.ty + t.b * tx + t.d * ty);
}
CCAffineTransform CCAffineTransformScale(CCAffineTransform t, CGFloat sx, CGFloat sy)
CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CGFloat sx, CGFloat sy)
{
return __CCAffineTransformMake(t.a * sx, t.b * sx, t.c * sy, t.d * sy, t.tx, t.ty);
}
CCAffineTransform CCAffineTransformRotate(CCAffineTransform t, CGFloat anAngle)
CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& t, CGFloat anAngle)
{
float fSin = sin(anAngle);
float fCos = cos(anAngle);
@ -107,7 +107,7 @@ CCAffineTransform CCAffineTransformRotate(CCAffineTransform t, CGFloat anAngle)
/* Concatenate `t2' to `t1' and return the result:
t' = t1 * t2 */
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2)
CCAffineTransform CCAffineTransformConcat(const CCAffineTransform& t1, const CCAffineTransform& t2)
{
return __CCAffineTransformMake( t1.a * t2.a + t1.b * t2.c, t1.a * t2.b + t1.b * t2.d, //a,b
t1.c * t2.a + t1.d * t2.c, t1.c * t2.b + t1.d * t2.d, //c,d
@ -116,12 +116,12 @@ CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform
}
/* Return true if `t1' and `t2' are equal, false otherwise. */
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2)
bool CCAffineTransformEqualToTransform(const CCAffineTransform& t1, const CCAffineTransform& t2)
{
return (t1.a == t2.a && t1.b == t2.b && t1.c == t2.c && t1.d == t2.d && t1.tx == t2.tx && t1.ty == t2.ty);
}
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t)
CCAffineTransform CCAffineTransformInvert(const CCAffineTransform& t)
{
float determinant = 1 / (t.a * t.d - t.b * t.c);

View File

@ -46,7 +46,7 @@ namespace cocos2d
ccglGenFramebuffers(1, &m_fbo);
}
void CCGrabber::grab(cocos2d::CCTexture2D *pTexture)
void CCGrabber::grab(CCTexture2D *pTexture)
{
// If the gles version is lower than GLES_VER_1_0,
// all the functions in CCGrabber return directly.
@ -74,7 +74,7 @@ namespace cocos2d
ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_oldFBO);
}
void CCGrabber::beforeRender(cocos2d::CCTexture2D *pTexture)
void CCGrabber::beforeRender(CCTexture2D *pTexture)
{
CC_UNUSED_PARAM(pTexture);
// If the gles version is lower than GLES_VER_1_0,

View File

@ -35,7 +35,7 @@ namespace cocos2d
{
// implementation of CCGridBase
CCGridBase* CCGridBase::gridWithSize(cocos2d::ccGridSize gridSize)
CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize)
{
CCGridBase *pGridBase = new CCGridBase();
@ -54,7 +54,7 @@ namespace cocos2d
return pGridBase;
}
CCGridBase* CCGridBase::gridWithSize(ccGridSize gridSize, CCTexture2D *texture, bool flipped)
CCGridBase* CCGridBase::gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped)
{
CCGridBase *pGridBase = new CCGridBase();
@ -73,7 +73,7 @@ namespace cocos2d
return pGridBase;
}
bool CCGridBase::initWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped)
bool CCGridBase::initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
bool bRet = true;
@ -85,7 +85,7 @@ namespace cocos2d
CC_SAFE_RETAIN(m_pTexture);
m_bIsTextureFlipped = bFlipped;
CCSize texSize = m_pTexture->getContentSizeInPixels();
const CCSize& texSize = m_pTexture->getContentSizeInPixels();
m_obStep.x = texSize.width / m_sGridSize.x;
m_obStep.y = texSize.height / m_sGridSize.y;
@ -105,7 +105,7 @@ namespace cocos2d
return bRet;
}
bool CCGridBase::initWithSize(ccGridSize gridSize)
bool CCGridBase::initWithSize(const ccGridSize& gridSize)
{
CCDirector *pDirector = CCDirector::sharedDirector();
CCSize s = pDirector->getWinSizeInPixels();
@ -254,7 +254,7 @@ namespace cocos2d
if (pTarget->getCamera()->getDirty())
{
CCPoint offset = pTarget->getAnchorPointInPixels();
const CCPoint& offset = pTarget->getAnchorPointInPixels();
//
// XXX: Camera should be applied in the AnchorPoint
@ -289,7 +289,7 @@ namespace cocos2d
// implementation of CCGrid3D
CCGrid3D* CCGrid3D::gridWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped)
CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
CCGrid3D *pRet= new CCGrid3D();
@ -309,7 +309,7 @@ namespace cocos2d
return pRet;
}
CCGrid3D* CCGrid3D::gridWithSize(ccGridSize gridSize)
CCGrid3D* CCGrid3D::gridWithSize(const ccGridSize& gridSize)
{
CCGrid3D *pRet= new CCGrid3D();
@ -424,7 +424,7 @@ namespace cocos2d
memcpy(m_pOriginalVertices, m_pVertices, (m_sGridSize.x+1) * (m_sGridSize.y+1) * sizeof(ccVertex3F));
}
ccVertex3F CCGrid3D::vertex(ccGridSize pos)
ccVertex3F CCGrid3D::vertex(const ccGridSize& pos)
{
int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3;
float *vertArray = (float*)m_pVertices;
@ -434,7 +434,7 @@ namespace cocos2d
return vert;
}
ccVertex3F CCGrid3D::originalVertex(cocos2d::ccGridSize pos)
ccVertex3F CCGrid3D::originalVertex(const ccGridSize& pos)
{
int index = (pos.x * (m_sGridSize.y+1) + pos.y) * 3;
float *vertArray = (float*)m_pOriginalVertices;
@ -444,7 +444,7 @@ namespace cocos2d
return vert;
}
void CCGrid3D::setVertex(ccGridSize pos, ccVertex3F vertex)
void CCGrid3D::setVertex(const ccGridSize& pos, const ccVertex3F& vertex)
{
int index = (pos.x * (m_sGridSize.y + 1) + pos.y) * 3;
float *vertArray = (float*)m_pVertices;
@ -472,7 +472,7 @@ namespace cocos2d
CC_SAFE_FREE(m_pIndices);
}
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(cocos2d::ccGridSize gridSize, cocos2d::CCTexture2D *pTexture, bool bFlipped)
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped)
{
CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -492,7 +492,7 @@ namespace cocos2d
return pRet;
}
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(cocos2d::ccGridSize gridSize)
CCTiledGrid3D* CCTiledGrid3D::gridWithSize(const ccGridSize& gridSize)
{
CCTiledGrid3D *pRet= new CCTiledGrid3D();
@ -604,14 +604,14 @@ namespace cocos2d
memcpy(m_pOriginalVertices, m_pVertices, numQuads * 12 * sizeof(GLfloat));
}
void CCTiledGrid3D::setTile(cocos2d::ccGridSize pos, cocos2d::ccQuad3 coords)
void CCTiledGrid3D::setTile(const ccGridSize& pos, const ccQuad3& coords)
{
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pVertices;
memcpy(&vertArray[idx], &coords, sizeof(ccQuad3));
}
ccQuad3 CCTiledGrid3D::originalTile(ccGridSize pos)
ccQuad3 CCTiledGrid3D::originalTile(const ccGridSize& pos)
{
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pOriginalVertices;
@ -622,7 +622,7 @@ namespace cocos2d
return ret;
}
ccQuad3 CCTiledGrid3D::tile(cocos2d::ccGridSize pos)
ccQuad3 CCTiledGrid3D::tile(const ccGridSize& pos)
{
int idx = (m_sGridSize.y * pos.x + pos.y) * 4 * 3;
float *vertArray = (float*)m_pVertices;

View File

@ -52,19 +52,19 @@ namespace cocos2d
inline void setReuseGrid(int nReuseGrid) { m_nReuseGrid = nReuseGrid; }
/** size of the grid */
inline ccGridSize getGridSize(void) { return m_sGridSize; }
inline void setGridSize(ccGridSize gridSize) { m_sGridSize = gridSize; }
inline const ccGridSize& getGridSize(void) { return m_sGridSize; }
inline void setGridSize(const ccGridSize& gridSize) { m_sGridSize = gridSize; }
/** pixels between the grids */
inline CCPoint getStep(void) { return m_obStep; }
inline void setStep(CCPoint step) { m_obStep = step; }
inline const CCPoint& getStep(void) { return m_obStep; }
inline void setStep(const CCPoint& step) { m_obStep = step; }
/** is texture flipped */
inline bool isTextureFlipped(void) { return m_bIsTextureFlipped; }
void setIsTextureFlipped(bool bFlipped);
bool initWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped);
bool initWithSize(ccGridSize gridSize);
bool initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
bool initWithSize(const ccGridSize& gridSize);
void beforeDraw(void);
void afterDraw(CCNode *pTarget);
@ -73,8 +73,8 @@ namespace cocos2d
virtual void calculateVertexPoints(void);
public:
static CCGridBase* gridWithSize(ccGridSize gridSize, CCTexture2D *texture, bool flipped);
static CCGridBase* gridWithSize(ccGridSize gridSize);
static CCGridBase* gridWithSize(const ccGridSize& gridSize, CCTexture2D *texture, bool flipped);
static CCGridBase* gridWithSize(const ccGridSize& gridSize);
void set2DProjection(void);
void set3DProjection(void);
@ -100,19 +100,19 @@ namespace cocos2d
~CCGrid3D(void);
/** returns the vertex at a given position */
ccVertex3F vertex(ccGridSize pos);
ccVertex3F vertex(const ccGridSize& pos);
/** returns the original (non-transformed) vertex at a given position */
ccVertex3F originalVertex(ccGridSize pos);
ccVertex3F originalVertex(const ccGridSize& pos);
/** sets a new vertex at a given position */
void setVertex(ccGridSize pos, ccVertex3F vertex);
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
virtual void blit(void);
virtual void reuse(void);
virtual void calculateVertexPoints(void);
public:
static CCGrid3D* gridWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCGrid3D* gridWithSize(ccGridSize gridSize);
static CCGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCGrid3D* gridWithSize(const ccGridSize& gridSize);
protected:
GLvoid *m_pTexCoordinates;
@ -131,19 +131,19 @@ namespace cocos2d
~CCTiledGrid3D(void);
/** returns the tile at the given position */
ccQuad3 tile(ccGridSize pos);
ccQuad3 tile(const ccGridSize& pos);
/** returns the original tile (untransformed) at the given position */
ccQuad3 originalTile(ccGridSize pos);
ccQuad3 originalTile(const ccGridSize& pos);
/** sets a new tile */
void setTile(ccGridSize pos, ccQuad3 coords);
void setTile(const ccGridSize& pos, const ccQuad3& coords);
virtual void blit(void);
virtual void reuse(void);
virtual void calculateVertexPoints(void);
public:
static CCTiledGrid3D* gridWithSize(ccGridSize gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCTiledGrid3D* gridWithSize(ccGridSize gridSize);
static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
static CCTiledGrid3D* gridWithSize(const ccGridSize& gridSize);
protected:
GLvoid *m_pTexCoordinates;

View File

@ -219,7 +219,7 @@ public:
bool initWithTarget(CCNode *pFollowedNode);
/** initializes the action with a set boundary */
bool initWithTarget(CCNode *pFollowedNode, CCRect rect);
bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void step(ccTime dt);
@ -231,7 +231,7 @@ public:
static CCFollow* actionWithTarget(CCNode *pFollowedNode);
/** creates the action with a set boundary */
static CCFollow* actionWithTarget(CCNode *pFollowedNode, CCRect rect);
static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect);
protected:
// node to follow

View File

@ -41,13 +41,13 @@ namespace cocos2d
virtual CCActionInterval* reverse(void);
/** initializes the action with size and duration */
virtual bool initWithSize(ccGridSize gridSize, ccTime duration);
virtual bool initWithSize(const ccGridSize& gridSize, ccTime duration);
/** returns the grid */
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration */
static CCGridAction* actionWithSize(ccGridSize gridSize, ccTime duration);
static CCGridAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
protected:
ccGridSize m_sGridSize;
@ -63,15 +63,15 @@ namespace cocos2d
/** returns the grid */
virtual CCGridBase* getGrid(void);
/** returns the vertex than belongs to certain position in the grid */
ccVertex3F vertex(ccGridSize pos);
ccVertex3F vertex(const ccGridSize& pos);
/** returns the non-transformed vertex than belongs to certain position in the grid */
ccVertex3F originalVertex(ccGridSize pos);
ccVertex3F originalVertex(const ccGridSize& pos);
/** sets a new vertex to a certain position of the grid */
void setVertex(ccGridSize pos, ccVertex3F vertex);
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
public:
/** creates the action with size and duration */
static CCGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration);
static CCGrid3DAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
};
/** @brief Base class for CCTiledGrid3D actions */
@ -79,18 +79,18 @@ namespace cocos2d
{
public:
/** returns the tile that belongs to a certain position of the grid */
ccQuad3 tile(ccGridSize pos);
ccQuad3 tile(const ccGridSize& pos);
/** returns the non-transformed tile that belongs to a certain position of the grid */
ccQuad3 originalTile(ccGridSize pos);
ccQuad3 originalTile(const ccGridSize& pos);
/** sets a new tile to a certain position of the grid */
void setTile(ccGridSize pos, ccQuad3 coords);
void setTile(const ccGridSize& pos, const ccQuad3& coords);
/** returns the grid */
virtual CCGridBase* getGrid(void);
public:
/** creates the action with size and duration */
static CCTiledGrid3DAction* actionWithSize(ccGridSize gridSize, ccTime duration);
static CCTiledGrid3DAction* actionWithSize(const ccGridSize& gridSize, ccTime duration);
};
/** @brief CCAccelDeccelAmplitude action */

View File

@ -42,14 +42,14 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** init the action */
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** create the action */
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
static CCWaves3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nWaves;
@ -63,7 +63,7 @@ namespace cocos2d
public:
/** initializes the action with duration */
bool initWithDuration(ccTime duration);
virtual bool initWithSize(ccGridSize gridSize, ccTime duration);
virtual bool initWithSize(const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
@ -93,17 +93,17 @@ namespace cocos2d
/** Set lens center position */
inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; }
inline CCPoint getPosition(void) { return m_position; }
void setPosition(CCPoint position);
inline const CCPoint& getPosition(void) { return m_position; }
void setPosition(const CCPoint& position);
/** initializes the action with center position, radius, a grid size and duration */
bool initWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
bool initWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with center position, radius, a grid size and duration */
static CCLens3D* actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
static CCLens3D* actionWithPosition(const CCPoint& pos, float r, const ccGridSize& gridSize, ccTime duration);
protected:
/* lens center position */
CCPoint m_position;
@ -122,9 +122,9 @@ namespace cocos2d
{
public:
/** get center position */
inline CCPoint getPosition(void) { return m_position; }
inline const CCPoint& getPosition(void) { return m_position; }
/** set center position */
void setPosition(CCPoint position);
void setPosition(const CCPoint& position);
inline float getAmplitude(void) { return m_fAmplitude; }
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
@ -133,15 +133,15 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
bool initWithPosition(CCPoint pos, float r, int wav, float amp,
ccGridSize gridSize, ccTime duration);
bool initWithPosition(const CCPoint& pos, float r, int wav, float amp,
const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
static CCRipple3D* actionWithPosition(CCPoint pos, float r, int wav, float amp,
ccGridSize gridSize, ccTime duration);
static CCRipple3D* actionWithPosition(const CCPoint& pos, float r, int wav, float amp,
const ccGridSize& gridSize, ccTime duration);
protected:
/* center position */
CCPoint m_position;
@ -159,13 +159,13 @@ namespace cocos2d
{
public:
/** initializes the action with a range, shake Z vertices, a grid and duration */
bool initWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
bool initWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with a range, shake Z vertices, a grid and duration */
static CCShaky3D* actionWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
static CCShaky3D* actionWithRange(int range, bool shakeZ, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nRandrange;
@ -183,13 +183,13 @@ namespace cocos2d
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
/** initializes the action with amplitude, a grid and duration */
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with amplitude, a grid and duration */
static CCLiquid* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
static CCLiquid* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nWaves;
@ -208,14 +208,14 @@ namespace cocos2d
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, ccGridSize gridSize,
bool initWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize,
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, const ccGridSize& gridSize,
ccTime duration);
protected:
int m_nWaves;
@ -230,9 +230,9 @@ namespace cocos2d
{
public:
/** get twirl center */
inline CCPoint getPosition(void) { return m_position; }
inline const CCPoint& getPosition(void) { return m_position; }
/** set twirl center */
void setPosition(CCPoint position);
void setPosition(const CCPoint& position);
inline float getAmplitude(void) { return m_fAmplitude; }
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
@ -241,14 +241,14 @@ namespace cocos2d
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(CCPoint pos, int t, float amp, ccGridSize gridSize,
bool initWithPosition(const CCPoint& pos, int t, float amp, const ccGridSize& gridSize,
ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize,
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, const ccGridSize& gridSize,
ccTime duration);
protected:
/* twirl center */

View File

@ -157,9 +157,9 @@ namespace cocos2d {
CCPlace(){}
virtual ~CCPlace(){}
/** creates a Place action with a position */
static CCPlace * actionWithPosition(CCPoint pos);
static CCPlace * actionWithPosition(const CCPoint& pos);
/** Initializes a Place action with a position */
bool initWithPosition(CCPoint pos);
bool initWithPosition(const CCPoint& pos);
//super methods
virtual void startWithTarget(CCNode *pTarget);
virtual CCObject* copyWithZone(CCZone *pZone);
@ -201,7 +201,7 @@ namespace cocos2d {
virtual void execute();
//super methods
virtual void startWithTarget(CCNode *pTarget);
CCObject * copyWithZone(cocos2d::CCZone *pZone);
CCObject * copyWithZone(CCZone *pZone);
void registerScriptFunction(const char* pszFunctionName);

View File

@ -285,7 +285,7 @@ class CC_DLL CCMoveTo : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, CCPoint position);
bool initWithDuration(ccTime duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -293,7 +293,7 @@ public:
public:
/** creates the action */
static CCMoveTo* actionWithDuration(ccTime duration, CCPoint position);
static CCMoveTo* actionWithDuration(ccTime duration, const CCPoint& position);
protected:
CCPoint m_endPosition;
@ -309,7 +309,7 @@ class CC_DLL CCMoveBy : public CCMoveTo
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, CCPoint position);
bool initWithDuration(ccTime duration, const CCPoint& position);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -317,7 +317,7 @@ public:
public:
/** creates the action */
static CCMoveBy* actionWithDuration(ccTime duration, CCPoint position);
static CCMoveBy* actionWithDuration(ccTime duration, const CCPoint& position);
};
/** Skews a CCNode object to given angles by modifying it's skewX and skewY attributes
@ -366,7 +366,7 @@ class CC_DLL CCJumpBy : public CCActionInterval
{
public:
/** initializes the action */
bool initWithDuration(ccTime duration, CCPoint position, ccTime height, unsigned int jumps);
bool initWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -375,7 +375,7 @@ public:
public:
/** creates the action */
static CCJumpBy* actionWithDuration(ccTime duration, CCPoint position, ccTime height, unsigned int jumps);
static CCJumpBy* actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps);
protected:
CCPoint m_startPosition;
@ -394,7 +394,7 @@ public:
public:
/** creates the action */
static CCJumpTo* actionWithDuration(ccTime duration, CCPoint position, ccTime height, int jumps);
static CCJumpTo* actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, int jumps);
};
/** @typedef bezier configuration structure
@ -414,7 +414,7 @@ class CC_DLL CCBezierBy : public CCActionInterval
{
public:
/** initializes the action with a duration and a bezier configuration */
bool initWithDuration(ccTime t, ccBezierConfig c);
bool initWithDuration(ccTime t, const ccBezierConfig& c);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -423,7 +423,7 @@ public:
public:
/** creates the action with a duration and a bezier configuration */
static CCBezierBy* actionWithDuration(ccTime t, ccBezierConfig c);
static CCBezierBy* actionWithDuration(ccTime t, const ccBezierConfig& c);
protected:
ccBezierConfig m_sConfig;
@ -441,7 +441,7 @@ public:
public:
/** creates the action with a duration and a bezier configuration */
static CCBezierTo* actionWithDuration(ccTime t, ccBezierConfig c);
static CCBezierTo* actionWithDuration(ccTime t, const ccBezierConfig& c);
};
/** @brief Scales a CCNode object to a zoom factor by modifying it's scale attribute.

View File

@ -45,7 +45,7 @@ namespace cocos2d
public:
/** create the action */
static CCPageTurn3D* actionWithSize(ccGridSize gridSize, ccTime time);
static CCPageTurn3D* actionWithSize(const ccGridSize& gridSize, ccTime time);
};
}

View File

@ -34,7 +34,7 @@ namespace cocos2d
{
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, ccGridSize gridSize,
bool initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -42,7 +42,7 @@ namespace cocos2d
public:
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
ccTime duration);
protected:
@ -55,7 +55,7 @@ namespace cocos2d
{
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, ccGridSize gridSize,
bool initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
@ -63,7 +63,7 @@ namespace cocos2d
public:
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, ccGridSize gridSize,
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
ccTime duration);
protected:
@ -81,10 +81,10 @@ namespace cocos2d
public:
~CCShuffleTiles(void);
/** initializes the action with a random seed, the grid size and the duration */
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration);
bool initWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
void shuffle(int *pArray, unsigned int nLen);
ccGridSize getDelta(ccGridSize pos);
void placeTile(ccGridSize pos, Tile *t);
ccGridSize getDelta(const ccGridSize& pos);
void placeTile(const ccGridSize& pos, Tile *t);
virtual void startWithTarget(CCNode *pTarget);
virtual void update(ccTime time);
@ -92,7 +92,7 @@ namespace cocos2d
public:
/** creates the action with a random seed, the grid size and the duration */
static CCShuffleTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
static CCShuffleTiles* actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nSeed;
@ -107,15 +107,15 @@ namespace cocos2d
class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction
{
public:
virtual float testFunc(ccGridSize pos, ccTime time);
void turnOnTile(ccGridSize pos);
void turnOffTile(ccGridSize pos);
virtual void transformTile(ccGridSize pos, float distance);
virtual float testFunc(const ccGridSize& pos, ccTime time);
void turnOnTile(const ccGridSize& pos);
void turnOffTile(const ccGridSize& pos);
virtual void transformTile(const ccGridSize& pos, float distance);
virtual void update(ccTime time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutTRTiles* actionWithSize(ccGridSize gridSize, ccTime time);
static CCFadeOutTRTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
};
/** @brief CCFadeOutBLTiles action.
@ -124,11 +124,11 @@ namespace cocos2d
class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
{
public:
virtual float testFunc(ccGridSize pos, ccTime time);
virtual float testFunc(const ccGridSize& pos, ccTime time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutBLTiles* actionWithSize(ccGridSize gridSize, ccTime time);
static CCFadeOutBLTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
};
/** @brief CCFadeOutUpTiles action.
@ -137,12 +137,12 @@ namespace cocos2d
class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles
{
public:
virtual float testFunc(ccGridSize pos, ccTime time);
virtual void transformTile(ccGridSize pos, float distance);
virtual float testFunc(const ccGridSize& pos, ccTime time);
virtual void transformTile(const ccGridSize& pos, float distance);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutUpTiles* actionWithSize(ccGridSize gridSize, ccTime time);
static CCFadeOutUpTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
};
/** @brief CCFadeOutDownTiles action.
@ -151,11 +151,11 @@ namespace cocos2d
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
{
public:
virtual float testFunc(ccGridSize pos, ccTime time);
virtual float testFunc(const ccGridSize& pos, ccTime time);
public:
/** creates the action with the grid size and the duration */
static CCFadeOutDownTiles* actionWithSize(ccGridSize gridSize, ccTime time);
static CCFadeOutDownTiles* actionWithSize(const ccGridSize& gridSize, ccTime time);
};
/** @brief CCTurnOffTiles action.
@ -166,10 +166,10 @@ namespace cocos2d
public:
~CCTurnOffTiles(void);
/** initializes the action with a random seed, the grid size and the duration */
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration);
bool initWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
void shuffle(int *pArray, unsigned int nLen);
void turnOnTile(ccGridSize pos);
void turnOffTile(ccGridSize pos);
void turnOnTile(const ccGridSize& pos);
void turnOffTile(const ccGridSize& pos);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void startWithTarget(CCNode *pTarget);
@ -177,9 +177,9 @@ namespace cocos2d
public:
/** creates the action with the grid size and the duration */
static CCTurnOffTiles* actionWithSize(ccGridSize size, ccTime d);
static CCTurnOffTiles* actionWithSize(const ccGridSize& size, ccTime d);
/** creates the action with a random seed, the grid size and the duration */
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
static CCTurnOffTiles* actionWithSeed(int s, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nSeed;
@ -200,14 +200,14 @@ namespace cocos2d
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, ccGridSize gridSize, ccTime duration);
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
static CCWavesTiles3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
static CCWavesTiles3D* actionWithWaves(int wav, float amp, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nWaves;
@ -230,13 +230,13 @@ namespace cocos2d
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, ccGridSize gridSize, ccTime duration);
bool initWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual void update(ccTime time);
public:
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
static CCJumpTiles3D* actionWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration);
static CCJumpTiles3D* actionWithJumps(int j, float amp, const ccGridSize& gridSize, ccTime duration);
protected:
int m_nJumps;

View File

@ -36,21 +36,21 @@ struct CCAffineTransform {
CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
#define CCAffineTransformMake __CCAffineTransformMake
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
CCPoint __CCPointApplyAffineTransform(const CCPoint& point, const CCAffineTransform& t);
#define CCPointApplyAffineTransform __CCPointApplyAffineTransform
CCSize __CCSizeApplyAffineTransform(CCSize size, CCAffineTransform t);
CCSize __CCSizeApplyAffineTransform(const CCSize& size, const CCAffineTransform& t);
#define CCSizeApplyAffineTransform __CCSizeApplyAffineTransform
CCAffineTransform CCAffineTransformMakeIdentity();
CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransform);
CCRect CCRectApplyAffineTransform(const CCRect& rect, const CCAffineTransform& anAffineTransform);
CCAffineTransform CCAffineTransformTranslate(CCAffineTransform t, float tx, float ty);
CCAffineTransform CCAffineTransformRotate(CCAffineTransform aTransform, CGFloat anAngle);
CCAffineTransform CCAffineTransformScale(CCAffineTransform t, CGFloat sx, CGFloat sy);
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2);
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2);
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t);
CCAffineTransform CCAffineTransformTranslate(const CCAffineTransform& t, float tx, float ty);
CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& aTransform, CGFloat anAngle);
CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CGFloat sx, CGFloat sy);
CCAffineTransform CCAffineTransformConcat(const CCAffineTransform& t1, const CCAffineTransform& t2);
bool CCAffineTransformEqualToTransform(const CCAffineTransform& t1, const CCAffineTransform& t2);
CCAffineTransform CCAffineTransformInvert(const CCAffineTransform& t);
extern const CCAffineTransform CCAffineTransformIdentity;
}//namespace cocos2d

View File

@ -97,7 +97,7 @@ namespace cocos2d {
/** Adds a frame with a texture and a rect. Internally it will create a CCSpriteFrame and it will add it.
Added to facilitate the migration from v0.8 to v0.9.
*/
void addFrameWithTexture(CCTexture2D* pobTexture, CCRect rect);
void addFrameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
bool init(void);

View File

@ -65,7 +65,7 @@ protected:
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc);
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
CC_PROPERTY(ccColor3B, m_tColor, Color);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
// quads to draw
CC_PROPERTY(unsigned int, m_uQuadsToDraw, QuadsToDraw);

View File

@ -231,17 +231,17 @@ public:
CCSize getDisplaySizeInPixels(void);
/** changes the projection size */
void reshapeProjection(CCSize newWindowSize);
void reshapeProjection(const CCSize& newWindowSize);
/** converts a UIKit coordinate to an OpenGL coordinate
Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)
*/
CCPoint convertToGL(CCPoint obPoint);
CCPoint convertToGL(const CCPoint& obPoint);
/** converts an OpenGL coordinate to a UIKit coordinate
Useful to convert node points to window points for calls such as glScissor
*/
CCPoint convertToUI(CCPoint obPoint);
CCPoint convertToUI(const CCPoint& obPoint);
/// XXX: missing description
float getZEye(void);

View File

@ -48,7 +48,7 @@ THE SOFTWARE.
namespace cocos2d {
/** draws a point given x and y coordinate measured in points */
void CC_DLL ccDrawPoint( CCPoint point );
void CC_DLL ccDrawPoint( const CCPoint& point );
/** draws an array of points.
@since v0.7.2
@ -56,7 +56,7 @@ void CC_DLL ccDrawPoint( CCPoint point );
void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints );
/** draws a line given the origin and destination point measured in points */
void CC_DLL ccDrawLine( CCPoint origin, CCPoint destination );
void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination );
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
The polygon can be closed or open
@ -64,17 +64,17 @@ The polygon can be closed or open
void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon );
/** draws a circle given the center, radius and number of segments. */
void CC_DLL ccDrawCircle( CCPoint center, float radius, float angle, int segments, bool drawLineToCenter);
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter);
/** draws a quad bezier path
@since v0.8
*/
void CC_DLL ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, int segments);
void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments);
/** draws a cubic bezier path
@since v0.8
*/
void CC_DLL ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, int segments);
void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments);
}//namespace cocos2d
#endif // __CCDRAWING_PRIMITIVES__

View File

@ -148,7 +148,7 @@ namespace cocos2d{
/** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(ccColor3B, m_tColor, Color)
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
protected:
@ -179,7 +179,7 @@ namespace cocos2d{
virtual void setString(const char *label);
virtual const char* getString(void);
virtual void setCString(const char *label);
virtual void setAnchorPoint(CCPoint var);
virtual void setAnchorPoint(const CCPoint& var);
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; }
#if CC_LABELBMFONT_DEBUG_DRAW

View File

@ -42,11 +42,11 @@ namespace cocos2d{
virtual ~CCLabelTTF();
char * description();
/** creates a CCLabelTTF from a fontname, alignment, dimension and font size */
static CCLabelTTF * labelWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
static CCLabelTTF * labelWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** creates a CCLabelTTF from a fontname and font size */
static CCLabelTTF * labelWithString(const char *label, const char *fontName, float fontSize);
/** initializes the CCLabelTTF with a font name, alignment, dimension and font size */
bool initWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
bool initWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** initializes the CCLabelTTF with a font name and font size */
bool initWithString(const char *label, const char *fontName, float fontSize);

View File

@ -161,17 +161,17 @@ public:
virtual ~CCLayerColor();
virtual void draw();
virtual void setContentSize(CCSize var);
virtual void setContentSize(const CCSize& var);
/** creates a CCLayer with color, width and height in Points */
static CCLayerColor * layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
static CCLayerColor * layerWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size. */
static CCLayerColor * layerWithColor(ccColor4B color);
static CCLayerColor * layerWithColor(const ccColor4B& color);
/** initializes a CCLayer with color, width and height in Points */
virtual bool initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height);
virtual bool initWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height);
/** initializes a CCLayer with color. Width and height are the window size. */
virtual bool initWithColor(ccColor4B color);
virtual bool initWithColor(const ccColor4B& color);
/** change width in Points*/
void changeWidth(GLfloat w);
@ -184,8 +184,8 @@ public:
/** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(ccColor3B, m_tColor, Color)
/** Color: conforms to CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** BlendFunction. Conforms to CCBlendProtocol protocol */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
@ -223,22 +223,22 @@ class CC_DLL CCLayerGradient : public CCLayerColor
{
public:
/** Creates a full-screen CCLayer with a gradient between start and end. */
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end);
static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
static CCLayerGradient* layerWithColor(ccColor4B start, ccColor4B end, CCPoint v);
static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
/** Initializes the CCLayer with a gradient between start and end. */
virtual bool initWithColor(ccColor4B start, ccColor4B end);
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end);
/** Initializes the CCLayer with a gradient between start and end in the direction of v. */
virtual bool initWithColor(ccColor4B start, ccColor4B end, CCPoint v);
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
CC_PROPERTY(ccColor3B, m_startColor, StartColor)
CC_PROPERTY(ccColor3B, m_endColor, EndColor)
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_startColor, StartColor)
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_endColor, EndColor)
CC_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity)
CC_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity)
CC_PROPERTY(CCPoint, m_AlongVector, Vector)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_AlongVector, Vector)
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
Default: YES

View File

@ -49,6 +49,10 @@ namespace cocos2d{
*/
class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol
{
/** Color: conforms with CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
/** Opacity: conforms with CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
public:
CCMenu()
: m_cOpacity(0)
@ -117,19 +121,12 @@ namespace cocos2d{
*/
virtual void onExit();
virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity(void);
virtual ccColor3B getColor(void);
virtual void setColor(ccColor3B color);
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
protected:
CCMenuItem* itemForTouch(CCTouch * touch);
tCCMenuState m_eState;
GLubyte m_cOpacity;
CCMenuItem *m_pSelectedItem;
ccColor3B m_tColor;
};
}

View File

@ -93,7 +93,7 @@ namespace cocos2d{
class CC_DLL CCMenuItemLabel : public CCMenuItem, public CCRGBAProtocol
{
/** the color that will be used to disable the item */
CC_PROPERTY(ccColor3B, m_tDisabledColor, DisabledColor);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tDisabledColor, DisabledColor);
/** Label that is rendered. It can be any CCNode that implements the CCLabelProtocol */
CC_PROPERTY(CCNode*, m_pLabel, Label);
public:
@ -120,8 +120,8 @@ namespace cocos2d{
virtual void setIsEnabled(bool enabled);
virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity();
virtual void setColor(ccColor3B color);
virtual ccColor3B getColor();
virtual void setColor(const ccColor3B& color);
virtual const ccColor3B& getColor();
virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; }
protected:
@ -223,8 +223,8 @@ namespace cocos2d{
/** initializes a menu item with a normal, selected and disabled image with target/selector */
bool initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector);
// super methods
virtual void setColor(ccColor3B color);
virtual ccColor3B getColor();
virtual void setColor(const ccColor3B& color);
virtual const ccColor3B& getColor();
virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity();
@ -272,7 +272,7 @@ namespace cocos2d{
/** conforms with CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
/** conforms with CCRGBAProtocol protocol */
CC_PROPERTY(ccColor3B, m_tColor, Color);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
/** returns the selected item */
CC_PROPERTY(unsigned int, m_uSelectedIndex, SelectedIndex);
/** CCMutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.

View File

@ -64,10 +64,10 @@ public:
{}
virtual ~CCMotionStreak(){}
/** creates the a MotionStreak. The image will be loaded using the TextureMgr. */
static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color);
static CCMotionStreak * streakWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color);
/** initializes a MotionStreak. The file will be loaded using the TextureMgr. */
bool initWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color);
bool initWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color);
/** polling function */
void update(ccTime delta);

View File

@ -138,8 +138,8 @@ namespace cocos2d {
CC_PROPERTY(float, m_fScaleY, ScaleY)
/** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */
CC_PROPERTY(CCPoint, m_tPosition, Position)
CC_PROPERTY(CCPoint, m_tPositionInPixels, PositionInPixels)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosition, Position)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPositionInPixels, PositionInPixels)
/** The X skew angle of the node in degrees.
This angle describes the shear distortion in the X direction.
@ -174,26 +174,26 @@ namespace cocos2d {
The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
@since v0.8
*/
CC_PROPERTY(CCPoint, m_tAnchorPoint, AnchorPoint)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tAnchorPoint, AnchorPoint)
/** The anchorPoint in absolute pixels.
Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead
*/
CC_PROPERTY_READONLY(CCPoint, m_tAnchorPointInPixels, AnchorPointInPixels)
CC_PROPERTY_READONLY_PASS_BY_REF(CCPoint, m_tAnchorPointInPixels, AnchorPointInPixels)
/** The untransformed size of the node.
The contentSize remains the same no matter the node is scaled or rotated.
All nodes has a size. Layer and Scene has the same size of the screen.
@since v0.8
*/
CC_PROPERTY(CCSize, m_tContentSize, ContentSize)
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
/** The untransformed size of the node in Pixels
The contentSize remains the same no matter the node is scaled or rotated.
All nodes has a size. Layer and Scene has the same size of the screen.
@since v0.8
*/
CC_PROPERTY(CCSize, m_tContentSizeInPixels, ContentSizeInPixels)
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSizeInPixels, ContentSizeInPixels)
/** whether or not the node is running */
CC_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning)
@ -246,7 +246,7 @@ namespace cocos2d {
void arrayMakeObjectsPerformSelector(CCArray* pArray, callbackFunc func);
CCPoint convertToWindowSpace(CCPoint nodePoint);
CCPoint convertToWindowSpace(const CCPoint& nodePoint);
public:
@ -515,21 +515,21 @@ namespace cocos2d {
/** Converts a Point to node (local) space coordinates. The result is in Points.
@since v0.7.1
*/
CCPoint convertToNodeSpace(CCPoint worldPoint);
CCPoint convertToNodeSpace(const CCPoint& worldPoint);
/** Converts a Point to world space coordinates. The result is in Points.
@since v0.7.1
*/
CCPoint convertToWorldSpace(CCPoint nodePoint);
CCPoint convertToWorldSpace(const CCPoint& nodePoint);
/** Converts a Point to node (local) space coordinates. The result is in Points.
treating the returned/received node point as anchor relative.
@since v0.7.1
*/
CCPoint convertToNodeSpaceAR(CCPoint worldPoint);
CCPoint convertToNodeSpaceAR(const CCPoint& worldPoint);
/** Converts a local Point to world space coordinates.The result is in Points.
treating the returned/received node point as anchor relative.
@since v0.7.1
*/
CCPoint convertToWorldSpaceAR(CCPoint nodePoint);
CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint);
/** convenience methods which take a CCTouch instead of CCPoint
@since v0.7.1

View File

@ -50,7 +50,7 @@ namespace cocos2d {
CCParallaxNode();
virtual ~CCParallaxNode();
static CCParallaxNode * node();
virtual void addChild(CCNode * child, unsigned int z, CCPoint parallaxRatio, CCPoint positionOffset);
virtual void addChild(CCNode * child, unsigned int z, const CCPoint& parallaxRatio, const CCPoint& positionOffset);
// super methods
virtual void addChild(CCNode * child, unsigned int zOrder, int tag);
virtual void removeChild(CCNode* child, bool cleanup);

View File

@ -237,9 +237,9 @@ protected:
/** How many seconds the emitter wil run. -1 means 'forever' */
CC_PROPERTY(float, m_fDuration, Duration)
/** sourcePosition of the emitter */
CC_PROPERTY(CCPoint, m_tSourcePosition, SourcePosition)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tSourcePosition, SourcePosition)
/** Position variance of the emitter */
CC_PROPERTY(CCPoint, m_tPosVar, PosVar)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tPosVar, PosVar)
/** life, and life variation of each particle */
CC_PROPERTY(float, m_fLife, Life)
/** life variance of each particle */
@ -252,8 +252,8 @@ protected:
//////////////////////////////////////////////////////////////////////////
public:
// mode A
virtual CCPoint getGravity();
virtual void setGravity(CCPoint g);
virtual const CCPoint& getGravity();
virtual void setGravity(const CCPoint& g);
virtual float getSpeed();
virtual void setSpeed(float speed);
virtual float getSpeedVar();
@ -290,13 +290,13 @@ public:
/** end size variance in pixels of each particle */
CC_PROPERTY(float, m_fEndSizeVar, EndSizeVar)
/** start color of each particle */
CC_PROPERTY(ccColor4F, m_tStartColor, StartColor)
CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tStartColor, StartColor)
/** start color variance of each particle */
CC_PROPERTY(ccColor4F, m_tStartColorVar, StartColorVar)
CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tStartColorVar, StartColorVar)
/** end color and end color variation of each particle */
CC_PROPERTY(ccColor4F, m_tEndColor, EndColor)
CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tEndColor, EndColor)
/** end color variance of each particle */
CC_PROPERTY(ccColor4F, m_tEndColorVar, EndColorVar)
CC_PROPERTY_PASS_BY_REF(ccColor4F, m_tEndColorVar, EndColorVar)
//* initial angle of each particle
CC_PROPERTY(float, m_fStartSpin, StartSpin)
//* initial angle of each particle
@ -372,7 +372,7 @@ public:
bool isFull();
//! should be overriden by subclasses
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition);
virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
//! should be overriden by subclasses
virtual void postStep();

View File

@ -60,7 +60,7 @@ public:
// super methods
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition);
virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
virtual void postStep();
virtual void draw();
virtual void setStartSpin(float var);

View File

@ -71,7 +71,7 @@ public:
void initIndices();
/** initilizes the texture with a rectangle measured Points */
void initTexCoordsWithRect(CCRect rect);
void initTexCoordsWithRect(const CCRect& rect);
/** Sets a new CCSpriteFrame as particle.
WARNING: this method is experimental. Use setTexture:withRect instead.
@ -82,11 +82,11 @@ public:
/** Sets a new texture with a rect. The rect is in Points.
@since v0.99.4
*/
void setTextureWithRect(CCTexture2D *texture, CCRect rect);
void setTextureWithRect(CCTexture2D *texture, const CCRect& rect);
// super methods
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
virtual void setTexture(CCTexture2D* texture);
virtual void updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition);
virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
virtual void postStep();
virtual void draw();
};

View File

@ -81,7 +81,7 @@ public:
static CCProgressTimer* progressWithTexture(CCTexture2D *pTexture);
protected:
ccVertex2F vertexFromTexCoord(CCPoint texCoord);
ccVertex2F vertexFromTexCoord(const CCPoint& texCoord);
void updateProgress(void);
void updateBar(void);
void updateRadial(void);

View File

@ -39,12 +39,12 @@ public:
/** sets Color
@since v0.8
*/
virtual void setColor(ccColor3B color) = 0;
virtual void setColor(const ccColor3B& color) = 0;
/** returns the color
@since v0.8
*/
virtual ccColor3B getColor(void) = 0;
virtual const ccColor3B& getColor(void) = 0;
// returns the opacity
virtual GLubyte getOpacity(void) = 0;

View File

@ -56,27 +56,27 @@ class CC_DLL CCRibbon : public CCNode, public CCTextureProtocol
/** GL blendind function */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
/** color used by the Ribbon (RGBA) */
CC_PROPERTY(ccColor4B, m_tColor, Color)
CC_PROPERTY_PASS_BY_REF(ccColor4B, m_tColor, Color)
public:
CCRibbon() : m_pTexture(0), m_pSegments(0), m_pDeletedSegments(0){}
virtual ~CCRibbon();
/** creates the ribbon */
static CCRibbon * ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade);
static CCRibbon * ribbonWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade);
/** init the ribbon */
bool initWithWidth(float w, const char *path, float length, ccColor4B color, float fade);
bool initWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade);
/** add a point to the ribbon */
void addPointAt(CCPoint location, float width);
/** polling function */
void update(ccTime delta);
/** determine side of line */
float sideOfLine(CCPoint p, CCPoint l1, CCPoint l2);
float sideOfLine(const CCPoint& p, const CCPoint& l1, const CCPoint& l2);
// super method
virtual void draw();
private:
/** rotates a point around 0, 0 */
CCPoint rotatePoint(CCPoint vec, float rotation);
CCPoint rotatePoint(const CCPoint& vec, float rotation);
protected:
CCMutableArray<CCRibbonSegment*> *m_pSegments;
CCMutableArray<CCRibbonSegment*> *m_pDeletedSegments;
@ -115,7 +115,7 @@ public:
char * description();
bool init();
void reset();
void draw(float curTime, float fadeTime, ccColor4B color);
void draw(float curTime, float fadeTime, const ccColor4B& color);
};
} // namespace cocos2d

View File

@ -92,6 +92,10 @@ typedef enum {
*/
class CC_DLL CCSprite : public CCNode, public CCTextureProtocol, public CCRGBAProtocol
{
/** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_nOpacity, Opacity)
/** Color: conforms with CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_sColor, Color);
public:
virtual void draw(void);
@ -117,7 +121,7 @@ public:
inline void setAtlasIndex(unsigned int uAtlasIndex) { m_uAtlasIndex = uAtlasIndex; }
/** returns the rect of the CCSprite in points */
inline CCRect getTextureRect(void) { return m_obRect; }
inline const CCRect& getTextureRect(void) { return m_obRect; }
/** whether or not the Sprite is rendered using a CCSpriteBatchNode */
inline bool isUsesBatchNode(void) { return m_bUsesBatchNode; }
@ -146,7 +150,7 @@ public:
/** Get offset position of the sprite. Calculated automatically by editors like Zwoptex.
@since v0.99.0
*/
inline CCPoint getOffsetPositionInPixels(void) { return m_obOffsetPositionInPixels; }
inline const CCPoint& getOffsetPositionInPixels(void) { return m_obOffsetPositionInPixels; }
/** conforms to CCTextureProtocol protocol */
inline ccBlendFunc getBlendFunc(void) { return m_sBlendFunc; }
@ -163,10 +167,10 @@ public:
/** Creates an sprite with a texture and a rect.
The offset will be (0,0).
*/
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect);
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
/** Creates an sprite with a texture, a rect and offset. */
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset);
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect, const CCPoint& offset);
/** Creates an sprite with an sprite frame. */
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
@ -187,11 +191,11 @@ public:
/** Creates an sprite with an image filename and a rect.
The offset will be (0,0).
*/
static CCSprite* spriteWithFile(const char *pszFileName, CCRect rect);
static CCSprite* spriteWithFile(const char *pszFileName, const CCRect& rect);
/** Creates an sprite with an CCBatchNode and a rect
*/
static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect);
static CCSprite* spriteWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect);
public:
bool init(void);
@ -206,8 +210,8 @@ public:
virtual void addChild(CCNode *pChild, int zOrder, int tag);
virtual void setDirtyRecursively(bool bValue);
virtual void setPosition(CCPoint pos);
virtual void setPositionInPixels(CCPoint pos);
virtual void setPosition(const CCPoint& pos);
virtual void setPositionInPixels(const CCPoint& pos);
virtual void setRotation(float fRotation);
virtual void setSkewX(float sx);
virtual void setSkewY(float sy);
@ -215,7 +219,7 @@ public:
virtual void setScaleY(float fScaleY);
virtual void setScale(float fScale);
virtual void setVertexZ(float fVertexZ);
virtual void setAnchorPoint(CCPoint anchor);
virtual void setAnchorPoint(const CCPoint& anchor);
virtual void setIsRelativeAnchorPoint(bool bRelative);
virtual void setIsVisible(bool bVisible);
void setFlipX(bool bFlipX);
@ -240,11 +244,6 @@ public:
void updateColor(void);
// RGBAProtocol
/** opacity: conforms to CCRGBAProtocol protocol */
virtual GLubyte getOpacity(void);
virtual void setOpacity(GLubyte opacity);
/** RGB colors: conforms to CCRGBAProtocol protocol */
virtual ccColor3B getColor(void);
virtual void setColor(ccColor3B color3);
virtual void setIsOpacityModifyRGB(bool bValue);
virtual bool getIsOpacityModifyRGB(void);
@ -263,7 +262,7 @@ public:
/** Initializes an sprite with a texture and a rect.
The offset will be (0,0).
*/
bool initWithTexture(CCTexture2D *pTexture, CCRect rect);
bool initWithTexture(CCTexture2D *pTexture, const CCRect& rect);
// Initializes an sprite with an sprite frame.
bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
@ -284,15 +283,15 @@ public:
/** Initializes an sprite with an image filename, and a rect.
The offset will be (0,0).
*/
bool initWithFile(const char *pszFilename, CCRect rect);
bool initWithFile(const char *pszFilename, const CCRect& rect);
/** Initializes an sprite with an CCSpriteBatchNode and a rect in points */
bool initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect);
bool initWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect);
/** Initializes an sprite with an CCSpriteBatchNode and a rect in pixels
@since v0.99.5
*/
bool initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, CCRect rect);
bool initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, const CCRect& rect);
// BatchNode methods
@ -305,11 +304,11 @@ public:
void useSelfRender(void);
/** updates the texture rect of the CCSprite in points. */
void setTextureRect(CCRect rect);
void setTextureRect(const CCRect& rect);
/** updates the texture rect, rectRotated and untrimmed size of the CCSprite in pixels
*/
void setTextureRectInPixels(CCRect rect, bool rotated, CCSize size);
void setTextureRectInPixels(const CCRect& rect, bool rotated, const CCSize& size);
/** tell the sprite to use batch node render.
@since v0.99.0
@ -336,7 +335,7 @@ public:
void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex);
protected:
void updateTextureCoords(CCRect rect);
void updateTextureCoords(const CCRect& rect);
void updateBlendFunc(void);
void getTransformValues(struct transformValues_ *tv); // optimization
@ -378,8 +377,6 @@ protected:
ccV3F_C4B_T2F_Quad m_sQuad;
// opacity and RGB protocol
GLubyte m_nOpacity;
ccColor3B m_sColor;
ccColor3B m_sColorUnmodified;
bool m_bOpacityModifyRGB;

View File

@ -53,26 +53,26 @@ class CC_DLL CCSpriteFrame : public CCObject
public:
// attributes
inline CCRect getRectInPixels(void) { return m_obRectInPixels; }
void setRectInPixels(CCRect rectInPixels);
inline const CCRect& getRectInPixels(void) { return m_obRectInPixels; }
void setRectInPixels(const CCRect& rectInPixels);
inline bool isRotated(void) { return m_bRotated; }
inline void setRotated(bool bRotated) { m_bRotated = bRotated; }
/** get rect of the frame */
inline CCRect getRect(void) { return m_obRect; }
inline const CCRect& getRect(void) { return m_obRect; }
/** set rect of the frame */
void setRect(CCRect rect);
void setRect(const CCRect& rect);
/** get offset of the frame */
inline CCPoint getOffsetInPixels(void) { return m_obOffsetInPixels; }
inline const CCPoint& getOffsetInPixels(void) { return m_obOffsetInPixels; }
/** set offset of the frame */
inline void setOffsetInPixels(CCPoint offsetInPixels) { m_obOffsetInPixels = offsetInPixels; }
inline void setOffsetInPixels(const CCPoint& offsetInPixels) { m_obOffsetInPixels = offsetInPixels; }
/** get original size of the trimmed image */
inline CCSize getOriginalSizeInPixels(void) { return m_obOriginalSizeInPixels; }
inline const CCSize& getOriginalSizeInPixels(void) { return m_obOriginalSizeInPixels; }
/** set original size of the trimmed image */
inline void setOriginalSizeInPixels(CCSize sizeInPixels) { m_obOriginalSizeInPixels = sizeInPixels; }
inline void setOriginalSizeInPixels(const CCSize& sizeInPixels) { m_obOriginalSizeInPixels = sizeInPixels; }
/** get texture of the frame */
inline CCTexture2D* getTexture(void) { return m_pobTexture; }
@ -91,23 +91,23 @@ public:
/** Create a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect);
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize);
static CCSpriteFrame* frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
public:
/** Initializes a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
bool initWithTexture(CCTexture2D* pobTexture, CCRect rect);
bool initWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
bool initWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize);
bool initWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
protected:
CCRect m_obRectInPixels;
bool m_bRotated;

View File

@ -63,9 +63,9 @@ namespace cocos2d {
class CC_DLL CCTMXLayer : public CCSpriteBatchNode
{
/** size of the layer in tiles */
CC_SYNTHESIZE(CCSize, m_tLayerSize, LayerSize);
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tLayerSize, LayerSize);
/** size of the map's tile (could be differnt from the tile's size) */
CC_SYNTHESIZE(CCSize, m_tMapTileSize, MapTileSize);
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapTileSize, MapTileSize);
/** pointer to the map of tiles */
CC_SYNTHESIZE(unsigned int*, m_pTiles, Tiles);
/** Tilset information for the layer */
@ -95,25 +95,25 @@ namespace cocos2d {
- layer->removeChild(sprite, cleanup);
- or layer->removeTileAt(ccp(x,y));
*/
CCSprite* tileAt(CCPoint tileCoordinate);
CCSprite* tileAt(const CCPoint& tileCoordinate);
/** returns the tile gid at a given tile coordinate.
if it returns 0, it means that the tile is empty.
This method requires the the tile map has not been previously released (eg. don't call layer->releaseMap())
*/
unsigned int tileGIDAt(CCPoint tileCoordinate);
unsigned int tileGIDAt(const CCPoint& tileCoordinate);
/** sets the tile gid (gid = tile global id) at a given tile coordinate.
The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor -> Tileset Mgr +1.
If a tile is already placed at that position, then it will be removed.
*/
void setTileGID(unsigned int gid, CCPoint tileCoordinate);
void setTileGID(unsigned int gid, const CCPoint& tileCoordinate);
/** removes a tile at given tile coordinate */
void removeTileAt(CCPoint tileCoordinate);
void removeTileAt(const CCPoint& tileCoordinate);
/** returns the position in pixels of a given tile coordinate */
CCPoint positionAt(CCPoint tileCoordinate);
CCPoint positionAt(const CCPoint& tileCoordinate);
/** return the value for the specific property name */
CCString *propertyNamed(const char *propertyName);
@ -132,20 +132,20 @@ namespace cocos2d {
inline const char* getLayerName(){ return m_sLayerName.c_str(); }
inline void setLayerName(const char *layerName){ m_sLayerName = layerName; }
private:
CCPoint positionForIsoAt(CCPoint pos);
CCPoint positionForOrthoAt(CCPoint pos);
CCPoint positionForHexAt(CCPoint pos);
CCPoint positionForIsoAt(const CCPoint& pos);
CCPoint positionForOrthoAt(const CCPoint& pos);
CCPoint positionForHexAt(const CCPoint& pos);
CCPoint calculateLayerOffset(CCPoint offset);
CCPoint calculateLayerOffset(const CCPoint& offset);
/* optimization methos */
CCSprite* appendTileForGID(unsigned int gid, CCPoint pos);
CCSprite* insertTileForGID(unsigned int gid, CCPoint pos);
CCSprite* updateTileForGID(unsigned int gid, CCPoint pos);
CCSprite* appendTileForGID(unsigned int gid, const CCPoint& pos);
CCSprite* insertTileForGID(unsigned int gid, const CCPoint& pos);
CCSprite* updateTileForGID(unsigned int gid, const CCPoint& pos);
/* The layer recognizes some special properties, like cc_vertez */
void parseInternalProperties();
int vertexZForPos(CCPoint pos);
int vertexZForPos(const CCPoint& pos);
// index
unsigned int atlasIndexForExistantZ(unsigned int z);

View File

@ -40,7 +40,7 @@ namespace cocos2d {
class CC_DLL CCTMXObjectGroup : public CCObject
{
/** offset position of child objects */
CC_SYNTHESIZE(CCPoint, m_tPositionOffset, PositionOffset);
CC_SYNTHESIZE_PASS_BY_REF(CCPoint, m_tPositionOffset, PositionOffset);
/** list of properties stored in a dictionary */
CC_PROPERTY(CCStringToStringDictionary*, m_pProperties, Properties);
/** array of the objects */

View File

@ -103,9 +103,9 @@ namespace cocos2d {
class CC_DLL CCTMXTiledMap : public CCNode
{
/** the map's size property measured in tiles */
CC_SYNTHESIZE(CCSize, m_tMapSize, MapSize);
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapSize, MapSize);
/** the tiles's size property measured in pixels */
CC_SYNTHESIZE(CCSize, m_tTileSize, TileSize);
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tTileSize, TileSize);
/** map orientation */
CC_SYNTHESIZE(int, m_nMapOrientation, MapOrientation);
/** object groups */

View File

@ -134,9 +134,9 @@ namespace cocos2d {
/// map orientation
CC_SYNTHESIZE(int, m_nOrientation, Orientation);
/// map width & height
CC_SYNTHESIZE(CCSize, m_tMapSize, MapSize);
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tMapSize, MapSize);
/// tiles width & height
CC_SYNTHESIZE(CCSize, m_tTileSize, TileSize);
CC_SYNTHESIZE_PASS_BY_REF(CCSize, m_tTileSize, TileSize);
/// Layers
CC_PROPERTY(CCMutableArray<CCTMXLayerInfo*>*, m_pLayers, Layers);
/// tilesets

View File

@ -98,11 +98,11 @@ public:
//char * description();
/** creates a CCTextFieldTTF from a fontname, alignment, dimension and font size */
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** creates a CCLabelTTF from a fontname and font size */
static CCTextFieldTTF * textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
/** initializes the CCTextFieldTTF with a font name, alignment, dimension and font size */
bool initWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
bool initWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** initializes the CCTextFieldTTF with a font name and font size */
bool initWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize);
@ -122,7 +122,7 @@ public:
CC_SYNTHESIZE(CCTextFieldDelegate *, m_pDelegate, Delegate);
CC_SYNTHESIZE_READONLY(int, m_nCharCount, CharCount);
CC_SYNTHESIZE(ccColor3B, m_ColorSpaceHolder, ColorSpaceHolder);
CC_SYNTHESIZE_PASS_BY_REF(ccColor3B, m_ColorSpaceHolder, ColorSpaceHolder);
// input text property
public:

View File

@ -108,7 +108,7 @@ class CC_DLL CCTexture2D : public CCObject
CC_PROPERTY_READONLY(GLuint, m_uName, Name)
/** content size */
CC_PROPERTY_READONLY(CCSize, m_tContentSize, ContentSizeInPixels)
CC_PROPERTY_READONLY_PASS_BY_REF(CCSize, m_tContentSize, ContentSizeInPixels)
/** texture max S */
CC_PROPERTY(GLfloat, m_fMaxS, MaxS)
/** texture max T */
@ -127,16 +127,16 @@ public:
void* keepData(void *data, unsigned int length);
/** Intializes with a texture2d with data */
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize);
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSize);
/**
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object.
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.
*/
/** draws a texture at a given point */
void drawAtPoint(CCPoint point);
void drawAtPoint(const CCPoint& point);
/** draws a texture inside a rect */
void drawInRect(CCRect rect);
void drawInRect(const CCRect& rect);
/**
Extensions to make it easy to create a CCTexture2D object from an image file.
@ -150,7 +150,7 @@ public:
Note that the generated textures are of type A8 - use the blending mode (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
*/
/** Initializes a texture from a string with dimensions, alignment, font name and font size */
bool initWithString(const char *text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
bool initWithString(const char *text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
/** Initializes a texture from a string with font name and font size */
bool initWithString(const char *text, const char *fontName, float fontSize);

View File

@ -182,8 +182,8 @@ public:
~VolatileTexture();
static void addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format);
static void addStringTexture(CCTexture2D *tt, const char* text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, CCSize contentSize);
static void addStringTexture(CCTexture2D *tt, const char* text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, const CCSize& contentSize);
static void removeTexture(CCTexture2D *t);
static void reloadAllTextures();

View File

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

View File

@ -408,9 +408,9 @@ public:
/** creates the transition with a duration and with an RGB color
* Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color
*/
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, ccColor3B color = ccBLACK);
static CCTransitionFade* transitionWithDuration(ccTime duration,CCScene* scene, const ccColor3B& color = ccBLACK);
/** initializes the transition with a duration and with an RGB color */
virtual bool initWithDuration(ccTime t, CCScene*scene ,ccColor3B color);
virtual bool initWithDuration(ccTime t, CCScene*scene ,const ccColor3B& color);
virtual bool initWithDuration(ccTime t,CCScene* scene);
virtual void onEnter();
@ -494,7 +494,7 @@ class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTransition
public:
CCTransitionFadeTR();
virtual ~CCTransitionFadeTR();
virtual CCActionInterval* actionWithSize(ccGridSize size);
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
virtual void onEnter();
virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);
@ -513,7 +513,7 @@ class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR
public:
CCTransitionFadeBL();
virtual ~CCTransitionFadeBL();
virtual CCActionInterval* actionWithSize(ccGridSize size);
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeBL)
@ -527,7 +527,7 @@ class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR
public:
CCTransitionFadeUp();
virtual ~CCTransitionFadeUp();
virtual CCActionInterval* actionWithSize(ccGridSize size);
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeUp)
@ -541,7 +541,7 @@ class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR
public:
CCTransitionFadeDown();
virtual ~CCTransitionFadeDown();
virtual CCActionInterval* actionWithSize(ccGridSize size);
virtual CCActionInterval* actionWithSize(const ccGridSize& size);
public:
DECLEAR_TRANSITIONWITHDURATION(CCTransitionFadeDown)

View File

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

View File

@ -145,7 +145,7 @@ namespace cocos2d{
{
CCAtlasNode::draw();
CCSize s = this->getContentSize();
const CCSize& s = this->getContentSize();
CCPoint vertices[4]={
ccp(0,0),ccp(s.width,0),
ccp(s.width,s.height),ccp(0,s.height),

View File

@ -568,7 +568,7 @@ namespace cocos2d{
}
//LabelBMFont - CCRGBAProtocol protocol
void CCLabelBMFont::setColor(ccColor3B var)
void CCLabelBMFont::setColor(const ccColor3B& var)
{
m_tColor = var;
if (m_pChildren && m_pChildren->count() != 0)
@ -583,7 +583,7 @@ namespace cocos2d{
}
} }
}
ccColor3B CCLabelBMFont::getColor()
const ccColor3B& CCLabelBMFont::getColor()
{
return m_tColor;
}
@ -636,7 +636,7 @@ namespace cocos2d{
}
// LabelBMFont - AnchorPoint
void CCLabelBMFont::setAnchorPoint(CCPoint point)
void CCLabelBMFont::setAnchorPoint(const CCPoint& point)
{
if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) )
{
@ -650,7 +650,7 @@ namespace cocos2d{
void CCLabelBMFont::draw()
{
CCSpriteBatchNode::draw();
CCSize s = this->getContentSize();
const CCSize& s = this->getContentSize();
CCPoint vertices[4]={
ccp(0,0),ccp(s.width,0),
ccp(s.width,s.height),ccp(0,s.height),

View File

@ -42,7 +42,7 @@ namespace cocos2d{
CC_SAFE_DELETE(m_pString);
}
CCLabelTTF * CCLabelTTF::labelWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
CCLabelTTF * CCLabelTTF::labelWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
CCLabelTTF *pRet = new CCLabelTTF();
if(pRet && pRet->initWithString(label, dimensions, alignment, fontName, fontSize))
@ -65,7 +65,7 @@ namespace cocos2d{
return NULL;
}
bool CCLabelTTF::initWithString(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
bool CCLabelTTF::initWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
assert(label != NULL);
if (CCSprite::init())

View File

@ -260,7 +260,7 @@ bool CCLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
return true;
}
void CCLayer::ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
void CCLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
if (isScriptHandlerExist(CCTOUCHBEGAN))
{
@ -322,13 +322,13 @@ void CCLayerColor::setOpacity(GLubyte var)
}
/// color getter
ccColor3B CCLayerColor::getColor()
const ccColor3B& CCLayerColor::getColor()
{
return m_tColor;
}
/// color setter
void CCLayerColor::setColor(ccColor3B var)
void CCLayerColor::setColor(const ccColor3B& var)
{
m_tColor = var;
updateColor();
@ -347,7 +347,7 @@ void CCLayerColor::setBlendFunc(ccBlendFunc var)
}
CCLayerColor * CCLayerColor::layerWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
CCLayerColor * CCLayerColor::layerWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height)
{
CCLayerColor * pLayer = new CCLayerColor();
if( pLayer && pLayer->initWithColorWidthHeight(color,width,height))
@ -358,7 +358,7 @@ CCLayerColor * CCLayerColor::layerWithColorWidthHeight(ccColor4B color, GLfloat
CC_SAFE_DELETE(pLayer);
return NULL;
}
CCLayerColor * CCLayerColor::layerWithColor(ccColor4B color)
CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color)
{
CCLayerColor * pLayer = new CCLayerColor();
if(pLayer && pLayer->initWithColor(color))
@ -370,7 +370,7 @@ CCLayerColor * CCLayerColor::layerWithColor(ccColor4B color)
return NULL;
}
bool CCLayerColor::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfloat height)
bool CCLayerColor::initWithColorWidthHeight(const ccColor4B& color, GLfloat width, GLfloat height)
{
// default blend function
m_tBlendFunc.src = CC_BLEND_SRC;
@ -392,7 +392,7 @@ bool CCLayerColor::initWithColorWidthHeight(ccColor4B color, GLfloat width, GLfl
return true;
}
bool CCLayerColor::initWithColor(ccColor4B color)
bool CCLayerColor::initWithColor(const ccColor4B& color)
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
this->initWithColorWidthHeight(color, s.width, s.height);
@ -400,7 +400,7 @@ bool CCLayerColor::initWithColor(ccColor4B color)
}
/// override contentSize
void CCLayerColor::setContentSize(CCSize size)
void CCLayerColor::setContentSize(const CCSize& size)
{
m_pSquareVertices[1].x = size.width * CC_CONTENT_SCALE_FACTOR();
m_pSquareVertices[2].y = size.height * CC_CONTENT_SCALE_FACTOR();
@ -472,7 +472,7 @@ void CCLayerColor::draw()
//
// CCLayerGradient
//
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end)
{
CCLayerGradient * pLayer = new CCLayerGradient();
if( pLayer && pLayer->initWithColor(start, end))
@ -484,7 +484,7 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
return NULL;
}
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CCPoint v)
CCLayerGradient* CCLayerGradient::layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
{
CCLayerGradient * pLayer = new CCLayerGradient();
if( pLayer && pLayer->initWithColor(start, end, v))
@ -496,12 +496,12 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end,
return NULL;
}
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
bool CCLayerGradient::initWithColor(const ccColor4B& start, const ccColor4B& end)
{
return initWithColor(start, end, ccp(0, -1));
}
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v)
bool CCLayerGradient::initWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v)
{
m_endColor.r = end.r;
m_endColor.g = end.g;
@ -511,10 +511,9 @@ bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v)
m_cStartOpacity = start.a;
m_AlongVector = v;
start.a = 255;
m_bCompressedInterpolation = true;
return CCLayerColor::initWithColor(start);
return CCLayerColor::initWithColor(ccc4(start.r, start.g, start.b, 255));
}
void CCLayerGradient::updateColor()
@ -573,23 +572,23 @@ void CCLayerGradient::updateColor()
m_pSquareColors[3].a = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c)));
}
ccColor3B CCLayerGradient::getStartColor()
const ccColor3B& CCLayerGradient::getStartColor()
{
return m_tColor;
}
void CCLayerGradient::setStartColor(ccColor3B colors)
void CCLayerGradient::setStartColor(const ccColor3B& color)
{
setColor(colors);
setColor(color);
}
void CCLayerGradient::setEndColor(ccColor3B colors)
void CCLayerGradient::setEndColor(const ccColor3B& color)
{
m_endColor = colors;
m_endColor = color;
updateColor();
}
ccColor3B CCLayerGradient::getEndColor()
const ccColor3B& CCLayerGradient::getEndColor()
{
return m_endColor;
}
@ -616,13 +615,13 @@ GLubyte CCLayerGradient::getEndOpacity()
return m_cEndOpacity;
}
void CCLayerGradient::setVector(CCPoint var)
void CCLayerGradient::setVector(const CCPoint& var)
{
m_AlongVector = var;
updateColor();
}
CCPoint CCLayerGradient::getVector()
const CCPoint& CCLayerGradient::getVector()
{
return m_AlongVector;
}

View File

@ -1035,7 +1035,7 @@ CCTransitionFade::~CCTransitionFade()
}
CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCScene *scene, ccColor3B color)
CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCScene *scene, const ccColor3B& color)
{
CCTransitionFade * pTransition = new CCTransitionFade();
pTransition->initWithDuration(duration, scene, color);
@ -1043,7 +1043,7 @@ CCTransitionFade * CCTransitionFade::transitionWithDuration(ccTime duration, CCS
return pTransition;
}
bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, ccColor3B color)
bool CCTransitionFade::initWithDuration(ccTime duration, CCScene *scene, const ccColor3B& color)
{
if (CCTransitionScene::initWithDuration(duration, scene))
{
@ -1350,7 +1350,7 @@ void CCTransitionFadeTR::onEnter()
}
CCActionInterval* CCTransitionFadeTR::actionWithSize(ccGridSize size)
CCActionInterval* CCTransitionFadeTR::actionWithSize(const ccGridSize& size)
{
return CCFadeOutTRTiles::actionWithSize(size, m_fDuration);
}
@ -1374,7 +1374,7 @@ CCTransitionFadeBL::~CCTransitionFadeBL()
{
}
CCActionInterval* CCTransitionFadeBL::actionWithSize(ccGridSize size)
CCActionInterval* CCTransitionFadeBL::actionWithSize(const ccGridSize& size)
{
return CCFadeOutBLTiles::actionWithSize(size, m_fDuration);
}
@ -1391,7 +1391,7 @@ CCTransitionFadeUp::~CCTransitionFadeUp()
{
}
CCActionInterval* CCTransitionFadeUp::actionWithSize(ccGridSize size)
CCActionInterval* CCTransitionFadeUp::actionWithSize(const ccGridSize& size)
{
return CCFadeOutUpTiles::actionWithSize(size, m_fDuration);
}
@ -1408,7 +1408,7 @@ CCTransitionFadeDown::~CCTransitionFadeDown()
{
}
CCActionInterval* CCTransitionFadeDown::actionWithSize(ccGridSize size)
CCActionInterval* CCTransitionFadeDown::actionWithSize(const ccGridSize& size)
{
return CCFadeOutDownTiles::actionWithSize(size, m_fDuration);
}

View File

@ -116,7 +116,7 @@ void CCTransitionPageTurn::onEnter()
}
CCActionInterval* CCTransitionPageTurn:: actionWithSize(ccGridSize vector)
CCActionInterval* CCTransitionPageTurn:: actionWithSize(const ccGridSize& vector)
{
if( m_bBack )
{

View File

@ -573,7 +573,7 @@ namespace cocos2d{
return m_cOpacity;
}
void CCMenu::setColor(cocos2d::ccColor3B var)
void CCMenu::setColor(const ccColor3B& var)
{
m_tColor = var;
@ -595,12 +595,12 @@ namespace cocos2d{
}
}
ccColor3B CCMenu::getColor(void)
const ccColor3B& CCMenu::getColor(void)
{
return m_tColor;
}
CCMenuItem* CCMenu::itemForTouch(cocos2d::CCTouch *touch)
CCMenuItem* CCMenu::itemForTouch(CCTouch *touch)
{
CCPoint touchLocation = touch->locationInView(touch->view());
touchLocation = CCDirector::sharedDirector()->convertToGL(touchLocation);

View File

@ -132,11 +132,11 @@ namespace cocos2d{
//
//CCMenuItemLabel
//
ccColor3B CCMenuItemLabel::getDisabledColor()
const ccColor3B& CCMenuItemLabel::getDisabledColor()
{
return m_tDisabledColor;
}
void CCMenuItemLabel::setDisabledColor(ccColor3B var)
void CCMenuItemLabel::setDisabledColor(const ccColor3B& var)
{
m_tDisabledColor = var;
}
@ -258,11 +258,11 @@ namespace cocos2d{
{
return m_pLabel->convertToRGBAProtocol()->getOpacity();
}
void CCMenuItemLabel::setColor(ccColor3B color)
void CCMenuItemLabel::setColor(const ccColor3B& color)
{
m_pLabel->convertToRGBAProtocol()->setColor(color);
}
ccColor3B CCMenuItemLabel::getColor()
const ccColor3B& CCMenuItemLabel::getColor()
{
return m_pLabel->convertToRGBAProtocol()->getColor();
}
@ -452,7 +452,7 @@ namespace cocos2d{
m_pDisabledImage->convertToRGBAProtocol()->setOpacity(opacity);
}
}
void CCMenuItemSprite::setColor(ccColor3B color)
void CCMenuItemSprite::setColor(const ccColor3B& color)
{
m_pNormalImage->convertToRGBAProtocol()->setColor(color);
m_pSelectedImage->convertToRGBAProtocol()->setColor(color);
@ -466,7 +466,7 @@ namespace cocos2d{
{
return m_pNormalImage->convertToRGBAProtocol()->getOpacity();
}
ccColor3B CCMenuItemSprite::getColor()
const ccColor3B& CCMenuItemSprite::getColor()
{
return m_pNormalImage->convertToRGBAProtocol()->getColor();
}
@ -691,7 +691,7 @@ namespace cocos2d{
this->removeChildByTag(kCurrentItem, false);
CCMenuItem *item = m_pSubItems->getObjectAtIndex(m_uSelectedIndex);
this->addChild(item, 0, kCurrentItem);
CCSize s = item->getContentSize();
const CCSize& s = item->getContentSize();
this->setContentSize(s);
item->setPosition( ccp( s.width/2, s.height/2 ) );
}
@ -756,11 +756,11 @@ namespace cocos2d{
}
}
}
ccColor3B CCMenuItemToggle::getColor()
const ccColor3B& CCMenuItemToggle::getColor()
{
return m_tColor;
}
void CCMenuItemToggle::setColor(ccColor3B color)
void CCMenuItemToggle::setColor(const ccColor3B& color)
{
m_tColor = color;
if(m_pSubItems && m_pSubItems->count() > 0)

View File

@ -38,7 +38,7 @@ namespace cocos2d {
*/
//implementation CCMotionStreak
CCMotionStreak * CCMotionStreak::streakWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color)
CCMotionStreak * CCMotionStreak::streakWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color)
{
CCMotionStreak *pRet = new CCMotionStreak();
if(pRet && pRet->initWithFade(fade, seg, imagePath, width, length, color))
@ -50,7 +50,7 @@ CCMotionStreak * CCMotionStreak::streakWithFade(float fade, float seg, const cha
return NULL;
}
bool CCMotionStreak::initWithFade(float fade, float seg, const char *imagePath, float width, float length, ccColor4B color)
bool CCMotionStreak::initWithFade(float fade, float seg, const char *imagePath, float width, float length, const ccColor4B& color)
{
m_fSegThreshold = seg;
m_fWidth = width;

View File

@ -56,7 +56,7 @@ bool CCProgressTimer::initWithFile(const char *pszFileName)
return this->initWithTexture(CCTextureCache::sharedTextureCache()->addImage(pszFileName));
}
CCProgressTimer* CCProgressTimer::progressWithTexture(cocos2d::CCTexture2D *pTexture)
CCProgressTimer* CCProgressTimer::progressWithTexture(CCTexture2D *pTexture)
{
CCProgressTimer *pProgressTimer = new CCProgressTimer();
if (pProgressTimer->initWithTexture(pTexture))
@ -72,7 +72,7 @@ CCProgressTimer* CCProgressTimer::progressWithTexture(cocos2d::CCTexture2D *pTex
return pProgressTimer;
}
bool CCProgressTimer::initWithTexture(cocos2d::CCTexture2D *pTexture)
bool CCProgressTimer::initWithTexture(CCTexture2D *pTexture)
{
m_pSprite = CCSprite::spriteWithTexture(pTexture);
CC_SAFE_RETAIN(m_pSprite);
@ -101,7 +101,7 @@ void CCProgressTimer::setPercentage(float fPercentage)
}
}
void CCProgressTimer::setSprite(cocos2d::CCSprite *pSprite)
void CCProgressTimer::setSprite(CCSprite *pSprite)
{
if (m_pSprite != pSprite)
{
@ -120,7 +120,7 @@ void CCProgressTimer::setSprite(cocos2d::CCSprite *pSprite)
}
}
void CCProgressTimer::setType(cocos2d::CCProgressTimerType type)
void CCProgressTimer::setType(CCProgressTimerType type)
{
if (type != m_eType)
{
@ -141,7 +141,7 @@ void CCProgressTimer::setType(cocos2d::CCProgressTimerType type)
///
// @returns the vertex position from the texture coordinate
///
ccVertex2F CCProgressTimer::vertexFromTexCoord(cocos2d::CCPoint texCoord)
ccVertex2F CCProgressTimer::vertexFromTexCoord(const CCPoint& texCoord)
{
CCPoint tmp;
ccVertex2F ret;

View File

@ -166,7 +166,7 @@ void CCRenderTexture::begin()
// Save the current matrix
glPushMatrix();
CCSize texSize = m_pTexture->getContentSizeInPixels();
const CCSize& texSize = m_pTexture->getContentSizeInPixels();
// Calculate the adjustment ratios based on the old and new projections
CCSize size = CCDirector::sharedDirector()->getDisplaySizeInPixels();
@ -221,7 +221,7 @@ void CCRenderTexture::beginWithClear(float r, float g, float b, float a)
}
// to get the rendered texture data
CCSize s = m_pTexture->getContentSizeInPixels();
const CCSize& s = m_pTexture->getContentSizeInPixels();
int tx = (int)s.width;
int ty = (int)s.height;
m_pTextureDataBuffer = new GLubyte[tx * ty * 4];
@ -294,7 +294,7 @@ bool CCRenderTexture::getUIImageFromBuffer(CCImage *pImage, int x, int y, int nW
return false;
}
CCSize s = m_pTexture->getContentSizeInPixels();
const CCSize& s = m_pTexture->getContentSizeInPixels();
int tx = (int)s.width;
int ty = (int)s.height;
@ -393,7 +393,7 @@ CCData * CCRenderTexture::getUIImageAsDataFromBuffer(int format)
//
// CCAssert(m_ePixelFormat == kCCTexture2DPixelFormat_RGBA8888, "only RGBA8888 can be saved as image");
//
// CCSize s = m_pTexture->getContentSizeInPixels();
// const CCSize& s = m_pTexture->getContentSizeInPixels();
// int tx = s.width;
// int ty = s.height;
//

View File

@ -47,7 +47,7 @@ namespace cocos2d {
//
// Ribbon
//
CCRibbon * CCRibbon::ribbonWithWidth(float w, const char *path, float length, ccColor4B color, float fade)
CCRibbon * CCRibbon::ribbonWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade)
{
CCRibbon *pRet = new CCRibbon();
if(pRet && pRet->initWithWidth(w, path, length, color, fade))
@ -59,7 +59,7 @@ CCRibbon * CCRibbon::ribbonWithWidth(float w, const char *path, float length, cc
return NULL;
}
bool CCRibbon::initWithWidth(float w, const char *path, float length, ccColor4B color, float fade)
bool CCRibbon::initWithWidth(float w, const char *path, float length, const ccColor4B& color, float fade)
{
m_pSegments = new CCMutableArray<CCRibbonSegment*>();
m_pDeletedSegments = new CCMutableArray<CCRibbonSegment*>();
@ -105,12 +105,12 @@ CCRibbon::~CCRibbon()
CC_SAFE_RELEASE(m_pTexture);
}
CCPoint CCRibbon::rotatePoint(CCPoint vec, float rotation)
CCPoint CCRibbon::rotatePoint(const CCPoint& vec, float rotation)
{
float xtemp = (vec.x * cosf(rotation)) - (vec.y * sinf(rotation));
vec.y = (vec.x * sinf(rotation)) + (vec.y * cosf(rotation));
vec.x = xtemp;
return vec;
CCPoint ret;
ret.x = (vec.x * cosf(rotation)) - (vec.y * sinf(rotation));
ret.y = (vec.x * sinf(rotation)) + (vec.y * cosf(rotation));
return ret;
}
void CCRibbon::update(ccTime delta)
@ -119,7 +119,7 @@ void CCRibbon::update(ccTime delta)
m_fDelta = delta;
}
float CCRibbon::sideOfLine(CCPoint p, CCPoint l1, CCPoint l2)
float CCRibbon::sideOfLine(const CCPoint& p, const CCPoint& l1, const CCPoint& l2)
{
CCPoint vp = ccpPerp(ccpSub(l1, l2));
CCPoint vx = ccpSub(p, l1);
@ -327,11 +327,11 @@ ccBlendFunc CCRibbon::getBlendFunc()
return m_tBlendFunc;
}
void CCRibbon::setColor(ccColor4B var)
void CCRibbon::setColor(const ccColor4B& var)
{
m_tColor = var;
}
ccColor4B CCRibbon::getColor()
const ccColor4B& CCRibbon::getColor()
{
return m_tColor;
}
@ -364,7 +364,7 @@ void CCRibbonSegment::reset()
m_bFinished = false;
}
void CCRibbonSegment::draw(float curTime, float fadeTime, ccColor4B color)
void CCRibbonSegment::draw(float curTime, float fadeTime, const ccColor4B& color)
{
GLubyte r = color.r;
GLubyte g = color.g;

View File

@ -671,7 +671,7 @@ void CCParticleSystem::update(ccTime dt)
this->postStep();
//#endif
}
void CCParticleSystem::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition)
void CCParticleSystem::updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition)
{
CC_UNUSED_PARAM(particle);
CC_UNUSED_PARAM(newPosition);
@ -770,12 +770,12 @@ float CCParticleSystem::getRadialAccelVar()
CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity");
return modeA.radialAccelVar;
}
void CCParticleSystem::setGravity(CCPoint g)
void CCParticleSystem::setGravity(const CCPoint& g)
{
CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity");
modeA.gravity = g;
}
CCPoint CCParticleSystem::getGravity()
const CCPoint& CCParticleSystem::getGravity()
{
CCAssert( m_nEmitterMode == kCCParticleModeGravity, "Particle Mode should be Gravity");
return modeA.gravity;
@ -878,19 +878,19 @@ void CCParticleSystem::setDuration(float var)
{
m_fDuration = var;
}
CCPoint CCParticleSystem::getSourcePosition()
const CCPoint& CCParticleSystem::getSourcePosition()
{
return m_tSourcePosition;
}
void CCParticleSystem::setSourcePosition(CCPoint var)
void CCParticleSystem::setSourcePosition(const CCPoint& var)
{
m_tSourcePosition = var;
}
CCPoint CCParticleSystem::getPosVar()
const CCPoint& CCParticleSystem::getPosVar()
{
return m_tPosVar;
}
void CCParticleSystem::setPosVar(CCPoint var)
void CCParticleSystem::setPosVar(const CCPoint& var)
{
m_tPosVar = var;
}
@ -958,35 +958,35 @@ void CCParticleSystem::setEndSizeVar(float var)
{
m_fEndSizeVar = var;
}
ccColor4F CCParticleSystem::getStartColor()
const ccColor4F& CCParticleSystem::getStartColor()
{
return m_tStartColor;
}
void CCParticleSystem::setStartColor(ccColor4F var)
void CCParticleSystem::setStartColor(const ccColor4F& var)
{
m_tStartColor = var;
}
ccColor4F CCParticleSystem::getStartColorVar()
const ccColor4F& CCParticleSystem::getStartColorVar()
{
return m_tStartColorVar;
}
void CCParticleSystem::setStartColorVar(ccColor4F var)
void CCParticleSystem::setStartColorVar(const ccColor4F& var)
{
m_tStartColorVar = var;
}
ccColor4F CCParticleSystem::getEndColor()
const ccColor4F& CCParticleSystem::getEndColor()
{
return m_tEndColor;
}
void CCParticleSystem::setEndColor(ccColor4F var)
void CCParticleSystem::setEndColor(const ccColor4F& var)
{
m_tEndColor = var;
}
ccColor4F CCParticleSystem::getEndColorVar()
const ccColor4F& CCParticleSystem::getEndColorVar()
{
return m_tEndColorVar;
}
void CCParticleSystem::setEndColorVar(ccColor4F var)
void CCParticleSystem::setEndColorVar(const ccColor4F& var)
{
m_tEndColorVar = var;
}

View File

@ -75,7 +75,7 @@ CCParticleSystemPoint * CCParticleSystemPoint::particleWithFile(const char *plis
return pRet;
}
void CCParticleSystemPoint::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition)
void CCParticleSystemPoint::updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition)
{
// place vertices and colos in array
m_pVertices[m_uParticleIdx].pos = vertex2(newPosition.x, newPosition.y);

View File

@ -102,7 +102,7 @@ CCParticleSystemQuad * CCParticleSystemQuad::particleWithFile(const char *plistF
}
// pointRect should be in Texture coordinates, not pixel coordinates
void CCParticleSystemQuad::initTexCoordsWithRect(CCRect pointRect)
void CCParticleSystemQuad::initTexCoordsWithRect(const CCRect& pointRect)
{
// convert to pixels coords
@ -152,7 +152,7 @@ void CCParticleSystemQuad::initTexCoordsWithRect(CCRect pointRect)
m_pQuads[i].tr.texCoords.v = top;
}
}
void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, CCRect rect)
void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, const CCRect& rect)
{
// Only update the texture if is different from the current one
if( !m_pTexture || texture->getName() != m_pTexture->getName() )
@ -164,7 +164,7 @@ void CCParticleSystemQuad::setTextureWithRect(CCTexture2D *texture, CCRect rect)
}
void CCParticleSystemQuad::setTexture(CCTexture2D* texture)
{
CCSize s = texture->getContentSize();
const CCSize& s = texture->getContentSize();
this->setTextureWithRect(texture, CCRectMake(0, 0, s.width, s.height));
}
void CCParticleSystemQuad::setDisplayFrame(CCSpriteFrame *spriteFrame)
@ -192,7 +192,7 @@ void CCParticleSystemQuad::initIndices()
m_pIndices[i6+3] = (GLushort) i4+3;
}
}
void CCParticleSystemQuad::updateQuadWithParticle(tCCParticle* particle, CCPoint newPosition)
void CCParticleSystemQuad::updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition)
{
// colors
ccV2F_C4B_T2F_Quad *quad = &(m_pQuads[m_uParticleIdx]);

View File

@ -66,6 +66,10 @@ It's new in cocos2d-x since v0.99.5
protected: varType varName;\
public: virtual varType get##funName(void);
#define CC_PROPERTY_READONLY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: virtual const varType& get##funName(void);
/** CC_PROPERTY is used to declare a protected variable.
We can use getter to read the variable, and use the setter to change the variable.
@param varType : the type of variable.
@ -81,6 +85,11 @@ protected: varType varName;\
public: virtual varType get##funName(void);\
public: virtual void set##funName(varType var);
#define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: virtual const varType& get##funName(void);\
public: virtual void set##funName(const varType& var);
/** CC_SYNTHESIZE_READONLY is used to declare a protected variable.
We can use getter to read the variable.
@param varType : the type of variable.
@ -94,6 +103,10 @@ public: virtual void set##funName(varType var);
protected: varType varName;\
public: inline varType get##funName(void) const { return varName; }
#define CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: inline const varType& get##funName(void) const { return varName; }
/** CC_SYNTHESIZE is used to declare a protected variable.
We can use getter to read the variable, and use the setter to change the variable.
@param varType : the type of variable.
@ -109,6 +122,11 @@ protected: varType varName;\
public: inline varType get##funName(void) const { return varName; }\
public: inline void set##funName(varType var){ varName = var; }
#define CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\
protected: varType varName;\
public: inline const varType& get##funName(void) const { return varName; }\
public: inline void set##funName(const varType& var){ varName = var; }
#define CC_SAFE_DELETE(p) if(p) { delete p; p = 0; }
#define CC_SAFE_DELETE_ARRAY(p) if(p) { delete[] p; p = 0; }
#define CC_SAFE_FREE(p) if(p) { free(p); p = 0; }

View File

@ -101,7 +101,7 @@ namespace cocos2d
m_pobFrames->addObject(pFrame);
}
void CCAnimation::addFrameWithTexture(CCTexture2D *pobTexture, CCRect rect)
void CCAnimation::addFrameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{
CCSpriteFrame *pFrame = CCSpriteFrame::frameWithTexture(pobTexture, rect);
m_pobFrames->addObject(pFrame);

View File

@ -59,7 +59,7 @@ struct transformValues_ {
bool visible;
};
CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect)
CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithBatchNode(batchNode, rect))
@ -71,7 +71,7 @@ CCSprite* CCSprite::spriteWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rec
return NULL;
}
bool CCSprite::initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect)
bool CCSprite::initWithBatchNode(CCSpriteBatchNode *batchNode, const CCRect& rect)
{
if (initWithTexture(batchNode->getTexture(), rect))
{
@ -81,7 +81,7 @@ bool CCSprite::initWithBatchNode(CCSpriteBatchNode *batchNode, CCRect rect)
return false;
}
bool CCSprite::initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, CCRect rect)
bool CCSprite::initWithBatchNodeRectInPixels(CCSpriteBatchNode *batchNode, const CCRect& rect)
{
if (initWithTexture(batchNode->getTexture()))
{
@ -104,7 +104,7 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture)
return NULL;
}
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect)
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithTexture(pTexture, rect))
@ -116,7 +116,7 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect)
return NULL;
}
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, CCRect rect, CCPoint offset)
CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect, const CCPoint& offset)
{
CC_UNUSED_PARAM(pTexture);
CC_UNUSED_PARAM(rect);
@ -138,7 +138,7 @@ CCSprite* CCSprite::spriteWithFile(const char *pszFileName)
return NULL;
}
CCSprite* CCSprite::spriteWithFile(const char *pszFileName, CCRect rect)
CCSprite* CCSprite::spriteWithFile(const char *pszFileName, const CCRect& rect)
{
CCSprite *pobSprite = new CCSprite();
if (pobSprite && pobSprite->initWithFile(pszFileName, rect))
@ -221,7 +221,7 @@ bool CCSprite::init(void)
return true;
}
bool CCSprite::initWithTexture(CCTexture2D *pTexture, CCRect rect)
bool CCSprite::initWithTexture(CCTexture2D *pTexture, const CCRect& rect)
{
assert(pTexture != NULL);
// IMPORTANT: [self init] and not [super init];
@ -260,7 +260,7 @@ bool CCSprite::initWithFile(const char *pszFilename)
return false;
}
bool CCSprite::initWithFile(const char *pszFilename, CCRect rect)
bool CCSprite::initWithFile(const char *pszFilename, const CCRect& rect)
{
assert(pszFilename != NULL);
@ -313,7 +313,7 @@ CCSprite* CCSprite::initWithCGImage(CGImageRef pImage, const char *pszKey)
// XXX: possible bug. See issue #349. New API should be added
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addCGImage(pImage, pszKey);
CCSize size = pTexture->getContentSize();
const CCSize& size = pTexture->getContentSize();
CCRect rect = CCRectMake(0 ,0, size.width, size.height);
return initWithTexture(texture, rect);
@ -356,14 +356,14 @@ void CCSprite::useBatchNode(CCSpriteBatchNode *batchNode)
m_pobBatchNode = batchNode;
}
void CCSprite::setTextureRect(CCRect rect)
void CCSprite::setTextureRect(const CCRect& rect)
{
CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect);
setTextureRectInPixels(rectInPixels, false, rectInPixels.size);
}
void CCSprite::setTextureRectInPixels(CCRect rect, bool rotated, CCSize size)
void CCSprite::setTextureRectInPixels(const CCRect& rect, bool rotated, const CCSize& size)
{
m_obRectInPixels = rect;
m_obRect = CC_RECT_PIXELS_TO_POINTS(rect);
@ -412,7 +412,7 @@ void CCSprite::setTextureRectInPixels(CCRect rect, bool rotated, CCSize size)
}
void CCSprite::updateTextureCoords(CCRect rect)
void CCSprite::updateTextureCoords(const CCRect& rect)
{
CCTexture2D *tex = m_bUsesBatchNode ? m_pobTextureAtlas->getTexture() : m_pobTexture;
if (! tex)
@ -702,8 +702,8 @@ void CCSprite::draw(void)
ccDrawPoly(vertices, 4, true);
#elif CC_SPRITE_DEBUG_DRAW == 2
// draw texture box
CCSize s = m_obRect.size;
CCPoint offsetPix = getOffsetPositionInPixels();
const CCSize& s = m_obRect.size;
const CCPoint& offsetPix = getOffsetPositionInPixels();
CCPoint vertices[4] = {
ccp(offsetPix.x,offsetPix.y), ccp(offsetPix.x+s.width,offsetPix.y),
ccp(offsetPix.x+s.width,offsetPix.y+s.height), ccp(offsetPix.x,offsetPix.y+s.height)
@ -826,13 +826,13 @@ void CCSprite::setDirtyRecursively(bool bValue)
} \
}
void CCSprite::setPosition(CCPoint pos)
void CCSprite::setPosition(const CCPoint& pos)
{
CCNode::setPosition(pos);
SET_DIRTY_RECURSIVELY();
}
void CCSprite::setPositionInPixels(CCPoint pos)
void CCSprite::setPositionInPixels(const CCPoint& pos)
{
CCNode::setPositionInPixels(pos);
SET_DIRTY_RECURSIVELY();
@ -880,7 +880,7 @@ void CCSprite::setVertexZ(float fVertexZ)
SET_DIRTY_RECURSIVELY();
}
void CCSprite::setAnchorPoint(CCPoint anchor)
void CCSprite::setAnchorPoint(const CCPoint& anchor)
{
CCNode::setAnchorPoint(anchor);
SET_DIRTY_RECURSIVELY();
@ -976,7 +976,7 @@ void CCSprite::setOpacity(GLubyte opacity)
updateColor();
}
ccColor3B CCSprite::getColor(void)
const ccColor3B& CCSprite::getColor(void)
{
if (m_bOpacityModifyRGB)
{
@ -986,7 +986,7 @@ ccColor3B CCSprite::getColor(void)
return m_sColor;
}
void CCSprite::setColor(ccColor3B color3)
void CCSprite::setColor(const ccColor3B& color3)
{
m_sColor = m_sColorUnmodified = color3;

View File

@ -39,7 +39,7 @@ namespace cocos2d
/*
* creation with CCTexture2D
*/
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(cocos2d::CCTexture2D *tex)
CCSpriteBatchNode* CCSpriteBatchNode::batchNodeWithTexture(CCTexture2D *tex)
{
CCSpriteBatchNode *batchNode = new CCSpriteBatchNode();
batchNode->initWithTexture(tex, defaultCapacity);
@ -81,7 +81,7 @@ namespace cocos2d
/*
* init with CCTexture2D
*/
bool CCSpriteBatchNode::initWithTexture(cocos2d::CCTexture2D *tex, unsigned int capacity)
bool CCSpriteBatchNode::initWithTexture(CCTexture2D *tex, unsigned int capacity)
{
m_blendFunc.src = CC_BLEND_SRC;
m_blendFunc.dst = CC_BLEND_DST;

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
namespace cocos2d {
// implementation of CCSpriteFrame
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, CCRect rect)
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, const CCRect& rect)
{
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect);
@ -38,7 +38,7 @@ CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D *pobTexture, CCRect r
return pSpriteFrame;
}
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize)
CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{
CCSpriteFrame *pSpriteFrame = new CCSpriteFrame();;
pSpriteFrame->initWithTexture(pobTexture, rect, rotated, offset, originalSize);
@ -47,13 +47,13 @@ CCSpriteFrame* CCSpriteFrame::frameWithTexture(CCTexture2D* pobTexture, CCRect r
return pSpriteFrame;
}
bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, CCRect rect)
bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, const CCRect& rect)
{
CCRect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect);
return initWithTexture(pobTexture, rectInPixels, false, CCPointZero, rectInPixels.size);
}
bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, CCRect rect, bool rotated, CCPoint offset, CCSize originalSize)
bool CCSpriteFrame::initWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize)
{
m_pobTexture = pobTexture;
@ -88,13 +88,13 @@ CCObject* CCSpriteFrame::copyWithZone(CCZone *pZone)
return pCopy;
}
void CCSpriteFrame::setRect(CCRect rect)
void CCSpriteFrame::setRect(const CCRect& rect)
{
m_obRect = rect;
m_obRectInPixels = CC_RECT_POINTS_TO_PIXELS(m_obRect);
}
void CCSpriteFrame::setRectInPixels(CCRect rectInPixels)
void CCSpriteFrame::setRectInPixels(const CCRect& rectInPixels)
{
m_obRectInPixels = rectInPixels;
m_obRect = CC_RECT_PIXELS_TO_POINTS(rectInPixels);

View File

@ -69,7 +69,7 @@ CCTextFieldTTF::~CCTextFieldTTF()
// static constructor
//////////////////////////////////////////////////////////////////////////
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
CCTextFieldTTF *pRet = new CCTextFieldTTF();
if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
@ -105,7 +105,7 @@ CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholde
// initialize
//////////////////////////////////////////////////////////////////////////
bool CCTextFieldTTF::initWithPlaceHolder(const char *placeholder, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
bool CCTextFieldTTF::initWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
if (placeholder)
{

View File

@ -102,7 +102,7 @@ GLuint CCTexture2D::getName()
return m_uName;
}
CCSize CCTexture2D::getContentSizeInPixels()
const CCSize& CCTexture2D::getContentSizeInPixels()
{
return m_tContentSize;
}
@ -153,7 +153,7 @@ bool CCTexture2D::getHasPremultipliedAlpha()
return m_bHasPremultipliedAlpha;
}
bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize)
bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSize)
{
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glGenTextures(1, &m_uName);
@ -441,7 +441,7 @@ bool CCTexture2D::initWithString(const char *text, const char *fontName, float f
{
return initWithString(text, CCSizeMake(0,0), CCTextAlignmentCenter, fontName, fontSize);
}
bool CCTexture2D::initWithString(const char *text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
bool CCTexture2D::initWithString(const char *text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
#if CC_ENABLE_CACHE_TEXTTURE_DATA
// cache the texture data
@ -462,7 +462,7 @@ bool CCTexture2D::initWithString(const char *text, CCSize dimensions, CCTextAlig
// implementation CCTexture2D (Drawing)
void CCTexture2D::drawAtPoint(CCPoint point)
void CCTexture2D::drawAtPoint(const CCPoint& point)
{
GLfloat coordinates[] = {
0.0f, m_fMaxT,
@ -485,7 +485,7 @@ void CCTexture2D::drawAtPoint(CCPoint point)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void CCTexture2D::drawInRect(CCRect rect)
void CCTexture2D::drawInRect(const CCRect& rect)
{
GLfloat coordinates[] = {
0.0f, m_fMaxT,

View File

@ -534,7 +534,7 @@ void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName
vt->m_FmtImage = format;
}
void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, CCSize contentSize)
void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, const CCSize& contentSize)
{
if (isReloading)
return;
@ -559,7 +559,7 @@ void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPix
vt->m_TextureSize = contentSize;
}
void VolatileTexture::addStringTexture(CCTexture2D *tt, const char* text, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
void VolatileTexture::addStringTexture(CCTexture2D *tt, const char* text, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
if (isReloading)
return;

View File

@ -77,7 +77,7 @@ namespace cocos2d {
CC_UNUSED_PARAM(tag);
CCAssert(0,"ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
}
void CCParallaxNode::addChild(CCNode *child, unsigned int z, CCPoint ratio, CCPoint offset)
void CCParallaxNode::addChild(CCNode *child, unsigned int z, const CCPoint& ratio, const CCPoint& offset)
{
CCAssert( child != NULL, "Argument must be non-nil");
CCPointObject *obj = CCPointObject::pointWithCCPoint(ratio, offset);

View File

@ -221,7 +221,7 @@ namespace cocos2d {
}
// CCTMXLayer - obtaining tiles/gids
CCSprite * CCTMXLayer::tileAt(CCPoint pos)
CCSprite * CCTMXLayer::tileAt(const CCPoint& pos)
{
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -255,7 +255,7 @@ namespace cocos2d {
}
return tile;
}
unsigned int CCTMXLayer::tileGIDAt(CCPoint pos)
unsigned int CCTMXLayer::tileGIDAt(const CCPoint& pos)
{
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -265,7 +265,7 @@ namespace cocos2d {
}
// CCTMXLayer - adding helper methods
CCSprite * CCTMXLayer::insertTileForGID(unsigned int gid, CCPoint pos)
CCSprite * CCTMXLayer::insertTileForGID(unsigned int gid, const CCPoint& pos)
{
CCRect rect = m_pTileSet->rectForGID(gid);
rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor);
@ -315,7 +315,7 @@ namespace cocos2d {
m_pTiles[z] = gid;
return m_pReusedTile;
}
CCSprite * CCTMXLayer::updateTileForGID(unsigned int gid, CCPoint pos)
CCSprite * CCTMXLayer::updateTileForGID(unsigned int gid, const CCPoint& pos)
{
CCRect rect = m_pTileSet->rectForGID(gid);
rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor);
@ -348,7 +348,7 @@ namespace cocos2d {
// used only when parsing the map. useless after the map was parsed
// since lot's of assumptions are no longer true
CCSprite * CCTMXLayer::appendTileForGID(unsigned int gid, CCPoint pos)
CCSprite * CCTMXLayer::appendTileForGID(unsigned int gid, const CCPoint& pos)
{
CCRect rect = m_pTileSet->rectForGID(gid);
rect = CCRect::CCRectMake(rect.origin.x / m_fContentScaleFactor, rect.origin.y / m_fContentScaleFactor, rect.size.width/ m_fContentScaleFactor, rect.size.height/ m_fContentScaleFactor);
@ -413,7 +413,7 @@ namespace cocos2d {
}
// CCTMXLayer - adding / remove tiles
void CCTMXLayer::setTileGID(unsigned int gid, CCPoint pos)
void CCTMXLayer::setTileGID(unsigned int gid, const CCPoint& pos)
{
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -477,7 +477,7 @@ namespace cocos2d {
ccCArrayRemoveValueAtIndex(m_pAtlasIndexArray, atlasIndex);
CCSpriteBatchNode::removeChild(sprite, cleanup);
}
void CCTMXLayer::removeTileAt(CCPoint pos)
void CCTMXLayer::removeTileAt(const CCPoint& pos)
{
CCAssert( pos.x < m_tLayerSize.width && pos.y < m_tLayerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCAssert( m_pTiles && m_pAtlasIndexArray, "TMXLayer: the tiles map has been released");
@ -527,7 +527,7 @@ namespace cocos2d {
}
//CCTMXLayer - obtaining positions, offset
CCPoint CCTMXLayer::calculateLayerOffset(CCPoint pos)
CCPoint CCTMXLayer::calculateLayerOffset(const CCPoint& pos)
{
CCPoint ret = CCPointZero;
switch( m_uLayerOrientation )
@ -545,7 +545,7 @@ namespace cocos2d {
}
return ret;
}
CCPoint CCTMXLayer::positionAt(CCPoint pos)
CCPoint CCTMXLayer::positionAt(const CCPoint& pos)
{
CCPoint ret = CCPointZero;
switch( m_uLayerOrientation )
@ -562,19 +562,19 @@ namespace cocos2d {
}
return ret;
}
CCPoint CCTMXLayer::positionForOrthoAt(CCPoint pos)
CCPoint CCTMXLayer::positionForOrthoAt(const CCPoint& pos)
{
CCPoint xy = CCPointMake(pos.x * m_tMapTileSize.width,
(m_tLayerSize.height - pos.y - 1) * m_tMapTileSize.height);
return xy;
}
CCPoint CCTMXLayer::positionForIsoAt(CCPoint pos)
CCPoint CCTMXLayer::positionForIsoAt(const CCPoint& pos)
{
CCPoint xy = CCPointMake(m_tMapTileSize.width /2 * ( m_tLayerSize.width + pos.x - pos.y - 1),
m_tMapTileSize.height /2 * (( m_tLayerSize.height * 2 - pos.x - pos.y) - 2));
return xy;
}
CCPoint CCTMXLayer::positionForHexAt(CCPoint pos)
CCPoint CCTMXLayer::positionForHexAt(const CCPoint& pos)
{
float diffY = 0;
if( (int)pos.x % 2 == 1 )
@ -586,7 +586,7 @@ namespace cocos2d {
(m_tLayerSize.height - pos.y - 1) * m_tMapTileSize.height + diffY);
return xy;
}
int CCTMXLayer::vertexZForPos(CCPoint pos)
int CCTMXLayer::vertexZForPos(const CCPoint& pos)
{
int ret = 0;
unsigned int maxVal = 0;

View File

@ -92,7 +92,7 @@ namespace cocos2d{
m_pTMXLayers->setObject(child, layerName);
// update content size with the max size
CCSize childSize = child->getContentSize();
const CCSize& childSize = child->getContentSize();
CCSize currentSize = this->getContentSize();
currentSize.width = MAX( currentSize.width, childSize.width );
currentSize.height = MAX( currentSize.height, childSize.height );

View File

@ -130,7 +130,7 @@ namespace cocos2d {
}
// CCTileMapAtlas - Atlas generation / updates
void CCTileMapAtlas::setTile(ccColor3B tile, ccGridSize position)
void CCTileMapAtlas::setTile(const ccColor3B& tile, const ccGridSize& position)
{
CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil");
CCAssert( m_pPosToAtlasIndex != NULL, "posToAtlasIndex must not be nil");
@ -164,7 +164,7 @@ namespace cocos2d {
this->updateAtlasValueAt(position, tile, num);
}
}
ccColor3B CCTileMapAtlas::tileAt(ccGridSize position)
ccColor3B CCTileMapAtlas::tileAt(const ccGridSize& position)
{
CCAssert( m_pTGAInfo != NULL, "tgaInfo must not be nil");
CCAssert( position.x < m_pTGAInfo->width, "Invalid position.x");
@ -175,7 +175,7 @@ namespace cocos2d {
return value;
}
void CCTileMapAtlas::updateAtlasValueAt(ccGridSize pos, ccColor3B value, unsigned int index)
void CCTileMapAtlas::updateAtlasValueAt(const ccGridSize& pos, const ccColor3B& value, unsigned int index)
{
ccV3F_C4B_T2F_Quad quad;