mirror of https://github.com/axmolengine/axmol.git
fixed #1649: Changed return type to const reference for member variable access.
This commit is contained in:
parent
0fd16e7b31
commit
6565fa92cc
|
@ -142,7 +142,7 @@ void CCAtlasNode::draw(void)
|
|||
|
||||
// CCAtlasNode - RGBA protocol
|
||||
|
||||
ccColor3B CCAtlasNode:: getColor()
|
||||
const ccColor3B& CCAtlasNode:: getColor()
|
||||
{
|
||||
if(m_bIsOpacityModifyRGB)
|
||||
{
|
||||
|
|
|
@ -270,7 +270,7 @@ void CCNode::setScaleY(float newScaleY)
|
|||
}
|
||||
|
||||
/// position getter
|
||||
CCPoint CCNode::getPosition()
|
||||
const CCPoint& CCNode::getPosition()
|
||||
{
|
||||
return m_obPosition;
|
||||
}
|
||||
|
@ -368,13 +368,13 @@ void CCNode::setVisible(bool var)
|
|||
m_bVisible = var;
|
||||
}
|
||||
|
||||
CCPoint CCNode::getAnchorPointInPoints()
|
||||
const CCPoint& CCNode::getAnchorPointInPoints()
|
||||
{
|
||||
return m_obAnchorPointInPoints;
|
||||
}
|
||||
|
||||
/// anchorPoint getter
|
||||
CCPoint CCNode::getAnchorPoint()
|
||||
const CCPoint& CCNode::getAnchorPoint()
|
||||
{
|
||||
return m_obAnchorPoint;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ void CCNode::setAnchorPoint(const CCPoint& point)
|
|||
}
|
||||
|
||||
/// contentSize getter
|
||||
CCSize CCNode::getContentSize()
|
||||
const CCSize& CCNode::getContentSize()
|
||||
{
|
||||
return m_obContentSize;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ public:
|
|||
virtual void setScaleY(float fScaleY);
|
||||
|
||||
/** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */
|
||||
virtual CCPoint getPosition();
|
||||
virtual const CCPoint& getPosition();
|
||||
virtual void setPosition(const CCPoint &position);
|
||||
|
||||
/** The X skew angle of the node in degrees.
|
||||
|
@ -320,20 +320,20 @@ public:
|
|||
The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
|
||||
@since v0.8
|
||||
*/
|
||||
virtual CCPoint getAnchorPoint();
|
||||
virtual const CCPoint& getAnchorPoint();
|
||||
virtual void setAnchorPoint(const CCPoint &anchorPoint);
|
||||
|
||||
/** The anchorPoint in absolute pixels.
|
||||
Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead
|
||||
*/
|
||||
virtual CCPoint getAnchorPointInPoints();
|
||||
virtual const CCPoint& getAnchorPointInPoints();
|
||||
|
||||
/** 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
|
||||
*/
|
||||
virtual CCSize getContentSize();
|
||||
virtual const CCSize& getContentSize();
|
||||
virtual void setContentSize(const CCSize &contentSize);
|
||||
|
||||
virtual bool isVisible();
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
/** 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;
|
||||
|
|
|
@ -1069,7 +1069,7 @@ void CCLabelBMFont::setColor(const ccColor3B& var)
|
|||
}
|
||||
}
|
||||
|
||||
ccColor3B CCLabelBMFont::getColor()
|
||||
const ccColor3B& CCLabelBMFont::getColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
|
|
@ -517,7 +517,7 @@ void CCLayerColor::setOpacity(GLubyte var)
|
|||
}
|
||||
|
||||
/// color getter
|
||||
ccColor3B CCLayerColor::getColor()
|
||||
const ccColor3B& CCLayerColor::getColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ void CCLayerGradient::updateColor()
|
|||
m_pSquareColors[3].a = E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c));
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getStartColor()
|
||||
const ccColor3B& CCLayerGradient::getStartColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ void CCLayerGradient::setEndColor(const ccColor3B& color)
|
|||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getEndColor()
|
||||
const ccColor3B& CCLayerGradient::getEndColor()
|
||||
{
|
||||
return m_endColor;
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ void CCLayerGradient::setVector(const CCPoint& var)
|
|||
updateColor();
|
||||
}
|
||||
|
||||
CCPoint CCLayerGradient::getVector()
|
||||
const CCPoint& CCLayerGradient::getVector()
|
||||
{
|
||||
return m_AlongVector;
|
||||
}
|
||||
|
|
|
@ -630,7 +630,7 @@ void CCMenu::setColor(const ccColor3B& var)
|
|||
}
|
||||
}
|
||||
|
||||
ccColor3B CCMenu::getColor(void)
|
||||
const ccColor3B& CCMenu::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ void CCMenuItem::setTarget(CCObject *rec, SEL_MenuHandler selector)
|
|||
//CCMenuItemLabel
|
||||
//
|
||||
|
||||
ccColor3B CCMenuItemLabel::getDisabledColor()
|
||||
const ccColor3B& CCMenuItemLabel::getDisabledColor()
|
||||
{
|
||||
return m_tDisabledColor;
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ void CCMenuItemLabel::setColor(const ccColor3B& color)
|
|||
dynamic_cast<CCRGBAProtocol*>(m_pLabel)->setColor(color);
|
||||
}
|
||||
|
||||
ccColor3B CCMenuItemLabel::getColor()
|
||||
const ccColor3B& CCMenuItemLabel::getColor()
|
||||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pLabel)->getColor();
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ GLubyte CCMenuItemSprite::getOpacity()
|
|||
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getOpacity();
|
||||
}
|
||||
|
||||
ccColor3B CCMenuItemSprite::getColor()
|
||||
const ccColor3B& CCMenuItemSprite::getColor()
|
||||
{
|
||||
return dynamic_cast<CCRGBAProtocol*>(m_pNormalImage)->getColor();
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ void CCMenuItemToggle::setOpacity(GLubyte opacity)
|
|||
}
|
||||
}
|
||||
|
||||
ccColor3B CCMenuItemToggle::getColor()
|
||||
const ccColor3B& CCMenuItemToggle::getColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual GLubyte getOpacity();
|
||||
virtual void setColor(const ccColor3B& color);
|
||||
virtual ccColor3B getColor();
|
||||
virtual const ccColor3B& getColor();
|
||||
|
||||
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
|
||||
virtual bool isOpacityModifyRGB(void) { return false;}
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
bool initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector);
|
||||
// super methods
|
||||
virtual void setColor(const ccColor3B& color);
|
||||
virtual ccColor3B getColor();
|
||||
virtual const ccColor3B& getColor();
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual GLubyte getOpacity();
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ void CCMotionStreak::setColor(const ccColor3B& color)
|
|||
m_tColor = color;
|
||||
}
|
||||
|
||||
ccColor3B CCMotionStreak::getColor(void)
|
||||
const ccColor3B& CCMotionStreak::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
virtual void setBlendFunc(ccBlendFunc blendFunc);
|
||||
virtual ccBlendFunc getBlendFunc(void);
|
||||
virtual void setColor(const ccColor3B& color);
|
||||
virtual ccColor3B getColor(void);
|
||||
virtual const ccColor3B& getColor(void);
|
||||
virtual GLubyte getOpacity(void);
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void setOpacityModifyRGB(bool bValue);
|
||||
|
|
|
@ -155,7 +155,7 @@ void CCProgressTimer::setColor(const ccColor3B& color)
|
|||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCProgressTimer::getColor(void)
|
||||
const ccColor3B& CCProgressTimer::getColor(void)
|
||||
{
|
||||
return m_pSprite->getColor();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
void setAnchorPoint(CCPoint anchorPoint);
|
||||
|
||||
virtual void setColor(const ccColor3B& color);
|
||||
virtual ccColor3B getColor(void);
|
||||
virtual const ccColor3B& getColor(void);
|
||||
virtual GLubyte getOpacity(void);
|
||||
virtual void setOpacity(GLubyte opacity);
|
||||
virtual void setOpacityModifyRGB(bool bValue);
|
||||
|
|
|
@ -1019,7 +1019,7 @@ void CCParticleSystem::setDuration(float var)
|
|||
m_fDuration = var;
|
||||
}
|
||||
|
||||
CCPoint CCParticleSystem::getSourcePosition()
|
||||
const CCPoint& CCParticleSystem::getSourcePosition()
|
||||
{
|
||||
return m_tSourcePosition;
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ void CCParticleSystem::setSourcePosition(const CCPoint& var)
|
|||
m_tSourcePosition = var;
|
||||
}
|
||||
|
||||
CCPoint CCParticleSystem::getPosVar()
|
||||
const CCPoint& CCParticleSystem::getPosVar()
|
||||
{
|
||||
return m_tPosVar;
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ void CCParticleSystem::setEndSizeVar(float var)
|
|||
m_fEndSizeVar = var;
|
||||
}
|
||||
|
||||
ccColor4F CCParticleSystem::getStartColor()
|
||||
const ccColor4F& CCParticleSystem::getStartColor()
|
||||
{
|
||||
return m_tStartColor;
|
||||
}
|
||||
|
@ -1129,7 +1129,7 @@ void CCParticleSystem::setStartColor(const ccColor4F& var)
|
|||
m_tStartColor = var;
|
||||
}
|
||||
|
||||
ccColor4F CCParticleSystem::getStartColorVar()
|
||||
const ccColor4F& CCParticleSystem::getStartColorVar()
|
||||
{
|
||||
return m_tStartColorVar;
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ void CCParticleSystem::setStartColorVar(const ccColor4F& var)
|
|||
m_tStartColorVar = var;
|
||||
}
|
||||
|
||||
ccColor4F CCParticleSystem::getEndColor()
|
||||
const ccColor4F& CCParticleSystem::getEndColor()
|
||||
{
|
||||
return m_tEndColor;
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ void CCParticleSystem::setEndColor(const ccColor4F& var)
|
|||
m_tEndColor = var;
|
||||
}
|
||||
|
||||
ccColor4F CCParticleSystem::getEndColorVar()
|
||||
const ccColor4F& CCParticleSystem::getEndColorVar()
|
||||
{
|
||||
return m_tEndColorVar;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public: virtual void set##funName(varType var);
|
|||
|
||||
#define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\
|
||||
protected: varType varName;\
|
||||
public: virtual varType get##funName(void);\
|
||||
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.
|
||||
|
@ -179,7 +179,7 @@ public: virtual void set##funName(varType var){ varName = var; }
|
|||
|
||||
#define CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\
|
||||
protected: varType varName;\
|
||||
public: virtual varType get##funName(void) const { return varName; }\
|
||||
public: virtual const varType& get##funName(void) const { return varName; }\
|
||||
public: virtual void set##funName(const varType& var){ varName = var; }
|
||||
|
||||
#define CC_SYNTHESIZE_RETAIN(varType, varName, funName) \
|
||||
|
|
|
@ -931,7 +931,7 @@ void CCSprite::setOpacity(GLubyte opacity)
|
|||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCSprite::getColor(void)
|
||||
const ccColor3B& CCSprite::getColor(void)
|
||||
{
|
||||
if (m_bOpacityModifyRGB)
|
||||
{
|
||||
|
|
|
@ -270,7 +270,7 @@ void CCTextFieldTTF::draw()
|
|||
setColor(color);
|
||||
}
|
||||
|
||||
ccColor3B CCTextFieldTTF::getColorSpaceHolder()
|
||||
const ccColor3B& CCTextFieldTTF::getColorSpaceHolder()
|
||||
{
|
||||
return m_ColorSpaceHolder;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
CC_SYNTHESIZE(CCTextFieldDelegate *, m_pDelegate, Delegate);
|
||||
CC_SYNTHESIZE_READONLY(int, m_nCharCount, CharCount);
|
||||
virtual ccColor3B getColorSpaceHolder();
|
||||
virtual const ccColor3B& getColorSpaceHolder();
|
||||
virtual void setColorSpaceHolder(const ccColor3B& color);
|
||||
|
||||
// input text property
|
||||
|
|
|
@ -239,7 +239,7 @@ void CCControl::setColor(const ccColor3B& color)
|
|||
}
|
||||
}
|
||||
|
||||
ccColor3B CCControl::getColor(void)
|
||||
const ccColor3B& CCControl::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
|
|
@ -618,7 +618,7 @@ void CCScale9Sprite::setColor(const ccColor3B& color3)
|
|||
}
|
||||
}
|
||||
|
||||
ccColor3B CCScale9Sprite::getColor(void)
|
||||
const ccColor3B& CCScale9Sprite::getColor(void)
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ void CCScrollView::performedAnimatedScroll(float dt)
|
|||
}
|
||||
|
||||
|
||||
CCSize CCScrollView::getContentSize()
|
||||
const CCSize& CCScrollView::getContentSize()
|
||||
{
|
||||
return m_pContainer->getContentSize();
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public:
|
|||
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
|
||||
|
||||
virtual void setContentSize(const CCSize & size);
|
||||
virtual CCSize getContentSize();
|
||||
virtual const CCSize& getContentSize();
|
||||
|
||||
void updateInset();
|
||||
/**
|
||||
|
|
|
@ -177,10 +177,11 @@ void CCPhysicsSprite::setCPBody(cpBody *pBody)
|
|||
}
|
||||
|
||||
// Override the setters and getters to always reflect the body's properties.
|
||||
CCPoint CCPhysicsSprite::getPosition()
|
||||
const CCPoint& CCPhysicsSprite::getPosition()
|
||||
{
|
||||
cpVect cpPos = cpBodyGetPos(m_pCPBody);
|
||||
return ccp(cpPos.x, cpPos.y);
|
||||
m_obPosition = ccp(cpPos.x, cpPos.y);
|
||||
return m_obPosition;
|
||||
}
|
||||
|
||||
void CCPhysicsSprite::setPosition(const CCPoint &pos)
|
||||
|
@ -245,13 +246,14 @@ void CCPhysicsSprite::setPTMRatio(float fRatio)
|
|||
}
|
||||
|
||||
// Override the setters and getters to always reflect the body's properties.
|
||||
CCPoint CCPhysicsSprite::getPosition()
|
||||
const CCPoint& CCPhysicsSprite::getPosition()
|
||||
{
|
||||
b2Vec2 pos = m_pB2Body->GetPosition();
|
||||
|
||||
float x = pos.x * m_fPTMRatio;
|
||||
float y = pos.y * m_fPTMRatio;
|
||||
return ccp(x,y);
|
||||
m_obPosition = ccp(x,y);
|
||||
return m_obPosition;
|
||||
}
|
||||
|
||||
void CCPhysicsSprite::setPosition(const CCPoint &pos)
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
|
||||
#if CC_ENABLE_CHIPMUNK_INTEGRATION
|
||||
|
||||
virtual CCPoint getPosition();
|
||||
virtual const CCPoint& getPosition();
|
||||
virtual void setPosition(const CCPoint &position);
|
||||
virtual float getRotation();
|
||||
virtual void setRotation(float fRotation);
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
#elif CC_ENABLE_BOX2D_INTEGRATION
|
||||
|
||||
virtual CCPoint getPosition();
|
||||
virtual const CCPoint& getPosition();
|
||||
virtual void setPosition(const CCPoint &position);
|
||||
virtual float getRotation();
|
||||
virtual void setRotation(float fRotation);
|
||||
|
|
Loading…
Reference in New Issue