Merge branch 'gles20-ccbi' of https://github.com/nicolasgramlich/cocos2d-x into gles20-ccbi

This commit is contained in:
James Chen 2012-06-16 11:05:28 +08:00
commit ab3dd66167
66 changed files with 866 additions and 629 deletions

View File

@ -124,6 +124,11 @@ unsigned int CCString::length() const
return m_sString.length();
}
int CCString::compare(const char * pStr) const
{
return strcmp(getCString(), pStr);
}
CCObject* CCString::copyWithZone(CCZone* pZone)
{
CCAssert(pZone == NULL, "CCString should not be inherited.");
@ -157,6 +162,31 @@ CCString* CCString::create(const char* pStr)
return pRet;
}
CCString* CCString::stringWithString(const std::string& pStr)
{
CCString* pRet = new CCString(pStr);
pRet->autorelease();
return pRet;
}
CCString* CCString::stringWithCStringData(const char* pData, unsigned long nLen)
{
CCString* pRet = NULL;
if (pData != NULL)
{
char* pStr = (char*)malloc(nLen+1);
if (pStr != NULL)
{
pStr[nLen] = '\0';
memcpy(pStr, pData, nLen);
pRet = CCString::stringWithCString(pStr);
free(pStr);
}
}
return pRet;
}
CCString* CCString::stringWithData(unsigned char* pData, unsigned long nLen)
{
return CCString::createWithData(pData, nLen);

View File

@ -66,18 +66,33 @@ public:
/** get the length of string */
unsigned int length() const;
/** compare to a c string */
int compare(const char *) const;
/* override functions */
virtual CCObject* copyWithZone(CCZone* pZone);
virtual bool isEqual(const CCObject* pObject);
/* static funcitons */
/** create a string with c string
/** create a string with c string
* @return A CCString pointer which is an autorelease object pointer,
* it means that you needn't do a release operation unless you retain it.
@warning: This interface will be deprecated in future.
*/
static CCString* stringWithCString(const char* pStr);
/** create a string with c string
* @return A CCString pointer which is an autorelease object pointer,
* it means that you needn't do a release operation unless you retain it.
*/
static CCString* stringWithCStringData(const char* pData, unsigned long nLen);
/** create a string with std::string
* @return A CCString pointer which is an autorelease object pointer,
* it means that you needn't do a release operation unless you retain it.
*/
static CCString* stringWithString(const std::string& str);
/** create a string with format, it's similar with the c function 'sprintf', the default buffer size is (1024*100) bytes,
* if you want to change it, you should modify the kMaxStringLen macro in CCString.cpp file.
* @return A CCString pointer which is an autorelease object pointer,
@ -134,6 +149,13 @@ public:
std::string m_sString;
};
struct CCStringCompare : public std::binary_function<CCString *, CCString *, bool> {
public:
bool operator() (CCString * a, CCString * b) const {
return strcmp(a->getCString(), b->getCString()) < 0;
}
};
#define CCStringMake(str) CCString::create(str)
#define ccs CCStringMake

View File

@ -9,8 +9,8 @@ CCNode * CCBFileLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
return CCNode::node();
}
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CCBFILE) == 0) {
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CCBFILE) == 0) {
pNode->addChild(pCCBFileNode);
} else {
CCNodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);

View File

@ -10,12 +10,12 @@ class CCBReader;
class CC_DLL CCBFileLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader);
protected:
virtual CCNode * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode *, CCBReader *);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode *, CCBReader *);
};
NS_CC_EXT_END

View File

@ -5,9 +5,16 @@
NS_CC_EXT_BEGIN
#define CCB_MEMBERVARIABLEASSIGNER_GLUE(TARGET, MEMBERVARIABLENAME, MEMBERVARIABLETYPE, MEMBERVARIABLE) if(pTarget == TARGET && pMemberVariableName->compare(MEMBERVARIABLENAME) == 0) { \
MEMBERVARIABLE = dynamic_cast<MEMBERVARIABLETYPE>(pNode); \
CC_ASSERT(MEMBERVARIABLE); \
MEMBERVARIABLE->retain(); \
return true; \
}
class CC_DLL CCBMemberVariableAssigner {
public:
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, const char * pMemberVariableName, CCNode * pNode) = 0;
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, cocos2d::CCString * pMemberVariableName, CCNode * pNode) = 0;
};
NS_CC_EXT_END

View File

@ -35,25 +35,6 @@ CCBReader::CCBReader(CCNodeLoaderLibrary * pCCNodeLoaderLibrary, CCBMemberVariab
#endif
}
CCBReader::~CCBReader() {
if(this->mBytes != NULL) {
delete this->mBytes;
this->mBytes = NULL;
}
this->mCCNodeLoaderLibrary->release();
/* Clear string cache. */
this->mStringCache.clear();
if(this->mRootCCBReader) {
/* Clear loaded spritesheets. */
this->mLoadedSpriteSheets.clear();
}
CC_SAFE_RELEASE(this->mRootNode);
}
CCBReader::CCBReader(CCBReader * pCCBReader) {
this->mRootNode = NULL;
this->mRootCCBReader = false;
@ -69,7 +50,25 @@ CCBReader::CCBReader(CCBReader * pCCBReader) {
this->mCCNodeLoaderListener = pCCBReader->mCCNodeLoaderListener;
}
std::string CCBReader::getCCBRootPath() {
CCBReader::~CCBReader() {
CC_SAFE_DELETE(this->mBytes);
this->mCCNodeLoaderLibrary->release();
/* Clear string cache. */
std::vector<CCString *>::iterator stringCacheIterator;
for (stringCacheIterator = this->mStringCache.begin(); stringCacheIterator != this->mStringCache.end(); stringCacheIterator++) {
(*stringCacheIterator)->release();
}
this->mStringCache.clear();
if(this->mRootCCBReader) {
/* Clear loaded spritesheets. */
this->mLoadedSpriteSheets.clear();
}
}
CCString * CCBReader::getCCBRootPath() {
return this->mCCBRootPath;
}
@ -89,16 +88,21 @@ CCNode * CCBReader::readNodeGraphFromFile(const char * pCCBRootPath, const char
return this->readNodeGraphFromFile(pCCBRootPath, pCCBFileName, pOwner, CCDirector::sharedDirector()->getWinSize());
}
CCNode * CCBReader::readNodeGraphFromFile(CCString * pCCBRootPath, CCString * pCCBFileName, CCObject * pOwner) {
return this->readNodeGraphFromFile(pCCBRootPath, pCCBFileName, pOwner, CCDirector::sharedDirector()->getWinSize());
}
CCNode * CCBReader::readNodeGraphFromFile(const char * pCCBRootPath, const char * pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize) {
return this->readNodeGraphFromFile(CCString::stringWithCString(pCCBRootPath), CCString::stringWithCString(pCCBFileName), pOwner, pRootContainerSize);
}
CCNode * CCBReader::readNodeGraphFromFile(CCString * pCCBRootPath, CCString * pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize) {
this->mCCBRootPath = pCCBRootPath;
this->mCCBRootPath->retain();
char* ccbFullFilePath = (char*)malloc(strlen(pCCBRootPath) + strlen(pCCBFileName) + 1);
ccbFullFilePath[strlen(pCCBRootPath) + strlen(pCCBFileName)] = '\0';
CCString * ccbFullFilePath = CCBReader::concat(pCCBRootPath, pCCBFileName);
strcpy(ccbFullFilePath, pCCBRootPath);
strcat(ccbFullFilePath, pCCBFileName);
const char * path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(ccbFullFilePath);
const char * path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(ccbFullFilePath->getCString());
CC_SAFE_FREE(ccbFullFilePath);
@ -107,18 +111,21 @@ CCNode * CCBReader::readNodeGraphFromFile(const char * pCCBRootPath, const char
this->mCurrentByte = 0;
this->mCurrentBit = 0;
this->mOwner = pOwner;
this->mOwner->retain();
this->mRootContainerSize = pRootContainerSize;
if(!this->readHeader()) {
return NULL;
CCNode * node = NULL;
if(this->readHeader() && this->readStringCache()) {
node = this->readNodeGraph();
}
if(!this->readStringCache()) {
return NULL;
}
CC_SAFE_RELEASE(this->mOwner);
CC_SAFE_RELEASE(this->mCCBRootPath);
CC_SAFE_RELEASE(this->mRootNode);
return this->readNodeGraph();
return node;
}
bool CCBReader::readHeader() {
@ -162,7 +169,8 @@ void CCBReader::readStringCacheEntry() {
int numBytes = b0 << 8 | b1;
const char * src = (const char *) (this->mBytes + this->mCurrentByte);
std::string string(src, numBytes);
CCString * string = CCString::stringWithCStringData(src, (unsigned long)numBytes);
string->retain();
this->mCurrentByte += numBytes;
@ -264,19 +272,19 @@ void CCBReader::alignBits() {
}
}
std::string CCBReader::readCachedString() {
CCString * CCBReader::readCachedString() {
int i = this->readInt(false);
return this->mStringCache[i];
}
CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
/* Read class name. */
const char * className = this->readCachedString().c_str();
CCString * className = this->readCachedString();
int memberVarAssignmentType = this->readInt(false);
const char * memberVarAssignmentName;
CCString * memberVarAssignmentName;
if(memberVarAssignmentType != kCCBTargetTypeNone) {
memberVarAssignmentName = this->readCachedString().c_str();
memberVarAssignmentName = this->readCachedString();
}
CCNodeLoader * ccNodeLoader = this->mCCNodeLoaderLibrary->getCCNodeLoader(className);
@ -348,49 +356,54 @@ CCSize CCBReader::getContainerSize(CCNode * pNode) {
}
}
bool CCBReader::isSpriteSheetLoaded(const char * pSpriteSheet) {
return this->mLoadedSpriteSheets.find(pSpriteSheet) != this->mLoadedSpriteSheets.end();
bool CCBReader::isSpriteSheetLoaded(CCString * pSpriteSheet) {
return this->mLoadedSpriteSheets.find(pSpriteSheet->m_sString) != this->mLoadedSpriteSheets.end();
}
void CCBReader::addLoadedSpriteSheet(const char * pSpriteSheet) {
this->mLoadedSpriteSheets.insert(pSpriteSheet);
void CCBReader::addLoadedSpriteSheet(CCString * pSpriteSheet) {
pSpriteSheet->retain();
this->mLoadedSpriteSheets.insert(pSpriteSheet->m_sString);
}
std::string CCBReader::lastPathComponent(const char * pPath) {
std::string path(pPath);
CCString * CCBReader::lastPathComponent(CCString * pPath) {
std::string path(pPath->getCString());
int slashPos = path.find_last_of("/");
if(slashPos != std::string::npos) {
return path.substr(slashPos + 1, path.length() - slashPos);
return CCString::stringWithCString(path.substr(slashPos + 1, path.length() - slashPos).c_str());
}
return path;
return CCString::stringWithCString(path.c_str());
}
std::string CCBReader::deletePathExtension(const char * pPath) {
std::string path(pPath);
CCString * CCBReader::deletePathExtension(CCString * pPath) {
std::string path(pPath->getCString());
int dotPos = path.find_last_of(".");
if(dotPos != std::string::npos) {
return path.substr(0, dotPos);
return CCString::stringWithCString(path.substr(0, dotPos).c_str());
}
return path;
return CCString::stringWithCString(path.c_str());
}
std::string CCBReader::toLowerCase(const char * pString) {
std::string copy(pString);
CCString * CCBReader::toLowerCase(CCString * pString) {
std::string copy(pString->getCString());
std::transform(copy.begin(), copy.end(), copy.begin(), ::tolower);
return copy;
return CCString::stringWithCString(copy.c_str());
}
std::string CCBReader::concat(const char * pStringA, const char * pStringB) {
std::string stringA(pStringA);
std::string stringB(pStringB);
CCString * CCBReader::concat(CCString * pStringA, CCString * pStringB) {
int concatenatedLength = pStringA->length() + pStringB->length() + 1;
char concatenated[concatenatedLength];
std::string string = stringA + stringB;
return string;
strcpy(concatenated, pStringA->getCString());
strcat(concatenated, pStringB->getCString());
concatenated[concatenatedLength] = '\0';
return CCString::stringWithCString(concatenated);
}
bool CCBReader::endsWith(const char * pString, const char * pEnding) {
std::string string(pString);
std::string ending(pEnding);
bool CCBReader::endsWith(CCString * pString, CCString * pEnding) {
std::string string(pString->getCString());
std::string ending(pEnding->getCString());
if(string.length() >= ending.length()) {
return (string.compare(string.length() - ending.length(), ending.length(), ending) == 0);
} else {

View File

@ -3,10 +3,24 @@
#include "cocos2d.h"
#define STATIC_NEW_AUTORELEASE_OBJECT_METHOD(T, METHOD) static T * METHOD() { \
T * t = new T(); \
t->autorelease(); \
return t; \
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(T, METHOD) static T * METHOD() { \
T * ptr = new T(); \
if(ptr != NULL) { \
ptr->autorelease(); \
return ptr; \
} \
CC_SAFE_DELETE(ptr); \
return NULL; \
}
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(T, METHOD) static T * METHOD() { \
T * ptr = new T(); \
if(ptr != NULL && ptr->init()) { \
ptr->autorelease(); \
return ptr; \
} \
CC_SAFE_DELETE(ptr); \
return NULL; \
}
#define kCCBVersion 2
@ -84,7 +98,7 @@ class CCBSelectorResolver;
*/
class CC_DLL CCBReader : public CCObject {
private:
std::string mCCBRootPath;
CCString * mCCBRootPath;
bool mRootCCBReader;
unsigned char * mBytes;
@ -100,7 +114,7 @@ class CC_DLL CCBReader : public CCObject {
CCBMemberVariableAssigner * mCCBMemberVariableAssigner;
CCBSelectorResolver * mCCBSelectorResolver;
std::vector<std::string> mStringCache;
std::vector<CCString *> mStringCache;
std::set<std::string> mLoadedSpriteSheets;
public:
@ -109,34 +123,37 @@ class CC_DLL CCBReader : public CCObject {
CCBReader(CCBReader *);
/* Destructor. */
~CCBReader();
CCNode * readNodeGraphFromFile(const char * pCCBRootPath, const char * pCCBFileName, CCObject * pOwner = NULL);
CCNode * readNodeGraphFromFile(CCString * pCCBRootPath, CCString * pCCBFileName, CCObject * pOwner = NULL);
CCNode * readNodeGraphFromFile(const char * pCCBRootPath, const char * pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize);
CCNode * readNodeGraphFromFile(CCString * pCCBRootPath, CCString * pCCBFileName, CCObject * pOwner, CCSize pRootContainerSize);
CCBMemberVariableAssigner * getCCBMemberVariableAssigner();
CCBSelectorResolver * getCCBSelectorResolver();
std::string getCCBRootPath();
CCString * getCCBRootPath();
CCObject * getOwner();
CCNode * getRootNode();
CCSize getContainerSize(CCNode *);
float getResolutionScale();
bool isSpriteSheetLoaded(const char *);
void addLoadedSpriteSheet(const char *);
bool isSpriteSheetLoaded(CCString *);
void addLoadedSpriteSheet(CCString *);
/* Utility methods. */
std::string lastPathComponent(const char *);
std::string deletePathExtension(const char *);
std::string toLowerCase(const char *);
bool endsWith(const char *, const char *);
std::string concat(const char *, const char *);
static CCString * lastPathComponent(CCString *);
static CCString * deletePathExtension(CCString *);
static CCString * toLowerCase(CCString *);
static bool endsWith(CCString *, CCString *);
static CCString * concat(CCString *, CCString *);
/* Parse methods. */
int readInt(bool pSign);
unsigned char readByte();
bool readBool();
float readFloat();
std::string readCachedString();
CCString * readCachedString();
private:
bool readHeader();
@ -147,7 +164,7 @@ class CC_DLL CCBReader : public CCObject {
bool getBit();
void alignBits();
const char * readUTF8();
CCString * readUTF8();
};
NS_CC_EXT_END

View File

@ -5,10 +5,18 @@
NS_CC_EXT_BEGIN
#define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \
return menu_selector(METHOD); \
}
#define CCB_SELECTORRESOLVER_CCCONTROL_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \
return cccontrol_selector(METHOD); \
}
class CC_DLL CCBSelectorResolver {
public:
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuSelector(CCObject * pTarget, const char * pSelectorName) = 0;
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, const char * pSelectorName) = 0;
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
};
NS_CC_EXT_END

View File

@ -26,82 +26,76 @@ CCControl * CCControlButtonLoader::createCCNode(CCNode * pParent, CCBReader * pC
return CCControlButton::node();
}
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ZOOMONTOUCHDOWN) == 0) {
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ZOOMONTOUCHDOWN) == 0) {
((CCControlButton *)pNode)->setZoomOnTouchDown(pCheck);
} else {
CCControlLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLE_NORMAL) == 0) {
CCString * ccString = new CCString(pString);
ccString->autorelease();
((CCControlButton *)pNode)->setTitleForState(ccString, CCControlStateNormal);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_HIGHLIGHTED) == 0) {
CCString * ccString = new CCString(pString);
ccString->autorelease();
((CCControlButton *)pNode)->setTitleForState(ccString, CCControlStateHighlighted);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_DISABLED) == 0) {
CCString * ccString = new CCString(pString);
ccString->autorelease();
((CCControlButton *)pNode)->setTitleForState(ccString, CCControlStateDisabled);
void CCControlButtonLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLE_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleForState(pString, CCControlStateNormal);
} else if(pPropertyName->compare(PROPERTY_TITLE_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleForState(pString, CCControlStateHighlighted);
} else if(pPropertyName->compare(PROPERTY_TITLE_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleForState(pString, CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeString(pNode, pParent, pPropertyName, pString, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTF_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateNormal);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateHighlighted);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateDisabled);
void CCControlButtonLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLETTF_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF->getCString(), CCControlStateNormal);
} else if(pPropertyName->compare(PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF->getCString(), CCControlStateHighlighted);
} else if(pPropertyName->compare(PROPERTY_TITLETTF_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF->getCString(), CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
void CCControlButtonLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateNormal);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
} else if(pPropertyName->compare(PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateHighlighted);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
} else if(pPropertyName->compare(PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_LABELANCHORPOINT) == 0) {
void CCControlButtonLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_LABELANCHORPOINT) == 0) {
((CCControlButton *)pNode)->setLabelAnchorPoint(pPoint);
} else {
CCControlLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
void CCControlButtonLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_PREFEREDSIZE) == 0) {
((CCControlButton *)pNode)->setPreferredSize(pSize);
} else {
CCControlLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
if(pCCSpriteFrame != NULL) {
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateNormal);
}
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
} else if(pPropertyName->compare(PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
if(pCCSpriteFrame != NULL) {
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateHighlighted);
}
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
} else if(pPropertyName->compare(PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
if(pCCSpriteFrame != NULL) {
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateDisabled);
}
@ -110,12 +104,12 @@ void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode *
}
}
void CCControlButtonLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_NORMAL) == 0) {
void CCControlButtonLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLECOLOR_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateNormal);
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
} else if(pPropertyName->compare(PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateHighlighted);
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_DISABLED) == 0) {
} else if(pPropertyName->compare(PROPERTY_TITLECOLOR_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);

View File

@ -10,19 +10,19 @@ class CCBReader;
class CC_DLL CCControlButtonLoader : public CCControlLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCControlButtonLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCControlButtonLoader, loader);
protected:
virtual CCControl * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint, CCBReader *);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool, CCBReader *);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint, CCBReader *);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
};
NS_CC_EXT_END

