Merge pull request #504 from minggo/iss715

fixed #715: make sure selected image is valid
This commit is contained in:
minggo 2011-09-12 23:34:27 -07:00
commit dcc5726665
1 changed files with 10 additions and 2 deletions

View File

@ -445,7 +445,11 @@ namespace cocos2d{
void CCMenuItemSprite::setOpacity(GLubyte opacity) void CCMenuItemSprite::setOpacity(GLubyte opacity)
{ {
m_pNormalImage->convertToRGBAProtocol()->setOpacity(opacity); m_pNormalImage->convertToRGBAProtocol()->setOpacity(opacity);
m_pSelectedImage->convertToRGBAProtocol()->setOpacity(opacity);
if (m_pSelectedImage)
{
m_pSelectedImage->convertToRGBAProtocol()->setOpacity(opacity);
}
if (m_pDisabledImage) if (m_pDisabledImage)
{ {
@ -455,7 +459,11 @@ namespace cocos2d{
void CCMenuItemSprite::setColor(const ccColor3B& color) void CCMenuItemSprite::setColor(const ccColor3B& color)
{ {
m_pNormalImage->convertToRGBAProtocol()->setColor(color); m_pNormalImage->convertToRGBAProtocol()->setColor(color);
m_pSelectedImage->convertToRGBAProtocol()->setColor(color);
if (m_pSelectedImage)
{
m_pSelectedImage->convertToRGBAProtocol()->setColor(color);
}
if (m_pDisabledImage) if (m_pDisabledImage)
{ {