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/CCActionInstant.h | |
| download | cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2 cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip | |
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/CCActionInstant.h')
| -rwxr-xr-x | libs/cocos2d/CCActionInstant.h | 205 |
1 files changed, 205 insertions, 0 deletions
| diff --git a/libs/cocos2d/CCActionInstant.h b/libs/cocos2d/CCActionInstant.h new file mode 100755 index 0000000..5a1bc2d --- /dev/null +++ b/libs/cocos2d/CCActionInstant.h | |||
| @@ -0,0 +1,205 @@ | |||
| 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 | |||
| 28 | #import "CCAction.h" | ||
| 29 | |||
| 30 | /** Instant actions are immediate actions. They don't have a duration like | ||
| 31 | the CCIntervalAction actions. | ||
| 32 | */ | ||
| 33 | @interface CCActionInstant : CCFiniteTimeAction <NSCopying> | ||
| 34 | { | ||
| 35 | } | ||
| 36 | @end | ||
| 37 | |||
| 38 | /** Show the node | ||
| 39 | */ | ||
| 40 | @interface CCShow : CCActionInstant | ||
| 41 | { | ||
| 42 | } | ||
| 43 | @end | ||
| 44 | |||
| 45 | /** Hide the node | ||
| 46 | */ | ||
| 47 | @interface CCHide : CCActionInstant | ||
| 48 | { | ||
| 49 | } | ||
| 50 | @end | ||
| 51 | |||
| 52 | /** Toggles the visibility of a node | ||
| 53 | */ | ||
| 54 | @interface CCToggleVisibility : CCActionInstant | ||
| 55 | { | ||
| 56 | } | ||
| 57 | @end | ||
| 58 | |||
| 59 | /** Flips the sprite horizontally | ||
| 60 | @since v0.99.0 | ||
| 61 | */ | ||
| 62 | @interface CCFlipX : CCActionInstant | ||
| 63 | { | ||
| 64 | BOOL flipX; | ||
| 65 | } | ||
| 66 | +(id) actionWithFlipX:(BOOL)x; | ||
| 67 | -(id) initWithFlipX:(BOOL)x; | ||
| 68 | @end | ||
| 69 | |||
| 70 | /** Flips the sprite vertically | ||
| 71 | @since v0.99.0 | ||
| 72 | */ | ||
| 73 | @interface CCFlipY : CCActionInstant | ||
| 74 | { | ||
| 75 | BOOL flipY; | ||
| 76 | } | ||
| 77 | +(id) actionWithFlipY:(BOOL)y; | ||
| 78 | -(id) initWithFlipY:(BOOL)y; | ||
| 79 | @end | ||
| 80 | |||
| 81 | /** Places the node in a certain position | ||
| 82 | */ | ||
| 83 | @interface CCPlace : CCActionInstant <NSCopying> | ||
| 84 | { | ||
| 85 | CGPoint position; | ||
| 86 | } | ||
| 87 | /** creates a Place action with a position */ | ||
| 88 | +(id) actionWithPosition: (CGPoint) pos; | ||
| 89 | /** Initializes a Place action with a position */ | ||
| 90 | -(id) initWithPosition: (CGPoint) pos; | ||
| 91 | @end | ||
| 92 | |||
| 93 | /** Calls a 'callback' | ||
| 94 | */ | ||
| 95 | @interface CCCallFunc : CCActionInstant <NSCopying> | ||
| 96 | { | ||
| 97 | id targetCallback_; | ||
| 98 | SEL selector_; | ||
| 99 | } | ||
| 100 | |||
| 101 | /** Target that will be called */ | ||
| 102 | @property (nonatomic, readwrite, retain) id targetCallback; | ||
| 103 | |||
| 104 | /** creates the action with the callback */ | ||
| 105 | +(id) actionWithTarget: (id) t selector:(SEL) s; | ||
| 106 | /** initializes the action with the callback */ | ||
| 107 | -(id) initWithTarget: (id) t selector:(SEL) s; | ||
| 108 | /** exeuctes the callback */ | ||
| 109 | -(void) execute; | ||
| 110 | @end | ||
| 111 | |||
| 112 | /** Calls a 'callback' with the node as the first argument. | ||
| 113 | N means Node | ||
| 114 | */ | ||
| 115 | @interface CCCallFuncN : CCCallFunc | ||
| 116 | { | ||
| 117 | } | ||
| 118 | @end | ||
| 119 | |||
| 120 | typedef void (*CC_CALLBACK_ND)(id, SEL, id, void *); | ||
| 121 | /** Calls a 'callback' with the node as the first argument and the 2nd argument is data. | ||
| 122 | * ND means: Node and Data. Data is void *, so it could be anything. | ||
| 123 | */ | ||
| 124 | @interface CCCallFuncND : CCCallFuncN | ||
| 125 | { | ||
| 126 | void *data_; | ||
| 127 | CC_CALLBACK_ND callbackMethod_; | ||
| 128 | } | ||
| 129 | |||
| 130 | /** Invocation object that has the target#selector and the parameters */ | ||
| 131 | @property (nonatomic,readwrite) CC_CALLBACK_ND callbackMethod; | ||
| 132 | |||
| 133 | /** creates the action with the callback and the data to pass as an argument */ | ||
| 134 | +(id) actionWithTarget: (id) t selector:(SEL) s data:(void*)d; | ||
| 135 | /** initializes the action with the callback and the data to pass as an argument */ | ||
| 136 | -(id) initWithTarget:(id) t selector:(SEL) s data:(void*) d; | ||
| 137 | @end | ||
| 138 | |||
| 139 | /** Calls a 'callback' with an object as the first argument. | ||
| 140 | O means Object. | ||
| 141 | @since v0.99.5 | ||
| 142 | */ | ||
| 143 | @interface CCCallFuncO : CCCallFunc | ||
| 144 | { | ||
| 145 | id object_; | ||
| 146 | } | ||
| 147 | /** object to be passed as argument */ | ||
| 148 | @property (nonatomic, readwrite, retain) id object; | ||
| 149 | |||
| 150 | /** creates the action with the callback and the object to pass as an argument */ | ||
| 151 | +(id) actionWithTarget: (id) t selector:(SEL) s object:(id)object; | ||
| 152 | /** initializes the action with the callback and the object to pass as an argument */ | ||
| 153 | -(id) initWithTarget:(id) t selector:(SEL) s object:(id)object; | ||
| 154 | |||
| 155 | @end | ||
| 156 | |||
| 157 | #pragma mark Blocks Support | ||
| 158 | |||
| 159 | #if NS_BLOCKS_AVAILABLE | ||
| 160 | |||
| 161 | /** Executes a callback using a block. | ||
| 162 | */ | ||
| 163 | @interface CCCallBlock : CCActionInstant<NSCopying> | ||
| 164 | { | ||
| 165 | void (^block_)(); | ||
| 166 | } | ||
| 167 | |||
| 168 | /** creates the action with the specified block, to be used as a callback. | ||
| 169 | The block will be "copied". | ||
| 170 | */ | ||
| 171 | +(id) actionWithBlock:(void(^)())block; | ||
| 172 | |||
| 173 | /** initialized the action with the specified block, to be used as a callback. | ||
| 174 | The block will be "copied". | ||
| 175 | */ | ||
| 176 | -(id) initWithBlock:(void(^)())block; | ||
| 177 | |||
| 178 | /** executes the callback */ | ||
| 179 | -(void) execute; | ||
| 180 | @end | ||
| 181 | |||
| 182 | @class CCNode; | ||
| 183 | |||
| 184 | /** Executes a callback using a block with a single CCNode parameter. | ||
| 185 | */ | ||
| 186 | @interface CCCallBlockN : CCActionInstant<NSCopying> | ||
| 187 | { | ||
| 188 | void (^block_)(CCNode *); | ||
| 189 | } | ||
| 190 | |||
| 191 | /** creates the action with the specified block, to be used as a callback. | ||
| 192 | The block will be "copied". | ||
| 193 | */ | ||
| 194 | +(id) actionWithBlock:(void(^)(CCNode *node))block; | ||
| 195 | |||
| 196 | /** initialized the action with the specified block, to be used as a callback. | ||
| 197 | The block will be "copied". | ||
| 198 | */ | ||
| 199 | -(id) initWithBlock:(void(^)(CCNode *node))block; | ||
| 200 | |||
| 201 | /** executes the callback */ | ||
| 202 | -(void) execute; | ||
| 203 | @end | ||
| 204 | |||
| 205 | #endif | ||
