From ce1d0d246efaaaace8eb78158aad10bc4886695b Mon Sep 17 00:00:00 2001 From: chsieh Date: Sun, 17 Apr 2011 17:31:47 -0700 Subject: [PATCH] Removing cocos2d and properly adding it back in later. --- Classes/cocos2d/CCAction.h | 188 --- Classes/cocos2d/CCAction.m | 360 ------ Classes/cocos2d/CCActionCamera.h | 72 -- Classes/cocos2d/CCActionCamera.m | 146 --- Classes/cocos2d/CCActionEase.h | 159 --- Classes/cocos2d/CCActionEase.m | 534 --------- Classes/cocos2d/CCActionGrid.h | 165 --- Classes/cocos2d/CCActionGrid.m | 386 ------- Classes/cocos2d/CCActionGrid3D.h | 208 ---- Classes/cocos2d/CCActionGrid3D.m | 659 ----------- Classes/cocos2d/CCActionInstant.h | 197 ---- Classes/cocos2d/CCActionInstant.m | 472 -------- Classes/cocos2d/CCActionInterval.h | 384 ------- Classes/cocos2d/CCActionInterval.m | 1213 -------------------- Classes/cocos2d/CCActionManager.h | 118 -- Classes/cocos2d/CCActionManager.m | 356 ------ Classes/cocos2d/CCActionPageTurn3D.h | 42 - Classes/cocos2d/CCActionPageTurn3D.m | 86 -- Classes/cocos2d/CCActionProgressTimer.h | 59 - Classes/cocos2d/CCActionProgressTimer.m | 103 -- Classes/cocos2d/CCActionTiledGrid.h | 211 ---- Classes/cocos2d/CCActionTiledGrid.m | 768 ------------- Classes/cocos2d/CCActionTween.h | 62 - Classes/cocos2d/CCActionTween.m | 72 -- Classes/cocos2d/CCAnimation.h | 132 --- Classes/cocos2d/CCAnimation.m | 152 --- Classes/cocos2d/CCAnimationCache.h | 63 - Classes/cocos2d/CCAnimationCache.m | 100 -- Classes/cocos2d/CCAtlasNode.h | 86 -- Classes/cocos2d/CCAtlasNode.m | 205 ---- Classes/cocos2d/CCBlockSupport.h | 51 - Classes/cocos2d/CCBlockSupport.m | 46 - Classes/cocos2d/CCCamera.h | 94 -- Classes/cocos2d/CCCamera.m | 130 --- Classes/cocos2d/CCCompatibility.h | 224 ---- Classes/cocos2d/CCCompatibility.m | 596 ---------- Classes/cocos2d/CCConfiguration.h | 110 -- Classes/cocos2d/CCConfiguration.m | 192 --- Classes/cocos2d/CCDirector.h | 304 ----- Classes/cocos2d/CCDirector.m | 557 --------- Classes/cocos2d/CCDrawingPrimitives.h | 91 -- Classes/cocos2d/CCDrawingPrimitives.m | 271 ----- Classes/cocos2d/CCGrabber.h | 43 - Classes/cocos2d/CCGrabber.m | 95 -- Classes/cocos2d/CCGrid.h | 121 -- Classes/cocos2d/CCGrid.m | 571 --------- Classes/cocos2d/CCLabelAtlas.h | 61 - Classes/cocos2d/CCLabelAtlas.m | 189 --- Classes/cocos2d/CCLabelBMFont.h | 189 --- Classes/cocos2d/CCLabelBMFont.m | 669 ----------- Classes/cocos2d/CCLabelTTF.h | 62 - Classes/cocos2d/CCLabelTTF.m | 125 -- Classes/cocos2d/CCLayer.h | 261 ----- Classes/cocos2d/CCLayer.m | 562 --------- Classes/cocos2d/CCMenu.h | 89 -- Classes/cocos2d/CCMenu.m | 516 --------- Classes/cocos2d/CCMenuItem.h | 341 ------ Classes/cocos2d/CCMenuItem.m | 752 ------------ Classes/cocos2d/CCMotionStreak.h | 67 -- Classes/cocos2d/CCMotionStreak.m | 104 -- Classes/cocos2d/CCNode.h | 510 -------- Classes/cocos2d/CCNode.m | 883 -------------- Classes/cocos2d/CCParallaxNode.h | 49 - Classes/cocos2d/CCParallaxNode.m | 160 --- Classes/cocos2d/CCParticleExamples.h | 110 -- Classes/cocos2d/CCParticleExamples.m | 925 --------------- Classes/cocos2d/CCParticleSystem.h | 444 ------- Classes/cocos2d/CCParticleSystem.m | 795 ------------- Classes/cocos2d/CCParticleSystemPoint.h | 64 - Classes/cocos2d/CCParticleSystemPoint.m | 207 ---- Classes/cocos2d/CCParticleSystemQuad.h | 74 -- Classes/cocos2d/CCParticleSystemQuad.m | 314 ----- Classes/cocos2d/CCProgressTimer.h | 83 -- Classes/cocos2d/CCProgressTimer.m | 494 -------- Classes/cocos2d/CCProtocols.h | 124 -- Classes/cocos2d/CCRenderTexture.h | 108 -- Classes/cocos2d/CCRenderTexture.m | 308 ----- Classes/cocos2d/CCRibbon.h | 117 -- Classes/cocos2d/CCRibbon.m | 381 ------ Classes/cocos2d/CCScene.h | 42 - Classes/cocos2d/CCScene.m | 44 - Classes/cocos2d/CCScheduler.h | 212 ---- Classes/cocos2d/CCScheduler.m | 597 ---------- Classes/cocos2d/CCSprite.h | 367 ------ Classes/cocos2d/CCSprite.m | 1004 ---------------- Classes/cocos2d/CCSpriteBatchNode.h | 143 --- Classes/cocos2d/CCSpriteBatchNode.m | 499 -------- Classes/cocos2d/CCSpriteFrame.h | 89 -- Classes/cocos2d/CCSpriteFrame.m | 87 -- Classes/cocos2d/CCSpriteFrameCache.h | 133 --- Classes/cocos2d/CCSpriteFrameCache.m | 344 ------ Classes/cocos2d/CCSpriteSheet.h | 61 - Classes/cocos2d/CCSpriteSheet.m | 37 - Classes/cocos2d/CCTMXLayer.h | 153 --- Classes/cocos2d/CCTMXLayer.m | 668 ----------- Classes/cocos2d/CCTMXObjectGroup.h | 65 -- Classes/cocos2d/CCTMXObjectGroup.m | 83 -- Classes/cocos2d/CCTMXTiledMap.h | 144 --- Classes/cocos2d/CCTMXTiledMap.m | 202 ---- Classes/cocos2d/CCTMXXMLParser.h | 200 ---- Classes/cocos2d/CCTMXXMLParser.m | 444 ------- Classes/cocos2d/CCTexture2D.h | 308 ----- Classes/cocos2d/CCTexture2D.m | 754 ------------ Classes/cocos2d/CCTextureAtlas.h | 138 --- Classes/cocos2d/CCTextureAtlas.m | 343 ------ Classes/cocos2d/CCTextureCache.h | 139 --- Classes/cocos2d/CCTextureCache.m | 466 -------- Classes/cocos2d/CCTexturePVR.h | 118 -- Classes/cocos2d/CCTexturePVR.m | 407 ------- Classes/cocos2d/CCTileMapAtlas.h | 82 -- Classes/cocos2d/CCTileMapAtlas.m | 233 ---- Classes/cocos2d/CCTransition.h | 295 ----- Classes/cocos2d/CCTransition.m | 1057 ----------------- Classes/cocos2d/CCTransitionPageTurn.h | 60 - Classes/cocos2d/CCTransitionPageTurn.m | 117 -- Classes/cocos2d/CCTransitionRadial.h | 40 - Classes/cocos2d/CCTransitionRadial.m | 115 -- Classes/cocos2d/Platforms/CCGL.h | 82 -- Classes/cocos2d/Platforms/CCNS.h | 62 - Classes/cocos2d/Platforms/Mac/CCDirectorMac.h | 99 -- Classes/cocos2d/Platforms/Mac/CCDirectorMac.m | 471 -------- Classes/cocos2d/Platforms/Mac/CCEventDispatcher.h | 233 ---- Classes/cocos2d/Platforms/Mac/CCEventDispatcher.m | 578 ---------- Classes/cocos2d/Platforms/Mac/MacGLView.h | 88 -- Classes/cocos2d/Platforms/Mac/MacGLView.m | 241 ---- Classes/cocos2d/Platforms/iOS/CCDirectorIOS.h | 342 ------ Classes/cocos2d/Platforms/iOS/CCDirectorIOS.m | 897 --------------- .../Platforms/iOS/CCTouchDelegateProtocol.h | 75 -- Classes/cocos2d/Platforms/iOS/CCTouchDispatcher.h | 122 -- Classes/cocos2d/Platforms/iOS/CCTouchDispatcher.m | 326 ------ Classes/cocos2d/Platforms/iOS/CCTouchHandler.h | 93 -- Classes/cocos2d/Platforms/iOS/CCTouchHandler.m | 135 --- Classes/cocos2d/Platforms/iOS/EAGLView.h | 155 --- Classes/cocos2d/Platforms/iOS/EAGLView.m | 342 ------ Classes/cocos2d/Platforms/iOS/ES1Renderer.h | 71 -- Classes/cocos2d/Platforms/iOS/ES1Renderer.m | 252 ---- Classes/cocos2d/Platforms/iOS/ESRenderer.h | 53 - Classes/cocos2d/Platforms/iOS/glu.c | 113 -- Classes/cocos2d/Platforms/iOS/glu.h | 29 - Classes/cocos2d/Support/CCArray.h | 92 -- Classes/cocos2d/Support/CCArray.m | 245 ---- Classes/cocos2d/Support/CCFileUtils.h | 61 - Classes/cocos2d/Support/CCFileUtils.m | 168 --- Classes/cocos2d/Support/CCProfiling.h | 53 - Classes/cocos2d/Support/CCProfiling.m | 117 -- Classes/cocos2d/Support/CGPointExtension.h | 321 ------ Classes/cocos2d/Support/CGPointExtension.m | 167 --- Classes/cocos2d/Support/OpenGL_Internal.h | 80 -- Classes/cocos2d/Support/TGAlib.h | 55 - Classes/cocos2d/Support/TGAlib.m | 272 ----- Classes/cocos2d/Support/TransformUtils.h | 37 - Classes/cocos2d/Support/TransformUtils.m | 46 - Classes/cocos2d/Support/ZipUtils.h | 78 -- Classes/cocos2d/Support/ZipUtils.m | 246 ---- Classes/cocos2d/Support/base64.c | 89 -- Classes/cocos2d/Support/base64.h | 33 - Classes/cocos2d/Support/ccCArray.h | 406 ------- Classes/cocos2d/Support/ccUtils.c | 20 - Classes/cocos2d/Support/ccUtils.h | 29 - Classes/cocos2d/Support/uthash.h | 956 --------------- Classes/cocos2d/Support/utlist.h | 493 -------- Classes/cocos2d/ccConfig.h | 291 ----- Classes/cocos2d/ccMacros.h | 227 ---- Classes/cocos2d/ccTypes.h | 262 ----- Classes/cocos2d/cocos2d.h | 165 --- Classes/cocos2d/cocos2d.m | 33 - 166 files changed, 0 insertions(+), 41582 deletions(-) delete mode 100644 Classes/cocos2d/CCAction.h delete mode 100644 Classes/cocos2d/CCAction.m delete mode 100644 Classes/cocos2d/CCActionCamera.h delete mode 100644 Classes/cocos2d/CCActionCamera.m delete mode 100644 Classes/cocos2d/CCActionEase.h delete mode 100644 Classes/cocos2d/CCActionEase.m delete mode 100644 Classes/cocos2d/CCActionGrid.h delete mode 100644 Classes/cocos2d/CCActionGrid.m delete mode 100644 Classes/cocos2d/CCActionGrid3D.h delete mode 100644 Classes/cocos2d/CCActionGrid3D.m delete mode 100644 Classes/cocos2d/CCActionInstant.h delete mode 100644 Classes/cocos2d/CCActionInstant.m delete mode 100644 Classes/cocos2d/CCActionInterval.h delete mode 100644 Classes/cocos2d/CCActionInterval.m delete mode 100644 Classes/cocos2d/CCActionManager.h delete mode 100644 Classes/cocos2d/CCActionManager.m delete mode 100644 Classes/cocos2d/CCActionPageTurn3D.h delete mode 100644 Classes/cocos2d/CCActionPageTurn3D.m delete mode 100644 Classes/cocos2d/CCActionProgressTimer.h delete mode 100644 Classes/cocos2d/CCActionProgressTimer.m delete mode 100644 Classes/cocos2d/CCActionTiledGrid.h delete mode 100644 Classes/cocos2d/CCActionTiledGrid.m delete mode 100644 Classes/cocos2d/CCActionTween.h delete mode 100644 Classes/cocos2d/CCActionTween.m delete mode 100644 Classes/cocos2d/CCAnimation.h delete mode 100644 Classes/cocos2d/CCAnimation.m delete mode 100644 Classes/cocos2d/CCAnimationCache.h delete mode 100644 Classes/cocos2d/CCAnimationCache.m delete mode 100644 Classes/cocos2d/CCAtlasNode.h delete mode 100644 Classes/cocos2d/CCAtlasNode.m delete mode 100644 Classes/cocos2d/CCBlockSupport.h delete mode 100644 Classes/cocos2d/CCBlockSupport.m delete mode 100644 Classes/cocos2d/CCCamera.h delete mode 100644 Classes/cocos2d/CCCamera.m delete mode 100644 Classes/cocos2d/CCCompatibility.h delete mode 100644 Classes/cocos2d/CCCompatibility.m delete mode 100644 Classes/cocos2d/CCConfiguration.h delete mode 100644 Classes/cocos2d/CCConfiguration.m delete mode 100644 Classes/cocos2d/CCDirector.h delete mode 100644 Classes/cocos2d/CCDirector.m delete mode 100644 Classes/cocos2d/CCDrawingPrimitives.h delete mode 100644 Classes/cocos2d/CCDrawingPrimitives.m delete mode 100644 Classes/cocos2d/CCGrabber.h delete mode 100644 Classes/cocos2d/CCGrabber.m delete mode 100644 Classes/cocos2d/CCGrid.h delete mode 100644 Classes/cocos2d/CCGrid.m delete mode 100644 Classes/cocos2d/CCLabelAtlas.h delete mode 100644 Classes/cocos2d/CCLabelAtlas.m delete mode 100644 Classes/cocos2d/CCLabelBMFont.h delete mode 100644 Classes/cocos2d/CCLabelBMFont.m delete mode 100644 Classes/cocos2d/CCLabelTTF.h delete mode 100644 Classes/cocos2d/CCLabelTTF.m delete mode 100644 Classes/cocos2d/CCLayer.h delete mode 100644 Classes/cocos2d/CCLayer.m delete mode 100644 Classes/cocos2d/CCMenu.h delete mode 100644 Classes/cocos2d/CCMenu.m delete mode 100644 Classes/cocos2d/CCMenuItem.h delete mode 100644 Classes/cocos2d/CCMenuItem.m delete mode 100644 Classes/cocos2d/CCMotionStreak.h delete mode 100644 Classes/cocos2d/CCMotionStreak.m delete mode 100644 Classes/cocos2d/CCNode.h delete mode 100644 Classes/cocos2d/CCNode.m delete mode 100644 Classes/cocos2d/CCParallaxNode.h delete mode 100644 Classes/cocos2d/CCParallaxNode.m delete mode 100644 Classes/cocos2d/CCParticleExamples.h delete mode 100644 Classes/cocos2d/CCParticleExamples.m delete mode 100644 Classes/cocos2d/CCParticleSystem.h delete mode 100644 Classes/cocos2d/CCParticleSystem.m delete mode 100644 Classes/cocos2d/CCParticleSystemPoint.h delete mode 100644 Classes/cocos2d/CCParticleSystemPoint.m delete mode 100644 Classes/cocos2d/CCParticleSystemQuad.h delete mode 100644 Classes/cocos2d/CCParticleSystemQuad.m delete mode 100644 Classes/cocos2d/CCProgressTimer.h delete mode 100644 Classes/cocos2d/CCProgressTimer.m delete mode 100644 Classes/cocos2d/CCProtocols.h delete mode 100755 Classes/cocos2d/CCRenderTexture.h delete mode 100755 Classes/cocos2d/CCRenderTexture.m delete mode 100644 Classes/cocos2d/CCRibbon.h delete mode 100644 Classes/cocos2d/CCRibbon.m delete mode 100644 Classes/cocos2d/CCScene.h delete mode 100644 Classes/cocos2d/CCScene.m delete mode 100644 Classes/cocos2d/CCScheduler.h delete mode 100644 Classes/cocos2d/CCScheduler.m delete mode 100644 Classes/cocos2d/CCSprite.h delete mode 100644 Classes/cocos2d/CCSprite.m delete mode 100644 Classes/cocos2d/CCSpriteBatchNode.h delete mode 100644 Classes/cocos2d/CCSpriteBatchNode.m delete mode 100644 Classes/cocos2d/CCSpriteFrame.h delete mode 100644 Classes/cocos2d/CCSpriteFrame.m delete mode 100644 Classes/cocos2d/CCSpriteFrameCache.h delete mode 100644 Classes/cocos2d/CCSpriteFrameCache.m delete mode 100644 Classes/cocos2d/CCSpriteSheet.h delete mode 100644 Classes/cocos2d/CCSpriteSheet.m delete mode 100644 Classes/cocos2d/CCTMXLayer.h delete mode 100644 Classes/cocos2d/CCTMXLayer.m delete mode 100644 Classes/cocos2d/CCTMXObjectGroup.h delete mode 100644 Classes/cocos2d/CCTMXObjectGroup.m delete mode 100644 Classes/cocos2d/CCTMXTiledMap.h delete mode 100644 Classes/cocos2d/CCTMXTiledMap.m delete mode 100644 Classes/cocos2d/CCTMXXMLParser.h delete mode 100644 Classes/cocos2d/CCTMXXMLParser.m delete mode 100644 Classes/cocos2d/CCTexture2D.h delete mode 100644 Classes/cocos2d/CCTexture2D.m delete mode 100644 Classes/cocos2d/CCTextureAtlas.h delete mode 100644 Classes/cocos2d/CCTextureAtlas.m delete mode 100644 Classes/cocos2d/CCTextureCache.h delete mode 100644 Classes/cocos2d/CCTextureCache.m delete mode 100644 Classes/cocos2d/CCTexturePVR.h delete mode 100644 Classes/cocos2d/CCTexturePVR.m delete mode 100644 Classes/cocos2d/CCTileMapAtlas.h delete mode 100644 Classes/cocos2d/CCTileMapAtlas.m delete mode 100644 Classes/cocos2d/CCTransition.h delete mode 100644 Classes/cocos2d/CCTransition.m delete mode 100644 Classes/cocos2d/CCTransitionPageTurn.h delete mode 100644 Classes/cocos2d/CCTransitionPageTurn.m delete mode 100644 Classes/cocos2d/CCTransitionRadial.h delete mode 100644 Classes/cocos2d/CCTransitionRadial.m delete mode 100644 Classes/cocos2d/Platforms/CCGL.h delete mode 100644 Classes/cocos2d/Platforms/CCNS.h delete mode 100644 Classes/cocos2d/Platforms/Mac/CCDirectorMac.h delete mode 100644 Classes/cocos2d/Platforms/Mac/CCDirectorMac.m delete mode 100644 Classes/cocos2d/Platforms/Mac/CCEventDispatcher.h delete mode 100644 Classes/cocos2d/Platforms/Mac/CCEventDispatcher.m delete mode 100644 Classes/cocos2d/Platforms/Mac/MacGLView.h delete mode 100644 Classes/cocos2d/Platforms/Mac/MacGLView.m delete mode 100755 Classes/cocos2d/Platforms/iOS/CCDirectorIOS.h delete mode 100755 Classes/cocos2d/Platforms/iOS/CCDirectorIOS.m delete mode 100644 Classes/cocos2d/Platforms/iOS/CCTouchDelegateProtocol.h delete mode 100644 Classes/cocos2d/Platforms/iOS/CCTouchDispatcher.h delete mode 100644 Classes/cocos2d/Platforms/iOS/CCTouchDispatcher.m delete mode 100644 Classes/cocos2d/Platforms/iOS/CCTouchHandler.h delete mode 100644 Classes/cocos2d/Platforms/iOS/CCTouchHandler.m delete mode 100755 Classes/cocos2d/Platforms/iOS/EAGLView.h delete mode 100755 Classes/cocos2d/Platforms/iOS/EAGLView.m delete mode 100755 Classes/cocos2d/Platforms/iOS/ES1Renderer.h delete mode 100755 Classes/cocos2d/Platforms/iOS/ES1Renderer.m delete mode 100755 Classes/cocos2d/Platforms/iOS/ESRenderer.h delete mode 100755 Classes/cocos2d/Platforms/iOS/glu.c delete mode 100644 Classes/cocos2d/Platforms/iOS/glu.h delete mode 100644 Classes/cocos2d/Support/CCArray.h delete mode 100644 Classes/cocos2d/Support/CCArray.m delete mode 100644 Classes/cocos2d/Support/CCFileUtils.h delete mode 100644 Classes/cocos2d/Support/CCFileUtils.m delete mode 100644 Classes/cocos2d/Support/CCProfiling.h delete mode 100644 Classes/cocos2d/Support/CCProfiling.m delete mode 100644 Classes/cocos2d/Support/CGPointExtension.h delete mode 100644 Classes/cocos2d/Support/CGPointExtension.m delete mode 100644 Classes/cocos2d/Support/OpenGL_Internal.h delete mode 100644 Classes/cocos2d/Support/TGAlib.h delete mode 100644 Classes/cocos2d/Support/TGAlib.m delete mode 100644 Classes/cocos2d/Support/TransformUtils.h delete mode 100644 Classes/cocos2d/Support/TransformUtils.m delete mode 100644 Classes/cocos2d/Support/ZipUtils.h delete mode 100644 Classes/cocos2d/Support/ZipUtils.m delete mode 100644 Classes/cocos2d/Support/base64.c delete mode 100644 Classes/cocos2d/Support/base64.h delete mode 100644 Classes/cocos2d/Support/ccCArray.h delete mode 100644 Classes/cocos2d/Support/ccUtils.c delete mode 100644 Classes/cocos2d/Support/ccUtils.h delete mode 100644 Classes/cocos2d/Support/uthash.h delete mode 100644 Classes/cocos2d/Support/utlist.h delete mode 100644 Classes/cocos2d/ccConfig.h delete mode 100644 Classes/cocos2d/ccMacros.h delete mode 100644 Classes/cocos2d/ccTypes.h delete mode 100644 Classes/cocos2d/cocos2d.h delete mode 100644 Classes/cocos2d/cocos2d.m diff --git a/Classes/cocos2d/CCAction.h b/Classes/cocos2d/CCAction.h deleted file mode 100644 index 327a251..0000000 --- a/Classes/cocos2d/CCAction.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2010 Ricardo Quesada - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#include -#import - -#import "ccTypes.h" - -enum { - //! Default tag - kCCActionTagInvalid = -1, -}; - -/** Base class for CCAction objects. - */ -@interface CCAction : NSObject -{ - id originalTarget_; - id target_; - NSInteger tag_; -} - -/** The "target". The action will modify the target properties. - The target will be set with the 'startWithTarget' method. - When the 'stop' method is called, target will be set to nil. - The target is 'assigned', it is not 'retained'. - */ -@property (nonatomic,readonly,assign) id target; - -/** The original target, since target can be nil. - Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method. - @since v0.8.2 -*/ -@property (nonatomic,readonly,assign) id originalTarget; - - -/** The action tag. An identifier of the action */ -@property (nonatomic,readwrite,assign) NSInteger tag; - -/** Allocates and initializes the action */ -+(id) action; - -/** Initializes the action */ --(id) init; - --(id) copyWithZone: (NSZone*) zone; - -//! return YES if the action has finished --(BOOL) isDone; -//! called before the action start. It will also set the target. --(void) startWithTarget:(id)target; -//! called after the action has finished. It will set the 'target' to nil. -//! IMPORTANT: You should never call "[action stop]" manually. Instead, use: "[target stopAction:action];" --(void) stop; -//! called every frame with it's delta time. DON'T override unless you know what you are doing. --(void) step: (ccTime) dt; -//! called once per frame. time a value between 0 and 1 -//! For example: -//! * 0 means that the action just started -//! * 0.5 means that the action is in the middle -//! * 1 means that the action is over --(void) update: (ccTime) time; - -@end - -/** Base class actions that do have a finite time duration. - Possible actions: - - An action with a duration of 0 seconds - - An action with a duration of 35.5 seconds - Infitite time actions are valid - */ -@interface CCFiniteTimeAction : CCAction -{ - //! duration in seconds - ccTime duration_; -} -//! duration in seconds of the action -@property (nonatomic,readwrite) ccTime duration; - -/** returns a reversed action */ -- (CCFiniteTimeAction*) reverse; -@end - - -@class CCActionInterval; -/** Repeats an action for ever. - To repeat the an action for a limited number of times use the Repeat action. - @warning This action can't be Sequenceable because it is not an IntervalAction - */ -@interface CCRepeatForever : CCAction -{ - CCActionInterval *other; -} -/** creates the action */ -+(id) actionWithAction: (CCActionInterval*) action; -/** initializes the action */ --(id) initWithAction: (CCActionInterval*) action; -@end - -/** Changes the speed of an action, making it take longer (speed>1) - or less (speed<1) time. - Useful to simulate 'slow motion' or 'fast forward' effect. - @warning This action can't be Sequenceable because it is not an IntervalAction - */ -@interface CCSpeed : CCAction -{ - CCActionInterval *other; - float speed; -} -/** alter the speed of the inner function in runtime */ -@property (nonatomic,readwrite) float speed; -/** creates the action */ -+(id) actionWithAction: (CCActionInterval*) action speed:(float)rate; -/** initializes the action */ --(id) initWithAction: (CCActionInterval*) action speed:(float)rate; -@end - -@class CCNode; -/** CCFollow is an action that "follows" a node. - - Eg: - [layer runAction: [CCFollow actionWithTarget:hero]]; - - Instead of using CCCamera as a "follower", use this action instead. - @since v0.99.2 - */ -@interface CCFollow : CCAction -{ - /* node to follow */ - CCNode *followedNode_; - - /* whether camera should be limited to certain area */ - BOOL boundarySet; - - /* if screensize is bigger than the boundary - update not needed */ - BOOL boundaryFullyCovered; - - /* fast access to the screen dimensions */ - CGPoint halfScreenSize; - CGPoint fullScreenSize; - - /* world boundaries */ - float leftBoundary; - float rightBoundary; - float topBoundary; - float bottomBoundary; -} - -/** alter behavior - turn on/off boundary */ -@property (nonatomic,readwrite) BOOL boundarySet; - -/** creates the action with no boundary set */ -+(id) actionWithTarget:(CCNode *)followedNode; - -/** creates the action with a set boundary */ -+(id) actionWithTarget:(CCNode *)followedNode worldBoundary:(CGRect)rect; - -/** initializes the action */ --(id) initWithTarget:(CCNode *)followedNode; - -/** initializes the action with a set boundary */ --(id) initWithTarget:(CCNode *)followedNode worldBoundary:(CGRect)rect; - -@end - diff --git a/Classes/cocos2d/CCAction.m b/Classes/cocos2d/CCAction.m deleted file mode 100644 index 8fc3b4c..0000000 --- a/Classes/cocos2d/CCAction.m +++ /dev/null @@ -1,360 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2010 Ricardo Quesada - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - - -#import -#import "CCDirector.h" -#import "ccMacros.h" -#import "CCAction.h" -#import "CCActionInterval.h" -#import "Support/CGPointExtension.h" - -// -// Action Base Class -// -#pragma mark - -#pragma mark Action -@implementation CCAction - -@synthesize tag = tag_, target = target_, originalTarget = originalTarget_; - -+(id) action -{ - return [[[self alloc] init] autorelease]; -} - --(id) init -{ - if( (self=[super init]) ) { - originalTarget_ = target_ = nil; - tag_ = kCCActionTagInvalid; - } - return self; -} - --(void) dealloc -{ - CCLOGINFO(@"cocos2d: deallocing %@", self); - [super dealloc]; -} - --(NSString*) description -{ - return [NSString stringWithFormat:@"<%@ = %08X | Tag = %i>", [self class], self, tag_]; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone: zone] init]; - copy.tag = tag_; - return copy; -} - --(void) startWithTarget:(id)aTarget -{ - originalTarget_ = target_ = aTarget; -} - --(void) stop -{ - target_ = nil; -} - --(BOOL) isDone -{ - return YES; -} - --(void) step: (ccTime) dt -{ - NSLog(@"[Action step]. override me"); -} - --(void) update: (ccTime) time -{ - NSLog(@"[Action update]. override me"); -} -@end - -// -// FiniteTimeAction -// -#pragma mark - -#pragma mark FiniteTimeAction -@implementation CCFiniteTimeAction -@synthesize duration = duration_; - -- (CCFiniteTimeAction*) reverse -{ - CCLOG(@"cocos2d: FiniteTimeAction#reverse: Implement me"); - return nil; -} -@end - - -// -// RepeatForever -// -#pragma mark - -#pragma mark RepeatForever -@implementation CCRepeatForever -+(id) actionWithAction: (CCActionInterval*) action -{ - return [[[self alloc] initWithAction: action] autorelease]; -} - --(id) initWithAction: (CCActionInterval*) action -{ - if( (self=[super init]) ) - other = [action retain]; - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone: zone] initWithAction:[[other copy] autorelease] ]; - return copy; -} - --(void) dealloc -{ - [other release]; - [super dealloc]; -} - --(void) startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - [other startWithTarget:target_]; -} - --(void) step:(ccTime) dt -{ - [other step: dt]; - if( [other isDone] ) { - ccTime diff = dt + other.duration - other.elapsed; - [other startWithTarget:target_]; - - // to prevent jerk. issue #390 - [other step: diff]; - } -} - - --(BOOL) isDone -{ - return NO; -} - -- (CCActionInterval *) reverse -{ - return [CCRepeatForever actionWithAction:[other reverse]]; -} - -@end - -// -// Speed -// -#pragma mark - -#pragma mark Speed -@implementation CCSpeed -@synthesize speed; - -+(id) actionWithAction: (CCActionInterval*) action speed:(float)r -{ - return [[[self alloc] initWithAction: action speed:r] autorelease]; -} - --(id) initWithAction: (CCActionInterval*) action speed:(float)r -{ - if( (self=[super init]) ) { - other = [action retain]; - speed = r; - } - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone: zone] initWithAction:[[other copy] autorelease] speed:speed]; - return copy; -} - --(void) dealloc -{ - [other release]; - [super dealloc]; -} - --(void) startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - [other startWithTarget:target_]; -} - --(void) stop -{ - [other stop]; - [super stop]; -} - --(void) step:(ccTime) dt -{ - [other step: dt * speed]; -} - --(BOOL) isDone -{ - return [other isDone]; -} - -- (CCActionInterval *) reverse -{ - return [CCSpeed actionWithAction:[other reverse] speed:speed]; -} -@end - -// -// Follow -// -#pragma mark - -#pragma mark Follow -@implementation CCFollow - -@synthesize boundarySet; - -+(id) actionWithTarget:(CCNode *) fNode -{ - return [[[self alloc] initWithTarget:fNode] autorelease]; -} - -+(id) actionWithTarget:(CCNode *) fNode worldBoundary:(CGRect)rect -{ - return [[[self alloc] initWithTarget:fNode worldBoundary:rect] autorelease]; -} - --(id) initWithTarget:(CCNode *)fNode -{ - if( (self=[super init]) ) { - - followedNode_ = [fNode retain]; - boundarySet = FALSE; - boundaryFullyCovered = FALSE; - - CGSize s = [[CCDirector sharedDirector] winSize]; - fullScreenSize = CGPointMake(s.width, s.height); - halfScreenSize = ccpMult(fullScreenSize, .5f); - } - - return self; -} - --(id) initWithTarget:(CCNode *)fNode worldBoundary:(CGRect)rect -{ - if( (self=[super init]) ) { - - followedNode_ = [fNode retain]; - boundarySet = TRUE; - boundaryFullyCovered = FALSE; - - CGSize winSize = [[CCDirector sharedDirector] winSize]; - fullScreenSize = CGPointMake(winSize.width, winSize.height); - halfScreenSize = ccpMult(fullScreenSize, .5f); - - leftBoundary = -((rect.origin.x+rect.size.width) - fullScreenSize.x); - rightBoundary = -rect.origin.x ; - topBoundary = -rect.origin.y; - bottomBoundary = -((rect.origin.y+rect.size.height) - fullScreenSize.y); - - if(rightBoundary < leftBoundary) - { - // screen width is larger than world's boundary width - //set both in the middle of the world - rightBoundary = leftBoundary = (leftBoundary + rightBoundary) / 2; - } - if(topBoundary < bottomBoundary) - { - // screen width is larger than world's boundary width - //set both in the middle of the world - topBoundary = bottomBoundary = (topBoundary + bottomBoundary) / 2; - } - - if( (topBoundary == bottomBoundary) && (leftBoundary == rightBoundary) ) - boundaryFullyCovered = TRUE; - } - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone: zone] init]; - copy.tag = tag_; - return copy; -} - --(void) step:(ccTime) dt -{ -#define CLAMP(x,y,z) MIN(MAX(x,y),z) - - if(boundarySet) - { - // whole map fits inside a single screen, no need to modify the position - unless map boundaries are increased - if(boundaryFullyCovered) - return; - - CGPoint tempPos = ccpSub( halfScreenSize, followedNode_.position); - [target_ setPosition:ccp(CLAMP(tempPos.x,leftBoundary,rightBoundary), CLAMP(tempPos.y,bottomBoundary,topBoundary))]; - } - else - [target_ setPosition:ccpSub( halfScreenSize, followedNode_.position )]; - -#undef CLAMP -} - - --(BOOL) isDone -{ - return !followedNode_.isRunning; -} - --(void) stop -{ - target_ = nil; - [super stop]; -} - --(void) dealloc -{ - [followedNode_ release]; - [super dealloc]; -} - -@end - - diff --git a/Classes/cocos2d/CCActionCamera.h b/Classes/cocos2d/CCActionCamera.h deleted file mode 100644 index 131c084..0000000 --- a/Classes/cocos2d/CCActionCamera.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2010 Ricardo Quesada - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#import "CCActionInterval.h" - -@class CCCamera; - -/** Base class for CCCamera actions - */ -@interface CCActionCamera : CCActionInterval -{ - float centerXOrig_; - float centerYOrig_; - float centerZOrig_; - - float eyeXOrig_; - float eyeYOrig_; - float eyeZOrig_; - - float upXOrig_; - float upYOrig_; - float upZOrig_; -} -@end - -/** CCOrbitCamera action - Orbits the camera around the center of the screen using spherical coordinates - */ -@interface CCOrbitCamera : CCActionCamera -{ - float radius_; - float deltaRadius_; - float angleZ_; - float deltaAngleZ_; - float angleX_; - float deltaAngleX_; - - float radZ_; - float radDeltaZ_; - float radX_; - float radDeltaX_; - -} -/** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */ -+(id) actionWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx; -/** initializes a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */ --(id) initWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx; -/** positions the camera according to spherical coordinates */ --(void) sphericalRadius:(float*) r zenith:(float*) zenith azimuth:(float*) azimuth; -@end diff --git a/Classes/cocos2d/CCActionCamera.m b/Classes/cocos2d/CCActionCamera.m deleted file mode 100644 index 5134c6f..0000000 --- a/Classes/cocos2d/CCActionCamera.m +++ /dev/null @@ -1,146 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2010 Ricardo Quesada - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - - -#import "CCActionCamera.h" -#import "CCNode.h" -#import "CCCamera.h" -#import "ccMacros.h" - -// -// CameraAction -// -@implementation CCActionCamera --(void) startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - CCCamera *camera = [target_ camera]; - [camera centerX:¢erXOrig_ centerY:¢erYOrig_ centerZ:¢erZOrig_]; - [camera eyeX:&eyeXOrig_ eyeY:&eyeYOrig_ eyeZ:&eyeZOrig_]; - [camera upX:&upXOrig_ upY:&upYOrig_ upZ: &upZOrig_]; -} - --(id) reverse -{ - return [CCReverseTime actionWithAction:self]; -} -@end - -@implementation CCOrbitCamera -+(id) actionWithDuration:(float)t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx -{ - return [[[self alloc] initWithDuration:t radius:r deltaRadius:dr angleZ:z deltaAngleZ:dz angleX:x deltaAngleX:dx] autorelease]; -} - --(id) copyWithZone: (NSZone*) zone -{ - return [[[self class] allocWithZone: zone] initWithDuration:duration_ radius:radius_ deltaRadius:deltaRadius_ angleZ:angleZ_ deltaAngleZ:deltaAngleZ_ angleX:angleX_ deltaAngleX:deltaAngleX_]; -} - - --(id) initWithDuration:(float)t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx -{ - if((self=[super initWithDuration:t]) ) { - - radius_ = r; - deltaRadius_ = dr; - angleZ_ = z; - deltaAngleZ_ = dz; - angleX_ = x; - deltaAngleX_ = dx; - - radDeltaZ_ = (CGFloat)CC_DEGREES_TO_RADIANS(dz); - radDeltaX_ = (CGFloat)CC_DEGREES_TO_RADIANS(dx); - } - - return self; -} - --(void) startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - float r, zenith, azimuth; - - [self sphericalRadius: &r zenith:&zenith azimuth:&azimuth]; - -#if 0 // isnan() is not supported on the simulator, and isnan() always returns false. - if( isnan(radius_) ) - radius_ = r; - - if( isnan( angleZ_) ) - angleZ_ = (CGFloat)CC_RADIANS_TO_DEGREES(zenith); - - if( isnan( angleX_ ) ) - angleX_ = (CGFloat)CC_RADIANS_TO_DEGREES(azimuth); -#endif - - radZ_ = (CGFloat)CC_DEGREES_TO_RADIANS(angleZ_); - radX_ = (CGFloat)CC_DEGREES_TO_RADIANS(angleX_); -} - --(void) update: (ccTime) dt -{ - float r = (radius_ + deltaRadius_ * dt) *[CCCamera getZEye]; - float za = radZ_ + radDeltaZ_ * dt; - float xa = radX_ + radDeltaX_ * dt; - - float i = sinf(za) * cosf(xa) * r + centerXOrig_; - float j = sinf(za) * sinf(xa) * r + centerYOrig_; - float k = cosf(za) * r + centerZOrig_; - - [[target_ camera] setEyeX:i eyeY:j eyeZ:k]; -} - --(void) sphericalRadius:(float*) newRadius zenith:(float*) zenith azimuth:(float*) azimuth -{ - float ex, ey, ez, cx, cy, cz, x, y, z; - float r; // radius - float s; - - CCCamera *camera = [target_ camera]; - [camera eyeX:&ex eyeY:&ey eyeZ:&ez]; - [camera centerX:&cx centerY:&cy centerZ:&cz]; - - x = ex-cx; - y = ey-cy; - z = ez-cz; - - r = sqrtf( x*x + y*y + z*z); - s = sqrtf( x*x + y*y); - if(s==0.0f) - s = FLT_EPSILON; - if(r==0.0f) - r = FLT_EPSILON; - - *zenith = acosf( z/r); - if( x < 0 ) - *azimuth = (float)M_PI - asinf(y/s); - else - *azimuth = asinf(y/s); - - *newRadius = r / [CCCamera getZEye]; -} -@end diff --git a/Classes/cocos2d/CCActionEase.h b/Classes/cocos2d/CCActionEase.h deleted file mode 100644 index fced701..0000000 --- a/Classes/cocos2d/CCActionEase.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2009 Jason Booth - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCActionInterval.h" - -/** Base class for Easing actions - */ -@interface CCActionEase : CCActionInterval -{ - CCActionInterval * other; -} -/** creates the action */ -+(id) actionWithAction: (CCActionInterval*) action; -/** initializes the action */ --(id) initWithAction: (CCActionInterval*) action; -@end - -/** Base class for Easing actions with rate parameters - */ -@interface CCEaseRateAction : CCActionEase -{ - float rate; -} -/** rate value for the actions */ -@property (nonatomic,readwrite,assign) float rate; -/** Creates the action with the inner action and the rate parameter */ -+(id) actionWithAction: (CCActionInterval*) action rate:(float)rate; -/** Initializes the action with the inner action and the rate parameter */ --(id) initWithAction: (CCActionInterval*) action rate:(float)rate; -@end - -/** CCEaseIn action with a rate - */ -@interface CCEaseIn : CCEaseRateAction {} @end - -/** CCEaseOut action with a rate - */ -@interface CCEaseOut : CCEaseRateAction {} @end - -/** CCEaseInOut action with a rate - */ -@interface CCEaseInOut : CCEaseRateAction {} @end - -/** CCEase Exponential In - */ -@interface CCEaseExponentialIn : CCActionEase {} @end -/** Ease Exponential Out - */ -@interface CCEaseExponentialOut : CCActionEase {} @end -/** Ease Exponential InOut - */ -@interface CCEaseExponentialInOut : CCActionEase {} @end -/** Ease Sine In - */ -@interface CCEaseSineIn : CCActionEase {} @end -/** Ease Sine Out - */ -@interface CCEaseSineOut : CCActionEase {} @end -/** Ease Sine InOut - */ -@interface CCEaseSineInOut : CCActionEase {} @end - -/** Ease Elastic abstract class - @since v0.8.2 - */ -@interface CCEaseElastic : CCActionEase -{ - float period_; -} - -/** period of the wave in radians. default is 0.3 */ -@property (nonatomic,readwrite) float period; - -/** Creates the action with the inner action and the period in radians (default is 0.3) */ -+(id) actionWithAction: (CCActionInterval*) action period:(float)period; -/** Initializes the action with the inner action and the period in radians (default is 0.3) */ --(id) initWithAction: (CCActionInterval*) action period:(float)period; -@end - -/** Ease Elastic In action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseElasticIn : CCEaseElastic {} @end -/** Ease Elastic Out action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseElasticOut : CCEaseElastic {} @end -/** Ease Elastic InOut action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseElasticInOut : CCEaseElastic {} @end - -/** CCEaseBounce abstract class. - @since v0.8.2 -*/ -@interface CCEaseBounce : CCActionEase {} @end - -/** CCEaseBounceIn action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 -*/ -@interface CCEaseBounceIn : CCEaseBounce {} @end - -/** EaseBounceOut action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseBounceOut : CCEaseBounce {} @end - -/** CCEaseBounceInOut action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseBounceInOut : CCEaseBounce {} @end - -/** CCEaseBackIn action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseBackIn : CCActionEase {} @end - -/** CCEaseBackOut action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseBackOut : CCActionEase {} @end - -/** CCEaseBackInOut action. - @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action. - @since v0.8.2 - */ -@interface CCEaseBackInOut : CCActionEase {} @end - diff --git a/Classes/cocos2d/CCActionEase.m b/Classes/cocos2d/CCActionEase.m deleted file mode 100644 index f28be11..0000000 --- a/Classes/cocos2d/CCActionEase.m +++ /dev/null @@ -1,534 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2009 Jason Booth - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -/* - * Elastic, Back and Bounce actions based on code from: - * http://github.com/NikhilK/silverlightfx/ - * - * by http://github.com/NikhilK - */ - -#import "CCActionEase.h" - -#ifndef M_PI_X_2 -#define M_PI_X_2 (float)M_PI * 2.0f -#endif - -#pragma mark EaseAction - -// -// EaseAction -// -@implementation CCActionEase - -+(id) actionWithAction: (CCActionInterval*) action -{ - return [[[self alloc] initWithAction: action] autorelease ]; -} - --(id) initWithAction: (CCActionInterval*) action -{ - NSAssert( action!=nil, @"Ease: arguments must be non-nil"); - - if( (self=[super initWithDuration: action.duration]) ) - other = [action retain]; - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone:zone] initWithAction:[[other copy] autorelease]]; - return copy; -} - --(void) dealloc -{ - [other release]; - [super dealloc]; -} - --(void) startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - [other startWithTarget:target_]; -} - --(void) stop -{ - [other stop]; - [super stop]; -} - --(void) update: (ccTime) t -{ - [other update: t]; -} - --(CCActionInterval*) reverse -{ - return [[self class] actionWithAction: [other reverse]]; -} -@end - - -#pragma mark - -#pragma mark EaseRate - -// -// EaseRateAction -// -@implementation CCEaseRateAction -@synthesize rate; -+(id) actionWithAction: (CCActionInterval*) action rate:(float)aRate -{ - return [[[self alloc] initWithAction: action rate:aRate] autorelease ]; -} - --(id) initWithAction: (CCActionInterval*) action rate:(float)aRate -{ - if( (self=[super initWithAction:action ]) ) - self.rate = aRate; - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone:zone] initWithAction:[[other copy] autorelease] rate:rate]; - return copy; -} - --(void) dealloc -{ - [super dealloc]; -} - --(CCActionInterval*) reverse -{ - return [[self class] actionWithAction: [other reverse] rate:1/rate]; -} -@end - -// -// EeseIn -// -@implementation CCEaseIn --(void) update: (ccTime) t -{ - [other update: powf(t,rate)]; -} -@end - -// -// EaseOut -// -@implementation CCEaseOut --(void) update: (ccTime) t -{ - [other update: powf(t,1/rate)]; -} -@end - -// -// EaseInOut -// -@implementation CCEaseInOut --(void) update: (ccTime) t -{ - int sign =1; - int r = (int) rate; - if (r % 2 == 0) - sign = -1; - t *= 2; - if (t < 1) - [other update: 0.5f * powf (t, rate)]; - else - [other update: sign*0.5f * (powf (t-2, rate) + sign*2)]; -} - -// InOut and OutIn are symmetrical --(CCActionInterval*) reverse -{ - return [[self class] actionWithAction: [other reverse] rate:rate]; -} - -@end - -#pragma mark - -#pragma mark EaseExponential - -// -// EaseExponentialIn -// -@implementation CCEaseExponentialIn --(void) update: (ccTime) t -{ - [other update: (t==0) ? 0 : powf(2, 10 * (t/1 - 1)) - 1 * 0.001f]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseExponentialOut actionWithAction: [other reverse]]; -} -@end - -// -// EaseExponentialOut -// -@implementation CCEaseExponentialOut --(void) update: (ccTime) t -{ - [other update: (t==1) ? 1 : (-powf(2, -10 * t/1) + 1)]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseExponentialIn actionWithAction: [other reverse]]; -} -@end - -// -// EaseExponentialInOut -// -@implementation CCEaseExponentialInOut --(void) update: (ccTime) t -{ - t /= 0.5f; - if (t < 1) - t = 0.5f * powf(2, 10 * (t - 1)); - else - t = 0.5f * (-powf(2, -10 * (t -1) ) + 2); - - [other update:t]; -} -@end - - -#pragma mark - -#pragma mark EaseSin actions - -// -// EaseSineIn -// -@implementation CCEaseSineIn --(void) update: (ccTime) t -{ - [other update:-1*cosf(t * (float)M_PI_2) +1]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseSineOut actionWithAction: [other reverse]]; -} -@end - -// -// EaseSineOut -// -@implementation CCEaseSineOut --(void) update: (ccTime) t -{ - [other update:sinf(t * (float)M_PI_2)]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseSineIn actionWithAction: [other reverse]]; -} -@end - -// -// EaseSineInOut -// -@implementation CCEaseSineInOut --(void) update: (ccTime) t -{ - [other update:-0.5f*(cosf( (float)M_PI*t) - 1)]; -} -@end - -#pragma mark - -#pragma mark EaseElastic actions - -// -// EaseElastic -// -@implementation CCEaseElastic - -@synthesize period = period_; - -+(id) actionWithAction: (CCActionInterval*) action -{ - return [[[self alloc] initWithAction:action period:0.3f] autorelease]; -} - -+(id) actionWithAction: (CCActionInterval*) action period:(float)period -{ - return [[[self alloc] initWithAction:action period:period] autorelease]; -} - --(id) initWithAction: (CCActionInterval*) action -{ - return [self initWithAction:action period:0.3f]; -} - --(id) initWithAction: (CCActionInterval*) action period:(float)period -{ - if( (self=[super initWithAction:action]) ) - period_ = period; - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCAction *copy = [[[self class] allocWithZone:zone] initWithAction:[[other copy] autorelease] period:period_]; - return copy; -} - --(CCActionInterval*) reverse -{ - NSAssert(NO,@"Override me"); - return nil; -} - -@end - -// -// EaseElasticIn -// - -@implementation CCEaseElasticIn --(void) update: (ccTime) t -{ - ccTime newT = 0; - if (t == 0 || t == 1) - newT = t; - - else { - float s = period_ / 4; - t = t - 1; - newT = -powf(2, 10 * t) * sinf( (t-s) *M_PI_X_2 / period_); - } - [other update:newT]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseElasticOut actionWithAction: [other reverse] period:period_]; -} - -@end - -// -// EaseElasticOut -// -@implementation CCEaseElasticOut - --(void) update: (ccTime) t -{ - ccTime newT = 0; - if (t == 0 || t == 1) { - newT = t; - - } else { - float s = period_ / 4; - newT = powf(2, -10 * t) * sinf( (t-s) *M_PI_X_2 / period_) + 1; - } - [other update:newT]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseElasticIn actionWithAction: [other reverse] period:period_]; -} - -@end - -// -// EaseElasticInOut -// -@implementation CCEaseElasticInOut --(void) update: (ccTime) t -{ - ccTime newT = 0; - - if( t == 0 || t == 1 ) - newT = t; - else { - t = t * 2; - if(! period_ ) - period_ = 0.3f * 1.5f; - ccTime s = period_ / 4; - - t = t -1; - if( t < 0 ) - newT = -0.5f * powf(2, 10 * t) * sinf((t - s) * M_PI_X_2 / period_); - else - newT = powf(2, -10 * t) * sinf((t - s) * M_PI_X_2 / period_) * 0.5f + 1; - } - [other update:newT]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseElasticInOut actionWithAction: [other reverse] period:period_]; -} - -@end - -#pragma mark - -#pragma mark EaseBounce actions - -// -// EaseBounce -// -@implementation CCEaseBounce --(ccTime) bounceTime:(ccTime) t -{ - if (t < 1 / 2.75) { - return 7.5625f * t * t; - } - else if (t < 2 / 2.75) { - t -= 1.5f / 2.75f; - return 7.5625f * t * t + 0.75f; - } - else if (t < 2.5 / 2.75) { - t -= 2.25f / 2.75f; - return 7.5625f * t * t + 0.9375f; - } - - t -= 2.625f / 2.75f; - return 7.5625f * t * t + 0.984375f; -} -@end - -// -// EaseBounceIn -// - -@implementation CCEaseBounceIn - --(void) update: (ccTime) t -{ - ccTime newT = 1 - [self bounceTime:1-t]; - [other update:newT]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseBounceOut actionWithAction: [other reverse]]; -} - -@end - -@implementation CCEaseBounceOut - --(void) update: (ccTime) t -{ - ccTime newT = [self bounceTime:t]; - [other update:newT]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseBounceIn actionWithAction: [other reverse]]; -} - -@end - -@implementation CCEaseBounceInOut - --(void) update: (ccTime) t -{ - ccTime newT = 0; - if (t < 0.5) { - t = t * 2; - newT = (1 - [self bounceTime:1-t] ) * 0.5f; - } else - newT = [self bounceTime:t * 2 - 1] * 0.5f + 0.5f; - - [other update:newT]; -} -@end - -#pragma mark - -#pragma mark Ease Back actions - -// -// EaseBackIn -// -@implementation CCEaseBackIn - --(void) update: (ccTime) t -{ - ccTime overshoot = 1.70158f; - [other update: t * t * ((overshoot + 1) * t - overshoot)]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseBackOut actionWithAction: [other reverse]]; -} -@end - -// -// EaseBackOut -// -@implementation CCEaseBackOut --(void) update: (ccTime) t -{ - ccTime overshoot = 1.70158f; - - t = t - 1; - [other update: t * t * ((overshoot + 1) * t + overshoot) + 1]; -} - -- (CCActionInterval*) reverse -{ - return [CCEaseBackIn actionWithAction: [other reverse]]; -} -@end - -// -// EaseBackInOut -// -@implementation CCEaseBackInOut - --(void) update: (ccTime) t -{ - ccTime overshoot = 1.70158f * 1.525f; - - t = t * 2; - if (t < 1) - [other update: (t * t * ((overshoot + 1) * t - overshoot)) / 2]; - else { - t = t - 2; - [other update: (t * t * ((overshoot + 1) * t + overshoot)) / 2 + 1]; - } -} -@end diff --git a/Classes/cocos2d/CCActionGrid.h b/Classes/cocos2d/CCActionGrid.h deleted file mode 100644 index 13b6bc7..0000000 --- a/Classes/cocos2d/CCActionGrid.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2009 On-Core - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCActionInterval.h" -#import "CCActionInstant.h" -#import "CCGrid.h" - -@class CCGridBase; - -/** Base class for Grid actions */ -@interface CCGridAction : CCActionInterval -{ - ccGridSize gridSize_; -} - -/** size of the grid */ -@property (nonatomic,readwrite) ccGridSize gridSize; - -/** creates the action with size and duration */ -+(id) actionWithSize:(ccGridSize)size duration:(ccTime)d; -/** initializes the action with size and duration */ --(id) initWithSize:(ccGridSize)gridSize duration:(ccTime)d; -/** returns the grid */ --(CCGridBase *)grid; - -@end - -//////////////////////////////////////////////////////////// - -/** Base class for CCGrid3D actions. - Grid3D actions can modify a non-tiled grid. - */ -@interface CCGrid3DAction : CCGridAction -{ -} - -/** returns the vertex than belongs to certain position in the grid */ --(ccVertex3F)vertex:(ccGridSize)pos; -/** returns the non-transformed vertex than belongs to certain position in the grid */ --(ccVertex3F)originalVertex:(ccGridSize)pos; -/** sets a new vertex to a certain position of the grid */ --(void)setVertex:(ccGridSize)pos vertex:(ccVertex3F)vertex; - -@end - -//////////////////////////////////////////////////////////// - -/** Base class for CCTiledGrid3D actions */ -@interface CCTiledGrid3DAction : CCGridAction -{ -} - -/** returns the tile that belongs to a certain position of the grid */ --(ccQuad3)tile:(ccGridSize)pos; -/** returns the non-transformed tile that belongs to a certain position of the grid */ --(ccQuad3)originalTile:(ccGridSize)pos; -/** sets a new tile to a certain position of the grid */ --(void)setTile:(ccGridSize)pos coords:(ccQuad3)coords; - -@end - -//////////////////////////////////////////////////////////// - -/** CCAccelDeccelAmplitude action */ -@interface CCAccelDeccelAmplitude : CCActionInterval -{ - float rate; - CCActionInterval *other; -} - -/** amplitude rate */ -@property (nonatomic,readwrite) float rate; - -/** creates the action with an inner action that has the amplitude property, and a duration time */ -+(id)actionWithAction:(CCAction*)action duration:(ccTime)d; -/** initializes the action with an inner action that has the amplitude property, and a duration time */ --(id)initWithAction:(CCAction*)action duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCAccelAmplitude action */ -@interface CCAccelAmplitude : CCActionInterval -{ - float rate; - CCActionInterval *other; -} - -/** amplitude rate */ -@property (nonatomic,readwrite) float rate; - -/** creates the action with an inner action that has the amplitude property, and a duration time */ -+(id)actionWithAction:(CCAction*)action duration:(ccTime)d; -/** initializes the action with an inner action that has the amplitude property, and a duration time */ --(id)initWithAction:(CCAction*)action duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCDeccelAmplitude action */ -@interface CCDeccelAmplitude : CCActionInterval -{ - float rate; - CCActionInterval *other; -} - -/** amplitude rate */ -@property (nonatomic,readwrite) float rate; - -/** creates the action with an inner action that has the amplitude property, and a duration time */ -+(id)actionWithAction:(CCAction*)action duration:(ccTime)d; -/** initializes the action with an inner action that has the amplitude property, and a duration time */ --(id)initWithAction:(CCAction*)action duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCStopGrid action. - Don't call this action if another grid action is active. - Call if you want to remove the the grid effect. Example: - [Sequence actions:[Lens ...], [StopGrid action], nil]; - */ -@interface CCStopGrid : CCActionInstant -{ -} -@end - -//////////////////////////////////////////////////////////// - -/** CCReuseGrid action */ -@interface CCReuseGrid : CCActionInstant -{ - int t; -} -/** creates an action with the number of times that the current grid will be reused */ -+(id) actionWithTimes: (int) times; -/** initializes an action with the number of times that the current grid will be reused */ --(id) initWithTimes: (int) times; -@end diff --git a/Classes/cocos2d/CCActionGrid.m b/Classes/cocos2d/CCActionGrid.m deleted file mode 100644 index b2d8f98..0000000 --- a/Classes/cocos2d/CCActionGrid.m +++ /dev/null @@ -1,386 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2009 On-Core - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCActionGrid.h" -#import "CCDirector.h" - -#pragma mark - -#pragma mark GridAction - -@implementation CCGridAction - -@synthesize gridSize = gridSize_; - -+(id) actionWithSize:(ccGridSize)size duration:(ccTime)d -{ - return [[[self alloc] initWithSize:size duration:d ] autorelease]; -} - --(id) initWithSize:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithDuration:d]) ) - { - gridSize_ = gSize; - } - - return self; -} - --(void)startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - - CCGridBase *newgrid = [self grid]; - - CCNode *t = (CCNode*) target_; - CCGridBase *targetGrid = [t grid]; - - if ( targetGrid && targetGrid.reuseGrid > 0 ) - { - if ( targetGrid.active && targetGrid.gridSize.x == gridSize_.x && targetGrid.gridSize.y == gridSize_.y && [targetGrid isKindOfClass:[newgrid class]] ) - [targetGrid reuse]; - else - [NSException raise:@"GridBase" format:@"Cannot reuse grid"]; - } - else - { - if ( targetGrid && targetGrid.active ) - targetGrid.active = NO; - - t.grid = newgrid; - t.grid.active = YES; - } -} - --(CCGridBase *)grid -{ - [NSException raise:@"GridBase" format:@"Abstract class needs implementation"]; - return nil; -} - -- (CCActionInterval*) reverse -{ - return [CCReverseTime actionWithAction:self]; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithSize:gridSize_ duration:duration_]; - return copy; -} -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Grid3DAction - -@implementation CCGrid3DAction - --(CCGridBase *)grid -{ - return [CCGrid3D gridWithSize:gridSize_]; -} - --(ccVertex3F)vertex:(ccGridSize)pos -{ - CCGrid3D *g = (CCGrid3D *)[target_ grid]; - return [g vertex:pos]; -} - --(ccVertex3F)originalVertex:(ccGridSize)pos -{ - CCGrid3D *g = (CCGrid3D *)[target_ grid]; - return [g originalVertex:pos]; -} - --(void)setVertex:(ccGridSize)pos vertex:(ccVertex3F)vertex -{ - CCGrid3D *g = (CCGrid3D *)[target_ grid]; - return [g setVertex:pos vertex:vertex]; -} -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark TiledGrid3DAction - -@implementation CCTiledGrid3DAction - --(CCGridBase *)grid -{ - return [CCTiledGrid3D gridWithSize:gridSize_]; -} - --(ccQuad3)tile:(ccGridSize)pos -{ - CCTiledGrid3D *g = (CCTiledGrid3D *)[target_ grid]; - return [g tile:pos]; -} - --(ccQuad3)originalTile:(ccGridSize)pos -{ - CCTiledGrid3D *g = (CCTiledGrid3D *)[target_ grid]; - return [g originalTile:pos]; -} - --(void)setTile:(ccGridSize)pos coords:(ccQuad3)coords -{ - CCTiledGrid3D *g = (CCTiledGrid3D *)[target_ grid]; - [g setTile:pos coords:coords]; -} - -@end - -//////////////////////////////////////////////////////////// - -@interface CCActionInterval (Amplitude) --(void)setAmplitudeRate:(CGFloat)amp; --(CGFloat)getAmplitudeRate; -@end - -@implementation CCActionInterval (Amplitude) --(void)setAmplitudeRate:(CGFloat)amp -{ - [NSException raise:@"IntervalAction (Amplitude)" format:@"Abstract class needs implementation"]; -} - --(CGFloat)getAmplitudeRate -{ - [NSException raise:@"IntervalAction (Amplitude)" format:@"Abstract class needs implementation"]; - return 0; -} -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark AccelDeccelAmplitude - -@implementation CCAccelDeccelAmplitude - -@synthesize rate; - -+(id)actionWithAction:(CCAction*)action duration:(ccTime)d -{ - return [[[self alloc] initWithAction:action duration:d ] autorelease]; -} - --(id)initWithAction:(CCAction *)action duration:(ccTime)d -{ - if ( (self = [super initWithDuration:d]) ) - { - rate = 1.0f; - other = [action retain]; - } - - return self; -} - --(void)dealloc -{ - [other release]; - [super dealloc]; -} - --(void)startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - [other startWithTarget:target_]; -} - --(void) update: (ccTime) time -{ - float f = time*2; - - if (f > 1) - { - f -= 1; - f = 1 - f; - } - - [other setAmplitudeRate:powf(f, rate)]; - [other update:time]; -} - -- (CCActionInterval*) reverse -{ - return [CCAccelDeccelAmplitude actionWithAction:[other reverse] duration:duration_]; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark AccelAmplitude - -@implementation CCAccelAmplitude - -@synthesize rate; - -+(id)actionWithAction:(CCAction*)action duration:(ccTime)d -{ - return [[[self alloc] initWithAction:action duration:d ] autorelease]; -} - --(id)initWithAction:(CCAction *)action duration:(ccTime)d -{ - if ( (self = [super initWithDuration:d]) ) - { - rate = 1.0f; - other = [action retain]; - } - - return self; -} - --(void)dealloc -{ - [other release]; - [super dealloc]; -} - --(void)startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - [other startWithTarget:target_]; -} - --(void) update: (ccTime) time -{ - [other setAmplitudeRate:powf(time, rate)]; - [other update:time]; -} - -- (CCActionInterval*) reverse -{ - return [CCAccelAmplitude actionWithAction:[other reverse] duration:self.duration]; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark DeccelAmplitude - -@implementation CCDeccelAmplitude - -@synthesize rate; - -+(id)actionWithAction:(CCAction*)action duration:(ccTime)d -{ - return [[[self alloc] initWithAction:action duration:d ] autorelease]; -} - --(id)initWithAction:(CCAction *)action duration:(ccTime)d -{ - if ( (self = [super initWithDuration:d]) ) - { - rate = 1.0f; - other = [action retain]; - } - - return self; -} - --(void)dealloc -{ - [other release]; - [super dealloc]; -} - --(void)startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - [other startWithTarget:target_]; -} - --(void) update: (ccTime) time -{ - [other setAmplitudeRate:powf((1-time), rate)]; - [other update:time]; -} - -- (CCActionInterval*) reverse -{ - return [CCDeccelAmplitude actionWithAction:[other reverse] duration:self.duration]; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark StopGrid - -@implementation CCStopGrid - --(void)startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - - if ( [[self target] grid] && [[[self target] grid] active] ) { - [[[self target] grid] setActive: NO]; - -// [[self target] setGrid: nil]; - } -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark ReuseGrid - -@implementation CCReuseGrid - -+(id)actionWithTimes:(int)times -{ - return [[[self alloc] initWithTimes:times ] autorelease]; -} - --(id)initWithTimes:(int)times -{ - if ( (self = [super init]) ) - t = times; - - return self; -} - --(void)startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - - CCNode *myTarget = (CCNode*) [self target]; - if ( myTarget.grid && myTarget.grid.active ) - myTarget.grid.reuseGrid += t; -} - -@end diff --git a/Classes/cocos2d/CCActionGrid3D.h b/Classes/cocos2d/CCActionGrid3D.h deleted file mode 100644 index a8003f4..0000000 --- a/Classes/cocos2d/CCActionGrid3D.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2009 On-Core - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCActionGrid.h" - -/** CCWaves3D action */ -@interface CCWaves3D : CCGrid3DAction -{ - int waves; - float amplitude; - float amplitudeRate; -} - -/** amplitude of the wave */ -@property (nonatomic,readwrite) float amplitude; -/** amplitude rate of the wave */ -@property (nonatomic,readwrite) float amplitudeRate; - -+(id)actionWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; --(id)initWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCFlipX3D action */ -@interface CCFlipX3D : CCGrid3DAction -{ -} - -/** creates the action with duration */ -+(id) actionWithDuration:(ccTime)d; -/** initizlies the action with duration */ --(id) initWithDuration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCFlipY3D action */ -@interface CCFlipY3D : CCFlipX3D -{ -} - -@end - -//////////////////////////////////////////////////////////// - -/** CCLens3D action */ -@interface CCLens3D : CCGrid3DAction -{ - CGPoint position_; - CGPoint positionInPixels_; - float radius_; - float lensEffect_; - BOOL dirty_; -} - -/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */ -@property (nonatomic,readwrite) float lensEffect; -/** lens center position in Points */ -@property (nonatomic,readwrite) CGPoint position; - -/** creates the action with center position in Points, radius, a grid size and duration */ -+(id)actionWithPosition:(CGPoint)pos radius:(float)r grid:(ccGridSize)gridSize duration:(ccTime)d; -/** initializes the action with center position in Points, radius, a grid size and duration */ --(id)initWithPosition:(CGPoint)pos radius:(float)r grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCRipple3D action */ -@interface CCRipple3D : CCGrid3DAction -{ - CGPoint position_; - CGPoint positionInPixels_; - float radius_; - int waves_; - float amplitude_; - float amplitudeRate_; -} - -/** center position in Points */ -@property (nonatomic,readwrite) CGPoint position; -/** amplitude */ -@property (nonatomic,readwrite) float amplitude; -/** amplitude rate */ -@property (nonatomic,readwrite) float amplitudeRate; - -/** creates the action with a position in points, radius, number of waves, amplitude, a grid size and duration */ -+(id)actionWithPosition:(CGPoint)pos radius:(float)r waves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; -/** initializes the action with a position in points, radius, number of waves, amplitude, a grid size and duration */ --(id)initWithPosition:(CGPoint)pos radius:(float)r waves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCShaky3D action */ -@interface CCShaky3D : CCGrid3DAction -{ - int randrange; - BOOL shakeZ; -} - -/** creates the action with a range, shake Z vertices, a grid and duration */ -+(id)actionWithRange:(int)range shakeZ:(BOOL)shakeZ grid:(ccGridSize)gridSize duration:(ccTime)d; -/** initializes the action with a range, shake Z vertices, a grid and duration */ --(id)initWithRange:(int)range shakeZ:(BOOL)shakeZ grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCLiquid action */ -@interface CCLiquid : CCGrid3DAction -{ - int waves; - float amplitude; - float amplitudeRate; - -} - -/** amplitude */ -@property (nonatomic,readwrite) float amplitude; -/** amplitude rate */ -@property (nonatomic,readwrite) float amplitudeRate; - -/** creates the action with amplitude, a grid and duration */ -+(id)actionWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; -/** initializes the action with amplitude, a grid and duration */ --(id)initWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCWaves action */ -@interface CCWaves : CCGrid3DAction -{ - int waves; - float amplitude; - float amplitudeRate; - BOOL vertical; - BOOL horizontal; -} - -/** amplitude */ -@property (nonatomic,readwrite) float amplitude; -/** amplitude rate */ -@property (nonatomic,readwrite) float amplitudeRate; - -/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */ -+(id)actionWithWaves:(int)wav amplitude:(float)amp horizontal:(BOOL)h vertical:(BOOL)v grid:(ccGridSize)gridSize duration:(ccTime)d; -/** creates the action with amplitude, horizontal sin, vertical sin, a grid and duration */ --(id)initWithWaves:(int)wav amplitude:(float)amp horizontal:(BOOL)h vertical:(BOOL)v grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end - -//////////////////////////////////////////////////////////// - -/** CCTwirl action */ -@interface CCTwirl : CCGrid3DAction -{ - CGPoint position_; - CGPoint positionInPixels_; - int twirls_; - float amplitude_; - float amplitudeRate_; -} - -/** twirl center */ -@property (nonatomic,readwrite) CGPoint position; -/** amplitude */ -@property (nonatomic,readwrite) float amplitude; -/** amplitude rate */ -@property (nonatomic,readwrite) float amplitudeRate; - -/** creates the action with center position, number of twirls, amplitude, a grid size and duration */ -+(id)actionWithPosition:(CGPoint)pos twirls:(int)t amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; -/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */ --(id)initWithPosition:(CGPoint)pos twirls:(int)t amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d; - -@end diff --git a/Classes/cocos2d/CCActionGrid3D.m b/Classes/cocos2d/CCActionGrid3D.m deleted file mode 100644 index 1d4a783..0000000 --- a/Classes/cocos2d/CCActionGrid3D.m +++ /dev/null @@ -1,659 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2009 On-Core - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCActionGrid3D.h" -#import "ccMacros.h" -#import "Support/CGPointExtension.h" - -#pragma mark - -#pragma mark Waves3D - -@implementation CCWaves3D - -@synthesize amplitude; -@synthesize amplitudeRate; - -+(id)actionWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithWaves:wav amplitude:amp grid:gridSize duration:d] autorelease]; -} - --(id)initWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - waves = wav; - amplitude = amp; - amplitudeRate = 1.0f; - } - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithWaves:waves amplitude:amplitude grid:gridSize_ duration:duration_]; - return copy; -} - - --(void)update:(ccTime)time -{ - int i, j; - - for( i = 0; i < (gridSize_.x+1); i++ ) - { - for( j = 0; j < (gridSize_.y+1); j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - v.z += (sinf((CGFloat)M_PI*time*waves*2 + (v.y+v.x) * .01f) * amplitude * amplitudeRate); - [self setVertex:ccg(i,j) vertex:v]; - } - } -} -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark FlipX3D - -@implementation CCFlipX3D - -+(id) actionWithDuration:(ccTime)d -{ - return [[[self alloc] initWithSize:ccg(1,1) duration:d] autorelease]; -} - --(id) initWithDuration:(ccTime)d -{ - return [super initWithSize:ccg(1,1) duration:d]; -} - --(id)initWithSize:(ccGridSize)gSize duration:(ccTime)d -{ - if ( gSize.x != 1 || gSize.y != 1 ) - { - [NSException raise:@"FlipX3D" format:@"Grid size must be (1,1)"]; - } - - return [super initWithSize:gSize duration:d]; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithSize:gridSize_ duration:duration_]; - return copy; -} - - --(void)update:(ccTime)time -{ - CGFloat angle = (CGFloat)M_PI * time; // 180 degrees - CGFloat mz = sinf( angle ); - angle = angle / 2.0f; // x calculates degrees from 0 to 90 - CGFloat mx = cosf( angle ); - - ccVertex3F v0, v1, v, diff; - - v0 = [self originalVertex:ccg(1,1)]; - v1 = [self originalVertex:ccg(0,0)]; - - CGFloat x0 = v0.x; - CGFloat x1 = v1.x; - CGFloat x; - ccGridSize a, b, c, d; - - if ( x0 > x1 ) - { - // Normal Grid - a = ccg(0,0); - b = ccg(0,1); - c = ccg(1,0); - d = ccg(1,1); - x = x0; - } - else - { - // Reversed Grid - c = ccg(0,0); - d = ccg(0,1); - a = ccg(1,0); - b = ccg(1,1); - x = x1; - } - - diff.x = ( x - x * mx ); - diff.z = fabsf( floorf( (x * mz) / 4.0f ) ); - -// bottom-left - v = [self originalVertex:a]; - v.x = diff.x; - v.z += diff.z; - [self setVertex:a vertex:v]; - -// upper-left - v = [self originalVertex:b]; - v.x = diff.x; - v.z += diff.z; - [self setVertex:b vertex:v]; - -// bottom-right - v = [self originalVertex:c]; - v.x -= diff.x; - v.z -= diff.z; - [self setVertex:c vertex:v]; - -// upper-right - v = [self originalVertex:d]; - v.x -= diff.x; - v.z -= diff.z; - [self setVertex:d vertex:v]; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark FlipY3D - -@implementation CCFlipY3D - --(void)update:(ccTime)time -{ - CGFloat angle = (CGFloat)M_PI * time; // 180 degrees - CGFloat mz = sinf( angle ); - angle = angle / 2.0f; // x calculates degrees from 0 to 90 - CGFloat my = cosf( angle ); - - ccVertex3F v0, v1, v, diff; - - v0 = [self originalVertex:ccg(1,1)]; - v1 = [self originalVertex:ccg(0,0)]; - - CGFloat y0 = v0.y; - CGFloat y1 = v1.y; - CGFloat y; - ccGridSize a, b, c, d; - - if ( y0 > y1 ) - { - // Normal Grid - a = ccg(0,0); - b = ccg(0,1); - c = ccg(1,0); - d = ccg(1,1); - y = y0; - } - else - { - // Reversed Grid - b = ccg(0,0); - a = ccg(0,1); - d = ccg(1,0); - c = ccg(1,1); - y = y1; - } - - diff.y = y - y * my; - diff.z = fabsf( floorf( (y * mz) / 4.0f ) ); - - // bottom-left - v = [self originalVertex:a]; - v.y = diff.y; - v.z += diff.z; - [self setVertex:a vertex:v]; - - // upper-left - v = [self originalVertex:b]; - v.y -= diff.y; - v.z -= diff.z; - [self setVertex:b vertex:v]; - - // bottom-right - v = [self originalVertex:c]; - v.y = diff.y; - v.z += diff.z; - [self setVertex:c vertex:v]; - - // upper-right - v = [self originalVertex:d]; - v.y -= diff.y; - v.z -= diff.z; - [self setVertex:d vertex:v]; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Lens3D - -@implementation CCLens3D - -@synthesize lensEffect=lensEffect_; - -+(id)actionWithPosition:(CGPoint)pos radius:(float)r grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithPosition:pos radius:r grid:gridSize duration:d] autorelease]; -} - --(id)initWithPosition:(CGPoint)pos radius:(float)r grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - position_ = ccp(-1,-1); - self.position = pos; - radius_ = r; - lensEffect_ = 0.7f; - dirty_ = YES; - } - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithPosition:position_ radius:radius_ grid:gridSize_ duration:duration_]; - return copy; -} - --(void) setPosition:(CGPoint)pos -{ - if( ! CGPointEqualToPoint(pos, position_) ) { - position_ = pos; - positionInPixels_.x = pos.x * CC_CONTENT_SCALE_FACTOR(); - positionInPixels_.y = pos.y * CC_CONTENT_SCALE_FACTOR(); - - dirty_ = YES; - } -} - --(CGPoint) position -{ - return position_; -} - --(void)update:(ccTime)time -{ - if ( dirty_ ) - { - int i, j; - - for( i = 0; i < gridSize_.x+1; i++ ) - { - for( j = 0; j < gridSize_.y+1; j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - CGPoint vect = ccpSub(positionInPixels_, ccp(v.x,v.y)); - CGFloat r = ccpLength(vect); - - if ( r < radius_ ) - { - r = radius_ - r; - CGFloat pre_log = r / radius_; - if ( pre_log == 0 ) pre_log = 0.001f; - float l = logf(pre_log) * lensEffect_; - float new_r = expf( l ) * radius_; - - if ( ccpLength(vect) > 0 ) - { - vect = ccpNormalize(vect); - CGPoint new_vect = ccpMult(vect, new_r); - v.z += ccpLength(new_vect) * lensEffect_; - } - } - - [self setVertex:ccg(i,j) vertex:v]; - } - } - - dirty_ = NO; - } -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Ripple3D - -@implementation CCRipple3D - -@synthesize amplitude = amplitude_; -@synthesize amplitudeRate = amplitudeRate_; - -+(id)actionWithPosition:(CGPoint)pos radius:(float)r waves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithPosition:pos radius:r waves:wav amplitude:amp grid:gridSize duration:d] autorelease]; -} - --(id)initWithPosition:(CGPoint)pos radius:(float)r waves:(int)wav amplitude:(float)amp grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - self.position = pos; - radius_ = r; - waves_ = wav; - amplitude_ = amp; - amplitudeRate_ = 1.0f; - } - - return self; -} - --(CGPoint) position -{ - return position_; -} - --(void) setPosition:(CGPoint)pos -{ - position_ = pos; - positionInPixels_.x = pos.x * CC_CONTENT_SCALE_FACTOR(); - positionInPixels_.y = pos.y * CC_CONTENT_SCALE_FACTOR(); -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithPosition:position_ radius:radius_ waves:waves_ amplitude:amplitude_ grid:gridSize_ duration:duration_]; - return copy; -} - - --(void)update:(ccTime)time -{ - int i, j; - - for( i = 0; i < (gridSize_.x+1); i++ ) - { - for( j = 0; j < (gridSize_.y+1); j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - CGPoint vect = ccpSub(positionInPixels_, ccp(v.x,v.y)); - CGFloat r = ccpLength(vect); - - if ( r < radius_ ) - { - r = radius_ - r; - CGFloat rate = powf( r / radius_, 2); - v.z += (sinf( time*(CGFloat)M_PI*waves_*2 + r * 0.1f) * amplitude_ * amplitudeRate_ * rate ); - } - - [self setVertex:ccg(i,j) vertex:v]; - } - } -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Shaky3D - -@implementation CCShaky3D - -+(id)actionWithRange:(int)range shakeZ:(BOOL)sz grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithRange:range shakeZ:sz grid:gridSize duration:d] autorelease]; -} - --(id)initWithRange:(int)range shakeZ:(BOOL)sz grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - randrange = range; - shakeZ = sz; - } - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithRange:randrange shakeZ:shakeZ grid:gridSize_ duration:duration_]; - return copy; -} - --(void)update:(ccTime)time -{ - int i, j; - - for( i = 0; i < (gridSize_.x+1); i++ ) - { - for( j = 0; j < (gridSize_.y+1); j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - v.x += ( rand() % (randrange*2) ) - randrange; - v.y += ( rand() % (randrange*2) ) - randrange; - if( shakeZ ) - v.z += ( rand() % (randrange*2) ) - randrange; - - [self setVertex:ccg(i,j) vertex:v]; - } - } -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Liquid - -@implementation CCLiquid - -@synthesize amplitude; -@synthesize amplitudeRate; - -+(id)actionWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithWaves:wav amplitude:amp grid:gridSize duration:d] autorelease]; -} - --(id)initWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - waves = wav; - amplitude = amp; - amplitudeRate = 1.0f; - } - - return self; -} - --(void)update:(ccTime)time -{ - int i, j; - - for( i = 1; i < gridSize_.x; i++ ) - { - for( j = 1; j < gridSize_.y; j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - v.x = (v.x + (sinf(time*(CGFloat)M_PI*waves*2 + v.x * .01f) * amplitude * amplitudeRate)); - v.y = (v.y + (sinf(time*(CGFloat)M_PI*waves*2 + v.y * .01f) * amplitude * amplitudeRate)); - [self setVertex:ccg(i,j) vertex:v]; - } - } -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithWaves:waves amplitude:amplitude grid:gridSize_ duration:duration_]; - return copy; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Waves - -@implementation CCWaves - -@synthesize amplitude; -@synthesize amplitudeRate; - -+(id)actionWithWaves:(int)wav amplitude:(float)amp horizontal:(BOOL)h vertical:(BOOL)v grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithWaves:wav amplitude:amp horizontal:h vertical:v grid:gridSize duration:d] autorelease]; -} - --(id)initWithWaves:(int)wav amplitude:(float)amp horizontal:(BOOL)h vertical:(BOOL)v grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - waves = wav; - amplitude = amp; - amplitudeRate = 1.0f; - horizontal = h; - vertical = v; - } - - return self; -} - --(void)update:(ccTime)time -{ - int i, j; - - for( i = 0; i < (gridSize_.x+1); i++ ) - { - for( j = 0; j < (gridSize_.y+1); j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - - if ( vertical ) - v.x = (v.x + (sinf(time*(CGFloat)M_PI*waves*2 + v.y * .01f) * amplitude * amplitudeRate)); - - if ( horizontal ) - v.y = (v.y + (sinf(time*(CGFloat)M_PI*waves*2 + v.x * .01f) * amplitude * amplitudeRate)); - - [self setVertex:ccg(i,j) vertex:v]; - } - } -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithWaves:waves amplitude:amplitude horizontal:horizontal vertical:vertical grid:gridSize_ duration:duration_]; - return copy; -} - -@end - -//////////////////////////////////////////////////////////// - -#pragma mark - -#pragma mark Twirl - -@implementation CCTwirl - -@synthesize amplitude = amplitude_; -@synthesize amplitudeRate = amplitudeRate_; - -+(id)actionWithPosition:(CGPoint)pos twirls:(int)t amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d -{ - return [[[self alloc] initWithPosition:pos twirls:t amplitude:amp grid:gridSize duration:d] autorelease]; -} - --(id)initWithPosition:(CGPoint)pos twirls:(int)t amplitude:(float)amp grid:(ccGridSize)gSize duration:(ccTime)d -{ - if ( (self = [super initWithSize:gSize duration:d]) ) - { - self.position = pos; - twirls_ = t; - amplitude_ = amp; - amplitudeRate_ = 1.0f; - } - - return self; -} - --(void) setPosition:(CGPoint)pos -{ - position_ = pos; - positionInPixels_.x = pos.x * CC_CONTENT_SCALE_FACTOR(); - positionInPixels_.y = pos.y * CC_CONTENT_SCALE_FACTOR(); -} - --(CGPoint) position -{ - return position_; -} - --(void)update:(ccTime)time -{ - int i, j; - CGPoint c = positionInPixels_; - - for( i = 0; i < (gridSize_.x+1); i++ ) - { - for( j = 0; j < (gridSize_.y+1); j++ ) - { - ccVertex3F v = [self originalVertex:ccg(i,j)]; - - CGPoint avg = ccp(i-(gridSize_.x/2.0f), j-(gridSize_.y/2.0f)); - CGFloat r = ccpLength( avg ); - - CGFloat amp = 0.1f * amplitude_ * amplitudeRate_; - CGFloat a = r * cosf( (CGFloat)M_PI/2.0f + time * (CGFloat)M_PI * twirls_ * 2 ) * amp; - - float cosA = cosf(a); - float sinA = sinf(a); - - CGPoint d = { - sinA * (v.y-c.y) + cosA * (v.x-c.x), - cosA * (v.y-c.y) - sinA * (v.x-c.x) - }; - - v.x = c.x + d.x; - v.y = c.y + d.y; - - [self setVertex:ccg(i,j) vertex:v]; - } - } -} - --(id) copyWithZone: (NSZone*) zone -{ - CCGridAction *copy = [[[self class] allocWithZone:zone] initWithPosition:position_ - twirls:twirls_ - amplitude:amplitude_ - grid:gridSize_ - duration:duration_]; - return copy; -} - - -@end diff --git a/Classes/cocos2d/CCActionInstant.h b/Classes/cocos2d/CCActionInstant.h deleted file mode 100644 index 40eb15f..0000000 --- a/Classes/cocos2d/CCActionInstant.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2010 Ricardo Quesada - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCAction.h" - -/** Instant actions are immediate actions. They don't have a duration like - the CCIntervalAction actions. -*/ -@interface CCActionInstant : CCFiniteTimeAction -{ -} -@end - -/** Show the node - */ - @interface CCShow : CCActionInstant -{ -} -@end - -/** Hide the node - */ -@interface CCHide : CCActionInstant -{ -} -@end - -/** Toggles the visibility of a node - */ -@interface CCToggleVisibility : CCActionInstant -{ -} -@end - -/** Flips the sprite horizontally - @since v0.99.0 - */ -@interface CCFlipX : CCActionInstant -{ - BOOL flipX; -} -+(id) actionWithFlipX:(BOOL)x; --(id) initWithFlipX:(BOOL)x; -@end - -/** Flips the sprite vertically - @since v0.99.0 - */ -@interface CCFlipY : CCActionInstant -{ - BOOL flipY; -} -+(id) actionWithFlipY:(BOOL)y; --(id) initWithFlipY:(BOOL)y; -@end - -/** Places the node in a certain position - */ -@interface CCPlace : CCActionInstant -{ - CGPoint position; -} -/** creates a Place action with a position */ -+(id) actionWithPosition: (CGPoint) pos; -/** Initializes a Place action with a position */ --(id) initWithPosition: (CGPoint) pos; -@end - -/** Calls a 'callback' - */ -@interface CCCallFunc : CCActionInstant -{ - id targetCallback_; - SEL selector_; -} -/** creates the action with the callback */ -+(id) actionWithTarget: (id) t selector:(SEL) s; -/** initializes the action with the callback */ --(id) initWithTarget: (id) t selector:(SEL) s; -/** exeuctes the callback */ --(void) execute; -@end - -/** Calls a 'callback' with the node as the first argument. - N means Node - */ -@interface CCCallFuncN : CCCallFunc -{ -} -@end - -typedef void (*CC_CALLBACK_ND)(id, SEL, id, void *); -/** Calls a 'callback' with the node as the first argument and the 2nd argument is data. - * ND means: Node and Data. Data is void *, so it could be anything. - */ -@interface CCCallFuncND : CCCallFuncN -{ - void *data_; - CC_CALLBACK_ND callbackMethod_; -} - -/** Invocation object that has the target#selector and the parameters */ -@property (nonatomic,readwrite) CC_CALLBACK_ND callbackMethod; - -/** creates the action with the callback and the data to pass as an argument */ -+(id) actionWithTarget: (id) t selector:(SEL) s data:(void*)d; -/** initializes the action with the callback and the data to pass as an argument */ --(id) initWithTarget:(id) t selector:(SEL) s data:(void*) d; -@end - -/** Calls a 'callback' with an object as the first argument. - O means Object. - @since v0.99.5 - */ -@interface CCCallFuncO : CCCallFunc -{ - id object_; -} -/** creates the action with the callback and the object to pass as an argument */ -+(id) actionWithTarget: (id) t selector:(SEL) s object:(id)object; -/** initializes the action with the callback and the object to pass as an argument */ --(id) initWithTarget:(id) t selector:(SEL) s object:(id)object; - -@end - -#pragma mark Blocks Support - -#if NS_BLOCKS_AVAILABLE - -/** Executes a callback using a block. - */ -@interface CCCallBlock : CCActionInstant -{ - void (^block_)(); -} - -/** creates the action with the specified block, to be used as a callback. - The block will be "copied". - */ -+(id) actionWithBlock:(void(^)())block; - -/** initialized the action with the specified block, to be used as a callback. - The block will be "copied". - */ --(id) initWithBlock:(void(^)())block; - -/** executes the callback */ --(void) execute; -@end - -@class CCNode; - -/** Executes a callback using a block with a single CCNode parameter. - */ -@interface CCCallBlockN : CCActionInstant -{ - void (^block_)(CCNode *); -} - -/** creates the action with the specified block, to be used as a callback. - The block will be "copied". - */ -+(id) actionWithBlock:(void(^)(CCNode *node))block; - -/** initialized the action with the specified block, to be used as a callback. - The block will be "copied". - */ --(id) initWithBlock:(void(^)(CCNode *node))block; - -/** executes the callback */ --(void) execute; -@end - -#endif diff --git a/Classes/cocos2d/CCActionInstant.m b/Classes/cocos2d/CCActionInstant.m deleted file mode 100644 index 2b9072c..0000000 --- a/Classes/cocos2d/CCActionInstant.m +++ /dev/null @@ -1,472 +0,0 @@ -/* - * cocos2d for iPhone: http://www.cocos2d-iphone.org - * - * Copyright (c) 2008-2010 Ricardo Quesada - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - - -#import "CCBlockSupport.h" -#import "CCActionInstant.h" -#import "CCNode.h" -#import "CCSprite.h" - - -// -// InstantAction -// -#pragma mark CCActionInstant - -@implementation CCActionInstant - --(id) init -{ - if( (self=[super init]) ) - duration_ = 0; - - return self; -} - --(id) copyWithZone: (NSZone*) zone -{ - CCActionInstant *copy = [[[self class] allocWithZone: zone] init]; - return copy; -} - -- (BOOL) isDone -{ - return YES; -} - --(void) step: (ccTime) dt -{ - [self update: 1]; -} - --(void) update: (ccTime) t -{ - // ignore -} - --(CCFiniteTimeAction*) reverse -{ - return [[self copy] autorelease]; -} -@end - -// -// Show -// -#pragma mark CCShow - -@implementation CCShow --(void) startWithTarget:(id)aTarget -{ - [super startWithTarget:aTarget]; - ((CCNode *)target_).visible = YES; -} - --(CCFiniteTimeAction*) reverse -{ - return [CCHide action]; -} -@end - -// -// Hide -// -#pragma mark CCHide - -@implementation CCHide --(vo