mirror of https://github.com/axmolengine/axmol.git
fixed #88
This commit is contained in:
parent
3c4eb5e8e0
commit
b531d99ca8
|
@ -401,6 +401,30 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="EaseActionsTest"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\tests\EaseActionsTest\EaseActionsTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\tests\EaseActionsTest\EaseActionsTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="MotionStreakTest"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\tests\MotionStreakTest\MotionStreakTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\tests\MotionStreakTest\MotionStreakTest.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\test_uphoneUnicodeScript.h"
|
||||
|
|
|
@ -0,0 +1,701 @@
|
|||
#include "EaseActionsTest.h"
|
||||
#include "../testResource.h"
|
||||
|
||||
enum {
|
||||
kTagAction1 = 1,
|
||||
kTagAction2 = 2,
|
||||
kTagSlider = 1,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEase
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEase::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0) );
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_in = CCEaseIn::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 3.0f);
|
||||
CCIntervalAction* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_out = CCEaseOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 3.0f);
|
||||
CCIntervalAction* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions(move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions(move_ease_in, move_ease_in_back, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions(move_ease_out, move_ease_out_back, NULL));
|
||||
|
||||
|
||||
CCAction *a2 = m_grossini->runAction( CCRepeatForever::actionWithAction(seq1) );
|
||||
a2->setTag(1);
|
||||
|
||||
CCAction *a1 = m_tamara->runAction( CCRepeatForever::actionWithAction(seq2) );
|
||||
a1->setTag(1);
|
||||
|
||||
CCAction *a = m_kathia->runAction( CCRepeatForever::actionWithAction(seq3) );
|
||||
a->setTag(1);
|
||||
|
||||
schedule(schedule_selector(SpriteEase::testStopAction), 6);
|
||||
}
|
||||
|
||||
void SpriteEase::testStopAction(ccTime dt)
|
||||
{
|
||||
unschedule(schedule_selector(SpriteEase::testStopAction));
|
||||
m_tamara->stopActionByTag(1);
|
||||
m_kathia->stopActionByTag(1);
|
||||
m_grossini->stopActionByTag(1);
|
||||
}
|
||||
|
||||
std::string SpriteEase::title()
|
||||
{
|
||||
return "EaseIn - EaseOut - Stop";
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseInOut
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseInOut::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
// id move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_inout1 = CCEaseInOut::actionWithAction(dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 2.0f);
|
||||
CCIntervalAction* move_ease_inout_back1 = move_ease_inout1->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_inout2 = CCEaseInOut::actionWithAction(dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 3.0f);
|
||||
CCIntervalAction* move_ease_inout_back2 = move_ease_inout2->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_inout3 = CCEaseInOut::actionWithAction(dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 4.0f);
|
||||
CCIntervalAction* move_ease_inout_back3 = move_ease_inout3->reverse();
|
||||
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_inout1, move_ease_inout_back1, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_inout2, move_ease_inout_back2, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_inout3, move_ease_inout_back3, NULL));
|
||||
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq1) );
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq2) );
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq3) );
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseInOut::title()
|
||||
{
|
||||
return "EaseInOut and rates";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseExponential
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseExponential::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_in = CCEaseExponentialIn::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_out = CCEaseExponentialOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_in, move_ease_in_back, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_out, move_ease_out_back, NULL));
|
||||
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1) );
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2) );
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq3) );
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseExponential::title()
|
||||
{
|
||||
return "ExpIn - ExpOut actions";
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseExponentialInOut
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseExponentialInOut::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease = CCEaseExponentialInOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_back = move_ease->reverse(); //--> reverse()°¡ Á¸ÀçÇÏÁö ¾Ê´Â´Ù.
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease, move_ease_back, NULL));
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseExponentialInOut::title()
|
||||
{
|
||||
return "EaseExponentialInOut action";
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseSine
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseSine::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_in = CCEaseSineIn::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_out = CCEaseSineOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_in, move_ease_in_back, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_out, move_ease_out_back, NULL));
|
||||
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq3));
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseSine::title()
|
||||
{
|
||||
return "EaseSineIn - EaseSineOut";
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseSineInOut
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseSineInOut::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease = CCEaseSineInOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_back = move_ease->reverse();
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease, move_ease_back, NULL));
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseSineInOut::title()
|
||||
{
|
||||
return "EaseSineInOut action";
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseElastic
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseElastic::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_in = CCEaseElasticIn::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_out = CCEaseElasticOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_in, move_ease_in_back, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_out, move_ease_out_back, NULL));
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq3));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseElastic::title()
|
||||
{
|
||||
return "Elastic In - Out actions";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseElasticInOut
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseElasticInOut::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
|
||||
CCIntervalAction* move_ease_inout1 = CCEaseElasticInOut::actionWithAction(dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 0.3f);
|
||||
CCIntervalAction* move_ease_inout_back1 = move_ease_inout1->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_inout2 = CCEaseElasticInOut::actionWithAction(dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 0.45f);
|
||||
CCIntervalAction* move_ease_inout_back2 = move_ease_inout2->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_inout3 = CCEaseElasticInOut::actionWithAction(dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()), 0.6f);
|
||||
CCIntervalAction* move_ease_inout_back3 = move_ease_inout3->reverse();
|
||||
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_inout1, move_ease_inout_back1, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_inout2, move_ease_inout_back2, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_inout3, move_ease_inout_back3, NULL));
|
||||
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq3));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseElasticInOut::title()
|
||||
{
|
||||
return "EaseElasticInOut action";
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseBounce
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseBounce::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_in = CCEaseBounceIn::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_out = CCEaseBounceOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_in, move_ease_in_back, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_out, move_ease_out_back, NULL));
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq3));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseBounce::title()
|
||||
{
|
||||
return "Bounce In - Out actions";
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseBounceInOut
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseBounceInOut::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease = CCEaseBounceInOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_back = move_ease->reverse();
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease, move_ease_back, NULL));
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseBounceInOut::title()
|
||||
{
|
||||
return "EaseBounceInOut action";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseBack
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseBack::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_in = CCEaseBackIn::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCIntervalAction* move_ease_out = CCEaseBackOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_in, move_ease_in_back, NULL));
|
||||
CCIntervalAction* seq3 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease_out, move_ease_out_back, NULL));
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
m_kathia->runAction( CCRepeatForever::actionWithAction(seq3));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseBack::title()
|
||||
{
|
||||
return "Back In - Out actions";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpriteEaseBackInOut
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpriteEaseBackInOut::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
CCIntervalAction* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
|
||||
CCIntervalAction* move_back = move->reverse();
|
||||
|
||||
CCIntervalAction* move_ease = CCEaseBackInOut::actionWithAction( dynamic_cast<CCIntervalAction*>(move->copy()->autorelease()) );
|
||||
CCIntervalAction* move_ease_back = move_ease->reverse();
|
||||
|
||||
CCIntervalAction* seq1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move, move_back, NULL));
|
||||
CCIntervalAction* seq2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( move_ease, move_ease_back, NULL));
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
m_grossini->runAction( CCRepeatForever::actionWithAction(seq1));
|
||||
m_tamara->runAction( CCRepeatForever::actionWithAction(seq2));
|
||||
}
|
||||
|
||||
|
||||
std::string SpriteEaseBackInOut::title()
|
||||
{
|
||||
return "EaseBackInOut action";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SpeedTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SpeedTest::onEnter()
|
||||
{
|
||||
__super::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();
|
||||
|
||||
CCIntervalAction* seq3_1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions(jump2, jump1, NULL));
|
||||
CCIntervalAction* seq3_2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( rot1, rot2, NULL));
|
||||
CCIntervalAction* spawn = dynamic_cast<CCIntervalAction*>(CCSpawn::actions(seq3_1, seq3_2, NULL));
|
||||
CCSpeed* action = CCSpeed::actionWithAction( CCRepeatForever::actionWithAction(spawn), 1.0f);
|
||||
action->setTag(kTagAction1);
|
||||
|
||||
CCAction* action2 = dynamic_cast<CCAction*>(action->copy()->autorelease());
|
||||
CCAction* action3 = dynamic_cast<CCAction*>(action->copy()->autorelease());
|
||||
|
||||
action2->setTag(kTagAction1);
|
||||
action3->setTag(kTagAction1);
|
||||
|
||||
m_grossini->runAction( action2 );
|
||||
m_tamara->runAction( action3 );
|
||||
m_kathia->runAction( action );
|
||||
|
||||
this->schedule(schedule_selector(SpeedTest::altertime), 1.0f);//:@selector(altertime:) interval:1.0f];
|
||||
}
|
||||
|
||||
void SpeedTest::altertime(ccTime dt)
|
||||
{
|
||||
CCSpeed* action1 = dynamic_cast<CCSpeed*>(m_grossini->getActionByTag(kTagAction1));
|
||||
CCSpeed* action2 = dynamic_cast<CCSpeed*>(m_tamara->getActionByTag(kTagAction1));
|
||||
CCSpeed* action3 = dynamic_cast<CCSpeed*>(m_kathia->getActionByTag(kTagAction1));
|
||||
|
||||
action1->setSpeed( CCRANDOM_0_1() * 2 );
|
||||
action2->setSpeed( CCRANDOM_0_1() * 2 );
|
||||
action3->setSpeed( CCRANDOM_0_1() * 2 );
|
||||
}
|
||||
|
||||
std::string SpeedTest::title()
|
||||
{
|
||||
return "Speed action";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// SchedulerTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
void SchedulerTest::onEnter()
|
||||
{
|
||||
__super::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();
|
||||
|
||||
CCIntervalAction* seq3_1 = dynamic_cast<CCIntervalAction*>(CCSequence::actions(jump2, jump1, NULL));
|
||||
CCIntervalAction* seq3_2 = dynamic_cast<CCIntervalAction*>(CCSequence::actions( rot1, rot2, NULL));
|
||||
CCIntervalAction* spawn = dynamic_cast<CCIntervalAction*>(CCSpawn::actions(seq3_1, seq3_2, NULL));
|
||||
CCRepeatForever* action = CCRepeatForever::actionWithAction(spawn);
|
||||
|
||||
CCRepeatForever* action2 = dynamic_cast<CCRepeatForever*>(action->copy()->autorelease());
|
||||
CCRepeatForever* action3 = dynamic_cast<CCRepeatForever*>(action->copy()->autorelease());
|
||||
|
||||
|
||||
m_grossini->runAction( CCSpeed::actionWithAction( action, 0.5f) );
|
||||
m_tamara->runAction( CCSpeed::actionWithAction( action2, 1.5f) );
|
||||
m_kathia->runAction( CCSpeed::actionWithAction( action3, 1.0f) );
|
||||
|
||||
CCParticleSystem* emitter = CCParticleFireworks::node();
|
||||
addChild(emitter);
|
||||
|
||||
//sliderCtl = [self sliderCtl];
|
||||
//[[[[Director sharedDirector] openGLView] window] addSubview: sliderCtl];
|
||||
}
|
||||
|
||||
|
||||
std::string SchedulerTest::title()
|
||||
{
|
||||
return "Scheduler scaleTime Test";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// EaseSpriteDemo
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
{
|
||||
IDC_NEXT = 100,
|
||||
IDC_BACK,
|
||||
IDC_RESTART
|
||||
};
|
||||
|
||||
static int sceneIdx = -1;
|
||||
|
||||
#define MAX_LAYER 14
|
||||
|
||||
CCLayer* createEaseLayer(int nIndex)
|
||||
{
|
||||
switch(nIndex)
|
||||
{
|
||||
case 0: return new SpriteEase();
|
||||
case 1: return new SpriteEaseInOut();
|
||||
case 2: return new SpriteEaseExponential();
|
||||
case 3: return new SpriteEaseExponentialInOut();
|
||||
case 4: return new SpriteEaseSine();
|
||||
case 5: return new SpriteEaseSineInOut();
|
||||
case 6: return new SpriteEaseElastic();
|
||||
case 7: return new SpriteEaseElasticInOut();
|
||||
case 8: return new SpriteEaseBounce();
|
||||
case 9: return new SpriteEaseBounceInOut();
|
||||
case 10: return new SpriteEaseBack();
|
||||
case 11: return new SpriteEaseBackInOut();
|
||||
case 12: return new SpeedTest();
|
||||
case 13: return new SchedulerTest();
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCLayer* nextEaseAction()
|
||||
{
|
||||
sceneIdx++;
|
||||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
CCLayer* pLayer = createEaseLayer(sceneIdx);
|
||||
pLayer->autorelease();
|
||||
|
||||
return pLayer;
|
||||
}
|
||||
|
||||
CCLayer* backEaseAction()
|
||||
{
|
||||
sceneIdx--;
|
||||
int total = MAX_LAYER;
|
||||
if( sceneIdx < 0 )
|
||||
sceneIdx += total;
|
||||
|
||||
CCLayer* pLayer = createEaseLayer(sceneIdx);
|
||||
pLayer->autorelease();
|
||||
|
||||
return pLayer;
|
||||
}
|
||||
|
||||
CCLayer* restartEaseAction()
|
||||
{
|
||||
CCLayer* pLayer = createEaseLayer(sceneIdx);
|
||||
pLayer->autorelease();
|
||||
|
||||
return pLayer;
|
||||
}
|
||||
|
||||
|
||||
EaseSpriteDemo::EaseSpriteDemo(void)
|
||||
{
|
||||
}
|
||||
|
||||
EaseSpriteDemo::~EaseSpriteDemo(void)
|
||||
{
|
||||
m_grossini->release();
|
||||
m_tamara->release();
|
||||
m_kathia->release();
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::positionForTwo()
|
||||
{
|
||||
m_grossini->setPosition( CGPointMake( 60, 120 ) );
|
||||
m_tamara->setPosition( CGPointMake( 60, 220) );
|
||||
m_kathia->setIsVisible(false);
|
||||
}
|
||||
|
||||
|
||||
std::string EaseSpriteDemo::title()
|
||||
{
|
||||
return "No title";
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
// Example:
|
||||
// You can create a sprite using a Texture2D
|
||||
CCTexture2D* tex = new CCTexture2D();
|
||||
UIImage* pImage = new UIImage();
|
||||
|
||||
if(pImage->initWithContentsOfFile(CCFileUtils::fullPathFromRelativePath(s_pPathGrossini)))
|
||||
{
|
||||
tex->initWithImage(pImage);
|
||||
m_grossini = CCSprite::spriteWithTexture(tex);
|
||||
m_grossini->retain();
|
||||
|
||||
}
|
||||
|
||||
tex->release();
|
||||
delete pImage;
|
||||
|
||||
// Example:
|
||||
// Or you can create an sprite using a filename. PNG and BMP files are supported. Probably TIFF too
|
||||
m_tamara = CCSprite::spriteWithFile(s_pPathSister1); m_tamara->retain();
|
||||
m_kathia = CCSprite::spriteWithFile(s_pPathSister2); m_kathia->retain();
|
||||
|
||||
addChild( m_grossini, 3);
|
||||
addChild( m_kathia, 2);
|
||||
addChild( m_tamara, 1);
|
||||
|
||||
CGSize s = CCDirector::getSharedDirector()->getWinSize();
|
||||
|
||||
m_grossini->setPosition( CGPointMake(60, 50) );
|
||||
m_kathia->setPosition( CGPointMake(60, 150) );
|
||||
m_tamara->setPosition( CGPointMake(60, 250) );
|
||||
|
||||
CCLabel* label = CCLabel::labelWithString(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition( CGPointMake(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(EaseSpriteDemo::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(EaseSpriteDemo::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(EaseSpriteDemo::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CGPointZero );
|
||||
item1->setPosition( CGPointMake( s.width/2 - 100,30) );
|
||||
item2->setPosition( CGPointMake( s.width/2, 30) );
|
||||
item3->setPosition( CGPointMake( s.width/2 + 100,30) );
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::restartCallback(NSObject* pSender)
|
||||
{
|
||||
CCScene* s = new EaseActionsTestScene();//CCScene::node();
|
||||
s->addChild(restartEaseAction());
|
||||
|
||||
CCDirector::getSharedDirector()->replaceScene(s);
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::nextCallback(NSObject* pSender)
|
||||
{
|
||||
CCScene* s = new EaseActionsTestScene();//CCScene::node();
|
||||
s->addChild( nextEaseAction() );
|
||||
CCDirector::getSharedDirector()->replaceScene(s);
|
||||
}
|
||||
|
||||
void EaseSpriteDemo::backCallback(NSObject* pSender)
|
||||
{
|
||||
CCScene* s = new EaseActionsTestScene();//CCScene::node();
|
||||
s->addChild( backEaseAction() );
|
||||
CCDirector::getSharedDirector()->replaceScene(s);
|
||||
}
|
||||
|
||||
void EaseActionsTestScene::runThisTest()
|
||||
{
|
||||
CCLayer* pLayer = nextEaseAction();
|
||||
addChild(pLayer);
|
||||
|
||||
CCDirector::getSharedDirector()->replaceScene(this);
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
#ifndef _EASE_ACTIONS_TEST_H_
|
||||
#define _EASE_ACTIONS_TEST_H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
class EaseSpriteDemo : public CCLayer
|
||||
{
|
||||
protected:
|
||||
CCSprite* m_grossini;
|
||||
CCSprite* m_tamara;
|
||||
CCSprite* m_kathia;
|
||||
|
||||
std::string m_strTitle;
|
||||
|
||||
public:
|
||||
EaseSpriteDemo(void);
|
||||
~EaseSpriteDemo(void);
|
||||
|
||||
virtual std::string title();
|
||||
virtual void onEnter();
|
||||
|
||||
void restartCallback(NSObject* pSender);
|
||||
void nextCallback(NSObject* pSender);
|
||||
void backCallback(NSObject* pSender);
|
||||
|
||||
void positionForTwo();
|
||||
};
|
||||
|
||||
class SpriteEase : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
|
||||
void testStopAction(ccTime dt);
|
||||
};
|
||||
|
||||
class SpriteEaseInOut : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseExponential : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseExponentialInOut : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseSine : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseSineInOut : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseElastic : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseElasticInOut : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseBounce : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseBounceInOut : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseBack : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpriteEaseBackInOut : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class SpeedTest : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
|
||||
void altertime(ccTime dt);
|
||||
};
|
||||
|
||||
|
||||
class SchedulerTest : public EaseSpriteDemo
|
||||
{
|
||||
public:
|
||||
void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class EaseActionsTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,213 @@
|
|||
#include "MotionStreakTest.h"
|
||||
#include "../testResource.h"
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// MotionStreakTest1
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void MotionStreakTest1::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CGSize s = CCDirector::getSharedDirector()->getWinSize();
|
||||
|
||||
// the root object just rotates around
|
||||
m_root = CCSprite::spriteWithFile(s_pPathR1);
|
||||
addChild(m_root, 1);
|
||||
m_root->setPosition( CGPointMake(s.width/2, s.height/2) );
|
||||
|
||||
// the target object is offset from root, and the streak is moved to follow it
|
||||
m_target = CCSprite::spriteWithFile(s_pPathR1);
|
||||
m_root->addChild(m_target);
|
||||
m_target->setPosition( CGPointMake(100,0) );
|
||||
|
||||
// create the streak object and add it to the scene
|
||||
m_streak = CCMotionStreak::streakWithFade(2, 3, s_streak, 32, 32, ccc4(0,255,0,255) );
|
||||
addChild( m_streak );
|
||||
// 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);
|
||||
|
||||
CCAction* action1 = CCRepeatForever::actionWithAction(a1);
|
||||
CCIntervalAction* motion = CCMoveBy::actionWithDuration(2, CGPointMake(100,0) );
|
||||
m_root->runAction( CCRepeatForever::actionWithAction( dynamic_cast<CCIntervalAction*>(CCSequence::actions(motion, motion->reverse(), NULL)) ) );
|
||||
m_root->runAction( action1 );
|
||||
}
|
||||
|
||||
void MotionStreakTest1::onUpdate(ccTime delta)
|
||||
{
|
||||
m_streak->setPosition( m_target->convertToWorldSpace(CGPointZero) );
|
||||
}
|
||||
|
||||
std::string MotionStreakTest1::title()
|
||||
{
|
||||
return "MotionStreak test 1";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// MotionStreakTest2
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void MotionStreakTest2::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
setIsTouchEnabled(true);
|
||||
|
||||
CGSize s = CCDirector::getSharedDirector()->getWinSize();
|
||||
|
||||
// create the streak object and add it to the scene
|
||||
m_streak = CCMotionStreak::streakWithFade(3, 3, s_streak, 64, 32, ccc4(255,255,255,255) );
|
||||
addChild( m_streak );
|
||||
|
||||
m_streak->setPosition( CGPointMake(s.width/2, s.height/2) );
|
||||
}
|
||||
|
||||
void MotionStreakTest2::ccTouchesMoved(NSSet* touches, UIEvent* event)
|
||||
{
|
||||
NSSetIterator it = touches->begin();
|
||||
CCTouch* touch = dynamic_cast<CCTouch*>(*it);
|
||||
|
||||
CGPoint touchLocation = touch->locationInView( touch->view() );
|
||||
touchLocation = CCDirector::getSharedDirector()->convertToGL( touchLocation );
|
||||
|
||||
m_streak->setPosition( touchLocation );
|
||||
}
|
||||
|
||||
std::string MotionStreakTest2::title()
|
||||
{
|
||||
return "MotionStreak test (tap screen)";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// MotionStreakTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// enum
|
||||
// {
|
||||
// IDC_NEXT = 100,
|
||||
// IDC_BACK,
|
||||
// IDC_RESTART
|
||||
// };
|
||||
|
||||
static int sceneIdx = -1;
|
||||
|
||||
#define MAX_LAYER 2
|
||||
|
||||
CCLayer* createMotionLayer(int nIndex)
|
||||
{
|
||||
switch(nIndex)
|
||||
{
|
||||
case 0: return new MotionStreakTest1();
|
||||
case 1: return new MotionStreakTest2();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCLayer* nextMotionAction()
|
||||
{
|
||||
sceneIdx++;
|
||||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
CCLayer* pLayer = createMotionLayer(sceneIdx);
|
||||
pLayer->autorelease();
|
||||
|
||||
return pLayer;
|
||||
}
|
||||
|
||||
CCLayer* backMotionAction()
|
||||
{
|
||||
sceneIdx--;
|
||||
int total = MAX_LAYER;
|
||||
if( sceneIdx < 0 )
|
||||
sceneIdx += total;
|
||||
|
||||
CCLayer* pLayer = createMotionLayer(sceneIdx);
|
||||
pLayer->autorelease();
|
||||
|
||||
return pLayer;
|
||||
}
|
||||
|
||||
CCLayer* restartMotionAction()
|
||||
{
|
||||
CCLayer* pLayer = createMotionLayer(sceneIdx);
|
||||
pLayer->autorelease();
|
||||
|
||||
return pLayer;
|
||||
}
|
||||
|
||||
|
||||
MotionStreakTest::MotionStreakTest(void)
|
||||
{
|
||||
}
|
||||
|
||||
MotionStreakTest::~MotionStreakTest(void)
|
||||
{
|
||||
}
|
||||
|
||||
std::string MotionStreakTest::title()
|
||||
{
|
||||
return "No title";
|
||||
}
|
||||
|
||||
void MotionStreakTest::onEnter()
|
||||
{
|
||||
__super::onEnter();
|
||||
|
||||
CGSize s = CCDirector::getSharedDirector()->getWinSize();
|
||||
|
||||
CCLabel* label = CCLabel::labelWithString(title().c_str(), "Arial", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition( CGPointMake(s.width/2, s.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(MotionStreakTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(MotionStreakTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2, this, menu_selector(MotionStreakTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition( CGPointZero );
|
||||
item1->setPosition( CGPointMake( s.width/2 - 100,30) );
|
||||
item2->setPosition( CGPointMake( s.width/2, 30) );
|
||||
item3->setPosition( CGPointMake( s.width/2 + 100,30) );
|
||||
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
void MotionStreakTest::restartCallback(NSObject* pSender)
|
||||
{
|
||||
CCScene* s = new MotionStreakTestScene();//CCScene::node();
|
||||
s->addChild(restartMotionAction());
|
||||
|
||||
CCDirector::getSharedDirector()->replaceScene(s);
|
||||
}
|
||||
|
||||
void MotionStreakTest::nextCallback(NSObject* pSender)
|
||||
{
|
||||
CCScene* s = new MotionStreakTestScene();//CCScene::node();
|
||||
s->addChild( nextMotionAction() );
|
||||
CCDirector::getSharedDirector()->replaceScene(s);
|
||||
}
|
||||
|
||||
void MotionStreakTest::backCallback(NSObject* pSender)
|
||||
{
|
||||
CCScene* s = new MotionStreakTestScene;//CCScene::node();
|
||||
s->addChild( backMotionAction() );
|
||||
CCDirector::getSharedDirector()->replaceScene(s);
|
||||
}
|
||||
|
||||
void MotionStreakTestScene::runThisTest()
|
||||
{
|
||||
CCLayer* pLayer = nextMotionAction();
|
||||
addChild(pLayer);
|
||||
|
||||
CCDirector::getSharedDirector()->replaceScene(this);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
#ifndef _MOTION_STREAK_TEST_H_
|
||||
#define _MOTION_STREAK_TEST_H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "../testBasic.h"
|
||||
|
||||
//using namespace cocos2d;
|
||||
|
||||
class MotionStreakTest : public CCLayer
|
||||
{
|
||||
public:
|
||||
MotionStreakTest(void);
|
||||
~MotionStreakTest(void);
|
||||
|
||||
virtual std::string title();
|
||||
virtual void onEnter();
|
||||
|
||||
void restartCallback(NSObject* pSender);
|
||||
void nextCallback(NSObject* pSender);
|
||||
void backCallback(NSObject* pSender);
|
||||
};
|
||||
|
||||
class MotionStreakTest1 : public MotionStreakTest
|
||||
{
|
||||
protected:
|
||||
CCNode* m_root;
|
||||
CCNode* m_target;
|
||||
CCMotionStreak* m_streak;
|
||||
|
||||
public:
|
||||
virtual void onEnter();
|
||||
void onUpdate(ccTime delta);
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class MotionStreakTest2 : public MotionStreakTest
|
||||
{
|
||||
protected:
|
||||
CCNode* m_root;
|
||||
CCNode* m_target;
|
||||
CCMotionStreak* m_streak;
|
||||
|
||||
public:
|
||||
virtual void onEnter();
|
||||
void ccTouchesMoved(NSSet* touches, UIEvent* event);
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class MotionStreakTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
//CCLayer* nextAction();
|
||||
|
||||
#endif
|
|
@ -25,6 +25,10 @@ static TestScene* CreateTestScene(int nIdx)
|
|||
pScene = new RotateWorldTestScene(); break;
|
||||
case TEST_PARTICLE:
|
||||
pScene = new ParticleTestScene(); break;
|
||||
case TEST_EASE_ACTIONS:
|
||||
pScene = new EaseActionsTestScene(); break;
|
||||
case TEST_MOTION_STREAK:
|
||||
pScene = new MotionStreakTestScene(); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ static const char s_stars1[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Imag
|
|||
static const char s_stars2[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/stars2.png";
|
||||
static const char s_fire[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/fire.png";
|
||||
static const char s_snow[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/snow.png";
|
||||
static const char s_streak[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/streak.png";
|
||||
// static const char s_star1_scale[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/stars.png";
|
||||
// static const char s_star2_scale[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/stars2.png";
|
||||
// static const char s_fire_scale[] = "/NEWPLUS/TDA_DATA/Data/cocos2d_tests/Images/fire.png";
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "ClickAndMoveTest/ClickAndMoveTest.h"
|
||||
#include "RotateWorldTest/RotateWorldTest.h"
|
||||
#include "ParticleTest/ParticleTest.h"
|
||||
#include "EaseActionsTest/EaseActionsTest.h"
|
||||
#include "MotionStreakTest/MotionStreakTest.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -18,6 +20,8 @@ enum
|
|||
TEST_CLICK_AND_MOVE,
|
||||
TEST_ROTATE_WORLD,
|
||||
TEST_PARTICLE,
|
||||
TEST_EASE_ACTIONS,
|
||||
TEST_MOTION_STREAK,
|
||||
// TEST_TEXTURE2D,
|
||||
// TEST_SPRITE,
|
||||
// TEST_LAYER,
|
||||
|
@ -38,6 +42,8 @@ const std::string g_aTestNames[TESTS_COUNT] = {
|
|||
"ClickAndMoveTest",
|
||||
"RotateWorldTest",
|
||||
"ParticleTest",
|
||||
"EaseActionsTest",
|
||||
"MotionStreakTest",
|
||||
// "Texture2dTest",
|
||||
// "SpriteTest",
|
||||
// "LayerTest",
|
||||
|
|
Loading…
Reference in New Issue