From 4a765d33a34dada39e7c6d2dd47b3f98b0fe6afc Mon Sep 17 00:00:00 2001 From: natural-law Date: Wed, 22 Dec 2010 15:15:04 +0800 Subject: [PATCH 1/5] rename the CCXXXAction files to CCActionXXX. --- .../project.pbxproj.REMOVED.git-id | 2 +- cocos2dx/Android.mk | 18 +-- cocos2dx/actions/CCAction.cpp | 2 +- ...{CCCameraAction.cpp => CCActionCamera.cpp} | 2 +- .../{CCEaseAction.cpp => CCActionEase.cpp} | 2 +- .../{CCGridAction.cpp => CCActionGrid.cpp} | 2 +- ...{CCGrid3DAction.cpp => CCActionGrid3D.cpp} | 2 +- ...CInstantAction.cpp => CCActionInstant.cpp} | 2 +- ...ntervalAction.cpp => CCActionInterval.cpp} | 2 +- ...urn3DAction.cpp => CCActionPageTurn3D.cpp} | 2 +- ...rActions.cpp => CCActionProgressTimer.cpp} | 2 +- ...edGridAction.cpp => CCActionTiledGrid.cpp} | 2 +- .../{CCCameraAction.h => CCActionCamera.h} | 2 +- .../{CCEaseAction.h => CCActionEase.h} | 2 +- .../{CCGridAction.h => CCActionGrid.h} | 4 +- .../{CCGrid3DAction.h => CCActionGrid3D.h} | 2 +- .../{CCInstantAction.h => CCActionInstant.h} | 0 ...{CCIntervalAction.h => CCActionInterval.h} | 0 ...ageTurn3DAction.h => CCActionPageTurn3D.h} | 2 +- ...TimerActions.h => CCActionProgressTimer.h} | 2 +- ...CTiledGridAction.h => CCActionTiledGrid.h} | 2 +- cocos2dx/include/cocos2d.h | 18 +-- .../CCPageTurnTransition.cpp | 8 +- .../CCRadialTransition.cpp | 4 +- .../CCTransition.cpp | 12 +- cocos2dx/menu_nodes/CCMenuItem.cpp | 2 +- cocos2dx/proj.uphone/Makefile-dynamic.ARM | 65 ++++----- cocos2dx/proj.uphone/Makefile.ARM | 54 ++++---- cocos2dx/proj.uphone/cocos2d-uphone.vcproj | 126 +++++++++--------- cocos2dx/proj.win32/cocos2d-win32.vcproj | 126 +++++++++--------- .../project.pbxproj.REMOVED.git-id | 2 +- 31 files changed, 238 insertions(+), 235 deletions(-) rename cocos2dx/actions/{CCCameraAction.cpp => CCActionCamera.cpp} (98%) rename cocos2dx/actions/{CCEaseAction.cpp => CCActionEase.cpp} (99%) rename cocos2dx/actions/{CCGridAction.cpp => CCActionGrid.cpp} (95%) rename cocos2dx/actions/{CCGrid3DAction.cpp => CCActionGrid3D.cpp} (97%) rename cocos2dx/actions/{CCInstantAction.cpp => CCActionInstant.cpp} (99%) rename cocos2dx/actions/{CCIntervalAction.cpp => CCActionInterval.cpp} (96%) rename cocos2dx/actions/{CCPageTurn3DAction.cpp => CCActionPageTurn3D.cpp} (97%) rename cocos2dx/actions/{CCProgressTimerActions.cpp => CCActionProgressTimer.cpp} (96%) rename cocos2dx/actions/{CCTiledGridAction.cpp => CCActionTiledGrid.cpp} (96%) rename cocos2dx/include/{CCCameraAction.h => CCActionCamera.h} (97%) rename cocos2dx/include/{CCEaseAction.h => CCActionEase.h} (99%) rename cocos2dx/include/{CCGridAction.h => CCActionGrid.h} (96%) rename cocos2dx/include/{CCGrid3DAction.h => CCActionGrid3D.h} (96%) rename cocos2dx/include/{CCInstantAction.h => CCActionInstant.h} (100%) rename cocos2dx/include/{CCIntervalAction.h => CCActionInterval.h} (100%) rename cocos2dx/include/{CCPageTurn3DAction.h => CCActionPageTurn3D.h} (96%) rename cocos2dx/include/{CCProgressTimerActions.h => CCActionProgressTimer.h} (96%) rename cocos2dx/include/{CCTiledGridAction.h => CCActionTiledGrid.h} (96%) diff --git a/HelloWorld/iphone/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id b/HelloWorld/iphone/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id index 8d8d57420c..edeef7f9b5 100644 --- a/HelloWorld/iphone/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/HelloWorld/iphone/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -3953f2411d63b47b48efda987da345573ac2b01a \ No newline at end of file +78c89f5d993e6ed6fd3016a960cd1796bbcc1d39 \ No newline at end of file diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index a462770ac8..9505ac5081 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -12,15 +12,15 @@ CCScheduler.cpp \ CCamera.cpp \ actions/CCAction.cpp \ actions/CCActionManager.cpp \ -actions/CCCameraAction.cpp \ -actions/CCEaseAction.cpp \ -actions/CCGrid3DAction.cpp \ -actions/CCGridAction.cpp \ -actions/CCInstantAction.cpp \ -actions/CCIntervalAction.cpp \ -actions/CCPageTurn3DAction.cpp \ -actions/CCProgressTimerActions.cpp \ -actions/CCTiledGridAction.cpp \ +actions/CCActionCamera.cpp \ +actions/CCActionEase.cpp \ +actions/CCActionGrid3D.cpp \ +actions/CCActionGrid.cpp \ +actions/CCActionInstant.cpp \ +actions/CCActionInterval.cpp \ +actions/CCActionPageTurn3D.cpp \ +actions/CCActionProgressTimer.cpp \ +actions/CCActionTiledGrid.cpp \ base_nodes/CCAtlasNode.cpp \ base_nodes/CCNode.cpp \ cocoa/CGAffineTransform.cpp \ diff --git a/cocos2dx/actions/CCAction.cpp b/cocos2dx/actions/CCAction.cpp index 114bf37d43..5a7e6f1dc9 100644 --- a/cocos2dx/actions/CCAction.cpp +++ b/cocos2dx/actions/CCAction.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "CCAction.h" -#include "CCIntervalAction.h" +#include "CCActionInterval.h" #include "ccMacros.h" #include "CCNode.h" #include "CGPointExtension.h" diff --git a/cocos2dx/actions/CCCameraAction.cpp b/cocos2dx/actions/CCActionCamera.cpp similarity index 98% rename from cocos2dx/actions/CCCameraAction.cpp rename to cocos2dx/actions/CCActionCamera.cpp index 7fbc6f8eaf..1c20a05e2f 100644 --- a/cocos2dx/actions/CCCameraAction.cpp +++ b/cocos2dx/actions/CCActionCamera.cpp @@ -21,7 +21,7 @@ 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 "CCCameraAction.h" +#include "CCActionCamera.h" #include "CCNode.h" #include "CCCamera.h" #include "platform/CCXMath.h" diff --git a/cocos2dx/actions/CCEaseAction.cpp b/cocos2dx/actions/CCActionEase.cpp similarity index 99% rename from cocos2dx/actions/CCEaseAction.cpp rename to cocos2dx/actions/CCActionEase.cpp index 9fa3648743..ddda253fca 100644 --- a/cocos2dx/actions/CCEaseAction.cpp +++ b/cocos2dx/actions/CCActionEase.cpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include "CCEaseAction.h" +#include "CCActionEase.h" #include "NSObject.h" /* diff --git a/cocos2dx/actions/CCGridAction.cpp b/cocos2dx/actions/CCActionGrid.cpp similarity index 95% rename from cocos2dx/actions/CCGridAction.cpp rename to cocos2dx/actions/CCActionGrid.cpp index 3872cdcfca..ed25b6c444 100644 --- a/cocos2dx/actions/CCGridAction.cpp +++ b/cocos2dx/actions/CCActionGrid.cpp @@ -21,7 +21,7 @@ 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 "CCGridAction.h" +#include "CCActionGrid.h" #include "CCDirector.h" #include "effects/CCGrid.h" diff --git a/cocos2dx/actions/CCGrid3DAction.cpp b/cocos2dx/actions/CCActionGrid3D.cpp similarity index 97% rename from cocos2dx/actions/CCGrid3DAction.cpp rename to cocos2dx/actions/CCActionGrid3D.cpp index 563836e471..d501d9a66e 100644 --- a/cocos2dx/actions/CCGrid3DAction.cpp +++ b/cocos2dx/actions/CCActionGrid3D.cpp @@ -21,7 +21,7 @@ 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 "CCGrid3DAction.h" +#include "CCActionGrid3D.h" #include "CGPointExtension.h" #include diff --git a/cocos2dx/actions/CCInstantAction.cpp b/cocos2dx/actions/CCActionInstant.cpp similarity index 99% rename from cocos2dx/actions/CCInstantAction.cpp rename to cocos2dx/actions/CCActionInstant.cpp index 9557ac4863..c4942cbcd3 100644 --- a/cocos2dx/actions/CCInstantAction.cpp +++ b/cocos2dx/actions/CCActionInstant.cpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include "CCInstantAction.h" +#include "CCActionInstant.h" #include "CCXCocos2dDefine.h" #include "CCNode.h" #include "CCSprite.h" diff --git a/cocos2dx/actions/CCIntervalAction.cpp b/cocos2dx/actions/CCActionInterval.cpp similarity index 96% rename from cocos2dx/actions/CCIntervalAction.cpp rename to cocos2dx/actions/CCActionInterval.cpp index 07208a054b..ce5930752b 100644 --- a/cocos2dx/actions/CCIntervalAction.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include "CCIntervalAction.h" +#include "CCActionInterval.h" #include "CCSprite.h" #include "CCNode.h" #include "CGPointExtension.h" diff --git a/cocos2dx/actions/CCPageTurn3DAction.cpp b/cocos2dx/actions/CCActionPageTurn3D.cpp similarity index 97% rename from cocos2dx/actions/CCPageTurn3DAction.cpp rename to cocos2dx/actions/CCActionPageTurn3D.cpp index a83eb3b199..836c8b1e75 100644 --- a/cocos2dx/actions/CCPageTurn3DAction.cpp +++ b/cocos2dx/actions/CCActionPageTurn3D.cpp @@ -21,7 +21,7 @@ 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 "CCPageTurn3DAction.h" +#include "CCActionPageTurn3D.h" namespace cocos2d { diff --git a/cocos2dx/actions/CCProgressTimerActions.cpp b/cocos2dx/actions/CCActionProgressTimer.cpp similarity index 96% rename from cocos2dx/actions/CCProgressTimerActions.cpp rename to cocos2dx/actions/CCActionProgressTimer.cpp index 321a86ba9e..84b7df1d03 100644 --- a/cocos2dx/actions/CCProgressTimerActions.cpp +++ b/cocos2dx/actions/CCActionProgressTimer.cpp @@ -21,7 +21,7 @@ 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 "CCProgressTimerActions.h" +#include "CCActionProgressTimer.h" #include "CCProgressTimer.h" namespace cocos2d diff --git a/cocos2dx/actions/CCTiledGridAction.cpp b/cocos2dx/actions/CCActionTiledGrid.cpp similarity index 96% rename from cocos2dx/actions/CCTiledGridAction.cpp rename to cocos2dx/actions/CCActionTiledGrid.cpp index 68726f56aa..5f27a4dd2c 100644 --- a/cocos2dx/actions/CCTiledGridAction.cpp +++ b/cocos2dx/actions/CCActionTiledGrid.cpp @@ -21,7 +21,7 @@ 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 "CCTiledGridAction.h" +#include "CCActionTiledGrid.h" #include "CCDirector.h" #include "ccMacros.h" #include "CGPointExtension.h" diff --git a/cocos2dx/include/CCCameraAction.h b/cocos2dx/include/CCActionCamera.h similarity index 97% rename from cocos2dx/include/CCCameraAction.h rename to cocos2dx/include/CCActionCamera.h index 2c3e4bfb50..d2bfece7a4 100644 --- a/cocos2dx/include/CCCameraAction.h +++ b/cocos2dx/include/CCActionCamera.h @@ -24,7 +24,7 @@ THE SOFTWARE. #ifndef __CCCAMERA_ACTION_H__ #define __CCCAMERA_ACTION_H__ -#include "CCIntervalAction.h" +#include "CCActionInterval.h" namespace cocos2d { class CCCamera; diff --git a/cocos2dx/include/CCEaseAction.h b/cocos2dx/include/CCActionEase.h similarity index 99% rename from cocos2dx/include/CCEaseAction.h rename to cocos2dx/include/CCActionEase.h index 43192bf86d..cf8000c3df 100644 --- a/cocos2dx/include/CCEaseAction.h +++ b/cocos2dx/include/CCActionEase.h @@ -25,7 +25,7 @@ THE SOFTWARE. #ifndef __ACTION_CCEASE_ACTION_H__ #define __ACTION_CCEASE_ACTION_H__ -#include "CCIntervalAction.h" +#include "CCActionInterval.h" #include "ccxCommon.h" namespace cocos2d { diff --git a/cocos2dx/include/CCGridAction.h b/cocos2dx/include/CCActionGrid.h similarity index 96% rename from cocos2dx/include/CCGridAction.h rename to cocos2dx/include/CCActionGrid.h index ce84a33ed6..04f537c70a 100644 --- a/cocos2dx/include/CCGridAction.h +++ b/cocos2dx/include/CCActionGrid.h @@ -24,8 +24,8 @@ THE SOFTWARE. #ifndef __ACTION_CCGRID_ACTION_H__ #define __ACTION_CCGRID_ACTION_H__ -#include "CCIntervalAction.h" -#include "CCInstantAction.h" +#include "CCActionInterval.h" +#include "CCActionInstant.h" namespace cocos2d { diff --git a/cocos2dx/include/CCGrid3DAction.h b/cocos2dx/include/CCActionGrid3D.h similarity index 96% rename from cocos2dx/include/CCGrid3DAction.h rename to cocos2dx/include/CCActionGrid3D.h index def7386a40..c2dcadf480 100644 --- a/cocos2dx/include/CCGrid3DAction.h +++ b/cocos2dx/include/CCActionGrid3D.h @@ -24,7 +24,7 @@ THE SOFTWARE. #ifndef __ACTION_CCGRID3D_ACTION_H__ #define __ACTION_CCGRID3D_ACTION_H__ -#include "CCGridAction.h" +#include "CCActionGrid.h" namespace cocos2d { diff --git a/cocos2dx/include/CCInstantAction.h b/cocos2dx/include/CCActionInstant.h similarity index 100% rename from cocos2dx/include/CCInstantAction.h rename to cocos2dx/include/CCActionInstant.h diff --git a/cocos2dx/include/CCIntervalAction.h b/cocos2dx/include/CCActionInterval.h similarity index 100% rename from cocos2dx/include/CCIntervalAction.h rename to cocos2dx/include/CCActionInterval.h diff --git a/cocos2dx/include/CCPageTurn3DAction.h b/cocos2dx/include/CCActionPageTurn3D.h similarity index 96% rename from cocos2dx/include/CCPageTurn3DAction.h rename to cocos2dx/include/CCActionPageTurn3D.h index 2412198285..b37b849e41 100644 --- a/cocos2dx/include/CCPageTurn3DAction.h +++ b/cocos2dx/include/CCActionPageTurn3D.h @@ -24,7 +24,7 @@ THE SOFTWARE. #ifndef __ACTION_CCPAGETURN3D_ACTION_H__ #define __ACTION_CCPAGETURN3D_ACTION_H__ -#include "CCGrid3DAction.h" +#include "CCActionGrid3D.h" namespace cocos2d { diff --git a/cocos2dx/include/CCProgressTimerActions.h b/cocos2dx/include/CCActionProgressTimer.h similarity index 96% rename from cocos2dx/include/CCProgressTimerActions.h rename to cocos2dx/include/CCActionProgressTimer.h index 2010f4a4b2..3eb5385038 100644 --- a/cocos2dx/include/CCProgressTimerActions.h +++ b/cocos2dx/include/CCActionProgressTimer.h @@ -24,7 +24,7 @@ THE SOFTWARE. #ifndef __ACTION_CCPROGRESS_TIMER_H__ #define __ACTION_CCPROGRESS_TIMER_H__ -#include "CCIntervalAction.h" +#include "CCActionInterval.h" namespace cocos2d { diff --git a/cocos2dx/include/CCTiledGridAction.h b/cocos2dx/include/CCActionTiledGrid.h similarity index 96% rename from cocos2dx/include/CCTiledGridAction.h rename to cocos2dx/include/CCActionTiledGrid.h index 045f5435ea..6549c18c54 100644 --- a/cocos2dx/include/CCTiledGridAction.h +++ b/cocos2dx/include/CCActionTiledGrid.h @@ -24,7 +24,7 @@ THE SOFTWARE. #ifndef __ACTION_CCTILEDGRID_ACTION_H__ #define __ACTION_CCTILEDGRID_ACTION_H__ -#include "CCGridAction.h" +#include "CCActionGrid.h" namespace cocos2d { diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 1511707e9a..85e0231b20 100644 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -34,15 +34,15 @@ THE SOFTWARE. #include "CCAction.h" #include "CCActionManager.h" #include "CCCamera.h" -#include "CCCameraAction.h" +#include "CCActionCamera.h" #include "CCProtocols.h" #include "CCNode.h" #include "CCDirector.h" // #include "CCTouchDispatcher.h" // #include "CCTouchDelegateProtocol.h" -#include "CCInstantAction.h" -#include "CCIntervalAction.h" -#include "CCEaseAction.h" +#include "CCActionInstant.h" +#include "CCActionInterval.h" +#include "CCActionEase.h" #include "CCLabel.h" #include "CCLayer.h" #include "CCMenu.h" @@ -59,9 +59,9 @@ THE SOFTWARE. #include "CCTextureAtlas.h" #include "CCLabelAtlas.h" #include "CCAtlasNode.h" -#include "CCTiledGridAction.h" -#include "CCGrid3DAction.h" -#include "CCGridAction.h" +#include "CCActionTiledGrid.h" +#include "CCActionGrid3D.h" +#include "CCActionGrid.h" #include "CCBitmapFontAtlas.h" #include "CCParallaxNode.h" #include "CCTileMapAtlas.h" @@ -71,12 +71,12 @@ THE SOFTWARE. #include "CCTMXXMLParser.h" #include "CCRenderTexture.h" #include "CCMotionStreak.h" -#include "CCPageTurn3DAction.h" +#include "CCActionPageTurn3D.h" #include "CCPageTurnTransition.h" #include "CCTexture2D.h" #include "CCPVRTexture.h" #include "CCRadialTransition.h" -#include "CCProgressTimerActions.h" +#include "CCActionProgressTimer.h" #include "CCTouchDispatcher.h" #include "CCDrawingPrimitives.h" #include "CCScheduler.h" diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp index c6e7f2b383..24bf69a606 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp @@ -24,10 +24,10 @@ THE SOFTWARE. #include "CCPageTurnTransition.h" #include "CCDirector.h" -#include "CCIntervalAction.h" -#include "CCInstantAction.h" -#include "CCGridAction.h" -#include "CCPageTurn3DAction.h" +#include "CCActionInterval.h" +#include "CCActionInstant.h" +#include "CCActionGrid.h" +#include "CCActionPageTurn3D.h" namespace cocos2d { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCRadialTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCRadialTransition.cpp index cb8ad5044e..42a4cb0492 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCRadialTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCRadialTransition.cpp @@ -25,8 +25,8 @@ THE SOFTWARE. #include "CCRadialTransition.h" #include "CCDirector.h" #include "CCRenderTexture.h" -#include "CCInstantAction.h" -#include "CCProgressTimerActions.h" +#include "CCActionInstant.h" +#include "CCActionProgressTimer.h" #include "CGPointExtension.h" namespace cocos2d { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp index c863ea2dab..cbe120da85 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp @@ -27,14 +27,14 @@ THE SOFTWARE. #include "CGPointExtension.h" #include "CCDirector.h" #include "CCTouchDispatcher.h" -#include "CCIntervalAction.h" -#include "CCInstantAction.h" -#include "CCEaseAction.h" -#include "CCCameraAction.h" +#include "CCActionInterval.h" +#include "CCActionInstant.h" +#include "CCActionEase.h" +#include "CCActionCamera.h" #include "CCLayer.h" -#include "CCGridAction.h" +#include "CCActionGrid.h" #include "CCRenderTexture.h" -#include "CCTiledGridAction.h" +#include "CCActionTiledGrid.h" namespace cocos2d { enum { diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index 41e4dad2c7..043d402c74 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -24,7 +24,7 @@ THE SOFTWARE. #include #include "CCMenuItem.h" #include "CGPointExtension.h" -#include "CCIntervalAction.h" +#include "CCActionInterval.h" #include "CCSprite.h" #include "CCLabelAtlas.h" #include "CCLabel.h" diff --git a/cocos2dx/proj.uphone/Makefile-dynamic.ARM b/cocos2dx/proj.uphone/Makefile-dynamic.ARM index d08d4eafac..78f3ee82d9 100644 --- a/cocos2dx/proj.uphone/Makefile-dynamic.ARM +++ b/cocos2dx/proj.uphone/Makefile-dynamic.ARM @@ -39,15 +39,15 @@ OBJECTS = \ $(OBJECTS_DIR)/cocos2d.o \ $(OBJECTS_DIR)/CCAction.o \ $(OBJECTS_DIR)/CCActionManager.o \ - $(OBJECTS_DIR)/CCCameraAction.o \ - $(OBJECTS_DIR)/CCEaseAction.o \ - $(OBJECTS_DIR)/CCGrid3DAction.o \ - $(OBJECTS_DIR)/CCGridAction.o \ - $(OBJECTS_DIR)/CCInstantAction.o \ - $(OBJECTS_DIR)/CCIntervalAction.o \ - $(OBJECTS_DIR)/CCPageTurn3DAction.o \ - $(OBJECTS_DIR)/CCProgressTimerActions.o \ - $(OBJECTS_DIR)/CCTiledGridAction.o \ + $(OBJECTS_DIR)/CCActionCamera.o \ + $(OBJECTS_DIR)/CCActionEase.o \ + $(OBJECTS_DIR)/CCActionGrid3D.o \ + $(OBJECTS_DIR)/CCActionGrid.o \ + $(OBJECTS_DIR)/CCActionInstant.o \ + $(OBJECTS_DIR)/CCActionInterval.o \ + $(OBJECTS_DIR)/CCActionPageTurn3D.o \ + $(OBJECTS_DIR)/CCActionProgressTimer.o \ + $(OBJECTS_DIR)/CCActionTiledGrid.o \ $(OBJECTS_DIR)/CCAtlasNode.o \ $(OBJECTS_DIR)/CCNode.o \ $(OBJECTS_DIR)/CGAffineTransform.o \ @@ -97,8 +97,11 @@ OBJECTS = \ $(OBJECTS_DIR)/CCProfiling.o \ $(OBJECTS_DIR)/CGPointExtension.o \ $(OBJECTS_DIR)/TransformUtils.o \ + $(OBJECTS_DIR)/FileUtils.o \ $(OBJECTS_DIR)/TGAlib.o \ $(OBJECTS_DIR)/glu.o \ + $(OBJECTS_DIR)/ioapi.o \ + $(OBJECTS_DIR)/unzip.o \ $(OBJECTS_DIR)/CCTexture2D.o \ $(OBJECTS_DIR)/CCTextureAtlas.o \ $(OBJECTS_DIR)/CCTextureCache.o \ @@ -152,32 +155,32 @@ $(OBJECTS_DIR)/CCAction.o : ../actions/CCAction.cpp $(OBJECTS_DIR)/CCActionManager.o : ../actions/CCActionManager.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionManager.o ../actions/CCActionManager.cpp -$(OBJECTS_DIR)/CCCameraAction.o : ../actions/CCCameraAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCCameraAction.o ../actions/CCCameraAction.cpp +$(OBJECTS_DIR)/CCActionCamera.o : ../actions/CCActionCamera.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionCamera.o ../actions/CCActionCamera.cpp -$(OBJECTS_DIR)/CCEaseAction.o : ../actions/CCEaseAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCEaseAction.o ../actions/CCEaseAction.cpp +$(OBJECTS_DIR)/CCActionEase.o : ../actions/CCActionEase.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionEase.o ../actions/CCActionEase.cpp -$(OBJECTS_DIR)/CCGrid3DAction.o : ../actions/CCGrid3DAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCGrid3DAction.o ../actions/CCGrid3DAction.cpp +$(OBJECTS_DIR)/CCActionGrid3D.o : ../actions/CCActionGrid3D.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionGrid3D.o ../actions/CCActionGrid3D.cpp -$(OBJECTS_DIR)/CCGridAction.o : ../actions/CCGridAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCGridAction.o ../actions/CCGridAction.cpp +$(OBJECTS_DIR)/CCActionGrid.o : ../actions/CCActionGrid.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionGrid.o ../actions/CCActionGrid.cpp -$(OBJECTS_DIR)/CCInstantAction.o : ../actions/CCInstantAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCInstantAction.o ../actions/CCInstantAction.cpp +$(OBJECTS_DIR)/CCActionInstant.o : ../actions/CCActionInstant.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionInstant.o ../actions/CCActionInstant.cpp -$(OBJECTS_DIR)/CCIntervalAction.o : ../actions/CCIntervalAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCIntervalAction.o ../actions/CCIntervalAction.cpp +$(OBJECTS_DIR)/CCActionInterval.o : ../actions/CCActionInterval.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionInterval.o ../actions/CCActionInterval.cpp -$(OBJECTS_DIR)/CCPageTurn3DAction.o : ../actions/CCPageTurn3DAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCPageTurn3DAction.o ../actions/CCPageTurn3DAction.cpp +$(OBJECTS_DIR)/CCActionPageTurn3D.o : ../actions/CCActionPageTurn3D.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionPageTurn3D.o ../actions/CCActionPageTurn3D.cpp -$(OBJECTS_DIR)/CCProgressTimerActions.o : ../actions/CCProgressTimerActions.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCProgressTimerActions.o ../actions/CCProgressTimerActions.cpp +$(OBJECTS_DIR)/CCActionProgressTimer.o : ../actions/CCActionProgressTimer.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionProgressTimer.o ../actions/CCActionProgressTimer.cpp -$(OBJECTS_DIR)/CCTiledGridAction.o : ../actions/CCTiledGridAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCTiledGridAction.o ../actions/CCTiledGridAction.cpp +$(OBJECTS_DIR)/CCActionTiledGrid.o : ../actions/CCActionTiledGrid.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionTiledGrid.o ../actions/CCActionTiledGrid.cpp $(OBJECTS_DIR)/CCAtlasNode.o : ../base_nodes/CCAtlasNode.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCAtlasNode.o ../base_nodes/CCAtlasNode.cpp @@ -335,11 +338,11 @@ $(OBJECTS_DIR)/TGAlib.o : ../support/image_support/TGAlib.cpp $(OBJECTS_DIR)/glu.o : ../support/opengl_support/glu.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/glu.o ../support/opengl_support/glu.cpp -$(OBJECTS_DIR)/ioapi.o : ../support/zip_support/ioapi.c - $(CC) -c $(CC_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/ioapi.o ../support/zip_support/ioapi.c +$(OBJECTS_DIR)/ioapi.o : ../support/zip_support/ioapi.cpp + $(CC) -c $(CC_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/ioapi.o ../support/zip_support/ioapi.cpp -$(OBJECTS_DIR)/unzip.o : ../support/zip_support/unzip.c - $(CC) -c $(CC_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/unzip.o ../support/zip_support/unzip.c +$(OBJECTS_DIR)/unzip.o : ../support/zip_support/unzip.cpp + $(CC) -c $(CC_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/unzip.o ../support/zip_support/unzip.cpp $(OBJECTS_DIR)/CCTexture2D.o : ../textures/CCTexture2D.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCTexture2D.o ../textures/CCTexture2D.cpp diff --git a/cocos2dx/proj.uphone/Makefile.ARM b/cocos2dx/proj.uphone/Makefile.ARM index 656760b391..f18798c1cd 100644 --- a/cocos2dx/proj.uphone/Makefile.ARM +++ b/cocos2dx/proj.uphone/Makefile.ARM @@ -39,15 +39,15 @@ OBJECTS = \ $(OBJECTS_DIR)/cocos2d.o \ $(OBJECTS_DIR)/CCAction.o \ $(OBJECTS_DIR)/CCActionManager.o \ - $(OBJECTS_DIR)/CCCameraAction.o \ - $(OBJECTS_DIR)/CCEaseAction.o \ - $(OBJECTS_DIR)/CCGrid3DAction.o \ - $(OBJECTS_DIR)/CCGridAction.o \ - $(OBJECTS_DIR)/CCInstantAction.o \ - $(OBJECTS_DIR)/CCIntervalAction.o \ - $(OBJECTS_DIR)/CCPageTurn3DAction.o \ - $(OBJECTS_DIR)/CCProgressTimerActions.o \ - $(OBJECTS_DIR)/CCTiledGridAction.o \ + $(OBJECTS_DIR)/CCActionCamera.o \ + $(OBJECTS_DIR)/CCActionEase.o \ + $(OBJECTS_DIR)/CCActionGrid3D.o \ + $(OBJECTS_DIR)/CCActionGrid.o \ + $(OBJECTS_DIR)/CCActionInstant.o \ + $(OBJECTS_DIR)/CCActionInterval.o \ + $(OBJECTS_DIR)/CCActionPageTurn3D.o \ + $(OBJECTS_DIR)/CCActionProgressTimer.o \ + $(OBJECTS_DIR)/CCActionTiledGrid.o \ $(OBJECTS_DIR)/CCAtlasNode.o \ $(OBJECTS_DIR)/CCNode.o \ $(OBJECTS_DIR)/CGAffineTransform.o \ @@ -155,32 +155,32 @@ $(OBJECTS_DIR)/CCAction.o : ../actions/CCAction.cpp $(OBJECTS_DIR)/CCActionManager.o : ../actions/CCActionManager.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionManager.o ../actions/CCActionManager.cpp -$(OBJECTS_DIR)/CCCameraAction.o : ../actions/CCCameraAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCCameraAction.o ../actions/CCCameraAction.cpp +$(OBJECTS_DIR)/CCActionCamera.o : ../actions/CCActionCamera.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionCamera.o ../actions/CCActionCamera.cpp -$(OBJECTS_DIR)/CCEaseAction.o : ../actions/CCEaseAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCEaseAction.o ../actions/CCEaseAction.cpp +$(OBJECTS_DIR)/CCActionEase.o : ../actions/CCActionEase.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionEase.o ../actions/CCActionEase.cpp -$(OBJECTS_DIR)/CCGrid3DAction.o : ../actions/CCGrid3DAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCGrid3DAction.o ../actions/CCGrid3DAction.cpp +$(OBJECTS_DIR)/CCActionGrid3D.o : ../actions/CCActionGrid3D.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionGrid3D.o ../actions/CCActionGrid3D.cpp -$(OBJECTS_DIR)/CCGridAction.o : ../actions/CCGridAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCGridAction.o ../actions/CCGridAction.cpp +$(OBJECTS_DIR)/CCActionGrid.o : ../actions/CCActionGrid.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionGrid.o ../actions/CCActionGrid.cpp -$(OBJECTS_DIR)/CCInstantAction.o : ../actions/CCInstantAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCInstantAction.o ../actions/CCInstantAction.cpp +$(OBJECTS_DIR)/CCActionInstant.o : ../actions/CCActionInstant.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionInstant.o ../actions/CCActionInstant.cpp -$(OBJECTS_DIR)/CCIntervalAction.o : ../actions/CCIntervalAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCIntervalAction.o ../actions/CCIntervalAction.cpp +$(OBJECTS_DIR)/CCActionInterval.o : ../actions/CCActionInterval.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionInterval.o ../actions/CCActionInterval.cpp -$(OBJECTS_DIR)/CCPageTurn3DAction.o : ../actions/CCPageTurn3DAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCPageTurn3DAction.o ../actions/CCPageTurn3DAction.cpp +$(OBJECTS_DIR)/CCActionPageTurn3D.o : ../actions/CCActionPageTurn3D.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionPageTurn3D.o ../actions/CCActionPageTurn3D.cpp -$(OBJECTS_DIR)/CCProgressTimerActions.o : ../actions/CCProgressTimerActions.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCProgressTimerActions.o ../actions/CCProgressTimerActions.cpp +$(OBJECTS_DIR)/CCActionProgressTimer.o : ../actions/CCActionProgressTimer.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionProgressTimer.o ../actions/CCActionProgressTimer.cpp -$(OBJECTS_DIR)/CCTiledGridAction.o : ../actions/CCTiledGridAction.cpp - $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCTiledGridAction.o ../actions/CCTiledGridAction.cpp +$(OBJECTS_DIR)/CCActionTiledGrid.o : ../actions/CCActionTiledGrid.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCActionTiledGrid.o ../actions/CCActionTiledGrid.cpp $(OBJECTS_DIR)/CCAtlasNode.o : ../base_nodes/CCAtlasNode.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCAtlasNode.o ../base_nodes/CCAtlasNode.cpp diff --git a/cocos2dx/proj.uphone/cocos2d-uphone.vcproj b/cocos2dx/proj.uphone/cocos2d-uphone.vcproj index 2f6bc08e02..64e299d6fb 100644 --- a/cocos2dx/proj.uphone/cocos2d-uphone.vcproj +++ b/cocos2dx/proj.uphone/cocos2d-uphone.vcproj @@ -192,44 +192,44 @@ RelativePath="..\actions\CCAction.cpp" > + + + + + + + + + + + + - - - - - - - - - - - - @@ -272,10 +272,46 @@ RelativePath="..\include\CCAction.h" > + + + + + + + + + + + + + + + + + + @@ -288,10 +324,6 @@ RelativePath="..\include\CCCamera.h" > - - @@ -304,26 +336,6 @@ RelativePath="..\include\CCDrawingPrimitives.h" > - - - - - - - - - - @@ -364,10 +376,6 @@ RelativePath="..\include\CCNode.h" > - - @@ -392,10 +400,6 @@ RelativePath="..\include\CCProgressTimer.h" > - - @@ -452,10 +456,6 @@ RelativePath="..\include\CCTextureCache.h" > - - diff --git a/cocos2dx/proj.win32/cocos2d-win32.vcproj b/cocos2dx/proj.win32/cocos2d-win32.vcproj index cc8fc75203..38ba69c37f 100644 --- a/cocos2dx/proj.win32/cocos2d-win32.vcproj +++ b/cocos2dx/proj.win32/cocos2d-win32.vcproj @@ -250,44 +250,44 @@ RelativePath="..\actions\CCAction.cpp" > + + + + + + + + + + + + - - - - - - - - - - - - @@ -298,10 +298,46 @@ RelativePath="..\include\CCAction.h" > + + + + + + + + + + + + + + + + + + @@ -314,10 +350,6 @@ RelativePath="..\include\CCCamera.h" > - - @@ -330,26 +362,6 @@ RelativePath="..\include\CCDrawingPrimitives.h" > - - - - - - - - - - @@ -390,10 +402,6 @@ RelativePath="..\include\CCNode.h" > - - @@ -418,10 +426,6 @@ RelativePath="..\include\CCProgressTimer.h" > - - @@ -482,10 +486,6 @@ RelativePath="..\include\CCTextureCache.h" > - - diff --git a/tests/test.iphone/test.iphone.xcodeproj/project.pbxproj.REMOVED.git-id b/tests/test.iphone/test.iphone.xcodeproj/project.pbxproj.REMOVED.git-id index 8aefc77e48..931cf11c4a 100644 --- a/tests/test.iphone/test.iphone.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/tests/test.iphone/test.iphone.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -6292688758b2f8c210799e936b81419ee421b534 \ No newline at end of file +392ea4551bd3d4b3f60b883f5204ccc1673a372b \ No newline at end of file From eeb4e9980476cb7feb1225413da5ea09ac5c5df8 Mon Sep 17 00:00:00 2001 From: natural-law Date: Wed, 22 Dec 2010 15:43:54 +0800 Subject: [PATCH 2/5] rename the action classes. --- cocos2dx/actions/CCAction.cpp | 10 +- cocos2dx/actions/CCActionCamera.cpp | 12 +- cocos2dx/actions/CCActionEase.cpp | 166 ++++++------- cocos2dx/actions/CCActionGrid.cpp | 36 +-- cocos2dx/actions/CCActionInstant.cpp | 44 ++-- cocos2dx/actions/CCActionInterval.cpp | 182 +++++++------- cocos2dx/actions/CCActionProgressTimer.cpp | 14 +- cocos2dx/include/CCAction.h | 10 +- cocos2dx/include/CCActionCamera.h | 10 +- cocos2dx/include/CCActionEase.h | 120 +++++----- cocos2dx/include/CCActionGrid.h | 26 +- cocos2dx/include/CCActionInstant.h | 20 +- cocos2dx/include/CCActionInterval.h | 84 +++---- cocos2dx/include/CCActionProgressTimer.h | 6 +- cocos2dx/include/CCPageTurnTransition.h | 2 +- cocos2dx/include/CCTransition.h | 38 +-- .../CCPageTurnTransition.cpp | 4 +- .../CCTransition.cpp | 108 ++++----- .../ActionManagerTest/ActionManagerTest.cpp | 2 +- tests/tests/ActionsTest/ActionsTest.cpp | 126 +++++----- tests/tests/AtlasTest/AtlasTest.cpp | 28 +-- .../ClickAndMoveTest/ClickAndMoveTest.cpp | 2 +- tests/tests/CocosNodeTest/CocosNodeTest.cpp | 40 ++-- .../tests/EaseActionsTest/EaseActionsTest.cpp | 222 +++++++++--------- .../EffectsAdvancedTest.cpp | 58 ++--- tests/tests/EffectsTest/EffectsTest.cpp | 96 ++++---- tests/tests/IntervalTest/IntervalTest.cpp | 2 +- tests/tests/LayerTest/LayerTest.cpp | 12 +- tests/tests/MenuTest/MenuTest.cpp | 14 +- .../MotionStreakTest/MotionStreakTest.cpp | 6 +- tests/tests/ParallaxTest/ParallaxTest.cpp | 10 +- tests/tests/ParticleTest/ParticleTest.cpp | 14 +- .../tests/RotateWorldTest/RotateWorldTest.cpp | 8 +- tests/tests/SceneTest/SceneTest.cpp | 6 +- tests/tests/SpriteTest/SpriteTest.cpp | 158 ++++++------- tests/tests/TileMapTest/TileMapTest.cpp | 44 ++-- 36 files changed, 870 insertions(+), 870 deletions(-) diff --git a/cocos2dx/actions/CCAction.cpp b/cocos2dx/actions/CCAction.cpp index 5a7e6f1dc9..d140e80e3b 100644 --- a/cocos2dx/actions/CCAction.cpp +++ b/cocos2dx/actions/CCAction.cpp @@ -120,7 +120,7 @@ CCSpeed::~CCSpeed() CCX_SAFE_RELEASE(m_pOther); } -CCSpeed * CCSpeed::actionWithAction(CCIntervalAction *pAction, float fRate) +CCSpeed * CCSpeed::actionWithAction(CCActionInterval *pAction, float fRate) { CCSpeed *pRet = new CCSpeed(); if (pRet && pRet->initWithAction(pAction, fRate)) @@ -132,7 +132,7 @@ CCSpeed * CCSpeed::actionWithAction(CCIntervalAction *pAction, float fRate) return NULL; } -bool CCSpeed::initWithAction(CCIntervalAction *pAction, float fRate) +bool CCSpeed::initWithAction(CCActionInterval *pAction, float fRate) { assert(pAction != NULL); pAction->retain(); @@ -156,7 +156,7 @@ NSObject *CCSpeed::copyWithZone(NSZone *pZone) } CCAction::copyWithZone(pZone); - pRet->initWithAction( (CCIntervalAction*)(m_pOther->copy()->autorelease()) , m_fSpeed ); + pRet->initWithAction( (CCActionInterval*)(m_pOther->copy()->autorelease()) , m_fSpeed ); CCX_SAFE_DELETE(pNewZone); return pRet; @@ -184,9 +184,9 @@ bool CCSpeed::isDone() return m_pOther->isDone(); } -CCIntervalAction *CCSpeed::reverse() +CCActionInterval *CCSpeed::reverse() { - return (CCIntervalAction*)(CCSpeed::actionWithAction(m_pOther->reverse(), m_fSpeed)); + return (CCActionInterval*)(CCSpeed::actionWithAction(m_pOther->reverse(), m_fSpeed)); } // diff --git a/cocos2dx/actions/CCActionCamera.cpp b/cocos2dx/actions/CCActionCamera.cpp index 1c20a05e2f..028dc29542 100644 --- a/cocos2dx/actions/CCActionCamera.cpp +++ b/cocos2dx/actions/CCActionCamera.cpp @@ -30,9 +30,9 @@ namespace cocos2d{ // // CameraAction // - void CCCameraAction::startWithTarget(CCNode *pTarget) + void CCActionCamera::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); CCCamera *camera = pTarget->getCamera(); camera->getCenterXYZ(&m_fCenterXOrig, &m_fCenterYOrig, &m_fCenterZOrig); @@ -40,7 +40,7 @@ namespace cocos2d{ camera->getUpXYZ(&m_fUpXOrig, &m_fUpYOrig, &m_fUpZOrig); } - CCIntervalAction * CCCameraAction::reverse() + CCActionInterval * CCActionCamera::reverse() { return CCReverseTime::actionWithAction(this); } @@ -71,7 +71,7 @@ namespace cocos2d{ pZone = pNewZone = new NSZone(pRet); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pRet->initWithDuration(m_fDuration, m_fRadius, m_fDeltaRadius, m_fAngleZ, m_fDeltaAngleZ, m_fAngleX, m_fDeltaAngleX); @@ -81,7 +81,7 @@ namespace cocos2d{ bool CCOrbitCamera::initWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX) { - if ( CCIntervalAction::initWithDuration(t) ) + if ( CCActionInterval::initWithDuration(t) ) { m_fRadius = radius; m_fDeltaRadius = deltaRadius; @@ -99,7 +99,7 @@ namespace cocos2d{ void CCOrbitCamera::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); float r, zenith, azimuth; this->sphericalRadius(&r, &zenith, &azimuth); if( CCXMath::isnanCocos2d(m_fRadius) ) diff --git a/cocos2dx/actions/CCActionEase.cpp b/cocos2dx/actions/CCActionEase.cpp index ddda253fca..e5bb1b7766 100644 --- a/cocos2dx/actions/CCActionEase.cpp +++ b/cocos2dx/actions/CCActionEase.cpp @@ -40,9 +40,9 @@ namespace cocos2d { // // EaseAction // - CCEaseAction* CCEaseAction::actionWithAction(cocos2d::CCIntervalAction *pAction) + CCActionEase* CCActionEase::actionWithAction(cocos2d::CCActionInterval *pAction) { - CCEaseAction *pRet = new CCEaseAction(); + CCActionEase *pRet = new CCActionEase(); if (pRet) { if (pRet->initWithAction(pAction)) @@ -58,11 +58,11 @@ namespace cocos2d { return pRet; } - bool CCEaseAction::initWithAction(cocos2d::CCIntervalAction *pAction) + bool CCActionEase::initWithAction(cocos2d::CCActionInterval *pAction) { assert(pAction != NULL); - if (CCIntervalAction::initWithDuration(pAction->getDuration())) + if (CCActionInterval::initWithDuration(pAction->getDuration())) { m_pOther = pAction; pAction->retain(); @@ -73,60 +73,60 @@ namespace cocos2d { return false; } - NSObject* CCEaseAction::copyWithZone(cocos2d::NSZone *pZone) + NSObject* CCActionEase::copyWithZone(cocos2d::NSZone *pZone) { NSZone* pNewZone = NULL; - CCEaseAction* pCopy = NULL; + CCActionEase* pCopy = NULL; if(pZone && pZone->m_pCopyObject) { //in case of being called at sub class - pCopy = (CCEaseAction*)(pZone->m_pCopyObject); + pCopy = (CCActionEase*)(pZone->m_pCopyObject); } else { - pCopy = new CCEaseAction(); + pCopy = new CCActionEase(); pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; } - CCEaseAction::~CCEaseAction(void) + CCActionEase::~CCActionEase(void) { CCX_SAFE_RELEASE(m_pOther); } - void CCEaseAction::startWithTarget(CCNode *pTarget) + void CCActionEase::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(m_pTarget); } - void CCEaseAction::stop(void) + void CCActionEase::stop(void) { m_pOther->stop(); - CCIntervalAction::stop(); + CCActionInterval::stop(); } - void CCEaseAction::update(cocos2d::ccTime time) + void CCActionEase::update(cocos2d::ccTime time) { m_pOther->update(time); } - CCIntervalAction* CCEaseAction::reverse(void) + CCActionInterval* CCActionEase::reverse(void) { - return CCEaseAction::actionWithAction(m_pOther->reverse()); + return CCActionEase::actionWithAction(m_pOther->reverse()); } // // EaseRateAction // - CCEaseRateAction* CCEaseRateAction::actionWithAction(cocos2d::CCIntervalAction *pAction, float fRate) + CCEaseRateAction* CCEaseRateAction::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) { CCEaseRateAction *pRet = new CCEaseRateAction(); if (pRet) @@ -144,9 +144,9 @@ namespace cocos2d { return pRet; } - bool CCEaseRateAction::initWithAction(cocos2d::CCIntervalAction *pAction, float fRate) + bool CCEaseRateAction::initWithAction(cocos2d::CCActionInterval *pAction, float fRate) { - if (CCEaseAction::initWithAction(pAction)) + if (CCActionEase::initWithAction(pAction)) { m_fRate = fRate; return true; @@ -170,7 +170,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction*)(m_pOther->copy()->autorelease()), m_fRate); + pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -180,7 +180,7 @@ namespace cocos2d { { } - CCIntervalAction* CCEaseRateAction::reverse(void) + CCActionInterval* CCEaseRateAction::reverse(void) { return CCEaseRateAction::actionWithAction(m_pOther->reverse(), 1 / m_fRate); } @@ -188,7 +188,7 @@ namespace cocos2d { // // EeseIn // - CCEaseIn* CCEaseIn::actionWithAction(cocos2d::CCIntervalAction *pAction, float fRate) + CCEaseIn* CCEaseIn::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) { CCEaseIn *pRet = new CCEaseIn(); if (pRet) @@ -221,7 +221,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction*)(m_pOther->copy()->autorelease()), m_fRate); + pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -235,7 +235,7 @@ namespace cocos2d { // // EaseOut // - CCEaseOut* CCEaseOut::actionWithAction(cocos2d::CCIntervalAction *pAction, float fRate) + CCEaseOut* CCEaseOut::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) { CCEaseOut *pRet = new CCEaseOut(); if (pRet) @@ -268,7 +268,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction*)(m_pOther->copy()->autorelease()), m_fRate); + pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -282,7 +282,7 @@ namespace cocos2d { // // EaseInOut // - CCEaseInOut* CCEaseInOut::actionWithAction(cocos2d::CCIntervalAction *pAction, float fRate) + CCEaseInOut* CCEaseInOut::actionWithAction(cocos2d::CCActionInterval *pAction, float fRate) { CCEaseInOut *pRet = new CCEaseInOut(); if (pRet) @@ -315,7 +315,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction*)(m_pOther->copy()->autorelease()), m_fRate); + pCopy->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease()), m_fRate); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -343,7 +343,7 @@ namespace cocos2d { } // InOut and OutIn are symmetrical - CCIntervalAction* CCEaseInOut::reverse(void) + CCActionInterval* CCEaseInOut::reverse(void) { return CCEaseInOut::actionWithAction(m_pOther->reverse(), m_fRate); } @@ -351,7 +351,7 @@ namespace cocos2d { // // EaseExponentialIn // - CCEaseExponentialIn* CCEaseExponentialIn::actionWithAction(CCIntervalAction* pAction) + CCEaseExponentialIn* CCEaseExponentialIn::actionWithAction(CCActionInterval* pAction) { CCEaseExponentialIn *pRet = new CCEaseExponentialIn(); if (pRet) @@ -384,7 +384,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -395,7 +395,7 @@ namespace cocos2d { m_pOther->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f); } - CCIntervalAction* CCEaseExponentialIn::reverse(void) + CCActionInterval* CCEaseExponentialIn::reverse(void) { return CCEaseExponentialOut::actionWithAction(m_pOther->reverse()); } @@ -403,7 +403,7 @@ namespace cocos2d { // // EaseExponentialOut // - CCEaseExponentialOut* CCEaseExponentialOut::actionWithAction(CCIntervalAction* pAction) + CCEaseExponentialOut* CCEaseExponentialOut::actionWithAction(CCActionInterval* pAction) { CCEaseExponentialOut *pRet = new CCEaseExponentialOut(); if (pRet) @@ -436,7 +436,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -447,7 +447,7 @@ namespace cocos2d { m_pOther->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1)); } - CCIntervalAction* CCEaseExponentialOut::reverse(void) + CCActionInterval* CCEaseExponentialOut::reverse(void) { return CCEaseExponentialIn::actionWithAction(m_pOther->reverse()); } @@ -455,7 +455,7 @@ namespace cocos2d { // // EaseExponentialInOut // - CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(cocos2d::CCIntervalAction *pAction) + CCEaseExponentialInOut* CCEaseExponentialInOut::actionWithAction(cocos2d::CCActionInterval *pAction) { CCEaseExponentialInOut *pRet = new CCEaseExponentialInOut(); if (pRet) @@ -488,7 +488,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -512,7 +512,7 @@ namespace cocos2d { // // EaseSineIn // - CCEaseSineIn* CCEaseSineIn::actionWithAction(CCIntervalAction* pAction) + CCEaseSineIn* CCEaseSineIn::actionWithAction(CCActionInterval* pAction) { CCEaseSineIn *pRet = new CCEaseSineIn(); if (pRet) @@ -545,7 +545,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -556,7 +556,7 @@ namespace cocos2d { m_pOther->update(-1 * cosf(time * (float)M_PI_2) + 1); } - CCIntervalAction* CCEaseSineIn::reverse(void) + CCActionInterval* CCEaseSineIn::reverse(void) { return CCEaseSineOut::actionWithAction(m_pOther->reverse()); } @@ -564,7 +564,7 @@ namespace cocos2d { // // EaseSineOut // - CCEaseSineOut* CCEaseSineOut::actionWithAction(CCIntervalAction* pAction) + CCEaseSineOut* CCEaseSineOut::actionWithAction(CCActionInterval* pAction) { CCEaseSineOut *pRet = new CCEaseSineOut(); if (pRet) @@ -597,7 +597,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -608,7 +608,7 @@ namespace cocos2d { m_pOther->update(sinf(time * (float)M_PI_2)); } - CCIntervalAction* CCEaseSineOut::reverse(void) + CCActionInterval* CCEaseSineOut::reverse(void) { return CCEaseSineIn::actionWithAction(m_pOther->reverse()); } @@ -616,7 +616,7 @@ namespace cocos2d { // // EaseSineInOut // - CCEaseSineInOut* CCEaseSineInOut::actionWithAction(CCIntervalAction* pAction) + CCEaseSineInOut* CCEaseSineInOut::actionWithAction(CCActionInterval* pAction) { CCEaseSineInOut *pRet = new CCEaseSineInOut(); if (pRet) @@ -649,7 +649,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -663,7 +663,7 @@ namespace cocos2d { // // EaseElastic // - CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCIntervalAction *pAction) + CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCActionInterval *pAction) { CCEaseElastic *pRet = new CCEaseElastic(); if (pRet) @@ -681,7 +681,7 @@ namespace cocos2d { return pRet; } - CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCIntervalAction *pAction, float fPeriod) + CCEaseElastic* CCEaseElastic::actionWithAction(cocos2d::CCActionInterval *pAction, float fPeriod) { CCEaseElastic *pRet = new CCEaseElastic(); if (pRet) @@ -699,14 +699,14 @@ namespace cocos2d { return pRet; } - bool CCEaseElastic::initWithAction(cocos2d::CCIntervalAction *pAction) + bool CCEaseElastic::initWithAction(cocos2d::CCActionInterval *pAction) { return initWithAction(pAction, 0.3f); } - bool CCEaseElastic::initWithAction(cocos2d::CCIntervalAction *pAction, float fPeriod) + bool CCEaseElastic::initWithAction(cocos2d::CCActionInterval *pAction, float fPeriod) { - if (CCEaseAction::initWithAction(pAction)) + if (CCActionEase::initWithAction(pAction)) { m_fPeriod = fPeriod; return true; @@ -730,13 +730,13 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease()), m_fPeriod); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod); CCX_SAFE_DELETE(pNewZone); return pCopy; } - CCIntervalAction* CCEaseElastic::reverse(void) + CCActionInterval* CCEaseElastic::reverse(void) { assert(0); @@ -746,7 +746,7 @@ namespace cocos2d { // // EaseElasticIn // - CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCIntervalAction *pAction, float fPeriod) + CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction, float fPeriod) { CCEaseElasticIn *pRet = new CCEaseElasticIn(); if (pRet) @@ -764,7 +764,7 @@ namespace cocos2d { return pRet; } - CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCIntervalAction *pAction) + CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction) { CCEaseElasticIn *pRet = new CCEaseElasticIn(); if (pRet) @@ -797,7 +797,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease()), m_fPeriod); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -820,7 +820,7 @@ namespace cocos2d { m_pOther->update(newT); } - CCIntervalAction* CCEaseElasticIn::reverse(void) + CCActionInterval* CCEaseElasticIn::reverse(void) { return CCEaseElasticOut::actionWithAction(m_pOther->reverse(), m_fPeriod); } @@ -828,7 +828,7 @@ namespace cocos2d { // // EaseElasticOut // - CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCIntervalAction *pAction) + CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction) { CCEaseElasticOut *pRet = new CCEaseElasticOut(); if (pRet) @@ -846,7 +846,7 @@ namespace cocos2d { return pRet; } - CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCIntervalAction *pAction, float fPeriod) + CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction, float fPeriod) { CCEaseElasticOut *pRet = new CCEaseElasticOut(); if (pRet) @@ -879,7 +879,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease()), m_fPeriod); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -901,7 +901,7 @@ namespace cocos2d { m_pOther->update(newT); } - CCIntervalAction* CCEaseElasticOut::reverse(void) + CCActionInterval* CCEaseElasticOut::reverse(void) { return CCEaseElasticIn::actionWithAction(m_pOther->reverse(), m_fPeriod); } @@ -909,7 +909,7 @@ namespace cocos2d { // // EaseElasticInOut // - CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCIntervalAction *pAction) + CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pAction) { CCEaseElasticInOut *pRet = new CCEaseElasticInOut(); if (pRet) @@ -927,7 +927,7 @@ namespace cocos2d { return pRet; } - CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCIntervalAction *pAction, float fPeriod) + CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pAction, float fPeriod) { CCEaseElasticInOut *pRet = new CCEaseElasticInOut(); if (pRet) @@ -960,7 +960,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease()), m_fPeriod); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease()), m_fPeriod); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -998,7 +998,7 @@ namespace cocos2d { m_pOther->update(newT); } - CCIntervalAction* CCEaseElasticInOut::reverse(void) + CCActionInterval* CCEaseElasticInOut::reverse(void) { return CCEaseInOut::actionWithAction(m_pOther->reverse(), m_fPeriod); } @@ -1006,7 +1006,7 @@ namespace cocos2d { // // EaseBounce // - CCEaseBounce* CCEaseBounce::actionWithAction(CCIntervalAction* pAction) + CCEaseBounce* CCEaseBounce::actionWithAction(CCActionInterval* pAction) { CCEaseBounce *pRet = new CCEaseBounce(); if (pRet) @@ -1039,7 +1039,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -1069,7 +1069,7 @@ namespace cocos2d { // // EaseBounceIn // - CCEaseBounceIn* CCEaseBounceIn::actionWithAction(CCIntervalAction* pAction) + CCEaseBounceIn* CCEaseBounceIn::actionWithAction(CCActionInterval* pAction) { CCEaseBounceIn *pRet = new CCEaseBounceIn(); if (pRet) @@ -1102,7 +1102,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -1114,7 +1114,7 @@ namespace cocos2d { m_pOther->update(newT); } - CCIntervalAction* CCEaseBounceIn::reverse(void) + CCActionInterval* CCEaseBounceIn::reverse(void) { return CCEaseBounceOut::actionWithAction(m_pOther->reverse()); } @@ -1122,7 +1122,7 @@ namespace cocos2d { // // EaseBounceOut // - CCEaseBounceOut* CCEaseBounceOut::actionWithAction(CCIntervalAction* pAction) + CCEaseBounceOut* CCEaseBounceOut::actionWithAction(CCActionInterval* pAction) { CCEaseBounceOut *pRet = new CCEaseBounceOut(); if (pRet) @@ -1155,7 +1155,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -1167,7 +1167,7 @@ namespace cocos2d { m_pOther->update(newT); } - CCIntervalAction* CCEaseBounceOut::reverse(void) + CCActionInterval* CCEaseBounceOut::reverse(void) { return CCEaseBounceIn::actionWithAction(m_pOther->reverse()); } @@ -1175,7 +1175,7 @@ namespace cocos2d { // // EaseBounceInOut // - CCEaseBounceInOut* CCEaseBounceInOut::actionWithAction(CCIntervalAction* pAction) + CCEaseBounceInOut* CCEaseBounceInOut::actionWithAction(CCActionInterval* pAction) { CCEaseBounceInOut *pRet = new CCEaseBounceInOut(); if (pRet) @@ -1208,7 +1208,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -1233,7 +1233,7 @@ namespace cocos2d { // // EaseBackIn // - CCEaseBackIn* CCEaseBackIn::actionWithAction(cocos2d::CCIntervalAction *pAction) + CCEaseBackIn* CCEaseBackIn::actionWithAction(cocos2d::CCActionInterval *pAction) { CCEaseBackIn *pRet = new CCEaseBackIn(); if (pRet) @@ -1266,7 +1266,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -1278,7 +1278,7 @@ namespace cocos2d { m_pOther->update(time * time * ((overshoot + 1) * time - overshoot)); } - CCIntervalAction* CCEaseBackIn::reverse(void) + CCActionInterval* CCEaseBackIn::reverse(void) { return CCEaseBackOut::actionWithAction(m_pOther->reverse()); } @@ -1286,7 +1286,7 @@ namespace cocos2d { // // EaseBackOut // - CCEaseBackOut* CCEaseBackOut::actionWithAction(CCIntervalAction* pAction) + CCEaseBackOut* CCEaseBackOut::actionWithAction(CCActionInterval* pAction) { CCEaseBackOut *pRet = new CCEaseBackOut(); if (pRet) @@ -1319,7 +1319,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; @@ -1333,7 +1333,7 @@ namespace cocos2d { m_pOther->update(time * time * ((overshoot + 1) * time + overshoot) + 1); } - CCIntervalAction* CCEaseBackOut::reverse(void) + CCActionInterval* CCEaseBackOut::reverse(void) { return CCEaseBackIn::actionWithAction(m_pOther->reverse()); } @@ -1341,7 +1341,7 @@ namespace cocos2d { // // EaseBackInOut // - CCEaseBackInOut* CCEaseBackInOut::actionWithAction(CCIntervalAction* pAction) + CCEaseBackInOut* CCEaseBackInOut::actionWithAction(CCActionInterval* pAction) { CCEaseBackInOut *pRet = new CCEaseBackInOut(); if (pRet) @@ -1374,7 +1374,7 @@ namespace cocos2d { pZone = pNewZone = new NSZone(pCopy); } - pCopy->initWithAction((CCIntervalAction *)(m_pOther->copy()->autorelease())); + pCopy->initWithAction((CCActionInterval *)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pCopy; diff --git a/cocos2dx/actions/CCActionGrid.cpp b/cocos2dx/actions/CCActionGrid.cpp index ed25b6c444..2ce6d5f493 100644 --- a/cocos2dx/actions/CCActionGrid.cpp +++ b/cocos2dx/actions/CCActionGrid.cpp @@ -49,7 +49,7 @@ namespace cocos2d bool CCGridAction::initWithSize(cocos2d::ccGridSize gridSize, cocos2d::ccTime duration) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_sGridSize = gridSize; @@ -61,7 +61,7 @@ namespace cocos2d void CCGridAction::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); CCGridBase *newgrid = this->getGrid(); @@ -100,7 +100,7 @@ namespace cocos2d return NULL; } - CCIntervalAction* CCGridAction::reverse(void) + CCActionInterval* CCGridAction::reverse(void) { return CCReverseTime::actionWithAction(this); } @@ -120,7 +120,7 @@ namespace cocos2d pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithSize(m_sGridSize, m_fDuration); @@ -200,10 +200,10 @@ namespace cocos2d bool CCAccelDeccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fRate = 1.0f; - m_pOther = (CCIntervalAction*)(pAction); + m_pOther = (CCActionInterval*)(pAction); pAction->retain(); return true; @@ -219,7 +219,7 @@ namespace cocos2d void CCAccelDeccelAmplitude::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(pTarget); } @@ -236,7 +236,7 @@ namespace cocos2d ((CCAccelDeccelAmplitude*)(m_pOther))->setAmplitudeRate(powf(f, m_fRate)); } - CCIntervalAction* CCAccelDeccelAmplitude::reverse(void) + CCActionInterval* CCAccelDeccelAmplitude::reverse(void) { return CCAccelDeccelAmplitude::actionWithAction(m_pOther->reverse(), m_fDuration); } @@ -263,10 +263,10 @@ namespace cocos2d bool CCAccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fRate = 1.0f; - m_pOther = (CCIntervalAction*)(pAction); + m_pOther = (CCActionInterval*)(pAction); pAction->retain(); return true; @@ -282,7 +282,7 @@ namespace cocos2d void CCAccelAmplitude::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(pTarget); } @@ -292,7 +292,7 @@ namespace cocos2d m_pOther->update(time); } - CCIntervalAction* CCAccelAmplitude::reverse(void) + CCActionInterval* CCAccelAmplitude::reverse(void) { return CCAccelAmplitude::actionWithAction(m_pOther->reverse(), m_fDuration); } @@ -319,10 +319,10 @@ namespace cocos2d bool CCDeccelAmplitude::initWithAction(cocos2d::CCAction *pAction, cocos2d::ccTime duration) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fRate = 1.0f; - m_pOther = (CCIntervalAction*)(pAction); + m_pOther = (CCActionInterval*)(pAction); pAction->retain(); return true; @@ -338,7 +338,7 @@ namespace cocos2d void CCDeccelAmplitude::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(pTarget); } @@ -348,7 +348,7 @@ namespace cocos2d m_pOther->update(time); } - CCIntervalAction* CCDeccelAmplitude::reverse(void) + CCActionInterval* CCDeccelAmplitude::reverse(void) { return CCDeccelAmplitude::actionWithAction(m_pOther->reverse(), m_fDuration); } @@ -357,7 +357,7 @@ namespace cocos2d void CCStopGrid::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); CCGridBase *pGrid = m_pTarget->getGrid(); if (pGrid && pGrid->isActive()) @@ -403,7 +403,7 @@ namespace cocos2d void CCReuseGrid::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); if (m_pTarget->getGrid() && m_pTarget->getGrid()->isActive()) { diff --git a/cocos2dx/actions/CCActionInstant.cpp b/cocos2dx/actions/CCActionInstant.cpp index c4942cbcd3..493fba0795 100644 --- a/cocos2dx/actions/CCActionInstant.cpp +++ b/cocos2dx/actions/CCActionInstant.cpp @@ -30,41 +30,41 @@ namespace cocos2d { // // InstantAction // - CCInstantAction::CCInstantAction() + CCActionInstant::CCActionInstant() { m_fDuration = 0; } - NSObject * CCInstantAction::copyWithZone(cocos2d::NSZone *pZone) + NSObject * CCActionInstant::copyWithZone(cocos2d::NSZone *pZone) { NSZone *pNewZone = NULL; - CCInstantAction *pRet = NULL; + CCActionInstant *pRet = NULL; if (pZone && pZone->m_pCopyObject) { - pRet = (CCInstantAction*)(pZone->m_pCopyObject); + pRet = (CCActionInstant*)(pZone->m_pCopyObject); } else { - pRet = new CCInstantAction(); + pRet = new CCActionInstant(); pZone = pNewZone = new NSZone(pRet); } CCFiniteTimeAction::copyWithZone(pZone); CCX_SAFE_DELETE(pNewZone); return pRet; } - bool CCInstantAction::isDone() + bool CCActionInstant::isDone() { return true; } - void CCInstantAction::step(ccTime dt) + void CCActionInstant::step(ccTime dt) { update(1); } - void CCInstantAction::update(ccTime time) + void CCActionInstant::update(ccTime time) { // ignore } - CCFiniteTimeAction * CCInstantAction::reverse() + CCFiniteTimeAction * CCActionInstant::reverse() { return (CCFiniteTimeAction*)(copy()->autorelease()); } @@ -80,7 +80,7 @@ namespace cocos2d { } void CCShow::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); pTarget->setIsVisible(true); } CCFiniteTimeAction *CCShow::reverse() @@ -98,7 +98,7 @@ namespace cocos2d { } void CCHide::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); pTarget->setIsVisible(false); } @@ -118,7 +118,7 @@ namespace cocos2d { } void CCToggleVisibility::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); pTarget->setIsVisible(! pTarget->getIsVisible()); } // @@ -138,7 +138,7 @@ namespace cocos2d { } void CCFlipX::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); ((CCSprite*)(pTarget))->setFlipX(m_bFlipX); } @@ -160,7 +160,7 @@ namespace cocos2d { pRet = new CCFlipX(); pZone = pNewZone = new NSZone(pRet); } - CCInstantAction::copyWithZone(pZone); + CCActionInstant::copyWithZone(pZone); pRet->initWithFlipX(m_bFlipX); CCX_SAFE_DELETE(pNewZone); return pRet; @@ -184,7 +184,7 @@ namespace cocos2d { void CCFlipY::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); ((CCSprite*)(pTarget))->setFlipY(m_bFlipY); } @@ -206,7 +206,7 @@ namespace cocos2d { pRet = new CCFlipY(); pZone = pNewZone = new NSZone(pRet); } - CCInstantAction::copyWithZone(pZone); + CCActionInstant::copyWithZone(pZone); pRet->initWithFlipY(m_bFlipY); CCX_SAFE_DELETE(pNewZone); return pRet; @@ -241,7 +241,7 @@ namespace cocos2d { pRet = new CCPlace(); pZone = pNewZone = new NSZone(pRet); } - CCInstantAction::copyWithZone(pZone); + CCActionInstant::copyWithZone(pZone); pRet->initWithPosition(m_tPosition); CCX_SAFE_DELETE(pNewZone); return pRet; @@ -249,7 +249,7 @@ namespace cocos2d { void CCPlace::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); m_pTarget->setPosition(m_tPosition); } @@ -292,7 +292,7 @@ namespace cocos2d { pRet = new CCCallFunc(); pZone = pNewZone = new NSZone(pRet); } - CCInstantAction::copyWithZone(pZone); + CCActionInstant::copyWithZone(pZone); pRet->initWithTarget(m_pSelectorTarget); pRet->m_pCallFunc = m_pCallFunc; CCX_SAFE_DELETE(pNewZone); @@ -300,7 +300,7 @@ namespace cocos2d { } void CCCallFunc::startWithTarget(CCNode *pTarget) { - CCInstantAction::startWithTarget(pTarget); + CCActionInstant::startWithTarget(pTarget); this->execute(); } void CCCallFunc::execute() @@ -427,7 +427,7 @@ namespace cocos2d { } -(id) copyWithZone: (NSZone*) zone { - CCInstantAction *copy = [[[self class] allocWithZone: zone] initWithBlock:block_]; + CCActionInstant *copy = [[[self class] allocWithZone: zone] initWithBlock:block_]; return copy; } @@ -464,7 +464,7 @@ namespace cocos2d { } -(id) copyWithZone: (NSZone*) zone { - CCInstantAction *copy = [[[self class] allocWithZone: zone] initWithBlock:block_]; + CCActionInstant *copy = [[[self class] allocWithZone: zone] initWithBlock:block_]; return copy; } diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index ce5930752b..473617a14c 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -35,16 +35,16 @@ namespace cocos2d { // // IntervalAction // -CCIntervalAction* CCIntervalAction::actionWithDuration(ccTime d) +CCActionInterval* CCActionInterval::actionWithDuration(ccTime d) { - CCIntervalAction *pAction = new CCIntervalAction(); + CCActionInterval *pAction = new CCActionInterval(); pAction->initWithDuration(d); pAction->autorelease(); return pAction; } -bool CCIntervalAction::initWithDuration(cocos2d::ccTime d) +bool CCActionInterval::initWithDuration(cocos2d::ccTime d) { m_fDuration = d; @@ -62,21 +62,21 @@ bool CCIntervalAction::initWithDuration(cocos2d::ccTime d) return true; } -NSObject* CCIntervalAction::copyWithZone(NSZone *pZone) +NSObject* CCActionInterval::copyWithZone(NSZone *pZone) { NSZone* pNewZone = NULL; - CCIntervalAction* pCopy = NULL; + CCActionInterval* pCopy = NULL; if(pZone && pZone->m_pCopyObject) { //in case of being called at sub class - pCopy = (CCIntervalAction*)(pZone->m_pCopyObject); + pCopy = (CCActionInterval*)(pZone->m_pCopyObject); } else { // action's base class , must be called using __super::copyWithZone(), after overriding from derived class assert(0); - pCopy = new CCIntervalAction(); + pCopy = new CCActionInterval(); pZone = pNewZone = new NSZone(pCopy); } @@ -90,12 +90,12 @@ NSObject* CCIntervalAction::copyWithZone(NSZone *pZone) return pCopy; } -bool CCIntervalAction::isDone(void) +bool CCActionInterval::isDone(void) { return m_elapsed >= m_fDuration; } -void CCIntervalAction::step(ccTime dt) +void CCActionInterval::step(ccTime dt) { if (m_bFirstTick) { @@ -111,13 +111,13 @@ void CCIntervalAction::step(ccTime dt) update(1 > m_elapsed/m_fDuration ? m_elapsed/m_fDuration : 1); } -void CCIntervalAction::setAmplitudeRate(CGFloat amp) +void CCActionInterval::setAmplitudeRate(CGFloat amp) { // Abstract class needs implementation assert(0); } -CGFloat CCIntervalAction::getAmplitudeRate(void) +CGFloat CCActionInterval::getAmplitudeRate(void) { // Abstract class needs implementation assert(0); @@ -125,14 +125,14 @@ CGFloat CCIntervalAction::getAmplitudeRate(void) return 0; } -void CCIntervalAction::startWithTarget(CCNode *pTarget) +void CCActionInterval::startWithTarget(CCNode *pTarget) { CCFiniteTimeAction::startWithTarget(pTarget); m_elapsed = 0.0f; m_bFirstTick = true; } -CCIntervalAction* CCIntervalAction::reverse(void) +CCActionInterval* CCActionInterval::reverse(void) { /* NSException* myException = [NSException @@ -187,7 +187,7 @@ bool CCSequence::initOneTwo(cocos2d::CCFiniteTimeAction *pActionOne, cocos2d::CC assert(pActionTwo != NULL); ccTime d = pActionOne->getDuration() + pActionTwo->getDuration(); - CCIntervalAction::initWithDuration(d); + CCActionInterval::initWithDuration(d); m_pActions[0] = pActionOne; pActionOne->retain(); @@ -213,7 +213,7 @@ NSObject* CCSequence::copyWithZone(NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initOneTwo((CCFiniteTimeAction*)(m_pActions[0]->copy()->autorelease()), (CCFiniteTimeAction*)(m_pActions[1]->copy()->autorelease())); @@ -230,7 +230,7 @@ CCSequence::~CCSequence(void) void CCSequence::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_split = m_pActions[0]->getDuration() / m_fDuration; m_last = -1; } @@ -239,7 +239,7 @@ void CCSequence::stop(void) { m_pActions[0]->stop(); m_pActions[1]->stop(); - CCIntervalAction::stop(); + CCActionInterval::stop(); } void CCSequence::update(cocos2d::ccTime time) @@ -294,7 +294,7 @@ void CCSequence::update(cocos2d::ccTime time) m_last = found; } -CCIntervalAction* CCSequence::reverse(void) +CCActionInterval* CCSequence::reverse(void) { return CCSequence::actionOneTwo(m_pActions[1]->reverse(), m_pActions[0]->reverse()); } @@ -315,7 +315,7 @@ bool CCRepeat::initWithAction(cocos2d::CCFiniteTimeAction *pAction, unsigned int { ccTime d = pAction->getDuration() * times; - if (CCIntervalAction::initWithDuration(d)) + if (CCActionInterval::initWithDuration(d)) { m_uTimes = times; m_pOther = pAction; @@ -345,7 +345,7 @@ NSObject* CCRepeat::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithAction((CCFiniteTimeAction*)(m_pOther->copy()->autorelease()), m_uTimes); @@ -361,14 +361,14 @@ CCRepeat::~CCRepeat(void) void CCRepeat::startWithTarget(CCNode *pTarget) { m_uTotal = 0; - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(pTarget); } void CCRepeat::stop(void) { m_pOther->stop(); - CCIntervalAction::stop(); + CCActionInterval::stop(); } // issue #80. Instead of hooking step:, hook update: since it can be called by any @@ -418,7 +418,7 @@ bool CCRepeat::isDone(void) return m_uTotal == m_uTimes; } -CCIntervalAction* CCRepeat::reverse(void) +CCActionInterval* CCRepeat::reverse(void) { return CCRepeat::actionWithAction(m_pOther->reverse(), m_uTimes); } @@ -430,7 +430,7 @@ CCRepeatForever::~CCRepeatForever() { m_pOther->release(); } -CCRepeatForever *CCRepeatForever::actionWithAction(CCIntervalAction *pAction) +CCRepeatForever *CCRepeatForever::actionWithAction(CCActionInterval *pAction) { CCRepeatForever *pRet = new CCRepeatForever(); if (pRet && pRet->initWithAction(pAction)) @@ -442,7 +442,7 @@ CCRepeatForever *CCRepeatForever::actionWithAction(CCIntervalAction *pAction) return NULL; } -bool CCRepeatForever::initWithAction(CCIntervalAction *pAction) +bool CCRepeatForever::initWithAction(CCActionInterval *pAction) { assert(pAction != NULL); pAction->retain(); @@ -462,16 +462,16 @@ NSObject* CCRepeatForever::copyWithZone(NSZone *pZone) pRet = new CCRepeatForever(); pZone = pNewZone = new NSZone(pRet); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); // win32 : use the m_pOther's copy object. - pRet->initWithAction((CCIntervalAction*)(m_pOther->copy()->autorelease())); + pRet->initWithAction((CCActionInterval*)(m_pOther->copy()->autorelease())); CCX_SAFE_DELETE(pNewZone); return pRet; } void CCRepeatForever::startWithTarget(CCNode* pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(pTarget); } @@ -492,9 +492,9 @@ bool CCRepeatForever::isDone() return false; } -CCIntervalAction *CCRepeatForever::reverse() +CCActionInterval *CCRepeatForever::reverse() { - return (CCIntervalAction*)(CCRepeatForever::actionWithAction(m_pOther->reverse())); + return (CCActionInterval*)(CCRepeatForever::actionWithAction(m_pOther->reverse())); } // @@ -544,7 +544,7 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct // __super::initWithDuration(fmaxf(d1, d2)); float maxd = (d1 >= d2 || CCXMath::isnanCocos2d(d2)) ? d1 : d2; - CCIntervalAction::initWithDuration(maxd); + CCActionInterval::initWithDuration(maxd); m_pOne = pAction1; m_pTwo = pAction2; @@ -579,7 +579,7 @@ NSObject* CCSpawn::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initOneTwo((CCFiniteTimeAction*)(m_pOne->copy()->autorelease()), (CCFiniteTimeAction*)(m_pTwo->copy()->autorelease())); @@ -596,7 +596,7 @@ CCSpawn::~CCSpawn(void) void CCSpawn::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOne->startWithTarget(pTarget); m_pTwo->startWithTarget(pTarget); } @@ -605,7 +605,7 @@ void CCSpawn::stop(void) { m_pOne->stop(); m_pTwo->stop(); - CCIntervalAction::stop(); + CCActionInterval::stop(); } void CCSpawn::update(cocos2d::ccTime time) @@ -620,7 +620,7 @@ void CCSpawn::update(cocos2d::ccTime time) } } -CCIntervalAction* CCSpawn::reverse(void) +CCActionInterval* CCSpawn::reverse(void) { return CCSpawn::actionOneTwo(m_pOne->reverse(), m_pTwo->reverse()); } @@ -639,7 +639,7 @@ CCRotateTo* CCRotateTo::actionWithDuration(cocos2d::ccTime duration, float fDelt bool CCRotateTo::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fDstAngle = fDeltaAngle; return true; @@ -663,7 +663,7 @@ NSObject* CCRotateTo::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_fDstAngle); @@ -674,7 +674,7 @@ NSObject* CCRotateTo::copyWithZone(cocos2d::NSZone *pZone) void CCRotateTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_fStartAngle = pTarget->getRotation(); @@ -721,7 +721,7 @@ CCRotateBy* CCRotateBy::actionWithDuration(cocos2d::ccTime duration, float fDelt bool CCRotateBy::initWithDuration(cocos2d::ccTime duration, float fDeltaAngle) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fAngle = fDeltaAngle; return true; @@ -745,7 +745,7 @@ NSObject* CCRotateBy::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_fAngle); @@ -755,7 +755,7 @@ NSObject* CCRotateBy::copyWithZone(cocos2d::NSZone *pZone) void CCRotateBy::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_fStartAngle = pTarget->getRotation(); } @@ -768,7 +768,7 @@ void CCRotateBy::update(cocos2d::ccTime time) } } -CCIntervalAction* CCRotateBy::reverse(void) +CCActionInterval* CCRotateBy::reverse(void) { return CCRotateBy::actionWithDuration(m_fDuration, -m_fAngle); } @@ -787,7 +787,7 @@ CCMoveTo* CCMoveTo::actionWithDuration(cocos2d::ccTime duration, cocos2d::CGPoin bool CCMoveTo::initWithDuration(cocos2d::ccTime duration, cocos2d::CGPoint position) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_endPosition = position; return true; @@ -811,7 +811,7 @@ NSObject* CCMoveTo::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_endPosition); @@ -821,7 +821,7 @@ NSObject* CCMoveTo::copyWithZone(cocos2d::NSZone *pZone) void CCMoveTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_startPosition = pTarget->getPosition(); m_delta = ccpSub(m_endPosition, m_startPosition); } @@ -849,7 +849,7 @@ CCMoveBy* CCMoveBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CGPoin bool CCMoveBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CGPoint position) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_delta = position; return true; @@ -888,7 +888,7 @@ void CCMoveBy::startWithTarget(CCNode *pTarget) m_delta = dTmp; } -CCIntervalAction* CCMoveBy::reverse(void) +CCActionInterval* CCMoveBy::reverse(void) { return CCMoveBy::actionWithDuration(m_fDuration, ccp(-m_delta.x, -m_delta.y)); } @@ -907,7 +907,7 @@ CCJumpBy* CCJumpBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CGPoin bool CCJumpBy::initWithDuration(cocos2d::ccTime duration, cocos2d::CGPoint position, cocos2d::ccTime height, int jumps) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_delta = position; m_height = height; @@ -934,7 +934,7 @@ NSObject* CCJumpBy::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_delta, m_height, m_nJumps); @@ -944,7 +944,7 @@ NSObject* CCJumpBy::copyWithZone(cocos2d::NSZone *pZone) void CCJumpBy::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_startPosition = pTarget->getPosition(); } @@ -961,7 +961,7 @@ void CCJumpBy::update(cocos2d::ccTime time) } } -CCIntervalAction* CCJumpBy::reverse(void) +CCActionInterval* CCJumpBy::reverse(void) { return CCJumpBy::actionWithDuration(m_fDuration, ccp(-m_delta.x, -m_delta.y), m_height, m_nJumps); @@ -1034,7 +1034,7 @@ CCBezierBy* CCBezierBy::actionWithDuration(cocos2d::ccTime t, cocos2d::ccBezierC bool CCBezierBy::initWithDuration(cocos2d::ccTime t, cocos2d::ccBezierConfig c) { - if (CCIntervalAction::initWithDuration(t)) + if (CCActionInterval::initWithDuration(t)) { m_sConfig = c; return true; @@ -1045,7 +1045,7 @@ bool CCBezierBy::initWithDuration(cocos2d::ccTime t, cocos2d::ccBezierConfig c) void CCBezierBy::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_startPosition = pTarget->getPosition(); } @@ -1064,7 +1064,7 @@ NSObject* CCBezierBy::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_sConfig); @@ -1092,7 +1092,7 @@ void CCBezierBy::update(cocos2d::ccTime time) } } -CCIntervalAction* CCBezierBy::reverse(void) +CCActionInterval* CCBezierBy::reverse(void) { ccBezierConfig r; @@ -1161,7 +1161,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float s) bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float s) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fEndScaleX = s; m_fEndScaleY = s; @@ -1183,7 +1183,7 @@ CCScaleTo* CCScaleTo::actionWithDuration(cocos2d::ccTime duration, float sx, flo bool CCScaleTo::initWithDuration(cocos2d::ccTime duration, float sx, float sy) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fEndScaleX = sx; m_fEndScaleY = sy; @@ -1209,7 +1209,7 @@ NSObject* CCScaleTo::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_fEndScaleX, m_fEndScaleY); @@ -1220,7 +1220,7 @@ NSObject* CCScaleTo::copyWithZone(cocos2d::NSZone *pZone) void CCScaleTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_fStartScaleX = pTarget->getScaleX(); m_fStartScaleY = pTarget->getScaleY(); m_fDeltaX = m_fEndScaleX - m_fStartScaleX; @@ -1288,7 +1288,7 @@ void CCScaleBy::startWithTarget(CCNode *pTarget) m_fDeltaY = m_fStartScaleY * m_fEndScaleY - m_fStartScaleY; } -CCIntervalAction* CCScaleBy::reverse(void) +CCActionInterval* CCScaleBy::reverse(void) { return CCScaleBy::actionWithDuration(m_fDuration, 1 / m_fEndScaleX, 1 / m_fEndScaleY); } @@ -1307,7 +1307,7 @@ CCBlink* CCBlink::actionWithDuration(cocos2d::ccTime duration, unsigned int uBli bool CCBlink::initWithDuration(cocos2d::ccTime duration, unsigned int uBlinks) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_nTimes = uBlinks; return true; @@ -1332,7 +1332,7 @@ NSObject* CCBlink::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, (unsigned int)m_nTimes); @@ -1350,7 +1350,7 @@ void CCBlink::update(cocos2d::ccTime time) } } -CCIntervalAction* CCBlink::reverse(void) +CCActionInterval* CCBlink::reverse(void) { // return 'self' return CCBlink::actionWithDuration(m_fDuration, m_nTimes); @@ -1384,7 +1384,7 @@ NSObject* CCFadeIn::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); CCX_SAFE_DELETE(pNewZone); @@ -1401,7 +1401,7 @@ void CCFadeIn::update(cocos2d::ccTime time) /*m_pTarget->setOpacity((GLubyte)(255 * time));*/ } -CCIntervalAction* CCFadeIn::reverse(void) +CCActionInterval* CCFadeIn::reverse(void) { return CCFadeOut::actionWithDuration(m_fDuration); } @@ -1434,7 +1434,7 @@ NSObject* CCFadeOut::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); CCX_SAFE_DELETE(pNewZone); @@ -1451,7 +1451,7 @@ void CCFadeOut::update(cocos2d::ccTime time) /*m_pTarget->setOpacity(GLubyte(255 * (1 - time)));*/ } -CCIntervalAction* CCFadeOut::reverse(void) +CCActionInterval* CCFadeOut::reverse(void) { return CCFadeIn::actionWithDuration(m_fDuration); } @@ -1470,7 +1470,7 @@ CCFadeTo* CCFadeTo::actionWithDuration(cocos2d::ccTime duration, GLubyte opacity bool CCFadeTo::initWithDuration(cocos2d::ccTime duration, GLubyte opacity) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_toOpacity = opacity; return true; @@ -1494,7 +1494,7 @@ NSObject* CCFadeTo::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_toOpacity); @@ -1504,7 +1504,7 @@ NSObject* CCFadeTo::copyWithZone(cocos2d::NSZone *pZone) void CCFadeTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); CCRGBAProtocol *pRGBAProtocol = pTarget->convertToRGBAProtocol(); if (pRGBAProtocol) @@ -1538,7 +1538,7 @@ CCTintTo* CCTintTo::actionWithDuration(cocos2d::ccTime duration, GLubyte red, GL bool CCTintTo::initWithDuration(cocos2d::ccTime duration, GLubyte red, GLubyte green, GLubyte blue) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_to = ccc3(red, green, blue); return true; @@ -1562,7 +1562,7 @@ NSObject* CCTintTo::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_to.r, m_to.g, m_to.b); @@ -1572,7 +1572,7 @@ NSObject* CCTintTo::copyWithZone(cocos2d::NSZone *pZone) void CCTintTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); CCRGBAProtocol *pRGBAProtocol = m_pTarget->convertToRGBAProtocol(); if (pRGBAProtocol) { @@ -1606,7 +1606,7 @@ CCTintBy* CCTintBy::actionWithDuration(cocos2d::ccTime duration, GLshort deltaRe bool CCTintBy::initWithDuration(cocos2d::ccTime duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_deltaR = deltaRed; m_deltaG = deltaGreen; @@ -1633,7 +1633,7 @@ NSObject* CCTintBy::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, (GLubyte)m_deltaR, (GLubyte)m_deltaG, (GLubyte)m_deltaB); @@ -1643,7 +1643,7 @@ NSObject* CCTintBy::copyWithZone(cocos2d::NSZone *pZone) void CCTintBy::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); CCRGBAProtocol *pRGBAProtocol = pTarget->convertToRGBAProtocol(); if (pRGBAProtocol) @@ -1666,7 +1666,7 @@ void CCTintBy::update(cocos2d::ccTime time) } } -CCIntervalAction* CCTintBy::reverse(void) +CCActionInterval* CCTintBy::reverse(void) { return CCTintBy::actionWithDuration(m_fDuration, -m_deltaR, -m_deltaG, -m_deltaB); } @@ -1700,7 +1700,7 @@ NSObject* CCDelayTime::copyWithZone(cocos2d::NSZone *pZone) } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); CCX_SAFE_DELETE(pNewZone); @@ -1712,7 +1712,7 @@ void CCDelayTime::update(cocos2d::ccTime time) return; } -CCIntervalAction* CCDelayTime::reverse(void) +CCActionInterval* CCDelayTime::reverse(void) { return CCDelayTime::actionWithDuration(m_fDuration); } @@ -1732,7 +1732,7 @@ CCReverseTime* CCReverseTime::actionWithAction(cocos2d::CCFiniteTimeAction *pAct bool CCReverseTime::initWithAction(cocos2d::CCFiniteTimeAction *pAction) { - if (CCIntervalAction::initWithDuration(pAction->getDuration())) + if (CCActionInterval::initWithDuration(pAction->getDuration())) { m_pOther = pAction; pAction->retain(); @@ -1758,7 +1758,7 @@ NSObject* CCReverseTime::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithAction((CCFiniteTimeAction*)(m_pOther->copy()->autorelease())); @@ -1773,14 +1773,14 @@ CCReverseTime::~CCReverseTime(void) void CCReverseTime::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_pOther->startWithTarget(pTarget); } void CCReverseTime::stop(void) { m_pOther->stop(); - CCIntervalAction::stop(); + CCActionInterval::stop(); } void CCReverseTime::update(cocos2d::ccTime time) @@ -1791,9 +1791,9 @@ void CCReverseTime::update(cocos2d::ccTime time) } } -CCIntervalAction* CCReverseTime::reverse(void) +CCActionInterval* CCReverseTime::reverse(void) { - return (CCIntervalAction*)(m_pOther->copy()->autorelease()); + return (CCActionInterval*)(m_pOther->copy()->autorelease()); } // @@ -1828,7 +1828,7 @@ bool CCAnimate::initWithAnimation(cocos2d::CCAnimation *pAnimation, bool bRestor { assert(pAnimation); - if (CCIntervalAction::initWithDuration(pAnimation->getFrames()->count() * pAnimation->getDelay())) + if (CCActionInterval::initWithDuration(pAnimation->getFrames()->count() * pAnimation->getDelay())) { m_bRestoreOriginalFrame = bRestoreOriginalFrame; m_pAnimation = pAnimation; @@ -1854,7 +1854,7 @@ bool CCAnimate::initWithDuration(cocos2d::ccTime duration, cocos2d::CCAnimation { assert(pAnimation != NULL); - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_bRestoreOriginalFrame = bRestoreOriginalFrame; m_pAnimation = pAnimation; @@ -1882,7 +1882,7 @@ NSObject* CCAnimate::copyWithZone(cocos2d::NSZone *pZone) pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_pAnimation, m_bRestoreOriginalFrame); @@ -1898,7 +1898,7 @@ CCAnimate::~CCAnimate(void) void CCAnimate::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); CCSprite *pSprite = (CCSprite*)(pTarget); CCX_SAFE_RELEASE(m_pOrigFrame); @@ -1917,7 +1917,7 @@ void CCAnimate::stop(void) ((CCSprite*)(m_pTarget))->setDisplayFrame(m_pOrigFrame); } - CCIntervalAction::stop(); + CCActionInterval::stop(); } void CCAnimate::update(cocos2d::ccTime time) @@ -1939,7 +1939,7 @@ void CCAnimate::update(cocos2d::ccTime time) } } -CCIntervalAction* CCAnimate::reverse(void) +CCActionInterval* CCAnimate::reverse(void) { NSMutableArray *pOldArray = m_pAnimation->getFrames(); NSMutableArray *pNewArray = new NSMutableArray(pOldArray->count()); diff --git a/cocos2dx/actions/CCActionProgressTimer.cpp b/cocos2dx/actions/CCActionProgressTimer.cpp index 84b7df1d03..06a29f11ef 100644 --- a/cocos2dx/actions/CCActionProgressTimer.cpp +++ b/cocos2dx/actions/CCActionProgressTimer.cpp @@ -41,7 +41,7 @@ namespace cocos2d bool CCProgressTo::initWithDuration(cocos2d::ccTime duration, float fPercent) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fTo = fPercent; @@ -66,7 +66,7 @@ namespace cocos2d pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_fTo); @@ -76,7 +76,7 @@ namespace cocos2d void CCProgressTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); m_fFrom = ((kProgressTimerCast)(pTarget))->getPercentage(); // XXX: Is this correct ? @@ -105,7 +105,7 @@ namespace cocos2d bool CCProgressFromTo::initWithDuration(cocos2d::ccTime duration, float fFromPercentage, float fToPercentage) { - if (CCIntervalAction::initWithDuration(duration)) + if (CCActionInterval::initWithDuration(duration)) { m_fTo = fToPercentage; m_fFrom = fFromPercentage; @@ -131,7 +131,7 @@ namespace cocos2d pZone = pNewZone = new NSZone(pCopy); } - CCIntervalAction::copyWithZone(pZone); + CCActionInterval::copyWithZone(pZone); pCopy->initWithDuration(m_fDuration, m_fFrom, m_fTo); @@ -139,14 +139,14 @@ namespace cocos2d return pCopy; } - CCIntervalAction* CCProgressFromTo::reverse(void) + CCActionInterval* CCProgressFromTo::reverse(void) { return CCProgressFromTo::actionWithDuration(m_fDuration, m_fTo, m_fFrom); } void CCProgressFromTo::startWithTarget(CCNode *pTarget) { - CCIntervalAction::startWithTarget(pTarget); + CCActionInterval::startWithTarget(pTarget); } void CCProgressFromTo::update(cocos2d::ccTime time) diff --git a/cocos2dx/include/CCAction.h b/cocos2dx/include/CCAction.h index 7707c366ed..1f3e3e5570 100644 --- a/cocos2dx/include/CCAction.h +++ b/cocos2dx/include/CCAction.h @@ -132,7 +132,7 @@ protected: ccTime m_fDuration; }; -class CCIntervalAction; +class CCActionInterval; class CCRepeatForever; /** @@ -152,22 +152,22 @@ public: inline void setSpeed(float fSpeed) { m_fSpeed = fSpeed; } /** initializes the action */ - bool initWithAction(CCIntervalAction *pAction, float fRate); + bool initWithAction(CCActionInterval *pAction, float fRate); virtual NSObject* copyWithZone(NSZone *pZone); virtual void startWithTarget(CCNode* pTarget); virtual void stop(); virtual void step(ccTime dt); virtual bool isDone(void); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ - static CCSpeed* actionWithAction(CCIntervalAction *pAction, float fRate); + static CCSpeed* actionWithAction(CCActionInterval *pAction, float fRate); protected: float m_fSpeed; - CCIntervalAction *m_pOther; + CCActionInterval *m_pOther; }; diff --git a/cocos2dx/include/CCActionCamera.h b/cocos2dx/include/CCActionCamera.h index d2bfece7a4..b0bc499eb7 100644 --- a/cocos2dx/include/CCActionCamera.h +++ b/cocos2dx/include/CCActionCamera.h @@ -32,10 +32,10 @@ namespace cocos2d { /** @brief Base class for CCCamera actions */ - class CCX_DLL CCCameraAction : public CCIntervalAction // + class CCX_DLL CCActionCamera : public CCActionInterval // { public: - CCCameraAction() + CCActionCamera() :m_fCenterXOrig(0) ,m_fCenterYOrig(0) ,m_fCenterZOrig(0) @@ -46,10 +46,10 @@ namespace cocos2d { ,m_fUpYOrig(0) ,m_fUpZOrig(0) {} - virtual ~CCCameraAction(){} + virtual ~CCActionCamera(){} // super methods virtual void startWithTarget(CCNode *pTarget); - virtual CCIntervalAction * reverse(); + virtual CCActionInterval * reverse(); protected: float m_fCenterXOrig; float m_fCenterYOrig; @@ -68,7 +68,7 @@ namespace cocos2d { @brief CCOrbitCamera action Orbits the camera around the center of the screen using spherical coordinates */ - class CCX_DLL CCOrbitCamera : public CCCameraAction // + class CCX_DLL CCOrbitCamera : public CCActionCamera // { public: CCOrbitCamera(){} diff --git a/cocos2dx/include/CCActionEase.h b/cocos2dx/include/CCActionEase.h index cf8000c3df..a9083c5d2b 100644 --- a/cocos2dx/include/CCActionEase.h +++ b/cocos2dx/include/CCActionEase.h @@ -36,32 +36,32 @@ class NSZone; /** @brief Base class for Easing actions */ -class CCX_DLL CCEaseAction : public CCIntervalAction +class CCX_DLL CCActionEase : public CCActionInterval { public: - virtual ~CCEaseAction(void); + virtual ~CCActionEase(void); /** initializes the action */ - bool initWithAction(CCIntervalAction *pAction); + bool initWithAction(CCActionInterval *pAction); virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); virtual void stop(void); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ - static CCEaseAction* actionWithAction(CCIntervalAction *pAction); + static CCActionEase* actionWithAction(CCActionInterval *pAction); protected: - CCIntervalAction *m_pOther; + CCActionInterval *m_pOther; }; /** @brief Base class for Easing actions with rate parameters */ -class CCX_DLL CCEaseRateAction : public CCEaseAction +class CCX_DLL CCEaseRateAction : public CCActionEase { public: virtual ~CCEaseRateAction(void); @@ -72,14 +72,14 @@ public: inline float getRate(void) { return m_fRate; } /** Initializes the action with the inner action and the rate parameter */ - bool initWithAction(CCIntervalAction *pAction, float fRate); + bool initWithAction(CCActionInterval *pAction, float fRate); virtual NSObject* copyWithZone(NSZone* pZone); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** Creates the action with the inner action and the rate parameter */ - static CCEaseRateAction* actionWithAction(CCIntervalAction* pAction, float fRate); + static CCEaseRateAction* actionWithAction(CCActionInterval* pAction, float fRate); protected: float m_fRate; @@ -95,7 +95,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); public: /** Creates the action with the inner action and the rate parameter */ - static CCEaseIn* actionWithAction(CCIntervalAction* pAction, float fRate); + static CCEaseIn* actionWithAction(CCActionInterval* pAction, float fRate); }; /** @@ -109,7 +109,7 @@ public: public: /** Creates the action with the inner action and the rate parameter */ - static CCEaseOut* actionWithAction(CCIntervalAction* pAction, float fRate); + static CCEaseOut* actionWithAction(CCActionInterval* pAction, float fRate); }; /** @@ -120,48 +120,48 @@ class CCX_DLL CCEaseInOut : public CCEaseRateAction public: virtual void update(ccTime time); virtual NSObject* copyWithZone(NSZone* pZone); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** Creates the action with the inner action and the rate parameter */ - static CCEaseInOut* actionWithAction(CCIntervalAction* pAction, float fRate); + static CCEaseInOut* actionWithAction(CCActionInterval* pAction, float fRate); }; /** @brief CCEase Exponential In */ -class CCX_DLL CCEaseExponentialIn : public CCEaseAction +class CCX_DLL CCEaseExponentialIn : public CCActionEase { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseExponentialIn* actionWithAction(CCIntervalAction* pAction); + static CCEaseExponentialIn* actionWithAction(CCActionInterval* pAction); }; /** @brief Ease Exponential Out */ -class CCX_DLL CCEaseExponentialOut : public CCEaseAction +class CCX_DLL CCEaseExponentialOut : public CCActionEase { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseExponentialOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseExponentialOut* actionWithAction(CCActionInterval* pAction); }; /** @brief Ease Exponential InOut */ -class CCX_DLL CCEaseExponentialInOut : public CCEaseAction +class CCX_DLL CCEaseExponentialInOut : public CCActionEase { public: virtual void update(ccTime time); @@ -169,44 +169,44 @@ public: public: /** creates the action */ - static CCEaseExponentialInOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseExponentialInOut* actionWithAction(CCActionInterval* pAction); }; /** @brief Ease Sine In */ -class CCX_DLL CCEaseSineIn : public CCEaseAction +class CCX_DLL CCEaseSineIn : public CCActionEase { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseSineIn* actionWithAction(CCIntervalAction* pAction); + static CCEaseSineIn* actionWithAction(CCActionInterval* pAction); }; /** @brief Ease Sine Out */ -class CCX_DLL CCEaseSineOut : public CCEaseAction +class CCX_DLL CCEaseSineOut : public CCActionEase { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseSineOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseSineOut* actionWithAction(CCActionInterval* pAction); }; /** @brief Ease Sine InOut */ -class CCX_DLL CCEaseSineInOut : public CCEaseAction +class CCX_DLL CCEaseSineInOut : public CCActionEase { public: virtual void update(ccTime time); @@ -214,14 +214,14 @@ public: public: /** creates the action */ - static CCEaseSineInOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseSineInOut* actionWithAction(CCActionInterval* pAction); }; /** @brief Ease Elastic abstract class @since v0.8.2 */ -class CCX_DLL CCEaseElastic : public CCEaseAction +class CCX_DLL CCEaseElastic : public CCActionEase { public: /** get period of the wave in radians. default is 0.3 */ @@ -230,18 +230,18 @@ public: inline void setPeriod(float fPeriod) { m_fPeriod = fPeriod; } /** Initializes the action with the inner action and the period in radians (default is 0.3) */ - bool initWithAction(CCIntervalAction *pAction, float fPeriod); + bool initWithAction(CCActionInterval *pAction, float fPeriod); /** initializes the action */ - bool initWithAction(CCIntervalAction *pAction); + bool initWithAction(CCActionInterval *pAction); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseElastic* actionWithAction(CCIntervalAction *pAction); + static CCEaseElastic* actionWithAction(CCActionInterval *pAction); /** Creates the action with the inner action and the period in radians (default is 0.3) */ - static CCEaseElastic* actionWithAction(CCIntervalAction *pAction, float fPeriod); + static CCEaseElastic* actionWithAction(CCActionInterval *pAction, float fPeriod); protected: float m_fPeriod; @@ -256,14 +256,14 @@ class CCX_DLL CCEaseElasticIn : public CCEaseElastic { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseElasticIn* actionWithAction(CCIntervalAction *pAction); + static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction); /** Creates the action with the inner action and the period in radians (default is 0.3) */ - static CCEaseElasticIn* actionWithAction(CCIntervalAction *pAction, float fPeriod); + static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction, float fPeriod); }; /** @@ -275,14 +275,14 @@ class CCX_DLL CCEaseElasticOut : public CCEaseElastic { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseElasticOut* actionWithAction(CCIntervalAction *pAction); + static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction); /** Creates the action with the inner action and the period in radians (default is 0.3) */ - static CCEaseElasticOut* actionWithAction(CCIntervalAction *pAction, float fPeriod); + static CCEaseElasticOut* actionWithAction(CCActionInterval *pAction, float fPeriod); }; /** @@ -294,21 +294,21 @@ class CCX_DLL CCEaseElasticInOut : public CCEaseElastic { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseElasticInOut* actionWithAction(CCIntervalAction *pAction); + static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction); /** Creates the action with the inner action and the period in radians (default is 0.3) */ - static CCEaseElasticInOut* actionWithAction(CCIntervalAction *pAction, float fPeriod); + static CCEaseElasticInOut* actionWithAction(CCActionInterval *pAction, float fPeriod); }; /** @brief CCEaseBounce abstract class. @since v0.8.2 */ -class CCX_DLL CCEaseBounce : public CCEaseAction +class CCX_DLL CCEaseBounce : public CCActionEase { public: ccTime bounceTime(ccTime time); @@ -316,7 +316,7 @@ public: public: /** creates the action */ - static CCEaseBounce* actionWithAction(CCIntervalAction* pAction); + static CCEaseBounce* actionWithAction(CCActionInterval* pAction); }; /** @@ -328,12 +328,12 @@ class CCX_DLL CCEaseBounceIn : public CCEaseBounce { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseBounceIn* actionWithAction(CCIntervalAction* pAction); + static CCEaseBounceIn* actionWithAction(CCActionInterval* pAction); }; /** @@ -345,12 +345,12 @@ class CCX_DLL CCEaseBounceOut : public CCEaseBounce { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseBounceOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseBounceOut* actionWithAction(CCActionInterval* pAction); }; /** @@ -366,7 +366,7 @@ public: public: /** creates the action */ - static CCEaseBounceInOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseBounceInOut* actionWithAction(CCActionInterval* pAction); }; /** @@ -374,16 +374,16 @@ public: @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 */ -class CCX_DLL CCEaseBackIn : public CCEaseAction +class CCX_DLL CCEaseBackIn : public CCActionEase { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseBackIn* actionWithAction(CCIntervalAction* pAction); + static CCEaseBackIn* actionWithAction(CCActionInterval* pAction); }; /** @@ -391,16 +391,16 @@ public: @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 */ -class CCX_DLL CCEaseBackOut : public CCEaseAction +class CCX_DLL CCEaseBackOut : public CCActionEase { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: /** creates the action */ - static CCEaseBackOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseBackOut* actionWithAction(CCActionInterval* pAction); }; /** @@ -408,7 +408,7 @@ public: @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 */ -class CCX_DLL CCEaseBackInOut : public CCEaseAction +class CCX_DLL CCEaseBackInOut : public CCActionEase { public: virtual void update(ccTime time); @@ -416,7 +416,7 @@ public: public: /** creates the action */ - static CCEaseBackInOut* actionWithAction(CCIntervalAction* pAction); + static CCEaseBackInOut* actionWithAction(CCActionInterval* pAction); }; #endif // __ACTION_CCEASE_ACTION_H__ diff --git a/cocos2dx/include/CCActionGrid.h b/cocos2dx/include/CCActionGrid.h index 04f537c70a..f1d6d5bcf0 100644 --- a/cocos2dx/include/CCActionGrid.h +++ b/cocos2dx/include/CCActionGrid.h @@ -32,12 +32,12 @@ namespace cocos2d class CCGridBase; /** @brief Base class for Grid actions */ - class CCX_DLL CCGridAction : public CCIntervalAction + class CCX_DLL CCGridAction : public CCActionInterval { public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); /** initializes the action with size and duration */ virtual bool initWithSize(ccGridSize gridSize, ccTime duration); @@ -93,7 +93,7 @@ namespace cocos2d }; /** @brief CCAccelDeccelAmplitude action */ - class CCX_DLL CCAccelDeccelAmplitude : public CCIntervalAction + class CCX_DLL CCAccelDeccelAmplitude : public CCActionInterval { public: virtual ~CCAccelDeccelAmplitude(void); @@ -102,7 +102,7 @@ namespace cocos2d virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); /** get amplitude rate */ inline float getRate(void) { return m_fRate; } @@ -115,11 +115,11 @@ namespace cocos2d protected: float m_fRate; - CCIntervalAction *m_pOther; + CCActionInterval *m_pOther; }; /** @brief CCAccelAmplitude action */ - class CCX_DLL CCAccelAmplitude : public CCIntervalAction + class CCX_DLL CCAccelAmplitude : public CCActionInterval { public: ~CCAccelAmplitude(void); @@ -133,7 +133,7 @@ namespace cocos2d virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action with an inner action that has the amplitude property, and a duration time */ @@ -141,11 +141,11 @@ namespace cocos2d protected: float m_fRate; - CCIntervalAction *m_pOther; + CCActionInterval *m_pOther; }; /** @brief CCDeccelAmplitude action */ - class CCX_DLL CCDeccelAmplitude : public CCIntervalAction + class CCX_DLL CCDeccelAmplitude : public CCActionInterval { public: ~CCDeccelAmplitude(void); @@ -159,7 +159,7 @@ namespace cocos2d virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action with an inner action that has the amplitude property, and a duration time */ @@ -167,7 +167,7 @@ namespace cocos2d protected: float m_fRate; - CCIntervalAction *m_pOther; + CCActionInterval *m_pOther; }; /** @brief CCStopGrid action. @@ -175,7 +175,7 @@ namespace cocos2d Call if you want to remove the the grid effect. Example: CCSequence::actions(Lens::action(...), CCStopGrid::action(...), NULL); */ - class CCX_DLL CCStopGrid : public CCInstantAction + class CCX_DLL CCStopGrid : public CCActionInstant { public: virtual void startWithTarget(CCNode *pTarget); @@ -186,7 +186,7 @@ namespace cocos2d }; /** @brief CCReuseGrid action */ - class CCX_DLL CCReuseGrid : public CCInstantAction + class CCX_DLL CCReuseGrid : public CCActionInstant { public: /** initializes an action with the number of times that the current grid will be reused */ diff --git a/cocos2dx/include/CCActionInstant.h b/cocos2dx/include/CCActionInstant.h index 585f853b47..16b274af09 100644 --- a/cocos2dx/include/CCActionInstant.h +++ b/cocos2dx/include/CCActionInstant.h @@ -34,11 +34,11 @@ namespace cocos2d { @brief Instant actions are immediate actions. They don't have a duration like the CCIntervalAction actions. */ - class CCX_DLL CCInstantAction : public CCFiniteTimeAction // + class CCX_DLL CCActionInstant : public CCFiniteTimeAction // { public: - CCInstantAction(); - virtual ~CCInstantAction(){} + CCActionInstant(); + virtual ~CCActionInstant(){} // CCAction methods virtual NSObject* copyWithZone(NSZone *pZone); virtual bool isDone(void); @@ -50,7 +50,7 @@ namespace cocos2d { /** @brief Show the node */ - class CCX_DLL CCShow : public CCInstantAction + class CCX_DLL CCShow : public CCActionInstant { public: CCShow(){} @@ -67,7 +67,7 @@ namespace cocos2d { /** @brief Hide the node */ - class CCX_DLL CCHide : public CCInstantAction + class CCX_DLL CCHide : public CCActionInstant { public: CCHide(){} @@ -83,7 +83,7 @@ namespace cocos2d { /** @brief Toggles the visibility of a node */ - class CCX_DLL CCToggleVisibility : public CCInstantAction + class CCX_DLL CCToggleVisibility : public CCActionInstant { public: CCToggleVisibility(){} @@ -100,7 +100,7 @@ namespace cocos2d { @brief Flips the sprite horizontally @since v0.99.0 */ - class CCX_DLL CCFlipX : public CCInstantAction + class CCX_DLL CCFlipX : public CCActionInstant { public: CCFlipX(){} @@ -123,7 +123,7 @@ namespace cocos2d { @brief Flips the sprite vertically @since v0.99.0 */ - class CCX_DLL CCFlipY : public CCInstantAction + class CCX_DLL CCFlipY : public CCActionInstant { public: CCFlipY(){} @@ -144,7 +144,7 @@ namespace cocos2d { /** @brief Places the node in a certain position */ - class CCX_DLL CCPlace : public CCInstantAction // + class CCX_DLL CCPlace : public CCActionInstant // { public: CCPlace(){} @@ -162,7 +162,7 @@ namespace cocos2d { /** @brief Calls a 'callback' */ - class CCX_DLL CCCallFunc : public CCInstantAction // + class CCX_DLL CCCallFunc : public CCActionInstant // { public: CCCallFunc() diff --git a/cocos2dx/include/CCActionInterval.h b/cocos2dx/include/CCActionInterval.h index eec14fa747..7b32e94f16 100644 --- a/cocos2dx/include/CCActionInterval.h +++ b/cocos2dx/include/CCActionInterval.h @@ -37,7 +37,7 @@ namespace cocos2d { It has an start time, and a finish time. The finish time is the parameter duration plus the start time. -These CCIntervalAction actions have some interesting properties, like: +These CCActionInterval actions have some interesting properties, like: - They can run normally (default) - They can run reversed with the reverse method - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. @@ -49,7 +49,7 @@ Example: CCAction *pingPongAction = CCSequence::actions(action, action->reverse(), NULL); */ -class CCX_DLL CCIntervalAction : public CCFiniteTimeAction +class CCX_DLL CCActionInterval : public CCFiniteTimeAction { public: /** how many seconds had elapsed since the actions started to run. */ @@ -65,11 +65,11 @@ public: virtual void step(ccTime dt); virtual void startWithTarget(CCNode *pTarget); /** returns a reversed action */ - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ - static CCIntervalAction* actionWithDuration(ccTime d); + static CCActionInterval* actionWithDuration(ccTime d); public: //extension in CCGridAction @@ -83,7 +83,7 @@ protected: /** @brief Runs actions sequentially, one after another */ -class CCX_DLL CCSequence : public CCIntervalAction +class CCX_DLL CCSequence : public CCActionInterval { public: ~CCSequence(void); @@ -95,7 +95,7 @@ public: virtual void startWithTarget(CCNode *pTarget); virtual void stop(void); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** helper constructor to create an array of sequenceable actions */ @@ -112,7 +112,7 @@ protected: /** @brief Repeats an action a number of times. * To repeat an action forever use the CCRepeatForever action. */ -class CCX_DLL CCRepeat : public CCIntervalAction +class CCX_DLL CCRepeat : public CCActionInterval { public: ~CCRepeat(void); @@ -125,7 +125,7 @@ public: virtual void stop(void); virtual void update(ccTime time); virtual bool isDone(void); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates a CCRepeat action. Times is an unsigned integer between 1 and pow(2,30) */ @@ -141,31 +141,31 @@ protected: 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 */ -class CCX_DLL CCRepeatForever : public CCIntervalAction +class CCX_DLL CCRepeatForever : public CCActionInterval { public: CCRepeatForever(){} virtual ~CCRepeatForever(); /** initializes the action */ - bool initWithAction(CCIntervalAction *pAction); + bool initWithAction(CCActionInterval *pAction); virtual NSObject* copyWithZone(NSZone *pZone); virtual void startWithTarget(CCNode* pTarget); virtual void step(ccTime dt); virtual bool isDone(void); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ - static CCRepeatForever* actionWithAction(CCIntervalAction *pAction); + static CCRepeatForever* actionWithAction(CCActionInterval *pAction); protected: - CCIntervalAction *m_pOther; + CCActionInterval *m_pOther; }; /** @brief Spawn a new action immediately */ -class CCX_DLL CCSpawn : public CCIntervalAction +class CCX_DLL CCSpawn : public CCActionInterval { public: ~CCSpawn(void); @@ -177,7 +177,7 @@ public: virtual void startWithTarget(CCNode *pTarget); virtual void stop(void); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** helper constructor to create an array of spawned actions */ @@ -195,7 +195,7 @@ protected: rotation attribute. The direction will be decided by the shortest angle. */ -class CCX_DLL CCRotateTo : public CCIntervalAction +class CCX_DLL CCRotateTo : public CCActionInterval { public: /** initializes the action */ @@ -217,7 +217,7 @@ protected: /** @brief Rotates a CCNode object clockwise a number of degrees by modifying it's rotation attribute. */ -class CCX_DLL CCRotateBy : public CCIntervalAction +class CCX_DLL CCRotateBy : public CCActionInterval { public: /** initializes the action */ @@ -226,7 +226,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ @@ -239,7 +239,7 @@ protected: /** @brief Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying it's position attribute. */ -class CCX_DLL CCMoveTo : public CCIntervalAction +class CCX_DLL CCMoveTo : public CCActionInterval { public: /** initializes the action */ @@ -271,7 +271,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ @@ -280,7 +280,7 @@ public: /** @brief Moves a CCNode object simulating a parabolic jump movement by modifying it's position attribute. */ -class CCX_DLL CCJumpBy : public CCIntervalAction +class CCX_DLL CCJumpBy : public CCActionInterval { public: /** initializes the action */ @@ -289,7 +289,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ @@ -328,7 +328,7 @@ typedef struct _ccBezierConfig { /** @brief An action that moves the target with a cubic Bezier curve by a certain distance. */ -class CCX_DLL CCBezierBy : public CCIntervalAction +class CCX_DLL CCBezierBy : public CCActionInterval { public: /** initializes the action with a duration and a bezier configuration */ @@ -337,7 +337,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action with a duration and a bezier configuration */ @@ -365,7 +365,7 @@ public: /** @brief Scales a CCNode object to a zoom factor by modifying it's scale attribute. @warning This action doesn't support "reverse" */ -class CCX_DLL CCScaleTo : public CCIntervalAction +class CCX_DLL CCScaleTo : public CCActionInterval { public: /** initializes the action with the same scale factor for X and Y */ @@ -401,7 +401,7 @@ class CCX_DLL CCScaleBy : public CCScaleTo { public: virtual void startWithTarget(CCNode *pTarget); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: @@ -414,7 +414,7 @@ public: /** @brief Blinks a CCNode object by modifying it's visible attribute */ -class CCX_DLL CCBlink : public CCIntervalAction +class CCX_DLL CCBlink : public CCActionInterval { public: /** initializes the action */ @@ -422,7 +422,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ @@ -434,11 +434,11 @@ protected: /** @brief Fades In an object that implements the CCRGBAProtocol protocol. It modifies the opacity from 0 to 255. The "reverse" of this action is FadeOut */ -class CCX_DLL CCFadeIn : public CCIntervalAction +class CCX_DLL CCFadeIn : public CCActionInterval { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: @@ -449,11 +449,11 @@ public: /** @brief Fades Out an object that implements the CCRGBAProtocol protocol. It modifies the opacity from 255 to 0. The "reverse" of this action is FadeIn */ -class CCX_DLL CCFadeOut : public CCIntervalAction +class CCX_DLL CCFadeOut : public CCActionInterval { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: @@ -464,7 +464,7 @@ public: /** @brief Fades an object that implements the CCRGBAProtocol protocol. It modifies the opacity from the current value to a custom one. @warning This action doesn't support "reverse" */ -class CCX_DLL CCFadeTo : public CCIntervalAction +class CCX_DLL CCFadeTo : public CCActionInterval { public: /** initializes the action with duration and opacity */ @@ -487,7 +487,7 @@ protected: @warning This action doesn't support "reverse" @since v0.7.2 */ -class CCX_DLL CCTintTo : public CCIntervalAction +class CCX_DLL CCTintTo : public CCActionInterval { public: /** initializes the action with duration and color */ @@ -509,7 +509,7 @@ protected: /** @brief Tints a CCNode that implements the CCNodeRGB protocol from current tint to a custom one. @since v0.7.2 */ -class CCX_DLL CCTintBy : public CCIntervalAction +class CCX_DLL CCTintBy : public CCActionInterval { public: /** initializes the action with duration and color */ @@ -518,7 +518,7 @@ public: virtual NSObject* copyWithZone(NSZone* pZone); virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates an action with duration and color */ @@ -536,11 +536,11 @@ protected: /** @brief Delays the action a certain amount of seconds */ -class CCX_DLL CCDelayTime : public CCIntervalAction +class CCX_DLL CCDelayTime : public CCActionInterval { public: virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual NSObject* copyWithZone(NSZone* pZone); public: @@ -555,7 +555,7 @@ public: of your own actions, but using it outside the "reversed" scope is not recommended. */ -class CCX_DLL CCReverseTime : public CCIntervalAction +class CCX_DLL CCReverseTime : public CCActionInterval { public: ~CCReverseTime(void); @@ -567,7 +567,7 @@ public: virtual void startWithTarget(CCNode *pTarget); virtual void stop(void); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action */ @@ -579,7 +579,7 @@ protected: class CCTexture2D; /** @brief Animates a sprite given the name of an Animation */ -class CCX_DLL CCAnimate : public CCIntervalAction +class CCX_DLL CCAnimate : public CCActionInterval { public: ~CCAnimate(void); @@ -610,7 +610,7 @@ public: virtual void startWithTarget(CCNode *pTarget); virtual void stop(void); virtual void update(ccTime time); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); public: /** creates the action with an Animation and will restore the original frame when the animation is over */ diff --git a/cocos2dx/include/CCActionProgressTimer.h b/cocos2dx/include/CCActionProgressTimer.h index 3eb5385038..c58e8eab19 100644 --- a/cocos2dx/include/CCActionProgressTimer.h +++ b/cocos2dx/include/CCActionProgressTimer.h @@ -33,7 +33,7 @@ namespace cocos2d @brief Progress to percentage @since v0.99.1 */ -class CCX_DLL CCProgressTo : public CCIntervalAction +class CCX_DLL CCProgressTo : public CCActionInterval { public: /** Initializes with a duration and a percent */ @@ -56,14 +56,14 @@ protected: @brief Progress from a percentage to another percentage @since v0.99.1 */ -class CCX_DLL CCProgressFromTo : public CCIntervalAction +class CCX_DLL CCProgressFromTo : public CCActionInterval { public: /** Initializes the action with a duration, a "from" percentage and a "to" percentage */ bool initWithDuration(ccTime duration, float fFromPercentage, float fToPercentage); virtual NSObject* copyWithZone(NSZone *pZone); - virtual CCIntervalAction* reverse(void); + virtual CCActionInterval* reverse(void); virtual void startWithTarget(CCNode *pTarget); virtual void update(ccTime time); diff --git a/cocos2dx/include/CCPageTurnTransition.h b/cocos2dx/include/CCPageTurnTransition.h index 4bca1901b2..850f46fc5f 100644 --- a/cocos2dx/include/CCPageTurnTransition.h +++ b/cocos2dx/include/CCPageTurnTransition.h @@ -62,7 +62,7 @@ public: */ virtual bool initWithDuration(ccTime t,CCScene* scene,bool backwards); - CCIntervalAction* actionWithSize(ccGridSize vector); + CCActionInterval* actionWithSize(ccGridSize vector); virtual void onEnter(); diff --git a/cocos2dx/include/CCTransition.h b/cocos2dx/include/CCTransition.h index 71454b3deb..4474e98b39 100644 --- a/cocos2dx/include/CCTransition.h +++ b/cocos2dx/include/CCTransition.h @@ -34,7 +34,7 @@ namespace cocos2d { #define DECLEAR_TRANSITIONWITHDURATION(_Type)\ static _Type* transitionWithDuration(ccTime t, CCScene* scene); -class CCIntervalAction; +class CCActionInterval; class CCNode; /** @brief CCTransitionEaseScene can ease the actions of the scene protocol. @@ -46,7 +46,7 @@ public: /** returns the Ease action that will be performed on a linear action. @since v0.8.2 */ - virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action) = 0; + virtual CCActionInterval * easeActionWithAction(CCActionInterval * action) = 0; }; /** Orientation Type used by some transitions @@ -157,9 +157,9 @@ public: /** initializes the scenes */ virtual void initScenes(void); /** returns the action that will be performed */ - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); - virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action); + virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); virtual void onEnter(); @@ -217,11 +217,11 @@ public: /** initializes the scenes */ virtual void initScenes(void); /** returns the action that will be performed by the incomming and outgoing scene */ - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); virtual void onEnter(); - virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action); + virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); DECLEAR_TRANSITIONWITHDURATION(CCSlideInLTransition); protected: @@ -240,7 +240,7 @@ public: /** initializes the scenes */ virtual void initScenes(void); /** returns the action that will be performed by the incomming and outgoing scene */ - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); DECLEAR_TRANSITIONWITHDURATION(CCSlideInRTransition); protected: @@ -259,7 +259,7 @@ public: /** initializes the scenes */ virtual void initScenes(void); /** returns the action that will be performed by the incomming and outgoing scene */ - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); DECLEAR_TRANSITIONWITHDURATION(CCSlideInBTransition); protected: @@ -278,7 +278,7 @@ public: /** initializes the scenes */ virtual void initScenes(void); /** returns the action that will be performed by the incomming and outgoing scene */ - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); DECLEAR_TRANSITIONWITHDURATION(CCSlideInTTransition); protected: @@ -295,7 +295,7 @@ public: virtual ~CCShrinkGrowTransition(); virtual void onEnter(); - virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action); + virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); DECLEAR_TRANSITIONWITHDURATION(CCShrinkGrowTransition); }; @@ -444,7 +444,7 @@ public : virtual ~CCTurnOffTilesTransition(); virtual void onEnter(); - virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action); + virtual CCActionInterval * easeActionWithAction(CCActionInterval * action); public: DECLEAR_TRANSITIONWITHDURATION(CCTurnOffTilesTransition); @@ -461,9 +461,9 @@ public: CCSplitColsTransition(); virtual ~CCSplitColsTransition(); - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); virtual void onEnter(); - virtual CCIntervalAction * easeActionWithAction(CCIntervalAction * action); + virtual CCActionInterval * easeActionWithAction(CCActionInterval * action); public: DECLEAR_TRANSITIONWITHDURATION(CCSplitColsTransition); @@ -478,7 +478,7 @@ public: CCSplitRowsTransition(); virtual ~CCSplitRowsTransition(); - virtual CCIntervalAction* action(void); + virtual CCActionInterval* action(void); public: DECLEAR_TRANSITIONWITHDURATION(CCSplitRowsTransition) @@ -492,9 +492,9 @@ class CCX_DLL CCFadeTRTransition : public CCTransitionScene , public CCTransitio public: CCFadeTRTransition(); virtual ~CCFadeTRTransition(); - virtual CCIntervalAction* actionWithSize(ccGridSize size); + virtual CCActionInterval* actionWithSize(ccGridSize size); virtual void onEnter(); - virtual CCIntervalAction* easeActionWithAction(CCIntervalAction * action); + virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); public: DECLEAR_TRANSITIONWITHDURATION(CCFadeTRTransition) @@ -511,7 +511,7 @@ class CCX_DLL CCFadeBLTransition : public CCFadeTRTransition public: CCFadeBLTransition(); virtual ~CCFadeBLTransition(); - virtual CCIntervalAction* actionWithSize(ccGridSize size); + virtual CCActionInterval* actionWithSize(ccGridSize size); public: DECLEAR_TRANSITIONWITHDURATION(CCFadeBLTransition) @@ -525,7 +525,7 @@ class CCX_DLL CCFadeUpTransition : public CCFadeTRTransition public: CCFadeUpTransition(); virtual ~CCFadeUpTransition(); - virtual CCIntervalAction* actionWithSize(ccGridSize size); + virtual CCActionInterval* actionWithSize(ccGridSize size); public: DECLEAR_TRANSITIONWITHDURATION(CCFadeUpTransition) @@ -539,7 +539,7 @@ class CCX_DLL CCFadeDownTransition : public CCFadeTRTransition public: CCFadeDownTransition(); virtual ~CCFadeDownTransition(); - virtual CCIntervalAction* actionWithSize(ccGridSize size); + virtual CCActionInterval* actionWithSize(ccGridSize size); public: DECLEAR_TRANSITIONWITHDURATION(CCFadeDownTransition) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp index 24bf69a606..26285190b2 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCPageTurnTransition.cpp @@ -79,7 +79,7 @@ void CCPageTurnTransition::onEnter() x=12;y=16; } - CCIntervalAction *action = this->actionWithSize(ccg(x,y)); + CCActionInterval *action = this->actionWithSize(ccg(x,y)); if(! m_bBack ) { @@ -113,7 +113,7 @@ void CCPageTurnTransition::onEnter() } -CCIntervalAction* CCPageTurnTransition:: actionWithSize(ccGridSize vector) +CCActionInterval* CCPageTurnTransition:: actionWithSize(ccGridSize vector) { if( m_bBack ) { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp index cbe120da85..74a8869668 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp @@ -238,7 +238,7 @@ void CCRotoZoomTransition:: onEnter() m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f)); m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f)); - CCIntervalAction *rotozoom = (CCIntervalAction*)(CCSequence::actions + CCActionInterval *rotozoom = (CCActionInterval*)(CCSequence::actions ( CCSpawn::actions ( @@ -285,14 +285,14 @@ void CCJumpZoomTransition::onEnter() m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f)); m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f)); - CCIntervalAction *jump = CCJumpBy::actionWithDuration(m_fDuration/4, ccp(-s.width,0), s.width/4, 2); - CCIntervalAction *scaleIn = CCScaleTo::actionWithDuration(m_fDuration/4, 1.0f); - CCIntervalAction *scaleOut = CCScaleTo::actionWithDuration(m_fDuration/4, 0.5f); + CCActionInterval *jump = CCJumpBy::actionWithDuration(m_fDuration/4, ccp(-s.width,0), s.width/4, 2); + CCActionInterval *scaleIn = CCScaleTo::actionWithDuration(m_fDuration/4, 1.0f); + CCActionInterval *scaleOut = CCScaleTo::actionWithDuration(m_fDuration/4, 0.5f); - CCIntervalAction *jumpZoomOut = (CCIntervalAction*)(CCSequence::actions(scaleOut, jump, NULL)); - CCIntervalAction *jumpZoomIn = (CCIntervalAction*)(CCSequence::actions(jump, scaleIn, NULL)); + CCActionInterval *jumpZoomOut = (CCActionInterval*)(CCSequence::actions(scaleOut, jump, NULL)); + CCActionInterval *jumpZoomIn = (CCActionInterval*)(CCSequence::actions(jump, scaleIn, NULL)); - CCIntervalAction *delay = CCDelayTime::actionWithDuration(m_fDuration/2); + CCActionInterval *delay = CCDelayTime::actionWithDuration(m_fDuration/2); m_pOutScene->runAction(jumpZoomOut); m_pInScene->runAction @@ -324,7 +324,7 @@ void CCMoveInLTransition::onEnter() CCTransitionScene::onEnter(); this->initScenes(); - CCIntervalAction *a = this->action(); + CCActionInterval *a = this->action(); m_pInScene->runAction ( @@ -337,12 +337,12 @@ void CCMoveInLTransition::onEnter() ); } -CCIntervalAction* CCMoveInLTransition::action() +CCActionInterval* CCMoveInLTransition::action() { return CCMoveTo::actionWithDuration(m_fDuration, ccp(0,0)); } -CCIntervalAction* CCMoveInLTransition::easeActionWithAction(CCIntervalAction* action) +CCActionInterval* CCMoveInLTransition::easeActionWithAction(CCActionInterval* action) { return CCEaseOut::actionWithAction(action, 2.0f); // return [EaseElasticOut actionWithAction:action period:0.4f]; @@ -432,11 +432,11 @@ void CCSlideInLTransition::onEnter() CCTransitionScene::onEnter(); this->initScenes(); - CCIntervalAction *in = this->action(); - CCIntervalAction *out = this->action(); + CCActionInterval *in = this->action(); + CCActionInterval *out = this->action(); - CCIntervalAction* inAction = easeActionWithAction(in); - CCIntervalAction* outAction = (CCIntervalAction*)CCSequence::actions + CCActionInterval* inAction = easeActionWithAction(in); + CCActionInterval* outAction = (CCActionInterval*)CCSequence::actions ( easeActionWithAction(out), CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), @@ -457,13 +457,13 @@ void CCSlideInLTransition:: initScenes() m_pInScene->setPosition( ccp(-(s.width-ADJUST_FACTOR),0) ); } -CCIntervalAction* CCSlideInLTransition::action() +CCActionInterval* CCSlideInLTransition::action() { CGSize s = CCDirector::sharedDirector()->getWinSize(); return CCMoveBy::actionWithDuration(m_fDuration, ccp(s.width-ADJUST_FACTOR,0)); } -CCIntervalAction* CCSlideInLTransition::easeActionWithAction(CCIntervalAction* action) +CCActionInterval* CCSlideInLTransition::easeActionWithAction(CCActionInterval* action) { return CCEaseOut::actionWithAction(action, 2.0f); // return [EaseElasticOut actionWithAction:action period:0.4f]; @@ -494,7 +494,7 @@ void CCSlideInRTransition::initScenes() } -CCIntervalAction* CCSlideInRTransition:: action() +CCActionInterval* CCSlideInRTransition:: action() { CGSize s = CCDirector::sharedDirector()->getWinSize(); return CCMoveBy::actionWithDuration(m_fDuration, ccp(-(s.width-ADJUST_FACTOR),0)); @@ -525,7 +525,7 @@ void CCSlideInTTransition::initScenes() } -CCIntervalAction* CCSlideInTTransition::action() +CCActionInterval* CCSlideInTTransition::action() { CGSize s = CCDirector::sharedDirector()->getWinSize(); return CCMoveBy::actionWithDuration(m_fDuration, ccp(0,-(s.height-ADJUST_FACTOR))); @@ -555,7 +555,7 @@ void CCSlideInBTransition:: initScenes() } -CCIntervalAction* CCSlideInBTransition:: action() +CCActionInterval* CCSlideInBTransition:: action() { CGSize s = CCDirector::sharedDirector()->getWinSize(); return CCMoveBy::actionWithDuration(m_fDuration, ccp(0,s.height-ADJUST_FACTOR)); @@ -583,8 +583,8 @@ void CCShrinkGrowTransition::onEnter() m_pInScene->setAnchorPoint(ccp(2/3.0f,0.5f)); m_pOutScene->setAnchorPoint(ccp(1/3.0f,0.5f)); - CCIntervalAction* scaleOut = CCScaleTo::actionWithDuration(m_fDuration, 0.01f); - CCIntervalAction* scaleIn = CCScaleTo::actionWithDuration(m_fDuration, 1.0f); + CCActionInterval* scaleOut = CCScaleTo::actionWithDuration(m_fDuration, 0.01f); + CCActionInterval* scaleIn = CCScaleTo::actionWithDuration(m_fDuration, 1.0f); m_pInScene->runAction(this->easeActionWithAction(scaleIn)); m_pOutScene->runAction @@ -597,7 +597,7 @@ void CCShrinkGrowTransition::onEnter() ) ); } -CCIntervalAction* CCShrinkGrowTransition:: easeActionWithAction(CCIntervalAction* action) +CCActionInterval* CCShrinkGrowTransition:: easeActionWithAction(CCActionInterval* action) { return CCEaseOut::actionWithAction(action, 2.0f); // return [EaseElasticOut actionWithAction:action period:0.3f]; @@ -619,7 +619,7 @@ void CCFlipXTransition::onEnter() { CCOrientedTransitionScene::onEnter(); - CCIntervalAction *inA, *outA; + CCActionInterval *inA, *outA; m_pInScene->setIsVisible(false); float inDeltaZ, inAngleZ; @@ -640,7 +640,7 @@ void CCFlipXTransition::onEnter() outAngleZ = 0; } - inA = (CCIntervalAction*)CCSequence::actions + inA = (CCActionInterval*)CCSequence::actions ( CCDelayTime::actionWithDuration(m_fDuration/2), CCShow::action(), @@ -649,7 +649,7 @@ void CCFlipXTransition::onEnter() NULL ); - outA = (CCIntervalAction *)CCSequence::actions + outA = (CCActionInterval *)CCSequence::actions ( CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 0, 0), CCHide::action(), @@ -684,7 +684,7 @@ void CCFlipYTransition::onEnter() { CCOrientedTransitionScene::onEnter(); - CCIntervalAction *inA, *outA; + CCActionInterval *inA, *outA; m_pInScene->setIsVisible(false); float inDeltaZ, inAngleZ; @@ -705,7 +705,7 @@ void CCFlipYTransition::onEnter() outAngleZ = 0; } - inA = (CCIntervalAction*)CCSequence::actions + inA = (CCActionInterval*)CCSequence::actions ( CCDelayTime::actionWithDuration(m_fDuration/2), CCShow::action(), @@ -713,7 +713,7 @@ void CCFlipYTransition::onEnter() CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), NULL ); - outA = (CCIntervalAction*)CCSequence::actions + outA = (CCActionInterval*)CCSequence::actions ( CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 90, 0), CCHide::action(), @@ -749,7 +749,7 @@ void CCFlipAngularTransition::onEnter() { CCOrientedTransitionScene::onEnter(); - CCIntervalAction *inA, *outA; + CCActionInterval *inA, *outA; m_pInScene->setIsVisible(false); float inDeltaZ, inAngleZ; @@ -770,7 +770,7 @@ void CCFlipAngularTransition::onEnter() outAngleZ = 0; } - inA = (CCIntervalAction *)CCSequence::actions + inA = (CCActionInterval *)CCSequence::actions ( CCDelayTime::actionWithDuration(m_fDuration/2), CCShow::action(), @@ -778,7 +778,7 @@ void CCFlipAngularTransition::onEnter() CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), NULL ); - outA = (CCIntervalAction *)CCSequence::actions + outA = (CCActionInterval *)CCSequence::actions ( CCOrbitCamera::actionWithDuration(m_fDuration/2, 1, 0, outAngleZ, outDeltaZ, 45, 0), CCHide::action(), @@ -813,7 +813,7 @@ void CCZoomFlipXTransition::onEnter() { CCOrientedTransitionScene::onEnter(); - CCIntervalAction *inA, *outA; + CCActionInterval *inA, *outA; m_pInScene->setIsVisible(false); float inDeltaZ, inAngleZ; @@ -832,7 +832,7 @@ void CCZoomFlipXTransition::onEnter() outDeltaZ = -90; outAngleZ = 0; } - inA = (CCIntervalAction *)CCSequence::actions + inA = (CCActionInterval *)CCSequence::actions ( CCDelayTime::actionWithDuration(m_fDuration/2), CCSpawn::actions @@ -845,7 +845,7 @@ void CCZoomFlipXTransition::onEnter() CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), NULL ); - outA = (CCIntervalAction *)CCSequence::actions + outA = (CCActionInterval *)CCSequence::actions ( CCSpawn::actions ( @@ -886,7 +886,7 @@ void CCZoomFlipYTransition::onEnter() { CCOrientedTransitionScene::onEnter(); - CCIntervalAction *inA, *outA; + CCActionInterval *inA, *outA; m_pInScene->setIsVisible(false); float inDeltaZ, inAngleZ; @@ -904,7 +904,7 @@ void CCZoomFlipYTransition::onEnter() outAngleZ = 0; } - inA = (CCIntervalAction *)CCSequence::actions + inA = (CCActionInterval *)CCSequence::actions ( CCDelayTime::actionWithDuration(m_fDuration/2), CCSpawn::actions @@ -918,7 +918,7 @@ void CCZoomFlipYTransition::onEnter() NULL ); - outA = (CCIntervalAction *)CCSequence::actions + outA = (CCActionInterval *)CCSequence::actions ( CCSpawn::actions ( @@ -960,7 +960,7 @@ void CCZoomFlipAngularTransition::onEnter() { CCOrientedTransitionScene::onEnter(); - CCIntervalAction *inA, *outA; + CCActionInterval *inA, *outA; m_pInScene->setIsVisible(false); float inDeltaZ, inAngleZ; @@ -980,7 +980,7 @@ void CCZoomFlipAngularTransition::onEnter() outAngleZ = 0; } - inA = (CCIntervalAction *)CCSequence::actions + inA = (CCActionInterval *)CCSequence::actions ( CCDelayTime::actionWithDuration(m_fDuration/2), CCSpawn::actions @@ -994,7 +994,7 @@ void CCZoomFlipAngularTransition::onEnter() CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), NULL ); - outA = (CCIntervalAction *)CCSequence::actions + outA = (CCActionInterval *)CCSequence::actions ( CCSpawn::actions ( @@ -1067,7 +1067,7 @@ void CCFadeTransition :: onEnter() addChild(l, 2, kSceneFade); CCNode* f = getChildByTag(kSceneFade); - CCIntervalAction* a = (CCIntervalAction *)CCSequence::actions + CCActionInterval* a = (CCActionInterval *)CCSequence::actions ( CCFadeIn::actionWithDuration(m_fDuration/2), CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)),//CCCallFunc::actionWithTarget:self selector:@selector(hideOutShowIn)], @@ -1209,7 +1209,7 @@ void CCTurnOffTilesTransition::onEnter() int y = 12; CCTurnOffTiles* toff = CCTurnOffTiles::actionWithSize( ccg(x,y), m_fDuration); - CCIntervalAction* action = easeActionWithAction(toff); + CCActionInterval* action = easeActionWithAction(toff); m_pOutScene->runAction ( CCSequence::actions @@ -1223,7 +1223,7 @@ void CCTurnOffTilesTransition::onEnter() } -CCIntervalAction* CCTurnOffTilesTransition:: easeActionWithAction(CCIntervalAction* action) +CCActionInterval* CCTurnOffTilesTransition:: easeActionWithAction(CCActionInterval* action) { return action; } @@ -1246,8 +1246,8 @@ void CCSplitColsTransition::onEnter() CCTransitionScene::onEnter(); m_pInScene->setIsVisible(false); - CCIntervalAction* split = action(); - CCIntervalAction* seq = (CCIntervalAction*)CCSequence::actions + CCActionInterval* split = action(); + CCActionInterval* seq = (CCActionInterval*)CCSequence::actions ( split, CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::hideOutShowIn)), @@ -1268,13 +1268,13 @@ void CCSplitColsTransition::onEnter() } -CCIntervalAction* CCSplitColsTransition:: action() +CCActionInterval* CCSplitColsTransition:: action() { return CCSplitCols::actionWithCols(3, m_fDuration/2.0f); } -CCIntervalAction* CCSplitColsTransition::easeActionWithAction(CCIntervalAction * action) +CCActionInterval* CCSplitColsTransition::easeActionWithAction(CCActionInterval * action) { return CCEaseInOut::actionWithAction(action, 3.0f); } @@ -1293,7 +1293,7 @@ CCSplitRowsTransition::~CCSplitRowsTransition() } -CCIntervalAction* CCSplitRowsTransition::action() +CCActionInterval* CCSplitRowsTransition::action() { return CCSplitRows::actionWithRows(3, m_fDuration/2.0f); } @@ -1325,7 +1325,7 @@ void CCFadeTRTransition::onEnter() int x = (int)(12 * aspect); int y = 12; - CCIntervalAction* action = actionWithSize(ccg(x,y)); + CCActionInterval* action = actionWithSize(ccg(x,y)); m_pOutScene->runAction ( @@ -1340,12 +1340,12 @@ void CCFadeTRTransition::onEnter() } -CCIntervalAction* CCFadeTRTransition::actionWithSize(ccGridSize size) +CCActionInterval* CCFadeTRTransition::actionWithSize(ccGridSize size) { return CCFadeOutTRTiles::actionWithSize(size, m_fDuration); } -CCIntervalAction* CCFadeTRTransition:: easeActionWithAction(CCIntervalAction* action) +CCActionInterval* CCFadeTRTransition:: easeActionWithAction(CCActionInterval* action) { return action; } @@ -1364,7 +1364,7 @@ CCFadeBLTransition::~CCFadeBLTransition() { } -CCIntervalAction* CCFadeBLTransition::actionWithSize(ccGridSize size) +CCActionInterval* CCFadeBLTransition::actionWithSize(ccGridSize size) { return CCFadeOutBLTiles::actionWithSize(size, m_fDuration); } @@ -1381,7 +1381,7 @@ CCFadeUpTransition::~CCFadeUpTransition() { } -CCIntervalAction* CCFadeUpTransition::actionWithSize(ccGridSize size) +CCActionInterval* CCFadeUpTransition::actionWithSize(ccGridSize size) { return CCFadeOutUpTiles::actionWithSize(size, m_fDuration); } @@ -1398,7 +1398,7 @@ CCFadeDownTransition::~CCFadeDownTransition() { } -CCIntervalAction* CCFadeDownTransition::actionWithSize(ccGridSize size) +CCActionInterval* CCFadeDownTransition::actionWithSize(ccGridSize size) { return CCFadeOutDownTiles::actionWithSize(size, m_fDuration); } diff --git a/tests/tests/ActionManagerTest/ActionManagerTest.cpp b/tests/tests/ActionManagerTest/ActionManagerTest.cpp index 86186294f9..bde82110f8 100644 --- a/tests/tests/ActionManagerTest/ActionManagerTest.cpp +++ b/tests/tests/ActionManagerTest/ActionManagerTest.cpp @@ -264,7 +264,7 @@ void RemoveTest::onEnter() CCMoveBy* pMove = CCMoveBy::actionWithDuration(2, CGPointMake(200, 0)); CCCallFunc* pCallback = CCCallFunc::actionWithTarget(this, callfunc_selector(RemoveTest::stopAction)); - CCIntervalAction* pSequence = (CCIntervalAction*) CCSequence::actions(pMove, pCallback, NULL); + CCActionInterval* pSequence = (CCActionInterval*) CCSequence::actions(pMove, pCallback, NULL); pSequence->setTag(kTagSequence); CCSprite* pChild = CCSprite::spriteWithFile(s_pPathGrossini); diff --git a/tests/tests/ActionsTest/ActionsTest.cpp b/tests/tests/ActionsTest/ActionsTest.cpp index 5ddcc13d49..2af0b43cab 100644 --- a/tests/tests/ActionsTest/ActionsTest.cpp +++ b/tests/tests/ActionsTest/ActionsTest.cpp @@ -302,9 +302,9 @@ void ActionMove::onEnter() CGSize s = CCDirector::sharedDirector()->getWinSize(); - CCIntervalAction* actionTo = CCMoveTo::actionWithDuration(2, CGPointMake(s.width-40, s.height-40)); - CCIntervalAction* actionBy = CCMoveBy::actionWithDuration(2, CGPointMake(80,80)); - CCIntervalAction* actionByBack = actionBy->reverse(); + CCActionInterval* actionTo = CCMoveTo::actionWithDuration(2, CGPointMake(s.width-40, s.height-40)); + CCActionInterval* actionBy = CCMoveBy::actionWithDuration(2, CGPointMake(80,80)); + CCActionInterval* actionByBack = actionBy->reverse(); m_tamara->runAction( actionTo); m_grossini->runAction( CCSequence::actions(actionBy, actionByBack, NULL)); @@ -327,10 +327,10 @@ void ActionScale::onEnter() centerSprites(3); - CCIntervalAction* actionTo = CCScaleTo::actionWithDuration( 2, 0.5f); - CCIntervalAction* actionBy = CCScaleBy::actionWithDuration(2 , 2); - CCIntervalAction* actionBy2 = CCScaleBy::actionWithDuration(2, 0.25f, 4.5f); - CCIntervalAction* actionByBack = actionBy->reverse(); + CCActionInterval* actionTo = CCScaleTo::actionWithDuration( 2, 0.5f); + CCActionInterval* actionBy = CCScaleBy::actionWithDuration(2 , 2); + CCActionInterval* actionBy2 = CCScaleBy::actionWithDuration(2, 0.25f, 4.5f); + CCActionInterval* actionByBack = actionBy->reverse(); m_tamara->runAction( actionTo); m_grossini->runAction( CCSequence::actions(actionBy, actionByBack, NULL)); @@ -353,13 +353,13 @@ void ActionRotate::onEnter() centerSprites(3); - CCIntervalAction* actionTo = CCRotateTo::actionWithDuration( 2, 45); - CCIntervalAction* actionTo2 = CCRotateTo::actionWithDuration( 2, -45); - CCIntervalAction* actionTo0 = CCRotateTo::actionWithDuration(2 , 0); + CCActionInterval* actionTo = CCRotateTo::actionWithDuration( 2, 45); + CCActionInterval* actionTo2 = CCRotateTo::actionWithDuration( 2, -45); + CCActionInterval* actionTo0 = CCRotateTo::actionWithDuration(2 , 0); m_tamara->runAction( CCSequence::actions(actionTo, actionTo0, NULL)); - CCIntervalAction* actionBy = CCRotateBy::actionWithDuration(2 , 360); - CCIntervalAction* actionByBack = actionBy->reverse(); + CCActionInterval* actionBy = CCRotateBy::actionWithDuration(2 , 360); + CCActionInterval* actionByBack = actionBy->reverse(); m_grossini->runAction( CCSequence::actions(actionBy, actionByBack, NULL)); m_kathia->runAction( CCSequence::actions(actionTo2, actionTo0->copy()->autorelease(), NULL)); @@ -381,10 +381,10 @@ void ActionJump::onEnter() centerSprites(3); - CCIntervalAction* actionTo = CCJumpTo::actionWithDuration(2, CGPointMake(300,300), 50, 4); - CCIntervalAction* actionBy = CCJumpBy::actionWithDuration(2, CGPointMake(300,0), 50, 4); - CCIntervalAction* actionUp = CCJumpBy::actionWithDuration(2, CGPointMake(0,0), 80, 4); - CCIntervalAction* actionByBack = actionBy->reverse(); + CCActionInterval* actionTo = CCJumpTo::actionWithDuration(2, CGPointMake(300,300), 50, 4); + CCActionInterval* actionBy = CCJumpBy::actionWithDuration(2, CGPointMake(300,0), 50, 4); + CCActionInterval* actionUp = CCJumpBy::actionWithDuration(2, CGPointMake(0,0), 80, 4); + CCActionInterval* actionByBack = actionBy->reverse(); m_tamara->runAction( actionTo); m_grossini->runAction( CCSequence::actions(actionBy, actionByBack, NULL)); @@ -419,9 +419,9 @@ void ActionBezier::onEnter() bezier.controlPoint_2 = CGPointMake(300, -s.height/2); bezier.endPosition = CGPointMake(300,100); - CCIntervalAction* bezierForward = CCBezierBy::actionWithDuration(3, bezier); - CCIntervalAction* bezierBack = bezierForward->reverse(); - CCAction* rep = CCRepeatForever::actionWithAction((CCIntervalAction*)CCSequence::actions( bezierForward, bezierBack, NULL)); + CCActionInterval* bezierForward = CCBezierBy::actionWithDuration(3, bezier); + CCActionInterval* bezierBack = bezierForward->reverse(); + CCAction* rep = CCRepeatForever::actionWithAction((CCActionInterval*)CCSequence::actions( bezierForward, bezierBack, NULL)); // sprite 2 @@ -431,11 +431,11 @@ void ActionBezier::onEnter() bezier2.controlPoint_2 = CGPointMake(200, -s.height/2); bezier2.endPosition = CGPointMake(240,160); - CCIntervalAction* bezierTo1 = CCBezierTo::actionWithDuration(2, bezier2); + CCActionInterval* bezierTo1 = CCBezierTo::actionWithDuration(2, bezier2); // sprite 3 m_kathia->setPosition(CGPointMake(400,160)); - CCIntervalAction* bezierTo2 = CCBezierTo::actionWithDuration(2, bezier2); + CCActionInterval* bezierTo2 = CCBezierTo::actionWithDuration(2, bezier2); m_grossini->runAction( rep); m_tamara->runAction(bezierTo1); @@ -459,8 +459,8 @@ void ActionBlink::onEnter() centerSprites(2); - CCIntervalAction* action1 = CCBlink::actionWithDuration(2, 10); - CCIntervalAction* action2 = CCBlink::actionWithDuration(2, 5); + CCActionInterval* action1 = CCBlink::actionWithDuration(2, 10); + CCActionInterval* action2 = CCBlink::actionWithDuration(2, 5); m_tamara->runAction( action1); m_kathia->runAction(action2); @@ -483,11 +483,11 @@ void ActionFade::onEnter() centerSprites(2); m_tamara->setOpacity( 0 ); - CCIntervalAction* action1 = CCFadeIn::actionWithDuration(1.0f); - CCIntervalAction* action1Back = action1->reverse(); + CCActionInterval* action1 = CCFadeIn::actionWithDuration(1.0f); + CCActionInterval* action1Back = action1->reverse(); - CCIntervalAction* action2 = CCFadeOut::actionWithDuration(1.0f); - CCIntervalAction* action2Back = action2->reverse(); + CCActionInterval* action2 = CCFadeOut::actionWithDuration(1.0f); + CCActionInterval* action2Back = action2->reverse(); m_tamara->runAction( CCSequence::actions( action1, action1Back, NULL)); m_kathia->runAction( CCSequence::actions( action2, action2Back, NULL)); @@ -510,9 +510,9 @@ void ActionTint::onEnter() centerSprites(2); - CCIntervalAction* action1 = CCTintTo::actionWithDuration(2, 255, 0, 255); - CCIntervalAction* action2 = CCTintBy::actionWithDuration(2, -127, -255, -127); - CCIntervalAction* action2Back = action2->reverse(); + CCActionInterval* action1 = CCTintTo::actionWithDuration(2, 255, 0, 255); + CCActionInterval* action2 = CCTintBy::actionWithDuration(2, -127, -255, -127); + CCActionInterval* action2Back = action2->reverse(); m_tamara->runAction( action1); m_kathia->runAction( CCSequence::actions( action2, action2Back, NULL)); @@ -542,8 +542,8 @@ void ActionAnimate::onEnter() animation->addFrameWithFileName(frameName); } - CCIntervalAction* action = CCAnimate::actionWithAnimation( animation, false); - CCIntervalAction* action_back = action->reverse(); + CCActionInterval* action = CCAnimate::actionWithAnimation( animation, false); + CCActionInterval* action_back = action->reverse(); m_grossini->runAction( CCSequence::actions( action, action_back, NULL)); } @@ -770,11 +770,11 @@ void ActionRotateToRepeat::onEnter() centerSprites(2); - CCIntervalAction* act1 = CCRotateTo::actionWithDuration(1, 90); - CCIntervalAction* act2 = CCRotateTo::actionWithDuration(1, 0); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions(act1, act2, NULL)); + CCActionInterval* act1 = CCRotateTo::actionWithDuration(1, 90); + CCActionInterval* act2 = CCRotateTo::actionWithDuration(1, 0); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions(act1, act2, NULL)); CCAction* rep1 = CCRepeatForever::actionWithAction(seq); - CCIntervalAction* rep2 = CCRepeat::actionWithAction((CCFiniteTimeAction*)(seq->copy()->autorelease()), 10); + CCActionInterval* rep2 = CCRepeat::actionWithAction((CCFiniteTimeAction*)(seq->copy()->autorelease()), 10); m_tamara->runAction(rep1); m_kathia->runAction(rep2); @@ -802,8 +802,8 @@ void ActionRotateJerk::onEnter() CCRotateTo::actionWithDuration(0.5f, 20), NULL); - CCIntervalAction* rep1 = CCRepeat::actionWithAction(seq, 10); - CCAction* rep2 = CCRepeatForever::actionWithAction( (CCIntervalAction*)(seq->copy()->autorelease()) ); + CCActionInterval* rep1 = CCRepeat::actionWithAction(seq, 10); + CCAction* rep2 = CCRepeatForever::actionWithAction( (CCActionInterval*)(seq->copy()->autorelease()) ); m_tamara->runAction(rep1); m_kathia->runAction(rep2); @@ -825,7 +825,7 @@ void ActionReverse::onEnter() alignSpritesLeft(1); - CCIntervalAction* jump = CCJumpBy::actionWithDuration(2, CGPointMake(300,0), 50, 4); + CCActionInterval* jump = CCJumpBy::actionWithDuration(2, CGPointMake(300,0), 50, 4); CCFiniteTimeAction* action = CCSequence::actions( jump, jump->reverse(), NULL); m_grossini->runAction(action); @@ -848,7 +848,7 @@ void ActionDelayTime::onEnter() alignSpritesLeft(1); - CCIntervalAction* move = CCMoveBy::actionWithDuration(1, CGPointMake(150,0)); + CCActionInterval* move = CCMoveBy::actionWithDuration(1, CGPointMake(150,0)); CCFiniteTimeAction* action = CCSequence::actions( move, CCDelayTime::actionWithDuration(2), move, NULL); m_grossini->runAction(action); @@ -871,8 +871,8 @@ void ActionReverseSequence::onEnter() alignSpritesLeft(1); - CCIntervalAction* move1 = CCMoveBy::actionWithDuration(1, CGPointMake(250,0)); - CCIntervalAction* move2 = CCMoveBy::actionWithDuration(1, CGPointMake(0,50)); + CCActionInterval* move1 = CCMoveBy::actionWithDuration(1, CGPointMake(250,0)); + CCActionInterval* move2 = CCMoveBy::actionWithDuration(1, CGPointMake(0,50)); CCFiniteTimeAction* seq = CCSequence::actions( move1, move2, move1->reverse(), NULL); CCFiniteTimeAction* action = CCSequence::actions( seq, seq->reverse(), NULL); @@ -899,14 +899,14 @@ void ActionReverseSequence2::onEnter() // Test: // Sequence should work both with IntervalAction and InstantActions - CCIntervalAction* move1 = CCMoveBy::actionWithDuration(1, CGPointMake(250,0)); - CCIntervalAction* move2 = CCMoveBy::actionWithDuration(1, CGPointMake(0,50)); + CCActionInterval* move1 = CCMoveBy::actionWithDuration(1, CGPointMake(250,0)); + CCActionInterval* move2 = CCMoveBy::actionWithDuration(1, CGPointMake(0,50)); CCToggleVisibility* tog1 = new CCToggleVisibility(); CCToggleVisibility* tog2 = new CCToggleVisibility(); tog1->autorelease(); tog2->autorelease(); CCFiniteTimeAction* seq = CCSequence::actions( move1, tog1, move2, tog2, move1->reverse(), NULL); - CCIntervalAction* action = CCRepeat::actionWithAction((CCIntervalAction*)(CCSequence::actions( seq, seq->reverse(), NULL)), 3); + CCActionInterval* action = CCRepeat::actionWithAction((CCActionInterval*)(CCSequence::actions( seq, seq->reverse(), NULL)), 3); @@ -914,9 +914,9 @@ void ActionReverseSequence2::onEnter() // Also test that the reverse of Hide is Show, and vice-versa m_kathia->runAction(action); - CCIntervalAction* move_tamara = CCMoveBy::actionWithDuration(1, CGPointMake(100,0)); - CCIntervalAction* move_tamara2 = CCMoveBy::actionWithDuration(1, CGPointMake(50,0)); - CCInstantAction* hide = new CCHide(); + CCActionInterval* move_tamara = CCMoveBy::actionWithDuration(1, CGPointMake(100,0)); + CCActionInterval* move_tamara2 = CCMoveBy::actionWithDuration(1, CGPointMake(50,0)); + CCActionInstant* hide = new CCHide(); hide->autorelease(); CCFiniteTimeAction* seq_tamara = CCSequence::actions( move_tamara, hide, move_tamara2, NULL); CCFiniteTimeAction* seq_back = seq_tamara->reverse(); @@ -939,12 +939,12 @@ void ActionRepeat::onEnter() alignSpritesLeft(2); - CCIntervalAction* a1 = CCMoveBy::actionWithDuration(1, CGPointMake(150,0)); - CCIntervalAction* action1 = CCRepeat::actionWithAction( + CCActionInterval* a1 = CCMoveBy::actionWithDuration(1, CGPointMake(150,0)); + CCActionInterval* action1 = CCRepeat::actionWithAction( CCSequence::actions( CCPlace::actionWithPosition(CGPointMake(60,60)), a1, NULL) , 3); CCAction* action2 = CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions((CCIntervalAction*)(a1->copy()->autorelease()), a1->reverse(), NULL)) + (CCActionInterval*)(CCSequence::actions((CCActionInterval*)(a1->copy()->autorelease()), a1->reverse(), NULL)) ); m_kathia->runAction(action1); @@ -967,32 +967,32 @@ void ActionOrbit::onEnter() centerSprites(3); - CCIntervalAction* orbit1 = CCOrbitCamera::actionWithDuration(2,1, 0, 0, 180, 0, 0); + CCActionInterval* orbit1 = CCOrbitCamera::actionWithDuration(2,1, 0, 0, 180, 0, 0); CCFiniteTimeAction* action1 = CCSequence::actions( orbit1, orbit1->reverse(), NULL); - CCIntervalAction* orbit2 = CCOrbitCamera::actionWithDuration(2,1, 0, 0, 180, -45, 0); + CCActionInterval* orbit2 = CCOrbitCamera::actionWithDuration(2,1, 0, 0, 180, -45, 0); CCFiniteTimeAction* action2 = CCSequence::actions( orbit2, orbit2->reverse(), NULL); - CCIntervalAction* orbit3 = CCOrbitCamera::actionWithDuration(2,1, 0, 0, 180, 90, 0); + CCActionInterval* orbit3 = CCOrbitCamera::actionWithDuration(2,1, 0, 0, 180, 90, 0); CCFiniteTimeAction* action3 = CCSequence::actions( orbit3, orbit3->reverse(), NULL); - m_kathia->runAction(CCRepeatForever::actionWithAction((CCIntervalAction*)action1)); - m_tamara->runAction(CCRepeatForever::actionWithAction((CCIntervalAction*)action2)); - m_grossini->runAction(CCRepeatForever::actionWithAction((CCIntervalAction*)action3)); + m_kathia->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)action1)); + m_tamara->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)action2)); + m_grossini->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)action3)); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(100,-100)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(100,-100)); + CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(move, move_back, NULL); - CCAction* rfe = CCRepeatForever::actionWithAction((CCIntervalAction*)seq); + CCAction* rfe = CCRepeatForever::actionWithAction((CCActionInterval*)seq); m_kathia->runAction(rfe); m_tamara->runAction((CCAction*)(rfe->copy()->autorelease())); m_grossini->runAction((CCAction*)(rfe->copy()->autorelease())); @@ -1016,10 +1016,10 @@ void ActionFollow::onEnter() CGSize s = CCDirector::sharedDirector()->getWinSize(); m_grossini->setPosition(CGPointMake(-200, s.height / 2)); - CCIntervalAction* move = CCMoveBy::actionWithDuration(2, CGPointMake(s.width * 3, 0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(2, CGPointMake(s.width * 3, 0)); + CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(move, move_back, NULL); - CCAction* rep = CCRepeatForever::actionWithAction((CCIntervalAction*)seq); + CCAction* rep = CCRepeatForever::actionWithAction((CCActionInterval*)seq); m_grossini->runAction(rep); diff --git a/tests/tests/AtlasTest/AtlasTest.cpp b/tests/tests/AtlasTest/AtlasTest.cpp index 2b6681227d..6a7bdff455 100644 --- a/tests/tests/AtlasTest/AtlasTest.cpp +++ b/tests/tests/AtlasTest/AtlasTest.cpp @@ -303,10 +303,10 @@ LabelAtlasColorTest::LabelAtlasColorTest() label2->setPosition( ccp(10,200) ); label2->setColor( ccRED ); - CCIntervalAction* fade = CCFadeOut::actionWithDuration(1.0f); - CCIntervalAction* fade_in = fade->reverse(); + CCActionInterval* fade = CCFadeOut::actionWithDuration(1.0f); + CCActionInterval* fade_in = fade->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(fade, fade_in, NULL); - CCAction* repeat = CCRepeatForever::actionWithAction( (CCIntervalAction*)seq ); + CCAction* repeat = CCRepeatForever::actionWithAction( (CCActionInterval*)seq ); label2->runAction( repeat ); m_time = 0; @@ -356,10 +356,10 @@ Atlas3::Atlas3() // testing anchors label1->setAnchorPoint( ccp(0,0) ); addChild(label1, 0, kTagBitmapAtlas1); - CCIntervalAction* fade = CCFadeOut::actionWithDuration(1.0f); - CCIntervalAction* fade_in = fade->reverse(); + CCActionInterval* fade = CCFadeOut::actionWithDuration(1.0f); + CCActionInterval* fade_in = fade->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(fade, fade_in, NULL); - CCAction* repeat = CCRepeatForever::actionWithAction((CCIntervalAction*)seq); + CCAction* repeat = CCRepeatForever::actionWithAction((CCActionInterval*)seq); label1->runAction(repeat); @@ -441,21 +441,21 @@ Atlas4::Atlas4() CCSprite* AChar = (CCSprite*) label->getChildByTag(12); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(2, 360); CCAction* rot_4ever = CCRepeatForever::actionWithAction(rotate); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 1.5f); - CCIntervalAction* scale_back = scale->reverse(); + CCActionInterval* scale = CCScaleBy::actionWithDuration(2, 1.5f); + CCActionInterval* scale_back = scale->reverse(); CCFiniteTimeAction* scale_seq = CCSequence::actions(scale, scale_back,NULL); - CCAction* scale_4ever = CCRepeatForever::actionWithAction((CCIntervalAction*)scale_seq); + CCAction* scale_4ever = CCRepeatForever::actionWithAction((CCActionInterval*)scale_seq); - CCIntervalAction* jump = CCJumpBy::actionWithDuration(0.5f, CGPointZero, 60, 1); + CCActionInterval* jump = CCJumpBy::actionWithDuration(0.5f, CGPointZero, 60, 1); CCAction* jump_4ever = CCRepeatForever::actionWithAction(jump); - CCIntervalAction* fade_out = CCFadeOut::actionWithDuration(1); - CCIntervalAction* fade_in = CCFadeIn::actionWithDuration(1); + CCActionInterval* fade_out = CCFadeOut::actionWithDuration(1); + CCActionInterval* fade_in = CCFadeIn::actionWithDuration(1); CCFiniteTimeAction* seq = CCSequence::actions(fade_out, fade_in, NULL); - CCAction* fade_4ever = CCRepeatForever::actionWithAction((CCIntervalAction*)seq); + CCAction* fade_4ever = CCRepeatForever::actionWithAction((CCActionInterval*)seq); BChar->runAction(rot_4ever); BChar->runAction(scale_4ever); diff --git a/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp b/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp index b621fbabd9..a169dffdd4 100644 --- a/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp +++ b/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp @@ -30,7 +30,7 @@ MainLayer::MainLayer() sprite->runAction( CCJumpTo::actionWithDuration(4, CGPointMake(300,48), 100, 4) ); layer->runAction( CCRepeatForever::actionWithAction( - (CCIntervalAction*)( CCSequence::actions( + (CCActionInterval*)( CCSequence::actions( CCFadeIn::actionWithDuration(1), CCFadeOut::actionWithDuration(1), NULL) ) diff --git a/tests/tests/CocosNodeTest/CocosNodeTest.cpp b/tests/tests/CocosNodeTest/CocosNodeTest.cpp index 748d98ef9a..544bb118fc 100644 --- a/tests/tests/CocosNodeTest/CocosNodeTest.cpp +++ b/tests/tests/CocosNodeTest/CocosNodeTest.cpp @@ -176,16 +176,16 @@ void Test2::onEnter() sp1->addChild(sp3); sp2->addChild(sp4); - CCIntervalAction* a1 = CCRotateBy::actionWithDuration(2, 360); - CCIntervalAction* a2 = CCScaleBy::actionWithDuration(2, 2); + CCActionInterval* a1 = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* a2 = CCScaleBy::actionWithDuration(2, 2); CCAction* action1 = CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions(a1, a2, a2->reverse(), NULL)) + (CCActionInterval*)(CCSequence::actions(a1, a2, a2->reverse(), NULL)) ); CCAction* action2 = CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions( - (CCIntervalAction*)(a1->copy()->autorelease()), - (CCIntervalAction*)(a2->copy()->autorelease()), + (CCActionInterval*)(CCSequence::actions( + (CCActionInterval*)(a1->copy()->autorelease()), + (CCActionInterval*)(a2->copy()->autorelease()), a2->reverse(), NULL) ) ); @@ -258,9 +258,9 @@ Test5::Test5() sp2->setPosition(CGPointMake(380,160)); CCRotateBy* rot = CCRotateBy::actionWithDuration(2, 360); - CCIntervalAction* rot_back = rot->reverse(); + CCActionInterval* rot_back = rot->reverse(); CCAction* forever = CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions(rot, rot_back, NULL)) + (CCActionInterval*)(CCSequence::actions(rot, rot_back, NULL)) ); CCAction* forever2 = (CCAction*)(forever->copy()->autorelease()); forever->setTag(101); @@ -314,10 +314,10 @@ Test6::Test6() sp1->setPosition(CGPointMake(100,160)); sp2->setPosition(CGPointMake(380,160)); - CCIntervalAction* rot = CCRotateBy::actionWithDuration(2, 360); - CCIntervalAction* rot_back = rot->reverse(); + CCActionInterval* rot = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* rot_back = rot->reverse(); CCAction* forever1 = CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions(rot, rot_back, NULL))); + (CCActionInterval*)(CCSequence::actions(rot, rot_back, NULL))); CCAction* forever11 = (CCAction*)(forever1->copy()->autorelease()); CCAction* forever2 = (CCAction*)(forever1->copy()->autorelease()); @@ -427,18 +427,18 @@ StressTest2::StressTest2() CCSprite *sp1 = CCSprite::spriteWithFile(s_pPathSister1); sp1->setPosition( CGPointMake(80, s.height/2) ); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_ease_inout3 = CCEaseInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 2.0f); - CCIntervalAction* move_ease_inout_back3 = move_ease_inout3->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_ease_inout3 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.0f); + CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse(); CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_inout3, move_ease_inout_back3, NULL); - sp1->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3) ); + sp1->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) ); sublayer->addChild(sp1, 1); CCParticleFire* fire = CCParticleFire::node(); fire->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png")); fire->setPosition( CGPointMake(80, s.height/2-50) ); - CCIntervalAction* copy_seq3 = (CCIntervalAction*)(seq3->copy()->autorelease()); + CCActionInterval* copy_seq3 = (CCActionInterval*)(seq3->copy()->autorelease()); fire->runAction( CCRepeatForever::actionWithAction(copy_seq3) ); sublayer->addChild(fire, 2); @@ -514,14 +514,14 @@ NodeToWorld::NodeToWorld() menu->setPosition( CGPointMake(backSize.width/2, backSize.height/2)); back->addChild(menu); - CCIntervalAction* rot = CCRotateBy::actionWithDuration(5, 360); + CCActionInterval* rot = CCRotateBy::actionWithDuration(5, 360); CCAction* fe = CCRepeatForever::actionWithAction( rot); item->runAction( fe ); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(200,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(200,0)); + CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL); - CCAction* fe2 = CCRepeatForever::actionWithAction((CCIntervalAction*)seq); + CCAction* fe2 = CCRepeatForever::actionWithAction((CCActionInterval*)seq); back->runAction(fe2); } diff --git a/tests/tests/EaseActionsTest/EaseActionsTest.cpp b/tests/tests/EaseActionsTest/EaseActionsTest.cpp index 38b643915a..7b46698bbe 100644 --- a/tests/tests/EaseActionsTest/EaseActionsTest.cpp +++ b/tests/tests/EaseActionsTest/EaseActionsTest.cpp @@ -17,14 +17,14 @@ void SpriteEase::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0) ); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0) ); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease_in = (CCIntervalAction*)CCEaseIn::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 3.0f); - CCIntervalAction* move_ease_in_back = move_ease_in->reverse(); + CCActionInterval* move_ease_in = (CCActionInterval*)CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f); + CCActionInterval* move_ease_in_back = move_ease_in->reverse(); - CCIntervalAction* move_ease_out = CCEaseOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 3.0f); - CCIntervalAction* move_ease_out_back = move_ease_out->reverse(); + CCActionInterval* move_ease_out = CCEaseOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f); + CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions(move, move_back, NULL); @@ -32,13 +32,13 @@ void SpriteEase::onEnter() CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, move_ease_out_back, NULL); - CCAction *a2 = m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1) ); + CCAction *a2 = m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1) ); a2->setTag(1); - CCAction *a1 = m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2) ); + CCAction *a1 = m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2) ); a1->setTag(1); - CCAction *a = m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3) ); + CCAction *a = m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) ); a->setTag(1); schedule(schedule_selector(SpriteEase::testStopAction), 6); @@ -68,26 +68,26 @@ void SpriteEaseInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); // id move_back = move->reverse(); - CCIntervalAction* move_ease_inout1 = CCEaseInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 2.0f); - CCIntervalAction* move_ease_inout_back1 = move_ease_inout1->reverse(); + CCActionInterval* move_ease_inout1 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.0f); + CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse(); - CCIntervalAction* move_ease_inout2 = CCEaseInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 3.0f); - CCIntervalAction* move_ease_inout_back2 = move_ease_inout2->reverse(); + CCActionInterval* move_ease_inout2 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f); + CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse(); - CCIntervalAction* move_ease_inout3 = CCEaseInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 4.0f); - CCIntervalAction* move_ease_inout_back3 = move_ease_inout3->reverse(); + CCActionInterval* move_ease_inout3 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 4.0f); + CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move_ease_inout1, move_ease_inout_back1, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease_inout2, move_ease_inout_back2, NULL); CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_inout3, move_ease_inout_back3, NULL); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1) ); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2) ); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3) ); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1) ); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2) ); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) ); } @@ -106,14 +106,14 @@ void SpriteEaseExponential::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease_in = CCEaseExponentialIn::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_in_back = move_ease_in->reverse(); + CCActionInterval* move_ease_in = CCEaseExponentialIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_in_back = move_ease_in->reverse(); - CCIntervalAction* move_ease_out = CCEaseExponentialOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_out_back = move_ease_out->reverse(); + CCActionInterval* move_ease_out = CCEaseExponentialOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); @@ -121,9 +121,9 @@ void SpriteEaseExponential::onEnter() CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_out, move_ease_out_back, NULL); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1) ); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2) ); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3) ); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1) ); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2) ); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) ); } @@ -141,19 +141,19 @@ void SpriteEaseExponentialInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease = CCEaseExponentialInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_back = move_ease->reverse(); //--> reverse() + CCActionInterval* move_ease = CCEaseExponentialInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_back = move_ease->reverse(); //--> reverse() CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease, move_ease_back, NULL); this->positionForTwo(); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); } @@ -172,14 +172,14 @@ void SpriteEaseSine::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease_in = CCEaseSineIn::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_in_back = move_ease_in->reverse(); + CCActionInterval* move_ease_in = CCEaseSineIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_in_back = move_ease_in->reverse(); - CCIntervalAction* move_ease_out = CCEaseSineOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_out_back = move_ease_out->reverse(); + CCActionInterval* move_ease_out = CCEaseSineOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); @@ -187,9 +187,9 @@ void SpriteEaseSine::onEnter() CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_out, move_ease_out_back, NULL); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3)); } @@ -208,19 +208,19 @@ void SpriteEaseSineInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease = CCEaseSineInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_back = move_ease->reverse(); + CCActionInterval* move_ease = CCEaseSineInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_back = move_ease->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease, move_ease_back, NULL); this->positionForTwo(); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); } @@ -237,22 +237,22 @@ std::string SpriteEaseSineInOut::title() void SpriteEaseElastic::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease_in = CCEaseElasticIn::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_in_back = move_ease_in->reverse(); + CCActionInterval* move_ease_in = CCEaseElasticIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_in_back = move_ease_in->reverse(); - CCIntervalAction* move_ease_out = CCEaseElasticOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_out_back = move_ease_out->reverse(); + CCActionInterval* move_ease_out = CCEaseElasticOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease_in, move_ease_in_back, NULL); CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_out, move_ease_out_back, NULL); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3)); } @@ -271,25 +271,25 @@ void SpriteEaseElasticInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_ease_inout1 = CCEaseElasticInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 0.3f); - CCIntervalAction* move_ease_inout_back1 = move_ease_inout1->reverse(); + CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.3f); + CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse(); - CCIntervalAction* move_ease_inout2 = CCEaseElasticInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 0.45f); - CCIntervalAction* move_ease_inout_back2 = move_ease_inout2->reverse(); + CCActionInterval* move_ease_inout2 = CCEaseElasticInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.45f); + CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse(); - CCIntervalAction* move_ease_inout3 = CCEaseElasticInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()), 0.6f); - CCIntervalAction* move_ease_inout_back3 = move_ease_inout3->reverse(); + CCActionInterval* move_ease_inout3 = CCEaseElasticInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.6f); + CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move_ease_inout1, move_ease_inout_back1, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease_inout2, move_ease_inout_back2, NULL); CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_inout3, move_ease_inout_back3, NULL); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3)); } @@ -308,22 +308,22 @@ std::string SpriteEaseElasticInOut::title() void SpriteEaseBounce::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease_in = CCEaseBounceIn::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_in_back = move_ease_in->reverse(); + CCActionInterval* move_ease_in = CCEaseBounceIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_in_back = move_ease_in->reverse(); - CCIntervalAction* move_ease_out = CCEaseBounceOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_out_back = move_ease_out->reverse(); + CCActionInterval* move_ease_out = CCEaseBounceOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease_in, move_ease_in_back, NULL); CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_out, move_ease_out_back, NULL); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3)); } @@ -343,19 +343,19 @@ void SpriteEaseBounceInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease = CCEaseBounceInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_back = move_ease->reverse(); + CCActionInterval* move_ease = CCEaseBounceInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_back = move_ease->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease, move_ease_back, NULL); this->positionForTwo(); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); } @@ -373,22 +373,22 @@ std::string SpriteEaseBounceInOut::title() void SpriteEaseBack::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease_in = CCEaseBackIn::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_in_back = move_ease_in->reverse(); + CCActionInterval* move_ease_in = CCEaseBackIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_in_back = move_ease_in->reverse(); - CCIntervalAction* move_ease_out = CCEaseBackOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_out_back = move_ease_out->reverse(); + CCActionInterval* move_ease_out = CCEaseBackOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease_in, move_ease_in_back, NULL); CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_out, move_ease_out_back, NULL); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); - m_kathia->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq3)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); + m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3)); } @@ -406,19 +406,19 @@ std::string SpriteEaseBack::title() void SpriteEaseBackInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0)); + CCActionInterval* move_back = move->reverse(); - CCIntervalAction* move_ease = CCEaseBackInOut::actionWithAction((CCIntervalAction*)(move->copy()->autorelease()) ); - CCIntervalAction* move_ease_back = move_ease->reverse(); + CCActionInterval* move_ease = CCEaseBackInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) ); + CCActionInterval* move_ease_back = move_ease->reverse(); CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL); CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease, move_ease_back, NULL); this->positionForTwo(); - m_grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq1)); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq2)); + m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2)); } @@ -438,15 +438,15 @@ void SpeedTest::onEnter() EaseSpriteDemo::onEnter(); // rotate and jump - CCIntervalAction *jump1 = CCJumpBy::actionWithDuration(4, CGPointMake(-400,0), 100, 4); - CCIntervalAction *jump2 = jump1->reverse(); - CCIntervalAction *rot1 = CCRotateBy::actionWithDuration(4, 360*2); - CCIntervalAction *rot2 = rot1->reverse(); + CCActionInterval *jump1 = CCJumpBy::actionWithDuration(4, CGPointMake(-400,0), 100, 4); + CCActionInterval *jump2 = jump1->reverse(); + CCActionInterval *rot1 = CCRotateBy::actionWithDuration(4, 360*2); + CCActionInterval *rot2 = rot1->reverse(); CCFiniteTimeAction* seq3_1 = CCSequence::actions(jump2, jump1, NULL); CCFiniteTimeAction* seq3_2 = CCSequence::actions( rot1, rot2, NULL); CCFiniteTimeAction* spawn = CCSpawn::actions(seq3_1, seq3_2, NULL); - CCSpeed* action = CCSpeed::actionWithAction(CCRepeatForever::actionWithAction((CCIntervalAction*)spawn), 1.0f); + CCSpeed* action = CCSpeed::actionWithAction(CCRepeatForever::actionWithAction((CCActionInterval*)spawn), 1.0f); action->setTag(kTagAction1); CCAction* action2 = (CCAction*)(action->copy()->autorelease()); @@ -488,23 +488,23 @@ void SchedulerTest::onEnter() EaseSpriteDemo::onEnter(); // rotate and jump - CCIntervalAction* jump1 = CCJumpBy::actionWithDuration(4, CGPointMake(-400,0), 100, 4); - CCIntervalAction* jump2 = jump1->reverse(); - CCIntervalAction* rot1 = CCRotateBy::actionWithDuration(4, 360*2); - CCIntervalAction* rot2 = rot1->reverse(); + CCActionInterval* jump1 = CCJumpBy::actionWithDuration(4, CGPointMake(-400,0), 100, 4); + CCActionInterval* jump2 = jump1->reverse(); + CCActionInterval* rot1 = CCRotateBy::actionWithDuration(4, 360*2); + CCActionInterval* rot2 = rot1->reverse(); CCFiniteTimeAction* seq3_1 = CCSequence::actions(jump2, jump1, NULL); CCFiniteTimeAction* seq3_2 = CCSequence::actions( rot1, rot2, NULL); CCFiniteTimeAction* spawn = CCSpawn::actions(seq3_1, seq3_2, NULL); - CCFiniteTimeAction* action = CCRepeatForever::actionWithAction((CCIntervalAction*)spawn); + CCFiniteTimeAction* action = CCRepeatForever::actionWithAction((CCActionInterval*)spawn); CCRepeatForever* action2 = (CCRepeatForever*)(action->copy()->autorelease()); CCRepeatForever* action3 = (CCRepeatForever*)(action->copy()->autorelease()); - m_grossini->runAction( CCSpeed::actionWithAction((CCIntervalAction*)action, 0.5f) ); - m_tamara->runAction( CCSpeed::actionWithAction((CCIntervalAction*)action2, 1.5f) ); - m_kathia->runAction( CCSpeed::actionWithAction((CCIntervalAction*)action3, 1.0f) ); + m_grossini->runAction( CCSpeed::actionWithAction((CCActionInterval*)action, 0.5f) ); + m_tamara->runAction( CCSpeed::actionWithAction((CCActionInterval*)action2, 1.5f) ); + m_kathia->runAction( CCSpeed::actionWithAction((CCActionInterval*)action3, 1.0f) ); CCParticleSystem* emitter = CCParticleFireworks::node(); emitter->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png")); diff --git a/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp index cbbc5553d9..be8261fa14 100644 --- a/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/tests/tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -28,16 +28,16 @@ void Effect1::onEnter() // Waves3D is Grid3D and it's size is (15,10) CGSize size = CCDirector::sharedDirector()->getWinSize(); - CCIntervalAction* lens = CCLens3D::actionWithPosition(ccp(size.width/2,size.height/2), 240, ccg(15,10), 0.0f); - CCIntervalAction* waves = CCWaves3D::actionWithWaves(18, 15, ccg(15,10), 10); + CCActionInterval* lens = CCLens3D::actionWithPosition(ccp(size.width/2,size.height/2), 240, ccg(15,10), 0.0f); + CCActionInterval* waves = CCWaves3D::actionWithWaves(18, 15, ccg(15,10), 10); CCFiniteTimeAction* reuse = CCReuseGrid::actionWithTimes(1); - CCIntervalAction* delay = CCDelayTime::actionWithDuration(8); + CCActionInterval* delay = CCDelayTime::actionWithDuration(8); - CCIntervalAction* orbit = CCOrbitCamera::actionWithDuration(5, 1, 2, 0, 180, 0, -90); - CCIntervalAction* orbit_back = orbit->reverse(); + CCActionInterval* orbit = CCOrbitCamera::actionWithDuration(5, 1, 2, 0, 180, 0, -90); + CCActionInterval* orbit_back = orbit->reverse(); - target->runAction( CCRepeatForever::actionWithAction( (CCIntervalAction *)(CCSequence::actions( orbit, orbit_back, NULL) ) ) ); + target->runAction( CCRepeatForever::actionWithAction( (CCActionInterval *)(CCSequence::actions( orbit, orbit_back, NULL) ) ) ); target->runAction( CCSequence::actions(lens, delay, reuse, waves, NULL) ); } @@ -62,10 +62,10 @@ void Effect2::onEnter() // ShakyTiles is TiledGrid3D and it's size is (15,10) // Shuffletiles is TiledGrid3D and it's size is (15,10) // TurnOfftiles is TiledGrid3D and it's size is (15,10) - CCIntervalAction* shaky = CCShakyTiles3D::actionWithRange(4, false, ccg(15,10), 5); - CCIntervalAction* shuffle = CCShuffleTiles::actionWithSeed(0, ccg(15,10), 3); - CCIntervalAction* turnoff = CCTurnOffTiles::actionWithSeed(0, ccg(15,10), 3); - CCIntervalAction* turnon = turnoff->reverse(); + CCActionInterval* shaky = CCShakyTiles3D::actionWithRange(4, false, ccg(15,10), 5); + CCActionInterval* shuffle = CCShuffleTiles::actionWithSeed(0, ccg(15,10), 3); + CCActionInterval* turnoff = CCTurnOffTiles::actionWithSeed(0, ccg(15,10), 3); + CCActionInterval* turnon = turnoff->reverse(); // reuse 2 times: // 1 for shuffle @@ -73,13 +73,13 @@ void Effect2::onEnter() // turnon tiles will use a new grid CCFiniteTimeAction* reuse = CCReuseGrid::actionWithTimes(2); - CCIntervalAction* delay = CCDelayTime::actionWithDuration(1); + CCActionInterval* delay = CCDelayTime::actionWithDuration(1); // id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90]; // id orbit_back = [orbit reverse]; // // [target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]]; - target->runAction( (CCIntervalAction *)(CCSequence::actions( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) ) ); + target->runAction( (CCActionInterval *)(CCSequence::actions( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) ) ); } std::string Effect2::title() @@ -101,15 +101,15 @@ void Effect3::onEnter() CCNode* target1 = bg->getChildByTag(kTagSprite1); CCNode* target2 = bg->getChildByTag(kTagSprite2); - CCIntervalAction* waves = CCWaves::actionWithWaves(5, 20, true, false, ccg(15,10), 5); - CCIntervalAction* shaky = CCShaky3D::actionWithRange(4, false, ccg(15,10), 5); + CCActionInterval* waves = CCWaves::actionWithWaves(5, 20, true, false, ccg(15,10), 5); + CCActionInterval* shaky = CCShaky3D::actionWithRange(4, false, ccg(15,10), 5); target1->runAction( CCRepeatForever::actionWithAction( waves ) ); target2->runAction( CCRepeatForever::actionWithAction( shaky ) ); // moving background. Testing issue #244 - CCIntervalAction* move = CCMoveBy::actionWithDuration(3, ccp(200,0) ); - bg->runAction(CCRepeatForever::actionWithAction( (CCIntervalAction *)(CCSequence::actions(move, move->reverse(), NULL) ) ) ); + CCActionInterval* move = CCMoveBy::actionWithDuration(3, ccp(200,0) ); + bg->runAction(CCRepeatForever::actionWithAction( (CCActionInterval *)(CCSequence::actions(move, move->reverse(), NULL) ) ) ); } std::string Effect3::title() @@ -127,15 +127,15 @@ void Effect4::onEnter() { EffectAdvanceTextLayer::onEnter(); - CCIntervalAction* lens = CCLens3D::actionWithPosition(ccp(100,180), 150, ccg(32,24), 10); + CCActionInterval* lens = CCLens3D::actionWithPosition(ccp(100,180), 150, ccg(32,24), 10); //id move = [MoveBy::actionWithDuration:5 position:ccp(400,0)]; /** @todo we only support CCNode run actions now. */ -// CCIntervalAction* move = CCJumpBy::actionWithDuration(5, ccp(380,0), 100, 4); -// CCIntervalAction* move_back = move->reverse(); -// CCIntervalAction* seq = (CCIntervalAction *)(CCSequence::actions( move, move_back, NULL)); +// CCActionInterval* move = CCJumpBy::actionWithDuration(5, ccp(380,0), 100, 4); +// CCActionInterval* move_back = move->reverse(); +// CCActionInterval* seq = (CCActionInterval *)(CCSequence::actions( move, move_back, NULL)); // CCActionManager::sharedManager()->addAction(seq, lens, false); runAction( lens ); @@ -157,9 +157,9 @@ void Effect5::onEnter() //CCDirector::sharedDirector()->setProjection(CCDirectorProjection2D); - CCIntervalAction* effect = CCLiquid::actionWithWaves(1, 20, ccg(32,24), 2); + CCActionInterval* effect = CCLiquid::actionWithWaves(1, 20, ccg(32,24), 2); - CCIntervalAction* stopEffect = (CCIntervalAction *)( CCSequence::actions( + CCActionInterval* stopEffect = (CCActionInterval *)( CCSequence::actions( effect, CCDelayTime::actionWithDuration(2), CCStopGrid::action(), @@ -192,7 +192,7 @@ void Issue631::onEnter() { EffectAdvanceTextLayer::onEnter(); - CCIntervalAction* effect = (CCIntervalAction*)(CCSequence::actions( CCDelayTime::actionWithDuration(2.0f), CCShaky3D::actionWithRange(16, false, ccg(5, 5), 5.0f), NULL)); + CCActionInterval* effect = (CCActionInterval*)(CCSequence::actions( CCDelayTime::actionWithDuration(2.0f), CCShaky3D::actionWithRange(16, false, ccg(5, 5), 5.0f), NULL)); // cleanup CCNode* bg = getChildByTag(kTagBackground); @@ -308,16 +308,16 @@ void EffectAdvanceTextLayer::onEnter(void) CCSprite* grossini = CCSprite::spriteWithFile("Images/grossinis_sister2.png"); bg->addChild(grossini, 1, kTagSprite1); grossini->setPosition( ccp(x/3.0f,200) ); - CCIntervalAction* sc = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* sc_back = sc->reverse(); - grossini->runAction( CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions(sc, sc_back, NULL)) ) ); + CCActionInterval* sc = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* sc_back = sc->reverse(); + grossini->runAction( CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions(sc, sc_back, NULL)) ) ); CCSprite* tamara = CCSprite::spriteWithFile("Images/grossinis_sister1.png"); bg->addChild(tamara, 1, kTagSprite2); tamara->setPosition( ccp(2*x/3.0f,200) ); - CCIntervalAction* sc2 = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* sc2_back = sc2->reverse(); - tamara->runAction( CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions(sc2, sc2_back, NULL)) ) ); + CCActionInterval* sc2 = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* sc2_back = sc2->reverse(); + tamara->runAction( CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions(sc2, sc2_back, NULL)) ) ); CCLabel* label = CCLabel::labelWithString(title().c_str(), "Marker Felt", 28); diff --git a/tests/tests/EffectsTest/EffectsTest.cpp b/tests/tests/EffectsTest/EffectsTest.cpp index 935b78d324..026172e5fa 100644 --- a/tests/tests/EffectsTest/EffectsTest.cpp +++ b/tests/tests/EffectsTest/EffectsTest.cpp @@ -39,7 +39,7 @@ static std::string effectsList[] = class Shaky3DDemo : public CCShaky3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCShaky3D::actionWithRange(5, true, ccg(15,10), t); } @@ -48,7 +48,7 @@ public: class Waves3DDemo : public CCWaves3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCWaves3D::actionWithWaves(5, 40, ccg(15,10), t); } @@ -57,33 +57,33 @@ public: class FlipX3DDemo : public CCFlipX3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCFlipX3D* flipx = CCFlipX3D::actionWithDuration(t); - CCIntervalAction* flipx_back = flipx->reverse(); + CCActionInterval* flipx_back = flipx->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(2); - return (CCIntervalAction*)(CCSequence::actions(flipx, delay, flipx_back, NULL)); + return (CCActionInterval*)(CCSequence::actions(flipx, delay, flipx_back, NULL)); } }; class FlipY3DDemo : public CCFlipY3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCFlipY3D* flipy = CCFlipY3D::actionWithDuration(t); - CCIntervalAction* flipy_back = flipy->reverse(); + CCActionInterval* flipy_back = flipy->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(2); - return (CCIntervalAction*)(CCSequence::actions(flipy, delay, flipy_back, NULL)); + return (CCActionInterval*)(CCSequence::actions(flipy, delay, flipy_back, NULL)); } }; class Lens3DDemo : public CCLens3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CGSize size = CCDirector::sharedDirector()->getWinSize(); return CCLens3D::actionWithPosition(CGPointMake(size.width/2,size.height/2), 240, ccg(15,10), t); @@ -94,7 +94,7 @@ public: class Ripple3DDemo : public CCRipple3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CGSize size = CCDirector::sharedDirector()->getWinSize(); return CCRipple3D::actionWithPosition(CGPointMake(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t); @@ -105,7 +105,7 @@ public: class LiquidDemo : public CCLiquid { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCLiquid::actionWithWaves(4, 20, ccg(16,12), t); } @@ -115,7 +115,7 @@ public: class WavesDemo : public CCWaves { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCWaves::actionWithWaves(4, 20, true, true, ccg(16,12), t); } @@ -125,7 +125,7 @@ public: class TwirlDemo : public CCTwirl { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CGSize size = CCDirector::sharedDirector()->getWinSize(); return CCTwirl::actionWithPosition(CGPointMake(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t); @@ -136,7 +136,7 @@ public: class ShakyTiles3DDemo : public CCShakyTiles3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCShakyTiles3D::actionWithRange(5, true, ccg(16,12), t) ; } @@ -146,7 +146,7 @@ public: class ShatteredTiles3DDemo : public CCShatteredTiles3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCShatteredTiles3D::actionWithRange(5, true, ccg(16,12), t); } @@ -156,13 +156,13 @@ public: class ShuffleTilesDemo : public CCShuffleTiles { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCShuffleTiles* shuffle = CCShuffleTiles::actionWithSeed(25, ccg(16,12), t); - CCIntervalAction* shuffle_back = shuffle->reverse(); + CCActionInterval* shuffle_back = shuffle->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(2); - return (CCIntervalAction*)(CCSequence::actions(shuffle, delay, shuffle_back, NULL)); + return (CCActionInterval*)(CCSequence::actions(shuffle, delay, shuffle_back, NULL)); } }; @@ -170,13 +170,13 @@ public: class FadeOutTRTilesDemo : public CCFadeOutTRTiles { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCFadeOutTRTiles* fadeout = CCFadeOutTRTiles::actionWithSize(ccg(16,12), t); - CCIntervalAction* back = fadeout->reverse(); + CCActionInterval* back = fadeout->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(0.5f); - return (CCIntervalAction*)(CCSequence::actions(fadeout, delay, back, NULL)); + return (CCActionInterval*)(CCSequence::actions(fadeout, delay, back, NULL)); } }; @@ -184,13 +184,13 @@ public: class FadeOutBLTilesDemo : public CCFadeOutBLTiles { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCFadeOutBLTiles* fadeout = CCFadeOutBLTiles::actionWithSize(ccg(16,12), t); - CCIntervalAction* back = fadeout->reverse(); + CCActionInterval* back = fadeout->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(0.5f); - return (CCIntervalAction*)(CCSequence::actions(fadeout, delay, back, NULL)); + return (CCActionInterval*)(CCSequence::actions(fadeout, delay, back, NULL)); } }; @@ -198,46 +198,46 @@ public: class FadeOutUpTilesDemo : public CCFadeOutUpTiles { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCFadeOutUpTiles* fadeout = CCFadeOutUpTiles::actionWithSize(ccg(16,12), t); - CCIntervalAction* back = fadeout->reverse(); + CCActionInterval* back = fadeout->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(0.5f); - return (CCIntervalAction*)(CCSequence::actions(fadeout, delay, back, NULL)); + return (CCActionInterval*)(CCSequence::actions(fadeout, delay, back, NULL)); } }; class FadeOutDownTilesDemo : public CCFadeOutDownTiles { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCFadeOutDownTiles* fadeout = CCFadeOutDownTiles::actionWithSize(ccg(16,12), t); - CCIntervalAction* back = fadeout->reverse(); + CCActionInterval* back = fadeout->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(0.5f); - return (CCIntervalAction*)(CCSequence::actions(fadeout, delay, back, NULL)); + return (CCActionInterval*)(CCSequence::actions(fadeout, delay, back, NULL)); } }; class TurnOffTilesDemo : public CCTurnOffTiles { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CCTurnOffTiles* fadeout = CCTurnOffTiles::actionWithSeed(25, ccg(48,32) , t); - CCIntervalAction* back = fadeout->reverse(); + CCActionInterval* back = fadeout->reverse(); CCDelayTime* delay = CCDelayTime::actionWithDuration(0.5f); - return (CCIntervalAction*)(CCSequence::actions(fadeout, delay, back, NULL)); + return (CCActionInterval*)(CCSequence::actions(fadeout, delay, back, NULL)); } }; class WavesTiles3DDemo : public CCWavesTiles3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCWavesTiles3D::actionWithWaves(4, 120, ccg(15,10), t); } @@ -246,7 +246,7 @@ public: class JumpTiles3DDemo : public CCJumpTiles3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { CGSize size = CCDirector::sharedDirector()->getWinSize(); return CCJumpTiles3D::actionWithJumps(2, 30, ccg(15,10), t); @@ -256,7 +256,7 @@ public: class SplitRowsDemo : public CCSplitRows { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCSplitRows::actionWithRows(9, t); } @@ -265,7 +265,7 @@ public: class SplitColsDemo : public CCSplitCols { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCSplitCols::actionWithCols(9, t); } @@ -274,7 +274,7 @@ public: class PageTurn3DDemo : public CCPageTurn3D { public: - static CCIntervalAction* actionWithDuration(ccTime t) + static CCActionInterval* actionWithDuration(ccTime t) { return CCPageTurn3D::actionWithSize(ccg(15,10), t); } @@ -287,7 +287,7 @@ public: //------------------------------------------------------------------ #define MAX_LAYER 22 -CCIntervalAction* createEffect(int nIndex, ccTime t) +CCActionInterval* createEffect(int nIndex, ccTime t) { switch(nIndex) @@ -319,9 +319,9 @@ CCIntervalAction* createEffect(int nIndex, ccTime t) return NULL; } -CCIntervalAction* getAction() +CCActionInterval* getAction() { - CCIntervalAction* pEffect = createEffect(actionIdx, 3); + CCActionInterval* pEffect = createEffect(actionIdx, 3); return pEffect; } @@ -346,7 +346,7 @@ TextLayer::TextLayer(void) y = size.height; CCNode* node = CCNode::node(); - CCIntervalAction* effect = getAction(); + CCActionInterval* effect = getAction(); node->runAction(effect) ; addChild(node, 0, kTagBackground); @@ -358,16 +358,16 @@ TextLayer::TextLayer(void) CCSprite* grossini = CCSprite::spriteWithFile(s_pPathSister2); node->addChild(grossini, 1); grossini->setPosition( CGPointMake(x/3,y/2) ); - CCIntervalAction* sc = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* sc_back = sc->reverse(); - grossini->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(sc, sc_back, NULL)) ) ); + CCActionInterval* sc = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* sc_back = sc->reverse(); + grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(sc, sc_back, NULL)) ) ); CCSprite* tamara = CCSprite::spriteWithFile(s_pPathSister1); node->addChild(tamara, 1); tamara->setPosition( CGPointMake(2*x/3,y/2) ); - CCIntervalAction* sc2 = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* sc2_back = sc2->reverse(); - tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(sc2, sc2_back, NULL))) ); + CCActionInterval* sc2 = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* sc2_back = sc2->reverse(); + tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(sc2, sc2_back, NULL))) ); CCLabel* label = CCLabel::labelWithString((effectsList[actionIdx]).c_str(), "Marker Felt", 32); diff --git a/tests/tests/IntervalTest/IntervalTest.cpp b/tests/tests/IntervalTest/IntervalTest.cpp index aede74a62e..84bd26c9ac 100644 --- a/tests/tests/IntervalTest/IntervalTest.cpp +++ b/tests/tests/IntervalTest/IntervalTest.cpp @@ -56,7 +56,7 @@ IntervalLayer::IntervalLayer() addChild(sprite); sprite->runAction( CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions(jump, jump->reverse(), NULL )) + (CCActionInterval*)(CCSequence::actions(jump, jump->reverse(), NULL )) ) ); // pause button diff --git a/tests/tests/LayerTest/LayerTest.cpp b/tests/tests/LayerTest/LayerTest.cpp index 77ac00d2f1..f78b7fa1bd 100644 --- a/tests/tests/LayerTest/LayerTest.cpp +++ b/tests/tests/LayerTest/LayerTest.cpp @@ -202,14 +202,14 @@ void LayerTest2::onEnter() layer2->setIsRelativeAnchorPoint(true); addChild(layer2, 1); - CCIntervalAction* actionTint = CCTintBy::actionWithDuration(2, -255, -127, 0); - CCIntervalAction* actionTintBack = actionTint->reverse(); - CCIntervalAction* seq1 = (CCIntervalAction*)CCSequence::actions( actionTint, actionTintBack, NULL); + CCActionInterval* actionTint = CCTintBy::actionWithDuration(2, -255, -127, 0); + CCActionInterval* actionTintBack = actionTint->reverse(); + CCActionInterval* seq1 = (CCActionInterval*)CCSequence::actions( actionTint, actionTintBack, NULL); layer1->runAction(seq1); - CCIntervalAction* actionFade = CCFadeOut::actionWithDuration(2.0f); - CCIntervalAction* actionFadeBack = actionFade->reverse(); - CCIntervalAction* seq2 = (CCIntervalAction*)CCSequence::actions(actionFade, actionFadeBack, NULL); + CCActionInterval* actionFade = CCFadeOut::actionWithDuration(2.0f); + CCActionInterval* actionFadeBack = actionFade->reverse(); + CCActionInterval* seq2 = (CCActionInterval*)CCSequence::actions(actionFade, actionFadeBack, NULL); layer2->runAction(seq2); } diff --git a/tests/tests/MenuTest/MenuTest.cpp b/tests/tests/MenuTest/MenuTest.cpp index e7d5551b4d..fc74b01bf8 100644 --- a/tests/tests/MenuTest/MenuTest.cpp +++ b/tests/tests/MenuTest/MenuTest.cpp @@ -61,10 +61,10 @@ MenuLayer1::MenuLayer1() // Font Item CCMenuItemFont* item6 = CCMenuItemFont::itemFromString("Quit", this, menu_selector(MenuLayer1::onQuit)); - CCIntervalAction* color_action = CCTintBy::actionWithDuration(0.5f, 0, -255, -255); - CCIntervalAction* color_back = color_action->reverse(); + CCActionInterval* color_action = CCTintBy::actionWithDuration(0.5f, 0, -255, -255); + CCActionInterval* color_back = color_action->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(color_action, color_back, NULL); - item6->runAction(CCRepeatForever::actionWithAction((CCIntervalAction*)seq)); + item6->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq)); CCMenu* menu = CCMenu::menuWithItems( item1, item2, item3, item4, item5, item6, NULL); menu->alignItemsVertically(); @@ -281,12 +281,12 @@ MenuLayer3::MenuLayer3() CCJumpBy* jump = CCJumpBy::actionWithDuration(3, CGPointMake(400,0), 50, 4); item2->runAction( CCRepeatForever::actionWithAction( - (CCIntervalAction*)(CCSequence::actions( jump, jump->reverse(), NULL)) + (CCActionInterval*)(CCSequence::actions( jump, jump->reverse(), NULL)) ) ); - CCIntervalAction* spin1 = CCRotateBy::actionWithDuration(3, 360); - CCIntervalAction* spin2 = (CCIntervalAction*)(spin1->copy()->autorelease()); - CCIntervalAction* spin3 = (CCIntervalAction*)(spin1->copy()->autorelease()); + CCActionInterval* spin1 = CCRotateBy::actionWithDuration(3, 360); + CCActionInterval* spin2 = (CCActionInterval*)(spin1->copy()->autorelease()); + CCActionInterval* spin3 = (CCActionInterval*)(spin1->copy()->autorelease()); item1->runAction( CCRepeatForever::actionWithAction(spin1) ); item2->runAction( CCRepeatForever::actionWithAction(spin2) ); diff --git a/tests/tests/MotionStreakTest/MotionStreakTest.cpp b/tests/tests/MotionStreakTest/MotionStreakTest.cpp index d6c904787c..52ca25b1f2 100644 --- a/tests/tests/MotionStreakTest/MotionStreakTest.cpp +++ b/tests/tests/MotionStreakTest/MotionStreakTest.cpp @@ -29,11 +29,11 @@ void MotionStreakTest1::onEnter() // schedule an update on each frame so we can syncronize the streak with the target schedule(schedule_selector(MotionStreakTest1::onUpdate)); - CCIntervalAction* a1 = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* a1 = CCRotateBy::actionWithDuration(2, 360); CCAction* action1 = CCRepeatForever::actionWithAction(a1); - CCIntervalAction* motion = CCMoveBy::actionWithDuration(2, CGPointMake(100,0) ); - m_root->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(motion, motion->reverse(), NULL)) ) ); + CCActionInterval* motion = CCMoveBy::actionWithDuration(2, CGPointMake(100,0) ); + m_root->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(motion, motion->reverse(), NULL)) ) ); m_root->runAction( action1 ); } diff --git a/tests/tests/ParallaxTest/ParallaxTest.cpp b/tests/tests/ParallaxTest/ParallaxTest.cpp index e3508d145b..08db0f2771 100644 --- a/tests/tests/ParallaxTest/ParallaxTest.cpp +++ b/tests/tests/ParallaxTest/ParallaxTest.cpp @@ -60,12 +60,12 @@ Parallax1::Parallax1() // now create some actions that will move the 'void' node // and the children of the 'void' node will move at different // speed, thus, simulation the 3D environment - CCIntervalAction* goUp = CCMoveBy::actionWithDuration(4, ccp(0,-500) ); - CCIntervalAction* goDown = goUp->reverse(); - CCIntervalAction* go = CCMoveBy::actionWithDuration(8, ccp(-1000,0) ); - CCIntervalAction* goBack = go->reverse(); + CCActionInterval* goUp = CCMoveBy::actionWithDuration(4, ccp(0,-500) ); + CCActionInterval* goDown = goUp->reverse(); + CCActionInterval* go = CCMoveBy::actionWithDuration(8, ccp(-1000,0) ); + CCActionInterval* goBack = go->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(goUp, go, goDown, goBack, NULL); - voidNode->runAction( (CCRepeatForever::actionWithAction((CCIntervalAction*) seq) )); + voidNode->runAction( (CCRepeatForever::actionWithAction((CCActionInterval*) seq) )); addChild( voidNode ); } diff --git a/tests/tests/ParticleTest/ParticleTest.cpp b/tests/tests/ParticleTest/ParticleTest.cpp index 7cfd2252e9..e10b62dc5b 100644 --- a/tests/tests/ParticleTest/ParticleTest.cpp +++ b/tests/tests/ParticleTest/ParticleTest.cpp @@ -1,5 +1,5 @@ #include "ParticleTest.h" -// #include "CCIntervalAction.h" +// #include "CCActionInterval.h" // #include "CCMenu.h" // #include "CCLabel.h" // #include "CCLabelAtlas.h" @@ -614,10 +614,10 @@ void ParallaxParticle::onEnter() p2->addChild(par, 10); par->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) ); - CCIntervalAction* move = CCMoveBy::actionWithDuration(4, CGPointMake(300,0)); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(4, CGPointMake(300,0)); + CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL); - p->runAction(CCRepeatForever::actionWithAction((CCIntervalAction*)seq)); + p->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq)); } std::string ParallaxParticle::title() @@ -1087,10 +1087,10 @@ ParticleDemo::ParticleDemo(void) addChild(m_background, 5); m_background->setPosition( CGPointMake(s.width/2, s.height-180) ); - CCIntervalAction* move = CCMoveBy::actionWithDuration(4, CGPointMake(300,0) ); - CCIntervalAction* move_back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(4, CGPointMake(300,0) ); + CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL); - m_background->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq) ); + m_background->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq) ); schedule( schedule_selector(ParticleDemo::step) ); diff --git a/tests/tests/RotateWorldTest/RotateWorldTest.cpp b/tests/tests/RotateWorldTest/RotateWorldTest.cpp index ebb127bfd2..7c67c6c5ad 100644 --- a/tests/tests/RotateWorldTest/RotateWorldTest.cpp +++ b/tests/tests/RotateWorldTest/RotateWorldTest.cpp @@ -61,11 +61,11 @@ void SpriteLayer::onEnter() sprite->runAction(rot); - CCIntervalAction *jump1 = CCJumpBy::actionWithDuration(4, CGPointMake(-400,0), 100, 4); - CCIntervalAction *jump2 = jump1->reverse(); + CCActionInterval *jump1 = CCJumpBy::actionWithDuration(4, CGPointMake(-400,0), 100, 4); + CCActionInterval *jump2 = jump1->reverse(); - CCIntervalAction *rot1 = CCRotateBy::actionWithDuration(4, 360*2); - CCIntervalAction *rot2 = rot1->reverse(); + CCActionInterval *rot1 = CCRotateBy::actionWithDuration(4, 360*2); + CCActionInterval *rot2 = rot1->reverse(); spriteSister1->runAction(CCRepeat::actionWithAction( CCSequence::actions(jump2, jump1, NULL), 5 )); spriteSister2->runAction(CCRepeat::actionWithAction( CCSequence::actions((CCFiniteTimeAction *)(jump1->copy()->autorelease()), (CCFiniteTimeAction *)(jump2->copy()->autorelease()), NULL), 5 )); diff --git a/tests/tests/SceneTest/SceneTest.cpp b/tests/tests/SceneTest/SceneTest.cpp index 4d28b095cc..2dac8790c3 100644 --- a/tests/tests/SceneTest/SceneTest.cpp +++ b/tests/tests/SceneTest/SceneTest.cpp @@ -31,7 +31,7 @@ SceneTestLayer1::SceneTestLayer1() CCSprite* sprite = CCSprite::spriteWithFile(s_pPathGrossini); addChild(sprite); sprite->setPosition( CGPointMake(s.width-40, s.height/2) ); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(2, 360); CCAction* repeat = CCRepeatForever::actionWithAction(rotate); sprite->runAction(repeat); @@ -104,7 +104,7 @@ SceneTestLayer2::SceneTestLayer2() CCSprite* sprite = CCSprite::spriteWithFile(s_pPathGrossini); addChild(sprite); sprite->setPosition( CGPointMake(s.width-40, s.height/2) ); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(2, 360); CCAction* repeat = CCRepeatForever::actionWithAction(rotate); sprite->runAction(repeat); @@ -161,7 +161,7 @@ SceneTestLayer3::SceneTestLayer3() CCSprite* sprite = CCSprite::spriteWithFile(s_pPathGrossini); addChild(sprite); sprite->setPosition( CGPointMake(s.width-40, s.height/2) ); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(2, 360); CCAction* repeat = CCRepeatForever::actionWithAction(rotate); sprite->runAction(repeat); diff --git a/tests/tests/SpriteTest/SpriteTest.cpp b/tests/tests/SpriteTest/SpriteTest.cpp index eda0a96420..e86218e757 100644 --- a/tests/tests/SpriteTest/SpriteTest.cpp +++ b/tests/tests/SpriteTest/SpriteTest.cpp @@ -220,7 +220,7 @@ void Sprite1::addNewSpriteWithCoords(CGPoint p) sprite->setPosition( ccp( p.x, p.y) ); - CCIntervalAction* action; + CCActionInterval* action; float random = CCRANDOM_0_1(); if( random < 0.20 ) @@ -233,8 +233,8 @@ void Sprite1::addNewSpriteWithCoords(CGPoint p) action = CCTintBy::actionWithDuration(2, 0, -255, -255); else action = CCFadeOut::actionWithDuration(2); - CCIntervalAction* action_back = action->reverse(); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions( action, action_back, NULL )); + CCActionInterval* action_back = action->reverse(); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions( action, action_back, NULL )); sprite->runAction( CCRepeatForever::actionWithAction(seq) ); } @@ -295,7 +295,7 @@ void SpriteSheet1::addNewSpriteWithCoords(CGPoint p) sprite->setPosition( ccp( p.x, p.y) ); - CCIntervalAction* action; + CCActionInterval* action; float random = CCRANDOM_0_1(); if( random < 0.20 ) @@ -309,8 +309,8 @@ void SpriteSheet1::addNewSpriteWithCoords(CGPoint p) else action = CCFadeOut::actionWithDuration(2); - CCIntervalAction* action_back = action->reverse(); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions(action, action_back, NULL)); + CCActionInterval* action_back = action->reverse(); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions(action, action_back, NULL)); sprite->runAction( CCRepeatForever::actionWithAction(seq)); } @@ -370,21 +370,21 @@ SpriteColorOpacity::SpriteColorOpacity() sprite7->setPosition( ccp( (s.width/5)*3, (s.height/3)*2) ); sprite8->setPosition( ccp( (s.width/5)*4, (s.height/3)*2) ); - CCIntervalAction* action = CCFadeIn::actionWithDuration(2); - CCIntervalAction* action_back = action->reverse(); - CCAction* fade = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( action, action_back, NULL))); + CCActionInterval* action = CCFadeIn::actionWithDuration(2); + CCActionInterval* action_back = action->reverse(); + CCAction* fade = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( action, action_back, NULL))); - CCIntervalAction* tintred = CCTintBy::actionWithDuration(2, 0, -255, -255); - CCIntervalAction* tintred_back = tintred->reverse(); - CCAction* red = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( tintred, tintred_back, NULL)) ); + CCActionInterval* tintred = CCTintBy::actionWithDuration(2, 0, -255, -255); + CCActionInterval* tintred_back = tintred->reverse(); + CCAction* red = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( tintred, tintred_back, NULL)) ); - CCIntervalAction* tintgreen = CCTintBy::actionWithDuration(2, -255, 0, -255); - CCIntervalAction* tintgreen_back = tintgreen->reverse(); - CCAction* green = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( tintgreen, tintgreen_back, NULL))); + CCActionInterval* tintgreen = CCTintBy::actionWithDuration(2, -255, 0, -255); + CCActionInterval* tintgreen_back = tintgreen->reverse(); + CCAction* green = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( tintgreen, tintgreen_back, NULL))); - CCIntervalAction* tintblue = CCTintBy::actionWithDuration(2, -255, -255, 0); - CCIntervalAction* tintblue_back = tintblue->reverse(); - CCAction* blue = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( tintblue, tintblue_back, NULL)) ); + CCActionInterval* tintblue = CCTintBy::actionWithDuration(2, -255, -255, 0); + CCActionInterval* tintblue_back = tintblue->reverse(); + CCAction* blue = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( tintblue, tintblue_back, NULL)) ); sprite5->runAction(red); sprite6->runAction(green); @@ -456,21 +456,21 @@ SpriteSheetColorOpacity::SpriteSheetColorOpacity() sprite7->setPosition( ccp( (s.width/5)*3, (s.height/3)*2) ); sprite8->setPosition( ccp( (s.width/5)*4, (s.height/3)*2) ); - CCIntervalAction* action = CCFadeIn::actionWithDuration(2); - CCIntervalAction* action_back = action->reverse(); - CCAction* fade = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( action, action_back,NULL))); + CCActionInterval* action = CCFadeIn::actionWithDuration(2); + CCActionInterval* action_back = action->reverse(); + CCAction* fade = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( action, action_back,NULL))); - CCIntervalAction* tintred = CCTintBy::actionWithDuration(2, 0, -255, -255); - CCIntervalAction* tintred_back = tintred->reverse(); - CCAction* red = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( tintred, tintred_back,NULL))); + CCActionInterval* tintred = CCTintBy::actionWithDuration(2, 0, -255, -255); + CCActionInterval* tintred_back = tintred->reverse(); + CCAction* red = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( tintred, tintred_back,NULL))); - CCIntervalAction* tintgreen = CCTintBy::actionWithDuration(2, -255, 0, -255); - CCIntervalAction* tintgreen_back = tintgreen->reverse(); - CCAction* green = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( tintgreen, tintgreen_back,NULL))); + CCActionInterval* tintgreen = CCTintBy::actionWithDuration(2, -255, 0, -255); + CCActionInterval* tintgreen_back = tintgreen->reverse(); + CCAction* green = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( tintgreen, tintgreen_back,NULL))); - CCIntervalAction* tintblue = CCTintBy::actionWithDuration(2, -255, -255, 0); - CCIntervalAction* tintblue_back = tintblue->reverse(); - CCAction* blue = CCRepeatForever::actionWithAction( (CCIntervalAction*)(CCSequence::actions( tintblue, tintblue_back,NULL))); + CCActionInterval* tintblue = CCTintBy::actionWithDuration(2, -255, -255, 0); + CCActionInterval* tintblue_back = tintblue->reverse(); + CCAction* blue = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions( tintblue, tintblue_back,NULL))); sprite5->runAction(red); @@ -893,7 +893,7 @@ SpriteAnchorPoint::SpriteAnchorPoint() CGSize s = CCDirector::sharedDirector()->getWinSize(); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(10, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(10, 360); CCAction* action = CCRepeatForever::actionWithAction(rotate); for(int i=0;i<3;i++) @@ -947,7 +947,7 @@ SpriteSheetAnchorPoint::SpriteSheetAnchorPoint() CGSize s = CCDirector::sharedDirector()->getWinSize(); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(10, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(10, 360); CCAction* action = CCRepeatForever::actionWithAction(rotate); for(int i=0;i<3;i++) { @@ -1006,17 +1006,17 @@ Sprite6::Sprite6() // SpriteSheet actions - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(5, 360); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(5, 360); CCAction* action = CCRepeatForever::actionWithAction(rotate); // SpriteSheet actions - CCIntervalAction* rotate_back = rotate->reverse(); - CCIntervalAction* rotate_seq = (CCIntervalAction*)(CCSequence::actions(rotate, rotate_back, NULL)); + CCActionInterval* rotate_back = rotate->reverse(); + CCActionInterval* rotate_seq = (CCActionInterval*)(CCSequence::actions(rotate, rotate_back, NULL)); CCAction* rotate_forever = CCRepeatForever::actionWithAction(rotate_seq); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(5, 1.5f); - CCIntervalAction* scale_back = scale->reverse(); - CCIntervalAction* scale_seq = (CCIntervalAction*)(CCSequence::actions( scale, scale_back, NULL)); + CCActionInterval* scale = CCScaleBy::actionWithDuration(5, 1.5f); + CCActionInterval* scale_back = scale->reverse(); + CCActionInterval* scale_seq = (CCActionInterval*)(CCSequence::actions( scale, scale_back, NULL)); CCAction* scale_forever = CCRepeatForever::actionWithAction(scale_seq); float step = s.width/4; @@ -1135,9 +1135,9 @@ SpriteAliased::SpriteAliased() sprite2->setPosition( ccp( s.width/2 + 100, s.height/2 ) ); addChild(sprite2, 0, kTagSprite2); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* scale_back = scale->reverse(); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions( scale, scale_back, NULL)); + CCActionInterval* scale = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* scale_back = scale->reverse(); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions( scale, scale_back, NULL)); CCAction* repeat = CCRepeatForever::actionWithAction(seq); CCAction* repeat2 = (CCAction*)(repeat->copy()->autorelease()); @@ -1194,9 +1194,9 @@ SpriteSheetAliased::SpriteSheetAliased() sprite2->setPosition( ccp( s.width/2 + 100, s.height/2 ) ); sheet->addChild(sprite2, 0, kTagSprite2); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* scale_back = scale->reverse(); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions( scale, scale_back, NULL)); + CCActionInterval* scale = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* scale_back = scale->reverse(); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions( scale, scale_back, NULL)); CCAction* repeat = CCRepeatForever::actionWithAction(seq); CCAction* repeat2 = (CCAction*)(repeat->copy()->autorelease()); @@ -1272,7 +1272,7 @@ void SpriteNewTexture::addNewSprite() sprite->setPosition( ccp( p.x, p.y) ); - CCIntervalAction* action; + CCActionInterval* action; float random = CCRANDOM_0_1(); if( random < 0.20 ) @@ -1286,8 +1286,8 @@ void SpriteNewTexture::addNewSprite() else action = CCFadeOut::actionWithDuration(2); - CCIntervalAction* action_back = action->reverse(); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions(action, action_back, NULL)); + CCActionInterval* action_back = action->reverse(); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions(action, action_back, NULL)); sprite->runAction( CCRepeatForever::actionWithAction(seq) ); } @@ -1379,7 +1379,7 @@ void SpriteSheetNewTexture::addNewSprite() sprite->setPosition( ccp( p.x, p.y) ); - CCIntervalAction* action; + CCActionInterval* action; float random = CCRANDOM_0_1(); if( random < 0.20 ) @@ -1392,8 +1392,8 @@ void SpriteSheetNewTexture::addNewSprite() action = CCTintBy::actionWithDuration(2, 0, -255, -255); else action = CCFadeOut::actionWithDuration(2); - CCIntervalAction* action_back = action->reverse(); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions(action, action_back, NULL)); + CCActionInterval* action_back = action->reverse(); + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions(action, action_back, NULL)); sprite->runAction( CCRepeatForever::actionWithAction(seq) ); } @@ -1760,9 +1760,9 @@ SpriteOffsetAnchorScale::SpriteOffsetAnchorScale() CCAnimation *animation = CCAnimation::animationWithName("dance", 0.2f, animFrames); sprite->runAction(CCRepeatForever::actionWithAction( CCAnimate::actionWithAnimation(animation, false) )); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 2); - CCIntervalAction* scale_back = scale->reverse(); - CCIntervalAction* seq_scale = (CCIntervalAction*)(CCSequence::actions(scale, scale_back, NULL)); + CCActionInterval* scale = CCScaleBy::actionWithDuration(2, 2); + CCActionInterval* scale_back = scale->reverse(); + CCActionInterval* seq_scale = (CCActionInterval*)(CCSequence::actions(scale, scale_back, NULL)); sprite->runAction(CCRepeatForever::actionWithAction(seq_scale)); addChild(sprite, 0); @@ -1836,9 +1836,9 @@ SpriteSheetOffsetAnchorScale::SpriteSheetOffsetAnchorScale() CCAnimation *animation = CCAnimation::animationWithName("dance", 0.2f, animFrames); sprite->runAction(CCRepeatForever::actionWithAction( CCAnimate::actionWithAnimation(animation, false) ) ); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 2); - CCIntervalAction* scale_back = scale->reverse(); - CCIntervalAction* seq_scale = (CCIntervalAction*)(CCSequence::actions(scale, scale_back, NULL) ); + CCActionInterval* scale = CCScaleBy::actionWithDuration(2, 2); + CCActionInterval* scale_back = scale->reverse(); + CCActionInterval* seq_scale = (CCActionInterval*)(CCSequence::actions(scale, scale_back, NULL) ); sprite->runAction(CCRepeatForever::actionWithAction(seq_scale) ); spritesheet->addChild(sprite, i); @@ -1896,7 +1896,7 @@ SpriteAnimationSplit::SpriteAnimationSplit() CCAnimation *animation = CCAnimation::animationWithName("fly", 0.2f, animFrames); CCAnimate *animate = CCAnimate::actionWithAnimation(animation, false); - CCIntervalAction* seq = (CCIntervalAction*)(CCSequence::actions( animate, + CCActionInterval* seq = (CCActionInterval*)(CCSequence::actions( animate, CCFlipX::actionWithFlipX(true), animate->copy()->autorelease(), CCFlipX::actionWithFlipX(false), @@ -1960,7 +1960,7 @@ SpriteHybrid::SpriteHybrid() } sprite->setPosition( ccp(x,y) ); - CCIntervalAction* action = CCRotateBy::actionWithDuration(4, 360); + CCActionInterval* action = CCRotateBy::actionWithDuration(4, 360); sprite->runAction( CCRepeatForever::actionWithAction(action) ); } @@ -2066,18 +2066,18 @@ SpriteSheetChildren::SpriteSheetChildren() sprite1->runAction(CCRepeatForever::actionWithAction( CCAnimate::actionWithAnimation(animation, false) ) ); // END NEW CODE - CCIntervalAction* action = CCMoveBy::actionWithDuration(2, ccp(200,0)); - CCIntervalAction* action_back = action->reverse(); - CCIntervalAction* action_rot = CCRotateBy::actionWithDuration(2, 360); - CCIntervalAction* action_s = CCScaleBy::actionWithDuration(2, 2); - CCIntervalAction* action_s_back = action_s->reverse(); + CCActionInterval* action = CCMoveBy::actionWithDuration(2, ccp(200,0)); + CCActionInterval* action_back = action->reverse(); + CCActionInterval* action_rot = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* action_s = CCScaleBy::actionWithDuration(2, 2); + CCActionInterval* action_s_back = action_s->reverse(); - CCIntervalAction* seq2 = action_rot->reverse(); + CCActionInterval* seq2 = action_rot->reverse(); sprite2->runAction( CCRepeatForever::actionWithAction(seq2) ); sprite1->runAction( (CCAction*)(CCRepeatForever::actionWithAction(action_rot)) ); - sprite1->runAction( (CCAction*)(CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(action, action_back,NULL)) ))); - sprite1->runAction( (CCAction*)(CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(action_s, action_s_back,NULL)))) ); + sprite1->runAction( (CCAction*)(CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(action, action_back,NULL)) ))); + sprite1->runAction( (CCAction*)(CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(action_s, action_s_back,NULL)))) ); animFrames->release(); @@ -2135,15 +2135,15 @@ SpriteSheetChildren2::SpriteSheetChildren2() // don't scale and rotate with it's parent sprite13->setHornorParentTransform((ccHonorParentTransform) (sprite13->getHornorParentTransform() & ~(CC_HONOR_PARENT_TRANSFORM_SCALE | CC_HONOR_PARENT_TRANSFORM_ROTATE) )); - CCIntervalAction* action = CCMoveBy::actionWithDuration(2, ccp(200,0)); - CCIntervalAction* action_back = action->reverse(); - CCIntervalAction* action_rot = CCRotateBy::actionWithDuration(2, 360); - CCIntervalAction* action_s = CCScaleBy::actionWithDuration(2, 2); - CCIntervalAction* action_s_back = action_s->reverse(); + CCActionInterval* action = CCMoveBy::actionWithDuration(2, ccp(200,0)); + CCActionInterval* action_back = action->reverse(); + CCActionInterval* action_rot = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* action_s = CCScaleBy::actionWithDuration(2, 2); + CCActionInterval* action_s_back = action_s->reverse(); sprite11->runAction( CCRepeatForever::actionWithAction(action_rot)); - sprite11->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(action, action_back,NULL)))); - sprite11->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions(action_s, action_s_back,NULL)))); + sprite11->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(action, action_back,NULL)))); + sprite11->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(action_s, action_s_back,NULL)))); // // another set of parent / children @@ -2171,7 +2171,7 @@ SpriteSheetChildren2::SpriteSheetChildren2() sprite23->setHornorParentTransform((ccHonorParentTransform) (sprite23->getHornorParentTransform() & ~CC_HONOR_PARENT_TRANSFORM_SCALE)); sprite21->runAction(CCRepeatForever::actionWithAction(CCRotateBy::actionWithDuration(1, 360) )); - sprite21->runAction(CCRepeatForever::actionWithAction((CCIntervalAction*)(CCSequence::actions( CCScaleTo::actionWithDuration(0.5f, 5.0f), CCScaleTo::actionWithDuration(0.5f, 1), NULL ) )) ); + sprite21->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions( CCScaleTo::actionWithDuration(0.5f, 5.0f), CCScaleTo::actionWithDuration(0.5f, 1), NULL ) )) ); } void SpriteSheetChildren2::onExit() @@ -2590,7 +2590,7 @@ SpriteSheetChildrenScale::SpriteSheetChildrenScale() CCNode *aParent; CCSprite* sprite1, *sprite2; - CCIntervalAction* rot = CCRotateBy::actionWithDuration(10, 360); + CCActionInterval* rot = CCRotateBy::actionWithDuration(10, 360); CCAction* seq = CCRepeatForever::actionWithAction(rot); // @@ -2691,10 +2691,10 @@ SpriteChildrenChildren::SpriteChildrenChildren() CCNode *aParent; CCSprite *l1, *l2a, *l2b, *l3a1, *l3a2, *l3b1, *l3b2; - CCIntervalAction* rot = CCRotateBy::actionWithDuration(10, 360); + CCActionInterval* rot = CCRotateBy::actionWithDuration(10, 360); CCAction* seq = CCRepeatForever::actionWithAction(rot); - CCIntervalAction* rot_back = rot->reverse(); + CCActionInterval* rot_back = rot->reverse(); CCAction* rot_back_fe = CCRepeatForever::actionWithAction(rot_back); // @@ -2774,10 +2774,10 @@ SpriteSheetChildrenChildren::SpriteSheetChildrenChildren() CCSpriteSheet *aParent; CCSprite *l1, *l2a, *l2b, *l3a1, *l3a2, *l3b1, *l3b2; - CCIntervalAction* rot = CCRotateBy::actionWithDuration(10, 360); + CCActionInterval* rot = CCRotateBy::actionWithDuration(10, 360); CCAction* seq = CCRepeatForever::actionWithAction(rot); - CCIntervalAction* rot_back = rot->reverse(); + CCActionInterval* rot_back = rot->reverse(); CCAction* rot_back_fe = CCRepeatForever::actionWithAction(rot_back); // diff --git a/tests/tests/TileMapTest/TileMapTest.cpp b/tests/tests/TileMapTest/TileMapTest.cpp index 250bce3303..6fb9d68fa9 100644 --- a/tests/tests/TileMapTest/TileMapTest.cpp +++ b/tests/tests/TileMapTest/TileMapTest.cpp @@ -321,17 +321,17 @@ TMXReadWriteTest::TMXReadWriteTest() tile2->setAnchorPoint( ccp(0.5f, 0.5f) ); tile3->setAnchorPoint( ccp(0.5f, 0.5f) ); - CCIntervalAction* move = CCMoveBy::actionWithDuration(0.5f, ccp(0,160)); - CCIntervalAction* rotate = CCRotateBy::actionWithDuration(2, 360); - CCIntervalAction* scale = CCScaleBy::actionWithDuration(2, 5); - CCIntervalAction* opacity = CCFadeOut::actionWithDuration(2); - CCIntervalAction* fadein = CCFadeIn::actionWithDuration(2); - CCIntervalAction* scaleback = CCScaleTo::actionWithDuration(1, 1); - CCInstantAction* finish = CCCallFuncN::actionWithTarget(this, callfuncN_selector(TMXReadWriteTest::removeSprite)); + CCActionInterval* move = CCMoveBy::actionWithDuration(0.5f, ccp(0,160)); + CCActionInterval* rotate = CCRotateBy::actionWithDuration(2, 360); + CCActionInterval* scale = CCScaleBy::actionWithDuration(2, 5); + CCActionInterval* opacity = CCFadeOut::actionWithDuration(2); + CCActionInterval* fadein = CCFadeIn::actionWithDuration(2); + CCActionInterval* scaleback = CCScaleTo::actionWithDuration(1, 1); + CCActionInstant* finish = CCCallFuncN::actionWithTarget(this, callfuncN_selector(TMXReadWriteTest::removeSprite)); CCFiniteTimeAction* seq0 = CCSequence::actions(move, rotate, scale, opacity, fadein, scaleback, finish, NULL); - CCIntervalAction* seq1 = (CCIntervalAction*)(seq0->copy()->autorelease()); - CCIntervalAction* seq2 = (CCIntervalAction*)(seq0->copy()->autorelease()); - CCIntervalAction* seq3 = (CCIntervalAction*)(seq0->copy()->autorelease()); + CCActionInterval* seq1 = (CCActionInterval*)(seq0->copy()->autorelease()); + CCActionInterval* seq2 = (CCActionInterval*)(seq0->copy()->autorelease()); + CCActionInterval* seq3 = (CCActionInterval*)(seq0->copy()->autorelease()); tile0->runAction(seq0); tile1->runAction(seq1); @@ -809,10 +809,10 @@ TMXIsoZorder::TMXIsoZorder() m_tamara->setAnchorPoint(ccp(0.5f,0)); - CCIntervalAction* move = CCMoveBy::actionWithDuration(10, ccp(300,250)); - CCIntervalAction* back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccp(300,250)); + CCActionInterval* back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(move, back,NULL); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*) seq) ); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*) seq) ); schedule( schedule_selector(TMXIsoZorder::repositionSprite) ); } @@ -874,10 +874,10 @@ TMXOrthoZorder::TMXOrthoZorder() m_tamara->setAnchorPoint(ccp(0.5f,0)); - CCIntervalAction* move = CCMoveBy::actionWithDuration(10, ccp(400,450)); - CCIntervalAction* back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccp(400,450)); + CCActionInterval* back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(move, back,NULL); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq)); schedule( schedule_selector(TMXOrthoZorder::repositionSprite)); } @@ -935,10 +935,10 @@ TMXIsoVertexZ::TMXIsoVertexZ() m_tamara = layer->tileAt( ccp(29,29) ); m_tamara->retain(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(10, ccp(300,250)); - CCIntervalAction* back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccp(300,250)); + CCActionInterval* back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(move, back,NULL); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*) seq) ); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*) seq) ); schedule( schedule_selector(TMXIsoVertexZ::repositionSprite)); @@ -1002,10 +1002,10 @@ TMXOrthoVertexZ::TMXOrthoVertexZ() m_tamara = layer->tileAt(ccp(0,11)); m_tamara->retain(); - CCIntervalAction* move = CCMoveBy::actionWithDuration(10, ccp(400,450)); - CCIntervalAction* back = move->reverse(); + CCActionInterval* move = CCMoveBy::actionWithDuration(10, ccp(400,450)); + CCActionInterval* back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::actions(move, back,NULL); - m_tamara->runAction( CCRepeatForever::actionWithAction((CCIntervalAction*)seq)); + m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq)); schedule(schedule_selector(TMXOrthoVertexZ::repositionSprite)); From 3c6d1d8317ae91d1a49ce643b5d4b1e277e2b88f Mon Sep 17 00:00:00 2001 From: natural-law Date: Thu, 23 Dec 2010 16:47:29 +0800 Subject: [PATCH 3/5] update actions to 0.99.5 --- cocos2dx/actions/CCActionInstant.cpp | 60 +++++++++++++++++++++++++ cocos2dx/actions/CCActionInterval.cpp | 2 +- cocos2dx/actions/CCActionPageTurn3D.cpp | 19 ++++---- cocos2dx/actions/CCActionTiledGrid.cpp | 8 ++++ cocos2dx/include/CCActionInstant.h | 30 +++++++++++++ cocos2dx/include/selector_protocol.h | 2 + 6 files changed, 110 insertions(+), 11 deletions(-) diff --git a/cocos2dx/actions/CCActionInstant.cpp b/cocos2dx/actions/CCActionInstant.cpp index 493fba0795..50d31485e8 100644 --- a/cocos2dx/actions/CCActionInstant.cpp +++ b/cocos2dx/actions/CCActionInstant.cpp @@ -407,6 +407,66 @@ namespace cocos2d { } } + // + // CCCallFuncO + // + CCCallFuncO::CCCallFuncO() + { + m_pTarget = NULL; + } + + CCCallFuncO::~CCCallFuncO() + { + m_pTarget->release(); + } + + void CCCallFuncO::execute() + { + if(m_pCallFuncO) + { + (m_pSelectorTarget->*m_pCallFuncO)(m_pTarget); + } + } + CCCallFuncO * CCCallFuncO::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, NSObject* pObject) + { + CCCallFuncO *pRet = new CCCallFuncO(); + if(pRet->initWithTarget(pSelectorTarget, selector, pObject)) + { + pRet->autorelease(); + return pRet; + } + CCX_SAFE_DELETE(pRet); + return NULL; + } + bool CCCallFuncO::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, NSObject* pObject) + { + if( CCCallFunc::initWithTarget(pSelectorTarget) ) + { + m_pObject = pObject; + m_pObject->retain(); + + m_pCallFuncO = selector; + return true; + } + return false; + } + NSObject * CCCallFuncO::copyWithZone(NSZone* zone) + { + NSZone* pNewZone = NULL; + CCCallFuncO* pRet = NULL; + if(zone && zone->m_pCopyObject) //in case of being called at sub class + pRet = (CCCallFuncO*)(zone->m_pCopyObject); + else + { + pRet = new CCCallFuncO(); + zone = pNewZone = new NSZone(pRet); + } + CCCallFunc::copyWithZone(zone); + pRet->initWithTarget(m_pSelectorTarget, m_pCallFuncO, m_pObject); + CCX_SAFE_DELETE(pNewZone); + return pRet; + } + #if NS_BLOCKS_AVAILABLE diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index 473617a14c..c96d1e58d2 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -1342,7 +1342,7 @@ NSObject* CCBlink::copyWithZone(cocos2d::NSZone *pZone) void CCBlink::update(cocos2d::ccTime time) { - if (m_pTarget) + if (m_pTarget && ! isDone()) { ccTime slice = 1.0f / m_nTimes; ccTime m = fmodf(time, slice); diff --git a/cocos2dx/actions/CCActionPageTurn3D.cpp b/cocos2dx/actions/CCActionPageTurn3D.cpp index 836c8b1e75..feee9aee36 100644 --- a/cocos2dx/actions/CCActionPageTurn3D.cpp +++ b/cocos2dx/actions/CCActionPageTurn3D.cpp @@ -78,26 +78,25 @@ namespace cocos2d if (beta <= M_PI) { p.x = ( r * sinf(beta)); - p.y = ( R + ay - ( r * (1 - cosBeta) * sinTheta)); - - // We scale z here to avoid the animation being - // too much bigger than the screen due to perspectve transform - p.z = (r * ( 1 - cosBeta ) * cosTheta) / 100; } else { // Force X = 0 to stop wrapped // points p.x = 0; - p.y = ( R + ay - ( r * (1 - cosBeta) * sinTheta)); - p.z = 0.001f; } - + + p.y = ( R + ay - ( r * (1 - cosBeta) * sinTheta)); + + // We scale z here to avoid the animation being + // too much bigger than the screen due to perspectve transform + p.z = (r * ( 1 - cosBeta ) * cosTheta) / 7;// "100" didn't work for + // Stop z coord from dropping beneath underlying page in a transition // issue #751 - if( p.z < 0.9f ) + if( p.z < 0.5f ) { - p.z = 0.9f; + p.z = 0.5f; } // Set new coords diff --git a/cocos2dx/actions/CCActionTiledGrid.cpp b/cocos2dx/actions/CCActionTiledGrid.cpp index 5f27a4dd2c..f4a281aa38 100644 --- a/cocos2dx/actions/CCActionTiledGrid.cpp +++ b/cocos2dx/actions/CCActionTiledGrid.cpp @@ -956,6 +956,10 @@ namespace cocos2d void CCSplitRows::startWithTarget(CCNode *pTarget) { CCTiledGrid3DAction::startWithTarget(pTarget); + + /** + @todo upto-0.99.5 Use CCDirector::sharedDirector()->getWinSizeInPixels() + */ m_winSize = CCDirector::sharedDirector()->getWinSize(); } @@ -1033,6 +1037,10 @@ namespace cocos2d void CCSplitCols::startWithTarget(CCNode *pTarget) { CCTiledGrid3DAction::startWithTarget(pTarget); + + /** + @todo upto-0.99.5 Use CCDirector::sharedDirector()->getWinSizeInPixels() + */ m_winSize = CCDirector::sharedDirector()->getWinSize(); } diff --git a/cocos2dx/include/CCActionInstant.h b/cocos2dx/include/CCActionInstant.h index 16b274af09..292d89842b 100644 --- a/cocos2dx/include/CCActionInstant.h +++ b/cocos2dx/include/CCActionInstant.h @@ -200,6 +200,7 @@ namespace cocos2d { SEL_CallFunc m_pCallFunc; SEL_CallFuncN m_pCallFuncN; SEL_CallFuncND m_pCallFuncND; + SEL_CallFuncO m_pCallFuncO; }; }; @@ -248,6 +249,35 @@ namespace cocos2d { void *m_pData; }; + + /** + @brief Calls a 'callback' with an object as the first argument. + O means Object. + @since v0.99.5 + */ + class CCX_DLL CCCallFuncO : public CCCallFunc + { + public: + CCCallFuncO(); + virtual ~CCCallFuncO(); + /** creates the action with the callback + + typedef void (SelectorProtocol::*SEL_CallFuncO)(NSObject*); + */ + static CCCallFuncO * actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, NSObject* pObject); + /** initializes the action with the callback + + typedef void (SelectorProtocol::*SEL_CallFuncO)(NSObject*); + */ + virtual bool initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, NSObject* pObject); + // super methods + virtual NSObject* copyWithZone(NSZone *pZone); + virtual void execute(); + + protected: + NSObject* m_pObject; + }; + } #endif //__CCINSTANT_ACTION_H__ diff --git a/cocos2dx/include/selector_protocol.h b/cocos2dx/include/selector_protocol.h index 397501ecc1..680bd2c045 100644 --- a/cocos2dx/include/selector_protocol.h +++ b/cocos2dx/include/selector_protocol.h @@ -53,6 +53,7 @@ typedef void (SelectorProtocol::*SEL_SCHEDULE)(ccTime); typedef void (SelectorProtocol::*SEL_CallFunc)(); typedef void (SelectorProtocol::*SEL_CallFuncN)(CCNode*); typedef void (SelectorProtocol::*SEL_CallFuncND)(CCNode*, void*); +typedef void (SelectorProtocol::*SEL_CallFuncO)(NSObject*); typedef void (SelectorProtocol::*SEL_MenuHandler)(NSObject*); // #define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(*((SEL_SCHEDULE*)(&(&_SELECTOR))) ) @@ -65,6 +66,7 @@ typedef void (SelectorProtocol::*SEL_MenuHandler)(NSObject*); #define callfunc_selector(_SELECTOR) (SEL_CallFunc)(&_SELECTOR) #define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(&_SELECTOR) #define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(&_SELECTOR) + #define callfuncO_selector(_SELECTOR) (SEL_CallFuncO)(&_SELECTOR) #define menu_selector(_SELECTOR) (SEL_MenuHandler)(&_SELECTOR) }//namespace cocos2d From e11ccb50fec465f587836830282d6135b07d028d Mon Sep 17 00:00:00 2001 From: natural-law Date: Fri, 24 Dec 2010 11:40:44 +0800 Subject: [PATCH 4/5] fixed #283 Add member data m_positionInPixels for some classes. --- cocos2dx/actions/CCActionGrid3D.cpp | 50 ++++++++++++++++++++++------- cocos2dx/include/CCActionGrid3D.h | 18 ++++++++--- cocos2dx/include/ccMacros.h | 43 +++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 16 deletions(-) diff --git a/cocos2dx/actions/CCActionGrid3D.cpp b/cocos2dx/actions/CCActionGrid3D.cpp index d501d9a66e..22d7db568e 100644 --- a/cocos2dx/actions/CCActionGrid3D.cpp +++ b/cocos2dx/actions/CCActionGrid3D.cpp @@ -362,10 +362,11 @@ namespace cocos2d { if (CCGrid3DAction::initWithSize(gridSize, duration)) { - m_position = pos; + m_position = ccp(-1, -1); + setPosition(pos); m_fRadius = r; m_fLensEffect = 0.7f; - m_lastPosition = ccp(-1, -1); + m_bDirty = YES; return true; } @@ -396,9 +397,20 @@ namespace cocos2d return pCopy; } + void CCLens3D::setPosition(CGPoint pos) + { + if( ! CGPoint::CGPointEqualToPoint(pos, m_position) ) { + m_position = pos; + m_positionInPixels.x = pos.x * CC_CONTENT_SCALE_FACTOR(); + m_positionInPixels.y = pos.y * CC_CONTENT_SCALE_FACTOR(); + + m_bDirty = YES; + } + } + void CCLens3D::update(cocos2d::ccTime time) { - if (m_position.x != m_lastPosition.x || m_position.y != m_lastPosition.y ) + if (m_bDirty) { int i, j; @@ -407,7 +419,7 @@ namespace cocos2d for (j = 0; j < m_sGridSize.y + 1; ++j) { ccVertex3F v = originalVertex(ccg(i, j)); - CGPoint vect = ccpSub(m_position, ccp(v.x, v.y)); + CGPoint vect = ccpSub(m_positionInPixels, ccp(v.x, v.y)); CGFloat r = ccpLength(vect); if (r < m_fRadius) @@ -434,7 +446,7 @@ namespace cocos2d } } - m_lastPosition = m_position; + m_bDirty = NO; } } @@ -463,7 +475,7 @@ namespace cocos2d { if (CCGrid3DAction::initWithSize(gridSize, duration)) { - m_position = pos; + setPosition(pos); m_fRadius = r; m_nWaves = wav; m_fAmplitude = amp; @@ -475,6 +487,13 @@ namespace cocos2d return false; } + void CCRipple3D::setPosition(CGPoint position) + { + m_position = position; + m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR(); + m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR(); + } + NSObject* CCRipple3D::copyWithZone(cocos2d::NSZone *pZone) { NSZone* pNewZone = NULL; @@ -507,7 +526,7 @@ namespace cocos2d for (j = 0; j < (m_sGridSize.y+1); ++j) { ccVertex3F v = originalVertex(ccg(i, j)); - CGPoint vect = ccpSub(m_position, ccp(v.x,v.y)); + CGPoint vect = ccpSub(m_positionInPixels, ccp(v.x,v.y)); CGFloat r = ccpLength(vect); if (r < m_fRadius) @@ -784,7 +803,7 @@ namespace cocos2d { if (CCGrid3DAction::initWithSize(gridSize, duration)) { - m_position = pos; + setPosition(pos); m_nTwirls = t; m_fAmplitude = amp; m_fAmplitudeRate = 1.0f; @@ -795,6 +814,13 @@ namespace cocos2d return false; } + void CCTwirl::setPosition(CGPoint position) + { + m_position = position; + m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR(); + m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR(); + } + NSObject* CCTwirl::copyWithZone(cocos2d::NSZone *pZone) { NSZone* pNewZone = NULL; @@ -822,7 +848,7 @@ namespace cocos2d void CCTwirl::update(cocos2d::ccTime time) { int i, j; - CGPoint c = m_position; + CGPoint c = m_positionInPixels; for (i = 0; i < (m_sGridSize.x+1); ++i) { @@ -836,9 +862,9 @@ namespace cocos2d CGFloat amp = 0.1f * m_fAmplitude * m_fAmplitudeRate; CGFloat a = r * cosf( (CGFloat)M_PI/2.0f + time * (CGFloat)M_PI * m_nTwirls * 2 ) * amp; - CGPoint d; - - d.x = sinf(a) * (v.y-c.y) + cosf(a) * (v.x-c.x); + CGPoint d; + + d.x = sinf(a) * (v.y-c.y) + cosf(a) * (v.x-c.x); d.y = cosf(a) * (v.y-c.y) - sinf(a) * (v.x-c.x); v.x = c.x + d.x; diff --git a/cocos2dx/include/CCActionGrid3D.h b/cocos2dx/include/CCActionGrid3D.h index c2dcadf480..8b6049fe29 100644 --- a/cocos2dx/include/CCActionGrid3D.h +++ b/cocos2dx/include/CCActionGrid3D.h @@ -93,7 +93,7 @@ namespace cocos2d inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; } inline CGPoint getPosition(void) { return m_position; } - inline void setPosition(CGPoint position) { m_position = position; } + void setPosition(CGPoint position); /** initializes the action with center position, radius, a grid size and duration */ bool initWithPosition(CGPoint pos, float r, ccGridSize gridSize, ccTime duration); @@ -109,7 +109,11 @@ namespace cocos2d float m_fRadius; /** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */ float m_fLensEffect; - CGPoint m_lastPosition; + + /* @since v0.99.5 */ + // CGPoint m_lastPosition; + CGPoint m_positionInPixels; + bool m_bDirty; }; /** @brief CCRipple3D action */ @@ -119,7 +123,7 @@ namespace cocos2d /** get center position */ inline CGPoint getPosition(void) { return m_position; } /** set center position */ - inline void setPosition(CGPoint position) { m_position = position; } + void setPosition(CGPoint position); inline float getAmplitude(void) { return m_fAmplitude; } inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; } @@ -144,6 +148,9 @@ namespace cocos2d int m_nWaves; float m_fAmplitude; float m_fAmplitudeRate; + + /*@since v0.99.5*/ + CGPoint m_positionInPixels; }; /** @brief CCShaky3D action */ @@ -224,7 +231,7 @@ namespace cocos2d /** get twirl center */ inline CGPoint getPosition(void) { return m_position; } /** set twirl center */ - inline void setPosition(CGPoint position) { m_position = position; } + void setPosition(CGPoint position); inline float getAmplitude(void) { return m_fAmplitude; } inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; } @@ -248,6 +255,9 @@ namespace cocos2d int m_nTwirls; float m_fAmplitude; float m_fAmplitudeRate; + + /*@since v0.99.5 */ + CGPoint m_positionInPixels; }; } diff --git a/cocos2dx/include/ccMacros.h b/cocos2dx/include/ccMacros.h index 3fa1322530..b61239e924 100644 --- a/cocos2dx/include/ccMacros.h +++ b/cocos2dx/include/ccMacros.h @@ -203,5 +203,48 @@ default gl blend src function. Compatible with premultiplied alpha images. TypeName(const TypeName&);\ void operator=(const TypeName&) +/** +@since v0.99.5 +@todo upto-0.99.5 check the code for retina +*/ +#if CC_IS_RETINA_DISPLAY_SUPPORTED + +/****************************/ +/** RETINA DISPLAY ENABLED **/ +/****************************/ + +/** @def CC_CONTENT_SCALE_FACTOR +On Mac it returns 1; +On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1 +*/ +#include "Platforms/iOS/CCDirectorIOS.h" +#define CC_CONTENT_SCALE_FACTOR() __ccContentScaleFactor + + +/** @def CC_RECT_PIXELS_TO_POINTS +Converts a rect in pixels to points +*/ +#define CC_RECT_PIXELS_TO_POINTS(__pixels__) \ + CGRectMake( (__pixels__).origin.x / CC_CONTENT_SCALE_FACTOR(), (__pixels__).origin.y / CC_CONTENT_SCALE_FACTOR(), \ + (__pixels__).size.width / CC_CONTENT_SCALE_FACTOR(), (__pixels__).size.height / CC_CONTENT_SCALE_FACTOR() ) + +/** @def CC_RECT_POINTS_TO_PIXELS +Converts a rect in points to pixels +*/ +#define CC_RECT_POINTS_TO_PIXELS(__points__) \ + CGRectMake( (__points__).origin.x * CC_CONTENT_SCALE_FACTOR(), (__points__).origin.y * CC_CONTENT_SCALE_FACTOR(), \ + (__points__).size.width * CC_CONTENT_SCALE_FACTOR(), (__points__).size.height * CC_CONTENT_SCALE_FACTOR() ) + +#else // retina disabled + +/*****************************/ +/** RETINA DISPLAY DISABLED **/ +/*****************************/ + +#define CC_CONTENT_SCALE_FACTOR() 1 +#define CC_RECT_PIXELS_TO_POINTS(__pixels__) __pixels__ +#define CC_RECT_POINTS_TO_PIXELS(__points__) __points__ + +#endif #endif // __CCMACROS_H__ From d6fb20986105203474ebac88436f213b14dc2c49 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 24 Dec 2010 15:21:57 +0800 Subject: [PATCH 5/5] merged from minggo-upto-0.995 to upto-0.99.5 --- cocos2dx/include/CCNode.h | 840 ++++++------- cocos2dx/include/ccMacros.h | 90 +- .../CCNode.cpp => platform/CCNode_mobile.cpp} | 185 ++- cocos2dx/platform/mac/CCNode_mac.cpp | 1084 +++++++++++++++++ cocos2dx/proj.uphone/cocos2d-uphone.vcproj | 8 +- 5 files changed, 1734 insertions(+), 473 deletions(-) rename cocos2dx/{base_nodes/CCNode.cpp => platform/CCNode_mobile.cpp} (81%) create mode 100644 cocos2dx/platform/mac/CCNode_mac.cpp diff --git a/cocos2dx/include/CCNode.h b/cocos2dx/include/CCNode.h index 6412ba46be..86f260d5cc 100644 --- a/cocos2dx/include/CCNode.h +++ b/cocos2dx/include/CCNode.h @@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#ifndef __CCNODE_H__ -#define __CCNODE_H__ +#ifndef __PLATFOMR_CCNODE_H__ +#define __PLATFOMR_CCNODE_H__ +#include "config_platform.h" #include "CCXCocos2dDefine.h" #include "ccMacros.h" #include "CGAffineTransform.h" @@ -33,485 +34,504 @@ THE SOFTWARE. #include "ccxCommon.h" #include "selector_protocol.h" -#include +#include "CCGL.h" namespace cocos2d { -class CCCamera; -class CCGridBase; -class CGPoint; -class CCTouch; -class CCAction; -class CCRGBAProtocol; -class CCLabelProtocol; + class CCCamera; + class CCGridBase; + class CGPoint; + class CCTouch; + class CCAction; + class CCRGBAProtocol; + class CCLabelProtocol; -enum { - kCCNodeTagInvalid = -1, -}; + enum { + kCCNodeTagInvalid = -1, + }; -/** @brief CCNode is the main element. Anything thats gets drawn or contains things that get drawn is a CCNode. -The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu. + /** @brief CCNode is the main element. Anything thats gets drawn or contains things that get drawn is a CCNode. + The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu. -The main features of a CCNode are: -- They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc) -- They can schedule periodic callback (schedule, unschedule, etc) -- They can execute actions (runAction, stopAction, etc) + The main features of a CCNode are: + - They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc) + - They can schedule periodic callback (schedule, unschedule, etc) + - They can execute actions (runAction, stopAction, etc) -Some CCNode nodes provide extra functionality for them or their children. + Some CCNode nodes provide extra functionality for them or their children. -Subclassing a CCNode usually means (one/all) of: -- overriding init to initialize resources and schedule callbacks -- create callbacks to handle the advancement of time -- overriding draw to render the node + Subclassing a CCNode usually means (one/all) of: + - overriding init to initialize resources and schedule callbacks + - create callbacks to handle the advancement of time + - overriding draw to render the node -Features of CCNode: -- position -- scale (x, y) -- rotation (in degrees, clockwise) -- CCCamera (an interface to gluLookAt ) -- CCGridBase (to do mesh transformations) -- anchor point -- size -- visible -- z-order -- openGL z position + Features of CCNode: + - position + - scale (x, y) + - rotation (in degrees, clockwise) + - CCCamera (an interface to gluLookAt ) + - CCGridBase (to do mesh transformations) + - anchor point + - size + - visible + - z-order + - openGL z position -Default values: -- rotation: 0 -- position: (x=0,y=0) -- scale: (x=1,y=1) -- contentSize: (x=0,y=0) -- anchorPoint: (x=0,y=0) + Default values: + - rotation: 0 + - position: (x=0,y=0) + - scale: (x=1,y=1) + - contentSize: (x=0,y=0) + - anchorPoint: (x=0,y=0) -Limitations: -- A CCNode is a "void" object. It doesn't have a texture + Limitations: + - A CCNode is a "void" object. It doesn't have a texture -Order in transformations with grid disabled --# The node will be translated (position) --# The node will be rotated (rotation) --# The node will be scaled (scale) --# The node will be moved according to the camera values (camera) + Order in transformations with grid disabled + -# The node will be translated (position) + -# The node will be rotated (rotation) + -# The node will be scaled (scale) + -# The node will be moved according to the camera values (camera) -Order in transformations with grid enabled --# The node will be translated (position) --# The node will be rotated (rotation) --# The node will be scaled (scale) --# The grid will capture the screen --# The node will be moved according to the camera values (camera) --# The grid will render the captured screen + Order in transformations with grid enabled + -# The node will be translated (position) + -# The node will be rotated (rotation) + -# The node will be scaled (scale) + -# The grid will capture the screen + -# The node will be moved according to the camera values (camera) + -# The grid will render the captured screen -Camera: -- Each node has a camera. By default it points to the center of the CCNode. -*/ + Camera: + - Each node has a camera. By default it points to the center of the CCNode. + */ -class CCX_DLL CCNode : public SelectorProtocol, public NSObject -{ + class CCX_DLL CCNode : public SelectorProtocol, public NSObject + { - // variable property + // variable property - /** The z order of the node relative to it's "brothers": children of the same parent */ - CCX_PROPERTY_READONLY(int, m_nZOrder, ZOrder) + /** The z order of the node relative to it's "brothers": children of the same parent */ + CCX_PROPERTY_READONLY(int, m_nZOrder, ZOrder) - /** The real openGL Z vertex. - Differences between openGL Z vertex and cocos2d Z order: - - OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children - - OpenGL Z might require to set 2D projection - - cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0 - @warning: Use it at your own risk since it might break the cocos2d parent-children z order - @since v0.8 - */ - CCX_PROPERTY(float, m_fVertexZ, VertexZ) + /** The real openGL Z vertex. + Differences between openGL Z vertex and cocos2d Z order: + - OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children + - OpenGL Z might require to set 2D projection + - cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0 + @warning: Use it at your own risk since it might break the cocos2d parent-children z order + @since v0.8 + */ + CCX_PROPERTY(float, m_fVertexZ, VertexZ) - /** The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW. */ - CCX_PROPERTY(float, m_fRotation, Rotation) + /** The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW. */ + CCX_PROPERTY(float, m_fRotation, Rotation) - /** Get the scale factor of the node. - @warning: Assert when m_fScaleX != m_fScaleY. - */ - float getScale(); - /** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */ - void setScale(float scale); + /** Get the scale factor of the node. + @warning: Assert when m_fScaleX != m_fScaleY. + */ + float getScale(); + /** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */ + void setScale(float scale); - /** The scale factor of the node. 1.0 is the default scale factor. It only modifies the X scale factor. */ - CCX_PROPERTY(float, m_fScaleX, ScaleX) + /** The scale factor of the node. 1.0 is the default scale factor. It only modifies the X scale factor. */ + CCX_PROPERTY(float, m_fScaleX, ScaleX) - /** The scale factor of the node. 1.0 is the default scale factor. It only modifies the Y scale factor. */ - CCX_PROPERTY(float, m_fScaleY, ScaleY) + /** The scale factor of the node. 1.0 is the default scale factor. It only modifies the Y scale factor. */ + CCX_PROPERTY(float, m_fScaleY, ScaleY) - /** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */ - CCX_PROPERTY(CGPoint, m_tPosition, Position) + /** Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner. */ + CCX_PROPERTY(CGPoint, m_tPosition, Position) + CCX_PROPERTY(CGPoint, m_tPositionInPixels, PositionInPixels) - CCX_PROPERTY_READONLY(NSMutableArray *, m_pChildren, Children) + CCX_PROPERTY_READONLY(NSMutableArray *, m_pChildren, Children) - /** A CCCamera object that lets you move the node using a gluLookAt - */ - CCX_PROPERTY_READONLY(CCCamera *, m_pCamera, Camera) + /** A CCCamera object that lets you move the node using a gluLookAt + */ + CCX_PROPERTY_READONLY(CCCamera *, m_pCamera, Camera) - /** A CCGrid object that is used when applying effects */ - CCX_PROPERTY(CCGridBase *, m_pGrid, Grid) + /** A CCGrid object that is used when applying effects */ + CCX_PROPERTY(CCGridBase *, m_pGrid, Grid) - /** Whether of not the node is visible. Default is true */ - CCX_PROPERTY(bool, m_bIsVisible, IsVisible) + /** Whether of not the node is visible. Default is true */ + CCX_PROPERTY(bool, m_bIsVisible, IsVisible) - /** anchorPoint is the point around which all transformations and positioning manipulations take place. - It's like a pin in the node where it is "attached" to its parent. - The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. - But you can use values higher than (1,1) and lower than (0,0) too. - The default anchorPoint is (0.5,0.5), so it starts in the center of the node. - @since v0.8 - */ - CCX_PROPERTY(CGPoint, m_tAnchorPoint, AnchorPoint) + /** anchorPoint is the point around which all transformations and positioning manipulations take place. + It's like a pin in the node where it is "attached" to its parent. + The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. + But you can use values higher than (1,1) and lower than (0,0) too. + The default anchorPoint is (0.5,0.5), so it starts in the center of the node. + @since v0.8 + */ + CCX_PROPERTY(CGPoint, m_tAnchorPoint, AnchorPoint) - /** The anchorPoint in absolute pixels. - Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead - */ - CCX_PROPERTY_READONLY(CGPoint, m_tAnchorPointInPixels, AnchorPointInPixels) - - /** The untransformed size of the node. - The contentSize remains the same no matter the node is scaled or rotated. - All nodes has a size. Layer and Scene has the same size of the screen. - @since v0.8 - */ - CCX_PROPERTY(CGSize, m_tContentSize, ContentSize) + /** The anchorPoint in absolute pixels. + Since v0.8 you can only read it. If you wish to modify it, use anchorPoint instead + */ + CCX_PROPERTY_READONLY(CGPoint, m_tAnchorPointInPixels, AnchorPointInPixels) - /** whether or not the node is running */ - CCX_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning) + /** The untransformed size of the node. + The contentSize remains the same no matter the node is scaled or rotated. + All nodes has a size. Layer and Scene has the same size of the screen. + @since v0.8 + */ + CCX_PROPERTY(CGSize, m_tContentSize, ContentSize) - /** A weak reference to the parent */ - CCX_PROPERTY(CCNode *, m_pParent, Parent) + /** The untransformed size of the node in Pixels + The contentSize remains the same no matter the node is scaled or rotated. + All nodes has a size. Layer and Scene has the same size of the screen. + @since v0.8 + */ + CCX_PROPERTY(CGSize, m_tContentSizeInPixels, ContentSizeInPixels) - /** If true the transformtions will be relative to it's anchor point. - * Sprites, Labels and any other sizeble object use it have it enabled by default. - * Scenes, Layers and other "whole screen" object don't use it, have it disabled by default. - */ - CCX_PROPERTY(bool, m_bIsRelativeAnchorPoint, IsRelativeAnchorPoint) + /** whether or not the node is running */ + CCX_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning) - /** A tag used to identify the node easily */ - CCX_PROPERTY(int, m_nTag, Tag) + /** A weak reference to the parent */ + CCX_PROPERTY(CCNode *, m_pParent, Parent) - /** A custom user data pointer */ - CCX_PROPERTY(void *, m_pUserData, UserData) - -protected: + /** If true the transformtions will be relative to it's anchor point. + * Sprites, Labels and any other sizeble object use it have it enabled by default. + * Scenes, Layers and other "whole screen" object don't use it, have it disabled by default. + */ + CCX_PROPERTY(bool, m_bIsRelativeAnchorPoint, IsRelativeAnchorPoint) - // transform - CGAffineTransform m_tTransform, m_tInverse; + /** A tag used to identify the node easily */ + CCX_PROPERTY(int, m_nTag, Tag) + + /** A custom user data pointer */ + CCX_PROPERTY(void *, m_pUserData, UserData) + + protected: + + // transform + CGAffineTransform m_tTransform, m_tInverse; #ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX - GLfloat m_pTransformGL[16]; + GLfloat m_pTransformGL[16]; #endif - // To reduce memory, place bools that are not properties here: - bool m_bIsTransformDirty; - bool m_bIsInverseDirty; + // To reduce memory, place bools that are not properties here: + bool m_bIsTransformDirty; + bool m_bIsInverseDirty; #ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX - bool m_bIsTransformGLDirty; + bool m_bIsTransformGLDirty; #endif - -private: - //! lazy allocs - void childrenAlloc(void); + private: - //! helper that reorder a child - void insertChild(CCNode* child, int z); + //! lazy allocs + void childrenAlloc(void); - //! used internally to alter the zOrder variable. DON'T call this method manually - void setZOrder(int z); + //! helper that reorder a child + void insertChild(CCNode* child, int z); - void detachChild(CCNode *child, bool doCleanup); + //! used internally to alter the zOrder variable. DON'T call this method manually + void setZOrder(int z); - typedef void (CCNode::*callbackFunc)(void); + void detachChild(CCNode *child, bool doCleanup); - void arrayMakeObjectsPerformSelector(NSMutableArray * pArray, callbackFunc func); + typedef void (CCNode::*callbackFunc)(void); - CGPoint convertToWindowSpace(CGPoint nodePoint); + void arrayMakeObjectsPerformSelector(NSMutableArray * pArray, callbackFunc func); -public: + CGPoint convertToWindowSpace(CGPoint nodePoint); - CCNode(); + public: - virtual ~CCNode(); + CCNode(); - char * description(void); + virtual ~CCNode(); - /** allocates and initializes a node. - The node will be created as "autorelease". - */ - static CCNode * node(void); + char * description(void); - //scene managment + /** allocates and initializes a node. + The node will be created as "autorelease". + */ + static CCNode * node(void); - /** callback that is called every time the CCNode enters the 'stage'. - If the CCNode enters the 'stage' with a transition, this callback is called when the transition starts. - During onEnter you can't a "sister/brother" node. - */ - virtual void onEnter(); + //scene managment - /** callback that is called when the CCNode enters in the 'stage'. - If the CCNode enters the 'stage' with a transition, this callback is called when the transition finishes. - @since v0.8 - */ - virtual void onEnterTransitionDidFinish(); + /** callback that is called every time the CCNode enters the 'stage'. + If the CCNode enters the 'stage' with a transition, this callback is called when the transition starts. + During onEnter you can't a "sister/brother" node. + */ + virtual void onEnter(); - /** callback that is called every time the CCNode leaves the 'stage'. - If the CCNode leaves the 'stage' with a transition, this callback is called when the transition finishes. - During onExit you can't a "sister/brother" node. - */ - virtual void onExit(); + /** callback that is called when the CCNode enters in the 'stage'. + If the CCNode enters the 'stage' with a transition, this callback is called when the transition finishes. + @since v0.8 + */ + virtual void onEnterTransitionDidFinish(); - // composition: ADD + /** callback that is called every time the CCNode leaves the 'stage'. + If the CCNode leaves the 'stage' with a transition, this callback is called when the transition finishes. + During onExit you can't a "sister/brother" node. + */ + virtual void onExit(); - /** Adds a child to the container with z-order as 0. - It returns self, so you can chain several addChilds. - @since v0.7.1 - */ - virtual CCNode * addChild(CCNode * child); + // composition: ADD - /** Adds a child to the container with a z-order - It returns self, so you can chain several addChilds. - @since v0.7.1 - */ - virtual CCNode * addChild(CCNode * child, int zOrder); + /** Adds a child to the container with z-order as 0. + If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. + @since v0.7.1 + */ + virtual void addChild(CCNode * child); - /** Adds a child to the container with z order and tag - It returns self, so you can chain several addChilds. - @since v0.7.1 - */ - virtual CCNode * addChild(CCNode * child, int zOrder, int tag); + /** Adds a child to the container with a z-order + If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. + @since v0.7.1 + */ + virtual void addChild(CCNode * child, int zOrder); - // composition: REMOVE + /** Adds a child to the container with z order and tag + If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. + @since v0.7.1 + */ + virtual void addChild(CCNode * child, int zOrder, int tag); - /** Remove itself from its parent node. If cleanup is true, then also remove all actions and callbacks. - If the node orphan, then nothing happens. - @since v0.99.3 - */ - void removeFromParentAndCleanup(bool cleanup); + // composition: REMOVE - /** Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. - @since v0.7.1 - */ - virtual void removeChild(CCNode* child, bool cleanup); + /** Remove itself from its parent node. If cleanup is true, then also remove all actions and callbacks. + If the node orphan, then nothing happens. + @since v0.99.3 + */ + void removeFromParentAndCleanup(bool cleanup); - /** Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter - @since v0.7.1 - */ - void removeChildByTag(int tag, bool cleanup); + /** Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. + @since v0.7.1 + */ + virtual void removeChild(CCNode* child, bool cleanup); - /** Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. - @since v0.7.1 - */ - virtual void removeAllChildrenWithCleanup(bool cleanup); + /** Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter + @since v0.7.1 + */ + void removeChildByTag(int tag, bool cleanup); - // composition: GET - /** Gets a child from the container given its tag - @return returns a CCNode object - @since v0.7.1 - */ - CCNode * getChildByTag(int tag); + /** Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. + @since v0.7.1 + */ + virtual void removeAllChildrenWithCleanup(bool cleanup); - /** Reorders a child according to a new z value. - * The child MUST be already added. - */ - virtual void reorderChild(CCNode * child, int zOrder); + // composition: GET + /** Gets a child from the container given its tag + @return returns a CCNode object + @since v0.7.1 + */ + CCNode * getChildByTag(int tag); - /** Stops all running actions and schedulers - @since v0.8 - */ - virtual void cleanup(void); + /** Reorders a child according to a new z value. + * The child MUST be already added. + */ + virtual void reorderChild(CCNode * child, int zOrder); - // draw + /** Stops all running actions and schedulers + @since v0.8 + */ + virtual void cleanup(void); - /** Override this method to draw your own node. - The following GL states will be enabled by default: - - glEnableClientState(GL_VERTEX_ARRAY); - - glEnableClientState(GL_COLOR_ARRAY); - - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - glEnable(GL_TEXTURE_2D); - - AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE - - But if you enable any other GL state, you should disable it after drawing your node. - */ - virtual void draw(void); - - /** recursive method that visit its children and draw them */ - virtual void visit(void); - - // transformations - - /** performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */ - void transform(void); - - /** performs OpenGL view-matrix transformation of it's ancestors. - Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO) - it's necessary to transform the ancestors again. - @since v0.7.2 - */ - void transformAncestors(void); - - /** returns a "local" axis aligned bounding box of the node. - The returned box is relative only to its parent. - - @since v0.8.2 - */ - CGRect boundingBox(void); - - // actions - - /** Executes an action, and returns the action that is executed. - The node becomes the action's target. - @warning Starting from v0.8 actions don't retain their target anymore. - @since v0.7.1 - @return An Action pointer - */ - - CCAction* runAction(CCAction* action); - - /** Removes all actions from the running action list */ - void stopAllActions(void); - - /** Removes an action from the running action list */ - void stopAction(CCAction* action); - - /** Removes an action from the running action list given its tag - @since v0.7.1 - */ - void stopActionByTag(int tag); - - /** Gets an action from the running action list given its tag - @since v0.7.1 - @return the Action the with the given tag - */ - CCAction* getActionByTag(int tag); - - /** Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays). - * Composable actions are counted as 1 action. Example: - * If you are running 1 Sequence of 7 actions, it will return 1. - * If you are running 7 Sequences of 2 actions, it will return 7. - */ - int numberOfRunningActions(void); - - - // timers - - /** check whether a selector is scheduled. */ - bool isScheduled(SEL_SCHEDULE selector); - - /** schedules the "update" method. It will use the order number 0. This method will be called every frame. - Scheduled methods with a lower order value will be called before the ones that have a higher order value. - Only one "update" method could be scheduled per node. - - @since v0.99.3 - */ - void scheduleUpdate(void); - - /** schedules the "update" selector with a custom priority. This selector will be called every frame. - Scheduled selectors with a lower priority will be called before the ones that have a higher value. - Only one "update" selector could be scheduled per node (You can't have 2 'update' selectors). - - @since v0.99.3 - */ - void scheduleUpdateWithPriority(int priority); - - /* unschedules the "update" method. - - @since v0.99.3 - */ - void unscheduleUpdate(void); - - /** schedules a selector. - The scheduled selector will be ticked every frame - */ - void schedule(SEL_SCHEDULE selector); - - /** schedules a custom selector with an interval time in seconds. - If time is 0 it will be ticked every frame. - If time is 0, it is recommended to use 'scheduleUpdate' instead. - If the selector is already scheduled, then the interval parameter - will be updated without scheduling it again. - */ - void schedule(SEL_SCHEDULE selector, ccTime interval); - - /** unschedules a custom selector.*/ - void unschedule(SEL_SCHEDULE selector); - - /** unschedule all scheduled selectors: custom selectors, and the 'update' selector. - Actions are not affected by this method. - @since v0.99.3 - */ - void unscheduleAllSelectors(void); - - /** resumes all scheduled selectors and actions. - Called internally by onEnter - */ - void resumeSchedulerAndActions(void); - /** pauses all scheduled selectors and actions. - Called internally by onExit - */ - void pauseSchedulerAndActions(void); - - // SelecterProtocol methods - - virtual void selectorProtocolRetain(void); - virtual void selectorProtocolRelease(void); - - virtual CCRGBAProtocol* convertToRGBAProtocol(void) { return NULL; } - virtual CCLabelProtocol* convertToLabelProtocol(void) { return NULL; } - - // transformation methods - - /** Returns the local affine transform matrix - @since v0.7.1 - */ - CGAffineTransform nodeToParentTransform(void); - - /** Returns the inverse local affine transform matrix - @since v0.7.1 - */ - CGAffineTransform parentToNodeTransform(void); - - /** Retrusn the world affine transform matrix - @since v0.7.1 - */ - CGAffineTransform nodeToWorldTransform(void); - - /** Returns the inverse world affine transform matrix - @since v0.7.1 - */ - CGAffineTransform worldToNodeTransform(void); - - /** converts a world coordinate to local coordinate - @since v0.7.1 - */ - CGPoint convertToNodeSpace(CGPoint worldPoint); - /** converts local coordinate to world space - @since v0.7.1 - */ - CGPoint convertToWorldSpace(CGPoint nodePoint); - /** converts a world coordinate to local coordinate - treating the returned/received node point as anchor relative - @since v0.7.1 - */ - CGPoint convertToNodeSpaceAR(CGPoint worldPoint); - /** converts local coordinate to world space - treating the returned/received node point as anchor relative - @since v0.7.1 - */ - CGPoint convertToWorldSpaceAR(CGPoint nodePoint); - /** convenience methods which take a CCTouch instead of CGPoint - @since v0.7.1 - */ - CGPoint convertTouchToNodeSpace(CCTouch * touch); - - /** converts a CCTouch (world coordinates) into a local coordiante. This method is AR (Anchor Relative). - @since v0.7.1 - */ - CGPoint convertTouchToNodeSpaceAR(CCTouch * touch); - -}; + // draw + + /** Override this method to draw your own node. + The following GL states will be enabled by default: + - glEnableClientState(GL_VERTEX_ARRAY); + - glEnableClientState(GL_COLOR_ARRAY); + - glEnableClientState(GL_TEXTURE_COORD_ARRAY); + - glEnable(GL_TEXTURE_2D); + + AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE + + But if you enable any other GL state, you should disable it after drawing your node. + */ + virtual void draw(void); + + /** recursive method that visit its children and draw them */ + virtual void visit(void); + + // transformations + + /** performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */ + void transform(void); + + /** performs OpenGL view-matrix transformation of it's ancestors. + Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO) + it's necessary to transform the ancestors again. + @since v0.7.2 + */ + void transformAncestors(void); + + /** returns a "local" axis aligned bounding box of the node. + The returned box is relative only to its parent. + + @since v0.8.2 + */ + CGRect boundingBox(void); + + /** returns a "local" axis aligned bounding box of the node in pixels. + The returned box is relative only to its parent. + The returned box is in Points. + + @since v0.99.5 + */ + CGRect boundingBoxInPixels(void); + + // actions + + /** Executes an action, and returns the action that is executed. + The node becomes the action's target. + @warning Starting from v0.8 actions don't retain their target anymore. + @since v0.7.1 + @return An Action pointer + */ + + CCAction* runAction(CCAction* action); + + /** Removes all actions from the running action list */ + void stopAllActions(void); + + /** Removes an action from the running action list */ + void stopAction(CCAction* action); + + /** Removes an action from the running action list given its tag + @since v0.7.1 + */ + void stopActionByTag(int tag); + + /** Gets an action from the running action list given its tag + @since v0.7.1 + @return the Action the with the given tag + */ + CCAction* getActionByTag(int tag); + + /** Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays). + * Composable actions are counted as 1 action. Example: + * If you are running 1 Sequence of 7 actions, it will return 1. + * If you are running 7 Sequences of 2 actions, it will return 7. + */ + int numberOfRunningActions(void); + + + // timers + + /** check whether a selector is scheduled. */ + bool isScheduled(SEL_SCHEDULE selector); + + /** schedules the "update" method. It will use the order number 0. This method will be called every frame. + Scheduled methods with a lower order value will be called before the ones that have a higher order value. + Only one "update" method could be scheduled per node. + + @since v0.99.3 + */ + void scheduleUpdate(void); + + /** schedules the "update" selector with a custom priority. This selector will be called every frame. + Scheduled selectors with a lower priority will be called before the ones that have a higher value. + Only one "update" selector could be scheduled per node (You can't have 2 'update' selectors). + + @since v0.99.3 + */ + void scheduleUpdateWithPriority(int priority); + + /* unschedules the "update" method. + + @since v0.99.3 + */ + void unscheduleUpdate(void); + + /** schedules a selector. + The scheduled selector will be ticked every frame + */ + void schedule(SEL_SCHEDULE selector); + + /** schedules a custom selector with an interval time in seconds. + If time is 0 it will be ticked every frame. + If time is 0, it is recommended to use 'scheduleUpdate' instead. + If the selector is already scheduled, then the interval parameter + will be updated without scheduling it again. + */ + void schedule(SEL_SCHEDULE selector, ccTime interval); + + /** unschedules a custom selector.*/ + void unschedule(SEL_SCHEDULE selector); + + /** unschedule all scheduled selectors: custom selectors, and the 'update' selector. + Actions are not affected by this method. + @since v0.99.3 + */ + void unscheduleAllSelectors(void); + + /** resumes all scheduled selectors and actions. + Called internally by onEnter + */ + void resumeSchedulerAndActions(void); + /** pauses all scheduled selectors and actions. + Called internally by onExit + */ + void pauseSchedulerAndActions(void); + + // SelecterProtocol methods + + virtual void selectorProtocolRetain(void); + virtual void selectorProtocolRelease(void); + + virtual CCRGBAProtocol* convertToRGBAProtocol(void) { return NULL; } + virtual CCLabelProtocol* convertToLabelProtocol(void) { return NULL; } + + // transformation methods + + /** Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates. + The matrix is in Pixels. + @since v0.7.1 + */ + CGAffineTransform nodeToParentTransform(void); + + /** Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates. + The matrix is in Pixels. + @since v0.7.1 + */ + CGAffineTransform parentToNodeTransform(void); + + /** Retrusn the world affine transform matrix. The matrix is in Pixels. + @since v0.7.1 + */ + CGAffineTransform nodeToWorldTransform(void); + + /** Returns the inverse world affine transform matrix. The matrix is in Pixels. + @since v0.7.1 + */ + CGAffineTransform worldToNodeTransform(void); + + /** Converts a Point to node (local) space coordinates. The result is in Points. + @since v0.7.1 + */ + CGPoint convertToNodeSpace(CGPoint worldPoint); + /** Converts a Point to world space coordinates. The result is in Points. + @since v0.7.1 + */ + CGPoint convertToWorldSpace(CGPoint nodePoint); + /** Converts a Point to node (local) space coordinates. The result is in Points. + treating the returned/received node point as anchor relative. + @since v0.7.1 + */ + CGPoint convertToNodeSpaceAR(CGPoint worldPoint); + /** Converts a local Point to world space coordinates.The result is in Points. + treating the returned/received node point as anchor relative. + @since v0.7.1 + */ + CGPoint convertToWorldSpaceAR(CGPoint nodePoint); + + /** convenience methods which take a CCTouch instead of CGPoint + @since v0.7.1 + */ + CGPoint convertTouchToNodeSpace(CCTouch * touch); + + /** converts a CCTouch (world coordinates) into a local coordiante. This method is AR (Anchor Relative). + @since v0.7.1 + */ + CGPoint convertTouchToNodeSpaceAR(CCTouch * touch); + + }; }//namespace cocos2d -#endif // __CCNODE_H__ +#endif // __PLATFOMR_CCNODE_H__ + - diff --git a/cocos2dx/include/ccMacros.h b/cocos2dx/include/ccMacros.h index b61239e924..ac7fcf2b6e 100644 --- a/cocos2dx/include/ccMacros.h +++ b/cocos2dx/include/ccMacros.h @@ -101,7 +101,13 @@ simple macro that swaps 2 variables /** @def CC_BLEND_SRC default gl blend src function. Compatible with premultiplied alpha images. */ -#define CC_BLEND_SRC GL_ONE +#if CC_OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA + #define CC_BLEND_SRC GL_ONE + #define CC_BLEND_DST GL_ONE_MINUS_SRC_ALPHA +#else + #define CC_BLEND_SRC GL_SRC_ALPHA + #define CC_BLEND_DST GL_ONE_MINUS_SRC_ALPHA +#endif // ! CC_OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA /** @def CC_BLEND_DST default gl blend dst function. Compatible with premultiplied alpha images. @@ -156,24 +162,29 @@ default gl blend src function. Compatible with premultiplied alpha images. //---- todo: replace with uphone window - -// #define CC_DIRECTOR_INIT() \ -// do { \ -// window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; \ -// if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] ) \ -// [CCDirector setDirectorType:kCCDirectorTypeNSTimer]; \ -// CCDirector *__director = [CCDirector sharedDirector]; \ -// [__director setDeviceOrientation:kCCDeviceOrientationPortrait]; \ -// [__director setDisplayFPS:NO]; \ -// [__director setAnimationInterval:1.0/60]; \ -// EAGLView *__glView = [EAGLView viewWithFrame:[window bounds] \ -// pixelFormat:kEAGLColorFormatRGB565 \ -// depthFormat:0 GL_DEPTH_COMPONENT24_OES \ -// preserveBackbuffer:NO]; \ -// [__director setOpenGLView:__glView]; \ -// [window addSubview:__glView]; \ -// [window makeKeyAndVisible]; \ -// } while(0) +/* +#define CC_DIRECTOR_INIT() \ +do { \ + window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; \ + if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] ) \ + [CCDirector setDirectorType:kCCDirectorTypeNSTimer]; \ + CCDirector *__director = [CCDirector sharedDirector]; \ + [__director setDeviceOrientation:kCCDeviceOrientationPortrait]; \ + [__director setDisplayFPS:NO]; \ + [__director setAnimationInterval:1.0/60]; \ + EAGLView *__glView = [EAGLView viewWithFrame:[window bounds] \ + pixelFormat:kEAGLColorFormatRGB565 \ + depthFormat:0 \ + preserveBackbuffer:NO \ + sharegroup:nil \ + multiSampling:NO \ + numberOfSamples:0 \ + ]; \ + [__director setOpenGLView:__glView]; \ + [window addSubview:__glView]; \ + [window makeKeyAndVisible]; \ +} while(0) +*/ /** @def CC_DIRECTOR_END @@ -189,11 +200,50 @@ default gl blend src function. Compatible with premultiplied alpha images. // #define CC_DIRECTOR_END() \ // do { \ // CCDirector *__director = [CCDirector sharedDirector]; \ -// EAGLView *__view = [__director openGLView]; \ +// CC_GLVIEW *__view = [__director openGLView]; \ // [__view removeFromSuperview]; \ // [__director end]; \ // } while(0) +#if CC_IS_RETINA_DISPLAY_SUPPORTED + +/****************************/ +/** RETINA DISPLAY ENABLED **/ +/****************************/ + +/** @def CC_CONTENT_SCALE_FACTOR +On Mac it returns 1; +On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1 +*/ +#import "Platforms/iOS/CCDirectorIOS.h" +#define CC_CONTENT_SCALE_FACTOR() __ccContentScaleFactor + + +/** @def CC_RECT_PIXELS_TO_POINTS +Converts a rect in pixels to points +*/ +#define CC_RECT_PIXELS_TO_POINTS(__pixels__) \ + CGRectMake( (__pixels__).origin.x / CC_CONTENT_SCALE_FACTOR(), (__pixels__).origin.y / CC_CONTENT_SCALE_FACTOR(), \ + (__pixels__).size.width / CC_CONTENT_SCALE_FACTOR(), (__pixels__).size.height / CC_CONTENT_SCALE_FACTOR() ) + +/** @def CC_RECT_POINTS_TO_PIXELS +Converts a rect in points to pixels +*/ +#define CC_RECT_POINTS_TO_PIXELS(__points__) \ + CGRectMake( (__points__).origin.x * CC_CONTENT_SCALE_FACTOR(), (__points__).origin.y * CC_CONTENT_SCALE_FACTOR(), \ + (__points__).size.width * CC_CONTENT_SCALE_FACTOR(), (__points__).size.height * CC_CONTENT_SCALE_FACTOR() ) + +#else // retina disabled + +/*****************************/ +/** RETINA DISPLAY DISABLED **/ +/*****************************/ + +#define CC_CONTENT_SCALE_FACTOR() 1 +#define CC_RECT_PIXELS_TO_POINTS(__pixels__) __pixels__ +#define CC_RECT_POINTS_TO_PIXELS(__points__) __points__ + +#endif // CC_IS_RETINA_DISPLAY_SUPPORTED #ifndef FLT_EPSILON #define FLT_EPSILON 1.192092896e-07F diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/platform/CCNode_mobile.cpp similarity index 81% rename from cocos2dx/base_nodes/CCNode.cpp rename to cocos2dx/platform/CCNode_mobile.cpp index e1328a6b3e..757d1c0613 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/platform/CCNode_mobile.cpp @@ -46,9 +46,11 @@ CCNode::CCNode(void) ,m_fScaleX(1.0f) ,m_fScaleY(1.0f) ,m_tPosition(CGPointZero) +,m_tPositionInPixels(CGPointZero) ,m_tAnchorPointInPixels(CGPointZero) ,m_tAnchorPoint(CGPointZero) ,m_tContentSize(CGSizeZero) +,m_tContentSizeInPixels(CGSizeZero) // "whole screen" objects. like Scenes and Layers, should set isRelativeAnchorPoint to false ,m_bIsRelativeAnchorPoint(true) ,m_bIsTransformDirty(true) @@ -139,7 +141,7 @@ float CCNode::getVertexZ() /// vertexZ setter void CCNode::setVertexZ(float var) { - m_fVertexZ = var; + m_fVertexZ = var * CC_CONTENT_SCALE_FACTOR(); } @@ -219,12 +221,41 @@ CGPoint CCNode::getPosition() void CCNode::setPosition(CGPoint newPosition) { m_tPosition = newPosition; + if (CC_CONTENT_SCALE_FACTOR() == 1) + { + m_tAnchorPointInPixels = m_tPosition; + } + else + { + m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); + } + m_bIsTransformDirty = m_bIsInverseDirty = true; #ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX m_bIsTransformGLDirty = true; #endif } +void CCNode::setPositionInPixels(CGPoint newPosition) +{ + m_tAnchorPointInPixels = newPosition; + + if ( CC_CONTENT_SCALE_FACTOR() == 1) + { + m_tPosition = m_tAnchorPointInPixels; + } + else + { + m_tPosition = ccpMult(newPosition, 1/CC_CONTENT_SCALE_FACTOR()); + } + + m_bIsTransformDirty = m_bIsInverseDirty = true; + +#if CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX +} + /// children getter NSMutableArray * CCNode::getChildren() { @@ -282,7 +313,7 @@ void CCNode::setAnchorPoint(CGPoint point) if( ! CGPoint::CGPointEqualToPoint(point, m_tAnchorPoint) ) { m_tAnchorPoint = point; - this->m_tAnchorPointInPixels = ccp( m_tContentSize.width * m_tAnchorPoint.x, m_tContentSize.height * m_tAnchorPoint.y ); + m_tAnchorPointInPixels = ccp( m_tContentSizeInPixels.width * m_tAnchorPoint.x, m_tContentSizeInPixels.height * m_tAnchorPoint.y ); m_bIsTransformDirty = m_bIsInverseDirty = true; #ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX m_bIsTransformGLDirty = true; @@ -315,6 +346,30 @@ void CCNode::setContentSize(CGSize size) } } +void CCNode::setContentSizeInPixels(CGSize size) +{ + if (! CGSize::CGSizeEqualToSize(size, m_tContentSizeInPixels)) + { + m_tContentSizeInPixels = size; + + if (CC_CONTENT_SCALE_FACTOR() == 1) + { + m_tContentSize = m_tContentSizeInPixels; + } + else + { + m_tContentSize = CGSizeMake(size.width / CC_CONTENT_SCALE_FACTOR(), size.height / CC_CONTENT_SCALE_FACTOR()); + } + + m_tAnchorPointInPixels = ccp(m_tContentSizeInPixels.width * m_tAnchorPoint.x, m_tContentSizeInPixels.height * m_tAnchorPoint.y); + m_bIsTransformDirty = m_bIsInverseDirty = true; + +#if CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + } +} + /// isRunning getter bool CCNode::getIsRunning() @@ -376,7 +431,13 @@ void CCNode::setUserData(void *var) CGRect CCNode::boundingBox() { - CGRect rect = CGRectMake(0, 0, m_tContentSize.width, m_tContentSize.height); + CGRect ret = boundingBoxInPixels(); + return CC_RECT_PIXELS_TO_POINTS(ret); +} + +CGRect CCNode::boundingBoxInPixels() +{ + CGRect rect = CGRectMake(0, 0, m_tContentSizeInPixels.width, m_tContentSizeInPixels.height); return CGRectApplyAffineTransform(rect, nodeToParentTransform()); } @@ -435,7 +496,7 @@ CCNode* CCNode::getChildByTag(int aTag) * If a class want's to extend the 'addChild' behaviour it only needs * to override this method */ -CCNode * CCNode::addChild(CCNode *child, int zOrder, int tag) +void CCNode::addChild(CCNode *child, int zOrder, int tag) { NSAssert( child != NULL, "Argument must be non-nil"); NSAssert( child->m_pParent == NULL, "child already added. It can't be added again"); @@ -454,20 +515,20 @@ CCNode * CCNode::addChild(CCNode *child, int zOrder, int tag) if( m_bIsRunning ) { child->onEnter(); + child->onEnterTransitionDidFinish(); } - return this; } -CCNode * CCNode::addChild(CCNode *child, int zOrder) +void CCNode::addChild(CCNode *child, int zOrder) { NSAssert( child != NULL, "Argument must be non-nil"); - return this->addChild(child, zOrder, child->m_nTag); + this->addChild(child, zOrder, child->m_nTag); } -CCNode * CCNode::addChild(CCNode *child) +void CCNode::addChild(CCNode *child) { NSAssert( child != NULL, "Argument must be non-nil"); - return this->addChild(child, child->m_nZOrder, child->m_nTag); + this->addChild(child, child->m_nZOrder, child->m_nTag); } void CCNode::removeFromParentAndCleanup(bool cleanup) @@ -570,30 +631,32 @@ void CCNode::detachChild(CCNode *child, bool doCleanup) // helper used by reorderChild & add void CCNode::insertChild(CCNode* child, int z) { - int index=0; - bool added = false; + unsigned int index=0; if(m_pChildren && m_pChildren->count() > 0) { - CCNode* pNode; - NSMutableArray::NSMutableArrayIterator it; - for( it = m_pChildren->begin(); it != m_pChildren->end(); it++) + CCNode* pNode = m_pChildren->getLastObject(); + + // // quick comparison to improve performance + if (! pNode || pNode->getZOrder() <= z) { - pNode = (*it); - - if ( pNode && pNode->m_nZOrder > z ) - { - added = true; - m_pChildren->insertObjectAtIndex(child, index); - break; - } - index++; + m_pChildren->addObject(child); } - } + else + { + NSMutableArray::NSMutableArrayIterator it; + for( it = m_pChildren->begin(); it != m_pChildren->end(); it++) + { + pNode = (*it); - if( ! added ) - { - m_pChildren->addObject(child); + if ( pNode && pNode->m_nZOrder > z ) + { + m_pChildren->insertObjectAtIndex(child, index); + break; + } + index++; + } + } } child->setZOrder(z); @@ -714,14 +777,14 @@ void CCNode::transform() if( translate ) { - glTranslatef(RENDER_IN_SUBPIXEL(m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tAnchorPointInPixels.y), 0); + ccglTranslate(RENDER_IN_SUBPIXEL(m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tAnchorPointInPixels.y), 0); } m_pCamera->locate(); if( translate ) { - glTranslatef(RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); + ccglTranslate(RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); } } @@ -736,8 +799,8 @@ void CCNode::transform() glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0) - glTranslatef( RENDER_IN_SUBPIXEL(m_tPosition.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPosition.y + m_tAnchorPointInPixels.y), m_fVertexZ); - else if ( m_tPosition.x !=0 || m_tPosition.y !=0 || m_fVertexZ != 0) + glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPosition.y + m_tAnchorPointInPixels.y), m_fVertexZ); + else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0) glTranslatef( RENDER_IN_SUBPIXEL(m_tPosition.x), RENDER_IN_SUBPIXEL(m_tPosition.y), m_fVertexZ ); // rotate @@ -893,8 +956,8 @@ CGAffineTransform CCNode::nodeToParentTransform(void) if( ! m_bIsRelativeAnchorPoint && ! CGPoint::CGPointEqualToPoint(m_tAnchorPointInPixels, CGPointZero) ) m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tAnchorPointInPixels.x, m_tAnchorPointInPixels.y); - if( ! CGPoint::CGPointEqualToPoint(m_tPosition, CGPointZero) ) - m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tPosition.x, m_tPosition.y); + if( ! CGPoint::CGPointEqualToPoint(m_tPositionInPixels, CGPointZero) ) + m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tPositionInPixels.x, m_tPosition.y); if( m_fRotation != 0 ) m_tTransform = CGAffineTransformRotate(m_tTransform, -CC_DEGREES_TO_RADIANS(m_fRotation)); if( ! (m_fScaleX == 1 && m_fScaleY == 1) ) @@ -936,24 +999,68 @@ CGAffineTransform CCNode::worldToNodeTransform(void) CGPoint CCNode::convertToNodeSpace(CGPoint worldPoint) { - return CGPointApplyAffineTransform(worldPoint, this->worldToNodeTransform()); + CGPoint ret; + if(CC_CONTENT_SCALE_FACTOR() == 1) + { + ret = CGPointApplyAffineTransform(worldPoint, worldToNodeTransform()); + } + else + { + ret = ccpMult(worldPoint, CC_CONTENT_SCALE_FACTOR()); + ret = CGPointApplyAffineTransform(ret, worldToNodeTransform()); + ret = ccpMult(ret, 1/CC_CONTENT_SCALE_FACTOR()); + } + + return ret; } CGPoint CCNode::convertToWorldSpace(CGPoint nodePoint) { - return CGPointApplyAffineTransform(nodePoint, this->nodeToWorldTransform()); + CGPoint ret; + if(CC_CONTENT_SCALE_FACTOR() == 1) + { + ret = CGPointApplyAffineTransform(nodePoint, nodeToWorldTransform()); + } + else + { + ret = ccpMult( nodePoint, CC_CONTENT_SCALE_FACTOR() ); + ret = CGPointApplyAffineTransform(ret, nodeToWorldTransform()); + ret = ccpMult( ret, 1/CC_CONTENT_SCALE_FACTOR() ); + } + + return ret; } CGPoint CCNode::convertToNodeSpaceAR(CGPoint worldPoint) { - CGPoint nodePoint = this->convertToNodeSpace(worldPoint); - return ccpSub(nodePoint, m_tAnchorPointInPixels); + CGPoint nodePoint = convertToNodeSpace(worldPoint); + CGPoint anchorInPoints; + if( CC_CONTENT_SCALE_FACTOR() == 1 ) + { + anchorInPoints = m_tAnchorPointInPixels; + } + else + { + anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() ); + } + + return ccpSub(nodePoint, anchorInPoints); } CGPoint CCNode::convertToWorldSpaceAR(CGPoint nodePoint) { - nodePoint = ccpAdd(nodePoint, m_tAnchorPointInPixels); - return this->convertToWorldSpace(nodePoint); + CGPoint anchorInPoints; + if( CC_CONTENT_SCALE_FACTOR() == 1 ) + { + anchorInPoints = m_tAnchorPointInPixels; + } + else + { + anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() ); + } + + nodePoint = ccpAdd(nodePoint, anchorInPoints); + return convertToWorldSpace(nodePoint); } CGPoint CCNode::convertToWindowSpace(CGPoint nodePoint) { diff --git a/cocos2dx/platform/mac/CCNode_mac.cpp b/cocos2dx/platform/mac/CCNode_mac.cpp new file mode 100644 index 0000000000..80ad97c38a --- /dev/null +++ b/cocos2dx/platform/mac/CCNode_mac.cpp @@ -0,0 +1,1084 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +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 "CCNode.h" +#include "CCGrid.h" +#include "CGPointExtension.h" +#include "support/TransformUtils.h" +#include "CCCamera.h" +#include "effects/CCGrid.h" +#include "CCDirector.h" +#include "CCScheduler.h" +#include "CCTouch.h" +#include "CCActionManager.h" + +#if CC_COCOSNODE_RENDER_SUBPIXEL +#define RENDER_IN_SUBPIXEL +#else +#define RENDER_IN_SUBPIXEL (int) +#endif + +namespace cocos2d { + +CCNode::CCNode(void) +:m_bIsRunning(false) +,m_fRotation(0.0f) +,m_fScaleX(1.0f) +,m_fScaleY(1.0f) +,m_tPosition(CGPointZero) +,m_tPositionInPixels(CGPointZero) +,m_tAnchorPointInPixels(CGPointZero) +,m_tAnchorPoint(CGPointZero) +,m_tContentSize(CGSizeZero) +,m_tAnchorPointInPixels(CGSizeZero) +// "whole screen" objects. like Scenes and Layers, should set isRelativeAnchorPoint to false +,m_bIsRelativeAnchorPoint(true) +,m_bIsTransformDirty(true) +,m_bIsInverseDirty(true) +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX +,m_bIsTransformGLDirty(true) +#endif +,m_fVertexZ(0.0f) +,m_pGrid(NULL) +,m_bIsVisible(true) +,m_nTag(kCCNodeTagInvalid) +,m_nZOrder(0) +// lazy alloc +,m_pCamera(NULL) +// children (lazy allocs) +,m_pChildren(NULL) +// userData is always inited as nil +,m_pUserData(NULL) +,m_pParent(NULL) +{ + // nothing +} +CCNode::~CCNode() +{ + CCLOGINFO( "cocos2d: deallocing" ); + + // attributes + CCX_SAFE_RELEASE(m_pCamera); + + CCX_SAFE_RELEASE(m_pGrid); + + + if(m_pChildren && m_pChildren->count() > 0) + { + NSMutableArray::NSMutableArrayIterator it; + for( it = m_pChildren->begin(); it != m_pChildren->end(); ++it) + { + if (*it) + { + (*it)->m_pParent = NULL; + } + } + } + + // children + CCX_SAFE_RELEASE(m_pChildren); + +} + +void CCNode::arrayMakeObjectsPerformSelector(NSMutableArray * pArray, callbackFunc func) +{ + if(pArray && pArray->count() > 0) + { + CCNode* pNode; + NSMutableArray::NSMutableArrayIterator it; + for( it = pArray->begin(); it != pArray->end(); it++) + { + pNode = (*it); + + if(pNode && func) + { + (pNode->*func)(); + } + } + } +} + +/// zOrder getter +int CCNode::getZOrder() +{ + return m_nZOrder; +} + +/// zOrder setter : private method +/// used internally to alter the zOrder variable. DON'T call this method manually +void CCNode::setZOrder(int z) +{ + m_nZOrder = z; +} + +/// ertexZ getter +float CCNode::getVertexZ() +{ + return m_fVertexZ; +} + + +/// vertexZ setter +void CCNode::setVertexZ(float var) +{ + m_fVertexZ = var * CC_CONTENT_SCALE_FACTOR(); +} + + +/// rotation getter +float CCNode::getRotation() +{ + return m_fRotation; +} + +/// rotation setter +void CCNode::setRotation(float newRotation) +{ + m_fRotation = newRotation; + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif +} + + +/// scale getter +float CCNode::getScale(void) +{ + NSAssert( m_fScaleX == m_fScaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return"); + return m_fScaleX; +} + +/// scale setter +void CCNode::setScale(float scale) +{ + m_fScaleX = m_fScaleY = scale; + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif +} + +/// scaleX getter +float CCNode::getScaleX() +{ + return m_fScaleX; +} + +/// scaleX setter +void CCNode::setScaleX(float newScaleX) +{ + m_fScaleX = newScaleX; + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif +} + +/// scaleY getter +float CCNode::getScaleY() +{ + return m_fScaleY; +} + +/// scaleY setter +void CCNode::setScaleY(float newScaleY) +{ + m_fScaleY = newScaleY; + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif +} + +/// position getter +CGPoint CCNode::getPosition() +{ + return m_tPosition; +} + +/// position setter +void CCNode::setPosition(CGPoint newPosition) +{ + m_tPosition = newPosition; + if (CC_CONTENT_SCALE_FACTOR() == 1) + { + m_tAnchorPointInPixels = m_tPosition + } + else + { + m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); + } + + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif +} + +void CCNode::setPositionInPixels(CGPoint newPosition) +{ + m_tAnchorPointInPixels = newPosition; + + if ( CC_CONTENT_SCALE_FACTOR() == 1) + { + m_tPosition = m_tAnchorPointInPixels; + } + else + { + m_tPosition = ccpMult(newPosition, 1/CC_CONTENT_SCALE_FACTOR()); + } + + m_bIsTransformDirty = m_bIsInverseDirty = true; + +#if CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX +} + +/// children getter +NSMutableArray * CCNode::getChildren() +{ + return m_pChildren; +} + +/// camera getter: lazy alloc +CCCamera* CCNode::getCamera() +{ + if (!m_pCamera) + { + m_pCamera = new CCCamera(); + } + + return m_pCamera; +} + + +/// grid getter +CCGridBase* CCNode::getGrid() +{ + return m_pGrid; +} + +/// grid setter +void CCNode::setGrid(CCGridBase* pGrid) +{ + CCX_SAFE_RETAIN(pGrid); + CCX_SAFE_RELEASE(m_pGrid); + m_pGrid = pGrid; +} + + +/// isVisible getter +bool CCNode::getIsVisible() +{ + return m_bIsVisible; +} + +/// isVisible setter +void CCNode::setIsVisible(bool var) +{ + m_bIsVisible = var; +} + + +/// anchorPoint getter +CGPoint CCNode::getAnchorPoint() +{ + return m_tAnchorPoint; +} + +void CCNode::setAnchorPoint(CGPoint point) +{ + if( ! CGPoint::CGPointEqualToPoint(point, m_tAnchorPoint) ) + { + m_tAnchorPoint = point; + m_tAnchorPointInPixels = ccp( m_tContentSizeInPixels.width * m_tAnchorPoint.x, m_tContentSizeInPixels.height * m_tAnchorPoint.y ); + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif + } +} + +/// anchorPointInPixels getter +CGPoint CCNode::getAnchorPointInPixels() +{ + return m_tAnchorPointInPixels; +} + +/// contentSize getter +CGSize CCNode::getContentSize() +{ + return m_tContentSize; +} + +void CCNode::setContentSize(CGSize size) +{ + if( ! CGSize::CGSizeEqualToSize(size, m_tContentSize) ) + { + m_tContentSize = size; + m_tAnchorPointInPixels = ccp( m_tContentSize.width * m_tAnchorPoint.x, m_tContentSize.height * m_tAnchorPoint.y ); + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif + } +} + +void CCNode::setContentSizeInPixels(CGSize size) +{ + if (! CGSize::CGSizeEqualToSize(size, m_tContentSizeInPixels)) + { + m_tContentSizeInPixels = size; + + if (CC_CONTENT_SCALE_FACTOR() == 1) + { + m_tContentSize = m_tContentSizeInPixels; + } + else + { + m_tContentSize = CGSizeMake(size.width / CC_CONTENT_SCALE_FACTOR(), size.height / CC_CONTENT_SCALE_FACTOR()); + } + + m_tAnchorPointInPixels = ccp(m_tContentSizeInPixels.width * m_tAnchorPoint.x, m_tContentSizeInPixels.height * m_tAnchorPoint.y); + m_bIsTransformDirty = m_bIsInverseDirty = true; + +#if CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif // CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + } +} + + +/// isRunning getter +bool CCNode::getIsRunning() +{ + return m_bIsRunning; +} + + +/// parent getter +CCNode * CCNode::getParent() +{ + return m_pParent; +} +/// parent setter +void CCNode::setParent(CCNode * var) +{ + m_pParent = var; +} + +/// isRelativeAnchorPoint getter +bool CCNode::getIsRelativeAnchorPoint() +{ + return m_bIsRelativeAnchorPoint; +} +/// isRelativeAnchorPoint setter +void CCNode::setIsRelativeAnchorPoint(bool newValue) +{ + m_bIsRelativeAnchorPoint = newValue; + m_bIsTransformDirty = m_bIsInverseDirty = true; +#ifdef CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + m_bIsTransformGLDirty = true; +#endif +} + +/// tag getter +int CCNode::getTag() +{ + return m_nTag; +} + +/// tag setter +void CCNode::setTag(int var) +{ + m_nTag = var; +} + +/// userData getter +void * CCNode::getUserData() +{ + return m_pUserData; +} + +/// userData setter +void CCNode::setUserData(void *var) +{ + m_pUserData = var; +} + + +CGRect CCNode::boundingBox() +{ + CGRect ret = boundingBoxInPixels(); + return CC_RECT_PIXELS_TO_POINTS(ret); +} + +CGRect CCNode::boundingBoxInPixels() +{ + CGRect rect = CGRectMake(0, 0, m_tContentSizeInPixels.width, m_tContentSizeInPixels.height); + return CGRectApplyAffineTransform(rect, nodeToParentTransform()); +} + + +CCNode * CCNode::node(void) +{ + CCNode * pRet = new CCNode(); + pRet->autorelease(); + return pRet; +} + + +void CCNode::cleanup() +{ + // actions + this->stopAllActions(); + this->unscheduleAllSelectors(); + + // timers + arrayMakeObjectsPerformSelector(m_pChildren, &CCNode::cleanup); +} + + +char * CCNode::description() +{ + char *ret = new char[100] ; + sprintf(ret, "", m_nTag); + return ret; +} + +// lazy allocs +void CCNode::childrenAlloc(void) +{ + m_pChildren = new NSMutableArray(4); +} + +CCNode* CCNode::getChildByTag(int aTag) +{ + NSAssert( aTag != kCCNodeTagInvalid, "Invalid tag"); + + if(m_pChildren && m_pChildren->count() > 0) + { + CCNode* pNode; + NSMutableArray::NSMutableArrayIterator it; + for( it = m_pChildren->begin(); it != m_pChildren->end(); it++) + { + pNode = (*it); + if(pNode && pNode->m_nTag == aTag) + return pNode; + } + } + return NULL; +} + +/* "add" logic MUST only be on this method +* If a class want's to extend the 'addChild' behaviour it only needs +* to override this method +*/ +void CCNode::addChild(CCNode *child, int zOrder, int tag) +{ + NSAssert( child != NULL, "Argument must be non-nil"); + NSAssert( child->m_pParent == NULL, "child already added. It can't be added again"); + + if( ! m_pChildren ) + { + this->childrenAlloc(); + } + + this->insertChild(child, zOrder); + + child->m_nTag = tag; + + child->setParent(this); + + if( m_bIsRunning ) + { + child->onEnter(); + child->onEnterTransitionDidFinish(); + } +} + +void CCNode::addChild(CCNode *child, int zOrder) +{ + NSAssert( child != NULL, "Argument must be non-nil"); + this->addChild(child, zOrder, child->m_nTag); +} + +void CCNode::addChild(CCNode *child) +{ + NSAssert( child != NULL, "Argument must be non-nil"); + this->addChild(child, child->m_nZOrder, child->m_nTag); +} + +void CCNode::removeFromParentAndCleanup(bool cleanup) +{ + this->m_pParent->removeChild(this,cleanup); +} + +/* "remove" logic MUST only be on this method +* If a class want's to extend the 'removeChild' behavior it only needs +* to override this method +*/ +void CCNode::removeChild(CCNode* child, bool cleanup) +{ + // explicit nil handling + if (m_pChildren == NULL) + { + return; + } + + if ( m_pChildren->containsObject(child) ) + { + this->detachChild(child,cleanup); + } +} + +void CCNode::removeChildByTag(int tag, bool cleanup) +{ + NSAssert( tag != kCCNodeTagInvalid, "Invalid tag"); + + CCNode *child = this->getChildByTag(tag); + + if (child == NULL) + { + CCLOG("cocos2d: removeChildByTag: child not found!"); + } + else + { + this->removeChild(child, cleanup); + } +} + +void CCNode::removeAllChildrenWithCleanup(bool cleanup) +{ + // not using detachChild improves speed here + if ( m_pChildren && m_pChildren->count() > 0 ) + { + CCNode * pNode; + NSMutableArray::NSMutableArrayIterator it; + for ( it = m_pChildren->begin(); it!= m_pChildren->end(); it++ ) + { + pNode = *it; + if (pNode) + { + // IMPORTANT: + // -1st do onExit + // -2nd cleanup + if(m_bIsRunning) + { + pNode->onExit(); + } + + if (cleanup) + { + pNode->cleanup(); + } + // set parent nil at the end + pNode->setParent(NULL); + } + } + + m_pChildren->removeAllObjects(); + } + +} + +void CCNode::detachChild(CCNode *child, bool doCleanup) +{ + // IMPORTANT: + // -1st do onExit + // -2nd cleanup + if (m_bIsRunning) + { + child->onExit(); + } + + // If you don't do cleanup, the child's actions will not get removed and the + // its scheduledSelectors_ dict will not get released! + if (doCleanup) + { + child->cleanup(); + } + + // set parent nil at the end + child->setParent(NULL); + + m_pChildren->removeObject(child); +} + + +// helper used by reorderChild & add +void CCNode::insertChild(CCNode* child, int z) +{ + unsigned int index=0; + + if(m_pChildren && m_pChildren->count() > 0) + { + CCNode* pNode = m_pChildren->getLastObject(); + + // // quick comparison to improve performance + if (! pNode || pNode->getZOrder() <= z) + { + m_pChildren->addObject(child); + } + else + { + NSMutableArray::NSMutableArrayIterator it; + for( it = m_pChildren->begin(); it != m_pChildren->end(); it++) + { + pNode = (*it); + + if ( pNode && pNode->m_nZOrder > z ) + { + added = true; + m_pChildren->insertObjectAtIndex(child, index); + break; + } + index++; + } + } + } + + child->setZOrder(z); +} + +void CCNode::reorderChild(CCNode *child, int zOrder) +{ + NSAssert( child != NULL, "Child must be non-nil"); + + child->retain(); + m_pChildren->removeObject(child); + + insertChild(child, zOrder); + child->release(); +} + + void CCNode::draw() + { + //assert(0); + // override me + // Only use- this function to draw your staff. + // DON'T draw your stuff outside this method + } + +void CCNode::visit() +{ + // quick return if not visible + if (!m_bIsVisible) + { + return; + } + glPushMatrix(); + + if (m_pGrid && m_pGrid->isActive()) + { + m_pGrid->beforeDraw(); + this->transformAncestors(); + } + + this->transform(); + + CCNode* pNode; + NSMutableArray::NSMutableArrayIterator it; + + if(m_pChildren && m_pChildren->count() > 0) + { + // draw children zOrder < 0 + for( it = m_pChildren->begin(); it != m_pChildren->end(); it++) + { + pNode = (*it); + + if ( pNode && pNode->m_nZOrder < 0 ) + { + pNode->visit(); + } + else + { + break; + } + } + } + + // self draw + this->draw(); + + // draw children zOrder >= 0 + if (m_pChildren && m_pChildren->count() > 0) + { + for ( ; it!=m_pChildren->end(); it++ ) + { + pNode = (*it); + if (pNode) + { + pNode->visit(); + } + } + } + + if (m_pGrid && m_pGrid->isActive()) + { + m_pGrid->afterDraw(this); + } + + glPopMatrix(); +} + +void CCNode::transformAncestors() +{ + if( m_pParent != NULL ) + { + m_pParent->transformAncestors(); + m_pParent->transform(); + } +} + +void CCNode::transform() +{ + // transformations + +#if CC_NODE_TRANSFORM_USING_AFFINE_MATRIX + // BEGIN alternative -- using cached transform + // + if( m_bIsTransformGLDirty ) { + CGAffineTransform t = this->nodeToParentTransform(); + CGAffineToGL(&t, m_pTransformGL); + m_bIsTransformGLDirty = false; + } + + glMultMatrixf(m_pTransformGL); + if( m_fVertexZ ) + { + glTranslatef(0, 0, m_fVertexZ); + } + + // XXX: Expensive calls. Camera should be integrated into the cached affine matrix + if (m_pCamera && !(m_pGrid && m_pGrid->isActive())) { + bool translate = (m_tAnchorPointInPixels.x != 0.0f || m_tAnchorPointInPixels.y != 0.0f); + + if( translate ) + { + ccglTranslate(RENDER_IN_SUBPIXEL(m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tAnchorPointInPixels.y), 0); + } + + m_pCamera->locate(); + + if( translate ) + { + ccglTranslate(RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); + } + } + + + // END alternative + +#else + // BEGIN original implementation + // + // translate + if ( m_bIsRelativeAnchorPoint && (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0 ) ) + glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); + + if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0) + glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPosition.y + m_tAnchorPointInPixels.y), m_fVertexZ); + else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0) + glTranslatef( RENDER_IN_SUBPIXEL(m_tPosition.x), RENDER_IN_SUBPIXEL(m_tPosition.y), m_fVertexZ ); + + // rotate + if (m_fRotation != 0.0f ) + glRotatef( -m_fRotation, 0.0f, 0.0f, 1.0f ); + + // scale + if (m_fScaleX != 1.0f || m_fScaleY != 1.0f) + glScalef( m_fScaleX, m_fScaleY, 1.0f ); + + if ( m_pCamera && !(m_pGrid && m_pGrid->isActive()) ) + m_pCamera->locate(); + + // restore and re-position point + if (m_tAnchorPointInPixels.x != 0.0f || m_tAnchorPointInPixels.y != 0.0f) + glTranslatef(RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); + + // + // END original implementation +#endif + +} + + +void CCNode::onEnter() +{ + arrayMakeObjectsPerformSelector(m_pChildren, &CCNode::onEnter); + + this->resumeSchedulerAndActions(); + + m_bIsRunning = true; +} + +void CCNode::onEnterTransitionDidFinish() +{ + arrayMakeObjectsPerformSelector(m_pChildren, &CCNode::onEnterTransitionDidFinish); +} + +void CCNode::onExit() +{ + this->pauseSchedulerAndActions(); + + m_bIsRunning = false; + + arrayMakeObjectsPerformSelector(m_pChildren, &CCNode::onExit); +} +CCAction * CCNode::runAction(CCAction* action) +{ + NSAssert( action != NULL, "Argument must be non-nil"); + CCActionManager::sharedManager()->addAction(action, this, !m_bIsRunning); + return action; +} + +void CCNode::stopAllActions() +{ + CCActionManager::sharedManager()->removeAllActionsFromTarget(this); +} + +void CCNode::stopAction(CCAction* action) +{ + CCActionManager::sharedManager()->removeAction(action); +} + +void CCNode::stopActionByTag(int tag) +{ + NSAssert( tag != kCCActionTagInvalid, "Invalid tag"); + CCActionManager::sharedManager()->removeActionByTag(tag, this); +} + +CCAction * CCNode::getActionByTag(int tag) +{ + NSAssert( tag != kCCActionTagInvalid, "Invalid tag"); + return CCActionManager::sharedManager()->getActionByTag(tag, this); +} + +int CCNode::numberOfRunningActions() +{ + return CCActionManager::sharedManager()->numberOfRunningActionsInTarget(this); +} + +// CCNode - Callbacks + +void CCNode::scheduleUpdate() +{ + scheduleUpdateWithPriority(0); +} + +void CCNode::scheduleUpdateWithPriority(int priority) +{ + CCScheduler::sharedScheduler()->scheduleUpdateForTarget(this, priority, !m_bIsRunning); +} + +void CCNode::unscheduleUpdate() +{ + CCScheduler::sharedScheduler()->unscheduleUpdateForTarget(this); +} + +void CCNode::schedule(SEL_SCHEDULE selector) +{ + this->schedule(selector, 0); +} + +void CCNode::schedule(SEL_SCHEDULE selector, ccTime interval) +{ + NSAssert( selector != NULL, "Argument must be non-nil"); + NSAssert( interval >=0, "Argument must be positive"); + + CCScheduler::sharedScheduler()->scheduleSelector(selector, this, interval, !m_bIsRunning); +} + +void CCNode::unschedule(SEL_SCHEDULE selector) +{ + // explicit nil handling + if (selector == NULL) + return; + + CCScheduler::sharedScheduler()->unscheduleSelector(selector, this); +} + +void CCNode::unscheduleAllSelectors() +{ + CCScheduler::sharedScheduler()->unscheduleAllSelectorsForTarget(this); +} + +void CCNode::resumeSchedulerAndActions() +{ + CCScheduler::sharedScheduler()->resumeTarget(this); + CCActionManager::sharedManager()->resumeTarget(this); +} + +void CCNode::pauseSchedulerAndActions() +{ + CCScheduler::sharedScheduler()->pauseTarget(this); + CCActionManager::sharedManager()->pauseTarget(this); +} + +void CCNode::selectorProtocolRetain(void) +{ + retain(); +} + +void CCNode::selectorProtocolRelease(void) +{ + release(); +} + +CGAffineTransform CCNode::nodeToParentTransform(void) +{ + if ( m_bIsTransformDirty ) { + + m_tTransform = CGAffineTransformIdentity; + + if( ! m_bIsRelativeAnchorPoint && ! CGPoint::CGPointEqualToPoint(m_tAnchorPointInPixels, CGPointZero) ) + m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tAnchorPointInPixels.x, m_tAnchorPointInPixels.y); + + if( ! CGPoint::CGPointEqualToPoint(m_tPositionInPixels, CGPointZero) ) + m_tTransform = CGAffineTransformTranslate(m_tTransform, m_tPositionInPixels.x, m_tPosition.y); + if( m_fRotation != 0 ) + m_tTransform = CGAffineTransformRotate(m_tTransform, -CC_DEGREES_TO_RADIANS(m_fRotation)); + if( ! (m_fScaleX == 1 && m_fScaleY == 1) ) + m_tTransform = CGAffineTransformScale(m_tTransform, m_fScaleX, m_fScaleY); + + if( ! CGPoint::CGPointEqualToPoint(m_tAnchorPointInPixels, CGPointZero) ) + m_tTransform = CGAffineTransformTranslate(m_tTransform, -m_tAnchorPointInPixels.x, -m_tAnchorPointInPixels.y); + + m_bIsTransformDirty = false; + } + + return m_tTransform; +} + +CGAffineTransform CCNode::parentToNodeTransform(void) +{ + if ( m_bIsInverseDirty ) { + m_tInverse = CGAffineTransformInvert(this->nodeToParentTransform()); + m_bIsInverseDirty = false; + } + + return m_tInverse; +} + +CGAffineTransform CCNode::nodeToWorldTransform() +{ + CGAffineTransform t = this->nodeToParentTransform(); + + for (CCNode *p = m_pParent; p != NULL; p = p->getParent()) + t = CGAffineTransformConcat(t, p->nodeToParentTransform()); + + return t; +} + +CGAffineTransform CCNode::worldToNodeTransform(void) +{ + return CGAffineTransformInvert(this->nodeToWorldTransform()); +} + +CGPoint CCNode::convertToNodeSpace(CGPoint worldPoint) +{ + CGPoint ret; + if(CC_CONTENT_SCALE_FACTOR() == 1) + { + ret = CGPointApplyAffineTransform(worldPoint, worldToNodeTransform()); + } + else + { + ret = ccpMult(worldPoint, CC_CONTENT_SCALE_FACTOR()); + ret = CGPointApplyAffineTransform(ret, worldToNodeTransform()); + ret = ccpMult(ret, 1/CC_CONTENT_SCALE_FACTOR()); + } + + return ret; +} + +CGPoint CCNode::convertToWorldSpace(CGPoint nodePoint) +{ + CGPoint ret; + if(CC_CONTENT_SCALE_FACTOR() == 1) + { + ret = CGPointApplyAffineTransform(nodePoint, nodeToWorldTransform()); + } + else + { + ret = ccpMult( nodePoint, CC_CONTENT_SCALE_FACTOR() ); + ret = CGPointApplyAffineTransform(ret, nodeToWorldTransform()); + ret = ccpMult( ret, 1/CC_CONTENT_SCALE_FACTOR() ); + } + + return ret; +} + +CGPoint CCNode::convertToNodeSpaceAR(CGPoint worldPoint) +{ + CGPoint nodePoint = convertToNodeSpace(worldPoint); + CGPoint anchorInPoints; + if( CC_CONTENT_SCALE_FACTOR() == 1 ) + { + anchorInPoints = m_tAnchorPointInPixels; + } + else + { + anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() ); + } + + return ccpSub(nodePoint, anchorInPoints); +} + +CGPoint CCNode::convertToWorldSpaceAR(CGPoint nodePoint) +{ + CGPoint anchorInPoints; + if( CC_CONTENT_SCALE_FACTOR() == 1 ) + { + anchorInPoints = m_tAnchorPointInPixels; + } + else + { + anchorInPoints = ccpMult( m_tAnchorPointInPixels, 1/CC_CONTENT_SCALE_FACTOR() ); + } + + nodePoint = ccpAdd(nodePoint, anchorInPoints); + return convertToWorldSpace(nodePoint); +} +CGPoint CCNode::convertToWindowSpace(CGPoint nodePoint) +{ + CGPoint worldPoint = this->convertToWorldSpace(nodePoint); + return CCDirector::sharedDirector()->convertToUI(worldPoint); +} + +// The functions are compatable with mobile platform, +// not supported in mac +CGPoint CCNode::convertTouchToNodeSpace(CCTouch *touch) +{ + CCLOG("cocos2d: CCNode: unsupported"); +} +CGPoint CCNode::convertTouchToNodeSpaceAR(CCTouch *touch) +{ + CCLOG("cocos2d: CCNode: unsupported"); +} + +}//namespace cocos2d diff --git a/cocos2dx/proj.uphone/cocos2d-uphone.vcproj b/cocos2dx/proj.uphone/cocos2d-uphone.vcproj index 64e299d6fb..c43275618c 100644 --- a/cocos2dx/proj.uphone/cocos2d-uphone.vcproj +++ b/cocos2dx/proj.uphone/cocos2d-uphone.vcproj @@ -240,10 +240,6 @@ RelativePath="..\base_nodes\CCAtlasNode.cpp" > - - + +