cocos2d-x 动画详解之三CCSpriteFrame
来源:互联网 发布:知乎日报瞎扯 编辑:程序博客网 时间:2024/05/01 23:02
CCSpriteFrame
精灵帧
CCTexture2D 将被用于CCSprite
默认的构造方法
通过 图片纹理+纹理上的矩形来创建
或通过 图片纹理+纹理上的矩形+是否旋转+偏移坐标+真实size
这里简单讲下
是否旋转
为了节省图片空间 图片将会被旋转90度
偏移坐标+真实size
为了节省图片空间 原始图片周围透明区域将被trim
Public Member Functions
const CCRect & getRectInPixels (void)void setRectInPixels (const CCRect &rectInPixels)bool isRotated (void)void setRotated (bool bRotated)const CCRect & getRect (void) get rect of the frame void setRect (const CCRect &rect) set rect of the frame const CCPoint & getOffsetInPixels (void) get offset of the frame void setOffsetInPixels (const CCPoint &offsetInPixels) set offset of the frame const CCSize & getOriginalSizeInPixels (void) get original size of the trimmed image void setOriginalSizeInPixels (const CCSize &sizeInPixels) set original size of the trimmed image CCTexture2D * getTexture (void) get texture of the frame void setTexture (CCTexture2D *pobTexture) 设置图片纹理 set texture of the frame, the texture is retained ~CCSpriteFrame (void)virtual CCObject * copyWithZone (CCZone *pZone)bool initWithTexture (CCTexture2D *pobTexture, const CCRect &rect) Initializes a CCSpriteFrame with a texture, rect in points. bool initWithTexture (CCTexture2D *pobTexture, const CCRect &rect, bool rotated, const CCPoint &offset, const CCSize &originalSize) Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.Static Public Member Functions
static CCSpriteFrame * frameWithTexture (CCTexture2D *pobTexture, const CCRect &rect) Create a CCSpriteFrame with a texture, rect in points. static CCSpriteFrame * frameWithTexture (CCTexture2D *pobTexture, const CCRect &rect, bool rotated, const CCPoint &offset, const CCSize &originalSize) Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.Protected Attributes
CCRect m_obRectInPixelsbool m_bRotatedCCRect m_obRectCCPoint m_obOffsetInPixelsCCSize m_obOriginalSizeInPixelsCCTexture2D * m_pobTextureDetailed Description
A CCSpriteFrame has:
- texture: A CCTexture2D that will be used by the CCSprite
- rectangle: A rectangle of the texture
You can modify the frame of a CCSprite by doing:
CCSpriteFrame *frame = CCSpriteFrame::frameWithTexture(texture, rect, offset); sprite->setDisplayFrame(frame);
- cocos2d-x 动画详解之三CCSpriteFrame
- cocos2d-x基础(三)CCSpriteFrameCache,CCSpriteFrame
- cocos2d-x 动画详解之二CCSpriteBatchNode
- cocos2d-x 动画详解之四-CCSpriteFrameCache
- cocos2d-X 节点(CCSpriteFrame.h..)API
- cocos2D-x关于CCSpriteFrame的cpp实现
- cocos2d-x 动画详解之六 动画思路整理
- cocos2d-x 骨骼动画详解
- Cocos2d-x游戏开发之骨骼动画详解-Spine
- Cocos2d-x游戏开发之骨骼动画详解-Spine
- Cocos2d-x游戏开发之骨骼动画详解-Spine
- cocos2d-x 2.0通过CCAnimation实例获取CCSpriteFrame
- cocos2d-x 2.0通过CCAnimation实例获取CCSpriteFrame
- cocos2d-x 2.0通过CCAnimation实例获取CCSpriteFrame
- cocos2d-x学习 之 动画
- cocos2d-x 动画之SWF
- Cocos2d-x学习笔记三之飞机游戏详解
- cocos2d-x 3.x之动画
- 去掉chrome 浏览器 input textarea 获取焦点后边框
- cocos2d-x 动画详解之二CCSpriteBatchNode
- 如何掌握并在实践总应用设计模式
- string.xml中%1$d、%1$s等用法
- 来自极客标签10款最新设计素材-系列五
- cocos2d-x 动画详解之三CCSpriteFrame
- cocos2d-x 动画详解之四-CCSpriteFrameCache
- 杭电2051
- cocos2d-x 动画详解之六 动画思路整理
- Tomcat7 SSI配置
- [JAVA]Swing、事件监听、文件的初级综合。简易图片浏览器,逸雨清风XIUXIU。
- jbpm的下载安装与使用教程
- 关于印发国家测绘地理信息局2013年立法工作计划的通知
- DTD教程