cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
/Users/rquesada/progs/cocos2d-iphone/cocos2d/CCActionInterval.h
00001 /*
00002  * cocos2d for iPhone: http://www.cocos2d-iphone.org
00003  *
00004  * Copyright (c) 2008-2011 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 "CCNode.h"
00029 #import "CCAction.h"
00030 #import "CCProtocols.h"
00031 
00032 #include <sys/time.h>
00033 
00050 @interface CCActionInterval: CCFiniteTimeAction <NSCopying>
00051 {
00052         ccTime  elapsed_;
00053         BOOL    firstTick_;
00054 }
00055 
00057 @property (nonatomic,readonly) ccTime elapsed;
00058 
00060 +(id) actionWithDuration: (ccTime) d;
00062 -(id) initWithDuration: (ccTime) d;
00064 -(BOOL) isDone;
00066 - (CCActionInterval*) reverse;
00067 @end
00068 
00071 @interface CCSequence : CCActionInterval <NSCopying>
00072 {
00073         CCFiniteTimeAction *actions_[2];
00074         ccTime split_;
00075         int last_;
00076 }
00078 +(id) actions: (CCFiniteTimeAction*) action1, ... NS_REQUIRES_NIL_TERMINATION;
00080 +(id) actionsWithArray: (NSArray*) actions;
00082 +(id) actionOne:(CCFiniteTimeAction*)actionOne two:(CCFiniteTimeAction*)actionTwo;
00084 -(id) initOne:(CCFiniteTimeAction*)actionOne two:(CCFiniteTimeAction*)actionTwo;
00085 @end
00086 
00087 
00091 @interface CCRepeat : CCActionInterval <NSCopying>
00092 {
00093         NSUInteger times_;
00094         NSUInteger total_;
00095         CCFiniteTimeAction *innerAction_;
00096 }
00097 
00099 @property (nonatomic,readwrite,retain) CCFiniteTimeAction *innerAction;
00100 
00102 +(id) actionWithAction:(CCFiniteTimeAction*)action times: (NSUInteger)times;
00104 -(id) initWithAction:(CCFiniteTimeAction*)action times: (NSUInteger)times;
00105 @end
00106 
00109 @interface CCSpawn : CCActionInterval <NSCopying>
00110 {
00111         CCFiniteTimeAction *one_;
00112         CCFiniteTimeAction *two_;
00113 }
00115 +(id) actions: (CCFiniteTimeAction*) action1, ... NS_REQUIRES_NIL_TERMINATION;
00117 +(id) actionsWithArray: (NSArray*) actions;
00119 +(id) actionOne: (CCFiniteTimeAction*) one two:(CCFiniteTimeAction*) two;
00121 -(id) initOne: (CCFiniteTimeAction*) one two:(CCFiniteTimeAction*) two;
00122 @end
00123 
00128 @interface CCRotateTo : CCActionInterval <NSCopying>
00129 {
00130         float dstAngle_;
00131         float startAngle_;
00132         float diffAngle_;
00133 }
00135 +(id) actionWithDuration:(ccTime)duration angle:(float)angle;
00137 -(id) initWithDuration:(ccTime)duration angle:(float)angle;
00138 @end
00139 
00142 @interface CCRotateBy : CCActionInterval <NSCopying>
00143 {
00144         float angle_;
00145         float startAngle_;
00146 }
00148 +(id) actionWithDuration:(ccTime)duration angle:(float)deltaAngle;
00150 -(id) initWithDuration:(ccTime)duration angle:(float)deltaAngle;
00151 @end
00152 
00155 @interface CCMoveTo : CCActionInterval <NSCopying>
00156 {
00157         CGPoint endPosition_;
00158         CGPoint startPosition_;
00159         CGPoint delta_;
00160 }
00162 +(id) actionWithDuration:(ccTime)duration position:(CGPoint)position;
00164 -(id) initWithDuration:(ccTime)duration position:(CGPoint)position;
00165 @end
00166 
00171 @interface CCMoveBy : CCMoveTo <NSCopying>
00172 {
00173 }
00175 +(id) actionWithDuration: (ccTime)duration position:(CGPoint)deltaPosition;
00177 -(id) initWithDuration: (ccTime)duration position:(CGPoint)deltaPosition;
00178 @end
00179 
00183 @interface CCSkewTo : CCActionInterval <NSCopying>
00184 {
00185         float skewX_;
00186         float skewY_;
00187         float startSkewX_;
00188         float startSkewY_;
00189         float endSkewX_;
00190         float endSkewY_;
00191         float deltaX_;
00192         float deltaY_;
00193 }
00195 +(id) actionWithDuration:(ccTime)t skewX:(float)sx skewY:(float)sy;
00197 -(id) initWithDuration:(ccTime)t skewX:(float)sx skewY:(float)sy;
00198 @end
00199 
00203 @interface CCSkewBy : CCSkewTo <NSCopying>
00204 {
00205 }
00206 @end
00207 
00210  @interface CCJumpBy : CCActionInterval <NSCopying>
00211 {
00212         CGPoint startPosition_;
00213         CGPoint delta_;
00214         ccTime height_;
00215         NSUInteger jumps_;
00216 }
00218 +(id) actionWithDuration: (ccTime)duration position:(CGPoint)position height:(ccTime)height jumps:(NSUInteger)jumps;
00220 -(id) initWithDuration: (ccTime)duration position:(CGPoint)position height:(ccTime)height jumps:(NSUInteger)jumps;
00221 @end
00222 
00225  @interface CCJumpTo : CCJumpBy <NSCopying>
00226 {
00227 }
00228 @end
00229 
00232 typedef struct _ccBezierConfig {
00234         CGPoint endPosition;
00236         CGPoint controlPoint_1;
00238         CGPoint controlPoint_2;
00239 } ccBezierConfig;
00240 
00243 @interface CCBezierBy : CCActionInterval <NSCopying>
00244 {
00245         ccBezierConfig config_;
00246         CGPoint startPosition_;
00247 }
00248 
00250 +(id) actionWithDuration: (ccTime) t bezier:(ccBezierConfig) c;
00251 
00253 -(id) initWithDuration: (ccTime) t bezier:(ccBezierConfig) c;
00254 @end
00255 
00259 @interface CCBezierTo : CCBezierBy
00260 {
00261 }
00262 @end
00263 
00267 @interface CCScaleTo : CCActionInterval <NSCopying>
00268 {
00269         float scaleX_;
00270         float scaleY_;
00271         float startScaleX_;
00272         float startScaleY_;
00273         float endScaleX_;
00274         float endScaleY_;
00275         float deltaX_;
00276         float deltaY_;
00277 }
00279 +(id) actionWithDuration: (ccTime)duration scale:(float) s;
00281 -(id) initWithDuration: (ccTime)duration scale:(float) s;
00283 +(id) actionWithDuration: (ccTime)duration scaleX:(float) sx scaleY:(float)sy;
00285 -(id) initWithDuration: (ccTime)duration scaleX:(float) sx scaleY:(float)sy;
00286 @end
00287 
00290 @interface CCScaleBy : CCScaleTo <NSCopying>
00291 {
00292 }
00293 @end
00294 
00297 @interface CCBlink : CCActionInterval <NSCopying>
00298 {
00299         NSUInteger times_;
00300 }
00302 +(id) actionWithDuration: (ccTime)duration blinks:(NSUInteger)blinks;
00304 -(id) initWithDuration: (ccTime)duration blinks:(NSUInteger)blinks;
00305 @end
00306 
00310 @interface CCFadeIn : CCActionInterval <NSCopying>
00311 {
00312 }
00313 @end
00314 
00318 @interface CCFadeOut : CCActionInterval <NSCopying>
00319 {
00320 }
00321 @end
00322 
00326 @interface CCFadeTo : CCActionInterval <NSCopying>
00327 {
00328         GLubyte toOpacity_;
00329         GLubyte fromOpacity_;
00330 }
00332 +(id) actionWithDuration:(ccTime)duration opacity:(GLubyte)opactiy;
00334 -(id) initWithDuration:(ccTime)duration opacity:(GLubyte)opacity;
00335 @end
00336 
00341 @interface CCTintTo : CCActionInterval <NSCopying>
00342 {
00343         ccColor3B to_;
00344         ccColor3B from_;
00345 }
00347 +(id) actionWithDuration:(ccTime)duration red:(GLubyte)red green:(GLubyte)green blue:(GLubyte)blue;
00349 -(id) initWithDuration:(ccTime)duration red:(GLubyte)red green:(GLubyte)green blue:(GLubyte)blue;
00350 @end
00351 
00355 @interface CCTintBy : CCActionInterval <NSCopying>
00356 {
00357         GLshort deltaR_, deltaG_, deltaB_;
00358         GLshort fromR_, fromG_, fromB_;
00359 }
00361 +(id) actionWithDuration:(ccTime)duration red:(GLshort)deltaRed green:(GLshort)deltaGreen blue:(GLshort)deltaBlue;
00363 -(id) initWithDuration:(ccTime)duration red:(GLshort)deltaRed green:(GLshort)deltaGreen blue:(GLshort)deltaBlue;
00364 @end
00365 
00368 @interface CCDelayTime : CCActionInterval <NSCopying>
00369 {
00370 }
00371 @end
00372 
00380 @interface CCReverseTime : CCActionInterval <NSCopying>
00381 {
00382         CCFiniteTimeAction * other_;
00383 }
00385 +(id) actionWithAction: (CCFiniteTimeAction*) action;
00387 -(id) initWithAction: (CCFiniteTimeAction*) action;
00388 @end
00389 
00390 
00391 @class CCAnimation;
00392 @class CCTexture2D;
00394 @interface CCAnimate : CCActionInterval <NSCopying>
00395 {
00396         CCAnimation *animation_;
00397         id origFrame_;
00398         BOOL restoreOriginalFrame_;
00399 }
00401 @property (readwrite,nonatomic,retain) CCAnimation * animation;
00402 
00404 +(id) actionWithAnimation:(CCAnimation*) a;
00406 -(id) initWithAnimation:(CCAnimation*) a;
00408 +(id) actionWithAnimation:(CCAnimation*) a restoreOriginalFrame:(BOOL)b;
00410 -(id) initWithAnimation:(CCAnimation*) a restoreOriginalFrame:(BOOL)b;
00415 +(id) actionWithDuration:(ccTime)duration animation:(CCAnimation*)animation restoreOriginalFrame:(BOOL)b;
00420 -(id) initWithDuration:(ccTime)duration animation:(CCAnimation*)animation restoreOriginalFrame:(BOOL)b;
00421 @end
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4