2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
2012-06-14 15:13:16 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2012-04-19 14:35:52 +08:00
|
|
|
Copyright (c) 2009 On-Core
|
|
|
|
|
|
|
|
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_CCGRID3D_ACTION_H__
|
|
|
|
#define __ACTION_CCGRID3D_ACTION_H__
|
|
|
|
|
|
|
|
#include "CCActionGrid.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
2012-06-20 18:09:11 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup actions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/**
|
|
|
|
@brief CCWaves3D action
|
|
|
|
*/
|
|
|
|
class CC_DLL CCWaves3D : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitude(void) { return _amplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitudeRate(void) { return _amplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-12-26 18:59:31 +08:00
|
|
|
/** initializes an action with duration, grid size, waves and amplitude */
|
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-16 03:38:32 +08:00
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCWaves3D* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
2012-12-26 18:59:31 +08:00
|
|
|
/** creates an action with duration, grid size, waves and amplitude */
|
|
|
|
static CCWaves3D* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCFlipX3D action */
|
|
|
|
class CC_DLL CCFlipX3D : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
virtual bool initWithDuration(float duration);
|
|
|
|
virtual bool initWithSize(const CCSize& gridSize, float duration);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCFlipX3D* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFlipX3D* create(float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCFlipY3D action */
|
|
|
|
class CC_DLL CCFlipY3D : public CCFlipX3D
|
|
|
|
{
|
|
|
|
public:
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFlipY3D* create(float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCLens3D action */
|
|
|
|
class CC_DLL CCLens3D : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Get lens center position */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getLensEffect(void) { return _lensEffect; }
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Set lens center position */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setLensEffect(float fLensEffect) { _lensEffect = fLensEffect; }
|
2013-02-16 11:12:12 +08:00
|
|
|
/** Set whether lens is concave */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline void setConcave(bool bConcave) { _concave = bConcave; }
|
2013-02-16 11:12:12 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline const CCPoint& getPosition(void) { return _position; }
|
2012-04-19 14:35:52 +08:00
|
|
|
void setPosition(const CCPoint& position);
|
|
|
|
|
|
|
|
/** initializes the action with center position, radius, a grid size and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCLens3D* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with center position, radius, a grid size and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
static CCLens3D* create(float duration, const CCSize& gridSize, const CCPoint& position, float radius);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
/* lens center position */
|
2013-06-15 14:03:30 +08:00
|
|
|
CCPoint _position;
|
|
|
|
float _radius;
|
2012-04-19 14:35:52 +08:00
|
|
|
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
|
2013-06-15 14:03:30 +08:00
|
|
|
float _lensEffect;
|
2013-02-16 11:12:12 +08:00
|
|
|
/** lens is concave. (true = concave, false = convex) default is convex i.e. false */
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _concave;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _dirty;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCRipple3D action */
|
|
|
|
class CC_DLL CCRipple3D : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** get center position */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline const CCPoint& getPosition(void) { return _position; }
|
2012-04-19 14:35:52 +08:00
|
|
|
/** set center position */
|
|
|
|
void setPosition(const CCPoint& position);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitude(void) { return _amplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitudeRate(void) { return _amplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCRipple3D* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
static CCRipple3D* create(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
/* center position */
|
2013-06-15 14:03:30 +08:00
|
|
|
CCPoint _position;
|
|
|
|
float _radius;
|
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCShaky3D action */
|
|
|
|
class CC_DLL CCShaky3D : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, int range, bool shakeZ);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCShaky3D* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with a range, shake Z vertices, a grid and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
static CCShaky3D* create(float duration, const CCSize& gridSize, int range, bool shakeZ);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
int _randrange;
|
|
|
|
bool _shakeZ;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCLiquid action */
|
|
|
|
class CC_DLL CCLiquid : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitude(void) { return _amplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitudeRate(void) { return _amplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with amplitude, a grid and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCLiquid* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with amplitude, a grid and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
static CCLiquid* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCWaves action */
|
|
|
|
class CC_DLL CCWaves : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitude(void) { return _amplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitudeRate(void) { return _amplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCWaves* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
static CCWaves* create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned int _waves;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
|
|
|
bool _vertical;
|
|
|
|
bool _horizontal;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCTwirl action */
|
|
|
|
class CC_DLL CCTwirl : public CCGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** get twirl center */
|
2013-06-15 14:03:30 +08:00
|
|
|
inline const CCPoint& getPosition(void) { return _position; }
|
2012-04-19 14:35:52 +08:00
|
|
|
/** set twirl center */
|
|
|
|
void setPosition(const CCPoint& position);
|
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitude(void) { return _amplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-15 14:03:30 +08:00
|
|
|
inline float getAmplitudeRate(void) { return _amplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
bool initWithDuration(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude);
|
2013-06-16 03:38:32 +08:00
|
|
|
|
|
|
|
/** returns a new clone of the action */
|
|
|
|
virtual CCTwirl* clone() const;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
2012-12-26 18:59:31 +08:00
|
|
|
static CCTwirl* create(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
/* twirl center */
|
2013-06-15 14:03:30 +08:00
|
|
|
CCPoint _position;
|
|
|
|
unsigned int _twirls;
|
|
|
|
float _amplitude;
|
|
|
|
float _amplitudeRate;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of actions group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __ACTION_CCGRID3D_ACTION_H__
|