Merge pull request #783 from minggo/ActionsEaseTest

rename EaseTatinosTest to ActionsEaseTest and SC
This commit is contained in:
minggo 2012-03-20 03:10:38 -07:00
commit 6a39dd21ab
6 changed files with 21 additions and 72 deletions

View File

@ -10,6 +10,7 @@ LOCAL_SRC_FILES := \
tests/AccelerometerTest/AccelerometerTest.cpp \ tests/AccelerometerTest/AccelerometerTest.cpp \
tests/ActionManagerTest/ActionManagerTest.cpp \ tests/ActionManagerTest/ActionManagerTest.cpp \
tests/ActionsTest/ActionsTest.cpp \ tests/ActionsTest/ActionsTest.cpp \
tests/ActionsEaseTest/ActionsEaseTest.cpp \
tests/ActionsProgressTest/ActionsProgressTest.cpp \ tests/ActionsProgressTest/ActionsProgressTest.cpp \
tests/BugsTest/Bug-1159.cpp \ tests/BugsTest/Bug-1159.cpp \
tests/BugsTest/Bug-1174.cpp \ tests/BugsTest/Bug-1174.cpp \
@ -29,7 +30,6 @@ tests/CurlTest/CurlTest.cpp \
tests/CurrentLanguageTest/CurrentLanguageTest.cpp \ tests/CurrentLanguageTest/CurrentLanguageTest.cpp \
tests/DirectorTest/DirectorTest.cpp \ tests/DirectorTest/DirectorTest.cpp \
tests/DrawPrimitivesTest/DrawPrimitivesTest.cpp \ tests/DrawPrimitivesTest/DrawPrimitivesTest.cpp \
tests/EaseActionsTest/EaseActionsTest.cpp \
tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp \ tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp \
tests/EffectsTest/EffectsTest.cpp \ tests/EffectsTest/EffectsTest.cpp \
tests/ExtensionsTest/ExtensionsTest.cpp \ tests/ExtensionsTest/ExtensionsTest.cpp \

View File

@ -300,14 +300,14 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="EaseActionsTest" Name="ActionsEaseTest"
> >
<File <File
RelativePath="..\tests\EaseActionsTest\EaseActionsTest.cpp" RelativePath="..\tests\ActionsEaseTest\ActionsEaseTest.cpp"
> >
</File> </File>
<File <File
RelativePath="..\tests\EaseActionsTest\EaseActionsTest.h" RelativePath="..\tests\ActionsEaseTest\ActionsEaseTest.h"
> >
</File> </File>
</Filter> </Filter>

View File

