cocos2d-x  2.2.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCSpriteFrame Class Reference

A CCSpriteFrame has: More...

#include <CCSpriteFrame.h>

Inheritance diagram for CCSpriteFrame:
CCObject CCCopying

Public Member Functions

const CCRectgetRectInPixels (void)
void setRectInPixels (const CCRect &rectInPixels)
local setRectInPixels ( local rectInPixels)
bool isRotated (void)
void setRotated (bool bRotated)
const CCRectgetRect (void)
 get rect of the frame More...
 
local getRect ()
 get rect of the frame More...
 
void setRect (const CCRect &rect)
 set rect of the frame More...
 
const CCPointgetOffsetInPixels (void)
 get offset of the frame More...
 
local getOffsetInPixels ()
 get offset of the frame More...
 
void setOffsetInPixels (const CCPoint &offsetInPixels)
 set offset of the frame More...
 
const CCSizegetOriginalSizeInPixels (void)
 get original size of the trimmed image More...
 
void setOriginalSizeInPixels (const CCSize &sizeInPixels)
 set original size of the trimmed image More...
 
const CCSizegetOriginalSize (void)
 get original size of the trimmed image More...
 
var getOriginalSize ()
 get original size of the trimmed image More...
 
local getOriginalSize ()
 get original size of the trimmed image More...
 
void setOriginalSize (const CCSize &sizeInPixels)
 set original size of the trimmed image More...
 
local setOriginalSize ( local sizeInPixels)
 set original size of the trimmed image More...
 
CCTexture2DgetTexture (void)
 get texture of the frame More...
 
var getTexture ()
 get texture of the frame More...
 
local getTexture ()
 get texture of the frame More...
 
void setTexture (CCTexture2D *pobTexture)
 set texture of the frame, the texture is retained More...
 
const CCPointgetOffset (void)
local getOffset ()
void setOffset (const CCPoint &offsets)
 ~CCSpriteFrame (void)
virtual CCObjectcopyWithZone (CCZone *pZone)
bool initWithTexture (CCTexture2D *pobTexture, const CCRect &rect)
 Initializes a CCSpriteFrame with a texture, rect in points. More...
 
bool initWithTextureFilename (const char *filename, const CCRect &rect)
 Initializes a CCSpriteFrame with a texture filename, rect in points; It is assumed that the frame was not trimmed. More...
 
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. More...
 
bool initWithTextureFilename (const char *filename, const CCRect &rect, bool rotated, const CCPoint &offset, const CCSize &originalSize)
 Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More...
 
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (void)
bool isSingleReference (void) const
unsigned int retainCount (void) const
virtual bool isEqual (const CCObject *pObject)
virtual void acceptVisitor (CCDataVisitor &visitor)
virtual void update (float dt)

Static Public Member Functions

static CCSpriteFramecreate (const char *filename, const CCRect &rect)
 Create a CCSpriteFrame with a texture filename, rect in points. More...
 
static CCSpriteFramecreate (const char *filename, const CCRect &rect, bool rotated, const CCPoint &offset, const CCSize &originalSize)
 Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. More...
 
var create ( var filename, var rect, var rotated, var offset, var originalSize)
 Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. More...
 
local create ( local filename, local rect, local rotated, local offset, local originalSize)
 Create a CCSpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. More...
 
static CCSpriteFramecreateWithTexture (CCTexture2D *pobTexture, const CCRect &rect)
 Create a CCSpriteFrame with a texture, rect in points. More...
 
static CCSpriteFramecreateWithTexture (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. More...
 
var createWithTexture ( var pobTexture, var rect, var rotated, var offset, var originalSize)
 Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More...
 
local createWithTexture ( local pobTexture, local rect, local rotated, local offset, local originalSize)
 Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More...
 

Protected Attributes

CCPoint m_obOffset
CCSize m_obOriginalSize
var m_obOriginalSize
local m_obOriginalSize
CCRect m_obRectInPixels
bool m_bRotated
CCRect m_obRect
var m_obRect
local m_obRect
CCPoint m_obOffsetInPixels
local m_obOffsetInPixels
CCSize m_obOriginalSizeInPixels
local m_obOriginalSizeInPixels
CCTexture2Dm_pobTexture
var m_pobTexture
local m_pobTexture
std::string m_strTextureFilename
var m_strTextureFilename
local m_strTextureFilename
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Detailed 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);

Constructor & Destructor Documentation

~CCSpriteFrame ( void  )

Member Function Documentation

virtual CCObject* copyWithZone ( CCZone pZone)
virtual

Reimplemented from CCCopying.

static CCSpriteFrame* create ( const char *  filename,
const CCRect rect 
)
static

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

It is assumed that the frame was not trimmed.

var create ( var  filename,
var  rect 
)
static

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

It is assumed that the frame was not trimmed.

local create ( local  filename,
local  rect 
)
static

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,
bool  rotated,
const CCPoint offset,
const CCSize originalSize 
)
static

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.

var create ( var  filename,
var  rect,
var  rotated,
var  offset,
var  originalSize 
)
static

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.

local create ( local  filename,
local  rect,
local  rotated,
local  offset,
local  originalSize 
)
static

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*
createWithTexture
( CCTexture2D pobTexture,
const CCRect rect 
)
static

Create a CCSpriteFrame with a texture, rect in points.

It is assumed that the frame was not trimmed.

var createWithTexture ( var  pobTexture,
var  rect 
)
static

Create a CCSpriteFrame with a texture, rect in points.

It is assumed that the frame was not trimmed.

