diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-07-30 11:19:14 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-07-30 11:19:14 -0400 |
commit | 9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch) | |
tree | 5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/CCSpriteFrame.h | |
download | cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2 cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip |
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/CCSpriteFrame.h')
-rwxr-xr-x | libs/cocos2d/CCSpriteFrame.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/libs/cocos2d/CCSpriteFrame.h b/libs/cocos2d/CCSpriteFrame.h new file mode 100755 index 0000000..983aeed --- /dev/null +++ b/libs/cocos2d/CCSpriteFrame.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org | ||
3 | * | ||
4 | * Copyright (c) 2008-2011 Ricardo Quesada | ||
5 | * Copyright (c) 2011 Zynga Inc. | ||
6 | * | ||
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
8 | * of this software and associated documentation files (the "Software"), to deal | ||
9 | * in the Software without restriction, including without limitation the rights | ||
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
11 | * copies of the Software, and to permit persons to whom the Software is | ||
12 | * furnished to do so, subject to the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice shall be included in | ||
15 | * all copies or substantial portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
23 | * THE SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #import <Foundation/Foundation.h> | ||
28 | #import "CCNode.h" | ||
29 | #import "CCProtocols.h" | ||
30 | |||
31 | /** A CCSpriteFrame has: | ||
32 | - texture: A CCTexture2D that will be used by the CCSprite | ||
33 | - rectangle: A rectangle of the texture | ||
34 | |||
35 | |||
36 | You can modify the frame of a CCSprite by doing: | ||
37 | |||
38 | CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:texture rect:rect offset:offset]; | ||
39 | [sprite setDisplayFrame:frame]; | ||
40 | */ | ||
41 | @interface CCSpriteFrame : NSObject <NSCopying> | ||
42 | { | ||
43 | CGRect rect_; | ||
44 | CGRect rectInPixels_; | ||
45 | BOOL rotated_; | ||
46 | CGPoint offsetInPixels_; | ||
47 | CGSize originalSizeInPixels_; | ||
48 | CCTexture2D *texture_; | ||
49 | } | ||
50 | /** rect of the frame in points. If it is updated, then rectInPixels will be updated too. */ | ||
51 | @property (nonatomic,readwrite) CGRect rect; | ||
52 | |||
53 | /** rect of the frame in pixels. If it is updated, then rect (points) will be udpated too. */ | ||
54 | @property (nonatomic,readwrite) CGRect rectInPixels; | ||
55 | |||
56 | /** whether or not the rect of the frame is rotated ( x = x+width, y = y+height, width = height, height = width ) */ | ||
57 | @property (nonatomic,readwrite) BOOL rotated; | ||
58 | |||
59 | /** offset of the frame in pixels */ | ||
60 | @property (nonatomic,readwrite) CGPoint offsetInPixels; | ||
61 | |||
62 | /** original size of the trimmed image in pixels */ | ||
63 | @property (nonatomic,readwrite) CGSize originalSizeInPixels; | ||
64 | |||
65 | /** texture of the frame */ | ||
66 | @property (nonatomic, retain, readwrite) CCTexture2D *texture; | ||
67 | |||
68 | /** Create a CCSpriteFrame with a texture, rect in points. | ||
69 | It is assumed that the frame was not trimmed. | ||
70 | */ | ||
71 | +(id) frameWithTexture:(CCTexture2D*)texture rect:(CGRect)rect; | ||
72 | |||
73 | /** Create a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. | ||
74 | The originalSize is the size in points of the frame before being trimmed. | ||
75 | */ | ||
76 | +(id) frameWithTexture:(CCTexture2D*)texture rectInPixels:(CGRect)rect rotated:(BOOL)rotated offset:(CGPoint)offset originalSize:(CGSize)originalSize; | ||
77 | |||
78 | |||
79 | /** Initializes a CCSpriteFrame with a texture, rect in points; | ||
80 | It is assumed that the frame was not trimmed. | ||
81 | */ | ||
82 | -(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect; | ||
83 | |||
84 | /** Initializes a CCSpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. | ||
85 | The originalSize is the size in points of the frame before being trimmed. | ||
86 | */ | ||
87 | -(id) initWithTexture:(CCTexture2D*)texture rectInPixels:(CGRect)rect rotated:(BOOL)rotated offset:(CGPoint)offset originalSize:(CGSize)originalSize; | ||
88 | |||
89 | @end | ||
90 | |||