|
cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
|
00001 /* 00002 * cocos2d for iPhone: http://www.cocos2d-iphone.org 00003 * 00004 * Copyright (c) 2008-2010 Ricardo Quesada 00005 * Copyright (c) 2011 Zynga Inc. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a copy 00008 * of this software and associated documentation files (the "Software"), to deal 00009 * in the Software without restriction, including without limitation the rights 00010 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00011 * copies of the Software, and to permit persons to whom the Software is 00012 * furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included in 00015 * all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00020 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00022 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00023 * THE SOFTWARE. 00024 * 00025 */ 00026 00027 00028 #import "CCAction.h" 00029 00033 @interface CCActionInstant : CCFiniteTimeAction <NSCopying> 00034 { 00035 } 00036 @end 00037 00040 @interface CCShow : CCActionInstant 00041 { 00042 } 00043 @end 00044 00047 @interface CCHide : CCActionInstant 00048 { 00049 } 00050 @end 00051 00054 @interface CCToggleVisibility : CCActionInstant 00055 { 00056 } 00057 @end 00058 00062 @interface CCFlipX : CCActionInstant 00063 { 00064 BOOL flipX; 00065 } 00066 +(id) actionWithFlipX:(BOOL)x; 00067 -(id) initWithFlipX:(BOOL)x; 00068 @end 00069 00073 @interface CCFlipY : CCActionInstant 00074 { 00075 BOOL flipY; 00076 } 00077 +(id) actionWithFlipY:(BOOL)y; 00078 -(id) initWithFlipY:(BOOL)y; 00079 @end 00080 00083 @interface CCPlace : CCActionInstant <NSCopying> 00084 { 00085 CGPoint position; 00086 } 00088 +(id) actionWithPosition: (CGPoint) pos; 00090 -(id) initWithPosition: (CGPoint) pos; 00091 @end 00092 00095 @interface CCCallFunc : CCActionInstant <NSCopying> 00096 { 00097 id targetCallback_; 00098 SEL selector_; 00099 } 00100 00102 @property (nonatomic, readwrite, retain) id targetCallback; 00103 00105 +(id) actionWithTarget: (id) t selector:(SEL) s; 00107 -(id) initWithTarget: (id) t selector:(SEL) s; 00109 -(void) execute; 00110 @end 00111 00115 @interface CCCallFuncN : CCCallFunc 00116 { 00117 } 00118 @end 00119 00120 typedef void (*CC_CALLBACK_ND)(id, SEL, id, void *); 00124 @interface CCCallFuncND : CCCallFuncN 00125 { 00126 void *data_; 00127 CC_CALLBACK_ND callbackMethod_; 00128 } 00129 00131 @property (nonatomic,readwrite) CC_CALLBACK_ND callbackMethod; 00132 00134 +(id) actionWithTarget: (id) t selector:(SEL) s data:(void*)d; 00136 -(id) initWithTarget:(id) t selector:(SEL) s data:(void*) d; 00137 @end 00138 00143 @interface CCCallFuncO : CCCallFunc 00144 { 00145 id object_; 00146 } 00148 @property (nonatomic, readwrite, retain) id object; 00149 00151 +(id) actionWithTarget: (id) t selector:(SEL) s object:(id)object; 00153 -(id) initWithTarget:(id) t selector:(SEL) s object:(id)object; 00154 00155 @end 00156 00157 #pragma mark Blocks Support 00158 00159 #if NS_BLOCKS_AVAILABLE 00160 00163 @interface CCCallBlock : CCActionInstant<NSCopying> 00164 { 00165 void (^block_)(); 00166 } 00167 00171 +(id) actionWithBlock:(void(^)())block; 00172 00176 -(id) initWithBlock:(void(^)())block; 00177 00179 -(void) execute; 00180 @end 00181 00182 @class CCNode; 00183 00186 @interface CCCallBlockN : CCActionInstant<NSCopying> 00187 { 00188 void (^block_)(CCNode *); 00189 } 00190 00194 +(id) actionWithBlock:(void(^)(CCNode *node))block; 00195 00199 -(id) initWithBlock:(void(^)(CCNode *node))block; 00200 00202 -(void) execute; 00203 @end 00204 00205 #endif