View File

@ -7,18 +7,18 @@ USING_NS_CC_EXT;
#define PROPERTY_SELECTED "selected"
#define PROPERTY_CCCONTROL "ccControl"
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ENABLED) == 0) {
((CCControl *)pNode)->setEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
} else if(pPropertyName->compare(PROPERTY_SELECTED) == 0) {
((CCControl *)pNode)->setSelected(pCheck);
} else {
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
}
}
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CCCONTROL) == 0) {
((CCControl *)pNode)->addTargetWithActionForControlEvents(pBlockCCControlData->mTarget, pBlockCCControlData->mSELCCControlHandler, pBlockCCControlData->mControlEvents);
} else {
CCNodeLoader::onHandlePropTypeBlockCCControl(pNode, pParent, pPropertyName, pBlockCCControlData, pCCBReader);

View File

@ -12,8 +12,8 @@ class CC_DLL CCControlLoader : public CCNodeLoader {
protected:
virtual CCControl * createCCNode(CCNode *, CCBReader *) = 0;
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData *, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData *, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool, CCBReader *);
};
NS_CC_EXT_END

View File

@ -13,41 +13,41 @@ CCLabelBMFont * CCLabelBMFontLoader::createCCNode(CCNode * pParent, CCBReader *
return CCLabelBMFont::node();
}
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
((CCLabelBMFont *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
((CCLabelBMFont *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCLabelBMFont *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFntFile, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
((CCLabelBMFont *)pNode)->setFntFile(pCCBReader->concat(pCCBReader->getCCBRootPath().c_str(), pFntFile).c_str());
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FNTFILE) == 0) {
((CCLabelBMFont *)pNode)->setFntFile(pFntFile->getCString());
} else {
CCNodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((CCLabelBMFont *)pNode)->setString(pText);
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STRING) == 0) {
((CCLabelBMFont *)pNode)->setString(pText->getCString());
} else {
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
}

View File

@ -10,16 +10,16 @@ class CCBReader;
class CC_DLL CCLabelBMFontLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelBMFontLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelBMFontLoader, loader);
protected:
virtual CCLabelBMFont * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
};
NS_CC_EXT_END

