x结构学习(十六)CCLayerColor、CCProgressTimer、CCProgressTo

1、CCLayerColor:继承自CCLayerRGBA和CCBlendProtocol,可能继承自CCGLBufferedNode,这些属性和方法和前面的都差不多,浏览一下就知晓

class CC_DLL CCLayerColor : public CCLayerRGBA, public CCBlendProtocol#ifdef EMSCRIPTEN, public CCGLBufferedNode#endif{protected:ccVertex2F m_pSquareVertices[4];ccColor4F m_pSquareColors[4];public:CCLayerColor();virtual ~CCLayerColor();virtual void draw();virtual void setContentSize(const CCSize & var);static CCLayerColor* create();static CCLayerColor * create(const ccColor4B& color, GLfloat width, GLfloat height);static CCLayerColor * create(const ccColor4B& color);virtual bool init();virtual bool initWithColor(const ccColor4B& color, GLfloat width, GLfloat height);virtual bool initWithColor(const ccColor4B& color);void changeWidth(GLfloat w);void changeHeight(GLfloat h);void changeWidthAndHeight(GLfloat w ,GLfloat h);CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)virtual void setColor(const ccColor3B &color);virtual void setOpacity(GLubyte opacity);protected:virtual void updateColor();};2、CCProgressTimer:时间进度类,继承自CCNodeRGBA,可能继承自CCGLBufferedNodeclass CC_DLL CCProgressTimer : public CCNodeRGBA#ifdef EMSCRIPTEN, public CCGLBufferedNode#endif{public:CCProgressTimer();~CCProgressTimer(void);inline CCProgressTimerType getType(void) { return m_eType; } //获得类型inline float getPercentage(void) {return m_fPercentage; }//获得百分比inline CCSprite* getSprite(void) { return m_pSprite; }bool initWithSprite(CCSprite* sp);void setPercentage(float fPercentage); //几个设置函数void setSprite(CCSprite *pSprite);void setType(CCProgressTimerType type);void setReverseProgress(bool reverse);virtual void draw(void);void setAnchorPoint(CCPoint anchorPoint);virtual void setColor(const ccColor3B& color);virtual const ccColor3B& getColor() const;virtual GLubyte getOpacity() const;virtual void setOpacity(GLubyte opacity);inline bool isReverseDirection() { return m_bReverseDirection; };inline void setReverseDirection(bool value) { m_bReverseDirection = value; };public:static CCProgressTimer* create(CCSprite* sp);protected:ccTex2F textureCoordFromAlphaPoint(CCPoint alpha);ccVertex2F vertexFromAlphaPoint(CCPoint alpha);void updateProgress(void);void updateBar(void);void updateRadial(void);void updateColor(void);CCPoint boundaryTexCoord(char index);protected:CCProgressTimerType m_eType;float m_fPercentage;CCSprite *m_pSprite;int m_nVertexDataCount;ccV2F_C4B_T2F *m_pVertexData;CC_PROPERTY(CCPoint, m_tMidpoint, Midpoint);CC_SYNTHESIZE(CCPoint, m_tBarChangeRate, BarChangeRate);bool m_bReverseDirection;};3、CCProgressTo:继承自CCActionIntervalclass CC_DLL CCProgressTo : public CCActionInterval{public:bool initWithDuration(float duration, float fPercent);virtual CCObject* copyWithZone(CCZone *pZone);virtual void startWithTarget(CCNode *pTarget);virtual void update(float time);public:static CCProgressTo* create(float duration, float fPercent);protected:float m_fTo;float m_fFrom;};4、CCSet:集合类,,继承自CCObjectclass CC_DLL CCSet : public CCObject{public:CCSet(void);CCSet(const CCSet &rSetObject);virtual ~CCSet(void);static CCSet * create();CCSet* copy();CCSet* mutableCopy();int count();//返回集合里有多少个元素void addObject(CCObject *pObject);//添加和移除void removeObject(CCObject *pObject);void removeAllObjects();bool containsObject(CCObject *pObject);CCSetIterator begin();CCSetIterator end();CCObject* anyObject();virtual void acceptVisitor(CCDataVisitor &visitor);private:std::set<CCObject *> *m_pSet;};

别让别人徘徊的脚步踩碎你明天美好的梦想,

x结构学习(十六)CCLayerColor、CCProgressTimer、CCProgressTo

相关文章:

你感兴趣的文章:

标签云: