cocos2d-x  2.1.1
CCRGBAProtocol Class Referenceabstract

RGBA protocol that affects CCNode's color and opacity. More...

#include <CCProtocols.h>

Inheritance diagram for CCRGBAProtocol:
CCAtlasNode CCLabelBMFont CCLayerColor CCMenu CCMenuItemLabel CCMenuItemSprite CCMenuItemToggle CCMotionStreak CCProgressTimer CCSprite CCControl CCScale9Sprite

Public Member Functions

virtual void setColor (const ccColor3B &color)=0
 Changes the color with R,G,B bytes.
 
virtual const ccColor3BgetColor (void)=0
 Returns color that is currently used.
 
virtual GLubyte getOpacity (void)=0
 Returns the opacity.
 
virtual void setOpacity (GLubyte opacity)=0
 Changes the opacity.
 
virtual void setOpacityModifyRGB (bool bValue)=0
 Changes the OpacityModifyRGB property.
 
virtual bool isOpacityModifyRGB (void)=0
 Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
 

Detailed Description

RGBA protocol that affects CCNode's color and opacity.

Member Function Documentation

virtual const ccColor3B& getColor ( void  )
pure virtual

Returns color that is currently used.

Returns
The ccColor3B contains R,G,B bytes.

Implemented in CCMenuItemToggle, CCSprite, CCMenuItemSprite, CCLayerColor, CCLabelBMFont, CCMenuItemLabel, CCControl, CCProgressTimer, CCAtlasNode, CCMotionStreak, CCScale9Sprite, and CCMenu.

virtual GLubyte getOpacity ( void  )
pure virtual

Returns the opacity.

The opacity which indicates how transparent or opaque this node is. 0 indicates fully transparent and 255 is fully opaque.

Returns
The opacity of sprite, from 0 ~ 255

Implemented in CCMenuItemToggle, CCMenuItemSprite, CCSprite, CCLayerColor, CCLabelBMFont, CCMenuItemLabel, CCControlButton, CCControl, CCProgressTimer, CCMotionStreak, CCAtlasNode, CCScale9Sprite, and CCMenu.

virtual bool isOpacityModifyRGB ( void  )
pure virtual

Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)

Returns
Returns opacity modify flag.

Implemented in CCMenuItemToggle, CCScale9Sprite, CCSprite, CCMenuItemSprite, CCLabelBMFont, CCLayerColor, CCMenuItemLabel, CCMenu, CCControl, CCProgressTimer, CCMotionStreak, and CCAtlasNode.

virtual void setColor ( const ccColor3B color)
pure virtual

Changes the color with R,G,B bytes.

Parameters
colorExample: ccc3(255,100,0) means R=255, G=100, B=0

Implemented in CCMenuItemToggle, CCSprite, CCMenuItemSprite, CCLayerColor, CCLabelBMFont, CCMenuItemLabel, CCControl, CCProgressTimer, CCAtlasNode, CCMotionStreak, CCScale9Sprite, CCMenu, and CCControlColourPicker.

virtual void setOpacity ( GLubyte  opacity)
pure virtual

Changes the opacity.

Parameters
valueGoes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.

Implemented in CCMenuItemToggle, CCSprite, CCMenuItemSprite, CCLayerColor, CCLabelBMFont, CCMenuItemLabel, CCControlButton, CCControl, CCProgressTimer, CCMotionStreak, CCAtlasNode, CCScale9Sprite, and CCMenu.

virtual void setOpacityModifyRGB ( bool  bValue)
pure virtual

Changes the OpacityModifyRGB property.

If thie property is set to true, then the rendered color will be affected by opacity. Normally, r = r * opacity/255, g = g * opacity/255, b = b * opacity/255.

Parameters
bValuetrue then the opacity will be applied as: glColor(R,G,B,opacity); false then the opacity will be applied as: glColor(opacity, opacity, opacity, opacity);

Implemented in CCMenuItemToggle, CCScale9Sprite, CCSprite, CCMenuItemSprite, CCLabelBMFont, CCLayerColor, CCMenuItemLabel, CCMenu, CCControl, CCProgressTimer, CCMotionStreak, and CCAtlasNode.


The documentation for this class was generated from the following file:
  • /Users/zhangkoumyou/SourceCode/cocos2d-x/cocos2dx/include/CCProtocols.h