2012-06-13 02:59:49 +08:00
|
|
|
#include "CCLayerGradientLoader.h"
|
2012-05-31 02:28:50 +08:00
|
|
|
|
2012-09-24 11:47:33 +08:00
|
|
|
|
2012-05-31 02:28:50 +08:00
|
|
|
|
|
|
|
#define PROPERTY_STARTCOLOR "startColor"
|
|
|
|
#define PROPERTY_ENDCOLOR "endColor"
|
|
|
|
#define PROPERTY_STARTOPACITY "startOpacity"
|
|
|
|
#define PROPERTY_ENDOPACITY "endOpacity"
|
|
|
|
#define PROPERTY_VECTOR "vector"
|
|
|
|
#define PROPERTY_BLENDFUNC "blendFunc"
|
|
|
|
|
2012-07-19 17:22:36 +08:00
|
|
|
NS_CC_EXT_BEGIN
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerGradient *)pNode)->setStartColor(pCCColor3B);
|
2012-06-14 15:01:01 +08:00
|
|
|
} else if(pPropertyName->compare(PROPERTY_ENDCOLOR) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerGradient *)pNode)->setEndColor(pCCColor3B);
|
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_STARTOPACITY) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerGradient *)pNode)->setStartOpacity(pByte);
|
2012-06-14 15:01:01 +08:00
|
|
|
} else if(pPropertyName->compare(PROPERTY_ENDOPACITY) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerGradient *)pNode)->setEndOpacity(pByte);
|
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerGradient *)pNode)->setBlendFunc(pCCBlendFunc);
|
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_VECTOR) == 0) {
|
2012-05-31 02:28:50 +08:00
|
|
|
((CCLayerGradient *)pNode)->setVector(pPoint);
|
|
|
|
|
|
|
|
// TODO Not passed along the ccbi file.
|
2012-06-15 16:47:30 +08:00
|
|
|
// ((CCLayerGradient *)pNode)->setCompressedInterpolation(true);
|
2012-05-31 02:28:50 +08:00
|
|
|
} else {
|
|
|
|
CCLayerLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
|
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_EXT_END
|