local createWithTexture ( local  pobTexture,
local  rect 
)
static

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,
bool  rotated,
const CCPoint offset,
const CCSize originalSize 
)
static

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.

var createWithTexture ( var  pobTexture,
var  rect,
var  rotated,
var  offset,
var  originalSize 
)
static

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.

local createWithTexture ( local  pobTexture,
local  rect,
local  rotated,
local  offset,
local  originalSize 
)
static

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.

const CCPoint& getOffset ( void  )
var getOffset (   )
local getOffset (   )
const CCPoint& getOffsetInPixels ( void  )

get offset of the frame

var getOffsetInPixels (   )

get offset of the frame

local getOffsetInPixels (   )

get offset of the frame

const CCSize& getOriginalSize ( void  )
inline

get original size of the trimmed image

var getOriginalSize (   )
inline

get original size of the trimmed image

local getOriginalSize (   )
inline

get original size of the trimmed image

const CCSize&
getOriginalSizeInPixels
( void  )
inline

get original size of the trimmed image

var getOriginalSizeInPixels (   )
inline

get original size of the trimmed image

local getOriginalSizeInPixels (   )
inline

get original size of the trimmed image

const CCRect& getRect ( void  )
inline

get rect of the frame

var getRect (   )
inline

get rect of the frame

local getRect (   )
inline

get rect of the frame

const CCRect& getRectInPixels ( void  )
inline
var getRectInPixels (   )
inline
local getRectInPixels (   )
inline
CCTexture2D* getTexture ( void  )

get texture of the frame

var getTexture (   )

get texture of the frame

local getTexture (   )

get texture of the frame

bool initWithTexture ( CCTexture2D pobTexture,
const CCRect rect 
)

Initializes a CCSpriteFrame with a texture, rect in points.

It is assumed that the frame was not trimmed.

var initWithTexture ( var  pobTexture,
var  rect 
)

Initializes a CCSpriteFrame with a texture, rect in points.

It is assumed that the frame was not trimmed.

local initWithTexture ( local  pobTexture,
local  rect 
)

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,
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 points of the frame before being trimmed.

var initWithTexture ( var  pobTexture,
var  rect,
var  rotated,
var  offset,
var  originalSize 
)

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.

local initWithTexture ( local  pobTexture,
local  rect,
local  rotated,
local  offset,
local  originalSize 
)

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 initWithTextureFilename ( const char *  filename,
const CCRect rect 
)

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

var initWithTextureFilename ( var  filename,
var  rect 
)

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

local initWithTextureFilename ( local  filename,
local  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,
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
var initWithTextureFilename ( var  filename,
var  rect,
var  rotated,
var  offset,
var  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
local initWithTextureFilename ( local  filename,
local  rect,
local  rotated,
local  offset,
local  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 isRotated ( void  )
inline
var isRotated (   )
inline
local isRotated (   )
inline
void setOffset ( const CCPoint offsets)
var setOffset ( var  offsets)
local setOffset ( local  offsets)
void setOffsetInPixels ( const CCPoint offsetInPixels)

set offset of the frame

var setOffsetInPixels ( var  offsetInPixels)

set offset of the frame

local setOffsetInPixels ( local  offsetInPixels)

set offset of the frame

void setOriginalSize ( const CCSize sizeInPixels)
inline

set original size of the trimmed image

var setOriginalSize ( var  sizeInPixels)
inline

set original size of the trimmed image

local setOriginalSize ( local  sizeInPixels)
inline

set original size of the trimmed image

void setOriginalSizeInPixels ( const CCSize sizeInPixels)
inline

set original size of the trimmed image

var setOriginalSizeInPixels ( var  sizeInPixels)
inline

set original size of the trimmed image

local setOriginalSizeInPixels ( local  sizeInPixels)
inline

set original size of the trimmed image

void setRect ( const CCRect rect)

set rect of the frame

var setRect ( var  rect)

set rect of the frame

local setRect ( local  rect)

set rect of the frame

void setRectInPixels ( const CCRect rectInPixels)
var setRectInPixels ( var  rectInPixels)
local setRectInPixels ( local  rectInPixels)
void setRotated ( bool  bRotated)
inline
var setRotated ( var  bRotated)
inline
local setRotated ( local  bRotated)
inline
void setTexture ( CCTexture2D pobTexture)

set texture of the frame, the texture is retained

var setTexture ( var  pobTexture)

set texture of the frame, the texture is retained

local setTexture ( local  pobTexture)

set texture of the frame, the texture is retained

Member Data Documentation

bool m_bRotated
protected
var m_bRotated
protected
local m_bRotated
protected
CCPoint m_obOffset
protected
CCPoint m_obOffsetInPixels
protected
var m_obOffsetInPixels
protected
local m_obOffsetInPixels
protected
CCSize m_obOriginalSize
protected
var m_obOriginalSize
protected
local m_obOriginalSize
protected
CCSize m_obOriginalSizeInPixels
protected
var m_obOriginalSizeInPixels
protected
local m_obOriginalSizeInPixels
protected
CCRect m_obRect
protected
var m_obRect
protected
local m_obRect
protected
CCRect m_obRectInPixels
protected
var m_obRectInPixels
protected
local m_obRectInPixels
protected
CCTexture2D* m_pobTexture
protected
var m_pobTexture
protected
local m_pobTexture
protected
std::string m_strTextureFilename
protected
var m_strTextureFilename
protected
local m_strTextureFilename
protected

The documentation for this class was generated from the following file: