COCos2d-X 节点(CCAtlasNode.h)API
2013-12-09 10:40
190 查看
本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
COCos2d-X 节点(CCAtlasNode.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记///cocos2d-x-3.0alpha0/cocos2dx/base_nodes #ifndef __CCATLAS_NODE_H__ #define __CCATLAS_NODE_H__ #include "CCNode.h" #include "CCProtocols.h" #include "ccTypes.h" NS_CC_BEGIN /** * @addtogroup base_nodes * @{ */ class TextureAtlas; /** @brief AtlasNode 是 Node 的子类,实现了 RGBAProtocol 、 TextureProtocol 协议 他知道如何 render(呈现)一个 TextureAtlas 对象. 如果你要 render(呈现)一个 AtlasNode 的子类 TextureAtlas (or AtlasNode 的子类) 从节点的所有功能都有效,再加上以下功能: - opacity and RGB colors //不透明度和RGB颜色 */ class CC_DLL AtlasNode : public NodeRGBA, public TextureProtocol { public: /** 使用 一个 Atlas 文件,每个 item(组成Atlas 的 tile(瓷砖)) 的宽度、高度 要显示的 items 数量 创建一个 AtlasNode */ static AtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender); /** * @js ctor */ AtlasNode(); /** * @js NA * @lua NA */ virtual ~AtlasNode(); /** 使用 一个 Atlas 文件,每个 item(组成Atlas 的 tile(瓷砖)) 的宽度、高度 要显示的 items 数量 初始化一个 AtlasNode */ bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender); /** 使用 texture,每个 item(组成Atlas 的 tile(瓷砖)) 的宽度、高度 要显示的 items 数量 初始化一个 AtlasNode */ bool initWithTexture(Texture2D* texture, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender); /**更新 Atlas(地图集) (indexed vertex array). //索引顶点数组 * 应在子类中重写 */ virtual void updateAtlasValues(); void setTextureAtlas(TextureAtlas* textureAtlas); TextureAtlas* getTextureAtlas() const; void setQuadsToDraw(unsigned int quadsToDraw); unsigned int getQuadsToDraw() const; // Overrides(覆盖) virtual void draw() override; virtual Texture2D* getTexture() const override; virtual void setTexture(Texture2D *texture) override; virtual bool isOpacityModifyRGB() const override; virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override; virtual const Color3B& getColor(void) const override; virtual void setColor(const Color3B& color) override; virtual void setOpacity(GLubyte opacity) override; /** * @code * 这个功能绑定在 js or lua 时参数将改变 * In js: var setBlendFunc(var src, var dst) * @endcode * @lua NA */ virtual void setBlendFunc(const BlendFunc& blendFunc) override; /** * @js NA * @lua NA */ virtual const BlendFunc& getBlendFunc() const override; private : void calculateMaxItems(); void updateBlendFunc(); void updateOpacityModifyRGB(); friend class Director; void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor); protected: //! 每行字符 unsigned int _itemsPerRow; //! 每列的字符 unsigned int _itemsPerColumn; //! 每个字符的宽度 unsigned int _itemWidth; //! 每个字符的高度 unsigned int _itemHeight; Color3B _colorUnmodified; TextureAtlas* _textureAtlas; // 协议变量 bool _isOpacityModifyRGB; BlendFunc _blendFunc; // 绘制的四边形 unsigned int _quadsToDraw; // 颜色均匀 GLint _uniformColor; // 这仅用于显示 LabelAtlas FPS . 所以我希望大家不要修改它的值. bool _ignoreContentScaleFactor; }; // end of base_node group /// @} NS_CC_END #endif // __CCATLAS_NODE_H__
相关文章推荐
- cocos2d-X 节点(SpriteBatchNode.h.)API
- COcos2d-X 节点(CCGLBufferedNode.h)API
- cocos2d-x节点(CCParallaxNode.h)API
- cocos2d-X 节点(CCNode.h)API
- cocos2d-X 节点(CCActionNode.h)API
- cocos2d-x节点(CCParticleBatchNode.h)API
- cocos2d-x节点(CCClippingNode.h)API
- cocos2d-X 节点(UIWidget.h)API
- cocos2d-X 节点(UISlider.h)API
- cocos2d-x之Node移除HelloWorld节点
- cocos2d-x节点(b2GearJoint.h)API
- cocos2d-x节点(b2Distance.h)API
- cocos2d-x节点(CCIMEDispatcher.h)API
- cocos2d-x节点(CCParticleSystemQuad.h)API
- cocos2d-x节点(CCRenderTexture.h)API
- cocos2d-x节点(CCEvent.h)API
- cocos2d-x节点(cocos2d.h)API
- cocos2d-x节点(CCNS.h)API
- cocos2d-x节点(CCActionPageTurn3D)API
- Cocos2d-x 3.0final 终结者系列教程08-绘图节点Node中的锚点和坐标系