@ -1,4 +1,4 @@
#include "EaseActionsTest.h" #include "ActionsEaseTest.h"
#include "../testResource.h" #include "../testResource.h"
enum { enum {
@ -24,10 +24,10 @@ void SpriteEase::onEnter()
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0) ); CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0) );
CCActionInterval* move_back = move->reverse(); CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = (CCActionInterval*)CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f); CCActionInterval* move_ease_in = (CCActionInterval*)CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
CCActionInterval* move_ease_in_back = move_ease_in->reverse(); CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f); CCActionInterval* move_ease_out = CCEaseOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
CCActionInterval* move_ease_out_back = move_ease_out->reverse(); CCActionInterval* move_ease_out_back = move_ease_out->reverse();
@ -75,13 +75,13 @@ void SpriteEaseInOut::onEnter()
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0)); CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
// id move_back = move->reverse(); // id move_back = move->reverse();
CCActionInterval* move_ease_inout1 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.0f); CCActionInterval* move_ease_inout1 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.65f);
CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse(); CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
CCActionInterval* move_ease_inout2 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f); CCActionInterval* move_ease_inout2 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 1.35f);
CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse(); CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse();
CCActionInterval* move_ease_inout3 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 4.0f); CCActionInterval* move_ease_inout3 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 1.0f);
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse(); CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
@ -482,48 +482,6 @@ std::string SpeedTest::title()
return "Speed action"; return "Speed action";
} }
//------------------------------------------------------------------
//
// SchedulerTest
//
//------------------------------------------------------------------
void SchedulerTest::onEnter()
{
EaseSpriteDemo::onEnter();
// rotate and jump
CCActionInterval* jump1 = CCJumpBy::actionWithDuration(4, CCPointMake(-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((CCActionInterval*)spawn);
CCRepeatForever* action2 = (CCRepeatForever*)(action->copy()->autorelease());
CCRepeatForever* action3 = (CCRepeatForever*)(action->copy()->autorelease());
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"));
addChild(emitter);
//sliderCtl = [self sliderCtl];
//[[[[Director sharedDirector] openGLView] window] addSubview: sliderCtl];
}
std::string SchedulerTest::title()
{
return "Scheduler scaleTime Test";
}
//------------------------------------------------------------------ //------------------------------------------------------------------
// //
// EaseSpriteDemo // EaseSpriteDemo
@ -539,7 +497,7 @@ enum
static int sceneIdx = -1; static int sceneIdx = -1;
#define MAX_LAYER 14 #define MAX_LAYER 13
CCLayer* createEaseLayer(int nIndex) CCLayer* createEaseLayer(int nIndex)
{ {
@ -558,7 +516,6 @@ CCLayer* createEaseLayer(int nIndex)
case 10: return new SpriteEaseBack(); case 10: return new SpriteEaseBack();
case 11: return new SpriteEaseBackInOut(); case 11: return new SpriteEaseBackInOut();
case 12: return new SpeedTest(); case 12: return new SpeedTest();
case 13: return new SchedulerTest();
} }
@ -661,7 +618,7 @@ void EaseSpriteDemo::onEnter()
void EaseSpriteDemo::restartCallback(CCObject* pSender) void EaseSpriteDemo::restartCallback(CCObject* pSender)
{ {
CCScene* s = new EaseActionsTestScene();//CCScene::node(); CCScene* s = new ActionsEaseTestScene();//CCScene::node();
s->addChild(restartEaseAction()); s->addChild(restartEaseAction());
CCDirector::sharedDirector()->replaceScene(s); CCDirector::sharedDirector()->replaceScene(s);
@ -670,7 +627,7 @@ void EaseSpriteDemo::restartCallback(CCObject* pSender)
void EaseSpriteDemo::nextCallback(CCObject* pSender) void EaseSpriteDemo::nextCallback(CCObject* pSender)
{ {
CCScene* s = new EaseActionsTestScene();//CCScene::node(); CCScene* s = new ActionsEaseTestScene();//CCScene::node();
s->addChild( nextEaseAction() ); s->addChild( nextEaseAction() );
CCDirector::sharedDirector()->replaceScene(s); CCDirector::sharedDirector()->replaceScene(s);
s->release(); s->release();
@ -678,13 +635,13 @@ void EaseSpriteDemo::nextCallback(CCObject* pSender)
void EaseSpriteDemo::backCallback(CCObject* pSender) void EaseSpriteDemo::backCallback(CCObject* pSender)
{ {
CCScene* s = new EaseActionsTestScene();//CCScene::node(); CCScene* s = new ActionsEaseTestScene();//CCScene::node();
s->addChild( backEaseAction() ); s->addChild( backEaseAction() );
CCDirector::sharedDirector()->replaceScene(s); CCDirector::sharedDirector()->replaceScene(s);
s->release(); s->release();
} }
void EaseActionsTestScene::runThisTest() void ActionsEaseTestScene::runThisTest()
{ {
CCLayer* pLayer = nextEaseAction(); CCLayer* pLayer = nextEaseAction();
addChild(pLayer); addChild(pLayer);

View File

@ -1,5 +1,5 @@
#ifndef _EASE_ACTIONS_TEST_H_ #ifndef _ACTIONS__EASE_TEST_H_
#define _EASE_ACTIONS_TEST_H_ #define _ACTIONS__EASE_TEST_H_
////----#include "cocos2d.h" ////----#include "cocos2d.h"
#include "../testBasic.h" #include "../testBasic.h"
@ -124,15 +124,7 @@ public:
void altertime(ccTime dt); void altertime(ccTime dt);
}; };
class ActionsEaseTestScene : public TestScene
class SchedulerTest : public EaseSpriteDemo
{
public:
void onEnter();
virtual std::string title();
};
class EaseActionsTestScene : public TestScene
{ {
public: public:
virtual void runThisTest(); virtual void runThisTest();

View File

@ -29,7 +29,7 @@ static TestScene* CreateTestScene(int nIdx)
case TEST_PARTICLE: case TEST_PARTICLE:
pScene = new ParticleTestScene(); break; pScene = new ParticleTestScene(); break;
case TEST_EASE_ACTIONS: case TEST_EASE_ACTIONS:
pScene = new EaseActionsTestScene(); break; pScene = new ActionsEaseTestScene(); break;
case TEST_MOTION_STREAK: case TEST_MOTION_STREAK:
pScene = new MotionStreakTestScene(); break; pScene = new MotionStreakTestScene(); break;
case TEST_DRAW_PRIMITIVES: case TEST_DRAW_PRIMITIVES:

View File

@ -8,7 +8,7 @@
#include "ClickAndMoveTest/ClickAndMoveTest.h" #include "ClickAndMoveTest/ClickAndMoveTest.h"
#include "RotateWorldTest/RotateWorldTest.h" #include "RotateWorldTest/RotateWorldTest.h"
#include "ParticleTest/ParticleTest.h" #include "ParticleTest/ParticleTest.h"
#include "EaseActionsTest/EaseActionsTest.h" #include "ActionsEaseTest/ActionsEaseTest.h"
#include "MotionStreakTest/MotionStreakTest.h" #include "MotionStreakTest/MotionStreakTest.h"
#include "DrawPrimitivesTest/DrawPrimitivesTest.h" #include "DrawPrimitivesTest/DrawPrimitivesTest.h"
#include "CocosNodeTest/CocosNodeTest.h" #include "CocosNodeTest/CocosNodeTest.h"
@ -114,7 +114,7 @@ const std::string g_aTestNames[TESTS_COUNT] = {
"ClickAndMoveTest", "ClickAndMoveTest",
"RotateWorldTest", "RotateWorldTest",
"ParticleTest", "ParticleTest",
"EaseActionsTest", "ActionsEaseTest",
"MotionStreakTest", "MotionStreakTest",
"DrawPrimitivesTest", "DrawPrimitivesTest",
"CocosNodeTest", "CocosNodeTest",