Merge branch 'gles20' of http://github.com/cocos2d/cocos2d-x into gles20

This commit is contained in:
Walzer 2012-05-05 10:07:21 +08:00
commit 6b374881f0
13 changed files with 226 additions and 209 deletions

View File

@ -1,23 +1,9 @@
#include "cocos2d.h"
#include "AppDelegate.h"
#include "SimpleAudioEngine.h"
#include "CCScriptSupport.h"
#include "CCLuaEngine.h"
#define IPAD 0
#if IPAD
#define CC_WIDTH 1024
#define CC_HEIGHT 768
#elif IPHONE_4
#define CC_WIDTH 960
#define CC_HEIGHT 640
#else
#define CC_WIDTH 480
#define CC_HEIGHT 320
#endif
USING_NS_CC;
using namespace CocosDenshion;
@ -56,23 +42,12 @@ bool AppDelegate::applicationDidFinishLaunching()
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
unsigned long size;
char *pFileContent = (char*)CCFileUtils::getFileData("hello.lua", "r", &size);
if (pFileContent)
CCString* pstrFileContent = CCString::stringWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pCodes = new char[size + 1];
pCodes[size] = '\0';
memcpy(pCodes, pFileContent, size);
delete[] pFileContent;
pEngine->executeString(pCodes);
delete []pCodes;
pEngine->executeString(pstrFileContent->getCString());
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
#else
std::string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
@ -85,16 +60,12 @@ bool AppDelegate::applicationDidFinishLaunching()
void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->pause();
// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->resume();
// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}

View File

@ -1,6 +1,6 @@
# set params
NDK_ROOT_LOCAL=/cygdrive/d/programe/android/ndk/android-ndk-r7b
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d-x
NDK_ROOT_LOCAL=/cygdrive/e/android/android-ndk-r8
COCOS2DX_ROOT_LOCAL=/cygdrive/f/Project/dumganhar/cocos2d-x
buildexternalsfromsource=

View File

@ -1,2 +0,0 @@
# Project target.
target=android-10

View File

@ -34,6 +34,9 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
}
else
{
ccDrawInit();
ccGLInvalidateStateCache();
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
CCTextureCache::reloadAllTextures();
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);

View File

@ -8,4 +8,4 @@
# project structure.
# Project target.
target=android-8
target=android-10

View File

@ -234,6 +234,11 @@ void CCEaseIn::update(ccTime time)
m_pOther->update(powf(time, m_fRate));
}
CCActionInterval* CCEaseIn::reverse(void)
{
return CCEaseIn::actionWithAction(m_pOther->reverse(), 1 / m_fRate);
}
//
// EaseOut
//
@ -281,6 +286,11 @@ void CCEaseOut::update(ccTime time)
m_pOther->update(powf(time, 1 / m_fRate));
}
CCActionInterval* CCEaseOut::reverse()
{
return CCEaseOut::actionWithAction(m_pOther->reverse(), 1 / m_fRate);
}
//
// EaseInOut
//
@ -325,14 +335,6 @@ CCObject* CCEaseInOut::copyWithZone(CCZone *pZone)
void CCEaseInOut::update(ccTime time)
{
int sign = 1;
int r = (int) m_fRate;
if (r % 2 == 0)
{
sign = -1;
}
time *= 2;
if (time < 1)
{
@ -340,7 +342,7 @@ void CCEaseInOut::update(ccTime time)
}
else
{
m_pOther->update(sign * 0.5f * (powf(time - 2, m_fRate) + sign * 2));
m_pOther->update(1.0f - 0.5f * powf(2-time, m_fRate));
}
}
@ -505,12 +507,17 @@ void CCEaseExponentialInOut::update(ccTime time)
}
else
{
time = 0.5f * (-powf(2, 10 * (time - 1)) + 2);
time = 0.5f * (-powf(2, -10 * (time - 1)) + 2);
}
m_pOther->update(time);
}
CCActionInterval* CCEaseExponentialInOut::reverse()
{
return CCEaseExponentialInOut::actionWithAction(m_pOther->reverse());
}
//
// EaseSineIn
//
@ -662,6 +669,11 @@ void CCEaseSineInOut::update(ccTime time)
m_pOther->update(-0.5f * (cosf((float)M_PI * time) - 1));
}
CCActionInterval* CCEaseSineInOut::reverse()
{
return CCEaseSineInOut::actionWithAction(m_pOther->reverse());
}
//
// EaseElastic
//
@ -740,7 +752,7 @@ CCObject* CCEaseElastic::copyWithZone(CCZone *pZone)
CCActionInterval* CCEaseElastic::reverse(void)
{
CCAssert(0, "");
CCAssert(0, "Override me");
return NULL;
}
@ -1002,7 +1014,7 @@ void CCEaseElasticInOut::update(ccTime time)
CCActionInterval* CCEaseElasticInOut::reverse(void)
{
return CCEaseInOut::actionWithAction(m_pOther->reverse(), m_fPeriod);
return CCEaseElasticInOut::actionWithAction(m_pOther->reverse(), m_fPeriod);
}
//
@ -1068,6 +1080,11 @@ ccTime CCEaseBounce::bounceTime(ccTime time)
return 7.5625f * time * time + 0.984375f;
}
CCActionInterval* CCEaseBounce::reverse()
{
return CCEaseBounce::actionWithAction(m_pOther->reverse());
}
//
// EaseBounceIn
//
@ -1232,6 +1249,11 @@ void CCEaseBounceInOut::update(ccTime time)
m_pOther->update(newT);
}
CCActionInterval* CCEaseBounceInOut::reverse()
{
return CCEaseBounceInOut::actionWithAction(m_pOther->reverse());
}
//
// EaseBackIn
//
@ -1398,4 +1420,9 @@ void CCEaseBackInOut::update(ccTime time)
}
}
CCActionInterval* CCEaseBackInOut::reverse()
{
return CCEaseBackInOut::actionWithAction(m_pOther->reverse());
}
NS_CC_END

View File

@ -92,6 +92,7 @@ class CC_DLL CCEaseIn : public CCEaseRateAction
{
public:
virtual void update(ccTime time);
virtual CCActionInterval* reverse(void);
virtual CCObject* copyWithZone(CCZone* pZone);
public:
/** Creates the action with the inner action and the rate parameter */
@ -105,6 +106,7 @@ class CC_DLL CCEaseOut : public CCEaseRateAction
{
public:
virtual void update(ccTime time);
virtual CCActionInterval* reverse();
virtual CCObject* copyWithZone(CCZone* pZone);
public:
@ -166,6 +168,7 @@ class CC_DLL CCEaseExponentialInOut : public CCActionEase
public:
virtual void update(ccTime time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
public:
/** creates the action */
@ -211,6 +214,7 @@ class CC_DLL CCEaseSineInOut : public CCActionEase
public:
virtual void update(ccTime time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
public:
/** creates the action */
@ -313,6 +317,7 @@ class CC_DLL CCEaseBounce : public CCActionEase
public:
ccTime bounceTime(ccTime time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
public:
/** creates the action */
@ -363,6 +368,7 @@ class CC_DLL CCEaseBounceInOut : public CCEaseBounce
public:
virtual void update(ccTime time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
public:
/** creates the action */
@ -413,6 +419,7 @@ class CC_DLL CCEaseBackInOut : public CCActionEase
public:
virtual void update(ccTime time);
virtual CCObject* copyWithZone(CCZone* pZone);
virtual CCActionInterval* reverse();
public:
/** creates the action */

View File

@ -76,9 +76,6 @@ CCObject* CCActionInterval::copyWithZone(CCZone *pZone)
}
else
{
// action's base class , must be called using __super::copyWithZone(), after overriding from derived class
CCAssert(0, "");
pCopy = new CCActionInterval();
pZone = pNewZone = new CCZone(pCopy);
}
@ -110,8 +107,12 @@ void CCActionInterval::step(ccTime dt)
m_elapsed += dt;
}
// update(min(1, m_elapsed/m_fDuration));
update(1 > m_elapsed/m_fDuration ? m_elapsed/m_fDuration : 1);
this->update(MAX (0, // needed for rewind. elapsed could be negative
MIN(1, m_elapsed /
MAX(m_fDuration, FLT_EPSILON) // division by 0
)
)
);
}
void CCActionInterval::setAmplitudeRate(CCFloat amp)
@ -138,13 +139,7 @@ void CCActionInterval::startWithTarget(CCNode *pTarget)
CCActionInterval* CCActionInterval::reverse(void)
{
/*
NSException* myException = [NSException
exceptionWithName:@"ReverseActionNotImplemented"
reason:@"Reverse Action not implemented"
userInfo:nil];
@throw myException;
*/
CCAssert(false, "CCIntervalAction: reverse not implemented.");
return NULL;
}

View File

@ -46,23 +46,12 @@ bool AppDelegate::applicationDidFinishLaunching()
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
unsigned long size;
char *pFileContent = (char*)CCFileUtils::getFileData("hello.lua", "r", &size);
if (pFileContent)
CCString* pstrFileContent = CCString::stringWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pCodes = new char[size + 1];
pCodes[size] = '\0';
memcpy(pCodes, pFileContent, size);
delete[] pFileContent;
pEngine->executeString(pCodes);
delete []pCodes;
pEngine->executeString(pstrFileContent->getCString());
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
#else
std::string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());

View File

@ -1,23 +1,9 @@
#include "cocos2d.h"
#include "AppDelegate.h"
#include "SimpleAudioEngine.h"
#include "CCScriptSupport.h"
#include "CCLuaEngine.h"
#define IPAD 0
#if IPAD
#define CC_WIDTH 1024
#define CC_HEIGHT 768
#elif IPHONE_4
#define CC_WIDTH 960
#define CC_HEIGHT 640
#else
#define CC_WIDTH 480
#define CC_HEIGHT 320
#endif
USING_NS_CC;
using namespace std;
using namespace CocosDenshion;
@ -57,23 +43,12 @@ bool AppDelegate::applicationDidFinishLaunching()
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
unsigned long size;
char *pFileContent = (char*)CCFileUtils::getFileData("hello.lua", "r", &size);
if (pFileContent)
CCString* pstrFileContent = CCString::stringWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pCodes = new char[size + 1];
pCodes[size] = '\0';
memcpy(pCodes, pFileContent, size);
delete[] pFileContent;
pEngine->executeString(pCodes);
delete []pCodes;
pEngine->executeString(pstrFileContent->getCString());
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
#else
string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());

View File

@ -16,24 +16,27 @@ CCLayer* restartEaseAction();
// SpriteEase
//
//------------------------------------------------------------------
#define CCCA(x) (x->copy()->autorelease())
void SpriteEase::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0) );
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130,0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = (CCActionInterval*)CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
CCActionInterval* move_ease_in = CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
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);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
CCAction *a2 = m_grossini->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
@ -45,7 +48,7 @@ void SpriteEase::onEnter()
CCAction *a = m_kathia->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq3));
a->setTag(1);
schedule(schedule_selector(SpriteEase::testStopAction), 6);
schedule(schedule_selector(SpriteEase::testStopAction), 6.25f);
}
void SpriteEase::testStopAction(ccTime dt)
@ -72,7 +75,9 @@ void SpriteEaseInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130,0));
// id move_back = move->reverse();
CCActionInterval* move_ease_inout1 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.65f);
@ -84,10 +89,11 @@ void SpriteEaseInOut::onEnter()
CCActionInterval* move_ease_inout3 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 1.0f);
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
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);
CCFiniteTimeAction* seq1 = CCSequence::actions( move_ease_inout1, delay, move_ease_inout_back1, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), NULL);
m_tamara->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
m_kathia->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq2));
@ -110,7 +116,9 @@ void SpriteEaseExponential::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130,0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseExponentialIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
@ -119,10 +127,11 @@ void SpriteEaseExponential::onEnter()
CCActionInterval* move_ease_out = CCEaseExponentialOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
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);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
@ -145,14 +154,18 @@ void SpriteEaseExponentialInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions( move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease, delay, move_ease_back, CCCA(delay), NULL);
this->positionForTwo();
@ -176,7 +189,9 @@ void SpriteEaseSine::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseSineIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
@ -185,10 +200,11 @@ void SpriteEaseSine::onEnter()
CCActionInterval* move_ease_out = CCEaseSineOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
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);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
@ -212,14 +228,18 @@ void SpriteEaseSineInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130,0));
CCActionInterval* move_back = move->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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
this->positionForTwo();
@ -241,7 +261,10 @@ std::string SpriteEaseSineInOut::title()
void SpriteEaseElastic::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseElasticIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
@ -250,9 +273,11 @@ void SpriteEaseElastic::onEnter()
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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2));
@ -275,7 +300,9 @@ void SpriteEaseElasticInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.3f);
CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
@ -286,10 +313,11 @@ void SpriteEaseElasticInOut::onEnter()
CCActionInterval* move_ease_inout3 = CCEaseElasticInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 0.6f);
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
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);
CCFiniteTimeAction* seq1 = CCSequence::actions(move_ease_inout1, delay, move_ease_inout_back1, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), NULL);
m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2));
@ -312,7 +340,10 @@ std::string SpriteEaseElasticInOut::title()
void SpriteEaseBounce::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseBounceIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
@ -321,9 +352,11 @@ void SpriteEaseBounce::onEnter()
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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2));
@ -347,14 +380,18 @@ void SpriteEaseBounceInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
this->positionForTwo();
@ -377,7 +414,10 @@ std::string SpriteEaseBounceInOut::title()
void SpriteEaseBack::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseBackIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()));
@ -386,9 +426,11 @@ void SpriteEaseBack::onEnter()
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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
m_tamara->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq2));
@ -410,14 +452,19 @@ std::string SpriteEaseBack::title()
void SpriteEaseBackInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->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);
CCDelayTime *delay = CCDelayTime::actionWithDuration(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::actions(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
this->positionForTwo();
@ -441,8 +488,10 @@ void SpeedTest::onEnter()
{
EaseSpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
// rotate and jump
CCActionInterval *jump1 = CCJumpBy::actionWithDuration(4, CCPointMake(-400,0), 100, 4);
CCActionInterval *jump1 = CCJumpBy::actionWithDuration(4, CCPointMake(-s.width+80, 0), 100, 4);
CCActionInterval *jump2 = jump1->reverse();
CCActionInterval *rot1 = CCRotateBy::actionWithDuration(4, 360*2);
CCActionInterval *rot2 = rot1->reverse();

View File

@ -26,6 +26,9 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
}
else
{
ccDrawInit();
ccGLInvalidateStateCache();
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
CCTextureCache::reloadAllTextures();
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);