![]() |
cocos2d-iphone
2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
|
#import <CCSpriteFrame.h>
Public Member Functions | |
(id) | - initWithTexture:rect: |
(id) | - initWithTextureFilename:rect: |
(id) | - initWithTexture:rectInPixels:rotated:offset:originalSize: |
(id) | - initWithTextureFilename:rectInPixels:rotated:offset:originalSize: |
Static Public Member Functions | |
(id) | + frameWithTexture:rect: |
(id) | + frameWithTextureFilename:rect: |
(id) | + frameWithTexture:rectInPixels:rotated:offset:originalSize: |
(id) | + frameWithTextureFilename:rectInPixels:rotated:offset:originalSize: |
Protected Attributes | |
CGRect | _rect |
CGRect | _rectInPixels |
BOOL | _rotated |
CGPoint | _offset |
CGPoint | _offsetInPixels |
CGSize | _originalSize |
CGSize | _originalSizeInPixels |
CCTexture2D * | _texture |
NSString * | _textureFilename |
Properties | |
CGRect | rect |
CGRect | rectInPixels |
BOOL | rotated |
CGPoint | offset |
CGPoint | offsetInPixels |
CGSize | originalSize |
CGSize | originalSizeInPixels |
CCTexture2D * | texture |
NSString * | textureFilename |
A CCSpriteFrame has:
You can modify the frame of a CCSprite by doing:
CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:texture rect:rect offset:offset]; [sprite setDisplayFrame:frame];
+ (id) frameWithTexture: | (CCTexture2D *) | texture | |
rect: | (CGRect) | rect | |
Create a CCSpriteFrame with a texture, rect in points. It is assumed that the frame was not trimmed.
+ (id) frameWithTexture: | (CCTexture2D *) | texture | |
rectInPixels: | (CGRect) | rect | |
rotated: | (BOOL) | rotated | |
offset: | (CGPoint) | offset | |
originalSize: | (CGSize) | 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) frameWithTextureFilename: | (NSString *) | filename | |
rect: | (CGRect) | rect | |
Create a CCSpriteFrame with a texture filename, rect in points. It is assumed that the frame was not trimmed.
+ (id) frameWithTextureFilename: | (NSString *) | filename | |
rectInPixels: | (CGRect) | rect | |
rotated: | (BOOL) | rotated | |
offset: | (CGPoint) | offset | |
originalSize: | (CGSize) | 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) initWithTexture: | (CCTexture2D *) | texture | |
rect: | (CGRect) | rect | |
Initializes a CCSpriteFrame with a texture, rect in points; It is assumed that the frame was not trimmed.
- (id) initWithTexture: | (CCTexture2D *) | texture | |
rectInPixels: | (CGRect) | rect | |
rotated: | (BOOL) | rotated | |
offset: | (CGPoint) | offset | |
originalSize: | (CGSize) | 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 | |
rect: | (CGRect) | rect | |
Initializes a CCSpriteFrame with a texture filename, rect in points; It is assumed that the frame was not trimmed.
- (id) initWithTextureFilename: | (NSString *) | filename | |
rectInPixels: | (CGRect) | rect | |
rotated: | (BOOL) | rotated | |
offset: | (CGPoint) | offset | |
originalSize: | (CGSize) | 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.
- (CGPoint) offset [read, write, assign] |
offset of the frame in points
- (CGPoint) offsetInPixels [read, write, assign] |
offset of the frame in pixels
- (CGSize) originalSize [read, write, assign] |
original size of the trimmed image in points
- (CGSize) originalSizeInPixels [read, write, assign] |
original size of the trimmed image in pixels
- (CGRect) rect [read, write, assign] |
rect of the frame in points. If it is updated, then rectInPixels will be updated too.
- (CGRect) rectInPixels [read, write, assign] |
rect of the frame in pixels. If it is updated, then rect (points) will be updated too.
- (BOOL) rotated [read, write, assign] |
whether or not the rect of the frame is rotated ( x = x+width, y = y+height, width = height, height = width )
- (CCTexture2D*) texture [read, write, retain] |
texture of the frame
- (NSString*) textureFilename [read, retain] |
texture file name of the frame