axmol/extensions/CCBReader/CCLayerColorLoader.cpp

35 lines
1.3 KiB
C++

#include "CCLayerColorLoader.h"
NS_CC_EXT_BEGIN
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
void LayerColorLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, Color3B pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((LayerColor *)pNode)->setColor(pColor3B);
} else {
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LayerColorLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((LayerColor *)pNode)->setOpacity(pByte);
} else {
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, BlendFunc pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LayerColor *)pNode)->setBlendFunc(pBlendFunc);
} else {
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
NS_CC_EXT_END