mirror of https://github.com/axmolengine/axmol.git
override updateDisplayedColor and updateDisplayedOpacity method in Scale9Sprite class
This commit is contained in:
parent
6bb2d64f19
commit
652f679d50
|
@ -61,8 +61,6 @@ Scale9Sprite::Scale9Sprite()
|
|||
, _bottom(NULL)
|
||||
, _bottomRight(NULL)
|
||||
, _opacityModifyRGB(false)
|
||||
, _opacity(255)
|
||||
, _color(Color3B::WHITE)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -774,8 +772,7 @@ void Scale9Sprite::visit()
|
|||
|
||||
void Scale9Sprite::setColor(const Color3B& color)
|
||||
{
|
||||
_color = color;
|
||||
|
||||
NodeRGBA::setColor(color);
|
||||
Object* child;
|
||||
Array* children = _scale9Image->getChildren();
|
||||
CCARRAY_FOREACH(children, child)
|
||||
|
@ -790,13 +787,12 @@ void Scale9Sprite::setColor(const Color3B& color)
|
|||
|
||||
const Color3B& Scale9Sprite::getColor() const
|
||||
{
|
||||
return _color;
|
||||
return _realColor;
|
||||
}
|
||||
|
||||
void Scale9Sprite::setOpacity(GLubyte opacity)
|
||||
{
|
||||
_opacity = opacity;
|
||||
|
||||
NodeRGBA::setOpacity(opacity);
|
||||
Object* child;
|
||||
Array* children = _scale9Image->getChildren();
|
||||
CCARRAY_FOREACH(children, child)
|
||||
|
@ -811,7 +807,37 @@ void Scale9Sprite::setOpacity(GLubyte opacity)
|
|||
|
||||
GLubyte Scale9Sprite::getOpacity() const
|
||||
{
|
||||
return _opacity;
|
||||
return _realOpacity;
|
||||
}
|
||||
|
||||
void Scale9Sprite::updateDisplayedColor(const cocos2d::Color3B &parentColor)
|
||||
{
|
||||
NodeRGBA::updateDisplayedColor(parentColor);
|
||||
Object* child;
|
||||
Array* children = _scale9Image->getChildren();
|
||||
CCARRAY_FOREACH(children, child)
|
||||
{
|
||||
RGBAProtocol* pNode = dynamic_cast<RGBAProtocol*>(child);
|
||||
if (pNode)
|
||||
{
|
||||
pNode->updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Scale9Sprite::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
NodeRGBA::updateDisplayedOpacity(parentOpacity);
|
||||
Object* child;
|
||||
Array* children = _scale9Image->getChildren();
|
||||
CCARRAY_FOREACH(children, child)
|
||||
{
|
||||
RGBAProtocol* pNode = dynamic_cast<RGBAProtocol*>(child);
|
||||
if (pNode)
|
||||
{
|
||||
pNode->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -97,8 +97,6 @@ protected:
|
|||
Sprite* _bottomRight;
|
||||
|
||||
bool _opacityModifyRGB;
|
||||
GLubyte _opacity;
|
||||
Color3B _color;
|
||||
|
||||
void updateCapInset();
|
||||
void updatePositions();
|
||||
|
@ -312,6 +310,9 @@ public:
|
|||
virtual GLubyte getOpacity() const;
|
||||
virtual void setColor(const Color3B& color);
|
||||
virtual const Color3B& getColor() const;
|
||||
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity);
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor);
|
||||
|
||||
virtual bool updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bool rotated, Rect capInsets);
|
||||
|
||||
|
|
Loading…
Reference in New Issue