cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
Public Member Functions | Static Public Member Functions | Properties
CCSpriteFrame Class Reference

#import <CCSpriteFrame.h>

Collaboration diagram for CCSpriteFrame:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(id) - initWithTexture:rect:
(id) - initWithTexture:rectInPixels:rotated:offset:originalSize:

Static Public Member Functions

(id) + frameWithTexture:rect:
(id) + frameWithTexture:rectInPixels:rotated:offset:originalSize:

Properties

CGRect rect
CGRect rectInPixels
BOOL rotated
CGPoint offsetInPixels
CGSize originalSizeInPixels
CCTexture2Dtexture

Detailed Description

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];

Definition at line 41 of file CCSpriteFrame.h.


Member Function Documentation

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


Property Documentation

- (CGPoint) offsetInPixels [read, write, assign]

offset of the frame in pixels

Definition at line 61 of file CCSpriteFrame.h.

- (CGSize) originalSizeInPixels [read, write, assign]

original size of the trimmed image in pixels

Definition at line 64 of file CCSpriteFrame.h.

- (CGRect) rect [read, write, assign]

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

Definition at line 52 of file CCSpriteFrame.h.

- (CGRect) rectInPixels [read, write, assign]

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

Definition at line 55 of file CCSpriteFrame.h.

- (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 )

Definition at line 58 of file CCSpriteFrame.h.

- (CCTexture2D*) texture [read, write, retain]

texture of the frame

Definition at line 67 of file CCSpriteFrame.h.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4