cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
Public 成员函数 - 图1 Public 成员函数 - 图2)
- 类列表 - 类索引 - 类继承关系 - 类成员

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

Public 成员函数 | 静态 Public 成员函数 | Protected 属性 | 所有成员列表

SpriteFrame类 参考 Sprite Nodes

A SpriteFrame has: 更多…

#include

类 SpriteFrame 继承关系图:

Public 成员函数 - 图3 Ref Clonable

## Public 成员函数
virtual ~SpriteFrame (void)
NA NA 更多…
bool initWithTexture (Texture2D pobTexture, const Rect &rect)
Initializes a SpriteFrame with a texture, rect in points. 更多…
bool initWithTextureFilename (const std::string &filename, const Rect &rect)
Initializes a SpriteFrame with a texture filename, rect in points; It is assumed that the frame was not trimmed. 更多…
bool initWithTexture (Texture2D pobTexture, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize)
Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. 更多…
bool initWithTextureFilename (const std::string &filename, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize)
Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. 更多…
const Rect & getRectInPixels () const
void setRectInPixels (const Rect &rectInPixels)
bool isRotated (void) const
void setRotated (bool rotated)
const Rect & getRect (void) const
get rect of the frame 更多…
void setRect (const Rect &rect)
set rect of the frame 更多…
const Vec2 & getOffsetInPixels (void) const
get offset of the frame 更多…
void setOffsetInPixels (const Vec2 &offsetInPixels)
set offset of the frame 更多…
const Size & getOriginalSizeInPixels (void) const
get original size of the trimmed image 更多…
void setOriginalSizeInPixels (const Size &sizeInPixels)
set original size of the trimmed image 更多…
const Size & getOriginalSize (void) const
get original size of the trimmed image 更多…
void setOriginalSize (const Size &sizeInPixels)
set original size of the trimmed image 更多…
Texture2D getTexture (void)
get texture of the frame 更多…
void setTexture (Texture2D pobTexture)
set texture of the frame, the texture is retained 更多…
const Vec2 & getOffset (void) const
void setOffset (const Vec2 &offsets)
virtual SpriteFrame clone () const override
返回Ref对象的一份拷贝 更多…
- Public 成员函数 继承自 Ref
void retain ()
保留所有权. 更多…
void release ()
立即释放所有权. 更多…
Ref autorelease ()
自动释放所有权在不久的将来. 更多…
unsigned int getReferenceCount () const
返回Ref对象当前的引用计数. 更多…
virtual ~Ref ()
NA NA 更多…
- Public 成员函数 继承自 Clonable
virtual ~Clonable ()
NA NA 更多…
CC_DEPRECATED_ATTRIBUTE Ref * copy () const
返回Ref对象的一份拷贝. 更多…
## 静态 Public 成员函数
static SpriteFrame create (const std::string &filename, const Rect &rect)
Create a SpriteFrame with a texture filename, rect in points. 更多…
static SpriteFrame create (const std::string &filename, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize)
Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. 更多…
static SpriteFrame createWithTexture (Texture2D pobTexture, const Rect &rect)
Create a SpriteFrame with a texture, rect in points. 更多…
static SpriteFrame createWithTexture (Texture2D pobTexture, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize)
Create a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. 更多…
## Protected 属性
Vec2 _offset
Size _originalSize
Rect _rectInPixels
bool _rotated
Rect _rect
Vec2 _offsetInPixels
Size _originalSizeInPixels
Texture2D * _texture
std::string _textureFilename
- Protected 属性 继承自 Ref
unsigned int _referenceCount
引用计数 更多…
## 额外继承的成员函数
- Protected 成员函数 继承自 Ref
Ref ()
构造函数 更多…

详细描述

A SpriteFrame has:

  • texture: A Texture2D that will be used by the Sprite
  • rectangle: A rectangle of the texture

You can modify the frame of a Sprite by doing:

SpriteFrame *frame = SpriteFrame::frameWithTexture(texture, rect, offset); sprite->setDisplayFrame(frame);

构造及析构函数说明

virtual ~SpriteFrame ( void )

virtual

NA NA

成员函数说明

virtual SpriteFrame* clone ( ) const

overridevirtual

返回Ref对象的一份拷贝

实现了 Clonable.

static SpriteFrame* create ( const std::string & filename,
const Rect & rect
)

static

Create a SpriteFrame with a texture filename, rect in points.

It is assumed that the frame was not trimmed.

static SpriteFrame* create ( const std::string & filename,
const Rect & rect,
bool rotated,
const Vec2 & offset,
const Size & originalSize
)

static

Create a SpriteFrame 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 SpriteFrame createWithTexture ( Texture2D pobTexture,
const Rect & rect
)

static

Create a SpriteFrame with a texture, rect in points.

It is assumed that the frame was not trimmed.

static SpriteFrame createWithTexture ( Texture2D pobTexture,
const Rect & rect,
bool rotated,
const Vec2 & offset,
const Size & originalSize
)

static

Create a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.

The originalSize is the size in points of the frame before being trimmed.

const Vec2& getOffset ( void ) const

const Vec2& getOffsetInPixels ( void ) const

get offset of the frame

const Size& getOriginalSize ( void ) const

inline

get original size of the trimmed image

const Size& getOriginalSizeInPixels ( void ) const

inline

get original size of the trimmed image

const Rect& getRect ( void ) const

inline

get rect of the frame

const Rect& getRectInPixels ( ) const

inline

Texture2D* getTexture ( void )

get texture of the frame

bool initWithTexture ( Texture2D * pobTexture,
const Rect & rect
)

Initializes a SpriteFrame with a texture, rect in points.

It is assumed that the frame was not trimmed.

bool initWithTexture ( Texture2D * pobTexture,
const Rect & rect,
bool rotated,
const Vec2 & offset,
const Size & originalSize
)

Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.

The originalSize is the size in points of the frame before being trimmed.

bool initWithTextureFilename ( const std::string & filename,
const Rect & rect
)

Initializes a SpriteFrame with a texture filename, rect in points; It is assumed that the frame was not trimmed.

bool initWithTextureFilename ( const std::string & filename,
const Rect & rect,
bool rotated,
const Vec2 & offset,
const Size & originalSize
)

Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.

The originalSize is the size in pixels of the frame before being trimmed.

  • 自从
  • v1.1

bool isRotated ( void ) const

inline

void setOffset ( const Vec2 & offsets)

void setOffsetInPixels ( const Vec2 & offsetInPixels)

set offset of the frame

void setOriginalSize ( const Size & sizeInPixels)

inline

set original size of the trimmed image

void setOriginalSizeInPixels ( const Size & sizeInPixels)

inline

set original size of the trimmed image

void setRect ( const Rect & rect)

set rect of the frame

void setRectInPixels ( const Rect & rectInPixels)

void setRotated ( bool rotated)

inline

void setTexture ( Texture2D * pobTexture)

set texture of the frame, the texture is retained

类成员变量说明

Vec2 _offset

protected

Vec2 _offsetInPixels

protected

Size _originalSize

protected

Size _originalSizeInPixels

protected

Rect _rect

protected

Rect _rectInPixels

protected

bool _rotated

protected

Texture2D* _texture

protected

std::string _textureFilename

protected


该类的文档由以下文件生成:

  • cocos2d
  • SpriteFrame
  • 生成于 2014年 五月 29日 星期四 09:41:50 , 为 cocos2d-x使用 doxygen 1.8.6