View File

@ -17,66 +17,66 @@ CCLabelTTF * CCLabelTTFLoader::createCCNode(CCNode * pParent, CCBReader * pCCBRe
return CCLabelTTF::node();
}
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
((CCLabelTTF *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
void CCLabelTTFLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
((CCLabelTTF *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCLabelTTFLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCLabelTTF *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) {
((CCLabelTTF *)pNode)->setFontName(pFontTTF);
void CCLabelTTFLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FONTNAME) == 0) {
((CCLabelTTF *)pNode)->setFontName(pFontTTF->getCString());
} else {
CCNodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((CCLabelTTF *)pNode)->setString(pText);
void CCLabelTTFLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STRING) == 0) {
((CCLabelTTF *)pNode)->setString(pText->getCString());
} else {
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FONTSIZE) == 0) {
void CCLabelTTFLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FONTSIZE) == 0) {
((CCLabelTTF *)pNode)->setFontSize(pFloatScale);
} else {
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_HORIZONTALALIGNMENT) == 0) {
void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_HORIZONTALALIGNMENT) == 0) {
((CCLabelTTF *)pNode)->setHorizontalAlignment(CCTextAlignment(pIntegerLabeled));
} else if(strcmp(pPropertyName, PROPERTY_VERTICALALIGNMENT) == 0) {
} else if(pPropertyName->compare(PROPERTY_VERTICALALIGNMENT) == 0) {
((CCLabelTTF *)pNode)->setVerticalAlignment(CCVerticalTextAlignment(pIntegerLabeled));
} else {
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_DIMENSIONS) == 0) {
void CCLabelTTFLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_DIMENSIONS) == 0) {
((CCLabelTTF *)pNode)->setDimensions(pSize);
} else {
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);

View File

@ -10,19 +10,19 @@ class CCBReader;
class CC_DLL CCLabelTTFLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelTTFLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelTTFLoader, loader);
protected:
virtual CCLabelTTF * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char *, CCBReader *);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int, CCBReader *);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int, CCBReader *);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize, CCBReader *);
};
NS_CC_EXT_END

View File

@ -11,24 +11,24 @@ CCLayerColor * CCLayerColorLoader::createCCNode(CCNode * pParent, CCBReader * pC
return CCLayerColor::node();
}
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
((CCLayerColor *)pNode)->setColor(pCCColor3B);
} else {
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
((CCLayerColor *)pNode)->setOpacity(pByte);
} else {
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCLayerColor *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);

View File

@ -10,13 +10,13 @@ class CCBReader;
class CC_DLL CCLayerColorLoader : public CCLayerLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerColorLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerColorLoader, loader);
protected:
virtual CCLayerColor * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
};
NS_CC_EXT_END

View File

@ -14,28 +14,28 @@ CCLayerGradient * CCLayerGradientLoader::createCCNode(CCNode * pParent, CCBReade
return CCLayerGradient::node();
}
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
((CCLayerGradient *)pNode)->setStartColor(pCCColor3B);
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
} else if(pPropertyName->compare(PROPERTY_ENDCOLOR) == 0) {
((CCLayerGradient *)pNode)->setEndColor(pCCColor3B);
} else {
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STARTOPACITY) == 0) {
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STARTOPACITY) == 0) {
((CCLayerGradient *)pNode)->setStartOpacity(pByte);
} else if(strcmp(pPropertyName, PROPERTY_ENDOPACITY) == 0) {
} else if(pPropertyName->compare(PROPERTY_ENDOPACITY) == 0) {
((CCLayerGradient *)pNode)->setEndOpacity(pByte);
} else {
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCLayerGradient *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
@ -43,8 +43,8 @@ void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * p
}
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_VECTOR) == 0) {
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_VECTOR) == 0) {
((CCLayerGradient *)pNode)->setVector(pPoint);
// TODO Not passed along the ccbi file.

View File

@ -10,15 +10,15 @@ class CCBReader;
class CC_DLL CCLayerGradientLoader : public CCLayerLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerGradientLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerGradientLoader, loader);
protected:
virtual CCLayerGradient * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
};
NS_CC_EXT_END

View File

@ -12,15 +12,15 @@ CCLayer * CCLayerLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader)
return CCLayer::node();
}
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TOUCH_ENABLED) == 0) {
((CCLayer *)pNode)->setTouchEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
} else if(pPropertyName->compare(PROPERTY_ACCELEROMETER_ENABLED) == 0) {
((CCLayer *)pNode)->setAccelerometerEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
} else if(pPropertyName->compare(PROPERTY_MOUSE_ENABLED) == 0) {
// TODO XXX
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);
} else if(strcmp(pPropertyName, PROPERTY_KEYBOARD_ENABLED) == 0) {
} else if(pPropertyName->compare(PROPERTY_KEYBOARD_ENABLED) == 0) {
// TODO XXX
CCLOG("The property '%s' is not supported!", PROPERTY_KEYBOARD_ENABLED);
// This comes closest: ((CCLayer *)pNode)->setKeypadEnabled(pCheck);

View File

@ -10,12 +10,12 @@ class CCBReader;
class CC_DLL CCLayerLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerLoader, loader);
protected:
virtual CCLayer * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -11,16 +11,16 @@ CCMenuItemImage * CCMenuItemImageLoader::createCCNode(CCNode * pParent, CCBReade
return CCMenuItemImage::node();
}
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_NORMALDISPLAYFRAME) == 0) {
if(pCCSpriteFrame != NULL) {
((CCMenuItemImage *)pNode)->setNormalSpriteFrame(pCCSpriteFrame);
}
} else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
} else if(pPropertyName->compare(PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
if(pCCSpriteFrame != NULL) {
((CCMenuItemImage *)pNode)->setSelectedSpriteFrame(pCCSpriteFrame);
}
} else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
} else if(pPropertyName->compare(PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
if(pCCSpriteFrame != NULL) {
((CCMenuItemImage *)pNode)->setDisabledSpriteFrame(pCCSpriteFrame);
}

View File

@ -10,12 +10,12 @@ class CCBReader;
class CC_DLL CCMenuItemImageLoader : public CCMenuItemLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuItemImageLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuItemImageLoader, loader);
protected:
virtual CCMenuItemImage * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
};
NS_CC_EXT_END

