CCSpriteFrame Class Reference
| 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
-
rectrect of the frame in points. If it is updated, then rectInPixels will be updated too.
property -
rectInPixelsrect of the frame in pixels. If it is updated, then rect (points) will be updated too.
property -
rotatedwhether or not the rect of the frame is rotated ( x = x+width, y = y+height, width = height, height = width )
property -
offsetoffset of the frame in points
property -
offsetInPixelsoffset of the frame in pixels
property -
originalSizeoriginal size of the trimmed image in points
property -
originalSizeInPixelsoriginal size of the trimmed image in pixels
property -
texturetexture of the frame
property -
textureFilenametexture file name of the frame
property -
+ frameWithTexture:rect:Create a CCSpriteFrame with a texture, rect in points. It is assumed that the frame was not trimmed.
-
+ frameWithTextureFilename:rect:Create a CCSpriteFrame with a texture filename, rect in points. It is assumed that the frame was not trimmed.
-
+ 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.
-
+ 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.
-
– initWithTexture:rect:Initializes a CCSpriteFrame with a texture, rect in points; It is assumed that the frame was not trimmed.
-
– initWithTextureFilename:rect:Initializes a CCSpriteFrame with a texture filename, rect in points; It is assumed that the frame was not trimmed.
-
– 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.
-
– 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.
Other Methods
-
+ frameWithTexture:rect:offset:Create a CCSpriteFrame with a texture, rect and offset. It is assumed that the frame was not trimmed.
-
+ 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.
-
– initWithTexture:rect:offset:Initializes a CCSpriteFrame with a texture, rect and offset. It is assumed that the frame was not trimmed.
-
– 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.
Properties
offset
offset of the frame in points
@property (nonatomic, readwrite) CGPoint offsetDeclared In
CCSpriteFrame.hoffsetInPixels
offset of the frame in pixels
@property (nonatomic, readwrite) CGPoint offsetInPixelsDeclared In
CCSpriteFrame.horiginalSize
original size of the trimmed image in points
@property (nonatomic, readwrite) CGSize originalSizeDeclared In
CCSpriteFrame.horiginalSizeInPixels
original size of the trimmed image in pixels
@property (nonatomic, readwrite) CGSize originalSizeInPixelsDeclared In
CCSpriteFrame.hrect
rect of the frame in points. If it is updated, then rectInPixels will be updated too.
@property (nonatomic, readwrite) CGRect rectDeclared In
CCSpriteFrame.hrectInPixels
rect of the frame in pixels. If it is updated, then rect (points) will be updated too.
@property (nonatomic, readwrite) CGRect rectInPixelsDeclared In
CCSpriteFrame.hrotated
whether or not the rect of the frame is rotated ( x = x+width, y = y+height, width = height, height = width )
@property (nonatomic, readwrite) BOOL rotatedDeclared In
CCSpriteFrame.hClass 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)rectDeclared In
CCSpriteFrame.hframeWithTexture: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)offsetDeclared In
CCSpriteFrame.hframeWithTexture: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)originalSizeDeclared In
CCSpriteFrame.hframeWithTexture: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)originalSizeDeclared In
CCSpriteFrame.hframeWithTextureFilename: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)rectDeclared In
CCSpriteFrame.hframeWithTextureFilename: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)originalSizeDeclared In
CCSpriteFrame.hInstance 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)rectDeclared In
CCSpriteFrame.hinitWithTexture: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)offsetDeclared In
CCSpriteFrame.hinitWithTexture: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)originalSizeDeclared In
CCSpriteFrame.hinitWithTexture: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)originalSizeDeclared In
CCSpriteFrame.hinitWithTextureFilename: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)rectDeclared In
CCSpriteFrame.hinitWithTextureFilename: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)originalSizeAvailability
Declared In
CCSpriteFrame.h