![]() |
cocos2d-iphone
1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
|
#include <CCSpriteFrame.h>
Public Member Functions | |
id | initWithTexture:rect: (CCTexture2D *texture,[rect] CGRect rect) |
id | initWithTexture:rectInPixels:rotated:offset:originalSize: (CCTexture2D *texture,[rectInPixels] CGRect rect,[rotated] BOOL rotated,[offset] CGPoint offset,[originalSize] CGSize originalSize) |
Static Public Member Functions | |
id | frameWithTexture:rect: (CCTexture2D *texture,[rect] CGRect rect) |
id | frameWithTexture:rectInPixels:rotated:offset:originalSize: (CCTexture2D *texture,[rectInPixels] CGRect rect,[rotated] BOOL rotated,[offset] CGPoint offset,[originalSize] CGSize originalSize) |
Protected Attributes | |
CGRect | rect_ |
CGRect | rectInPixels_ |
BOOL | rotated_ |
CGPoint | offsetInPixels_ |
CGSize | originalSizeInPixels_ |
CCTexture2D * | texture_ |
Properties | |
CGRect | rect |
CGRect | rectInPixels |
BOOL | rotated |
CGPoint | offsetInPixels |
CGSize | originalSizeInPixels |
CCTexture2D * | texture |
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 CCSpriteFrame::frameWithTexture:rect: | ( | CCTexture2D * | texture, |
[rect] CGRect | rect | ||
) | [static, virtual] |
Create a CCSpriteFrame with a texture, rect in points. It is assumed that the frame was not trimmed.
id CCSpriteFrame::frameWithTexture:rectInPixels:rotated:offset:originalSize: | ( | CCTexture2D * | texture, |
[rectInPixels] CGRect | rect, | ||
[rotated] BOOL | rotated, | ||
[offset] CGPoint | offset, | ||
[originalSize] CGSize | originalSize | ||
) | [static, virtual] |
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.
id CCSpriteFrame::initWithTexture:rect: | ( | CCTexture2D * | texture, |
[rect] CGRect | rect | ||
) | [virtual] |
Initializes a CCSpriteFrame with a texture, rect in points; It is assumed that the frame was not trimmed.
id CCSpriteFrame::initWithTexture:rectInPixels:rotated:offset:originalSize: | ( | CCTexture2D * | texture, |
[rectInPixels] CGRect | rect, | ||
[rotated] BOOL | rotated, | ||
[offset] CGPoint | offset, | ||
[originalSize] CGSize | originalSize | ||
) | [virtual] |
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.
CGPoint CCSpriteFrame::offsetInPixels [read, write, assign] |
offset of the frame in pixels
CGSize CCSpriteFrame::originalSizeInPixels [read, write, assign] |
original size of the trimmed image in pixels
CGRect CCSpriteFrame::rect [read, write, assign] |
rect of the frame in points. If it is updated, then rectInPixels will be updated too.
CGRect CCSpriteFrame::rectInPixels [read, write, assign] |
rect of the frame in pixels. If it is updated, then rect (points) will be udpated too.
BOOL CCSpriteFrame::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* CCSpriteFrame::texture [read, write, retain] |
texture of the frame