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/CCAnimation.h | |
| download | cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2 cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip | |
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/CCAnimation.h')
| -rwxr-xr-x | libs/cocos2d/CCAnimation.h | 136 |
1 files changed, 136 insertions, 0 deletions
| diff --git a/libs/cocos2d/CCAnimation.h b/libs/cocos2d/CCAnimation.h new file mode 100755 index 0000000..24b3d96 --- /dev/null +++ b/libs/cocos2d/CCAnimation.h | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | /* | ||
| 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008-2010 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 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | ||
| 29 | #import <CoreGraphics/CoreGraphics.h> | ||
| 30 | #endif // IPHONE | ||
| 31 | |||
| 32 | @class CCSpriteFrame; | ||
| 33 | @class CCTexture2D; | ||
| 34 | |||
| 35 | /** A CCAnimation object is used to perform animations on the CCSprite objects. | ||
| 36 | |||
| 37 | The CCAnimation object contains CCSpriteFrame objects, and a possible delay between the frames. | ||
| 38 | You can animate a CCAnimation object by using the CCAnimate action. Example: | ||
| 39 | |||
| 40 | [sprite runAction:[CCAnimate actionWithAnimation:animation]]; | ||
| 41 | |||
| 42 | */ | ||
| 43 | @interface CCAnimation : NSObject | ||
| 44 | { | ||
| 45 | NSString *name_; | ||
| 46 | float delay_; | ||
| 47 | NSMutableArray *frames_; | ||
| 48 | } | ||
| 49 | |||
| 50 | /** name of the animation */ | ||
| 51 | @property (nonatomic,readwrite,retain) NSString *name; | ||
| 52 | /** delay between frames in seconds. */ | ||
| 53 | @property (nonatomic,readwrite,assign) float delay; | ||
| 54 | /** array of frames */ | ||
| 55 | @property (nonatomic,readwrite,retain) NSMutableArray *frames; | ||
| 56 | |||
| 57 | /** Creates an animation | ||
| 58 | @since v0.99.5 | ||
| 59 | */ | ||
| 60 | +(id) animation; | ||
| 61 | |||
| 62 | /** Creates an animation with frames. | ||
| 63 | @since v0.99.5 | ||
| 64 | */ | ||
| 65 | +(id) animationWithFrames:(NSArray*)frames; | ||
| 66 | |||
| 67 | /* Creates an animation with frames and a delay between frames. | ||
| 68 | @since v0.99.5 | ||
| 69 | */ | ||
| 70 | +(id) animationWithFrames:(NSArray*)frames delay:(float)delay; | ||
| 71 | |||
| 72 | /** Creates a CCAnimation with a name | ||
| 73 | @since v0.99.3 | ||
| 74 | @deprecated Will be removed in 1.0.1. Use "animation" instead. | ||
| 75 | */ | ||
| 76 | +(id) animationWithName:(NSString*)name DEPRECATED_ATTRIBUTE; | ||
| 77 | |||
| 78 | /** Creates a CCAnimation with a name and frames | ||
| 79 | @since v0.99.3 | ||
| 80 | @deprecated Will be removed in 1.0.1. Use "animationWithFrames" instead. | ||
| 81 | */ | ||
| 82 | +(id) animationWithName:(NSString*)name frames:(NSArray*)frames DEPRECATED_ATTRIBUTE; | ||
| 83 | |||
| 84 | /** Creates a CCAnimation with a name and delay between frames. */ | ||
| 85 | +(id) animationWithName:(NSString*)name delay:(float)delay DEPRECATED_ATTRIBUTE; | ||
| 86 | |||
| 87 | /** Creates a CCAnimation with a name, delay and an array of CCSpriteFrames. */ | ||
| 88 | +(id) animationWithName:(NSString*)name delay:(float)delay frames:(NSArray*)frames DEPRECATED_ATTRIBUTE; | ||
| 89 | |||
| 90 | |||
| 91 | /** Initializes a CCAnimation with frames. | ||
| 92 | @since v0.99.5 | ||
| 93 | */ | ||
| 94 | -(id) initWithFrames:(NSArray*)frames; | ||
| 95 | |||
| 96 | /** Initializes a CCAnimation with frames and a delay between frames | ||
| 97 | @since v0.99.5 | ||
| 98 | */ | ||
| 99 | -(id) initWithFrames:(NSArray *)frames delay:(float)delay; | ||
| 100 | |||
| 101 | /** Initializes a CCAnimation with a name | ||
| 102 | @since v0.99.3 | ||
| 103 | @deprecated Will be removed in 1.0.1. Use "init" instead. | ||
| 104 | */ | ||
| 105 | -(id) initWithName:(NSString*)name DEPRECATED_ATTRIBUTE; | ||
| 106 | |||
| 107 | /** Initializes a CCAnimation with a name and frames | ||
| 108 | @since v0.99.3 | ||
| 109 | @deprecated Will be removed in 1.0.1. Use "initWithFrames" instead. | ||
| 110 | */ | ||
| 111 | -(id) initWithName:(NSString*)name frames:(NSArray*)frames DEPRECATED_ATTRIBUTE; | ||
| 112 | |||
| 113 | /** Initializes a CCAnimation with a name and delay between frames. | ||
| 114 | @deprecated Will be removed in 1.0.1. Use "initWithFrames:nil delay:delay" instead. | ||
| 115 | */ | ||
| 116 | -(id) initWithName:(NSString*)name delay:(float)delay DEPRECATED_ATTRIBUTE; | ||
| 117 | |||
| 118 | /** Initializes a CCAnimation with a name, delay and an array of CCSpriteFrames. | ||
| 119 | @deprecated Will be removed in 1.0.1. Use "initWithFrames:frames delay:delay" instead. | ||
| 120 | */ | ||
| 121 | -(id) initWithName:(NSString*)name delay:(float)delay frames:(NSArray*)frames DEPRECATED_ATTRIBUTE; | ||
| 122 | |||
| 123 | /** Adds a frame to a CCAnimation. */ | ||
| 124 | -(void) addFrame:(CCSpriteFrame*)frame; | ||
| 125 | |||
| 126 | /** Adds a frame with an image filename. Internally it will create a CCSpriteFrame and it will add it. | ||
| 127 | Added to facilitate the migration from v0.8 to v0.9. | ||
| 128 | */ | ||
| 129 | -(void) addFrameWithFilename:(NSString*)filename; | ||
| 130 | |||
| 131 | /** Adds a frame with a texture and a rect. Internally it will create a CCSpriteFrame and it will add it. | ||
| 132 | Added to facilitate the migration from v0.8 to v0.9. | ||
| 133 | */ | ||
| 134 | -(void) addFrameWithTexture:(CCTexture2D*)texture rect:(CGRect)rect; | ||
| 135 | |||
| 136 | @end | ||