View File

@ -6,16 +6,16 @@ USING_NS_CC_EXT;
#define PROPERTY_BLOCK "block"
#define PROPERTY_ISENABLED "isEnabled"
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLOCK) == 0) {
((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
} else {
CCNodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, pCCBReader);
}
}
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ISENABLED) == 0) {
((CCMenuItem *)pNode)->setEnabled(pCheck);
} else {
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);

View File

@ -12,8 +12,8 @@ class CC_DLL CCMenuItemLoader : public CCNodeLoader {
protected:
virtual CCMenuItem * createCCNode(CCNode *, CCBReader *) = 0;
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData *, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool, CCBReader *);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData *, CCBReader *);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool, CCBReader *);
};
NS_CC_EXT_END

View File

@ -10,7 +10,7 @@ class CCBReader;
class CC_DLL CCMenuLoader : public CCLayerLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuLoader, loader);
protected:
virtual CCMenu * createCCNode(CCNode *, CCBReader *);

View File

@ -11,8 +11,8 @@
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
#define PROPERTY_VISIBLE "visible"
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) printf("Unexpected property: '%s'!\n", PROPERTY); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) printf("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLog("Unexpected property: '%s'!\n", PROPERTY->getCString()); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) CCLog("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
USING_NS_CC;
USING_NS_CC_EXT;
@ -33,7 +33,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
int propertyCount = pCCBReader->readInt(false);
for(int i = 0; i < propertyCount; i++) {
int type = pCCBReader->readInt(false);
const char * propertyName = pCCBReader->readCachedString().c_str();
CCString * propertyName = pCCBReader->readCachedString();
// Check if the property can be set for this platform
bool setProp = false;
@ -198,28 +198,28 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
break;
}
case kCCBPropTypeFntFile: {
const char * fntFile = this->parsePropTypeFntFile(pNode, pParent, pCCBReader);
CCString * fntFile = this->parsePropTypeFntFile(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeFntFile(pNode, pParent, propertyName, fntFile, pCCBReader);
}
break;
}
case kCCBPropTypeFontTTF: {
const char * fontTTF = this->parsePropTypeFontTTF(pNode, pParent, pCCBReader);
CCString * fontTTF = this->parsePropTypeFontTTF(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeFontTTF(pNode, pParent, propertyName, fontTTF, pCCBReader);
}
break;
}
case kCCBPropTypeString: {
const char * string = this->parsePropTypeString(pNode, pParent, pCCBReader);
CCString * string = this->parsePropTypeString(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeString(pNode, pParent, propertyName, string, pCCBReader);
}
break;
}
case kCCBPropTypeText: {
const char * text = this->parsePropTypeText(pNode, pParent, pCCBReader);
CCString * text = this->parsePropTypeText(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeText(pNode, pParent, propertyName, text, pCCBReader);
}
@ -406,39 +406,39 @@ bool CCNodeLoader::parsePropTypeCheck(CCNode * pNode, CCNode * pParent, CCBReade
CCSpriteFrame * CCNodeLoader::parsePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * spriteSheet = pCCBReader->readCachedString().c_str();
const char * spriteFile = pCCBReader->readCachedString().c_str();
CCString * spriteSheet = pCCBReader->readCachedString();
CCString * spriteFile = pCCBReader->readCachedString();
CCSpriteFrame * spriteFrame;
if(strcmp(spriteSheet, "") == 0) {
if(strcmp(spriteFile, "") == 0) {
if(spriteSheet == NULL || spriteSheet->length() == 0) {
if(spriteFile == NULL || spriteFile->length() == 0) {
return NULL;
}
const char * spriteFilePath = pCCBReader->concat(pCCBReader->getCCBRootPath().c_str(), spriteFile).c_str();
CCString * spriteFilePath = CCBReader::concat(pCCBReader->getCCBRootPath(), spriteFile);
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFilePath);
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFilePath->getCString());
CCRect bounds = CCRect::CCRect(0, 0, texture->getContentSize().width, texture->getContentSize().height);
spriteFrame = CCSpriteFrame::frameWithTexture(texture, bounds);
} else {
CCSpriteFrameCache * frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
const char * spriteSheetPath = pCCBReader->concat(pCCBReader->getCCBRootPath().c_str(), spriteSheet).c_str();
CCString * spriteSheetPath = CCBReader::concat(pCCBReader->getCCBRootPath(), spriteSheet);
/* Load the sprite sheet only if it is not loaded. */
if(!pCCBReader->isSpriteSheetLoaded(spriteSheetPath)) {
frameCache->addSpriteFramesWithFile(spriteSheetPath);
frameCache->addSpriteFramesWithFile(spriteSheetPath->getCString());
pCCBReader->addLoadedSpriteSheet(spriteSheetPath);
}
spriteFrame = frameCache->spriteFrameByName(spriteFile);
spriteFrame = frameCache->spriteFrameByName(spriteFile->getCString());
}
return spriteFrame;
}
CCAnimation * CCNodeLoader::parsePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * animationFile = pCCBReader->readCachedString().c_str();
const char * animation = pCCBReader->readCachedString().c_str();
CCString * animationFile = pCCBReader->readCachedString();
CCString * animation = pCCBReader->readCachedString();
CCAnimation * ccAnimation = NULL;
@ -447,22 +447,22 @@ CCAnimation * CCNodeLoader::parsePropTypeAnimation(CCNode * pNode, CCNode * pPar
// Eventually this should be handled by a client side asset manager
// interface which figured out what resources to load.
// TODO Does this problem exist in C++?
animation = pCCBReader->lastPathComponent(animation).c_str();
animationFile = pCCBReader->lastPathComponent(animationFile).c_str();
animation = CCBReader::lastPathComponent(animation);
animationFile = CCBReader::lastPathComponent(animationFile);
if(strcmp(animation, "") != 0) {
if(animation != NULL && animation->compare("") != 0) {
CCAnimationCache * animationCache = CCAnimationCache::sharedAnimationCache();
animationCache->addAnimationsWithFile(animationFile);
animationCache->addAnimationsWithFile(animationFile->getCString());
ccAnimation = animationCache->animationByName(animation);
ccAnimation = animationCache->animationByName(animation->getCString());
}
return ccAnimation;
}
CCTexture2D * CCNodeLoader::parsePropTypeTexture(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * spriteFile = pCCBReader->concat(pCCBReader->getCCBRootPath().c_str(), pCCBReader->readCachedString().c_str()).c_str();
CCString * spriteFile = CCBReader::concat(pCCBReader->getCCBRootPath(), pCCBReader->readCachedString());
return CCTextureCache::sharedTextureCache()->addImage(spriteFile);
return CCTextureCache::sharedTextureCache()->addImage(spriteFile->getCString());
}
unsigned char CCNodeLoader::parsePropTypeByte(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
@ -524,32 +524,36 @@ ccBlendFunc CCNodeLoader::parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParen
return blendFunc;
}
const char * CCNodeLoader::parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString().c_str();
CCString * CCNodeLoader::parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * fntFile = pCCBReader->readCachedString();
return CCBReader::concat(pCCBReader->getCCBRootPath(), fntFile);
}
const char * CCNodeLoader::parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString().c_str();
CCString * CCNodeLoader::parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString();
}
const char * CCNodeLoader::parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString().c_str();
CCString * CCNodeLoader::parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString();
}
const char * CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * fnt = pCCBReader->readCachedString().c_str();
const char * ttfEnding("ttf");
CCString * CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * fontTTF = pCCBReader->readCachedString();
if(pCCBReader->endsWith(pCCBReader->toLowerCase(fnt).c_str(), ttfEnding)){
fnt = pCCBReader->deletePathExtension(pCCBReader->lastPathComponent(fnt).c_str()).c_str();
CCString * ttfEnding = CCString::stringWithCString(".ttf");
/* If the fontTTF comes with the ".ttf" extension, prepend the absolute path.
* System fonts come without the ".ttf" extension and do not need the path prepended. */
if(CCBReader::endsWith(CCBReader::toLowerCase(fontTTF), ttfEnding)){
fontTTF = CCBReader::concat(pCCBReader->getCCBRootPath(), fontTTF);
}
return fnt;
return fontTTF;
}
BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * selectorName = pCCBReader->readCachedString().c_str();
CCString * selectorName = pCCBReader->readCachedString();
int selectorTarget = pCCBReader->readInt(false);
if(selectorTarget != kCCBTargetTypeNone) {
@ -561,18 +565,18 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
}
if(target != NULL) {
if(strlen(selectorName) > 0) {
if(selectorName->length() > 0) {
SEL_MenuHandler selMenuHandler = 0;
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL) {
selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuSelector(target, selectorName);
selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName);
}
if(selMenuHandler == 0) {
CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL) {
selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuSelector(target, selectorName);
selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName);
}
}
@ -598,7 +602,7 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
}
BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * selectorName = pCCBReader->readCachedString().c_str();
CCString * selectorName = pCCBReader->readCachedString();
int selectorTarget = pCCBReader->readInt(false);
int controlEvents = pCCBReader->readInt(false);
@ -611,7 +615,7 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
}
if(target != NULL) {
if(strlen(selectorName) > 0) {
if(selectorName->length() > 0) {
SEL_CCControlHandler selCCControlHandler = 0;
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
@ -649,52 +653,52 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
}
CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
const char * ccbFileName = pCCBReader->readCachedString().c_str();
CCString * ccbFileName = pCCBReader->readCachedString();
/* Change path extension to .ccbi. */
const char * ccbFileWithoutPathExtension = pCCBReader->deletePathExtension(ccbFileName).c_str();
const char * ccbiFileName = pCCBReader->concat(ccbFileWithoutPathExtension, ".ccbi").c_str();
CCString * ccbFileWithoutPathExtension = CCBReader::deletePathExtension(ccbFileName);
CCString * ccbiFileName = CCBReader::concat(ccbFileWithoutPathExtension, CCString::stringWithCString(".ccbi"));
CCBReader * ccbReader = new CCBReader(pCCBReader);
ccbReader->autorelease();
CCNode * ccbFileNode = ccbReader->readNodeGraphFromFile(pCCBReader->getCCBRootPath().c_str(), ccbiFileName, pCCBReader->getOwner(), pParent->getContentSize());
CCNode * ccbFileNode = ccbReader->readNodeGraphFromFile(pCCBReader->getCCBRootPath(), ccbiFileName, pCCBReader->getOwner(), pParent->getContentSize());
return ccbFileNode;
}
void CCNodeLoader::onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_POSITION) == 0) {
void CCNodeLoader::onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_POSITION) == 0) {
pNode->setPosition(pPosition);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ANCHORPOINT) == 0) {
void CCNodeLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ANCHORPOINT) == 0) {
pNode->setAnchorPoint(pPoint);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
void CCNodeLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CONTENTSIZE) == 0) {
pNode->setContentSize(pSize);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pScaleLock, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pScaleLock, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_SCALE) == 0) {
pNode->setScaleX(pScaleLock[0]);
pNode->setScaleY(pScaleLock[1]);
} else {
@ -702,104 +706,104 @@ void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, c
}
}
void CCNodeLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pDegrees, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ROTATION) == 0) {
void CCNodeLoader::onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pDegrees, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ROTATION) == 0) {
pNode->setRotation(pDegrees);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TAG) == 0) {
void CCNodeLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TAG) == 0) {
pNode->setTag(pInteger);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_VISIBLE) == 0) {
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_VISIBLE) == 0) {
pNode->setVisible(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
} else if(pPropertyName->compare(PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
pNode->ignoreAnchorPointForPosition(pCheck);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFntFile, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}

View File

@ -6,6 +6,10 @@
NS_CC_EXT_BEGIN
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) { \
return T::node(); \
}
struct BlockData {
SEL_MenuHandler mSELMenuHandler;
CCObject * mTarget;
@ -22,7 +26,7 @@ class CCBReader;
class CC_DLL CCNodeLoader : public CCObject {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoader, loader);
virtual CCNode * loadCCNode(CCNode *, CCBReader * pCCBReader);
virtual void parseProperties(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
@ -50,42 +54,42 @@ class CC_DLL CCNodeLoader : public CCObject {
virtual ccColor4F * parsePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual bool * parsePropTypeFlip(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual ccBlendFunc parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual const char * parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual const char * parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual const char * parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual const char * parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual BlockData * parsePropTypeBlock(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual BlockCCControlData * parsePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCNode * parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual void onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pScaleLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pDegrees, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFoatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pScaleLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pDegrees, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFoatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -42,25 +42,35 @@ void CCNodeLoaderLibrary::registerDefaultCCNodeLoaders() {
}
void CCNodeLoaderLibrary::registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader) {
this->mCCNodeLoaders.insert(std::pair<const char *, CCNodeLoader *>(pClassName, pCCNodeLoader));
this->registerCCNodeLoader(CCString::stringWithCString(pClassName), pCCNodeLoader);
}
void CCNodeLoaderLibrary::registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader) {
pClassName->retain();
pCCNodeLoader->retain();
this->mCCNodeLoaders.insert(CCNodeLoaderMapEntry(pClassName, pCCNodeLoader));
}
void CCNodeLoaderLibrary::unregisterCCNodeLoader(const char * pClassName) {
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
this->unregisterCCNodeLoader(CCString::stringWithCString(pClassName));
}
void CCNodeLoaderLibrary::unregisterCCNodeLoader(CCString * pClassName) {
CCNodeLoaderMap::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
ccNodeLoadersIterator->first->release();
ccNodeLoadersIterator->second->release();
}
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(const char * pClassName) {
std::map<std::string, CCNodeLoader *>::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(CCString * pClassName) {
CCNodeLoaderMap::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
return ccNodeLoadersIterator->second;
}
void CCNodeLoaderLibrary::purge(bool pReleaseCCNodeLoaders) {
if(pReleaseCCNodeLoaders) {
for(std::map<std::string, CCNodeLoader *>::iterator it = this->mCCNodeLoaders.begin(); it != this->mCCNodeLoaders.end(); it++) {
for(CCNodeLoaderMap::iterator it = this->mCCNodeLoaders.begin(); it != this->mCCNodeLoaders.end(); it++) {
it->second->release();
}
}

View File

@ -6,20 +6,26 @@
NS_CC_EXT_BEGIN
typedef std::map<CCString *, CCNodeLoader *, CCStringCompare> CCNodeLoaderMap;
typedef std::pair<CCString *, CCNodeLoader *> CCNodeLoaderMapEntry;
class CC_DLL CCNodeLoaderLibrary : public CCObject {
private:
std::map<std::string, CCNodeLoader *> mCCNodeLoaders;
CCNodeLoaderMap mCCNodeLoaders;
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoaderLibrary, library);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoaderLibrary, library);
CCNodeLoaderLibrary();
~CCNodeLoaderLibrary();
void registerDefaultCCNodeLoaders();
void registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader);
void registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader);
void unregisterCCNodeLoader(const char * pClassName);
void unregisterCCNodeLoader(CCString * pClassName);
CCNodeLoader * getCCNodeLoader(const char * pClassName);
CCNodeLoader * getCCNodeLoader(CCString * pClassName);
void purge(bool pDelete);
public:

View File

@ -30,77 +30,77 @@ CCParticleSystemQuad * CCParticleSystemQuadLoader::createCCNode(CCNode * pParent
return CCParticleSystemQuad::node();
}
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_EMITERMODE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_EMITERMODE) == 0) {
((CCParticleSystemQuad *)pNode)->setEmitterMode(pIntegerLabeled);
} else {
CCNodeLoader::onHandlePropTypeIntegerLabeled(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_POSVAR) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_POSVAR) == 0) {
((CCParticleSystemQuad *)pNode)->setPosVar(pPoint);
} else if(strcmp(pPropertyName, PROPERTY_GRAVITY) == 0) {
} else if(pPropertyName->compare(PROPERTY_GRAVITY) == 0) {
((CCParticleSystemQuad *)pNode)->setGravity(pPoint);
} else {
CCNodeLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_EMISSIONRATE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_EMISSIONRATE) == 0) {
((CCParticleSystemQuad *)pNode)->setEmissionRate(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_DURATION) == 0) {
} else if(pPropertyName->compare(PROPERTY_DURATION) == 0) {
((CCParticleSystemQuad *)pNode)->setDuration(pFloat);
} else {
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TOTALPARTICLES) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TOTALPARTICLES) == 0) {
((CCParticleSystemQuad *)pNode)->setTotalParticles(pInteger);
} else {
CCNodeLoader::onHandlePropTypeInteger(pNode, pParent, pPropertyName, pInteger, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_LIFE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_LIFE) == 0) {
((CCParticleSystemQuad *)pNode)->setLife(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setLifeVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_STARTSIZE) == 0) {
} else if(pPropertyName->compare(PROPERTY_STARTSIZE) == 0) {
((CCParticleSystemQuad *)pNode)->setStartSize(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setStartSizeVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDSIZE) == 0) {
} else if(pPropertyName->compare(PROPERTY_ENDSIZE) == 0) {
((CCParticleSystemQuad *)pNode)->setEndSize(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setEndSizeVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_STARTSPIN) == 0) {
} else if(pPropertyName->compare(PROPERTY_STARTSPIN) == 0) {
((CCParticleSystemQuad *)pNode)->setStartSpin(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setStartSpinVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDSPIN) == 0) {
} else if(pPropertyName->compare(PROPERTY_ENDSPIN) == 0) {
((CCParticleSystemQuad *)pNode)->setEndSpin(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setEndSpinVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ANGLE) == 0) {
} else if(pPropertyName->compare(PROPERTY_ANGLE) == 0) {
((CCParticleSystemQuad *)pNode)->setAngle(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setAngleVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_SPEED) == 0) {
} else if(pPropertyName->compare(PROPERTY_SPEED) == 0) {
((CCParticleSystemQuad *)pNode)->setSpeed(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setSpeedVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_TANGENTIALACCEL) == 0) {
} else if(pPropertyName->compare(PROPERTY_TANGENTIALACCEL) == 0) {
((CCParticleSystemQuad *)pNode)->setTangentialAccel(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setTangentialAccelVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_RADIALACCEL) == 0) {
} else if(pPropertyName->compare(PROPERTY_RADIALACCEL) == 0) {
((CCParticleSystemQuad *)pNode)->setRadialAccel(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setRadialAccelVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_STARTRADIUS) == 0) {
} else if(pPropertyName->compare(PROPERTY_STARTRADIUS) == 0) {
((CCParticleSystemQuad *)pNode)->setStartRadius(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setStartRadiusVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDRADIUS) == 0) {
} else if(pPropertyName->compare(PROPERTY_ENDRADIUS) == 0) {
((CCParticleSystemQuad *)pNode)->setEndRadius(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setEndRadiusVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ROTATEPERSECOND) == 0) {
} else if(pPropertyName->compare(PROPERTY_ROTATEPERSECOND) == 0) {
((CCParticleSystemQuad *)pNode)->setRotatePerSecond(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setRotatePerSecondVar(pFloatVar[1]);
} else {
@ -108,11 +108,11 @@ void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
((CCParticleSystemQuad *)pNode)->setStartColor(pCCColor4FVar[0]);
((CCParticleSystemQuad *)pNode)->setStartColorVar(pCCColor4FVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
} else if(pPropertyName->compare(PROPERTY_ENDCOLOR) == 0) {
((CCParticleSystemQuad *)pNode)->setEndColor(pCCColor4FVar[0]);
((CCParticleSystemQuad *)pNode)->setEndColorVar(pCCColor4FVar[1]);
} else {
@ -120,16 +120,16 @@ void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNo
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCParticleSystemQuad *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TEXTURE) == 0) {
((CCParticleSystemQuad *)pNode)->setTexture(pCCTexture2D);
} else {
CCNodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pCCTexture2D, pCCBReader);

View File

@ -10,19 +10,19 @@ class CCBReader;
class CC_DLL CCParticleSystemQuadLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCParticleSystemQuadLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCParticleSystemQuadLoader, loader);
protected:
virtual CCParticleSystemQuad * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int, CCBReader *);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint, CCBReader *);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int, CCBReader *);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float *, CCBReader *);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F *, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D *, CCBReader *);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int, CCBReader *);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint, CCBReader *);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int, CCBReader *);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float *, CCBReader *);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F *, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D *, CCBReader *);
};
NS_CC_EXT_END

