axmol/cocos/2d/CCActionInterval.h

1687 lines
48 KiB
C
Raw Normal View History

/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2017 Chukong Technologies Inc.
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__
Squashed commit of the following: commit a794d107ad85667e3d754f0b6251fc864dfbf288 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 14:33:49 2014 -0700 Yeah... everything compiles on win32 and wp8 commit 4740be6e4a0d16f742c27996e7ab2c100adc76af Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 13:58:38 2014 -0700 CCIME moved to base and compiles on Android commit ff3e1bf1eb27a01019f4e1b56d1aebbe2d385f72 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 13:02:57 2014 -0700 compiles Ok for Windows Phone 8 commit 8160a4eb2ecdc61b5bd1cf56b90d2da6f11e3ebd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 12:25:31 2014 -0700 fixes for Windows Phone 8 commit 418197649efc93032aee0adc205e502101cdb53d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 11:15:13 2014 -0700 Compiles on Win32 commit 08813ed7cf8ac1079ffadeb1ce78ea9e833e1a33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 10:08:31 2014 -0700 Compiles on linux! commit 118896521e5b335a5257090b6863f1fb2a2002fe Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 09:30:42 2014 -0700 moves cocos/2d/platform -> cocos/platform commit 4fe9319d7717b0c1bccb2db0156eeb86255a89e0 Merge: bd68ec2 511295e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 08:24:41 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into files commit bd68ec2f0e3a826d8b2f4b60564ba65ce766bc56 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu May 15 19:36:23 2014 -0700 files in the correct directory
2014-05-17 05:36:00 +08:00
#include <vector>
#include "2d/CCAction.h"
Squashed commit of the following: commit c16dcfaaea0922039aad05bce1f4efed18e04871 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 19:05:18 2014 -0700 more linux fixes commit 1553795976c9090a1b46deb53d12910fe0676008 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 19:04:04 2014 -0700 more linux fixes commit 1e43a8cabff33cbf25aa5eb5412f53a878222d83 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 19:02:07 2014 -0700 fixes linux isuses commit 723a445dd6411f91846da2b801248ad8298174f1 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:58:50 2014 -0700 more linux fixes commit 533c8025e794fc76cef02f396b3a93b3d7f4cfc8 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:57:33 2014 -0700 more linux fixes commit 4ba1e84959670bcbf044f18d1c0d4b3cb3be4090 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:53:43 2014 -0700 more linux fixes commit 1f8e011f306a47ed4134224e5e349929201f0539 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:49:28 2014 -0700 more linux fixes commit 3e2033100822ff6d532a1b4f012337491dc11920 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:47:43 2014 -0700 more linux fixes commit 2e708863c75fd032f1b2396dfdf1d31f7a62b713 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:46:00 2014 -0700 more linux fixes commit 861b5b92a6efd4de7b926c20d636ce9d749b293f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:43:15 2014 -0700 more linux fixes commit 2a43365a0c1755e9b9cada53301be1a20adb31cf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:36:06 2014 -0700 more fixes for linux commit 7d332bf911892f87c7824d2a5da7bf73ce7ec411 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:35:29 2014 -0700 more fixes for linux commit f1becc17d3316dfe3678c23c9dcedb7a447d9235 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:34:44 2014 -0700 more fixes for linux commit d2e5959bb0dde921dd5e73be1d8acc3b3f50e51d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:33:45 2014 -0700 fixes for linux commit ad9b633c352107cf0e8b060a0e23d6e6a3f5e80f Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:16:48 2014 -0700 compiles on Windows commit 4425ee8e5de8f42a2d6050e4470109600dce8b5d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Apr 30 18:07:20 2014 -0700 fix builder
2014-05-01 10:09:13 +08:00
#include "2d/CCAnimation.h"
Squashed commit of the following: commit a794d107ad85667e3d754f0b6251fc864dfbf288 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 14:33:49 2014 -0700 Yeah... everything compiles on win32 and wp8 commit 4740be6e4a0d16f742c27996e7ab2c100adc76af Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 13:58:38 2014 -0700 CCIME moved to base and compiles on Android commit ff3e1bf1eb27a01019f4e1b56d1aebbe2d385f72 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 13:02:57 2014 -0700 compiles Ok for Windows Phone 8 commit 8160a4eb2ecdc61b5bd1cf56b90d2da6f11e3ebd Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 12:25:31 2014 -0700 fixes for Windows Phone 8 commit 418197649efc93032aee0adc205e502101cdb53d Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 11:15:13 2014 -0700 Compiles on Win32 commit 08813ed7cf8ac1079ffadeb1ce78ea9e833e1a33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 10:08:31 2014 -0700 Compiles on linux! commit 118896521e5b335a5257090b6863f1fb2a2002fe Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 09:30:42 2014 -0700 moves cocos/2d/platform -> cocos/platform commit 4fe9319d7717b0c1bccb2db0156eeb86255a89e0 Merge: bd68ec2 511295e Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri May 16 08:24:41 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into files commit bd68ec2f0e3a826d8b2f4b60564ba65ce766bc56 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu May 15 19:36:23 2014 -0700 files in the correct directory
2014-05-17 05:36:00 +08:00
#include "base/CCProtocols.h"
2014-04-27 01:35:57 +08:00
#include "base/CCVector.h"
NS_CC_BEGIN
2014-08-26 18:19:28 +08:00
class Node;
class SpriteFrame;
class EventCustom;
2012-06-20 18:09:11 +08:00
/**
* @addtogroup actions
* @{
*/
/** @class ActionInterval
2010-09-28 18:27:33 +08:00
@brief An interval action is an action that takes place within a certain period of time.
It has an start time, and a finish time. The finish time is the parameter
duration plus the start time.
These ActionInterval actions have some interesting properties, like:
- 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.
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
@code
auto action = MoveBy::create(1.0f, Vec2::ONE);
auto pingPongAction = Sequence::create(action, action->reverse(), nullptr);
@endcode
*/
class CC_DLL ActionInterval : public FiniteTimeAction
{
public:
/** How many seconds had elapsed since the actions started to run.
*
* @return The seconds had elapsed since the actions started to run.
*/
float getElapsed() { return _elapsed; }
/** Sets the amplitude rate, extension in GridAction
*
* @param amp The amplitude rate.
*/
void setAmplitudeRate(float amp);
/** Gets the amplitude rate, extension in GridAction
*
* @return The amplitude rate.
*/
float getAmplitudeRate(void);
//
// Overrides
//
virtual bool isDone(void) const override;
2015-01-20 15:41:59 +08:00
/**
* @param dt in seconds
*/
virtual void step(float dt) override;
virtual void startWithTarget(Node *target) override;
virtual ActionInterval* reverse() const override
{
CC_ASSERT(0);
return nullptr;
}
2014-07-18 14:53:00 +08:00
virtual ActionInterval *clone() const override
{
CC_ASSERT(0);
return nullptr;
}
CC_CONSTRUCTOR_ACCESS:
/** initializes the action */
bool initWithDuration(float d);
protected:
float _elapsed;
bool _firstTick;
bool _done;
protected:
bool sendUpdateEventToScript(float dt, Action *actionObject);
};
/** @class Sequence
* @brief Runs actions sequentially, one after another.
*/
class CC_DLL Sequence : public ActionInterval
{
public:
/** Helper constructor to create an array of sequenceable actions.
*
* @return An autoreleased Sequence object.
*/
2015-05-09 00:19:13 +08:00
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 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
static Sequence* create(FiniteTimeAction *action1, ...) CC_REQUIRES_NULL_TERMINATION;
#endif
/** Helper constructor to create an array of sequenceable actions given an array.
* @code
* When this function 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
*
* @param arrayOfActions An array of sequenceable actions.
* @return An autoreleased Sequence object.
*/
static Sequence* create(const Vector<FiniteTimeAction*>& arrayOfActions);
/** Helper constructor to create an array of sequence-able actions.
*
* @param action1 The first sequenceable action.
* @param args The va_list variable.
* @return An autoreleased Sequence object.
* @js NA
*/
static Sequence* createWithVariableList(FiniteTimeAction *action1, va_list args);
/** Creates the action.
* @param actionOne The first sequenceable action.
* @param actionTwo The second sequenceable action.
* @return An autoreleased Sequence object.
* @js NA
*/
static Sequence* createWithTwoActions(FiniteTimeAction *actionOne, FiniteTimeAction *actionTwo);
//
// Overrides
//
virtual Sequence* clone() const override;
2014-07-18 14:53:00 +08:00
virtual Sequence* reverse() const override;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
2015-01-20 15:41:59 +08:00
/**
* @param t In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float t) override;
CC_CONSTRUCTOR_ACCESS:
Sequence();
virtual ~Sequence();
/** initializes the action */
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
bool init(const Vector<FiniteTimeAction*>& arrayOfActions);
protected:
FiniteTimeAction *_actions[2];
float _split;
int _last;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Sequence);
};
/** @class Repeat
* @brief Repeats an action a number of times.
* To repeat an action forever use the RepeatForever action.
*/
class CC_DLL Repeat : public ActionInterval
{
public:
/** Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30).
*
* @param action The action needs to repeat.
* @param times The repeat times.
* @return An autoreleased Repeat object.
*/
static Repeat* create(FiniteTimeAction *action, unsigned int times);
/** Sets the inner action.
*
* @param action The inner action.
*/
void setInnerAction(FiniteTimeAction *action)
{
if (_innerAction != action)
{
CC_SAFE_RETAIN(action);
CC_SAFE_RELEASE(_innerAction);
_innerAction = action;
}
}
/** Gets the inner action.
*
* @return The inner action.
*/
FiniteTimeAction* getInnerAction()
{
return _innerAction;
}
//
// Overrides
//
virtual Repeat* clone() const override;
2014-07-18 14:53:00 +08:00
virtual Repeat* reverse() const override;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
2015-01-20 15:41:59 +08:00
/**
* @param dt In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float dt) override;
virtual bool isDone(void) const override;
CC_CONSTRUCTOR_ACCESS:
Repeat() {}
virtual ~Repeat();
/** initializes a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
bool initWithAction(FiniteTimeAction *pAction, unsigned int times);
protected:
unsigned int _times;
unsigned int _total;
float _nextDt;
bool _actionInstant;
/** Inner action */
FiniteTimeAction *_innerAction;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Repeat);
};
/** @class RepeatForever
* @brief Repeats an action for ever.
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.
*/
class CC_DLL RepeatForever : public ActionInterval
{
public:
/** Creates the action.
*
* @param action The action need to repeat forever.
* @return An autoreleased RepeatForever object.
*/
static RepeatForever* create(ActionInterval *action);
/** Sets the inner action.
*
* @param action The inner action.
*/
void setInnerAction(ActionInterval *action)
{
if (_innerAction != action)
{
CC_SAFE_RELEASE(_innerAction);
_innerAction = action;
CC_SAFE_RETAIN(_innerAction);
}
}
/** Gets the inner action.
*
* @return The inner action.
*/
ActionInterval* getInnerAction()
{
return _innerAction;
}
//
// Overrides
//
virtual RepeatForever* clone() const override;
2014-07-18 14:53:00 +08:00
virtual RepeatForever* reverse(void) const override;
virtual void startWithTarget(Node* target) override;
2015-01-20 15:41:59 +08:00
/**
* @param dt In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void step(float dt) override;
virtual bool isDone(void) const override;
CC_CONSTRUCTOR_ACCESS:
RepeatForever()
: _innerAction(nullptr)
{}
virtual ~RepeatForever();
/** initializes the action */
bool initWithAction(ActionInterval *action);
protected:
/** Inner action */
ActionInterval *_innerAction;
private:
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
};
/** @class Spawn
* @brief Spawn a new action immediately
*/
class CC_DLL Spawn : public ActionInterval
{
public:
/** Helper constructor to create an array of spawned actions.
* @code
* When this function 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
*
* @return An autoreleased Spawn object.
*/
2015-05-09 00:19:13 +08:00
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 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
static Spawn* create(FiniteTimeAction *action1, ...) CC_REQUIRES_NULL_TERMINATION;
#endif
/** Helper constructor to create an array of spawned actions.
*
* @param action1 The first sequenceable action.
* @param args The va_list variable.
* @return An autoreleased Spawn object.
* @js NA
*/
static Spawn* createWithVariableList(FiniteTimeAction *action1, va_list args);
/** Helper constructor to create an array of spawned actions given an array.
*
* @param arrayOfActions An array of spawned actions.
* @return An autoreleased Spawn object.
*/
static Spawn* create(const Vector<FiniteTimeAction*>& arrayOfActions);
/** Creates the Spawn action.
*
* @param action1 The first spawned action.
2015-12-03 20:00:51 +08:00
* @param action2 The second spawned action.
* @return An autoreleased Spawn object.
* @js NA
*/
static Spawn* createWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2);
//
// Overrides
//
virtual Spawn* clone() const override;
2014-07-18 14:53:00 +08:00
virtual Spawn* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
2015-01-20 15:41:59 +08:00
/**
2015-03-27 12:07:19 +08:00
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Spawn();
virtual ~Spawn();
/** initializes the Spawn action with the 2 actions to spawn */
bool initWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2);
bool init(const Vector<FiniteTimeAction*>& arrayOfActions);
protected:
FiniteTimeAction *_one;
FiniteTimeAction *_two;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Spawn);
};
/** @class RotateTo
* @brief Rotates a Node object to a certain angle by modifying it's rotation attribute.
The direction will be decided by the shortest angle.
*/
class CC_DLL RotateTo : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action with separate rotation angles.
*
* @param duration Duration time, in seconds.
* @param dstAngleX In degreesCW.
* @param dstAngleY In degreesCW.
* @return An autoreleased RotateTo object.
2015-01-20 15:41:59 +08:00
*/
static RotateTo* create(float duration, float dstAngleX, float dstAngleY);
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
*
* @param duration Duration time, in seconds.
* @param dstAngle In degreesCW.
* @return An autoreleased RotateTo object.
2015-01-20 15:41:59 +08:00
*/
static RotateTo* create(float duration, float dstAngle);
2015-01-20 15:41:59 +08:00
/**
* Creates the action with 3D rotation angles.
* @param duration Duration time, in seconds.
* @param dstAngle3D A Vec3 angle.
* @return An autoreleased RotateTo object.
2015-01-20 15:41:59 +08:00
*/
static RotateTo* create(float duration, const Vec3& dstAngle3D);
//
// Overrides
//
virtual RotateTo* clone() const override;
virtual RotateTo* reverse() const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
2015-03-27 12:07:19 +08:00
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
2012-11-15 17:16:51 +08:00
CC_CONSTRUCTOR_ACCESS:
RotateTo();
virtual ~RotateTo() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration in seconds
* @param dstAngleX in degreesCW
* @param dstAngleY in degreesCW
*/
bool initWithDuration(float duration, float dstAngleX, float dstAngleY);
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration in seconds
*/
bool initWithDuration(float duration, const Vec3& dstAngle3D);
2015-01-20 15:41:59 +08:00
/**
* calculates the start and diff angles
* @param dstAngle in degreesCW
*/
void calculateAngles(float &startAngle, float &diffAngle, float dstAngle);
protected:
bool _is3D;
Vec3 _dstAngle;
Vec3 _startAngle;
Vec3 _diffAngle;
private:
CC_DISALLOW_COPY_AND_ASSIGN(RotateTo);
};
/** @class RotateBy
* @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
*/
class CC_DLL RotateBy : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
*
* @param duration Duration time, in seconds.
* @param deltaAngle In degreesCW.
* @return An autoreleased RotateBy object.
2015-01-20 15:41:59 +08:00
*/
static RotateBy* create(float duration, float deltaAngle);
2015-01-20 15:41:59 +08:00
/**
* Creates the action with separate rotation angles.
*
* @param duration Duration time, in seconds.
* @param deltaAngleZ_X In degreesCW.
* @param deltaAngleZ_Y In degreesCW.
* @return An autoreleased RotateBy object.
2015-01-20 15:41:59 +08:00
* @warning The physics body contained in Node doesn't support rotate with different x and y angle.
*/
2014-02-23 11:16:42 +08:00
static RotateBy* create(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
/** Creates the action with 3D rotation angles.
*
* @param duration Duration time, in seconds.
* @param deltaAngle3D A Vec3 angle.
* @return An autoreleased RotateBy object.
2015-01-20 15:41:59 +08:00
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
static RotateBy* create(float duration, const Vec3& deltaAngle3D);
//
// Override
//
virtual RotateBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual RotateBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
2012-11-15 17:16:51 +08:00
CC_CONSTRUCTOR_ACCESS:
2014-02-23 11:16:42 +08:00
RotateBy();
virtual ~RotateBy() {}
/** initializes the action */
bool initWithDuration(float duration, float deltaAngle);
2015-01-20 15:41:59 +08:00
/**
* @warning The physics body contained in Node doesn't support rotate with different x and y angle.
* @param deltaAngleZ_X in degreesCW
* @param deltaAngleZ_Y in degreesCW
*/
2014-02-23 11:16:42 +08:00
bool initWithDuration(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
bool initWithDuration(float duration, const Vec3& deltaAngle3D);
protected:
2014-02-23 11:16:42 +08:00
bool _is3D;
Vec3 _deltaAngle;
Vec3 _startAngle;
private:
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
};
/** @class MoveBy
* @brief Moves a Node object x,y pixels by modifying it's position attribute.
x and y are relative to the position of the object.
Several MoveBy actions can be concurrently called, and the resulting
movement will be the sum of individual movements.
@since v2.1beta2-custom
*/
class CC_DLL MoveBy : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
*
* @param duration Duration time, in seconds.
* @param deltaPosition The delta distance in 2d, it's a Vec2 type.
* @return An autoreleased MoveBy object.
2015-01-20 15:41:59 +08:00
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
static MoveBy* create(float duration, const Vec2& deltaPosition);
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
*
* @param duration Duration time, in seconds.
* @param deltaPosition The delta distance in 3d, it's a Vec3 type.
* @return An autoreleased MoveBy object.
2015-01-20 15:41:59 +08:00
*/
2014-12-22 14:34:35 +08:00
static MoveBy* create(float duration, const Vec3& deltaPosition);
//
// Overrides
//
virtual MoveBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual MoveBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
2014-12-22 14:34:35 +08:00
MoveBy():_is3D(false) {}
virtual ~MoveBy() {}
/** initializes the action */
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
bool initWithDuration(float duration, const Vec2& deltaPosition);
2014-12-22 14:34:35 +08:00
bool initWithDuration(float duration, const Vec3& deltaPosition);
protected:
2014-12-22 14:34:35 +08:00
bool _is3D;
Vec3 _positionDelta;
Vec3 _startPosition;
Vec3 _previousPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(MoveBy);
};
/** @class MoveTo
* @brief 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
movement will be the sum of individual movements.
@since v2.1beta2-custom
*/
class CC_DLL MoveTo : public MoveBy
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param duration Duration time, in seconds.
* @param position The destination position in 2d.
* @return An autoreleased MoveTo object.
2015-01-20 15:41:59 +08:00
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
static MoveTo* create(float duration, const Vec2& position);
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param duration Duration time, in seconds.
* @param position The destination position in 3d.
* @return An autoreleased MoveTo object.
2015-01-20 15:41:59 +08:00
*/
2014-12-22 14:34:35 +08:00
static MoveTo* create(float duration, const Vec3& position);
//
// Overrides
//
virtual MoveTo* clone() const override;
2015-03-10 13:50:53 +08:00
virtual MoveTo* reverse() const override;
virtual void startWithTarget(Node *target) override;
CC_CONSTRUCTOR_ACCESS:
MoveTo() {}
virtual ~MoveTo() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration in seconds
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
bool initWithDuration(float duration, const Vec2& position);
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration in seconds
*/
2014-12-22 14:34:35 +08:00
bool initWithDuration(float duration, const Vec3& position);
protected:
2014-12-22 14:34:35 +08:00
Vec3 _endPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
};
/** @class SkewTo
* @brief Skews a Node object to given angles by modifying it's skewX and skewY attributes
@since v1.0
*/
class CC_DLL SkewTo : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param t Duration time, in seconds.
* @param sx Skew x angle.
* @param sy Skew y angle.
* @return An autoreleased SkewTo object.
2015-01-20 15:41:59 +08:00
*/
static SkewTo* create(float t, float sx, float sy);
//
// Overrides
//
virtual SkewTo* clone() const override;
2014-07-18 14:53:00 +08:00
virtual SkewTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
SkewTo();
virtual ~SkewTo() {}
2015-01-20 15:41:59 +08:00
/**
* @param t In seconds.
2015-01-20 15:41:59 +08:00
*/
bool initWithDuration(float t, float sx, float sy);
protected:
float _skewX;
float _skewY;
float _startSkewX;
float _startSkewY;
float _endSkewX;
float _endSkewY;
float _deltaX;
float _deltaY;
private:
CC_DISALLOW_COPY_AND_ASSIGN(SkewTo);
};
/** @class SkewBy
* @brief Skews a Node object by skewX and skewY degrees.
@since v1.0
*/
class CC_DLL SkewBy : public SkewTo
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param t Duration time, in seconds.
* @param deltaSkewX Skew x delta angle.
* @param deltaSkewY Skew y delta angle.
* @return An autoreleased SkewBy object.
2015-01-20 15:41:59 +08:00
*/
static SkewBy* create(float t, float deltaSkewX, float deltaSkewY);
//
// Overrides
//
virtual void startWithTarget(Node *target) override;
virtual SkewBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual SkewBy* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS:
SkewBy() {}
virtual ~SkewBy() {}
2015-01-20 15:41:59 +08:00
/**
* @param t In seconds.
2015-01-20 15:41:59 +08:00
*/
bool initWithDuration(float t, float sx, float sy);
private:
CC_DISALLOW_COPY_AND_ASSIGN(SkewBy);
};
/** @class ResizeTo
* @brief Resize a Node object to the final size by modifying it's Size attribute.
*/
class CC_DLL ResizeTo : public ActionInterval
{
public:
/**
* Creates the action.
* @brief Resize a Node object to the final size by modifying it's Size attribute. Works on all nodes where setContentSize is effective. But it's mostly useful for nodes where 9-slice is enabled
* @param duration Duration time, in seconds.
* @param final_size The target size to reach
* @return An autoreleased RotateTo object.
*/
static ResizeTo* create(float duration, const cocos2d::Size& final_size);
//
// Overrides
//
virtual ResizeTo* clone() const override;
void startWithTarget(cocos2d::Node* target) override;
void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
ResizeTo() {}
virtual ~ResizeTo() {}
/**
* initializes the action
* @param duration in seconds
* @param final_size in Size type
*/
bool initWithDuration(float duration, const cocos2d::Size& final_size);
protected:
cocos2d::Size _initialSize;
cocos2d::Size _finalSize;
cocos2d::Size _sizeDelta;
private:
CC_DISALLOW_COPY_AND_ASSIGN(ResizeTo);
};
/** @class ResizeBy
* @brief Resize a Node object by a Size. Works on all nodes where setContentSize is effective. But it's mostly useful for nodes where 9-slice is enabled
*/
class CC_DLL ResizeBy : public ActionInterval
{
public:
/**
* Creates the action.
*
* @param duration Duration time, in seconds.
* @param deltaSize The delta size.
* @return An autoreleased ResizeBy object.
*/
static ResizeBy* create(float duration, const cocos2d::Size& deltaSize);
//
// Overrides
//
virtual ResizeBy* clone() const override;
virtual ResizeBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
ResizeBy() {}
virtual ~ResizeBy() {}
/** initializes the action */
bool initWithDuration(float duration, const cocos2d::Size& deltaSize);
protected:
cocos2d::Size _sizeDelta;
cocos2d::Size _startSize;
cocos2d::Size _previousSize;
private:
CC_DISALLOW_COPY_AND_ASSIGN(ResizeBy);
};
/** @class JumpBy
* @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
*/
class CC_DLL JumpBy : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param duration Duration time, in seconds.
* @param position The jumping distance.
* @param height The jumping height.
* @param jumps The jumping times.
* @return An autoreleased JumpBy object.
2015-01-20 15:41:59 +08:00
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
static JumpBy* create(float duration, const Vec2& position, float height, int jumps);
//
// Overrides
//
virtual JumpBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual JumpBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
JumpBy() {}
virtual ~JumpBy() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration in seconds
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
bool initWithDuration(float duration, const Vec2& position, float height, int jumps);
protected:
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 _startPosition;
Vec2 _delta;
float _height;
int _jumps;
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 _previousPos;
private:
CC_DISALLOW_COPY_AND_ASSIGN(JumpBy);
};
/** @class JumpTo
* @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
*/
class CC_DLL JumpTo : public JumpBy
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param duration Duration time, in seconds.
* @param position The jumping destination position.
* @param height The jumping height.
* @param jumps The jumping times.
* @return An autoreleased JumpTo object.
2015-01-20 15:41:59 +08:00
*/
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
static JumpTo* create(float duration, const Vec2& position, float height, int jumps);
//
// Override
//
virtual void startWithTarget(Node *target) override;
virtual JumpTo* clone() const override;
2014-07-18 14:53:00 +08:00
virtual JumpTo* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS:
JumpTo() {}
virtual ~JumpTo() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration In seconds.
2015-01-20 15:41:59 +08:00
*/
bool initWithDuration(float duration, const Vec2& position, float height, int jumps);
protected:
Vec2 _endPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
};
/** @struct Bezier configuration structure
*/
typedef struct _ccBezierConfig {
//! end position of the bezier
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 endPosition;
//! Bezier control point 1
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 controlPoint_1;
//! Bezier control point 2
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 controlPoint_2;
} ccBezierConfig;
/** @class BezierBy
* @brief An action that moves the target with a cubic Bezier curve by a certain distance.
*/
class CC_DLL BezierBy : public ActionInterval
{
public:
/** Creates the action with a duration and a bezier configuration.
* @param t Duration time, in seconds.
* @param c Bezier config.
* @return An autoreleased BezierBy object.
* @code
* When this function bound to js or lua,the input params are changed.
* in js: var create(var t,var table)
2015-12-03 20:00:51 +08:00
* in lua: local create(local t, local table)
* @endcode
*/
static BezierBy* create(float t, const ccBezierConfig& c);
//
// Overrides
//
virtual BezierBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual BezierBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
BezierBy() {}
virtual ~BezierBy() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action with a duration and a bezier configuration
* @param t in seconds
*/
bool initWithDuration(float t, const ccBezierConfig& c);
protected:
ccBezierConfig _config;
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
Vec2 _startPosition;
Vec2 _previousPosition;
private:
CC_DISALLOW_COPY_AND_ASSIGN(BezierBy);
};
/** @class BezierTo
* @brief An action that moves the target with a cubic Bezier curve to a destination point.
@since v0.8.2
*/
class CC_DLL BezierTo : public BezierBy
{
public:
/** Creates the action with a duration and a bezier configuration.
* @param t Duration time, in seconds.
* @param c Bezier config.
* @return An autoreleased BezierTo object.
* @code
* when this function bound to js or lua,the input params are changed
* in js: var create(var t,var table)
2015-12-03 20:00:51 +08:00
* in lua: local create(local t, local table)
* @endcode
*/
static BezierTo* create(float t, const ccBezierConfig& c);
//
// Overrides
//
virtual void startWithTarget(Node *target) override;
virtual BezierTo* clone() const override;
2014-07-18 14:53:00 +08:00
virtual BezierTo* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS:
BezierTo() {}
virtual ~BezierTo() {}
2015-01-20 15:41:59 +08:00
/**
* @param t In seconds.
2015-01-20 15:41:59 +08:00
*/
bool initWithDuration(float t, const ccBezierConfig &c);
protected:
ccBezierConfig _toConfig;
private:
CC_DISALLOW_COPY_AND_ASSIGN(BezierTo);
};
/** @class ScaleTo
@brief Scales a Node object to a zoom factor by modifying it's scale attribute.
@warning This action doesn't support "reverse".
@warning The physics body contained in Node doesn't support this action.
*/
class CC_DLL ScaleTo : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action with the same scale factor for X and Y.
* @param duration Duration time, in seconds.
* @param s Scale factor of x and y.
* @return An autoreleased ScaleTo object.
2015-01-20 15:41:59 +08:00
*/
static ScaleTo* create(float duration, float s);
2015-01-20 15:41:59 +08:00
/**
* Creates the action with and X factor and a Y factor.
* @param duration Duration time, in seconds.
* @param sx Scale factor of x.
* @param sy Scale factor of y.
* @return An autoreleased ScaleTo object.
2015-01-20 15:41:59 +08:00
*/
static ScaleTo* create(float duration, float sx, float sy);
2015-01-20 15:41:59 +08:00
/**
* Creates the action with X Y Z factor.
* @param duration Duration time, in seconds.
* @param sx Scale factor of x.
* @param sy Scale factor of y.
* @param sz Scale factor of z.
* @return An autoreleased ScaleTo object.
2015-01-20 15:41:59 +08:00
*/
static ScaleTo* create(float duration, float sx, float sy, float sz);
//
// Overrides
//
virtual ScaleTo* clone() const override;
2014-07-18 14:53:00 +08:00
virtual ScaleTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
ScaleTo() {}
virtual ~ScaleTo() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action with the same scale factor for X and Y
* @param duration in seconds
*/
bool initWithDuration(float duration, float s);
2015-01-20 15:41:59 +08:00
/**
* initializes the action with and X factor and a Y factor
* @param duration in seconds
*/
bool initWithDuration(float duration, float sx, float sy);
2015-01-20 15:41:59 +08:00
/**
* initializes the action with X Y Z factor
* @param duration in seconds
*/
bool initWithDuration(float duration, float sx, float sy, float sz);
protected:
float _scaleX;
float _scaleY;
float _scaleZ;
float _startScaleX;
float _startScaleY;
float _startScaleZ;
float _endScaleX;
float _endScaleY;
float _endScaleZ;
float _deltaX;
float _deltaY;
float _deltaZ;
private:
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
};
/** @class ScaleBy
* @brief Scales a Node object a zoom factor by modifying it's scale attribute.
@warning The physics body contained in Node doesn't support this action.
*/
class CC_DLL ScaleBy : public ScaleTo
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action with the same scale factor for X and Y.
* @param duration Duration time, in seconds.
* @param s Scale factor of x and y.
* @return An autoreleased ScaleBy object.
2015-01-20 15:41:59 +08:00
*/
static ScaleBy* create(float duration, float s);
2015-01-20 15:41:59 +08:00
/**
* Creates the action with and X factor and a Y factor.
* @param duration Duration time, in seconds.
* @param sx Scale factor of x.
* @param sy Scale factor of y.
* @return An autoreleased ScaleBy object.
2015-01-20 15:41:59 +08:00
*/
static ScaleBy* create(float duration, float sx, float sy);
2015-01-20 15:41:59 +08:00
/**
* Creates the action with X Y Z factor.
* @param duration Duration time, in seconds.
* @param sx Scale factor of x.
* @param sy Scale factor of y.
* @param sz Scale factor of z.
* @return An autoreleased ScaleBy object.
2015-01-20 15:41:59 +08:00
*/
static ScaleBy* create(float duration, float sx, float sy, float sz);
//
// Overrides
//
virtual void startWithTarget(Node *target) override;
virtual ScaleBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual ScaleBy* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS:
ScaleBy() {}
virtual ~ScaleBy() {}
private:
CC_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
};
/** @class Blink
* @brief Blinks a Node object by modifying it's visible attribute.
*/
class CC_DLL Blink : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param duration Duration time, in seconds.
* @param blinks Blink times.
* @return An autoreleased Blink object.
2015-01-20 15:41:59 +08:00
*/
static Blink* create(float duration, int blinks);
//
// Overrides
//
virtual Blink* clone() const override;
2014-07-18 14:53:00 +08:00
virtual Blink* reverse() const override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
virtual void startWithTarget(Node *target) override;
virtual void stop() override;
2012-11-15 17:16:51 +08:00
CC_CONSTRUCTOR_ACCESS:
Blink() {}
virtual ~Blink() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action
* @param duration in seconds
*/
bool initWithDuration(float duration, int blinks);
protected:
int _times;
bool _originalState;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Blink);
};
/** @class FadeTo
* @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"
*/
class CC_DLL FadeTo : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates an action with duration and opacity.
* @param duration Duration time, in seconds.
* @param opacity A certain opacity, the range is from 0 to 255.
* @return An autoreleased FadeTo object.
2015-01-20 15:41:59 +08:00
*/
static FadeTo* create(float duration, GLubyte opacity);
//
// Overrides
//
virtual FadeTo* clone() const override;
2014-07-18 14:53:00 +08:00
virtual FadeTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
FadeTo() {}
virtual ~FadeTo() {}
2015-01-20 15:41:59 +08:00
/**
* initializes the action with duration and opacity
* @param duration in seconds
*/
bool initWithDuration(float duration, GLubyte opacity);
protected:
GLubyte _toOpacity;
GLubyte _fromOpacity;
friend class FadeOut;
friend class FadeIn;
private:
CC_DISALLOW_COPY_AND_ASSIGN(FadeTo);
};
/** @class FadeIn
* @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
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param d Duration time, in seconds.
* @return An autoreleased FadeIn object.
2015-01-20 15:41:59 +08:00
*/
static FadeIn* create(float d);
//
// Overrides
//
virtual void startWithTarget(Node *target) override;
virtual FadeIn* clone() const override;
2014-07-18 14:53:00 +08:00
virtual FadeTo* reverse(void) const override;
/**
* @js NA
*/
void setReverseAction(FadeTo* ac);
CC_CONSTRUCTOR_ACCESS:
FadeIn():_reverseAction(nullptr) {}
virtual ~FadeIn() {}
private:
CC_DISALLOW_COPY_AND_ASSIGN(FadeIn);
FadeTo* _reverseAction;
};
/** @class FadeOut
* @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
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param d Duration time, in seconds.
2015-01-20 15:41:59 +08:00
*/
static FadeOut* create(float d);
//
// Overrides
//
virtual void startWithTarget(Node *target) override;
virtual FadeOut* clone() const override;
2014-07-18 14:53:00 +08:00
virtual FadeTo* reverse(void) const override;
/**
* @js NA
*/
void setReverseAction(FadeTo* ac);
CC_CONSTRUCTOR_ACCESS:
FadeOut():_reverseAction(nullptr) {}
virtual ~FadeOut() {}
private:
CC_DISALLOW_COPY_AND_ASSIGN(FadeOut);
FadeTo* _reverseAction;
};
/** @class TintTo
* @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
@warning This action doesn't support "reverse"
@since v0.7.2
*/
class CC_DLL TintTo : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates an action with duration and color.
* @param duration Duration time, in seconds.
* @param red Red Color, from 0 to 255.
* @param green Green Color, from 0 to 255.
* @param blue Blue Color, from 0 to 255.
* @return An autoreleased TintTo object.
2015-01-20 15:41:59 +08:00
*/
static TintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
2015-01-20 15:41:59 +08:00
/**
* Creates an action with duration and color.
* @param duration Duration time, in seconds.
* @param color It's a Color3B type.
* @return An autoreleased TintTo object.
2015-01-20 15:41:59 +08:00
*/
static TintTo* create(float duration, const Color3B& color);
//
// Overrides
//
virtual TintTo* clone() const override;
2014-07-18 14:53:00 +08:00
virtual TintTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
TintTo() {}
virtual ~TintTo() {}
/** initializes the action with duration and color */
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
protected:
Color3B _to;
Color3B _from;
private:
CC_DISALLOW_COPY_AND_ASSIGN(TintTo);
};
/** @class TintBy
@brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
@since v0.7.2
*/
class CC_DLL TintBy : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates an action with duration and color.
* @param duration Duration time, in seconds.
* @param deltaRed Delta red color.
* @param deltaGreen Delta green color.
* @param deltaBlue Delta blue color.
* @return An autoreleased TintBy object.
2015-01-20 15:41:59 +08:00
*/
static TintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
//
// Overrides
//
virtual TintBy* clone() const override;
2014-07-18 14:53:00 +08:00
virtual TintBy* reverse() const override;
virtual void startWithTarget(Node *target) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
TintBy() {}
virtual ~TintBy() {}
/** initializes the action with duration and color */
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
protected:
GLshort _deltaR;
GLshort _deltaG;
GLshort _deltaB;
GLshort _fromR;
GLshort _fromG;
GLshort _fromB;
private:
CC_DISALLOW_COPY_AND_ASSIGN(TintBy);
};
/** @class DelayTime
* @brief Delays the action a certain amount of seconds.
*/
class CC_DLL DelayTime : public ActionInterval
{
public:
2015-01-20 15:41:59 +08:00
/**
* Creates the action.
* @param d Duration time, in seconds.
* @return An autoreleased DelayTime object.
2015-01-20 15:41:59 +08:00
*/
static DelayTime* create(float d);
//
// Overrides
//
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
virtual DelayTime* reverse() const override;
virtual DelayTime* clone() const override;
CC_CONSTRUCTOR_ACCESS:
DelayTime() {}
virtual ~DelayTime() {}
private:
CC_DISALLOW_COPY_AND_ASSIGN(DelayTime);
};
/** @class ReverseTime
* @brief Executes an action in reverse order, from time=duration to time=0
@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.
*/
class CC_DLL ReverseTime : public ActionInterval
{
public:
/** Creates the action.
*
* @param action a certain action.
* @return An autoreleased ReverseTime object.
*/
static ReverseTime* create(FiniteTimeAction *action);
//
// Overrides
//
2014-07-18 14:53:00 +08:00
virtual ReverseTime* reverse() const override;
virtual ReverseTime* clone() const override;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
ReverseTime();
virtual ~ReverseTime(void);
/** initializes the action */
bool initWithAction(FiniteTimeAction *action);
protected:
FiniteTimeAction *_other;
private:
CC_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
};
class Texture2D;
/** @class Animate
* @brief Animates a sprite given the name of an Animation.
*/
class CC_DLL Animate : public ActionInterval
{
public:
/** Creates the action with an Animation and will restore the original frame when the animation is over.
*
* @param animation A certain animation.
* @return An autoreleased Animate object.
*/
static Animate* create(Animation *animation);
/** Sets the Animation object to be animated
*
2015-03-27 17:09:54 +08:00
* @param animation certain animation.
*/
void setAnimation( Animation* animation );
/** returns the Animation object that is being animated
*
* @return Gets the animation object that is being animated.
*/
Animation* getAnimation() { return _animation; }
const Animation* getAnimation() const { return _animation; }
2015-07-13 10:40:43 +08:00
/**
* Gets the index of sprite frame currently displayed.
* @return int the index of sprite frame currently displayed.
*/
int getCurrentFrameIndex() { return _currFrameIndex; }
//
// Overrides
//
virtual Animate* clone() const override;
virtual Animate* reverse() const override;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
2015-01-20 15:41:59 +08:00
/**
* @param t In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float t) override;
CC_CONSTRUCTOR_ACCESS:
Animate();
virtual ~Animate();
/** initializes the action with an Animation and will restore the original frame when the animation is over */
bool initWithAnimation(Animation *animation);
protected:
std::vector<float>* _splitTimes;
int _nextFrame;
SpriteFrame* _origFrame;
2015-07-13 10:40:43 +08:00
int _currFrameIndex;
unsigned int _executedLoops;
Animation* _animation;
EventCustom* _frameDisplayedEvent;
AnimationFrame::DisplayedEventInfo _frameDisplayedEventInfo;
private:
CC_DISALLOW_COPY_AND_ASSIGN(Animate);
};
/** @class TargetedAction
* @brief 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.
*/
class CC_DLL TargetedAction : public ActionInterval
{
public:
/** Create an action with the specified action and forced target.
*
* @param target The target needs to override.
* @param action The action needs to override.
* @return An autoreleased TargetedAction object.
*/
static TargetedAction* create(Node* target, FiniteTimeAction* action);
/** Sets the target that the action will be forced to run with.
*
* @param forcedTarget 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.
*
* @return The target that the action is forced to run with.
*/
Node* getForcedTarget() { return _forcedTarget; }
const Node* getForcedTarget() const { return _forcedTarget; }
//
// Overrides
//
virtual TargetedAction* clone() const override;
virtual TargetedAction* reverse() const override;
virtual void startWithTarget(Node *target) override;
virtual void stop(void) override;
2015-01-20 15:41:59 +08:00
/**
* @param time In seconds.
2015-01-20 15:41:59 +08:00
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
TargetedAction();
virtual ~TargetedAction();
/** Init an action with the specified action and forced target */
bool initWithTarget(Node* target, FiniteTimeAction* action);
protected:
FiniteTimeAction* _action;
Node* _forcedTarget;
private:
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
};
/**
* @class ActionFloat
* @brief Action used to animate any value in range [from,to] over specified time interval
*/
class CC_DLL ActionFloat : public ActionInterval
{
public:
/**
* Callback function used to report back result
*/
typedef std::function<void(float value)> ActionFloatCallback;
/**
* Creates FloatAction with specified duration, from value, to value and callback to report back
* results
* @param duration of the action
* @param from value to start from
* @param to value to be at the end of the action
* @param callback to report back result
*
* @return An autoreleased ActionFloat object
*/
static ActionFloat* create(float duration, float from, float to, ActionFloatCallback callback);
/**
* Overridden ActionInterval methods
*/
void startWithTarget(Node* target) override;
void update(float delta) override;
ActionFloat* reverse() const override;
ActionFloat* clone() const override;
CC_CONSTRUCTOR_ACCESS:
ActionFloat() {};
virtual ~ActionFloat() {};
bool initWithDuration(float duration, float from, float to, ActionFloatCallback callback);
protected:
/* From value */
float _from;
/* To value */
float _to;
/* delta time */
float _delta;
/* Callback to report back results */
ActionFloatCallback _callback;
private:
CC_DISALLOW_COPY_AND_ASSIGN(ActionFloat);
};
2012-06-20 18:09:11 +08:00
// end of actions group
/// @}
NS_CC_END
#endif //__ACTION_CCINTERVAL_ACTION_H__