issue #2373: Adding missing overload const getter functions.

This commit is contained in:
James Chen 2013-07-05 15:06:38 +08:00
parent d2746bbe90
commit ec902c3550
15 changed files with 48 additions and 47 deletions

View File

@ -152,7 +152,7 @@ void AtlasNode::draw(void)
// AtlasNode - RGBA protocol
const ccColor3B& AtlasNode::getColor()
const ccColor3B& AtlasNode::getColor() const
{
if(_isOpacityModifyRGB)
{
@ -191,7 +191,7 @@ void AtlasNode::setOpacityModifyRGB(bool bValue)
this->setColor(oldColor);
}
bool AtlasNode::isOpacityModifyRGB()
bool AtlasNode::isOpacityModifyRGB() const
{
return _isOpacityModifyRGB;
}

View File

@ -107,9 +107,9 @@ public:
/** sets a new texture. it will be retained*/
virtual void setTexture(Texture2D *texture);
virtual bool isOpacityModifyRGB();
virtual bool isOpacityModifyRGB() const;
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
virtual const ccColor3B& getColor(void);
virtual const ccColor3B& getColor(void) const;
virtual void setColor(const ccColor3B& color);
virtual void setOpacity(GLubyte opacity);

View File

@ -135,7 +135,7 @@ public:
virtual void onExit();
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
virtual bool isOpacityModifyRGB(void) const { return false;}
virtual bool isEnabled() { return _enabled; }
virtual void setEnabled(bool value) { _enabled = value; };

View File

@ -154,7 +154,7 @@ void ProgressTimer::setOpacityModifyRGB(bool bValue)
CC_UNUSED_PARAM(bValue);
}
bool ProgressTimer::isOpacityModifyRGB(void)
bool ProgressTimer::isOpacityModifyRGB(void) const
{
return false;
}
@ -225,7 +225,7 @@ void ProgressTimer::updateProgress(void)
}
}
void ProgressTimer::setAnchorPoint(Point anchorPoint)
void ProgressTimer::setAnchorPoint(const Point& anchorPoint)
{
Node::setAnchorPoint(anchorPoint);
}

View File

@ -80,10 +80,10 @@ public:
void setReverseProgress(bool reverse);
virtual void draw(void);
void setAnchorPoint(Point anchorPoint);
void setAnchorPoint(const Point& anchorPoint);
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
virtual bool isOpacityModifyRGB(void) const;
inline bool isReverseDirection() { return _reverseDirection; };
inline void setReverseDirection(bool value) { _reverseDirection = value; };

View File

@ -248,7 +248,7 @@ void Control::setOpacityModifyRGB(bool bOpacityModifyRGB)
}
}
bool Control::isOpacityModifyRGB()
bool Control::isOpacityModifyRGB() const
{
return _isOpacityModifyRGB;
}

View File

@ -114,7 +114,7 @@ public:
*/
virtual void needsLayout();
virtual bool isOpacityModifyRGB();
virtual bool isOpacityModifyRGB() const;
virtual void setOpacityModifyRGB(bool bOpacityModifyRGB);
protected:

View File

@ -724,7 +724,7 @@ void ControlButton::setOpacity(GLubyte opacity)
}
}
GLubyte ControlButton::getOpacity()
GLubyte ControlButton::getOpacity() const
{
return _realOpacity;
}
@ -741,7 +741,7 @@ void ControlButton::setColor(const ccColor3B & color)
}
}
const ccColor3B& ControlButton::getColor()
const ccColor3B& ControlButton::getColor() const
{
return _realColor;
}

View File

@ -91,9 +91,9 @@ protected:
CC_PROPERTY(Point, _labelAnchorPoint, LabelAnchorPoint);
/* Override setter to affect a background sprite too */
virtual GLubyte getOpacity(void);
virtual GLubyte getOpacity(void) const;
virtual void setOpacity(GLubyte var);
virtual const ccColor3B& getColor(void);
virtual const ccColor3B& getColor(void) const;
virtual void setColor(const ccColor3B&);
/** Flag to know if the button is currently pushed. */

View File

@ -719,7 +719,7 @@ void Scale9Sprite::setOpacityModifyRGB(bool var)
}
}
}
bool Scale9Sprite::isOpacityModifyRGB()
bool Scale9Sprite::isOpacityModifyRGB() const
{
return _opacityModifyRGB;
}
@ -806,7 +806,7 @@ void Scale9Sprite::setColor(const ccColor3B& color)
}
}
const ccColor3B& Scale9Sprite::getColor()
const ccColor3B& Scale9Sprite::getColor() const
{
return _color;
}
@ -827,7 +827,7 @@ void Scale9Sprite::setOpacity(GLubyte opacity)
}
}
GLubyte Scale9Sprite::getOpacity()
GLubyte Scale9Sprite::getOpacity() const
{
return _opacity;
}

