CCSpriteFrame(setDisplayFrame(frame)成员m_obOffset m_obOriginalSize m_bRotated m_obRect m_pobTexture)
来源:互联网 发布:c语言\n什么意思 编辑:程序博客网 时间:2024/05/22 01:47
#ifndef __SPRITE_CCSPRITE_FRAME_H__
#define __SPRITE_CCSPRITE_FRAME_H__
#include "base_nodes/CCNode.h"
#include "CCProtocols.h"
#include "cocoa/CCObject.h"
#include "cocoa/CCGeometry.h"
NS_CC_BEGIN
class CCTexture2D;
class CCZone;
/** @brief 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);
*/
class CC_DLL CCSpriteFrame : public CCObject
{
public:
// attributes
//精灵帧的矩形大小,分别用点值和像素值来表示
inline const CCRect& getRectInPixels(void) { return m_obRectInPixels; }
void setRectInPixels(const CCRect& rectInPixels);
{
m_obRectInPixels = rectInPixels;
m_obRect = CC_RECT_PIXELS_TO_POINTS(rectInPixels);
}
//精灵帧的矩形框是否发生旋转
inline bool isRotated(void) { return m_bRotated; }
inline void setRotated(bool bRotated) { m_bRotated = bRotated; }
/** get rect of the frame */
inline const CCRect& getRect(void) { return m_obRect; }
/** set rect of the frame */
void setRect(const CCRect& rect);
{
m_obRect = rect;
m_obRectInPixels = CC_RECT_POINTS_TO_PIXELS(m_obRect);
}
//精灵帧的位置偏移(以像素值计算)
const CCPoint& getOffsetInPixels(void);
/** set offset of the frame */
void setOffsetInPixels(const CCPoint& offsetInPixels);
//修剪后图片的原始大小(以像素值计算)
inline const CCSize& getOriginalSizeInPixels(void) { return m_obOriginalSizeInPixels; }
/** set original size of the trimmed image */
inline void setOriginalSizeInPixels(const CCSize& sizeInPixels) { m_obOriginalSizeInPixels = sizeInPixels; }
/** get original size of the trimmed image */
inline const CCSize& getOriginalSize(void) { return m_obOriginalSize; }
/** set original size of the trimmed image */
inline void setOriginalSize(const CCSize& sizeInPixels) { m_obOriginalSize = sizeInPixels; }
/** get texture of the frame */
CCTexture2D* getTexture(void);
/** set texture of the frame, the texture is retained */
void setTexture(CCTexture2D* pobTexture);
const CCPoint& getOffset(void);
void setOffset(const CCPoint& offsets);
public:
~CCSpriteFrame(void);
virtual CCObject* copyWithZone(CCZone *pZone);
/** Create a CCSpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* create(const char* filename, const CCRect& rect);
/** Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
*/
static CCSpriteFrame* create(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
/** Create a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
static CCSpriteFrame* createWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
static CCSpriteFrame* createWithTexture(CCTexture2D* pobTexture, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
public:
/** Initializes a CCSpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
*/
bool initWithTexture(CCTexture2D* pobTexture, const CCRect& rect);
/** Initializes a CCSpriteFrame with a texture filename, rect in points;
It is assumed that the frame was not trimmed.
*/
bool initWithTextureFilename(const char* filename, const CCRect& rect);
/** Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in points of the frame before being trimmed.
*/
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.
The originalSize is the size in pixels of the frame before being trimmed.
@since v1.1
*/
bool initWithTextureFilename(const char* filename, const CCRect& rect, bool rotated, const CCPoint& offset, const CCSize& originalSize);
protected:
CCPoint m_obOffset;
CCSize m_obOriginalSize;
CCRect m_obRectInPixels;
bool m_bRotated;
CCRect m_obRect;
CCPoint m_obOffsetInPixels;
CCSize m_obOriginalSizeInPixels;
CCTexture2D *m_pobTexture;
std::string m_strTextureFilename;
};
// end of sprite_nodes group
/// @}
NS_CC_END
#endif //__SPRITE_CCSPRITE_FRAME_H__
- CCSpriteFrame(setDisplayFrame(frame)成员m_obOffset m_obOriginalSize m_bRotated m_obRect m_pobTexture)
- CCSpriteFrame解析
- CCSpriteFrame 、CCAnimation 的使用
- cocos2dx--CCSprite,CCSpriteFrame,CCTexture,CCSpriteBatchNode
- Frameset中各个Frame间访问成员方法
- frame
- frame
- frame
- Frame
- Frame
- frame
- Frame
- frame
- frame
- Frame
- frame,
- cocos2d-x 动画详解之三CCSpriteFrame
- cocos2d-X 节点(CCSpriteFrame.h..)API
- windows下配置 qt&creator&mingw 环境
- LSTM中的推导(LATEX写的)
- Robotium中文api(一)By类
- tomcat访问日志设置
- 分布式文件系统FastDFS设计原理
- CCSpriteFrame(setDisplayFrame(frame)成员m_obOffset m_obOriginalSize m_bRotated m_obRect m_pobTexture)
- OCP 1Z0 051 73
- 《大话设计模式》—— 读后感(27)其实你不懂老板的心——解释器模式
- java虚拟机
- sqlalchemy Support for the MySQL database
- POSIX线程(1)
- c++构造函数学习总结(基本用法)
- 查看当前使用的spfile还是pfile
- 23种设计模式--3行为模式