Inherits from NSObject
Conforms to NSCopying
Declared in CCSpriteFrame.h

Overview

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:rect offset:offset];
[sprite setDisplayFrame:frame];

Tasks

Other Methods

Other Methods

Properties

offset

offset of the frame in points

@property (nonatomic, readwrite) CGPoint offset

Declared In

CCSpriteFrame.h

offsetInPixels

offset of the frame in pixels

@property (nonatomic, readwrite) CGPoint offsetInPixels

Declared In

CCSpriteFrame.h

originalSize

original size of the trimmed image in points

@property (nonatomic, readwrite) CGSize originalSize

Declared In

CCSpriteFrame.h

originalSizeInPixels

original size of the trimmed image in pixels

@property (nonatomic, readwrite) CGSize originalSizeInPixels

Declared In

CCSpriteFrame.h

rect

rect of the frame in points. If it is updated, then rectInPixels will be updated too.

@property (nonatomic, readwrite) CGRect rect

Declared In

CCSpriteFrame.h

rectInPixels

rect of the frame in pixels. If it is updated, then rect (points) will be updated too.

@property (nonatomic, readwrite) CGRect rectInPixels

Declared In

CCSpriteFrame.h

rotated

whether or not the rect of the frame is rotated ( x = x+width, y = y+height, width = height, height = width )

@property (nonatomic, readwrite) BOOL rotated

Declared In

CCSpriteFrame.h

texture

texture of the frame

@property (nonatomic, retain, readwrite) CCTexture2D *texture

Declared In

CCSpriteFrame.h

textureFilename

texture file name of the frame

@property (nonatomic, retain, readonly) NSString *textureFilename

Declared In

CCSpriteFrame.h

Class Methods

frameWithTexture:rect:

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

+ (id)frameWithTexture:(CCTexture2D *)texture rect:(CGRect)rect

Declared In

CCSpriteFrame.h

frameWithTexture:rect:offset:

Create a CCSpriteFrame with a texture, rect and offset. It is assumed that the frame was not trimmed.

+ (id)frameWithTexture:(CCTexture2D *)texture rect:(CGRect)rect offset:(CGPoint)offset

Declared In

CCSpriteFrame.h

frameWithTexture:rect:offset:originalSize:

Create a CCSpriteFrame with a texture, rect, offset and originalSize. The originalSize is the size in pixels of the frame before being trimmed.

+ (id)frameWithTexture:(CCTexture2D *)texture rect:(CGRect)rect offset:(CGPoint)offset originalSize:(CGSize)originalSize

Declared In

CCSpriteFrame.h

frameWithTexture:rectInPixels:rotated:offset:originalSize:

Create 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.

+ (id)frameWithTexture:(CCTexture2D *)texture rectInPixels:(CGRect)rect rotated:(BOOL)rotated offset:(CGPoint)offset originalSize:(CGSize)originalSize

Declared In

CCSpriteFrame.h

frameWithTextureFilename:rect:

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

+ (id)frameWithTextureFilename:(NSString *)filename rect:(CGRect)rect

Declared In

CCSpriteFrame.h

frameWithTextureFilename:rectInPixels:rotated:offset:originalSize:

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.

+ (id)frameWithTextureFilename:(NSString *)filename rectInPixels:(CGRect)rect rotated:(BOOL)rotated offset:(CGPoint)offset originalSize:(CGSize)originalSize

Declared In

CCSpriteFrame.h

Instance Methods

initWithTexture:rect:

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

- (id)initWithTexture:(CCTexture2D *)texture rect:(CGRect)rect

Declared In

CCSpriteFrame.h

initWithTexture:rect:offset:

Initializes a CCSpriteFrame with a texture, rect and offset. It is assumed that the frame was not trimmed.

- (id)initWithTexture:(CCTexture2D *)texture rect:(CGRect)rect offset:(CGPoint)offset

Declared In

CCSpriteFrame.h

initWithTexture:rect:offset:originalSize:

Initializes a CCSpriteFrame with a texture, rect, offset and originalSize. The originalSize is the size in pixels of the frame before being trimmed.

- (id)initWithTexture:(CCTexture2D *)texture rect:(CGRect)rect offset:(CGPoint)offset originalSize:(CGSize)originalSize

Declared In

CCSpriteFrame.h

initWithTexture:rectInPixels:rotated:offset: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.

- (id)initWithTexture:(CCTexture2D *)texture rectInPixels:(CGRect)rect rotated:(BOOL)rotated offset:(CGPoint)offset originalSize:(CGSize)originalSize

Declared In

CCSpriteFrame.h

initWithTextureFilename:rect:

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

- (id)initWithTextureFilename:(NSString *)filename rect:(CGRect)rect

Declared In

CCSpriteFrame.h

initWithTextureFilename:rectInPixels:rotated:offset: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.

- (id)initWithTextureFilename:(NSString *)filename rectInPixels:(CGRect)rect rotated:(BOOL)rotated offset:(CGPoint)offset originalSize:(CGSize)originalSize

Availability

Declared In

CCSpriteFrame.h