2010-08-18 16:56:27 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010 cocos2d-x.org
|
|
|
|
|
|
|
|
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__
|
|
|
|
|
2010-12-22 15:15:04 +08:00
|
|
|
#include "CCActionGrid.h"
|
2010-08-18 16:56:27 +08:00
|
|
|
|
|
|
|
namespace cocos2d
|
|
|
|
{
|
2010-09-28 18:27:33 +08:00
|
|
|
/**
|
2010-09-29 09:44:57 +08:00
|
|
|
@brief CCWaves3D action
|
2010-09-28 18:27:33 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCWaves3D : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
2010-09-29 17:39:45 +08:00
|
|
|
/** init the action */
|
2010-08-18 16:56:27 +08:00
|
|
|
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-29 17:39:45 +08:00
|
|
|
/** create the action */
|
2010-08-18 16:56:27 +08:00
|
|
|
static CCWaves3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nWaves;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCFlipX3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCFlipX3D : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
bool initWithDuration(ccTime duration);
|
|
|
|
virtual bool initWithSize(ccGridSize gridSize, ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
static CCFlipX3D* actionWithDuration(ccTime duration);
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCFlipY3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCFlipY3D : public CCFlipX3D
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void update(ccTime time);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
static CCFlipY3D* actionWithDuration(ccTime duration);
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCLens3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCLens3D : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-29 17:39:45 +08:00
|
|
|
/** Get lens center position */
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getLensEffect(void) { return m_fLensEffect; }
|
2010-09-29 17:39:45 +08:00
|
|
|
/** Set lens center position */
|
2010-08-18 16:56:27 +08:00
|
|
|
inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; }
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
inline CCPoint getPosition(void) { return m_position; }
|
|
|
|
void setPosition(CCPoint position);
|
2010-08-18 16:56:27 +08:00
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with center position, radius, a grid size and duration */
|
2011-03-07 17:11:57 +08:00
|
|
|
bool initWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
|
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with center position, radius, a grid size and duration */
|
2011-03-07 17:11:57 +08:00
|
|
|
static CCLens3D* actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, ccTime duration);
|
2010-08-18 16:56:27 +08:00
|
|
|
protected:
|
2010-09-29 17:39:45 +08:00
|
|
|
/* lens center position */
|
2011-03-07 17:11:57 +08:00
|
|
|
CCPoint m_position;
|
2010-08-18 16:56:27 +08:00
|
|
|
float m_fRadius;
|
2010-09-29 17:39:45 +08:00
|
|
|
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
|
2010-08-18 16:56:27 +08:00
|
|
|
float m_fLensEffect;
|
2010-12-24 11:40:44 +08:00
|
|
|
|
|
|
|
/* @since v0.99.5 */
|
2011-03-07 17:11:57 +08:00
|
|
|
// CCPoint m_lastPosition;
|
|
|
|
CCPoint m_positionInPixels;
|
2010-12-24 11:40:44 +08:00
|
|
|
bool m_bDirty;
|
2010-08-18 16:56:27 +08:00
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCRipple3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCRipple3D : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-29 17:39:45 +08:00
|
|
|
/** get center position */
|
2011-03-07 17:11:57 +08:00
|
|
|
inline CCPoint getPosition(void) { return m_position; }
|
2010-09-29 17:39:45 +08:00
|
|
|
/** set center position */
|
2011-03-07 17:11:57 +08:00
|
|
|
void setPosition(CCPoint position);
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
2011-03-07 17:11:57 +08:00
|
|
|
bool initWithPosition(CCPoint pos, float r, int wav, float amp,
|
2010-08-18 16:56:27 +08:00
|
|
|
ccGridSize gridSize, ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
|
2011-03-07 17:11:57 +08:00
|
|
|
static CCRipple3D* actionWithPosition(CCPoint pos, float r, int wav, float amp,
|
2010-08-18 16:56:27 +08:00
|
|
|
ccGridSize gridSize, ccTime duration);
|
|
|
|
protected:
|
2010-09-29 17:39:45 +08:00
|
|
|
/* center position */
|
2011-03-07 17:11:57 +08:00
|
|
|
CCPoint m_position;
|
2010-08-18 16:56:27 +08:00
|
|
|
float m_fRadius;
|
|
|
|
int m_nWaves;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
2010-12-24 11:40:44 +08:00
|
|
|
|
|
|
|
/*@since v0.99.5*/
|
2011-03-07 17:11:57 +08:00
|
|
|
CCPoint m_positionInPixels;
|
2010-08-18 16:56:27 +08:00
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCShaky3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCShaky3D : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
bool initWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with a range, shake Z vertices, a grid and duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
static CCShaky3D* actionWithRange(int range, bool shakeZ, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nRandrange;
|
|
|
|
bool m_bShakeZ;
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCLiquid action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCLiquid : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with amplitude, a grid and duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
bool initWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with amplitude, a grid and duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
static CCLiquid* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nWaves;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCWaves action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCWaves : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
bool initWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize,
|
|
|
|
ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
2010-08-18 16:56:27 +08:00
|
|
|
static CCWaves* actionWithWaves(int wav, float amp, bool h, bool v, ccGridSize gridSize,
|
|
|
|
ccTime duration);
|
|
|
|
protected:
|
|
|
|
int m_nWaves;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
bool m_bVertical;
|
|
|
|
bool m_bHorizontal;
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCTwirl action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTwirl : public CCGrid3DAction
|
2010-08-18 16:56:27 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-29 17:39:45 +08:00
|
|
|
/** get twirl center */
|
2011-03-07 17:11:57 +08:00
|
|
|
inline CCPoint getPosition(void) { return m_position; }
|
2010-09-29 17:39:45 +08:00
|
|
|
/** set twirl center */
|
2011-03-07 17:11:57 +08:00
|
|
|
void setPosition(CCPoint position);
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
2010-09-29 17:39:45 +08:00
|
|
|
|
2010-08-18 16:56:27 +08:00
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
2011-03-07 17:11:57 +08:00
|
|
|
bool initWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize,
|
2010-08-18 16:56:27 +08:00
|
|
|
ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-18 16:56:27 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
2011-03-07 17:11:57 +08:00
|
|
|
static CCTwirl* actionWithPosition(CCPoint pos, int t, float amp, ccGridSize gridSize,
|
2010-08-18 16:56:27 +08:00
|
|
|
ccTime duration);
|
|
|
|
protected:
|
2010-09-29 17:39:45 +08:00
|
|
|
/* twirl center */
|
2011-03-07 17:11:57 +08:00
|
|
|
CCPoint m_position;
|
2010-08-18 16:56:27 +08:00
|
|
|
int m_nTwirls;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
2010-12-24 11:40:44 +08:00
|
|
|
|
|
|
|
/*@since v0.99.5 */
|
2011-03-07 17:11:57 +08:00
|
|
|
CCPoint m_positionInPixels;
|
2010-08-18 16:56:27 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __ACTION_CCGRID3D_ACTION_H__
|