|
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 #include <sys/time.h> 00029 #import <Foundation/Foundation.h> 00030 00031 #import "ccTypes.h" 00032 00033 enum { 00035 kCCActionTagInvalid = -1, 00036 }; 00037 00040 @interface CCAction : NSObject <NSCopying> 00041 { 00042 id originalTarget_; 00043 id target_; 00044 NSInteger tag_; 00045 } 00046 00052 @property (nonatomic,readonly,assign) id target; 00053 00058 @property (nonatomic,readonly,assign) id originalTarget; 00059 00060 00062 @property (nonatomic,readwrite,assign) NSInteger tag; 00063 00065 +(id) action; 00066 00068 -(id) init; 00069 00070 -(id) copyWithZone: (NSZone*) zone; 00071 00073 -(BOOL) isDone; 00075 -(void) startWithTarget:(id)target; 00078 -(void) stop; 00080 -(void) step: (ccTime) dt; 00086 -(void) update: (ccTime) time; 00087 00088 @end 00089 00096 @interface CCFiniteTimeAction : CCAction <NSCopying> 00097 { 00099 ccTime duration_; 00100 } 00102 @property (nonatomic,readwrite) ccTime duration; 00103 00105 - (CCFiniteTimeAction*) reverse; 00106 @end 00107 00108 00109 @class CCActionInterval; 00114 @interface CCRepeatForever : CCAction <NSCopying> 00115 { 00116 CCActionInterval *innerAction_; 00117 } 00119 @property (nonatomic, readwrite, retain) CCActionInterval *innerAction; 00120 00122 +(id) actionWithAction: (CCActionInterval*) action; 00124 -(id) initWithAction: (CCActionInterval*) action; 00125 @end 00126 00132 @interface CCSpeed : CCAction <NSCopying> 00133 { 00134 CCActionInterval *innerAction_; 00135 float speed_; 00136 } 00138 @property (nonatomic,readwrite) float speed; 00140 @property (nonatomic, readwrite, retain) CCActionInterval *innerAction; 00141 00143 +(id) actionWithAction: (CCActionInterval*) action speed:(float)rate; 00145 -(id) initWithAction: (CCActionInterval*) action speed:(float)rate; 00146 @end 00147 00148 @class CCNode; 00157 @interface CCFollow : CCAction <NSCopying> 00158 { 00159 /* node to follow */ 00160 CCNode *followedNode_; 00161 00162 /* whether camera should be limited to certain area */ 00163 BOOL boundarySet; 00164 00165 /* if screensize is bigger than the boundary - update not needed */ 00166 BOOL boundaryFullyCovered; 00167 00168 /* fast access to the screen dimensions */ 00169 CGPoint halfScreenSize; 00170 CGPoint fullScreenSize; 00171 00172 /* world boundaries */ 00173 float leftBoundary; 00174 float rightBoundary; 00175 float topBoundary; 00176 float bottomBoundary; 00177 } 00178 00180 @property (nonatomic,readwrite) BOOL boundarySet; 00181 00183 +(id) actionWithTarget:(CCNode *)followedNode; 00184 00186 +(id) actionWithTarget:(CCNode *)followedNode worldBoundary:(CGRect)rect; 00187 00189 -(id) initWithTarget:(CCNode *)followedNode; 00190 00192 -(id) initWithTarget:(CCNode *)followedNode worldBoundary:(CGRect)rect; 00193 00194 @end 00195