View File

@ -306,11 +306,11 @@ public:
/** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
@since v0.8
*/
virtual bool isOpacityModifyRGB(void);
virtual bool isOpacityModifyRGB(void) const;
virtual void setOpacity(GLubyte opacity);
virtual GLubyte getOpacity();
virtual GLubyte getOpacity() const;
virtual void setColor(const ccColor3B& color);
virtual const ccColor3B& getColor();
virtual const ccColor3B& getColor() const;
virtual bool updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bool rotated, Rect capInsets);

View File

@ -166,28 +166,29 @@ void PhysicsSprite::setIgnoreBodyRotation(bool bIgnoreBodyRotation)
}
// Override the setters and getters to always reflect the body's properties.
const Point& PhysicsSprite::getPosition()
const Point& PhysicsSprite::getPosition() const
{
updatePosFromPhysics();
return Node::getPosition();
return getPosFromPhysics();
}
void PhysicsSprite::getPosition(float* x, float* y)
void PhysicsSprite::getPosition(float* x, float* y) const
{
updatePosFromPhysics();
return Node::getPosition(x, y);
if (x == NULL || y == NULL) {
return;
}
const Point& pos = getPosFromPhysics();
*x = pos.x;
*y = pos.y;
}
float PhysicsSprite::getPositionX()
float PhysicsSprite::getPositionX() const
{
updatePosFromPhysics();
return _position.x;
return getPosFromPhysics().x;
}
float PhysicsSprite::getPositionY()
float PhysicsSprite::getPositionY() const
{
updatePosFromPhysics();
return _position.y;
return getPosFromPhysics().y;
}
//
@ -270,22 +271,22 @@ void PhysicsSprite::setCPBody(cpBody *pBody)
// Common to Box2d and Chipmunk
//
void PhysicsSprite::updatePosFromPhysics()
const Point& PhysicsSprite::getPosFromPhysics() const
{
static Point s_physicPosion;
#if CC_ENABLE_CHIPMUNK_INTEGRATION
cpVect cpPos = cpBodyGetPos(_CPBody);
_position = ccp(cpPos.x, cpPos.y);
s_physicPosion = ccp(cpPos.x, cpPos.y);
#elif CC_ENABLE_BOX2D_INTEGRATION
b2Vec2 pos = _pB2Body->GetPosition();
float x = pos.x * _PTMRatio;
float y = pos.y * _PTMRatio;
_position = ccp(x,y);
s_physicPosion = ccp(x,y);
#endif
return s_physicPosion;
}
void PhysicsSprite::setPosition(const Point &pos)
@ -303,7 +304,7 @@ void PhysicsSprite::setPosition(const Point &pos)
}
float PhysicsSprite::getRotation()
float PhysicsSprite::getRotation() const
{
#if CC_ENABLE_CHIPMUNK_INTEGRATION

View File

@ -96,12 +96,12 @@ public:
bool isIgnoreBodyRotation() const;
void setIgnoreBodyRotation(bool bIgnoreBodyRotation);
virtual const Point& getPosition();
virtual void getPosition(float* x, float* y);
virtual float getPositionX();
virtual float getPositionY();
virtual const Point& getPosition() const;
virtual void getPosition(float* x, float* y) const;
virtual float getPositionX() const;
virtual float getPositionY() const;
virtual void setPosition(const Point &position);
virtual float getRotation();
virtual float getRotation() const;
virtual void setRotation(float fRotation);
virtual AffineTransform nodeToParentTransform();
@ -123,7 +123,7 @@ public:
void setPTMRatio(float fPTMRatio);
protected:
void updatePosFromPhysics();
const Point& getPosFromPhysics() const;
};
NS_CC_EXT_END

View File

@ -284,7 +284,7 @@ void CCSkeleton::setOpacityModifyRGB (bool value) {
premultipliedAlpha = value;
}
bool CCSkeleton::isOpacityModifyRGB () {
bool CCSkeleton::isOpacityModifyRGB () const {
return premultipliedAlpha;
}

View File

@ -82,7 +82,7 @@ public:
// --- BlendProtocol
CC_PROPERTY_PASS_BY_REF(cocos2d::ccBlendFunc, blendFunc, BlendFunc);
virtual void setOpacityModifyRGB (bool value);
virtual bool isOpacityModifyRGB ();
virtual bool isOpacityModifyRGB() const;
protected:
CCSkeleton ();