View File

@ -18,32 +18,32 @@ CCScale9Sprite * CCScale9SpriteLoader::createCCNode(CCNode * pParent, CCBReader
return CCScale9Sprite::node();
}
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_SPRITEFRAME) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_SPRITEFRAME) == 0) {
((CCScale9Sprite *)pNode)->initWithSpriteFrame(pCCSpriteFrame);
} else {
CCNodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
((CCScale9Sprite *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
((CCScale9Sprite *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
// TODO Not exported by CocosBuilder yet!
// ((CCScale9Sprite *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
@ -51,24 +51,24 @@ void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pP
}
}
void CCScale9SpriteLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CONTENTSIZE) == 0) {
//((CCScale9Sprite *)pNode)->setContentSize(pSize);
} else if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
} else if(pPropertyName->compare(PROPERTY_PREFEREDSIZE) == 0) {
((CCScale9Sprite *)pNode)->setPreferredSize(pSize);
} else {
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_INSETLEFT) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_INSETLEFT) == 0) {
((CCScale9Sprite *)pNode)->setInsetLeft(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETTOP) == 0) {
} else if(pPropertyName->compare(PROPERTY_INSETTOP) == 0) {
((CCScale9Sprite *)pNode)->setInsetTop(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETRIGHT) == 0) {
} else if(pPropertyName->compare(PROPERTY_INSETRIGHT) == 0) {
((CCScale9Sprite *)pNode)->setInsetRight(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETBOTTOM) == 0) {
} else if(pPropertyName->compare(PROPERTY_INSETBOTTOM) == 0) {
((CCScale9Sprite *)pNode)->setInsetBottom(pFloat);
} else {
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);

