2012-04-19 14:35:52 +08:00
|
|
|
/****************************************************************************
|
2012-09-24 21:22:20 +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_CCTILEDGRID_ACTION_H__
|
|
|
|
#define __ACTION_CCTILEDGRID_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 CCShakyTiles3D action */
|
|
|
|
class CC_DLL CCShakyTiles3D : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
|
|
|
bool initWithRange(int nRange, bool bShakeZ, const ccGridSize& gridSize,
|
2012-06-08 13:55:28 +08:00
|
|
|
float duration);
|
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
|
|
|
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
2012-06-14 17:18:05 +08:00
|
|
|
static CCShakyTiles3D* create(int nRange, bool bShakeZ, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nRandrange;
|
|
|
|
bool m_bShakeZ;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCShatteredTiles3D action */
|
|
|
|
class CC_DLL CCShatteredTiles3D : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
|
|
|
bool initWithRange(int nRange, bool bShatterZ, const ccGridSize& gridSize,
|
2012-06-08 13:55:28 +08:00
|
|
|
float duration);
|
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
|
|
|
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCShatteredTiles3D* create(int nRange, bool bShatterZ, const ccGridSize& gridSize,
|
2012-06-08 13:55:28 +08:00
|
|
|
float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
int m_nRandrange;
|
|
|
|
bool m_bOnce;
|
|
|
|
bool m_bShatterZ;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Tile;
|
|
|
|
/** @brief CCShuffleTiles action
|
|
|
|
Shuffle the tiles in random order
|
|
|
|
*/
|
|
|
|
class CC_DLL CCShuffleTiles : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~CCShuffleTiles(void);
|
|
|
|
/** initializes the action with a random seed, the grid size and the duration */
|
2012-06-08 13:55:28 +08:00
|
|
|
bool initWithSeed(int s, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
void shuffle(int *pArray, unsigned int nLen);
|
|
|
|
ccGridSize getDelta(const ccGridSize& pos);
|
|
|
|
void placeTile(const ccGridSize& pos, Tile *t);
|
|
|
|
|
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
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 a random seed, the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCShuffleTiles* create(int s, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
int m_nSeed;
|
|
|
|
unsigned int m_nTilesCount;
|
|
|
|
int *m_pTilesOrder;
|
|
|
|
Tile *m_pTiles;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCFadeOutTRTiles action
|
|
|
|
Fades out the tiles in a Top-Right direction
|
|
|
|
*/
|
|
|
|
class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual float testFunc(const ccGridSize& pos, float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
void turnOnTile(const ccGridSize& pos);
|
|
|
|
void turnOffTile(const ccGridSize& pos);
|
|
|
|
virtual void transformTile(const ccGridSize& pos, float distance);
|
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
|
|
|
/** creates the action with the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFadeOutTRTiles* create(const ccGridSize& gridSize, float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCFadeOutBLTiles action.
|
|
|
|
Fades out the tiles in a Bottom-Left direction
|
|
|
|
*/
|
|
|
|
class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual float testFunc(const ccGridSize& pos, 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
|
|
|
/** creates the action with the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFadeOutBLTiles* create(const ccGridSize& gridSize, float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCFadeOutUpTiles action.
|
|
|
|
Fades out the tiles in upwards direction
|
|
|
|
*/
|
|
|
|
class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual float testFunc(const ccGridSize& pos, float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual void transformTile(const ccGridSize& pos, float distance);
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFadeOutUpTiles* create(const ccGridSize& gridSize, float time);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCFadeOutDownTiles action.
|
|
|
|
Fades out the tiles in downwards direction
|
|
|
|
*/
|
|
|
|
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
|
|
|
|
{
|
|
|
|
public:
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual float testFunc(const ccGridSize& pos, 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
|
|
|
/** creates the action with the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFadeOutDownTiles* create(const ccGridSize& gridSize, float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCTurnOffTiles action.
|
|
|
|
Turn off the files in random order
|
|
|
|
*/
|
|
|
|
class CC_DLL CCTurnOffTiles : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~CCTurnOffTiles(void);
|
|
|
|
/** initializes the action with a random seed, the grid size and the duration */
|
2012-06-08 13:55:28 +08:00
|
|
|
bool initWithSeed(int s, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
void shuffle(int *pArray, unsigned int nLen);
|
|
|
|
void turnOnTile(const ccGridSize& pos);
|
|
|
|
void turnOffTile(const ccGridSize& pos);
|
|
|
|
|
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
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
|
|
|
/** creates the action with the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCTurnOffTiles* create(const ccGridSize& size, float d);
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action with a random seed, the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCTurnOffTiles* create(int s, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nSeed;
|
|
|
|
unsigned int m_nTilesCount;
|
|
|
|
int *m_pTilesOrder;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCWavesTiles3D action. */
|
|
|
|
class CC_DLL CCWavesTiles3D : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** waves amplitude */
|
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
|
|
|
|
|
|
|
/** waves amplitude rate */
|
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
|
|
|
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
2012-06-08 13:55:28 +08:00
|
|
|
bool initWithWaves(int wav, float amp, const ccGridSize& gridSize, float duration);
|
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 number of waves, the waves amplitude, the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCWavesTiles3D* create(int wav, float amp, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
int m_nWaves;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCJumpTiles3D action.
|
|
|
|
A sin function is executed to move the tiles across the Z axis
|
|
|
|
*/
|
|
|
|
class CC_DLL CCJumpTiles3D : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** amplitude of the sin*/
|
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
|
|
|
|
|
|
|
/** amplitude rate */
|
|
|
|
inline float getAmplitudeRate(void) { return m_fAmplitudeRate; }
|
|
|
|
inline void setAmplitudeRate(float fAmplitudeRate) { m_fAmplitudeRate = fAmplitudeRate; }
|
|
|
|
|
|
|
|
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
2012-06-08 13:55:28 +08:00
|
|
|
bool initWithJumps(int j, float amp, const ccGridSize& gridSize, float duration);
|
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-06 18:51:33 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCJumpTiles3D* create(int j, float amp, const ccGridSize& gridSize, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
int m_nJumps;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCSplitRows action */
|
|
|
|
class CC_DLL CCSplitRows : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public :
|
|
|
|
/** initializes the action with the number of rows to split and the duration */
|
2012-06-08 13:55:28 +08:00
|
|
|
bool initWithRows(int nRows, float duration);
|
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
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
|
|
|
|
|
|
public:
|
2012-12-06 18:51:33 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action with the number of rows to split and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCSplitRows* create(int nRows, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
int m_nRows;
|
|
|
|
CCSize m_winSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief CCSplitCols action */
|
|
|
|
class CC_DLL CCSplitCols : public CCTiledGrid3DAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initializes the action with the number of columns to split and the duration */
|
2012-06-08 13:55:28 +08:00
|
|
|
bool initWithCols(int nCols, float duration);
|
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
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** creates the action with the number of columns to split and the duration */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCSplitCols* create(int nCols, float duration);
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
|
|
|
int m_nCols;
|
|
|
|
CCSize m_winSize;
|
|
|
|
};
|
|
|
|
|
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_CCTILEDGRID_ACTION_H__
|