mirror of https://github.com/axmolengine/axmol.git
issue #1269:mrege latest code and fix conflict
This commit is contained in:
commit
2666df9472
|
@ -67,12 +67,13 @@ extensions/CCBReader/CCLabelTTFLoader.cpp \
|
||||||
extensions/CCBReader/CCLayerLoader.cpp \
|
extensions/CCBReader/CCLayerLoader.cpp \
|
||||||
extensions/CCBReader/CCLayerColorLoader.cpp \
|
extensions/CCBReader/CCLayerColorLoader.cpp \
|
||||||
extensions/CCBReader/CCLayerGradientLoader.cpp \
|
extensions/CCBReader/CCLayerGradientLoader.cpp \
|
||||||
extensions/CCBReader/CCMenuLoader.cpp \
|
|
||||||
extensions/CCBReader/CCMenuItemLoader.cpp \
|
extensions/CCBReader/CCMenuItemLoader.cpp \
|
||||||
extensions/CCBReader/CCMenuItemImageLoader.cpp \
|
extensions/CCBReader/CCMenuItemImageLoader.cpp \
|
||||||
extensions/CCBReader/CCSpriteLoader.cpp \
|
extensions/CCBReader/CCSpriteLoader.cpp \
|
||||||
extensions/CCBReader/CCScale9SpriteLoader.cpp \
|
extensions/CCBReader/CCScale9SpriteLoader.cpp \
|
||||||
|
extensions/CCBReader/CCScrollViewLoader.cpp \
|
||||||
extensions/CCBReader/CCParticleSystemQuadLoader.cpp \
|
extensions/CCBReader/CCParticleSystemQuadLoader.cpp \
|
||||||
|
extensions/CCScrollView/CCScrollView.cpp \
|
||||||
kazmath/src/aabb.c \
|
kazmath/src/aabb.c \
|
||||||
kazmath/src/mat3.c \
|
kazmath/src/mat3.c \
|
||||||
kazmath/src/mat4.c \
|
kazmath/src/mat4.c \
|
||||||
|
|
|
@ -357,12 +357,12 @@ void CCNode::setAnchorPoint(const CCPoint& point)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// contentSize getter
|
/// contentSize getter
|
||||||
const CCSize& CCNode::getContentSize()
|
CCSize CCNode::getContentSize()
|
||||||
{
|
{
|
||||||
return m_tContentSize;
|
return m_tContentSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCNode::setContentSize(const CCSize& size)
|
void CCNode::setContentSize(CCSize size)
|
||||||
{
|
{
|
||||||
if( ! CCSize::CCSizeEqualToSize(size, m_tContentSize) )
|
if( ! CCSize::CCSizeEqualToSize(size, m_tContentSize) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -222,7 +222,7 @@ public:
|
||||||
All nodes has a size. Layer and Scene has the same size of the screen.
|
All nodes has a size. Layer and Scene has the same size of the screen.
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
|
CC_PROPERTY(CCSize, m_tContentSize, ContentSize)
|
||||||
|
|
||||||
/** whether or not the node is running */
|
/** whether or not the node is running */
|
||||||
bool m_bIsRunning;
|
bool m_bIsRunning;
|
||||||
|
|
|
@ -5,10 +5,6 @@ USING_NS_CC_EXT;
|
||||||
|
|
||||||
#define PROPERTY_CCBFILE "ccbFile"
|
#define PROPERTY_CCBFILE "ccbFile"
|
||||||
|
|
||||||
CCNode * CCBFileLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCNode::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_CCBFILE) == 0) {
|
if(pPropertyName->compare(PROPERTY_CCBFILE) == 0) {
|
||||||
pNode->addChild(pCCBFileNode);
|
pNode->addChild(pCCBFileNode);
|
||||||
|
|
|
@ -10,12 +10,13 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCBFileLoader : public CCNodeLoader {
|
class CC_DLL CCBFileLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCBFileLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCNode * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCNode);
|
||||||
|
|
||||||
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode *, CCBReader *);
|
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -14,7 +14,8 @@ NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
class CC_DLL CCBMemberVariableAssigner {
|
class CC_DLL CCBMemberVariableAssigner {
|
||||||
public:
|
public:
|
||||||
virtual ~CCBMemberVariableAssigner() {}
|
virtual ~CCBMemberVariableAssigner() {};
|
||||||
|
|
||||||
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, cocos2d::CCString * pMemberVariableName, CCNode * pNode) = 0;
|
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, cocos2d::CCString * pMemberVariableName, CCNode * pNode) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ bool CCBReader::readBool() {
|
||||||
return this->readByte();
|
return this->readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CCBReader::readInt(bool pSign) {
|
int CCBReader::readInt(bool pSigned) {
|
||||||
int numBits = 0;
|
int numBits = 0;
|
||||||
while(!this->getBit()) {
|
while(!this->getBit()) {
|
||||||
numBits++;
|
numBits++;
|
||||||
|
@ -200,7 +200,7 @@ int CCBReader::readInt(bool pSign) {
|
||||||
current |= 1 << numBits;
|
current |= 1 << numBits;
|
||||||
|
|
||||||
int num;
|
int num;
|
||||||
if(pSign) {
|
if(pSigned) {
|
||||||
int s = current % 2;
|
int s = current % 2;
|
||||||
if(s) {
|
if(s) {
|
||||||
num = (int)(current / 2);
|
num = (int)(current / 2);
|
||||||
|
|
|
@ -118,11 +118,9 @@ class CC_DLL CCBReader : public CCObject {
|
||||||
std::set<std::string> mLoadedSpriteSheets;
|
std::set<std::string> mLoadedSpriteSheets;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Constructor. */
|
CCBReader(CCNodeLoaderLibrary * pCCNodeLoaderLibrary, CCBMemberVariableAssigner * pCCBMemberVariableAssigner = NULL, CCBSelectorResolver * pCCBSelectorResolver = NULL, CCNodeLoaderListener * pCCNodeLoaderListener = NULL);
|
||||||
CCBReader(CCNodeLoaderLibrary *, CCBMemberVariableAssigner * = NULL, CCBSelectorResolver * = NULL, CCNodeLoaderListener * = NULL);
|
CCBReader(CCBReader * pCCBReader);
|
||||||
CCBReader(CCBReader *);
|
virtual ~CCBReader();
|
||||||
/* Destructor. */
|
|
||||||
~CCBReader();
|
|
||||||
|
|
||||||
CCNode * readNodeGraphFromFile(const char * pCCBRootPath, const char * pCCBFileName, CCObject * pOwner = NULL);
|
CCNode * readNodeGraphFromFile(const char * pCCBRootPath, const char * pCCBFileName, CCObject * pOwner = NULL);
|
||||||
CCNode * readNodeGraphFromFile(CCString * pCCBRootPath, CCString * pCCBFileName, CCObject * pOwner = NULL);
|
CCNode * readNodeGraphFromFile(CCString * pCCBRootPath, CCString * pCCBFileName, CCObject * pOwner = NULL);
|
||||||
|
@ -135,21 +133,21 @@ class CC_DLL CCBReader : public CCObject {
|
||||||
CCString * getCCBRootPath();
|
CCString * getCCBRootPath();
|
||||||
CCObject * getOwner();
|
CCObject * getOwner();
|
||||||
CCNode * getRootNode();
|
CCNode * getRootNode();
|
||||||
CCSize getContainerSize(CCNode *);
|
CCSize getContainerSize(CCNode * pNode);
|
||||||
float getResolutionScale();
|
float getResolutionScale();
|
||||||
|
|
||||||
bool isSpriteSheetLoaded(CCString *);
|
bool isSpriteSheetLoaded(CCString * pSpriteSheet);
|
||||||
void addLoadedSpriteSheet(CCString *);
|
void addLoadedSpriteSheet(CCString * pSpriteSheet);
|
||||||
|
|
||||||
/* Utility methods. */
|
/* Utility methods. */
|
||||||
static CCString * lastPathComponent(CCString *);
|
static CCString * lastPathComponent(CCString * pString);
|
||||||
static CCString * deletePathExtension(CCString *);
|
static CCString * deletePathExtension(CCString * pString);
|
||||||
static CCString * toLowerCase(CCString *);
|
static CCString * toLowerCase(CCString * pCCString);
|
||||||
static bool endsWith(CCString *, CCString *);
|
static bool endsWith(CCString * pString, CCString * pEnding);
|
||||||
static CCString * concat(CCString *, CCString *);
|
static CCString * concat(CCString * pStringA, CCString * pStringB);
|
||||||
|
|
||||||
/* Parse methods. */
|
/* Parse methods. */
|
||||||
int readInt(bool pSign);
|
int readInt(bool pSigned);
|
||||||
unsigned char readByte();
|
unsigned char readByte();
|
||||||
bool readBool();
|
bool readBool();
|
||||||
float readFloat();
|
float readFloat();
|
||||||
|
@ -160,7 +158,7 @@ class CC_DLL CCBReader : public CCObject {
|
||||||
bool readStringCache();
|
bool readStringCache();
|
||||||
void readStringCacheEntry();
|
void readStringCacheEntry();
|
||||||
CCNode * readNodeGraph();
|
CCNode * readNodeGraph();
|
||||||
CCNode * readNodeGraph(CCNode *);
|
CCNode * readNodeGraph(CCNode * pParent);
|
||||||
|
|
||||||
bool getBit();
|
bool getBit();
|
||||||
void alignBits();
|
void alignBits();
|
||||||
|
|
|
@ -15,7 +15,8 @@ NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
class CC_DLL CCBSelectorResolver {
|
class CC_DLL CCBSelectorResolver {
|
||||||
public:
|
public:
|
||||||
virtual ~CCBSelectorResolver() {}
|
virtual ~CCBSelectorResolver() {};
|
||||||
|
|
||||||
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
||||||
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,10 +22,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED "backgroundSpriteFrame|2"
|
#define PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED "backgroundSpriteFrame|2"
|
||||||
#define PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED "backgroundSpriteFrame|3"
|
#define PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED "backgroundSpriteFrame|3"
|
||||||
|
|
||||||
CCControl * CCControlButtonLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCControlButton::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_ZOOMONTOUCHDOWN) == 0) {
|
if(pPropertyName->compare(PROPERTY_ZOOMONTOUCHDOWN) == 0) {
|
||||||
((CCControlButton *)pNode)->setZoomOnTouchDown(pCheck);
|
((CCControlButton *)pNode)->setZoomOnTouchDown(pCheck);
|
||||||
|
|
|
@ -10,19 +10,20 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCControlButtonLoader : public CCControlLoader {
|
class CC_DLL CCControlButtonLoader : public CCControlLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCControlButtonLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCControlButtonLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCControlButtonLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCControl * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCControlButton);
|
||||||
|
|
||||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool, CCBReader *);
|
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
|
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
|
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
|
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint, CCBReader *);
|
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize, CCBReader *);
|
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
|
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -9,11 +9,14 @@ NS_CC_EXT_BEGIN
|
||||||
class CCBReader;
|
class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCControlLoader : public CCNodeLoader {
|
class CC_DLL CCControlLoader : public CCNodeLoader {
|
||||||
protected:
|
public:
|
||||||
virtual CCControl * createCCNode(CCNode *, CCBReader *) = 0;
|
virtual ~CCControlLoader() {};
|
||||||
|
|
||||||
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData *, CCBReader *);
|
protected:
|
||||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool, CCBReader *);
|
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCControl);
|
||||||
|
|
||||||
|
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -9,10 +9,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_FNTFILE "fntFile"
|
#define PROPERTY_FNTFILE "fntFile"
|
||||||
#define PROPERTY_STRING "string"
|
#define PROPERTY_STRING "string"
|
||||||
|
|
||||||
CCLabelBMFont * CCLabelBMFontLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCLabelBMFont::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
||||||
((CCLabelBMFont *)pNode)->setColor(pCCColor3B);
|
((CCLabelBMFont *)pNode)->setColor(pCCColor3B);
|
||||||
|
|
|
@ -10,16 +10,17 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCLabelBMFontLoader : public CCNodeLoader {
|
class CC_DLL CCLabelBMFontLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCLabelBMFontLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelBMFontLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelBMFontLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCLabelBMFont * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLabelBMFont);
|
||||||
|
|
||||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
|
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
|
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
|
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -13,10 +13,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_STRING "string"
|
#define PROPERTY_STRING "string"
|
||||||
#define PROPERTY_DIMENSIONS "dimensions"
|
#define PROPERTY_DIMENSIONS "dimensions"
|
||||||
|
|
||||||
CCLabelTTF * CCLabelTTFLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCLabelTTF::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
||||||
((CCLabelTTF *)pNode)->setColor(pCCColor3B);
|
((CCLabelTTF *)pNode)->setColor(pCCColor3B);
|
||||||
|
|
|
@ -10,19 +10,20 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCLabelTTFLoader : public CCNodeLoader {
|
class CC_DLL CCLabelTTFLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCLabelTTFLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelTTFLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLabelTTFLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCLabelTTF * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLabelTTF);
|
||||||
|
|
||||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
|
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
|
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString *, CCBReader *);
|
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
|
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int, CCBReader *);
|
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize, CCBReader *);
|
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -7,10 +7,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_OPACITY "opacity"
|
#define PROPERTY_OPACITY "opacity"
|
||||||
#define PROPERTY_BLENDFUNC "blendFunc"
|
#define PROPERTY_BLENDFUNC "blendFunc"
|
||||||
|
|
||||||
CCLayerColor * CCLayerColorLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCLayerColor::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
|
||||||
((CCLayerColor *)pNode)->setColor(pCCColor3B);
|
((CCLayerColor *)pNode)->setColor(pCCColor3B);
|
||||||
|
|
|
@ -10,13 +10,15 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCLayerColorLoader : public CCLayerLoader {
|
class CC_DLL CCLayerColorLoader : public CCLayerLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCLayerColorLoader() {};
|
||||||
CCB_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, CCString * pPropertyName, ccColor3B, CCBReader *);
|
protected:
|
||||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLayerColor);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
|
||||||
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -10,10 +10,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_VECTOR "vector"
|
#define PROPERTY_VECTOR "vector"
|
||||||
#define PROPERTY_BLENDFUNC "blendFunc"
|
#define PROPERTY_BLENDFUNC "blendFunc"
|
||||||
|
|
||||||
CCLayerGradient * CCLayerGradientLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCLayerGradient::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
|
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
|
||||||
((CCLayerGradient *)pNode)->setStartColor(pCCColor3B);
|
((CCLayerGradient *)pNode)->setStartColor(pCCColor3B);
|
||||||
|
|
|
@ -10,15 +10,16 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCLayerGradientLoader : public CCLayerLoader {
|
class CC_DLL CCLayerGradientLoader : public CCLayerLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCLayerGradientLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerGradientLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerGradientLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCLayerGradient * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLayerGradient);
|
||||||
|
|
||||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
|
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint, CCBReader *);
|
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -8,10 +8,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_MOUSE_ENABLED "isMouseEnabled"
|
#define PROPERTY_MOUSE_ENABLED "isMouseEnabled"
|
||||||
#define PROPERTY_KEYBOARD_ENABLED "isKeyboardEnabled"
|
#define PROPERTY_KEYBOARD_ENABLED "isKeyboardEnabled"
|
||||||
|
|
||||||
CCLayer * CCLayerLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCLayer::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_TOUCH_ENABLED) == 0) {
|
if(pPropertyName->compare(PROPERTY_TOUCH_ENABLED) == 0) {
|
||||||
((CCLayer *)pNode)->setTouchEnabled(pCheck);
|
((CCLayer *)pNode)->setTouchEnabled(pCheck);
|
||||||
|
|
|
@ -10,10 +10,11 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCLayerLoader : public CCNodeLoader {
|
class CC_DLL CCLayerLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCLayerLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCLayerLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCLayer * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLayer);
|
||||||
|
|
||||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
|
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,10 +7,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame"
|
#define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame"
|
||||||
#define PROPERTY_DISABLEDDISPLAYFRAME "disabledSpriteFrame"
|
#define PROPERTY_DISABLEDDISPLAYFRAME "disabledSpriteFrame"
|
||||||
|
|
||||||
CCMenuItemImage * CCMenuItemImageLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCMenuItemImage::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_NORMALDISPLAYFRAME) == 0) {
|
if(pPropertyName->compare(PROPERTY_NORMALDISPLAYFRAME) == 0) {
|
||||||
if(pCCSpriteFrame != NULL) {
|
if(pCCSpriteFrame != NULL) {
|
||||||
|
|
|
@ -10,12 +10,13 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCMenuItemImageLoader : public CCMenuItemLoader {
|
class CC_DLL CCMenuItemImageLoader : public CCMenuItemLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCMenuItemImageLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuItemImageLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuItemImageLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCMenuItemImage * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCMenuItemImage);
|
||||||
|
|
||||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
|
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -9,11 +9,14 @@ NS_CC_EXT_BEGIN
|
||||||
class CCBReader;
|
class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCMenuItemLoader : public CCNodeLoader {
|
class CC_DLL CCMenuItemLoader : public CCNodeLoader {
|
||||||
protected:
|
public:
|
||||||
virtual CCMenuItem * createCCNode(CCNode *, CCBReader *) = 0;
|
virtual ~CCMenuItemLoader() {};
|
||||||
|
|
||||||
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData *, CCBReader *);
|
protected:
|
||||||
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool, CCBReader *);
|
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCMenuItem);
|
||||||
|
|
||||||
|
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#include "CCMenuLoader.h"
|
|
||||||
|
|
||||||
USING_NS_CC;
|
|
||||||
USING_NS_CC_EXT;
|
|
||||||
|
|
||||||
|
|
||||||
CCMenu * CCMenuLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCMenu::node();
|
|
||||||
}
|
|
|
@ -10,10 +10,11 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCMenuLoader : public CCLayerLoader {
|
class CC_DLL CCMenuLoader : public CCLayerLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCMenuLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCMenuLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCMenu * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCMenu);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -25,10 +25,6 @@ CCNode * CCNodeLoader::loadCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
||||||
return ccNode;
|
return ccNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCNode * CCNodeLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCNode::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
|
||||||
int propertyCount = pCCBReader->readInt(false);
|
int propertyCount = pCCBReader->readInt(false);
|
||||||
for(int i = 0; i < propertyCount; i++) {
|
for(int i = 0; i < propertyCount; i++) {
|
||||||
|
@ -86,7 +82,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
||||||
if(setProp) {
|
if(setProp) {
|
||||||
this->onHandlePropTypeScaleLock(pNode, pParent, propertyName, scaleLock, pCCBReader);
|
this->onHandlePropTypeScaleLock(pNode, pParent, propertyName, scaleLock, pCCBReader);
|
||||||
}
|
}
|
||||||
delete[] scaleLock;
|
CC_SAFE_DELETE_ARRAY(scaleLock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kCCBPropTypeFloat: {
|
case kCCBPropTypeFloat: {
|
||||||
|
@ -129,7 +125,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
||||||
if(setProp) {
|
if(setProp) {
|
||||||
this->onHandlePropTypeFloatVar(pNode, pParent, propertyName, floatVar, pCCBReader);
|
this->onHandlePropTypeFloatVar(pNode, pParent, propertyName, floatVar, pCCBReader);
|
||||||
}
|
}
|
||||||
delete[] floatVar;
|
CC_SAFE_DELETE_ARRAY(floatVar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kCCBPropTypeCheck: {
|
case kCCBPropTypeCheck: {
|
||||||
|
@ -179,7 +175,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
||||||
if(setProp) {
|
if(setProp) {
|
||||||
this->onHandlePropTypeColor4FVar(pNode, pParent, propertyName, color4FVar, pCCBReader);
|
this->onHandlePropTypeColor4FVar(pNode, pParent, propertyName, color4FVar, pCCBReader);
|
||||||
}
|
}
|
||||||
delete[] color4FVar;
|
CC_SAFE_DELETE_ARRAY(color4FVar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kCCBPropTypeFlip: {
|
case kCCBPropTypeFlip: {
|
||||||
|
@ -187,7 +183,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
||||||
if(setProp) {
|
if(setProp) {
|
||||||
this->onHandlePropTypeFlip(pNode, pParent, propertyName, flip, pCCBReader);
|
this->onHandlePropTypeFlip(pNode, pParent, propertyName, flip, pCCBReader);
|
||||||
}
|
}
|
||||||
delete[] flip;
|
CC_SAFE_DELETE_ARRAY(flip);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kCCBPropTypeBlendFunc: {
|
case kCCBPropTypeBlendFunc: {
|
||||||
|
@ -230,7 +226,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
||||||
if(setProp) {
|
if(setProp) {
|
||||||
this->onHandlePropTypeBlock(pNode, pParent, propertyName, blockData, pCCBReader);
|
this->onHandlePropTypeBlock(pNode, pParent, propertyName, blockData, pCCBReader);
|
||||||
}
|
}
|
||||||
delete blockData;
|
CC_SAFE_DELETE(blockData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kCCBPropTypeBlockCCControl: {
|
case kCCBPropTypeBlockCCControl: {
|
||||||
|
@ -238,7 +234,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
||||||
if(setProp && blockCCControlData != NULL) {
|
if(setProp && blockCCControlData != NULL) {
|
||||||
this->onHandlePropTypeBlockCCControl(pNode, pParent, propertyName, blockCCControlData, pCCBReader);
|
this->onHandlePropTypeBlockCCControl(pNode, pParent, propertyName, blockCCControlData, pCCBReader);
|
||||||
}
|
}
|
||||||
delete blockCCControlData;
|
CC_SAFE_DELETE(blockCCControlData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kCCBPropTypeCCBFile: {
|
case kCCBPropTypeCCBFile: {
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
NS_CC_EXT_BEGIN
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) { \
|
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) { \
|
||||||
return T::node(); \
|
return T::node(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) = 0
|
||||||
|
|
||||||
struct BlockData {
|
struct BlockData {
|
||||||
SEL_MenuHandler mSELMenuHandler;
|
SEL_MenuHandler mSELMenuHandler;
|
||||||
CCObject * mTarget;
|
CCObject * mTarget;
|
||||||
|
@ -26,13 +28,14 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCNodeLoader : public CCObject {
|
class CC_DLL CCNodeLoader : public CCObject {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCNodeLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoader, loader);
|
||||||
|
|
||||||
virtual CCNode * loadCCNode(CCNode *, CCBReader * pCCBReader);
|
virtual CCNode * loadCCNode(CCNode *, CCBReader * pCCBReader);
|
||||||
virtual void parseProperties(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
|
virtual void parseProperties(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCNode * createCCNode(CCNode * pParent, CCBReader * pCCBReader);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCNode);
|
||||||
|
|
||||||
virtual CCPoint parsePropTypePosition(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
|
virtual CCPoint parsePropTypePosition(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
|
||||||
virtual CCPoint parsePropTypePoint(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
|
virtual CCPoint parsePropTypePoint(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "CCMenuItemImageLoader.h"
|
#include "CCMenuItemImageLoader.h"
|
||||||
#include "CCControlButtonLoader.h"
|
#include "CCControlButtonLoader.h"
|
||||||
#include "CCParticleSystemQuadLoader.h"
|
#include "CCParticleSystemQuadLoader.h"
|
||||||
|
#include "CCScrollViewLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
|
@ -34,6 +35,7 @@ void CCNodeLoaderLibrary::registerDefaultCCNodeLoaders() {
|
||||||
this->registerCCNodeLoader("CCLabelBMFont", CCLabelBMFontLoader::loader());
|
this->registerCCNodeLoader("CCLabelBMFont", CCLabelBMFontLoader::loader());
|
||||||
this->registerCCNodeLoader("CCLabelTTF", CCLabelTTFLoader::loader());
|
this->registerCCNodeLoader("CCLabelTTF", CCLabelTTFLoader::loader());
|
||||||
this->registerCCNodeLoader("CCScale9Sprite", CCScale9SpriteLoader::loader());
|
this->registerCCNodeLoader("CCScale9Sprite", CCScale9SpriteLoader::loader());
|
||||||
|
this->registerCCNodeLoader("CCScrollView", CCScrollViewLoader::loader());
|
||||||
this->registerCCNodeLoader("CCBFile", CCBFileLoader::loader());
|
this->registerCCNodeLoader("CCBFile", CCBFileLoader::loader());
|
||||||
this->registerCCNodeLoader("CCMenu", CCMenuLoader::loader());
|
this->registerCCNodeLoader("CCMenu", CCMenuLoader::loader());
|
||||||
this->registerCCNodeLoader("CCMenuItemImage", CCMenuItemImageLoader::loader());
|
this->registerCCNodeLoader("CCMenuItemImage", CCMenuItemImageLoader::loader());
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CC_DLL CCNodeLoaderLibrary : public CCObject {
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoaderLibrary, library);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCNodeLoaderLibrary, library);
|
||||||
|
|
||||||
CCNodeLoaderLibrary();
|
CCNodeLoaderLibrary();
|
||||||
~CCNodeLoaderLibrary();
|
virtual ~CCNodeLoaderLibrary();
|
||||||
|
|
||||||
void registerDefaultCCNodeLoaders();
|
void registerDefaultCCNodeLoaders();
|
||||||
void registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader);
|
void registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader);
|
||||||
|
|
|
@ -7,7 +7,8 @@ NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
class CC_DLL CCNodeLoaderListener {
|
class CC_DLL CCNodeLoaderListener {
|
||||||
public:
|
public:
|
||||||
virtual ~CCNodeLoaderListener() {}
|
virtual ~CCNodeLoaderListener() {};
|
||||||
|
|
||||||
virtual void onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader) = 0;
|
virtual void onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_ENDRADIUS "endRadius"
|
#define PROPERTY_ENDRADIUS "endRadius"
|
||||||
#define PROPERTY_ROTATEPERSECOND "rotatePerSecond"
|
#define PROPERTY_ROTATEPERSECOND "rotatePerSecond"
|
||||||
|
|
||||||
CCParticleSystemQuad * CCParticleSystemQuadLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCParticleSystemQuad::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_EMITERMODE) == 0) {
|
if(pPropertyName->compare(PROPERTY_EMITERMODE) == 0) {
|
||||||
((CCParticleSystemQuad *)pNode)->setEmitterMode(pIntegerLabeled);
|
((CCParticleSystemQuad *)pNode)->setEmitterMode(pIntegerLabeled);
|
||||||
|
|
|
@ -10,19 +10,20 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCParticleSystemQuadLoader : public CCNodeLoader {
|
class CC_DLL CCParticleSystemQuadLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCParticleSystemQuadLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCParticleSystemQuadLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCParticleSystemQuadLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCParticleSystemQuad * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCParticleSystemQuad);
|
||||||
|
|
||||||
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int, CCBReader *);
|
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint, CCBReader *);
|
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
|
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int, CCBReader *);
|
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float *, CCBReader *);
|
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFloatVar, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F *, CCBReader *);
|
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D *, CCBReader *);
|
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -14,10 +14,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_INSETRIGHT "insetRight"
|
#define PROPERTY_INSETRIGHT "insetRight"
|
||||||
#define PROPERTY_INSETBOTTOM "insetBottom"
|
#define PROPERTY_INSETBOTTOM "insetBottom"
|
||||||
|
|
||||||
CCScale9Sprite * CCScale9SpriteLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCScale9Sprite::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_SPRITEFRAME) == 0) {
|
if(pPropertyName->compare(PROPERTY_SPRITEFRAME) == 0) {
|
||||||
((CCScale9Sprite *)pNode)->initWithSpriteFrame(pCCSpriteFrame);
|
((CCScale9Sprite *)pNode)->initWithSpriteFrame(pCCSpriteFrame);
|
||||||
|
|
|
@ -10,17 +10,18 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCScale9SpriteLoader : public CCNodeLoader {
|
class CC_DLL CCScale9SpriteLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCScale9SpriteLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScale9SpriteLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScale9SpriteLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCScale9Sprite * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCScale9Sprite);
|
||||||
|
|
||||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
|
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
|
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize, CCBReader *);
|
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float, CCBReader *);
|
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
#include "CCScrollViewLoader.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
USING_NS_CC_EXT;
|
||||||
|
|
||||||
|
#define PROPERTY_CONTAINER "container"
|
||||||
|
#define PROPERTY_DIRECTION "direction"
|
||||||
|
#define PROPERTY_CLIPSTOBOUNDS "clipsToBounds"
|
||||||
|
#define PROPERTY_BOUNCES "bounces"
|
||||||
|
#define PROPERTY_SCALE "scale"
|
||||||
|
|
||||||
|
void CCScrollViewLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
||||||
|
if(pPropertyName->compare(PROPERTY_CLIPSTOBOUNDS) == 0) {
|
||||||
|
((CCScrollView *)pNode)->setClippingToBounds(pCheck);
|
||||||
|
} else if(pPropertyName->compare(PROPERTY_BOUNCES) == 0) {
|
||||||
|
((CCScrollView *)pNode)->setBounceable(pCheck);
|
||||||
|
} else {
|
||||||
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
||||||
|
if(pPropertyName->compare(PROPERTY_CONTAINER) == 0) {
|
||||||
|
((CCScrollView *)pNode)->setContainer(pCCBFileNode);
|
||||||
|
} else {
|
||||||
|
CCNodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollViewLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
||||||
|
if(pPropertyName->compare(PROPERTY_SCALE) == 0) {
|
||||||
|
((CCScrollView *)pNode)->setScale(pFloat);
|
||||||
|
} else {
|
||||||
|
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollViewLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
||||||
|
if(pPropertyName->compare(PROPERTY_DIRECTION) == 0) {
|
||||||
|
((CCScrollView *)pNode)->setDirection(CCScrollViewDirection(pIntegerLabeled));
|
||||||
|
} else {
|
||||||
|
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef _CCB_CCSCROLLVIEWLOADER_H_
|
||||||
|
#define _CCB_CCSCROLLVIEWLOADER_H_
|
||||||
|
|
||||||
|
#include "CCNodeLoader.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
/* Forward declaration. */
|
||||||
|
class CCBReader;
|
||||||
|
|
||||||
|
class CC_DLL CCScrollViewLoader : public CCNodeLoader {
|
||||||
|
public:
|
||||||
|
virtual ~CCScrollViewLoader() {};
|
||||||
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCScrollViewLoader, loader);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCScrollView);
|
||||||
|
|
||||||
|
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
|
||||||
|
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,10 +9,6 @@ USING_NS_CC_EXT;
|
||||||
#define PROPERTY_OPACITY "opacity"
|
#define PROPERTY_OPACITY "opacity"
|
||||||
#define PROPERTY_BLENDFUNC "blendFunc"
|
#define PROPERTY_BLENDFUNC "blendFunc"
|
||||||
|
|
||||||
CCSprite * CCSpriteLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
||||||
return CCSprite::node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
||||||
if(pPropertyName->compare(PROPERTY_DISPLAYFRAME) == 0) {
|
if(pPropertyName->compare(PROPERTY_DISPLAYFRAME) == 0) {
|
||||||
((CCSprite *)pNode)->setDisplayFrame(pCCSpriteFrame);
|
((CCSprite *)pNode)->setDisplayFrame(pCCSpriteFrame);
|
||||||
|
|
|
@ -10,16 +10,17 @@ class CCBReader;
|
||||||
|
|
||||||
class CC_DLL CCSpriteLoader : public CCNodeLoader {
|
class CC_DLL CCSpriteLoader : public CCNodeLoader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~CCSpriteLoader() {};
|
||||||
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCSpriteLoader, loader);
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCSpriteLoader, loader);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CCSprite * createCCNode(CCNode *, CCBReader *);
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCSprite);
|
||||||
|
|
||||||
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B, CCBReader *);
|
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char, CCBReader *);
|
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc, CCBReader *);
|
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBBlendFunc, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame *, CCBReader *);
|
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
|
||||||
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool *, CCBReader *);
|
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -0,0 +1,722 @@
|
||||||
|
//
|
||||||
|
// SWScrollView.m
|
||||||
|
// SWGameLib
|
||||||
|
//
|
||||||
|
// Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
// Copyright (c) 2010 Sangwoo Im
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN false EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
// Created by Sangwoo Im on 6/3/10.
|
||||||
|
// Copyright 2010 Sangwoo Im. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "CCScrollView.h"
|
||||||
|
#include "CCActionInterval.h"
|
||||||
|
#include "CCActionTween.h"
|
||||||
|
#include "CCActionInstant.h"
|
||||||
|
#include "CCPointExtension.h"
|
||||||
|
#include "CCTouchDispatcher.h"
|
||||||
|
#include "CCGrid.h"
|
||||||
|
#include "CCDirector.h"
|
||||||
|
#include "kazmath/GL/matrix.h"
|
||||||
|
#include "CCTouch.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
#define SCROLL_DEACCEL_RATE 0.95f
|
||||||
|
#define SCROLL_DEACCEL_DIST 1.0f
|
||||||
|
#define BOUNCE_DURATION 0.15f
|
||||||
|
#define INSET_RATIO 0.2f
|
||||||
|
|
||||||
|
|
||||||
|
CCScrollView::CCScrollView()
|
||||||
|
: m_fZoomScale(0.0f)
|
||||||
|
, m_fMinZoomScale(0.0f)
|
||||||
|
, m_fMaxZoomScale(0.0f)
|
||||||
|
, m_pDelegate(NULL)
|
||||||
|
, m_bDragging(false)
|
||||||
|
, m_bBounceable(false)
|
||||||
|
, m_eDirection(CCScrollViewDirectionBoth)
|
||||||
|
, m_bClippingToBounds(false)
|
||||||
|
, m_pContainer(NULL)
|
||||||
|
, m_bTouchMoved(false)
|
||||||
|
, m_fTouchLength(0.0f)
|
||||||
|
, m_pTouches(NULL)
|
||||||
|
, m_fMinScale(0.0f)
|
||||||
|
, m_fMaxScale(0.0f)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CCScrollView::~CCScrollView()
|
||||||
|
{
|
||||||
|
m_pTouches->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCScrollView* CCScrollView::viewWithViewSize(CCSize size, CCNode* container/* = NULL*/)
|
||||||
|
{
|
||||||
|
return CCScrollView::create(size, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCScrollView* CCScrollView::create(CCSize size, CCNode* container/* = NULL*/)
|
||||||
|
{
|
||||||
|
CCScrollView* pRet = new CCScrollView();
|
||||||
|
if (pRet && pRet->initWithViewSize(size, container))
|
||||||
|
{
|
||||||
|
pRet->autorelease();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE(pRet);
|
||||||
|
}
|
||||||
|
return pRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCScrollView* CCScrollView::node()
|
||||||
|
{
|
||||||
|
return CCScrollView::create();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCScrollView* CCScrollView::create()
|
||||||
|
{
|
||||||
|
CCScrollView* pRet = new CCScrollView();
|
||||||
|
if (pRet && pRet->init())
|
||||||
|
{
|
||||||
|
pRet->autorelease();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE(pRet);
|
||||||
|
}
|
||||||
|
return pRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CCScrollView::initWithViewSize(CCSize size, CCNode *container/* = NULL*/)
|
||||||
|
{
|
||||||
|
if (CCLayer::init())
|
||||||
|
{
|
||||||
|
m_pContainer = container;
|
||||||
|
|
||||||
|
if (!this->m_pContainer)
|
||||||
|
{
|
||||||
|
m_pContainer = CCLayer::node();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setViewSize(size);
|
||||||
|
|
||||||
|
setTouchEnabled(true);
|
||||||
|
m_pTouches = new CCArray();
|
||||||
|
m_pDelegate = NULL;
|
||||||
|
m_bBounceable = true;
|
||||||
|
m_bClippingToBounds = true;
|
||||||
|
//m_pContainer->setContentSize(CCSizeZero);
|
||||||
|
m_eDirection = CCScrollViewDirectionBoth;
|
||||||
|
m_pContainer->setPosition(ccp(0.0f, 0.0f));
|
||||||
|
m_fTouchLength = 0.0f;
|
||||||
|
|
||||||
|
this->addChild(m_pContainer);
|
||||||
|
m_fMinScale = m_fMaxScale = 1.0f;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCScrollView::init()
|
||||||
|
{
|
||||||
|
return this->initWithViewSize(CCSizeMake(200, 200), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::registerWithTouchDispatcher()
|
||||||
|
{
|
||||||
|
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCScrollView::isNodeVisible(CCNode* node)
|
||||||
|
{
|
||||||
|
const CCPoint offset = this->getContentOffset();
|
||||||
|
const CCSize size = this->getViewSize();
|
||||||
|
const float scale = this->getZoomScale();
|
||||||
|
|
||||||
|
CCRect viewRect;
|
||||||
|
|
||||||
|
viewRect = CCRectMake(-offset.x/scale, -offset.y/scale, size.width/scale, size.height/scale);
|
||||||
|
|
||||||
|
return CCRect::CCRectIntersectsRect(viewRect, node->boundingBox());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::pause(CCObject* sender)
|
||||||
|
{
|
||||||
|
m_pContainer->pauseSchedulerAndActions();
|
||||||
|
|
||||||
|
CCObject* pObj = NULL;
|
||||||
|
CCArray* pChildren = m_pContainer->getChildren();
|
||||||
|
|
||||||
|
CCARRAY_FOREACH(pChildren, pObj)
|
||||||
|
{
|
||||||
|
CCNode* pChild = (CCNode*)pObj;
|
||||||
|
pChild->pauseSchedulerAndActions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::resume(CCObject* sender)
|
||||||
|
{
|
||||||
|
CCObject* pObj = NULL;
|
||||||
|
CCArray* pChildren = m_pContainer->getChildren();
|
||||||
|
|
||||||
|
CCARRAY_FOREACH(pChildren, pObj)
|
||||||
|
{
|
||||||
|
CCNode* pChild = (CCNode*)pObj;
|
||||||
|
pChild->resumeSchedulerAndActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pContainer->resumeSchedulerAndActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setTouchEnabled(bool e)
|
||||||
|
{
|
||||||
|
CCLayer::setTouchEnabled(e);
|
||||||
|
if (!e)
|
||||||
|
{
|
||||||
|
m_bDragging = false;
|
||||||
|
m_bTouchMoved = false;
|
||||||
|
m_pTouches->removeAllObjects();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setContentOffset(CCPoint offset, bool animated/* = false*/)
|
||||||
|
{
|
||||||
|
if (animated)
|
||||||
|
{ //animate scrolling
|
||||||
|
this->setContentOffsetInDuration(offset, BOUNCE_DURATION);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //set the container position directly
|
||||||
|
if (!m_bBounceable)
|
||||||
|
{
|
||||||
|
const CCPoint minOffset = this->minContainerOffset();
|
||||||
|
const CCPoint maxOffset = this->maxContainerOffset();
|
||||||
|
|
||||||
|
offset.x = MAX(minOffset.x, MIN(maxOffset.x, offset.x));
|
||||||
|
offset.y = MAX(minOffset.y, MIN(maxOffset.y, offset.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pContainer->setPosition(offset);
|
||||||
|
|
||||||
|
if (m_pDelegate != NULL)
|
||||||
|
{
|
||||||
|
m_pDelegate->scrollViewDidScroll(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setContentOffsetInDuration(CCPoint offset, float dt)
|
||||||
|
{
|
||||||
|
CCFiniteTimeAction *scroll, *expire;
|
||||||
|
|
||||||
|
scroll = CCMoveTo::actionWithDuration(dt, offset);
|
||||||
|
expire = CCCallFuncN::actionWithTarget(this, callfuncN_selector(CCScrollView::stoppedAnimatedScroll));
|
||||||
|
m_pContainer->runAction(CCSequence::actions(scroll, expire, NULL));
|
||||||
|
this->schedule(schedule_selector(CCScrollView::performedAnimatedScroll));
|
||||||
|
}
|
||||||
|
|
||||||
|
CCPoint CCScrollView::getContentOffset()
|
||||||
|
{
|
||||||
|
return m_pContainer->getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setZoomScale(float s)
|
||||||
|
{
|
||||||
|
if (m_pContainer->getScale() != s)
|
||||||
|
{
|
||||||
|
CCPoint oldCenter, newCenter;
|
||||||
|
CCPoint center;
|
||||||
|
|
||||||
|
if (m_fTouchLength == 0.0f)
|
||||||
|
{
|
||||||
|
center = ccp(m_tViewSize.width*0.5f, m_tViewSize.height*0.5f);
|
||||||
|
center = this->convertToWorldSpace(center);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
center = m_tTouchPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
oldCenter = m_pContainer->convertToNodeSpace(center);
|
||||||
|
m_pContainer->setScale(MAX(m_fMinScale, MIN(m_fMaxScale, s)));
|
||||||
|
newCenter = m_pContainer->convertToWorldSpace(oldCenter);
|
||||||
|
|
||||||
|
const CCPoint offset = ccpSub(center, newCenter);
|
||||||
|
if (m_pDelegate != NULL)
|
||||||
|
{
|
||||||
|
m_pDelegate->scrollViewDidZoom(this);
|
||||||
|
}
|
||||||
|
this->setContentOffset(ccpAdd(m_pContainer->getPosition(),offset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCFloat CCScrollView::getZoomScale()
|
||||||
|
{
|
||||||
|
return m_pContainer->getScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setZoomScale(float s, bool animated)
|
||||||
|
{
|
||||||
|
if (animated)
|
||||||
|
{
|
||||||
|
this->setZoomScaleInDuration(s, BOUNCE_DURATION);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->setZoomScale(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setZoomScaleInDuration(float s, float dt)
|
||||||
|
{
|
||||||
|
if (dt > 0)
|
||||||
|
{
|
||||||
|
if (m_pContainer->getScale() != s)
|
||||||
|
{
|
||||||
|
CCActionTween *scaleAction;
|
||||||
|
scaleAction = CCActionTween::actionWithDuration(dt, "zoomScale", m_pContainer->getScale(), s);
|
||||||
|
this->runAction(scaleAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->setZoomScale(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setViewSize(CCSize size)
|
||||||
|
{
|
||||||
|
m_tViewSize = size;
|
||||||
|
|
||||||
|
if (this->m_pContainer != NULL)
|
||||||
|
{
|
||||||
|
m_fMaxInset = this->maxContainerOffset();
|
||||||
|
m_fMaxInset = ccp(m_fMaxInset.x + m_tViewSize.width * INSET_RATIO,
|
||||||
|
m_fMaxInset.y + m_tViewSize.height * INSET_RATIO);
|
||||||
|
m_fMinInset = this->minContainerOffset();
|
||||||
|
m_fMinInset = ccp(m_fMinInset.x - m_tViewSize.width * INSET_RATIO,
|
||||||
|
m_fMinInset.y - m_tViewSize.height * INSET_RATIO);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLayer::setContentSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCNode * CCScrollView::getContainer()
|
||||||
|
{
|
||||||
|
return this->m_pContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setContainer(CCNode * pContainer)
|
||||||
|
{
|
||||||
|
this->removeAllChildrenWithCleanup(true);
|
||||||
|
|
||||||
|
if (!pContainer) return;
|
||||||
|
|
||||||
|
this->m_pContainer = pContainer;
|
||||||
|
|
||||||
|
this->m_pContainer->ignoreAnchorPointForPosition(false);
|
||||||
|
this->m_pContainer->setAnchorPoint(ccp(0.0f, 0.0f));
|
||||||
|
|
||||||
|
this->addChild(this->m_pContainer);
|
||||||
|
|
||||||
|
this->setViewSize(this->m_tViewSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::relocateContainer(bool animated)
|
||||||
|
{
|
||||||
|
CCPoint oldPoint, min, max;
|
||||||
|
CCFloat newX, newY;
|
||||||
|
|
||||||
|
min = this->minContainerOffset();
|
||||||
|
max = this->maxContainerOffset();
|
||||||
|
|
||||||
|
oldPoint = m_pContainer->getPosition();
|
||||||
|
|
||||||
|
newX = oldPoint.x;
|
||||||
|
newY = oldPoint.y;
|
||||||
|
if (m_eDirection == CCScrollViewDirectionBoth || m_eDirection == CCScrollViewDirectionHorizontal)
|
||||||
|
{
|
||||||
|
newX = MIN(newX, max.x);
|
||||||
|
newX = MAX(newX, min.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_eDirection == CCScrollViewDirectionBoth || m_eDirection == CCScrollViewDirectionVertical)
|
||||||
|
{
|
||||||
|
newY = MIN(newY, max.y);
|
||||||
|
newY = MAX(newY, min.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newY != oldPoint.y || newX != oldPoint.x)
|
||||||
|
{
|
||||||
|
this->setContentOffset(ccp(newX, newY), animated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCPoint CCScrollView::maxContainerOffset()
|
||||||
|
{
|
||||||
|
return ccp(0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCPoint CCScrollView::minContainerOffset()
|
||||||
|
{
|
||||||
|
return ccp(m_tViewSize.width - m_pContainer->getContentSize().width*m_pContainer->getScaleX(),
|
||||||
|
m_tViewSize.height - m_pContainer->getContentSize().height*m_pContainer->getScaleY());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::deaccelerateScrolling(float dt)
|
||||||
|
{
|
||||||
|
if (m_bDragging)
|
||||||
|
{
|
||||||
|
this->unschedule(schedule_selector(CCScrollView::deaccelerateScrolling));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCFloat newX, newY;
|
||||||
|
CCPoint maxInset, minInset;
|
||||||
|
|
||||||
|
m_pContainer->setPosition(ccpAdd(m_pContainer->getPosition(), m_tScrollDistance));
|
||||||
|
|
||||||
|
if (m_bBounceable)
|
||||||
|
{
|
||||||
|
maxInset = m_fMaxInset;
|
||||||
|
minInset = m_fMinInset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxInset = this->maxContainerOffset();
|
||||||
|
minInset = this->minContainerOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
//check to see if offset lies within the inset bounds
|
||||||
|
newX = MIN(m_pContainer->getPosition().x, maxInset.x);
|
||||||
|
newX = MAX(newX, minInset.x);
|
||||||
|
newY = MIN(m_pContainer->getPosition().y, maxInset.y);
|
||||||
|
newY = MAX(newY, minInset.y);
|
||||||
|
|
||||||
|
m_tScrollDistance = ccpSub(m_tScrollDistance, ccp(newX - m_pContainer->getPosition().x, newY - m_pContainer->getPosition().y));
|
||||||
|
m_tScrollDistance = ccpMult(m_tScrollDistance, SCROLL_DEACCEL_RATE);
|
||||||
|
this->setContentOffset(ccp(newX,newY));
|
||||||
|
|
||||||
|
if ((fabsf(m_tScrollDistance.x) <= SCROLL_DEACCEL_DIST &&
|
||||||
|
fabsf(m_tScrollDistance.y) <= SCROLL_DEACCEL_DIST) ||
|
||||||
|
newX == maxInset.x || newX == minInset.x ||
|
||||||
|
newY == maxInset.y || newY == minInset.y)
|
||||||
|
{
|
||||||
|
this->unschedule(schedule_selector(CCScrollView::deaccelerateScrolling));
|
||||||
|
this->relocateContainer(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::stoppedAnimatedScroll(CCNode * node)
|
||||||
|
{
|
||||||
|
this->unschedule(schedule_selector(CCScrollView::performedAnimatedScroll));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::performedAnimatedScroll(float dt)
|
||||||
|
{
|
||||||
|
if (m_bDragging)
|
||||||
|
{
|
||||||
|
this->unschedule(schedule_selector(CCScrollView::performedAnimatedScroll));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pDelegate != NULL)
|
||||||
|
{
|
||||||
|
m_pDelegate->scrollViewDidScroll(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CCSize CCScrollView::getContentSize()
|
||||||
|
{
|
||||||
|
return CCSizeMake(m_pContainer->getContentSize().width, m_pContainer->getContentSize().height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::setContentSize(CCSize size)
|
||||||
|
{
|
||||||
|
this->setViewSize(size);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* make sure all children go to the container
|
||||||
|
*/
|
||||||
|
void CCScrollView::addChild(CCNode * child, int zOrder, int tag)
|
||||||
|
{
|
||||||
|
child->ignoreAnchorPointForPosition(false);
|
||||||
|
child->setAnchorPoint(ccp(0.0f, 0.0f));
|
||||||
|
if (m_pContainer != child) {
|
||||||
|
m_pContainer->addChild(child, zOrder, tag);
|
||||||
|
} else {
|
||||||
|
CCLayer::addChild(child, zOrder, tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::addChild(CCNode * child, int zOrder)
|
||||||
|
{
|
||||||
|
this->addChild(child, zOrder, child->getTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::addChild(CCNode * child)
|
||||||
|
{
|
||||||
|
this->addChild(child, child->getZOrder(), child->getTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clip this view so that outside of the visible bounds can be hidden.
|
||||||
|
*/
|
||||||
|
void CCScrollView::beforeDraw()
|
||||||
|
{
|
||||||
|
if (m_bClippingToBounds)
|
||||||
|
{
|
||||||
|
// TODO: This scrollview should respect parents' positions
|
||||||
|
CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition());
|
||||||
|
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
float s = this->getScale();
|
||||||
|
|
||||||
|
CCDirector *director = CCDirector::sharedDirector();
|
||||||
|
s *= director->getContentScaleFactor();
|
||||||
|
|
||||||
|
glScissor((GLint)screenPos.x, (GLint)screenPos.y, (GLsizei)(m_tViewSize.width*s), (GLsizei)(m_tViewSize.height*s));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retract what's done in beforeDraw so that there's no side effect to
|
||||||
|
* other nodes.
|
||||||
|
*/
|
||||||
|
void CCScrollView::afterDraw()
|
||||||
|
{
|
||||||
|
if (m_bClippingToBounds)
|
||||||
|
{
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::visit()
|
||||||
|
{
|
||||||
|
// quick return if not visible
|
||||||
|
if (!isVisible())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kmGLPushMatrix();
|
||||||
|
|
||||||
|
// glPushMatrix();
|
||||||
|
|
||||||
|
if (m_pGrid && m_pGrid->isActive())
|
||||||
|
{
|
||||||
|
m_pGrid->beforeDraw();
|
||||||
|
this->transformAncestors();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->transform();
|
||||||
|
this->beforeDraw();
|
||||||
|
|
||||||
|
if(m_pChildren)
|
||||||
|
{
|
||||||
|
ccArray *arrayData = m_pChildren->data;
|
||||||
|
unsigned int i=0;
|
||||||
|
|
||||||
|
// draw children zOrder < 0
|
||||||
|
for( ; i < arrayData->num; i++ )
|
||||||
|
{
|
||||||
|
CCNode *child = (CCNode*)arrayData->arr[i];
|
||||||
|
if ( child->getZOrder() < 0 )
|
||||||
|
{
|
||||||
|
child->visit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// this draw
|
||||||
|
this->draw();
|
||||||
|
|
||||||
|
// draw children zOrder >= 0
|
||||||
|
for( ; i < arrayData->num; i++ )
|
||||||
|
{
|
||||||
|
CCNode* child = (CCNode*)arrayData->arr[i];
|
||||||
|
child->visit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->afterDraw();
|
||||||
|
if ( m_pGrid && m_pGrid->isActive())
|
||||||
|
{
|
||||||
|
m_pGrid->afterDraw(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
kmGLPopMatrix();
|
||||||
|
|
||||||
|
// glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event)
|
||||||
|
{
|
||||||
|
if (!this->isVisible())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CCRect frame;
|
||||||
|
frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height);
|
||||||
|
|
||||||
|
//dispatcher does not know about clipping. reject touches outside visible bounds.
|
||||||
|
if (m_pTouches->count() > 2 ||
|
||||||
|
m_bTouchMoved ||
|
||||||
|
!CCRect::CCRectContainsPoint(frame, m_pContainer->convertToWorldSpace(m_pContainer->convertTouchToNodeSpace(touch))))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_pTouches->containsObject(touch))
|
||||||
|
{
|
||||||
|
m_pTouches->addObject(touch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pTouches->count() == 1)
|
||||||
|
{ // scrolling
|
||||||
|
m_tTouchPoint = this->convertTouchToNodeSpace(touch);
|
||||||
|
m_bTouchMoved = false;
|
||||||
|
m_bDragging = true; //dragging started
|
||||||
|
m_tScrollDistance = ccp(0.0f, 0.0f);
|
||||||
|
m_fTouchLength = 0.0f;
|
||||||
|
}
|
||||||
|
else if (m_pTouches->count() == 2)
|
||||||
|
{
|
||||||
|
m_tTouchPoint = ccpMidpoint(this->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(0)),
|
||||||
|
this->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(1)));
|
||||||
|
m_fTouchLength = ccpDistance(m_pContainer->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(0)),
|
||||||
|
m_pContainer->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(1)));
|
||||||
|
m_bDragging = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::ccTouchMoved(CCTouch* touch, CCEvent* event)
|
||||||
|
{
|
||||||
|
if (!this->isVisible())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pTouches->containsObject(touch))
|
||||||
|
{
|
||||||
|
if (m_pTouches->count() == 1 && m_bDragging)
|
||||||
|
{ // scrolling
|
||||||
|
CCPoint moveDistance, newPoint, maxInset, minInset;
|
||||||
|
CCRect frame;
|
||||||
|
CCFloat newX, newY;
|
||||||
|
|
||||||
|
m_bTouchMoved = true;
|
||||||
|
frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height);
|
||||||
|
newPoint = this->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(0));
|
||||||
|
moveDistance = ccpSub(newPoint, m_tTouchPoint);
|
||||||
|
m_tTouchPoint = newPoint;
|
||||||
|
|
||||||
|
if (CCRect::CCRectContainsPoint(frame, this->convertToWorldSpace(newPoint)))
|
||||||
|
{
|
||||||
|
switch (m_eDirection)
|
||||||
|
{
|
||||||
|
case CCScrollViewDirectionVertical:
|
||||||
|
moveDistance = ccp(0.0f, moveDistance.y);
|
||||||
|
break;
|
||||||
|
case CCScrollViewDirectionHorizontal:
|
||||||
|
moveDistance = ccp(moveDistance.x, 0.0f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pContainer->setPosition(ccpAdd(m_pContainer->getPosition(), moveDistance));
|
||||||
|
|
||||||
|
maxInset = m_fMaxInset;
|
||||||
|
minInset = m_fMinInset;
|
||||||
|
|
||||||
|
|
||||||
|
//check to see if offset lies within the inset bounds
|
||||||
|
newX = MIN(m_pContainer->getPosition().x, maxInset.x);
|
||||||
|
newX = MAX(newX, minInset.x);
|
||||||
|
newY = MIN(m_pContainer->getPosition().y, maxInset.y);
|
||||||
|
newY = MAX(newY, minInset.y);
|
||||||
|
|
||||||
|
m_tScrollDistance = ccpSub(moveDistance, ccp(newX - m_pContainer->getPosition().x, newY - m_pContainer->getPosition().y));
|
||||||
|
this->setContentOffset(ccp(newX, newY));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_pTouches->count() == 2 && !m_bDragging)
|
||||||
|
{
|
||||||
|
const CCFloat len = ccpDistance(m_pContainer->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(0)),
|
||||||
|
m_pContainer->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(1)));
|
||||||
|
this->setZoomScale(this->getZoomScale()*len/m_fTouchLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::ccTouchEnded(CCTouch* touch, CCEvent* event)
|
||||||
|
{
|
||||||
|
if (!this->isVisible())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_pTouches->containsObject(touch))
|
||||||
|
{
|
||||||
|
if (m_pTouches->count() == 1 && m_bTouchMoved)
|
||||||
|
{
|
||||||
|
this->schedule(schedule_selector(CCScrollView::deaccelerateScrolling));
|
||||||
|
}
|
||||||
|
m_pTouches->removeObject(touch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pTouches->count() == 0)
|
||||||
|
{
|
||||||
|
m_bDragging = false;
|
||||||
|
m_bTouchMoved = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCScrollView::ccTouchCancelled(CCTouch* touch, CCEvent* event)
|
||||||
|
{
|
||||||
|
if (!this->isVisible())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_pTouches->removeObject(touch);
|
||||||
|
if (m_pTouches->count() == 0)
|
||||||
|
{
|
||||||
|
m_bDragging = false;
|
||||||
|
m_bTouchMoved = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
|
@ -0,0 +1,343 @@
|
||||||
|
//
|
||||||
|
// SWScrollView.h
|
||||||
|
// SWGameLib
|
||||||
|
//
|
||||||
|
// Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
// Copyright (c) 2010 Sangwoo Im
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Sangwoo Im on 6/3/10.
|
||||||
|
// Copyright 2010 Sangwoo Im. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __CCSCROLLVIEW_H__
|
||||||
|
#define __CCSCROLLVIEW_H__
|
||||||
|
|
||||||
|
#include "layers_scenes_transitions_nodes/CCLayer.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CCScrollViewDirectionHorizontal = 0,
|
||||||
|
CCScrollViewDirectionVertical,
|
||||||
|
CCScrollViewDirectionBoth
|
||||||
|
} CCScrollViewDirection;
|
||||||
|
|
||||||
|
class CCScrollView;
|
||||||
|
|
||||||
|
class CC_DLL CCScrollViewDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~CCScrollViewDelegate() {}
|
||||||
|
virtual void scrollViewDidScroll(CCScrollView* view) = 0;
|
||||||
|
virtual void scrollViewDidZoom(CCScrollView* view) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ScrollView support for cocos2d for iphone.
|
||||||
|
* It provides scroll view functionalities to cocos2d projects natively.
|
||||||
|
*/
|
||||||
|
class CC_DLL CCScrollView : public CCLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCScrollView();
|
||||||
|
virtual ~CCScrollView();
|
||||||
|
|
||||||
|
bool init();
|
||||||
|
virtual void registerWithTouchDispatcher();
|
||||||
|
/**
|
||||||
|
* Returns an autoreleased scroll view object.
|
||||||
|
* @warning: This interface will be deprecated in future.
|
||||||
|
* @param size view size
|
||||||
|
* @param container parent object
|
||||||
|
* @return autoreleased scroll view object
|
||||||
|
*/
|
||||||
|
static CCScrollView* viewWithViewSize(CCSize size, CCNode* container = NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an autoreleased scroll view object.
|
||||||
|
*
|
||||||
|
* @param size view size
|
||||||
|
* @param container parent object
|
||||||
|
* @return autoreleased scroll view object
|
||||||
|
*/
|
||||||
|
static CCScrollView* create(CCSize size, CCNode* container = NULL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an autoreleased scroll view object.
|
||||||
|
* @warning: This interface will be deprecated in future.
|
||||||
|
* @param size view size
|
||||||
|
* @param container parent object
|
||||||
|
* @return autoreleased scroll view object
|
||||||
|
*/
|
||||||
|
static CCScrollView* node();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an autoreleased scroll view object.
|
||||||
|
*
|
||||||
|
* @param size view size
|
||||||
|
* @param container parent object
|
||||||
|
* @return autoreleased scroll view object
|
||||||
|
*/
|
||||||
|
static CCScrollView* create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a scroll view object
|
||||||
|
*
|
||||||
|
* @param size view size
|
||||||
|
* @param container parent object
|
||||||
|
* @return scroll view object
|
||||||
|
*/
|
||||||
|
bool initWithViewSize(CCSize size, CCNode* container = NULL);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
|
||||||
|
*
|
||||||
|
* @param offset new offset
|
||||||
|
* @param If YES, the view scrolls to the new offset
|
||||||
|
*/
|
||||||
|
void setContentOffset(CCPoint offset, bool animated = false);
|
||||||
|
CCPoint getContentOffset();
|
||||||
|
/**
|
||||||
|
* Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
|
||||||
|
* You can override the animation duration with this method.
|
||||||
|
*
|
||||||
|
* @param offset new offset
|
||||||
|
* @param animation duration
|
||||||
|
*/
|
||||||
|
void setContentOffsetInDuration(CCPoint offset, float dt);
|
||||||
|
|
||||||
|
void setZoomScale(float s);
|
||||||
|
/**
|
||||||
|
* Sets a new scale and does that for a predefined duration.
|
||||||
|
*
|
||||||
|
* @param s a new scale vale
|
||||||
|
* @param animated if YES, scaling is animated
|
||||||
|
*/
|
||||||
|
void setZoomScale(float s, bool animated);
|
||||||
|
|
||||||
|
CCFloat getZoomScale();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new scale for container in a given duration.
|
||||||
|
*
|
||||||
|
* @param s a new scale value
|
||||||
|
* @param animation duration
|
||||||
|
*/
|
||||||
|
void setZoomScaleInDuration(float s, float dt);
|
||||||
|
/**
|
||||||
|
* Returns the current container's minimum offset. You may want this while you animate scrolling by yourself
|
||||||
|
*/
|
||||||
|
CCPoint minContainerOffset();
|
||||||
|
/**
|
||||||
|
* Returns the current container's maximum offset. You may want this while you animate scrolling by yourself
|
||||||
|
*/
|
||||||
|
CCPoint maxContainerOffset();
|
||||||
|
/**
|
||||||
|
* Determines if a given node's bounding box is in visible bounds
|
||||||
|
*
|
||||||
|
* @return YES if it is in visible bounds
|
||||||
|
*/
|
||||||
|
bool isNodeVisible(CCNode * node);
|
||||||
|
/**
|
||||||
|
* Provided to make scroll view compatible with SWLayer's pause method
|
||||||
|
*/
|
||||||
|
void pause(CCObject* sender);
|
||||||
|
/**
|
||||||
|
* Provided to make scroll view compatible with SWLayer's resume method
|
||||||
|
*/
|
||||||
|
void resume(CCObject* sender);
|
||||||
|
|
||||||
|
|
||||||
|
bool isDragging() {return m_bDragging;}
|
||||||
|
bool isTouchMoved() { return m_bTouchMoved; }
|
||||||
|
bool isBounceable() { return m_bBounceable; }
|
||||||
|
void setBounceable(bool bBounceable) { m_bBounceable = bBounceable; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* size to clip. CCNode boundingBox uses contentSize directly.
|
||||||
|
* It's semantically different what it actually means to common scroll views.
|
||||||
|
* Hence, this scroll view will use a separate size property.
|
||||||
|
*/
|
||||||
|
CCSize getViewSize() { return m_tViewSize; }
|
||||||
|
void setViewSize(CCSize size);
|
||||||
|
|
||||||
|
CCNode * getContainer();
|
||||||
|
void setContainer(CCNode * pContainer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* direction allowed to scroll. CCScrollViewDirectionBoth by default.
|
||||||
|
*/
|
||||||
|
CCScrollViewDirection getDirection() { return m_eDirection; }
|
||||||
|
void setDirection(CCScrollViewDirection eDirection) { m_eDirection = eDirection; }
|
||||||
|
|
||||||
|
CCScrollViewDelegate* getDelegate() { return m_pDelegate; }
|
||||||
|
void setDelegate(CCScrollViewDelegate* pDelegate) { m_pDelegate = pDelegate; }
|
||||||
|
|
||||||
|
/** override functions */
|
||||||
|
// optional
|
||||||
|
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
||||||
|
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
|
||||||
|
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
|
||||||
|
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
|
||||||
|
|
||||||
|
virtual void setContentSize(CCSize size);
|
||||||
|
virtual CCSize getContentSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether it clips its children or not.
|
||||||
|
*/
|
||||||
|
bool isClippingToBounds() { return m_bClippingToBounds; }
|
||||||
|
void setClippingToBounds(bool bClippingToBounds) { m_bClippingToBounds = bClippingToBounds; }
|
||||||
|
|
||||||
|
virtual void visit();
|
||||||
|
virtual void addChild(CCNode * child, int zOrder, int tag);
|
||||||
|
virtual void addChild(CCNode * child, int zOrder);
|
||||||
|
virtual void addChild(CCNode * child);
|
||||||
|
void setTouchEnabled(bool e);
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Init this object with a given size to clip its content.
|
||||||
|
*
|
||||||
|
* @param size view size
|
||||||
|
* @return initialized scroll view object
|
||||||
|
*/
|
||||||
|
bool initWithViewSize(CCSize size);
|
||||||
|
/**
|
||||||
|
* Relocates the container at the proper offset, in bounds of max/min offsets.
|
||||||
|
*
|
||||||
|
* @param animated If YES, relocation is animated
|
||||||
|
*/
|
||||||
|
void relocateContainer(bool animated);
|
||||||
|
/**
|
||||||
|
* implements auto-scrolling behavior. change SCROLL_DEACCEL_RATE as needed to choose
|
||||||
|
* deacceleration speed. it must be less than 1.0f.
|
||||||
|
*
|
||||||
|
* @param dt delta
|
||||||
|
*/
|
||||||
|
void deaccelerateScrolling(float dt);
|
||||||
|
/**
|
||||||
|
* This method makes sure auto scrolling causes delegate to invoke its method
|
||||||
|
*/
|
||||||
|
void performedAnimatedScroll(float dt);
|
||||||
|
/**
|
||||||
|
* Expire animated scroll delegate calls
|
||||||
|
*/
|
||||||
|
void stoppedAnimatedScroll(CCNode* node);
|
||||||
|
/**
|
||||||
|
* clip this view so that outside of the visible bounds can be hidden.
|
||||||
|
*/
|
||||||
|
void beforeDraw();
|
||||||
|
/**
|
||||||
|
* retract what's done in beforeDraw so that there's no side effect to
|
||||||
|
* other nodes.
|
||||||
|
*/
|
||||||
|
void afterDraw();
|
||||||
|
/**
|
||||||
|
* Zoom handling
|
||||||
|
*/
|
||||||
|
void handleZoom();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* current zoom scale
|
||||||
|
*/
|
||||||
|
CCFloat m_fZoomScale;
|
||||||
|
/**
|
||||||
|
* min zoom scale
|
||||||
|
*/
|
||||||
|
CCFloat m_fMinZoomScale;
|
||||||
|
/**
|
||||||
|
* max zoom scale
|
||||||
|
*/
|
||||||
|
CCFloat m_fMaxZoomScale;
|
||||||
|
/**
|
||||||
|
* scroll view delegate
|
||||||
|
*/
|
||||||
|
CCScrollViewDelegate* m_pDelegate;
|
||||||
|
|
||||||
|
CCScrollViewDirection m_eDirection;
|
||||||
|
/**
|
||||||
|
* If YES, the view is being dragged.
|
||||||
|
*/
|
||||||
|
bool m_bDragging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Content offset. Note that left-bottom point is the origin
|
||||||
|
*/
|
||||||
|
CCPoint m_tContentOffset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container holds scroll view contents, Sets the scrollable container object of the scroll view
|
||||||
|
*/
|
||||||
|
CCNode* m_pContainer;
|
||||||
|
/**
|
||||||
|
* Determiens whether user touch is moved after begin phase.
|
||||||
|
*/
|
||||||
|
bool m_bTouchMoved;
|
||||||
|
/**
|
||||||
|
* max inset point to limit scrolling by touch
|
||||||
|
*/
|
||||||
|
CCPoint m_fMaxInset;
|
||||||
|
/**
|
||||||
|
* min inset point to limit scrolling by touch
|
||||||
|
*/
|
||||||
|
CCPoint m_fMinInset;
|
||||||
|
/**
|
||||||
|
* Determines whether the scroll view is allowed to bounce or not.
|
||||||
|
*/
|
||||||
|
bool m_bBounceable;
|
||||||
|
|
||||||
|
bool m_bClippingToBounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* scroll speed
|
||||||
|
*/
|
||||||
|
CCPoint m_tScrollDistance;
|
||||||
|
/**
|
||||||
|
* Touch point
|
||||||
|
*/
|
||||||
|
CCPoint m_tTouchPoint;
|
||||||
|
/**
|
||||||
|
* length between two fingers
|
||||||
|
*/
|
||||||
|
CCFloat m_fTouchLength;
|
||||||
|
/**
|
||||||
|
* UITouch objects to detect multitouch
|
||||||
|
*/
|
||||||
|
CCArray* m_pTouches;
|
||||||
|
/**
|
||||||
|
* size to clip. CCNode boundingBox uses contentSize directly.
|
||||||
|
* It's semantically different what it actually means to common scroll views.
|
||||||
|
* Hence, this scroll view will use a separate size property.
|
||||||
|
*/
|
||||||
|
CCSize m_tViewSize;
|
||||||
|
/**
|
||||||
|
* max and min scale
|
||||||
|
*/
|
||||||
|
CCFloat m_fMinScale, m_fMaxScale;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
||||||
|
|
||||||
|
#endif /* __CCSCROLLVIEW_H__ */
|
|
@ -5,5 +5,6 @@
|
||||||
#include "extensions/CCControlExtension/CCControlExtensions.h"
|
#include "extensions/CCControlExtension/CCControlExtensions.h"
|
||||||
#include "extensions/CCListView/CCListView.h"
|
#include "extensions/CCListView/CCListView.h"
|
||||||
#include "extensions/CCTextureWatcher/CCTextureWatcher.h"
|
#include "extensions/CCTextureWatcher/CCTextureWatcher.h"
|
||||||
|
#include "extensions/CCScrollView/CCScrollView.h"
|
||||||
|
|
||||||
#endif /* __COCOS2DEXT_H__ */
|
#endif /* __COCOS2DEXT_H__ */
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
09db4ca2f8aea11791d3c39709ea90d4dabd3327
|
1b9cd698b4218156a0fa72a86827864d77ee83ee
|
|
@ -1334,10 +1334,6 @@
|
||||||
RelativePath="..\extensions\CCBReader\CCMenuItemLoader.h"
|
RelativePath="..\extensions\CCBReader\CCMenuItemLoader.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\extensions\CCBReader\CCMenuLoader.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\extensions\CCBReader\CCMenuLoader.h"
|
RelativePath="..\extensions\CCBReader\CCMenuLoader.h"
|
||||||
>
|
>
|
||||||
|
@ -1378,6 +1374,14 @@
|
||||||
RelativePath="..\extensions\CCBReader\CCScale9SpriteLoader.h"
|
RelativePath="..\extensions\CCBReader\CCScale9SpriteLoader.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\extensions\CCBReader\CCScrollViewLoader.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\extensions\CCBReader\CCScrollViewLoader.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\extensions\CCBReader\CCSpriteLoader.cpp"
|
RelativePath="..\extensions\CCBReader\CCSpriteLoader.cpp"
|
||||||
>
|
>
|
||||||
|
@ -1387,6 +1391,18 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="CCScrollView"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\extensions\CCScrollView\CCScrollView.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\extensions\CCScrollView\CCScrollView.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="kazmath"
|
Name="kazmath"
|
||||||
|
|
|
@ -174,11 +174,11 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCLayerLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCLayerLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCMenuItemImageLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCMenuItemImageLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCMenuItemLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCMenuItemLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCMenuLoader.cpp" />
|
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCNodeLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCNodeLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCNodeLoaderLibrary.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCNodeLoaderLibrary.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCParticleSystemQuadLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCParticleSystemQuadLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCScale9SpriteLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCScale9SpriteLoader.cpp" />
|
||||||
|
<ClCompile Include="..\extensions\CCBReader\CCScrollViewLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCSpriteLoader.cpp" />
|
<ClCompile Include="..\extensions\CCBReader\CCSpriteLoader.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCControlExtension\CCControl.cpp" />
|
<ClCompile Include="..\extensions\CCControlExtension\CCControl.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCControlExtension\CCControlButton.cpp" />
|
<ClCompile Include="..\extensions\CCControlExtension\CCControlButton.cpp" />
|
||||||
|
@ -195,6 +195,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
||||||
<ClCompile Include="..\extensions\CCListView\CCListView.cpp" />
|
<ClCompile Include="..\extensions\CCListView\CCListView.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCListView\CCListViewCell.cpp" />
|
<ClCompile Include="..\extensions\CCListView\CCListViewCell.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCNotificationCenter\CCNotificationCenter.cpp" />
|
<ClCompile Include="..\extensions\CCNotificationCenter\CCNotificationCenter.cpp" />
|
||||||
|
<ClCompile Include="..\extensions\CCScrollView\CCScrollView.cpp" />
|
||||||
<ClCompile Include="..\extensions\CCTextureWatcher\CCTextureWatcher.cpp" />
|
<ClCompile Include="..\extensions\CCTextureWatcher\CCTextureWatcher.cpp" />
|
||||||
<ClCompile Include="..\kazmath\src\aabb.c" />
|
<ClCompile Include="..\kazmath\src\aabb.c" />
|
||||||
<ClCompile Include="..\kazmath\src\GL\mat4stack.c" />
|
<ClCompile Include="..\kazmath\src\GL\mat4stack.c" />
|
||||||
|
@ -330,6 +331,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
||||||
<ClInclude Include="..\extensions\CCBReader\CCNodeLoaderListener.h" />
|
<ClInclude Include="..\extensions\CCBReader\CCNodeLoaderListener.h" />
|
||||||
<ClInclude Include="..\extensions\CCBReader\CCParticleSystemQuadLoader.h" />
|
<ClInclude Include="..\extensions\CCBReader\CCParticleSystemQuadLoader.h" />
|
||||||
<ClInclude Include="..\extensions\CCBReader\CCScale9SpriteLoader.h" />
|
<ClInclude Include="..\extensions\CCBReader\CCScale9SpriteLoader.h" />
|
||||||
|
<ClInclude Include="..\extensions\CCBReader\CCScrollViewLoader.h" />
|
||||||
<ClInclude Include="..\extensions\CCBReader\CCSpriteLoader.h" />
|
<ClInclude Include="..\extensions\CCBReader\CCSpriteLoader.h" />
|
||||||
<ClInclude Include="..\extensions\CCControlExtension\CCControl.h" />
|
<ClInclude Include="..\extensions\CCControlExtension\CCControl.h" />
|
||||||
<ClInclude Include="..\extensions\CCControlExtension\CCControlButton.h" />
|
<ClInclude Include="..\extensions\CCControlExtension\CCControlButton.h" />
|
||||||
|
@ -348,6 +350,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
||||||
<ClInclude Include="..\extensions\CCListView\CCListView.h" />
|
<ClInclude Include="..\extensions\CCListView\CCListView.h" />
|
||||||
<ClInclude Include="..\extensions\CCListView\CCListViewCell.h" />
|
<ClInclude Include="..\extensions\CCListView\CCListViewCell.h" />
|
||||||
<ClInclude Include="..\extensions\CCNotificationCenter\CCNotificationCenter.h" />
|
<ClInclude Include="..\extensions\CCNotificationCenter\CCNotificationCenter.h" />
|
||||||
|
<ClInclude Include="..\extensions\CCScrollView\CCScrollView.h" />
|
||||||
<ClInclude Include="..\extensions\CCTextureWatcher\CCTextureWatcher.h" />
|
<ClInclude Include="..\extensions\CCTextureWatcher\CCTextureWatcher.h" />
|
||||||
<ClInclude Include="..\include\ccConfig.h" />
|
<ClInclude Include="..\include\ccConfig.h" />
|
||||||
<ClInclude Include="..\include\CCEventType.h" />
|
<ClInclude Include="..\include\CCEventType.h" />
|
||||||
|
|
|
@ -109,6 +109,9 @@
|
||||||
<Filter Include="extensions\CCBReader">
|
<Filter Include="extensions\CCBReader">
|
||||||
<UniqueIdentifier>{4647762c-52c3-475d-968a-96aa48dbcd0c}</UniqueIdentifier>
|
<UniqueIdentifier>{4647762c-52c3-475d-968a-96aa48dbcd0c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="extensions\CCScrollView">
|
||||||
|
<UniqueIdentifier>{a9d9fee5-8d26-4082-b526-2b7830770446}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\effects\CCGrabber.cpp">
|
<ClCompile Include="..\effects\CCGrabber.cpp">
|
||||||
|
@ -510,9 +513,6 @@
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCMenuItemLoader.cpp">
|
<ClCompile Include="..\extensions\CCBReader\CCMenuItemLoader.cpp">
|
||||||
<Filter>extensions\CCBReader</Filter>
|
<Filter>extensions\CCBReader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCMenuLoader.cpp">
|
|
||||||
<Filter>extensions\CCBReader</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\extensions\CCBReader\CCNodeLoader.cpp">
|
<ClCompile Include="..\extensions\CCBReader\CCNodeLoader.cpp">
|
||||||
<Filter>extensions\CCBReader</Filter>
|
<Filter>extensions\CCBReader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -537,6 +537,12 @@
|
||||||
<ClCompile Include="..\actions\CCActionCatmullRom.cpp">
|
<ClCompile Include="..\actions\CCActionCatmullRom.cpp">
|
||||||
<Filter>actions</Filter>
|
<Filter>actions</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\extensions\CCScrollView\CCScrollView.cpp">
|
||||||
|
<Filter>extensions\CCScrollView</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\extensions\CCBReader\CCScrollViewLoader.cpp">
|
||||||
|
<Filter>extensions\CCBReader</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\effects\CCGrabber.h">
|
<ClInclude Include="..\effects\CCGrabber.h">
|
||||||
|
@ -1087,5 +1093,11 @@
|
||||||
<ClInclude Include="..\actions\CCActionCatmullRom.h">
|
<ClInclude Include="..\actions\CCActionCatmullRom.h">
|
||||||
<Filter>actions</Filter>
|
<Filter>actions</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\extensions\CCScrollView\CCScrollView.h">
|
||||||
|
<Filter>extensions\CCScrollView</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\extensions\CCBReader\CCScrollViewLoader.h">
|
||||||
|
<Filter>extensions\CCBReader</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -30,7 +30,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class CCTouch : public CCObject
|
class CC_DLL CCTouch : public CCObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCTouch()
|
CCTouch()
|
||||||
|
@ -59,7 +59,7 @@ private:
|
||||||
CCPoint m_prevPoint;
|
CCPoint m_prevPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEvent : public CCObject
|
class CC_DLL CCEvent : public CCObject
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
80e25f0506e93a93d244735fd6deb92cec8055d2
|
237baaafa1073d1c133294a70e84bcd2849ec57d
|
|
@ -1 +1 @@
|
||||||
cf9109aeec89b5dafb4bc9588c59b279c734d0a2
|
c13eb2b1ec38e28d1537f0671e700e1af00dd31e
|
|
@ -1001,6 +1001,18 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="ScrollViewTest"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest\ScrollViewTestLayer.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest\ScrollViewTestLayerLoader.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
|
@ -125,13 +125,11 @@
|
||||||
<ClCompile Include="..\tests\BugsTest\BugsTest.cpp" />
|
<ClCompile Include="..\tests\BugsTest\BugsTest.cpp" />
|
||||||
<ClCompile Include="..\tests\ChipmunkAccelTouchTest\ChipmunkAccelTouchTest.cpp" />
|
<ClCompile Include="..\tests\ChipmunkAccelTouchTest\ChipmunkAccelTouchTest.cpp" />
|
||||||
<ClCompile Include="..\tests\CurrentLanguageTest\CurrentLanguageTest.cpp" />
|
<ClCompile Include="..\tests\CurrentLanguageTest\CurrentLanguageTest.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayer.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTest\ButtonTestLayer.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayerLoader.cpp" />
|
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayer.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder\HelloCocosBuilderLayer.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayerLoader.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\MenuTest\MenuTestLayer.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayer.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeader\TestHeaderLayer.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayerLoader.cpp" />
|
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlButtonTest\CCControlButtonTest.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlButtonTest\CCControlButtonTest.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlColourPicker\CCControlColourPickerTest.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlColourPicker\CCControlColourPickerTest.cpp" />
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlScene.cpp" />
|
<ClCompile Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlScene.cpp" />
|
||||||
|
@ -208,13 +206,23 @@
|
||||||
<ClInclude Include="..\tests\BugsTest\BugsTest.h" />
|
<ClInclude Include="..\tests\BugsTest\BugsTest.h" />
|
||||||
<ClInclude Include="..\tests\ChipmunkAccelTouchTest\ChipmunkAccelTouchTest.h" />
|
<ClInclude Include="..\tests\ChipmunkAccelTouchTest\ChipmunkAccelTouchTest.h" />
|
||||||
<ClInclude Include="..\tests\CurrentLanguageTest\CurrentLanguageTest.h" />
|
<ClInclude Include="..\tests\CurrentLanguageTest\CurrentLanguageTest.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayer.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTest\ButtonTestLayer.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayerLoader.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTest\ButtonTestLayerLoader.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayer.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder\HelloCocosBuilderLayer.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayerLoader.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder\HelloCocosBuilderLayerLoader.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayer.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\LabelTest\LabelTestLayer.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayerLoader.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\LabelTest\LabelTestLayerLoader.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\MenuTest\MenuTestLayer.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\MenuTest\MenuTestLayerLoader.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest\ParticleSystemTestLayer.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest\ParticleSystemTestLayerLoader.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest\ScrollViewTestLayer.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest\ScrollViewTestLayerLoader.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\SpriteTest\SpriteTestLayer.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\SpriteTest\SpriteTestLayerLoader.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeader\TestHeaderLayer.h" />
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeader\TestHeaderLayerLoader.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlButtonTest\CCControlButtonTest.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlButtonTest\CCControlButtonTest.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlColourPicker\CCControlColourPickerTest.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlColourPicker\CCControlColourPickerTest.h" />
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlScene.h" />
|
<ClInclude Include="..\tests\ExtensionsTest\ControlExtensionTest\CCControlScene.h" />
|
||||||
|
|
|
@ -166,6 +166,30 @@
|
||||||
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest">
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest">
|
||||||
<UniqueIdentifier>{2e6b7147-7836-4a98-a2f5-a00080e7ca23}</UniqueIdentifier>
|
<UniqueIdentifier>{2e6b7147-7836-4a98-a2f5-a00080e7ca23}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\ButtonTest">
|
||||||
|
<UniqueIdentifier>{b6567e7e-4af7-4e84-857a-affc03c1332a}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder">
|
||||||
|
<UniqueIdentifier>{5b3fcb56-0c0f-4433-a209-50ffca282f88}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\LabelTest">
|
||||||
|
<UniqueIdentifier>{629b76d1-2144-49f0-a2ef-357caa97d0dc}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\MenuTest">
|
||||||
|
<UniqueIdentifier>{eee8a971-55ff-46ca-8d1f-7b03feb9481c}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest">
|
||||||
|
<UniqueIdentifier>{ff19ea2d-70c2-444d-8d41-7ce3cd208dbd}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest">
|
||||||
|
<UniqueIdentifier>{706efc28-51b2-48d9-bcd9-b76f49eb68a5}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\SpriteTest">
|
||||||
|
<UniqueIdentifier>{8a4f12b4-f105-495c-83d6-0005d05b61a0}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="classes\tests\ExtensionsTest\CocosBuilderTest\TestHeader">
|
||||||
|
<UniqueIdentifier>{4c0682f3-b85a-4418-adda-9b25de410af0}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
|
@ -390,26 +414,20 @@
|
||||||
<ClCompile Include="..\tests\MutiTouchTest\MutiTouchTest.cpp">
|
<ClCompile Include="..\tests\MutiTouchTest\MutiTouchTest.cpp">
|
||||||
<Filter>classes\tests\MutiTouchTest</Filter>
|
<Filter>classes\tests\MutiTouchTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayer.cpp">
|
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayerLoader.cpp">
|
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.cpp">
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.cpp">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayer.cpp">
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeader\TestHeaderLayer.cpp">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\TestHeader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayerLoader.cpp">
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\MenuTest\MenuTestLayer.cpp">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\MenuTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayer.cpp">
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder\HelloCocosBuilderLayer.cpp">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayerLoader.cpp">
|
<ClCompile Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTest\ButtonTestLayer.cpp">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ButtonTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -749,26 +767,56 @@
|
||||||
<ClInclude Include="..\tests\MutiTouchTest\MutiTouchTest.h">
|
<ClInclude Include="..\tests\MutiTouchTest\MutiTouchTest.h">
|
||||||
<Filter>classes\tests\MutiTouchTest</Filter>
|
<Filter>classes\tests\MutiTouchTest</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayer.h">
|
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTestLayerLoader.h">
|
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.h">
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\CocosBuilderTest.h">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayer.h">
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeader\TestHeaderLayer.h">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\TestHeader</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilderLayerLoader.h">
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeader\TestHeaderLayerLoader.h">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\TestHeader</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayer.h">
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\SpriteTest\SpriteTestLayer.h">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\SpriteTest</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\TestHeaderLayerLoader.h">
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\SpriteTest\SpriteTestLayerLoader.h">
|
||||||
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest</Filter>
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\SpriteTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest\ScrollViewTestLayer.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest\ScrollViewTestLayerLoader.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ScrollViewTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest\ParticleSystemTestLayer.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest\ParticleSystemTestLayerLoader.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ParticleSystemTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\MenuTest\MenuTestLayer.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\MenuTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\MenuTest\MenuTestLayerLoader.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\MenuTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\LabelTest\LabelTestLayer.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\LabelTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\LabelTest\LabelTestLayerLoader.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\LabelTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder\HelloCocosBuilderLayer.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder\HelloCocosBuilderLayerLoader.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\HelloCocosBuilder</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTest\ButtonTestLayer.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ButtonTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\tests\ExtensionsTest\CocosBuilderTest\ButtonTest\ButtonTestLayerLoader.h">
|
||||||
|
<Filter>classes\tests\ExtensionsTest\CocosBuilderTest\ButtonTest</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -9,6 +9,7 @@
|
||||||
#include "../SpriteTest/SpriteTestLayerLoader.h"
|
#include "../SpriteTest/SpriteTestLayerLoader.h"
|
||||||
#include "../MenuTest/MenuTestLayerLoader.h"
|
#include "../MenuTest/MenuTestLayerLoader.h"
|
||||||
#include "../ParticleSystemTest/ParticleSystemTestLayerLoader.h"
|
#include "../ParticleSystemTest/ParticleSystemTestLayerLoader.h"
|
||||||
|
#include "../ScrollViewTest/ScrollViewTestLayerLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
|
@ -101,5 +102,5 @@ void HelloCocosBuilderLayer::onParticleSystemTestClicked(CCObject * pSender, coc
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelloCocosBuilderLayer::onScrollViewTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
|
void HelloCocosBuilderLayer::onScrollViewTestClicked(CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent) {
|
||||||
CCLog("onScrollViewTestClicked\n");
|
this->openTest("ccb/ScrollViewTest.ccbi", "ScrollViewTestLayer", ScrollViewTestLayerLoader::loader());
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _SCROLLVIEWTESTLAYER_H_
|
||||||
|
#define _SCROLLVIEWTESTLAYER_H_
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "extensions/CCBReader/CCBReader.h"
|
||||||
|
|
||||||
|
class ScrollViewTestLayer : public cocos2d::CCLayer {
|
||||||
|
public:
|
||||||
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(ScrollViewTestLayer, node);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef _SCROLLVIEWTESTLAYERLOADER_H_
|
||||||
|
#define _SCROLLVIEWTESTLAYERLOADER_H_
|
||||||
|
|
||||||
|
#include "extensions/CCBReader/CCLayerLoader.h"
|
||||||
|
#include "ScrollViewTestLayer.h"
|
||||||
|
|
||||||
|
/* Forward declaration. */
|
||||||
|
class CCBReader;
|
||||||
|
|
||||||
|
class ScrollViewTestLayerLoader : public cocos2d::extension::CCLayerLoader {
|
||||||
|
public:
|
||||||
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(ScrollViewTestLayerLoader, loader);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(ScrollViewTestLayer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -50,7 +50,7 @@ class CCNode : public CCObject
|
||||||
tolua_property__CCSkewY float skewY;
|
tolua_property__CCSkewY float skewY;
|
||||||
// tolua_property__CCIsVisible bool isVisible;
|
// tolua_property__CCIsVisible bool isVisible;
|
||||||
tolua_property__CCAnchorPoint CCPoint anchorPoint;
|
tolua_property__CCAnchorPoint CCPoint anchorPoint;
|
||||||
tolua_property__CCContentSize CCSize contentSize;
|
// tolua_property__CCContentSize CCSize contentSize;
|
||||||
tolua_property__CCTag int tag;
|
tolua_property__CCTag int tag;
|
||||||
|
|
||||||
CCArray* getChildren();
|
CCArray* getChildren();
|
||||||
|
|
Loading…
Reference in New Issue