View File

@ -10,17 +10,17 @@ class CCBReader;
class CC_DLL CCScale9SpriteLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScale9SpriteLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScale9SpriteLoader, loader);
protected:
virtual CCScale9Sprite * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize, CCBReader *);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize, CCBReader *);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
};
NS_CC_EXT_END

View File

@ -13,16 +13,16 @@ CCSprite * CCSpriteLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader
return CCSprite::node();
}
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) {
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_DISPLAYFRAME) == 0) {
((CCSprite *)pNode)->setDisplayFrame(pCCSpriteFrame);
} else {
CCNodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
}
}
void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FLIP) == 0) {
void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FLIP) == 0) {
((CCSprite *)pNode)->setFlipX(pFlip[0]);
((CCSprite *)pNode)->setFlipX(pFlip[1]);
} else {
@ -30,24 +30,24 @@ void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, cons
}
}
void CCSpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
void CCSpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
((CCSprite *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCSpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
void CCSpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
((CCSprite *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCSpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
void CCSpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
((CCSprite *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);

View File

@ -10,16 +10,16 @@ class CCBReader;
class CC_DLL CCSpriteLoader : public CCNodeLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCSpriteLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCSpriteLoader, loader);
protected:
virtual CCSprite * createCCNode(CCNode *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool *, CCBReader *);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool *, CCBReader *);
};
NS_CC_EXT_END

View File

@ -230,17 +230,14 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
dim = _calculateStringSizeWithFontOrZFont(str, font, &constrainSize, false);
}
#if CC_FONT_LABEL_SUPPORT
if (! font)
{
font = [[FontManager sharedManager] zFontWithName:fntName pointSize:nSize];
if (font)
{
//dim = [str sizeWithZFont:font];
dim =_caculateStringSizeWithFontOrZFont(str, font, &constrainSize, true);
dim =_calculateStringSizeWithFontOrZFont(str, font, &constrainSize, true);
}
}
#endif // CC_FONT_LABEL_SUPPORT
if (! font)
{
@ -316,17 +313,14 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
: UITextAlignmentLeft;
// normal fonts
if( [font isKindOfClass:[UIFont class] ] )
{
[str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
}
#if CC_FONT_LABEL_SUPPORT
else // ZFont class
{
[FontLabelStringDrawingHelper drawInRect:str rect:CGRectMake(0, startH, dim.width, dim.height) withZFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
}
#endif
if( [font isKindOfClass:[UIFont class] ] )
{
[str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
}
else // ZFont class
{
[FontLabelStringDrawingHelper drawInRect:str rect:CGRectMake(0, startH, dim.width, dim.height) withZFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
}
UIGraphicsPopContext();

View File

@ -51,10 +51,6 @@ THE SOFTWARE.
NS_CC_BEGIN
#if CC_FONT_LABEL_SUPPORT
// FontLabel support
#endif// CC_FONT_LABEL_SUPPORT
//CLASS IMPLEMENTATIONS:
// If the image has alpha, you can create RGBA8 (32-bit) or RGBA4 (16-bit) or RGB5A1 (16-bit)

View File

@ -45,12 +45,10 @@ tests/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourP
tests/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp \
tests/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp \
tests/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp \
tests/ExtensionsTest/CocosBuilderTest/HelloCocosBuilderLayer.cpp \
tests/ExtensionsTest/CocosBuilderTest/HelloCocosBuilderLayerLoader.cpp \
tests/ExtensionsTest/CocosBuilderTest/TestHeaderLayer.cpp \
tests/ExtensionsTest/CocosBuilderTest/TestHeaderLayerLoader.cpp \
tests/ExtensionsTest/CocosBuilderTest/ButtonTestLayer.cpp \
tests/ExtensionsTest/CocosBuilderTest/ButtonTestLayerLoader.cpp \
tests/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp \
tests/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp \
tests/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp \
tests/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp \
tests/FontTest/FontTest.cpp \
tests/IntervalTest/IntervalTest.cpp \
tests/KeypadTest/KeypadTest.cpp \

View File

@ -1 +1 @@
e7a48f141ba644f5dc6c8d2f786899216a211a9a
cf47c05a8260b8bdde74155d3dc2382ae9735b76

View File

@ -0,0 +1,56 @@
#include "ButtonTestLayer.h"
#include "extensions/CCBReader/CCBReader.h"
USING_NS_CC;
USING_NS_CC_EXT;
SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) {
return NULL;
}
SEL_CCControlHandler ButtonTestLayer::onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) {
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonClicked", ButtonTestLayer::onCCControlButtonClicked);
return NULL;
}
bool ButtonTestLayer::onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode) {
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mCCControlEventLabel", CCLabelBMFont *, this->mCCControlEventLabel);
return false;
}
void ButtonTestLayer::onCCControlButtonClicked(cocos2d::CCObject *pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
switch(pCCControlEvent) {
case CCControlEventTouchDown:
this->mCCControlEventLabel->setString("Touch Down.");
break;
case CCControlEventTouchDragInside:
this->mCCControlEventLabel->setString("Touch Drag Inside.");
break;
case CCControlEventTouchDragOutside:
this->mCCControlEventLabel->setString("Touch Drag Outside.");
break;
case CCControlEventTouchDragEnter:
this->mCCControlEventLabel->setString("Touch Drag Enter.");
break;
case CCControlEventTouchDragExit:
this->mCCControlEventLabel->setString("Touch Drag Exit.");
break;
case CCControlEventTouchUpInside:
this->mCCControlEventLabel->setString("Touch Up Inside.");
break;
case CCControlEventTouchUpOutside:
this->mCCControlEventLabel->setString("Touch Up Outside.");
break;
case CCControlEventTouchCancel:
this->mCCControlEventLabel->setString("Touch Cancel.");
break;
case CCControlEventValueChanged:
this->mCCControlEventLabel->setString("Value Changed.");
break;
default:
assert(false); // OH SHIT!
}
}

View File

@ -0,0 +1,23 @@
#ifndef _BUTTONTESTLAYER_H_
#define _BUTTONTESTLAYER_H_
#include "cocos2d.h"
#include "extensions/CCBReader/CCNodeLoader.h"
#include "extensions/CCBReader/CCBSelectorResolver.h"
#include "extensions/CCBReader/CCBMemberVariableAssigner.h"
class ButtonTestLayer : public cocos2d::extension::CCBSelectorResolver, public cocos2d::extension::CCBMemberVariableAssigner, public cocos2d::CCLayer {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(ButtonTestLayer, node);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode);
virtual void onCCControlButtonClicked(cocos2d::CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent);
private:
cocos2d::CCLabelBMFont * mCCControlEventLabel;
};
#endif

View File

@ -9,10 +9,10 @@ class CCBReader;
class ButtonTestLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(ButtonTestLayerLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(ButtonTestLayerLoader, loader);
protected:
virtual ButtonTestLayer * createCCNode(cocos2d::CCNode *, cocos2d::extension::CCBReader *);
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(ButtonTestLayer);
};
#endif

View File

@ -1,33 +0,0 @@
#include "ButtonTestLayer.h"
#include "extensions/CCBReader/CCBReader.h"
USING_NS_CC;
USING_NS_CC_EXT;
ButtonTestLayer * ButtonTestLayer::node() {
ButtonTestLayer * ptr = new ButtonTestLayer();
if(ptr && ptr->init()) {
ptr->autorelease();
return ptr;
}
CC_SAFE_DELETE(ptr);
return NULL;
}
SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuSelector(CCObject * pTarget, const char * pSelectorName) {
return NULL;
}
SEL_CCControlHandler ButtonTestLayer::onResolveCCBCCControlSelector(CCObject * pTarget, const char * pSelectorName) {
if(pTarget == this) {
if(strcmp(pSelectorName, "onCCControlButtonClicked") == 0) {
return cccontrol_selector(ButtonTestLayer::onCCControlButtonClicked);
}
}
return NULL;
}
void ButtonTestLayer::onCCControlButtonClicked(cocos2d::CCObject *pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onCCControlButtonClicked\n");
}

View File

@ -1,18 +0,0 @@
#ifndef _BUTTONTESTLAYER_H_
#define _BUTTONTESTLAYER_H_
#include "cocos2d.h"
#include "extensions/CCBReader/CCNodeLoader.h"
#include "extensions/CCBReader/CCBSelectorResolver.h"
class ButtonTestLayer : public cocos2d::extension::CCBSelectorResolver, public cocos2d::CCLayer {
public:
static ButtonTestLayer * node();
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
virtual void onCCControlButtonClicked(cocos2d::CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent);
};
#endif

View File

@ -1,8 +0,0 @@
#include "ButtonTestLayerLoader.h"
USING_NS_CC;
USING_NS_CC_EXT;
ButtonTestLayer * ButtonTestLayerLoader::createCCNode(CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) {
return ButtonTestLayer::node();
}

View File

@ -26,7 +26,7 @@
#include "../../testResource.h"
#include "extensions/CCBReader/CCBReader.h"
#include "extensions/CCBReader/CCNodeLoaderLibrary.h"
#include "HelloCocosBuilderLayerLoader.h"
#include "HelloCocosBuilder/HelloCocosBuilderLayerLoader.h"
USING_NS_CC;
USING_NS_CC_EXT;

View File

@ -3,23 +3,16 @@
#include "extensions/CCBReader/CCBReader.h"
#include "extensions/CCBReader/CCNodeLoaderLibrary.h"
#include "TestHeaderLayerLoader.h"
#include "ButtonTestLayerLoader.h"
#include "CCTransition.h"
#include "../TestHeader/TestHeaderLayerLoader.h"
#include "../LabelTest/LabelTestLayerLoader.h"
#include "../ButtonTest/ButtonTestLayerLoader.h"
#include "../SpriteTest/SpriteTestLayerLoader.h"
#include "../MenuTest/MenuTestLayerLoader.h"
#include "../ParticleSystemTest/ParticleSystemTestLayerLoader.h"
USING_NS_CC;
USING_NS_CC_EXT;
HelloCocosBuilderLayer * HelloCocosBuilderLayer::node() {
HelloCocosBuilderLayer * ptr = new HelloCocosBuilderLayer();
if(ptr && ptr->init()) {
ptr->autorelease();
return ptr;
}
CC_SAFE_DELETE(ptr);
return NULL;
}
void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * pCCNodeName, CCNodeLoader * pCCNodeLoader) {
/* Create an autorelease CCNodeLoaderLibrary. */
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
@ -64,69 +57,49 @@ void HelloCocosBuilderLayer::onNodeLoaded(cocos2d::CCNode * pNode, cocos2d::exte
}
SEL_MenuHandler HelloCocosBuilderLayer::onResolveCCBCCMenuSelector(CCObject * pTarget, const char * pSelectorName) {
SEL_MenuHandler HelloCocosBuilderLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) {
return NULL;
}
SEL_CCControlHandler HelloCocosBuilderLayer::onResolveCCBCCControlSelector(CCObject * pTarget, const char * pSelectorName) {
if(pTarget == this) {
if(strcmp(pSelectorName, "onMenuTestClicked") == 0) {
return cccontrol_selector(HelloCocosBuilderLayer::onMenuTestClicked);
} else if(strcmp(pSelectorName, "onSpriteTestClicked") == 0) {
return cccontrol_selector(HelloCocosBuilderLayer::onSpriteTestClicked);
} else if(strcmp(pSelectorName, "onButtonTestClicked") == 0) {
return cccontrol_selector(HelloCocosBuilderLayer::onButtonTestClicked);
} else if(strcmp(pSelectorName, "onLabelTestClicked") == 0) {
return cccontrol_selector(HelloCocosBuilderLayer::onLabelTestClicked);
} else if(strcmp(pSelectorName, "onParticleSystemTestClicked") == 0) {
return cccontrol_selector(HelloCocosBuilderLayer::onParticleSystemTestClicked);
} else if(strcmp(pSelectorName, "onScrollViewTestClicked") == 0) {
return cccontrol_selector(HelloCocosBuilderLayer::onScrollViewTestClicked);
}
}
SEL_CCControlHandler HelloCocosBuilderLayer::onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) {
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onMenuTestClicked", HelloCocosBuilderLayer::onMenuTestClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onSpriteTestClicked", HelloCocosBuilderLayer::onSpriteTestClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onButtonTestClicked", HelloCocosBuilderLayer::onButtonTestClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onLabelTestClicked", HelloCocosBuilderLayer::onLabelTestClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onParticleSystemTestClicked", HelloCocosBuilderLayer::onParticleSystemTestClicked);
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onScrollViewTestClicked", HelloCocosBuilderLayer::onScrollViewTestClicked);
return NULL;
}
bool HelloCocosBuilderLayer::onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode) {
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mBurstSprite", CCSprite *, this->mBurstSprite);
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mTestTitleLabelTTF", CCLabelTTF *, this->mTestTitleLabelTTF);
bool HelloCocosBuilderLayer::onAssignCCBMemberVariable(CCObject * pTarget, const char * pMemberVariableName, CCNode * pNode) {
if(pTarget == this) {
if(strcmp(pMemberVariableName, "mBurstSprite") == 0) {
this->mBurstSprite = dynamic_cast<CCSprite *>(pNode);
CC_ASSERT(this->mBurstSprite);
this->mBurstSprite->retain();
return true;
} else if(strcmp(pMemberVariableName, "mTestTitleLabel") == 0) {
this->mTestTitleLabelTTF = dynamic_cast<CCLabelTTF *>(pNode);
CC_ASSERT(this->mTestTitleLabelTTF);
this->mTestTitleLabelTTF->retain();
return true;
}
}
return false;
}
void HelloCocosBuilderLayer::onMenuTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onMenuTestClicked\n");
this->openTest("ccb/MenuTest.ccbi", "MenuTestLayer", MenuTestLayerLoader::loader());
}
void HelloCocosBuilderLayer::onSpriteTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onSpriteTestClicked\n");
this->openTest("ccb/SpriteTest.ccbi", "SpriteTestLayer", SpriteTestLayerLoader::loader());
}
void HelloCocosBuilderLayer::onButtonTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onButtonTestClicked\n");
this->openTest("ccb/ButtonTest.ccbi", "ButtonTestLayer", ButtonTestLayerLoader::loader());
}
void HelloCocosBuilderLayer::onLabelTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onLabelTestClicked\n");
this->openTest("ccb/LabelTest.ccbi", "LabelTestLayer", LabelTestLayerLoader::loader());
}
void HelloCocosBuilderLayer::onParticleSystemTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onParticleSystemTestClicked\n");
this->openTest("ccb/ParticleSystemTest.ccbi", "ParticleSystemTestLayer", ParticleSystemTestLayerLoader::loader());
}
void HelloCocosBuilderLayer::onScrollViewTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
printf("onScrollViewTestClicked\n");
CCLog("onScrollViewTestClicked\n");
}

