2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2012-09-24 21:22:20 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ACTION_CCINTERVAL_ACTION_H__
|
|
|
|
#define __ACTION_CCINTERVAL_ACTION_H__
|
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "2d/CCNode.h"
|
|
|
|
#include "2d/CCAction.h"
|
|
|
|
#include "2d/CCProtocols.h"
|
|
|
|
#include "2d/CCSpriteFrame.h"
|
2013-10-14 14:01:00 +08:00
|
|
|
#include "CCAnimation.h"
|
2014-04-27 01:35:57 +08:00
|
|
|
#include "base/CCVector.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup actions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/**
|
|
|
|
@brief An interval action is an action that takes place within a certain period of time.
|
2010-08-06 10:51:40 +08:00
|
|
|
It has an start time, and a finish time. The finish time is the parameter
|
|
|
|
duration plus the start time.
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
These ActionInterval actions have some interesting properties, like:
|
2012-04-19 14:35:52 +08:00
|
|
|
- They can run normally (default)
|
|
|
|
- They can run reversed with the reverse method
|
|
|
|
- They can run with the time altered with the Accelerate, AccelDeccel and Speed actions.
|
2010-08-06 10:51:40 +08:00
|
|
|
|
|
|
|
For example, you can simulate a Ping Pong effect running the action normally and
|
|
|
|
then running it again in Reverse mode.
|
|
|
|
|
|
|
|
Example:
|
2010-09-28 16:18:05 +08:00
|
|
|
|
2013-12-18 17:47:20 +08:00
|
|
|
Action *pingPongAction = Sequence::actions(action, action->reverse(), nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL ActionInterval : public FiniteTimeAction
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** how many seconds had elapsed since the actions started to run. */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getElapsed(void) { return _elapsed; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//extension in GridAction
|
2012-08-01 15:30:12 +08:00
|
|
|
void setAmplitudeRate(float amp);
|
|
|
|
float getAmplitudeRate(void);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual bool isDone(void) const override;
|
|
|
|
virtual void step(float dt) override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual ActionInterval* reverse() const override = 0;
|
|
|
|
virtual ActionInterval *clone() const override = 0;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
|
|
|
bool initWithDuration(float d);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
float _elapsed;
|
|
|
|
bool _firstTick;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief Runs actions sequentially, one after another
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Sequence : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** helper constructor to create an array of sequenceable actions */
|
2014-04-20 00:25:54 +08:00
|
|
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
2014-03-25 06:09:24 +08:00
|
|
|
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported
|
|
|
|
typedef FiniteTimeAction* M;
|
|
|
|
static Sequence* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); }
|
|
|
|
static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); }
|
|
|
|
|
|
|
|
// On WP8 for variable argument lists longer than 10 items, use the other create functions or variadicCreate with NULL as the last argument
|
|
|
|
static Sequence* variadicCreate(FiniteTimeAction* item, ...);
|
|
|
|
#else
|
2013-12-18 17:47:20 +08:00
|
|
|
static Sequence* create(FiniteTimeAction *action1, ...) CC_REQUIRES_NULL_TERMINATION;
|
2014-03-25 06:09:24 +08:00
|
|
|
#endif
|
|
|
|
|
2013-09-13 11:41:20 +08:00
|
|
|
/** helper constructor to create an array of sequenceable actions given an array
|
|
|
|
* @code
|
|
|
|
* When this funtion bound to the js or lua,the input params changed
|
|
|
|
* in js :var create(var object1,var object2, ...)
|
|
|
|
* in lua :local create(local object1,local object2, ...)
|
|
|
|
* @endcode
|
|
|
|
*/
|
2013-11-28 11:04:39 +08:00
|
|
|
static Sequence* create(const Vector<FiniteTimeAction*>& arrayOfActions);
|
2012-11-15 17:16:51 +08:00
|
|
|
/** helper constructor to create an array of sequence-able actions */
|
2013-12-18 17:47:20 +08:00
|
|
|
static Sequence* createWithVariableList(FiniteTimeAction *action1, va_list args);
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
static Sequence* createWithTwoActions(FiniteTimeAction *actionOne, FiniteTimeAction *actionTwo);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual Sequence* clone() const override;
|
|
|
|
virtual Sequence* reverse() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop(void) override;
|
|
|
|
virtual void update(float t) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
Sequence() {}
|
|
|
|
virtual ~Sequence(void);
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
|
|
|
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-20 14:13:12 +08:00
|
|
|
FiniteTimeAction *_actions[2];
|
2013-06-15 14:03:30 +08:00
|
|
|
float _split;
|
|
|
|
int _last;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief Repeats an action a number of times.
|
2013-06-20 14:13:12 +08:00
|
|
|
* To repeat an action forever use the RepeatForever action.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Repeat : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
2013-12-18 17:47:20 +08:00
|
|
|
static Repeat* create(FiniteTimeAction *action, unsigned int times);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-12-18 17:47:20 +08:00
|
|
|
inline void setInnerAction(FiniteTimeAction *action)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-12-18 17:47:20 +08:00
|
|
|
if (_innerAction != action)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-12-18 17:47:20 +08:00
|
|
|
CC_SAFE_RETAIN(action);
|
2013-06-15 14:03:30 +08:00
|
|
|
CC_SAFE_RELEASE(_innerAction);
|
2013-12-18 17:47:20 +08:00
|
|
|
_innerAction = action;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inline FiniteTimeAction* getInnerAction()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
return _innerAction;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual Repeat* clone() const override;
|
|
|
|
virtual Repeat* reverse() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop(void) override;
|
|
|
|
virtual void update(float dt) override;
|
|
|
|
virtual bool isDone(void) const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
Repeat() {}
|
|
|
|
virtual ~Repeat();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
|
|
|
bool initWithAction(FiniteTimeAction *pAction, unsigned int times);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _times;
|
|
|
|
unsigned int _total;
|
|
|
|
float _nextDt;
|
|
|
|
bool _actionInstant;
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Inner action */
|
2013-06-20 14:13:12 +08:00
|
|
|
FiniteTimeAction *_innerAction;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief Repeats an action for ever.
|
2010-08-28 18:00:38 +08:00
|
|
|
To repeat the an action for a limited number of times use the Repeat action.
|
|
|
|
@warning This action can't be Sequenceable because it is not an IntervalAction
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL RepeatForever : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
static RepeatForever* create(ActionInterval *action);
|
2013-07-08 23:05:47 +08:00
|
|
|
|
2013-12-18 17:47:20 +08:00
|
|
|
inline void setInnerAction(ActionInterval *action)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-12-18 17:47:20 +08:00
|
|
|
if (_innerAction != action)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
CC_SAFE_RELEASE(_innerAction);
|
2013-12-18 17:47:20 +08:00
|
|
|
_innerAction = action;
|
2013-06-15 14:03:30 +08:00
|
|
|
CC_SAFE_RETAIN(_innerAction);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
inline ActionInterval* getInnerAction()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
return _innerAction;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual RepeatForever* clone() const override;
|
|
|
|
virtual RepeatForever* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node* target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void step(float dt) override;
|
|
|
|
virtual bool isDone(void) const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
RepeatForever()
|
|
|
|
: _innerAction(nullptr)
|
|
|
|
{}
|
|
|
|
virtual ~RepeatForever();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithAction(ActionInterval *action);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Inner action */
|
2013-06-20 14:13:12 +08:00
|
|
|
ActionInterval *_innerAction;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief Spawn a new action immediately
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Spawn : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-09-13 11:41:20 +08:00
|
|
|
/** helper constructor to create an array of spawned actions
|
|
|
|
* @code
|
|
|
|
* When this funtion bound to the js or lua,the input params changed
|
|
|
|
* in js :var create(var object1,var object2, ...)
|
|
|
|
* in lua :local create(local object1,local object2, ...)
|
|
|
|
* @endcode
|
|
|
|
*/
|
2014-04-20 00:25:54 +08:00
|
|
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
2014-03-25 06:09:24 +08:00
|
|
|
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported
|
|
|
|
typedef FiniteTimeAction* M;
|
|
|
|
static Spawn* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); }
|
|
|
|
static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); }
|
|
|
|
|
|
|
|
// On WP8 for variable argument lists longer than 10 items, use the other create functions or createSpawn with NULL as the last argument
|
|
|
|
static Spawn* variadicCreate(FiniteTimeAction* item, ...);
|
|
|
|
#else
|
2013-12-18 17:47:20 +08:00
|
|
|
static Spawn* create(FiniteTimeAction *action1, ...) CC_REQUIRES_NULL_TERMINATION;
|
2014-03-25 06:09:24 +08:00
|
|
|
#endif
|
2013-07-16 03:43:22 +08:00
|
|
|
|
2012-11-15 17:16:51 +08:00
|
|
|
/** helper constructor to create an array of spawned actions */
|
2013-12-18 17:47:20 +08:00
|
|
|
static Spawn* createWithVariableList(FiniteTimeAction *action1, va_list args);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-09-17 15:02:24 +08:00
|
|
|
/** helper constructor to create an array of spawned actions given an array */
|
2013-11-28 11:04:39 +08:00
|
|
|
static Spawn* create(const Vector<FiniteTimeAction*>& arrayOfActions);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** creates the Spawn action */
|
2013-12-18 17:47:20 +08:00
|
|
|
static Spawn* createWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual Spawn* clone() const override;
|
|
|
|
virtual Spawn* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop(void) override;
|
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
Spawn() {}
|
|
|
|
virtual ~Spawn();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the Spawn action with the 2 actions to spawn */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-20 14:13:12 +08:00
|
|
|
FiniteTimeAction *_one;
|
|
|
|
FiniteTimeAction *_two;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Rotates a Node object to a certain angle by modifying it's
|
2010-08-06 10:51:40 +08:00
|
|
|
rotation attribute.
|
|
|
|
The direction will be decided by the shortest angle.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL RotateTo : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action with separate rotation angles */
|
2013-12-18 17:47:20 +08:00
|
|
|
static RotateTo* create(float duration, float deltaAngleX, float deltaAngleY);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
2012-11-15 17:16:51 +08:00
|
|
|
/** creates the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
static RotateTo* create(float duration, float deltaAngle);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual RotateTo* clone() const override;
|
|
|
|
virtual RotateTo* reverse() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2012-11-15 17:16:51 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
RotateTo() {}
|
|
|
|
virtual ~RotateTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithDuration(float duration, float deltaAngle);
|
|
|
|
bool initWithDuration(float duration, float deltaAngleX, float deltaAngleY);
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _dstAngleX;
|
|
|
|
float _startAngleX;
|
|
|
|
float _diffAngleX;
|
2012-11-15 17:16:51 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
float _dstAngleY;
|
|
|
|
float _startAngleY;
|
|
|
|
float _diffAngleY;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL RotateBy : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-11-15 17:16:51 +08:00
|
|
|
/** creates the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
static RotateBy* create(float duration, float deltaAngle);
|
2014-02-23 11:16:42 +08:00
|
|
|
static RotateBy* create(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
2014-04-02 15:06:16 +08:00
|
|
|
static RotateBy* create(float duration, const Vector3& deltaAngle3D);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Override
|
|
|
|
//
|
|
|
|
virtual RotateBy* clone() const override;
|
|
|
|
virtual RotateBy* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2012-11-15 17:16:51 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2014-02-23 11:16:42 +08:00
|
|
|
RotateBy();
|
2013-11-22 09:06:06 +08:00
|
|
|
virtual ~RotateBy() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithDuration(float duration, float deltaAngle);
|
2014-02-23 11:16:42 +08:00
|
|
|
bool initWithDuration(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
2014-04-02 15:06:16 +08:00
|
|
|
bool initWithDuration(float duration, const Vector3& deltaAngle3D);
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
protected:
|
2014-02-23 11:16:42 +08:00
|
|
|
float _angleZ_X;
|
|
|
|
float _startAngleZ_X;
|
|
|
|
float _angleZ_Y;
|
|
|
|
float _startAngleZ_Y;
|
|
|
|
|
|
|
|
bool _is3D;
|
2014-04-02 15:06:16 +08:00
|
|
|
Vector3 _angle3D;
|
|
|
|
Vector3 _startAngle3D;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** Moves a Node object x,y pixels by modifying it's position attribute.
|
2013-06-14 08:25:14 +08:00
|
|
|
x and y are relative to the position of the object.
|
2013-06-20 14:13:12 +08:00
|
|
|
Several MoveBy actions can be concurrently called, and the resulting
|
2013-06-14 08:25:14 +08:00
|
|
|
movement will be the sum of individual movements.
|
|
|
|
@since v2.1beta2-custom
|
2012-12-26 18:59:31 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL MoveBy : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
static MoveBy* create(float duration, const Vector2& deltaPosition);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual MoveBy* clone() const override;
|
|
|
|
virtual MoveBy* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
MoveBy() {}
|
|
|
|
virtual ~MoveBy() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
bool initWithDuration(float duration, const Vector2& deltaPosition);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 _positionDelta;
|
|
|
|
Vector2 _startPosition;
|
|
|
|
Vector2 _previousPosition;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(MoveBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** Moves a Node object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
|
|
|
|
Several MoveTo actions can be concurrently called, and the resulting
|
2013-06-14 08:25:14 +08:00
|
|
|
movement will be the sum of individual movements.
|
|
|
|
@since v2.1beta2-custom
|
2012-12-26 18:59:31 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL MoveTo : public MoveBy
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
static MoveTo* create(float duration, const Vector2& position);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual MoveTo* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
MoveTo() {}
|
|
|
|
virtual ~MoveTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
bool initWithDuration(float duration, const Vector2& position);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 _endPosition;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
2012-04-19 14:35:52 +08:00
|
|
|
@since v1.0
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL SkewTo : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
|
|
|
static SkewTo* create(float t, float sx, float sy);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual SkewTo* clone() const override;
|
|
|
|
virtual SkewTo* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
SkewTo();
|
|
|
|
virtual ~SkewTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
bool initWithDuration(float t, float sx, float sy);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _skewX;
|
|
|
|
float _skewY;
|
|
|
|
float _startSkewX;
|
|
|
|
float _startSkewY;
|
|
|
|
float _endSkewX;
|
|
|
|
float _endSkewY;
|
|
|
|
float _deltaX;
|
|
|
|
float _deltaY;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** Skews a Node object by skewX and skewY degrees
|
2012-04-19 14:35:52 +08:00
|
|
|
@since v1.0
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL SkewBy : public SkewTo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
/** creates the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
static SkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual SkewBy* clone() const override;
|
|
|
|
virtual SkewBy* reverse(void) const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
SkewBy() {}
|
|
|
|
virtual ~SkewBy() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
bool initWithDuration(float t, float sx, float sy);
|
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(SkewBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL JumpBy : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
static JumpBy* create(float duration, const Vector2& position, float height, int jumps);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual JumpBy* clone() const override;
|
|
|
|
virtual JumpBy* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
JumpBy() {}
|
|
|
|
virtual ~JumpBy() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
bool initWithDuration(float duration, const Vector2& position, float height, int jumps);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 _startPosition;
|
|
|
|
Vector2 _delta;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _height;
|
2013-07-20 13:01:27 +08:00
|
|
|
int _jumps;
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 _previousPos;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(JumpBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL JumpTo : public JumpBy
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** creates the action */
|
2014-04-15 18:08:29 +08:00
|
|
|
static JumpTo* create(float duration, const Vector2& position, float height, int jumps);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Override
|
|
|
|
//
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual JumpTo* clone() const override;
|
|
|
|
virtual JumpTo* reverse(void) const override;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
JumpTo() {}
|
|
|
|
virtual ~JumpTo() {}
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-08-01 21:40:13 +08:00
|
|
|
/** Bezier configuration structure
|
2010-08-06 10:51:40 +08:00
|
|
|
*/
|
|
|
|
typedef struct _ccBezierConfig {
|
2012-04-19 14:35:52 +08:00
|
|
|
//! end position of the bezier
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 endPosition;
|
2012-04-19 14:35:52 +08:00
|
|
|
//! Bezier control point 1
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 controlPoint_1;
|
2012-04-19 14:35:52 +08:00
|
|
|
//! Bezier control point 2
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 controlPoint_2;
|
2012-04-19 14:35:52 +08:00
|
|
|
} ccBezierConfig;
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief An action that moves the target with a cubic Bezier curve by a certain distance.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL BezierBy : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-09-13 11:41:20 +08:00
|
|
|
/** creates the action with a duration and a bezier configuration
|
|
|
|
* @code
|
|
|
|
* when this function bound to js or lua,the input params are changed
|
|
|
|
* in js: var create(var t,var table)
|
|
|
|
* in lua: lcaol create(local t, local table)
|
|
|
|
* @endcode
|
|
|
|
*/
|
2013-07-16 03:43:22 +08:00
|
|
|
static BezierBy* create(float t, const ccBezierConfig& c);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual BezierBy* clone() const override;
|
|
|
|
virtual BezierBy* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
BezierBy() {}
|
|
|
|
virtual ~BezierBy() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action with a duration and a bezier configuration */
|
|
|
|
bool initWithDuration(float t, const ccBezierConfig& c);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
ccBezierConfig _config;
|
2014-04-15 18:08:29 +08:00
|
|
|
Vector2 _startPosition;
|
|
|
|
Vector2 _previousPosition;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(BezierBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief An action that moves the target with a cubic Bezier curve to a destination point.
|
2010-08-06 10:51:40 +08:00
|
|
|
@since v0.8.2
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL BezierTo : public BezierBy
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-09-13 11:41:20 +08:00
|
|
|
/** creates the action with a duration and a bezier configuration
|
|
|
|
* @code
|
|
|
|
* when this function bound to js or lua,the input params are changed
|
|
|
|
* in js: var create(var t,var table)
|
|
|
|
* in lua: lcaol create(local t, local table)
|
|
|
|
* @endcode
|
|
|
|
*/
|
2013-07-16 03:43:22 +08:00
|
|
|
static BezierTo* create(float t, const ccBezierConfig& c);
|
2013-07-08 23:05:47 +08:00
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
|
|
|
virtual BezierTo* clone() const override;
|
|
|
|
virtual BezierTo* reverse(void) const override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
BezierTo() {}
|
|
|
|
virtual ~BezierTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
bool initWithDuration(float t, const ccBezierConfig &c);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
ccBezierConfig _toConfig;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Scales a Node object to a zoom factor by modifying it's scale attribute.
|
2010-08-06 10:51:40 +08:00
|
|
|
@warning This action doesn't support "reverse"
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL ScaleTo : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action with the same scale factor for X and Y */
|
|
|
|
static ScaleTo* create(float duration, float s);
|
|
|
|
|
|
|
|
/** creates the action with and X factor and a Y factor */
|
|
|
|
static ScaleTo* create(float duration, float sx, float sy);
|
|
|
|
|
2014-03-19 16:23:14 +08:00
|
|
|
/** creates the action with X Y Z factor */
|
|
|
|
static ScaleTo* create(float duration, float sx, float sy, float sz);
|
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual ScaleTo* clone() const override;
|
|
|
|
virtual ScaleTo* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
ScaleTo() {}
|
|
|
|
virtual ~ScaleTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action with the same scale factor for X and Y */
|
|
|
|
bool initWithDuration(float duration, float s);
|
|
|
|
/** initializes the action with and X factor and a Y factor */
|
|
|
|
bool initWithDuration(float duration, float sx, float sy);
|
2014-03-19 16:23:14 +08:00
|
|
|
/** initializes the action with X Y Z factor */
|
|
|
|
bool initWithDuration(float duration, float sx, float sy, float sz);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _scaleX;
|
|
|
|
float _scaleY;
|
2014-03-19 16:23:14 +08:00
|
|
|
float _scaleZ;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _startScaleX;
|
|
|
|
float _startScaleY;
|
2014-03-19 16:23:14 +08:00
|
|
|
float _startScaleZ;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _endScaleX;
|
|
|
|
float _endScaleY;
|
2014-03-19 16:23:14 +08:00
|
|
|
float _endScaleZ;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _deltaX;
|
|
|
|
float _deltaY;
|
2014-03-19 16:23:14 +08:00
|
|
|
float _deltaZ;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL ScaleBy : public ScaleTo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** creates the action with the same scale factor for X and Y */
|
2013-06-20 14:13:12 +08:00
|
|
|
static ScaleBy* create(float duration, float s);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** creates the action with and X factor and a Y factor */
|
2013-06-20 14:13:12 +08:00
|
|
|
static ScaleBy* create(float duration, float sx, float sy);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
2014-03-19 16:23:14 +08:00
|
|
|
/** creates the action with X Y Z factor */
|
|
|
|
static ScaleBy* create(float duration, float sx, float sy, float sz);
|
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual ScaleBy* clone() const override;
|
|
|
|
virtual ScaleBy* reverse(void) const override;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
ScaleBy() {}
|
|
|
|
virtual ~ScaleBy() {}
|
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Blinks a Node object by modifying it's visible attribute
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Blink : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
2013-07-20 13:01:27 +08:00
|
|
|
static Blink* create(float duration, int blinks);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual Blink* clone() const override;
|
|
|
|
virtual Blink* reverse(void) const override;
|
|
|
|
virtual void update(float time) override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop() override;
|
2012-11-15 17:16:51 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
Blink() {}
|
|
|
|
virtual ~Blink() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
|
|
|
bool initWithDuration(float duration, int blinks);
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
protected:
|
2013-07-20 13:01:27 +08:00
|
|
|
int _times;
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _originalState;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Blink);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2014-02-25 15:30:54 +08:00
|
|
|
|
|
|
|
/** @brief Fades an object that implements the RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
|
|
|
|
@warning This action doesn't support "reverse"
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2014-02-25 15:30:54 +08:00
|
|
|
class CC_DLL FadeTo : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2014-02-25 15:30:54 +08:00
|
|
|
/** creates an action with duration and opacity */
|
|
|
|
static FadeTo* create(float duration, GLubyte opacity);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
2014-02-25 15:30:54 +08:00
|
|
|
virtual FadeTo* clone() const override;
|
|
|
|
virtual FadeTo* reverse(void) const override;
|
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2014-02-25 15:30:54 +08:00
|
|
|
FadeTo() {}
|
|
|
|
virtual ~FadeTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2014-02-25 15:30:54 +08:00
|
|
|
/** initializes the action with duration and opacity */
|
|
|
|
bool initWithDuration(float duration, GLubyte opacity);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2014-02-25 15:30:54 +08:00
|
|
|
GLubyte _toOpacity;
|
|
|
|
GLubyte _fromOpacity;
|
|
|
|
friend class FadeOut;
|
|
|
|
friend class FadeIn;
|
2013-11-22 09:06:06 +08:00
|
|
|
private:
|
2014-02-25 15:30:54 +08:00
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2014-02-25 15:30:54 +08:00
|
|
|
/** @brief Fades In an object that implements the RGBAProtocol protocol. It modifies the opacity from 0 to 255.
|
|
|
|
The "reverse" of this action is FadeOut
|
|
|
|
*/
|
|
|
|
class CC_DLL FadeIn : public FadeTo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** creates the action */
|
2014-02-25 15:30:54 +08:00
|
|
|
static FadeIn* create(float d);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
2014-02-25 15:30:54 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
|
|
|
virtual FadeIn* clone() const override;
|
|
|
|
virtual FadeTo* reverse(void) const override;
|
|
|
|
|
|
|
|
void setReverseAction(FadeTo* ac);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
protected:
|
2014-02-25 15:30:54 +08:00
|
|
|
FadeIn():_reverseAction(nullptr) {}
|
|
|
|
virtual ~FadeIn() {}
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
2014-02-25 15:30:54 +08:00
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeIn);
|
|
|
|
FadeTo* _reverseAction;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2014-02-25 15:30:54 +08:00
|
|
|
/** @brief Fades Out an object that implements the RGBAProtocol protocol. It modifies the opacity from 255 to 0.
|
|
|
|
The "reverse" of this action is FadeIn
|
|
|
|
*/
|
|
|
|
class CC_DLL FadeOut : public FadeTo
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2014-02-25 15:30:54 +08:00
|
|
|
/** creates the action */
|
|
|
|
static FadeOut* create(float d);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2014-02-25 15:30:54 +08:00
|
|
|
virtual FadeOut* clone() const override;
|
|
|
|
virtual FadeTo* reverse(void) const override;
|
|
|
|
|
|
|
|
void setReverseAction(FadeTo* ac);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2014-02-25 15:30:54 +08:00
|
|
|
FadeOut():_reverseAction(nullptr) {}
|
|
|
|
virtual ~FadeOut() {}
|
2013-11-22 09:06:06 +08:00
|
|
|
private:
|
2014-02-25 15:30:54 +08:00
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeOut);
|
|
|
|
FadeTo* _reverseAction;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
2010-08-06 10:51:40 +08:00
|
|
|
@warning This action doesn't support "reverse"
|
|
|
|
@since v0.7.2
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL TintTo : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates an action with duration and color */
|
|
|
|
static TintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual TintTo* clone() const override;
|
|
|
|
virtual TintTo* reverse(void) const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
TintTo() {}
|
|
|
|
virtual ~TintTo() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action with duration and color */
|
|
|
|
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-07-05 16:49:22 +08:00
|
|
|
Color3B _to;
|
|
|
|
Color3B _from;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(TintTo);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
2010-08-06 10:51:40 +08:00
|
|
|
@since v0.7.2
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL TintBy : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates an action with duration and color */
|
|
|
|
static TintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual TintBy* clone() const override;
|
|
|
|
virtual TintBy* reverse() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
TintBy() {}
|
|
|
|
virtual ~TintBy() {}
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action with duration and color */
|
|
|
|
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
GLshort _deltaR;
|
|
|
|
GLshort _deltaG;
|
|
|
|
GLshort _deltaB;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
GLshort _fromR;
|
|
|
|
GLshort _fromG;
|
|
|
|
GLshort _fromB;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief Delays the action a certain amount of seconds
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL DelayTime : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** creates the action */
|
2013-06-20 14:13:12 +08:00
|
|
|
static DelayTime* create(float d);
|
2013-07-16 03:43:22 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual void update(float time) override;
|
|
|
|
virtual DelayTime* reverse() const override;
|
|
|
|
virtual DelayTime* clone() const override;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DelayTime() {}
|
|
|
|
virtual ~DelayTime() {}
|
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(DelayTime);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2010-09-28 18:27:33 +08:00
|
|
|
/** @brief Executes an action in reverse order, from time=duration to time=0
|
2010-08-06 10:51:40 +08:00
|
|
|
|
|
|
|
@warning Use this action carefully. This action is not
|
|
|
|
sequenceable. Use it as the default "reversed" method
|
|
|
|
of your own actions, but using it outside the "reversed"
|
|
|
|
scope is not recommended.
|
2012-04-19 14:35:52 +08:00
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL ReverseTime : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
static ReverseTime* create(FiniteTimeAction *action);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual ReverseTime* reverse() const override;
|
|
|
|
virtual ReverseTime* clone() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop(void) override;
|
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
ReverseTime();
|
|
|
|
virtual ~ReverseTime(void);
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithAction(FiniteTimeAction *action);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-20 14:13:12 +08:00
|
|
|
FiniteTimeAction *_other;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class Texture2D;
|
2012-04-19 14:35:52 +08:00
|
|
|
/** @brief Animates a sprite given the name of an Animation */
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Animate : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-07-16 03:43:22 +08:00
|
|
|
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
2013-12-18 17:47:20 +08:00
|
|
|
static Animate* create(Animation *animation);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-20 04:16:38 +08:00
|
|
|
/** sets the Animation object to be animated */
|
|
|
|
void setAnimation( Animation* animation );
|
|
|
|
/** returns the Animation object that is being animated */
|
|
|
|
Animation* getAnimation() { return _animation; }
|
|
|
|
const Animation* getAnimation() const { return _animation; }
|
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual Animate* clone() const override;
|
|
|
|
virtual Animate* reverse() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop(void) override;
|
|
|
|
virtual void update(float t) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
Animate();
|
|
|
|
virtual ~Animate();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** initializes the action with an Animation and will restore the original frame when the animation is over */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithAnimation(Animation *animation);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
std::vector<float>* _splitTimes;
|
2013-07-20 04:16:38 +08:00
|
|
|
int _nextFrame;
|
|
|
|
SpriteFrame* _origFrame;
|
2013-07-07 13:01:21 +08:00
|
|
|
unsigned int _executedLoops;
|
2013-07-20 04:16:38 +08:00
|
|
|
Animation* _animation;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(Animate);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Overrides the target of an action so that it always runs on the target
|
|
|
|
* specified at action creation rather than the one specified by runAction.
|
|
|
|
*/
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL TargetedAction : public ActionInterval
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Create an action with the specified action and forced target */
|
2013-12-18 17:47:20 +08:00
|
|
|
static TargetedAction* create(Node* target, FiniteTimeAction* action);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-20 04:16:38 +08:00
|
|
|
/** Sets the target that the action will be forced to run with */
|
|
|
|
void setForcedTarget(Node* forcedTarget);
|
|
|
|
/** returns the target that the action is forced to run with */
|
|
|
|
Node* getForcedTarget() { return _forcedTarget; }
|
|
|
|
const Node* getForcedTarget() const { return _forcedTarget; }
|
|
|
|
|
2013-07-16 03:43:22 +08:00
|
|
|
//
|
|
|
|
// Overrides
|
|
|
|
//
|
|
|
|
virtual TargetedAction* clone() const override;
|
|
|
|
virtual TargetedAction* reverse() const override;
|
2013-07-18 07:56:19 +08:00
|
|
|
virtual void startWithTarget(Node *target) override;
|
2013-07-16 03:43:22 +08:00
|
|
|
virtual void stop(void) override;
|
|
|
|
virtual void update(float time) override;
|
2014-03-21 13:44:29 +08:00
|
|
|
|
|
|
|
CC_CONSTRUCTOR_ACCESS:
|
2013-11-22 09:06:06 +08:00
|
|
|
TargetedAction();
|
|
|
|
virtual ~TargetedAction();
|
2014-03-21 13:44:29 +08:00
|
|
|
|
2013-11-22 09:06:06 +08:00
|
|
|
/** Init an action with the specified action and forced target */
|
2013-12-18 17:47:20 +08:00
|
|
|
bool initWithTarget(Node* target, FiniteTimeAction* action);
|
2013-11-22 09:06:06 +08:00
|
|
|
|
2014-03-21 13:44:29 +08:00
|
|
|
protected:
|
2013-06-20 14:13:12 +08:00
|
|
|
FiniteTimeAction* _action;
|
2013-07-20 04:16:38 +08:00
|
|
|
Node* _forcedTarget;
|
2013-11-22 09:06:06 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of actions group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif //__ACTION_CCINTERVAL_ACTION_H__
|