mirror of https://github.com/axmolengine/axmol.git
commit
ea613be58a
|
@ -521,7 +521,7 @@ static BOOL _mixerRateSet = NO;
|
||||||
if (soundId >= bufferTotal) {
|
if (soundId >= bufferTotal) {
|
||||||
//Need to resize the buffers
|
//Need to resize the buffers
|
||||||
int requiredIncrement = CD_BUFFERS_INCREMENT;
|
int requiredIncrement = CD_BUFFERS_INCREMENT;
|
||||||
while (bufferTotal + requiredIncrement < soundId) {
|
while (bufferTotal + requiredIncrement <= soundId) {
|
||||||
requiredIncrement += CD_BUFFERS_INCREMENT;
|
requiredIncrement += CD_BUFFERS_INCREMENT;
|
||||||
}
|
}
|
||||||
CDLOGINFO(@"Denshion::CDSoundEngine - attempting to resize buffers by %i for sound %i",requiredIncrement,soundId);
|
CDLOGINFO(@"Denshion::CDSoundEngine - attempting to resize buffers by %i for sound %i",requiredIncrement,soundId);
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include "support/CCPointExtension.h"
|
#include "support/CCPointExtension.h"
|
||||||
#include "CCActionCatmullRom.h"
|
#include "CCActionCatmullRom.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
NS_CC_BEGIN;
|
NS_CC_BEGIN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -78,6 +80,7 @@ CCObject* CCPointArray::copyWithZone(cocos2d::CCZone *zone)
|
||||||
}
|
}
|
||||||
|
|
||||||
CCPointArray *points = CCPointArray::arrayWithCapacity(10);
|
CCPointArray *points = CCPointArray::arrayWithCapacity(10);
|
||||||
|
points->retain();
|
||||||
points->setControlPoints(newArray);
|
points->setControlPoints(newArray);
|
||||||
newArray->release();
|
newArray->release();
|
||||||
|
|
||||||
|
@ -91,14 +94,30 @@ CCPointArray::~CCPointArray()
|
||||||
|
|
||||||
CCPointArray::CCPointArray() :m_pControlPoints(NULL){}
|
CCPointArray::CCPointArray() :m_pControlPoints(NULL){}
|
||||||
|
|
||||||
void CCPointArray::addControlPoint(CCPoint &controlPoint)
|
void CCPointArray::addControlPoint(CCPoint controlPoint)
|
||||||
{
|
{
|
||||||
m_pControlPoints->addObject(&controlPoint);
|
// should create a new object of CCPoint
|
||||||
|
// because developer always use this function like this
|
||||||
|
// addControlPoint(ccp(x, y))
|
||||||
|
// passing controlPoint is a temple object
|
||||||
|
// and CCArray::addObject() will retain the passing object, so it
|
||||||
|
// should be an object created in heap
|
||||||
|
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
||||||
|
m_pControlPoints->addObject(temp);
|
||||||
|
temp->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPointArray::insertControlPoint(CCPoint &controlPoint, unsigned int index)
|
void CCPointArray::insertControlPoint(CCPoint &controlPoint, unsigned int index)
|
||||||
{
|
{
|
||||||
m_pControlPoints->insertObject(&controlPoint, index);
|
// should create a new object of CCPoint
|
||||||
|
// because developer always use this function like this
|
||||||
|
// insertControlPoint(ccp(x, y))
|
||||||
|
// passing controlPoint is a temple object
|
||||||
|
// and CCArray::insertObject() will retain the passing object, so it
|
||||||
|
// should be an object created in heap
|
||||||
|
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
||||||
|
m_pControlPoints->insertObject(temp, index);
|
||||||
|
temp->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCPoint CCPointArray::getControlPointAtIndex(unsigned int index)
|
CCPoint CCPointArray::getControlPointAtIndex(unsigned int index)
|
||||||
|
@ -111,7 +130,15 @@ CCPoint CCPointArray::getControlPointAtIndex(unsigned int index)
|
||||||
|
|
||||||
void CCPointArray::replaceControlPoint(cocos2d::CCPoint &controlPoint, unsigned int index)
|
void CCPointArray::replaceControlPoint(cocos2d::CCPoint &controlPoint, unsigned int index)
|
||||||
{
|
{
|
||||||
m_pControlPoints->replaceObjectAtIndex(index, &controlPoint);
|
// should create a new object of CCPoint
|
||||||
|
// because developer always use this function like this
|
||||||
|
// replaceControlPoint(ccp(x, y))
|
||||||
|
// passing controlPoint is a temple object
|
||||||
|
// and CCArray::insertObject() will retain the passing object, so it
|
||||||
|
// should be an object created in heap
|
||||||
|
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
||||||
|
m_pControlPoints->replaceObjectAtIndex(index, temp);
|
||||||
|
temp->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPointArray::removeControlPointAtIndex(unsigned int index)
|
void CCPointArray::removeControlPointAtIndex(unsigned int index)
|
||||||
|
@ -136,7 +163,6 @@ CCPointArray* CCPointArray::reverse()
|
||||||
|
|
||||||
newArray->release();
|
newArray->release();
|
||||||
|
|
||||||
config->autorelease();
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
bool initWithCapacity(unsigned int capacity);
|
bool initWithCapacity(unsigned int capacity);
|
||||||
|
|
||||||
/** appends a control point */
|
/** appends a control point */
|
||||||
void addControlPoint(CCPoint &controlPoint);
|
void addControlPoint(CCPoint controlPoint);
|
||||||
|
|
||||||
/** inserts a controlPoint at index */
|
/** inserts a controlPoint at index */
|
||||||
void insertControlPoint(CCPoint &controlPoint, unsigned int index);
|
void insertControlPoint(CCPoint &controlPoint, unsigned int index);
|
||||||
|
|
|
@ -85,7 +85,7 @@ default gl blend src function. Compatible with premultiplied alpha images.
|
||||||
#define CC_NODE_DRAW_SETUP() \
|
#define CC_NODE_DRAW_SETUP() \
|
||||||
do { \
|
do { \
|
||||||
ccGLEnable( m_glServerState ); \
|
ccGLEnable( m_glServerState ); \
|
||||||
CCAssert(getShaderProgram(), "No shader program set for node: %p", this); \
|
CCAssert(getShaderProgram(), "No shader program set for this node"); \
|
||||||
{ \
|
{ \
|
||||||
getShaderProgram()->use(); \
|
getShaderProgram()->use(); \
|
||||||
getShaderProgram()->setUniformForModelViewProjectionMatrix(); \
|
getShaderProgram()->setUniformForModelViewProjectionMatrix(); \
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
b77ecad7976dbe21bb61300c73e06ddbad3a4bd8
|
c16d1dddb12b5a7e7e715f234dfd031657369f96
|
|
@ -99,9 +99,9 @@ void ActionManagerTest::onEnter()
|
||||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||||
|
|
||||||
menu->setPosition(CCPointZero);
|
menu->setPosition(CCPointZero);
|
||||||
item1->setPosition( CCPointMake( s.width/2 - 100,30) );
|
item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
item2->setPosition( CCPointMake( s.width/2, 30) );
|
item2->setPosition(CCPointMake(s.width/2, item2->getContentSize().height/2));
|
||||||
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
|
item3->setPosition(CCPointMake(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
|
|
||||||
addChild(menu, 1);
|
addChild(menu, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,8 +617,10 @@ EaseSpriteDemo::~EaseSpriteDemo(void)
|
||||||
|
|
||||||
void EaseSpriteDemo::positionForTwo()
|
void EaseSpriteDemo::positionForTwo()
|
||||||
{
|
{
|
||||||
m_grossini->setPosition( CCPointMake( 60, 120 ) );
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
m_tamara->setPosition( CCPointMake( 60, 220) );
|
|
||||||
|
m_grossini->setPosition(CCPointMake(60, s.height*1/5));
|
||||||
|
m_tamara->setPosition(CCPointMake( 60, s.height*4/5));
|
||||||
m_kathia->setIsVisible(false);
|
m_kathia->setIsVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,9 +645,9 @@ void EaseSpriteDemo::onEnter()
|
||||||
|
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
m_grossini->setPosition( CCPointMake(60, 50) );
|
m_grossini->setPosition(CCPointMake(60, s.height*1/5));
|
||||||
m_kathia->setPosition( CCPointMake(60, 150) );
|
m_kathia->setPosition(CCPointMake(60, s.height*2.5f/5));
|
||||||
m_tamara->setPosition( CCPointMake(60, 250) );
|
m_tamara->setPosition(CCPointMake(60, s.height*4/5));
|
||||||
|
|
||||||
CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 32);
|
CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 32);
|
||||||
addChild(label);
|
addChild(label);
|
||||||
|
@ -658,9 +660,9 @@ void EaseSpriteDemo::onEnter()
|
||||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||||
|
|
||||||
menu->setPosition(CCPointZero);
|
menu->setPosition(CCPointZero);
|
||||||
item1->setPosition( CCPointMake( s.width/2 - 100,30) );
|
item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
item2->setPosition( CCPointMake( s.width/2, 30) );
|
item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2));
|
||||||
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
|
item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
|
|
||||||
addChild(menu, 1);
|
addChild(menu, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,9 +112,9 @@ void SpriteDemo::onEnter()
|
||||||
|
|
||||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||||
menu->setPosition(CCPointZero);
|
menu->setPosition(CCPointZero);
|
||||||
item1->setPosition( CCPointMake( s.width/2 - 100,30) );
|
item1->setPosition(CCPointMake( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
item2->setPosition( CCPointMake( s.width/2, 30) );
|
item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2));
|
||||||
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
|
item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
addChild(menu, 1);
|
addChild(menu, 1);
|
||||||
|
|
||||||
CCLayerColor *background = CCLayerColor::layerWithColor(ccc4(255,0,0,255));
|
CCLayerColor *background = CCLayerColor::layerWithColor(ccc4(255,0,0,255));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "ActionsTest.h"
|
#include "ActionsTest.h"
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
#include "CCActionCatmullRom.h"
|
||||||
|
|
||||||
CCLayer* NextAction();
|
CCLayer* NextAction();
|
||||||
CCLayer* BackAction();
|
CCLayer* BackAction();
|
||||||
|
@ -79,6 +80,13 @@ CCLayer* CreateLayer(int nIndex)
|
||||||
pLayer = new Issue1288_2(); break;
|
pLayer = new Issue1288_2(); break;
|
||||||
case ACTION_ISSUE1327_LAYER:
|
case ACTION_ISSUE1327_LAYER:
|
||||||
pLayer = new Issue1327(); break;
|
pLayer = new Issue1327(); break;
|
||||||
|
case ACTION_CARDINALSPLINE_LAYER:
|
||||||
|
pLayer = new ActionCardinalSpline(); break;
|
||||||
|
case ACTION_CATMULLROM_LAYER:
|
||||||
|
pLayer = new ActionCatmullRom(); break;
|
||||||
|
case PAUSERESUMEACTIONS_LAYER:
|
||||||
|
pLayer = new PauseResumeActions(); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -184,9 +192,9 @@ void ActionsDemo::onEnter()
|
||||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, NULL);
|
||||||
|
|
||||||
menu->setPosition(CCPointZero);
|
menu->setPosition(CCPointZero);
|
||||||
item1->setPosition( CCPointMake( s.width/2 - 100,30) );
|
item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
item2->setPosition( CCPointMake( s.width/2, 30) );
|
item2->setPosition(CCPointMake(s.width/2, item2->getContentSize().height/2));
|
||||||
item3->setPosition( CCPointMake( s.width/2 + 100,30) );
|
item3->setPosition(CCPointMake(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2));
|
||||||
|
|
||||||
addChild(menu, 1);
|
addChild(menu, 1);
|
||||||
}
|
}
|
||||||
|
@ -1441,3 +1449,219 @@ void Issue1327::logSprRotation(CCNode* pSender)
|
||||||
CCLog("%f", ((CCSprite*)pSender)->getRotation());
|
CCLog("%f", ((CCSprite*)pSender)->getRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ActionCatmullRom
|
||||||
|
*/
|
||||||
|
void ActionCatmullRom::onEnter()
|
||||||
|
{
|
||||||
|
ActionsDemo::onEnter();
|
||||||
|
|
||||||
|
this->centerSprites(2);
|
||||||
|
|
||||||
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
|
//
|
||||||
|
// sprite 1 (By)
|
||||||
|
//
|
||||||
|
// startPosition can be any coordinate, but since the movement
|
||||||
|
// is relative to the Catmull Rom curve, it is better to start with (0,0).
|
||||||
|
//
|
||||||
|
|
||||||
|
m_tamara->setPosition(ccp(50, 50));
|
||||||
|
|
||||||
|
CCPointArray *array = CCPointArray::arrayWithCapacity(20);
|
||||||
|
|
||||||
|
array->addControlPoint(ccp(0, 0));
|
||||||
|
array->addControlPoint(ccp(80, 80));
|
||||||
|
array->addControlPoint(ccp(s.width - 80, 80));
|
||||||
|
array->addControlPoint(ccp(s.width - 80, s.height - 80));
|
||||||
|
array->addControlPoint(ccp(80, s.height - 80));
|
||||||
|
array->addControlPoint(ccp(80, 80));
|
||||||
|
array->addControlPoint(ccp(s.width / 2, s.height / 2));
|
||||||
|
|
||||||
|
CCCatmullRomBy *action = CCCatmullRomBy::actionWithDuration(3, array);
|
||||||
|
CCFiniteTimeAction *reverse = action->reverse();
|
||||||
|
|
||||||
|
CCFiniteTimeAction *seq = CCSequence::actions(action, reverse, NULL);
|
||||||
|
|
||||||
|
m_tamara->runAction(seq);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// sprite 2 (To)
|
||||||
|
//
|
||||||
|
// The startPosition is not important here, because it uses a "To" action.
|
||||||
|
// The initial position will be the 1st point of the Catmull Rom path
|
||||||
|
//
|
||||||
|
|
||||||
|
CCPointArray *array2 = CCPointArray::arrayWithCapacity(20);
|
||||||
|
|
||||||
|
array2->addControlPoint(ccp(s.width / 2, 30));
|
||||||
|
array2->addControlPoint(ccp(s.width -80, 30));
|
||||||
|
array2->addControlPoint(ccp(s.width - 80, s.height - 80));
|
||||||
|
array2->addControlPoint(ccp(s.width / 2, s.height - 80));
|
||||||
|
array2->addControlPoint(ccp(s.width / 2, 30));
|
||||||
|
|
||||||
|
CCCatmullRomTo *action2 = CCCatmullRomTo::actionWithDuration(3, array2);
|
||||||
|
CCFiniteTimeAction *reverse2 = action2->reverse();
|
||||||
|
|
||||||
|
CCFiniteTimeAction *seq2 = CCSequence::actions(action2, reverse2, NULL);
|
||||||
|
|
||||||
|
m_kathia->runAction(seq2);
|
||||||
|
|
||||||
|
m_pArray1 = array;
|
||||||
|
m_pArray1->retain();
|
||||||
|
m_pArray2 = array2;
|
||||||
|
m_pArray2->retain();
|
||||||
|
}
|
||||||
|
|
||||||
|
ActionCatmullRom::~ActionCatmullRom()
|
||||||
|
{
|
||||||
|
m_pArray1->release();
|
||||||
|
m_pArray2->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionCatmullRom::draw()
|
||||||
|
{
|
||||||
|
ActionsDemo::draw();
|
||||||
|
|
||||||
|
// move to 50,50 since the "by" path will start at 50,50
|
||||||
|
kmGLPushMatrix();
|
||||||
|
kmGLTranslatef(50, 50, 0);
|
||||||
|
ccDrawCatmullRom(m_pArray1, 50);
|
||||||
|
kmGLPopMatrix();
|
||||||
|
|
||||||
|
ccDrawCatmullRom(m_pArray2,50);
|
||||||
|
}
|
||||||
|
|
||||||
|
string ActionCatmullRom::title()
|
||||||
|
{
|
||||||
|
return "CatmullRomBy / CatmullRomTo";
|
||||||
|
}
|
||||||
|
|
||||||
|
string ActionCatmullRom::subtitle()
|
||||||
|
{
|
||||||
|
return "Catmull Rom spline paths. Testing reverse too";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ActionCardinalSpline
|
||||||
|
*/
|
||||||
|
void ActionCardinalSpline::onEnter()
|
||||||
|
{
|
||||||
|
ActionsDemo::onEnter();
|
||||||
|
|
||||||
|
this->centerSprites(2);
|
||||||
|
|
||||||
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
|
CCPointArray *array = CCPointArray::arrayWithCapacity(20);
|
||||||
|
|
||||||
|
array->addControlPoint(ccp(0, 0));
|
||||||
|
array->addControlPoint(ccp(s.width/2-30, 0));
|
||||||
|
array->addControlPoint(ccp(s.width/2-30, s.height-80));
|
||||||
|
array->addControlPoint(ccp(0, s.height-80));
|
||||||
|
array->addControlPoint(ccp(0, 0));
|
||||||
|
|
||||||
|
//
|
||||||
|
// sprite 1 (By)
|
||||||
|
//
|
||||||
|
// Spline with no tension (tension==0)
|
||||||
|
//
|
||||||
|
|
||||||
|
CCCardinalSplineBy *action = CCCardinalSplineBy::actionWithDuration(3, array, 0);
|
||||||
|
CCActionInterval *reverse = action->reverse();
|
||||||
|
|
||||||
|
CCFiniteTimeAction *seq = CCSequence::actions(action, reverse, NULL);
|
||||||
|
|
||||||
|
m_tamara->setPosition(ccp(50, 50));
|
||||||
|
m_tamara->runAction(seq);
|
||||||
|
|
||||||
|
//
|
||||||
|
// sprite 2 (By)
|
||||||
|
//
|
||||||
|
// Spline with high tension (tension==1)
|
||||||
|
//
|
||||||
|
|
||||||
|
CCCardinalSplineBy *action2 = CCCardinalSplineBy::actionWithDuration(3, array, 1);
|
||||||
|
CCActionInterval *reverse2 = action2->reverse();
|
||||||
|
|
||||||
|
CCFiniteTimeAction *seq2 = CCSequence::actions(action2, reverse2, NULL);
|
||||||
|
|
||||||
|
m_kathia->setPosition(ccp(s.width/2, 50));
|
||||||
|
m_kathia->runAction(seq2);
|
||||||
|
|
||||||
|
m_pArray = array;
|
||||||
|
array->retain();
|
||||||
|
}
|
||||||
|
|
||||||
|
ActionCardinalSpline::~ActionCardinalSpline()
|
||||||
|
{
|
||||||
|
m_pArray->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionCardinalSpline::draw()
|
||||||
|
{
|
||||||
|
ActionsDemo::draw();
|
||||||
|
|
||||||
|
// move to 50,50 since the "by" path will start at 50,50
|
||||||
|
kmGLPushMatrix();
|
||||||
|
kmGLTranslatef(50, 50, 0);
|
||||||
|
ccDrawCardinalSpline(m_pArray, 0, 100);
|
||||||
|
kmGLPopMatrix();
|
||||||
|
|
||||||
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
|
kmGLPushMatrix();
|
||||||
|
kmGLTranslatef(s.width/2, 50, 0);
|
||||||
|
ccDrawCardinalSpline(m_pArray, 1, 100);
|
||||||
|
kmGLPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
string ActionCardinalSpline::title()
|
||||||
|
{
|
||||||
|
return "CardinalSplineBy / CardinalSplineAt";
|
||||||
|
}
|
||||||
|
|
||||||
|
string ActionCardinalSpline::subtitle()
|
||||||
|
{
|
||||||
|
return "Cardinal Spline paths. Testing different tensions for one array";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PauseResumeActions
|
||||||
|
*/
|
||||||
|
void PauseResumeActions::onEnter()
|
||||||
|
{
|
||||||
|
ActionsDemo::onEnter();
|
||||||
|
|
||||||
|
this->centerSprites(2);
|
||||||
|
|
||||||
|
m_tamara->runAction(CCRepeatForever::actionWithAction(CCRotateBy::actionWithDuration(3, 360)));
|
||||||
|
m_grossini->runAction(CCRepeatForever::actionWithAction(CCRotateBy::actionWithDuration(3, -360)));
|
||||||
|
m_kathia->runAction(CCRepeatForever::actionWithAction(CCRotateBy::actionWithDuration(3, 360)));
|
||||||
|
|
||||||
|
this->schedule(schedule_selector(PauseResumeActions::pause), 3, false, 0);
|
||||||
|
this->schedule(schedule_selector(PauseResumeActions::resume), 5, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
string PauseResumeActions::title()
|
||||||
|
{
|
||||||
|
return "PauseResumeActions";
|
||||||
|
}
|
||||||
|
|
||||||
|
string PauseResumeActions::subtitle()
|
||||||
|
{
|
||||||
|
return "All actions pause at 3s and resume at 5s";
|
||||||
|
}
|
||||||
|
|
||||||
|
void PauseResumeActions::pause(float dt)
|
||||||
|
{
|
||||||
|
CCLog("Pausing");
|
||||||
|
CCDirector *director = CCDirector::sharedDirector();
|
||||||
|
this->m_pPausedTargets = director->getActionManager()->pauseAlllRunningActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PauseResumeActions::resume(float dt)
|
||||||
|
{
|
||||||
|
CCLog("Resuming");
|
||||||
|
CCDirector *director = CCDirector::sharedDirector();
|
||||||
|
director->getActionManager()->resumeTargets(this->m_pPausedTargets);
|
||||||
|
}
|
|
@ -16,6 +16,8 @@ enum
|
||||||
ACTION_SKEW_LAYER,
|
ACTION_SKEW_LAYER,
|
||||||
ACTION_SKEWROTATE_LAYER,
|
ACTION_SKEWROTATE_LAYER,
|
||||||
ACTION_JUMP_LAYER,
|
ACTION_JUMP_LAYER,
|
||||||
|
ACTION_CARDINALSPLINE_LAYER,
|
||||||
|
ACTION_CATMULLROM_LAYER,
|
||||||
ACTION_BEZIER_LAYER,
|
ACTION_BEZIER_LAYER,
|
||||||
ACTION_BLINK_LAYER,
|
ACTION_BLINK_LAYER,
|
||||||
ACTION_FADE_LAYER,
|
ACTION_FADE_LAYER,
|
||||||
|
@ -37,6 +39,7 @@ enum
|
||||||
ACTION_ORBIT_LAYER,
|
ACTION_ORBIT_LAYER,
|
||||||
ACTION_FLLOW_LAYER,
|
ACTION_FLLOW_LAYER,
|
||||||
ACTION_TARGETED_LAYER,
|
ACTION_TARGETED_LAYER,
|
||||||
|
PAUSERESUMEACTIONS_LAYER,
|
||||||
ACTION_ISSUE1305_LAYER,
|
ACTION_ISSUE1305_LAYER,
|
||||||
ACTION_ISSUE1305_2_LAYER,
|
ACTION_ISSUE1305_2_LAYER,
|
||||||
ACTION_ISSUE1288_LAYER,
|
ACTION_ISSUE1288_LAYER,
|
||||||
|
@ -334,4 +337,44 @@ public:
|
||||||
void logSprRotation(CCNode* pSender);
|
void logSprRotation(CCNode* pSender);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ActionCatmullRom : public ActionsDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
~ActionCatmullRom();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual void draw();
|
||||||
|
virtual std::string subtitle();
|
||||||
|
virtual std::string title();
|
||||||
|
private:
|
||||||
|
CCPointArray *m_pArray1;
|
||||||
|
CCPointArray *m_pArray2;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ActionCardinalSpline : public ActionsDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
~ActionCardinalSpline();
|
||||||
|
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual void draw();
|
||||||
|
virtual std::string subtitle();
|
||||||
|
virtual std::string title();
|
||||||
|
private:
|
||||||
|
CCPointArray *m_pArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PauseResumeActions : public ActionsDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void onEnter();
|
||||||
|
virtual std::string subtitle();
|
||||||
|
virtual std::string title();
|
||||||
|
|
||||||
|
void pause(float dt);
|
||||||
|
void resume(float dt);
|
||||||
|
private:
|
||||||
|
CCSet *m_pPausedTargets;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue