From 37915cfed6e5fa2a0b3ce44a3d4cc69b172b9a13 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 28 Dec 2011 14:46:49 +0800 Subject: [PATCH] remove unneeded function, and make protocol an abstract class --- cocos2dx/include/CCAtlasNode.h | 2 -- cocos2dx/include/CCLabelBMFont.h | 3 +-- cocos2dx/include/CCLayer.h | 3 ++- cocos2dx/include/CCMenu.h | 3 ++- cocos2dx/include/CCMenuItem.h | 9 ++++++--- cocos2dx/include/CCObject.h | 4 ++-- cocos2dx/include/CCProtocols.h | 6 +++--- cocos2dx/include/CCSprite.h | 2 -- cocos2dx/platform/CCPlatformMacros.h | 8 ++++---- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cocos2dx/include/CCAtlasNode.h b/cocos2dx/include/CCAtlasNode.h index 3f6982d637..aca04144cf 100755 --- a/cocos2dx/include/CCAtlasNode.h +++ b/cocos2dx/include/CCAtlasNode.h @@ -88,8 +88,6 @@ public: virtual void draw(); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } - // CC Texture protocol /** returns the used texture*/ diff --git a/cocos2dx/include/CCLabelBMFont.h b/cocos2dx/include/CCLabelBMFont.h index 847a825324..9e730de79a 100755 --- a/cocos2dx/include/CCLabelBMFont.h +++ b/cocos2dx/include/CCLabelBMFont.h @@ -180,8 +180,7 @@ namespace cocos2d{ virtual const char* getString(void); virtual void setCString(const char *label); virtual void setAnchorPoint(const CCPoint& var); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } - virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; } + #if CC_LABELBMFONT_DEBUG_DRAW virtual void draw(); #endif // CC_LABELBMFONT_DEBUG_DRAW diff --git a/cocos2dx/include/CCLayer.h b/cocos2dx/include/CCLayer.h index 5adcaf0028..7b01f2d77b 100755 --- a/cocos2dx/include/CCLayer.h +++ b/cocos2dx/include/CCLayer.h @@ -182,7 +182,8 @@ public: /** BlendFunction. Conforms to CCBlendProtocol protocol */ CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc) - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } + virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} + virtual bool getIsOpacityModifyRGB(void) { return false;} LAYER_NODE_FUNC(CCLayerColor); protected: diff --git a/cocos2dx/include/CCMenu.h b/cocos2dx/include/CCMenu.h index ddb0104301..c1b2ba6bea 100755 --- a/cocos2dx/include/CCMenu.h +++ b/cocos2dx/include/CCMenu.h @@ -118,7 +118,8 @@ namespace cocos2d{ */ virtual void onExit(); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } + virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} + virtual bool getIsOpacityModifyRGB(void) { return false;} protected: CCMenuItem* itemForTouch(CCTouch * touch); diff --git a/cocos2dx/include/CCMenuItem.h b/cocos2dx/include/CCMenuItem.h index 5842afabd5..20d558ce35 100755 --- a/cocos2dx/include/CCMenuItem.h +++ b/cocos2dx/include/CCMenuItem.h @@ -124,7 +124,8 @@ namespace cocos2d{ virtual void setColor(const ccColor3B& color); virtual const ccColor3B& getColor(); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } + virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} + virtual bool getIsOpacityModifyRGB(void) { return false;} protected: ccColor3B m_tColorBackup; float m_fOriginalScale; @@ -236,7 +237,8 @@ namespace cocos2d{ virtual void unselected(); virtual void setIsEnabled(bool bEnabled); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } + virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} + virtual bool getIsOpacityModifyRGB(void) { return false;} }; /** @brief CCMenuItemImage accepts images as items. @@ -308,7 +310,8 @@ namespace cocos2d{ virtual void unselected(); virtual void setIsEnabled(bool var); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol*)this; } + virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} + virtual bool getIsOpacityModifyRGB(void) { return false;} }; } diff --git a/cocos2dx/include/CCObject.h b/cocos2dx/include/CCObject.h index 9029c57992..15d7fc3b35 100755 --- a/cocos2dx/include/CCObject.h +++ b/cocos2dx/include/CCObject.h @@ -52,8 +52,8 @@ public: CCObject(void); virtual ~CCObject(void); - virtual void release(void); - virtual void retain(void); + void release(void); + void retain(void); CCObject* autorelease(void); CCObject* copy(void); bool isSingleRefrence(void); diff --git a/cocos2dx/include/CCProtocols.h b/cocos2dx/include/CCProtocols.h index 4a8aa0d4db..742b7efaf1 100755 --- a/cocos2dx/include/CCProtocols.h +++ b/cocos2dx/include/CCProtocols.h @@ -63,12 +63,12 @@ public: Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO @since v0.8 */ - virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} + virtual void setIsOpacityModifyRGB(bool bValue) = 0; /** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity); @since v0.8 */ - virtual bool getIsOpacityModifyRGB(void) { return false;} + virtual bool getIsOpacityModifyRGB(void) = 0; }; /** @@ -101,7 +101,7 @@ public: virtual CCTexture2D* getTexture(void) = 0; // sets a new texture. it will be retained - virtual void setTexture(CCTexture2D *texture) {CC_UNUSED_PARAM(texture);} + virtual void setTexture(CCTexture2D *texture) = 0; }; //! @brief Common interface for Labels diff --git a/cocos2dx/include/CCSprite.h b/cocos2dx/include/CCSprite.h index 33cb714c85..249084d040 100755 --- a/cocos2dx/include/CCSprite.h +++ b/cocos2dx/include/CCSprite.h @@ -246,8 +246,6 @@ public: virtual void setIsOpacityModifyRGB(bool bValue); virtual bool getIsOpacityModifyRGB(void); - virtual CCRGBAProtocol* convertToRGBAProtocol() { return (CCRGBAProtocol *)this; } - // CCTextureProtocol virtual void setTexture(CCTexture2D *texture); virtual CCTexture2D* getTexture(void); diff --git a/cocos2dx/platform/CCPlatformMacros.h b/cocos2dx/platform/CCPlatformMacros.h index 580caf51d8..81c34faf91 100644 --- a/cocos2dx/platform/CCPlatformMacros.h +++ b/cocos2dx/platform/CCPlatformMacros.h @@ -82,13 +82,13 @@ public: virtual const varType& get##funName(void); */ #define CC_PROPERTY(varType, varName, funName)\ protected: varType varName;\ -public: virtual varType get##funName(void);\ -public: virtual void set##funName(varType var); +public: varType get##funName(void);\ +public: void set##funName(varType var); #define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\ protected: varType varName;\ -public: virtual const varType& get##funName(void);\ -public: virtual void set##funName(const varType& var); +public: const varType& get##funName(void);\ +public: void set##funName(const varType& var); /** CC_SYNTHESIZE_READONLY is used to declare a protected variable. We can use getter to read the variable.