View File

@ -19,13 +19,13 @@
*/
class HelloCocosBuilderLayer : public cocos2d::extension::CCBSelectorResolver, public cocos2d::extension::CCBMemberVariableAssigner, public cocos2d::extension::CCNodeLoaderListener, public cocos2d::CCLayer {
public:
static HelloCocosBuilderLayer * node();
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(HelloCocosBuilderLayer, node);
void openTest(const char * pCCBFileName, const char * pCCNodeName = NULL, cocos2d::extension::CCNodeLoader * pCCNodeLoader = NULL);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, const char * pMemberVariableName, cocos2d::CCNode * pNode);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode);
virtual void onNodeLoaded(cocos2d::CCNode * pNode, cocos2d::extension::CCNodeLoader * pNodeLoader);
virtual void onMenuTestClicked(cocos2d::CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent);

View File

@ -9,10 +9,10 @@ class CCBReader;
class HelloCocosBuilderLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(HelloCocosBuilderLayerLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(HelloCocosBuilderLayerLoader, loader);
protected:
virtual HelloCocosBuilderLayer * createCCNode(cocos2d::CCNode *, cocos2d::extension::CCBReader *);
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(HelloCocosBuilderLayer);
};
#endif

View File

@ -1,8 +0,0 @@
#include "HelloCocosBuilderLayerLoader.h"
USING_NS_CC;
USING_NS_CC_EXT;
HelloCocosBuilderLayer * HelloCocosBuilderLayerLoader::createCCNode(CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) {
return HelloCocosBuilderLayer::node();
}

View File

@ -0,0 +1,12 @@
#ifndef _LABELTESTLAYER_H_
#define _LABELTESTLAYER_H_
#include "cocos2d.h"
#include "extensions/CCBReader/CCBReader.h"
class LabelTestLayer : public cocos2d::CCLayer {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(LabelTestLayer, node);
};
#endif

View File

@ -0,0 +1,18 @@
#ifndef _LABELTESTLAYERLOADER_H_
#define _LABELTESTLAYERLOADER_H_
#include "extensions/CCBReader/CCLayerLoader.h"
#include "LabelTestLayer.h"
/* Forward declaration. */
class CCBReader;
class LabelTestLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LabelTestLayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(LabelTestLayer);
};
#endif

View File

@ -0,0 +1,37 @@
#include "MenuTestLayer.h"
#include "extensions/CCBReader/CCBReader.h"
USING_NS_CC;
USING_NS_CC_EXT;
SEL_MenuHandler MenuTestLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) {
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onMenuItemAClicked", MenuTestLayer::onMenuItemAClicked);
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onMenuItemBClicked", MenuTestLayer::onMenuItemBClicked);
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onMenuItemCClicked", MenuTestLayer::onMenuItemCClicked);
return NULL;
}
SEL_CCControlHandler MenuTestLayer::onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) {
return NULL;
}
bool MenuTestLayer::onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode) {
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mMenuItemStatusLabelBMFont", CCLabelBMFont *, this->mMenuItemStatusLabelBMFont);
return false;
}
void MenuTestLayer::onMenuItemAClicked(cocos2d::CCObject *pSender) {
this->mMenuItemStatusLabelBMFont->setString("Menu Item A clicked.");
}
void MenuTestLayer::onMenuItemBClicked(cocos2d::CCObject *pSender) {
this->mMenuItemStatusLabelBMFont->setString("Menu Item B clicked.");
}
void MenuTestLayer::onMenuItemCClicked(cocos2d::CCObject *pSender) {
this->mMenuItemStatusLabelBMFont->setString("Menu Item C clicked.");
}

View File

@ -0,0 +1,25 @@
#ifndef _MENUTESTLAYER_H_
#define _MENUTESTLAYER_H_
#include "cocos2d.h"
#include "extensions/CCBReader/CCNodeLoader.h"
#include "extensions/CCBReader/CCBSelectorResolver.h"
#include "extensions/CCBReader/CCBMemberVariableAssigner.h"
class MenuTestLayer : public cocos2d::extension::CCBSelectorResolver, public cocos2d::extension::CCBMemberVariableAssigner, public cocos2d::CCLayer {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(MenuTestLayer, node);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode);
virtual void onMenuItemAClicked(cocos2d::CCObject * pSender);
virtual void onMenuItemBClicked(cocos2d::CCObject * pSender);
virtual void onMenuItemCClicked(cocos2d::CCObject * pSender);
private:
cocos2d::CCLabelBMFont * mMenuItemStatusLabelBMFont;
};
#endif

View File

@ -0,0 +1,18 @@
#ifndef _MENUTESTLAYERLOADER_H_
#define _MENUTESTLAYERLOADER_H_
#include "extensions/CCBReader/CCLayerLoader.h"
#include "MenuTestLayer.h"
/* Forward declaration. */
class CCBReader;
class MenuTestLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(MenuTestLayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(MenuTestLayer);
};
#endif

View File

@ -0,0 +1,12 @@
#ifndef _PARTICLESYSTEMTESTLAYER_H_
#define _PARTICLESYSTEMTESTLAYER_H_
#include "cocos2d.h"
#include "extensions/CCBReader/CCBReader.h"
class ParticleSystemTestLayer : public cocos2d::CCLayer {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(ParticleSystemTestLayer, node);
};
#endif

View File

@ -0,0 +1,18 @@
#ifndef _PARTICLESYSTEMTESTLOADER_H_
#define _PARTICLESYSTEMTESTLOADER_H_
#include "extensions/CCBReader/CCLayerLoader.h"
#include "ParticleSystemTestLayer.h"
/* Forward declaration. */
class CCBReader;
class ParticleSystemTestLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(ParticleSystemTestLayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(ParticleSystemTestLayer);
};
#endif

View File

@ -0,0 +1,12 @@
#ifndef _SPRITETESTLAYER_H_
#define _SPRITETESTLAYER_H_
#include "cocos2d.h"
#include "extensions/CCBReader/CCBReader.h"
class SpriteTestLayer : public cocos2d::CCLayer {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(SpriteTestLayer, node);
};
#endif

View File

@ -0,0 +1,18 @@
#ifndef _SPRITETESTLAYERLOADER_H_
#define _SPRITETESTLAYERLOADER_H_
#include "extensions/CCBReader/CCLayerLoader.h"
#include "SpriteTestLayer.h"
/* Forward declaration. */
class CCBReader;
class SpriteTestLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(SpriteTestLayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(SpriteTestLayer);
};
#endif

View File

@ -0,0 +1,21 @@
#include "TestHeaderLayer.h"
#include "extensions/CCBReader/CCBReader.h"
USING_NS_CC;
USING_NS_CC_EXT;
SEL_MenuHandler TestHeaderLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) {
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onBackClicked", TestHeaderLayer::onBackClicked);
return NULL;
}
SEL_CCControlHandler TestHeaderLayer::onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) {
return NULL;
}
void TestHeaderLayer::onBackClicked(cocos2d::CCObject *pSender) {
CCDirector::sharedDirector()->popScene();
}

View File

@ -7,10 +7,10 @@
class TestHeaderLayer : public cocos2d::extension::CCBSelectorResolver, public cocos2d::CCLayer {
public:
static TestHeaderLayer * node();
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(TestHeaderLayer, node);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual void onBackClicked(cocos2d::CCObject * pSender);
};

View File

@ -9,10 +9,10 @@ class CCBReader;
class TestHeaderLayerLoader : public cocos2d::extension::CCLayerLoader {
public:
STATIC_NEW_AUTORELEASE_OBJECT_METHOD(TestHeaderLayerLoader, loader);
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(TestHeaderLayerLoader, loader);
protected:
virtual TestHeaderLayer * createCCNode(cocos2d::CCNode *, cocos2d::extension::CCBReader *);
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(TestHeaderLayer);
};
#endif

View File

@ -1,34 +0,0 @@
#include "TestHeaderLayer.h"
#include "extensions/CCBReader/CCBReader.h"
USING_NS_CC;
USING_NS_CC_EXT;
TestHeaderLayer * TestHeaderLayer::node() {
TestHeaderLayer * ptr = new TestHeaderLayer();
if(ptr && ptr->init()) {
ptr->autorelease();
return ptr;
}
CC_SAFE_DELETE(ptr);
return NULL;
}
SEL_MenuHandler TestHeaderLayer::onResolveCCBCCMenuSelector(CCObject * pTarget, const char * pSelectorName) {
if(pTarget == this) {
if(strcmp(pSelectorName, "onBackClicked") == 0) {
return menu_selector(TestHeaderLayer::onBackClicked);
}
}
return NULL;
}
SEL_CCControlHandler TestHeaderLayer::onResolveCCBCCControlSelector(CCObject * pTarget, const char * pSelectorName) {
return NULL;
}
void TestHeaderLayer::onBackClicked(cocos2d::CCObject *pSender) {
CCDirector::sharedDirector()->popScene();
}

View File

@ -1,8 +0,0 @@
#include "TestHeaderLayerLoader.h"
USING_NS_CC;
USING_NS_CC_EXT;
TestHeaderLayer * TestHeaderLayerLoader::createCCNode(CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) {
return TestHeaderLayer::node();
}