2010-08-20 17:38:48 +08:00
|
|
|
/****************************************************************************
|
2011-03-19 10:59:01 +08:00
|
|
|
Copyright (c) 2010-2011 cocos2d-x.org
|
|
|
|
Copyright (c) 2009 On-Core
|
2010-08-20 17:38:48 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __ACTION_CCTILEDGRID_ACTION_H__
|
|
|
|
#define __ACTION_CCTILEDGRID_ACTION_H__
|
|
|
|
|
2010-12-22 15:15:04 +08:00
|
|
|
#include "CCActionGrid.h"
|
2010-08-20 17:38:48 +08:00
|
|
|
|
|
|
|
namespace cocos2d
|
|
|
|
{
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCShakyTiles3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCShakyTiles3D : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,
|
|
|
|
ccTime duration);
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCShakyTiles3D* actionWithRange(int nRange, bool bShakeZ, ccGridSize gridSize,
|
|
|
|
ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nRandrange;
|
|
|
|
bool m_bShakeZ;
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCShatteredTiles3D action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCShatteredTiles3D : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithRange(int nRange, bool bShatterZ, ccGridSize gridSize,
|
|
|
|
ccTime duration);
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCShatteredTiles3D* actionWithRange(int nRange, bool bShatterZ, ccGridSize gridSize,
|
|
|
|
ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nRandrange;
|
|
|
|
bool m_bOnce;
|
|
|
|
bool m_bShatterZ;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Tile;
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCShuffleTiles action
|
|
|
|
Shuffle the tiles in random order
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCShuffleTiles : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
~CCShuffleTiles(void);
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with a random seed, the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
2011-07-01 15:08:23 +08:00
|
|
|
void shuffle(int *pArray, unsigned int nLen);
|
2010-08-20 17:38:48 +08:00
|
|
|
ccGridSize getDelta(ccGridSize pos);
|
|
|
|
void placeTile(ccGridSize pos, Tile *t);
|
|
|
|
|
2010-08-28 12:02:10 +08:00
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-20 17:38:48 +08:00
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with a random seed, the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCShuffleTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
2011-07-01 15:08:23 +08:00
|
|
|
int m_nSeed;
|
|
|
|
unsigned int m_nTilesCount;
|
|
|
|
int *m_pTilesOrder;
|
|
|
|
Tile *m_pTiles;
|
2010-08-20 17:38:48 +08:00
|
|
|
};
|
|
|
|
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCFadeOutTRTiles action
|
|
|
|
Fades out the tiles in a Top-Right direction
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCFadeOutTRTiles : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual float testFunc(ccGridSize pos, ccTime time);
|
|
|
|
void turnOnTile(ccGridSize pos);
|
|
|
|
void turnOffTile(ccGridSize pos);
|
|
|
|
virtual void transformTile(ccGridSize pos, float distance);
|
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCFadeOutTRTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
|
|
};
|
|
|
|
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCFadeOutBLTiles action.
|
|
|
|
Fades out the tiles in a Bottom-Left direction
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual float testFunc(ccGridSize pos, ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCFadeOutBLTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
|
|
};
|
|
|
|
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCFadeOutUpTiles action.
|
|
|
|
Fades out the tiles in upwards direction
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCFadeOutUpTiles : public CCFadeOutTRTiles
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual float testFunc(ccGridSize pos, ccTime time);
|
|
|
|
virtual void transformTile(ccGridSize pos, float distance);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCFadeOutUpTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
|
|
};
|
|
|
|
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCFadeOutDownTiles action.
|
|
|
|
Fades out the tiles in downwards direction
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual float testFunc(ccGridSize pos, ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCFadeOutDownTiles* actionWithSize(ccGridSize gridSize, ccTime time);
|
|
|
|
};
|
|
|
|
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCTurnOffTiles action.
|
|
|
|
Turn off the files in random order
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCTurnOffTiles : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
~CCTurnOffTiles(void);
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with a random seed, the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
2011-07-01 15:08:23 +08:00
|
|
|
void shuffle(int *pArray, unsigned int nLen);
|
2010-08-20 17:38:48 +08:00
|
|
|
void turnOnTile(ccGridSize pos);
|
|
|
|
void turnOffTile(ccGridSize pos);
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-28 12:02:10 +08:00
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the grid size and the duration */
|
2010-09-01 12:02:36 +08:00
|
|
|
static CCTurnOffTiles* actionWithSize(ccGridSize size, ccTime d);
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with a random seed, the grid size and the duration */
|
2010-09-01 12:02:36 +08:00
|
|
|
static CCTurnOffTiles* actionWithSeed(int s, ccGridSize gridSize, ccTime duration);
|
2010-08-20 17:38:48 +08:00
|
|
|
|
|
|
|
protected:
|
2011-07-01 15:08:23 +08:00
|
|
|
int m_nSeed;
|
|
|
|
unsigned int m_nTilesCount;
|
|
|
|
int *m_pTilesOrder;
|
2010-08-20 17:38:48 +08:00
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCWavesTiles3D action. */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCWavesTiles3D : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** waves amplitude */
|
2010-08-20 17:38:48 +08:00
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** waves amplitude rate */
|
2010-08-20 17:38:48 +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 a number of waves, the waves amplitude, the grid size and the duration */
|
2010-08-20 17:38:48 +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-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCWavesTiles3D* actionWithWaves(int wav, float amp, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nWaves;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
};
|
|
|
|
|
2010-12-17 23:44:19 +08:00
|
|
|
/** @brief CCJumpTiles3D action.
|
|
|
|
A sin function is executed to move the tiles across the Z axis
|
2010-08-20 17:38:48 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCJumpTiles3D : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** amplitude of the sin*/
|
2010-08-20 17:38:48 +08:00
|
|
|
inline float getAmplitude(void) { return m_fAmplitude; }
|
|
|
|
inline void setAmplitude(float fAmplitude) { m_fAmplitude = fAmplitude; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** amplitude rate */
|
2010-08-20 17:38:48 +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 the number of jumps, the sin amplitude, the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration);
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCJumpTiles3D* actionWithJumps(int j, float amp, ccGridSize gridSize, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nJumps;
|
|
|
|
float m_fAmplitude;
|
|
|
|
float m_fAmplitudeRate;
|
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCSplitRows action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCSplitRows : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public :
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with the number of rows to split and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithRows(int nRows, ccTime duration);
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
2010-08-28 12:02:10 +08:00
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
2010-08-20 17:38:48 +08:00
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the number of rows to split and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCSplitRows* actionWithRows(int nRows, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nRows;
|
2011-03-07 17:11:57 +08:00
|
|
|
CCSize m_winSize;
|
2010-08-20 17:38:48 +08:00
|
|
|
};
|
|
|
|
|
2010-09-29 09:44:57 +08:00
|
|
|
/** @brief CCSplitCols action */
|
2011-03-07 17:11:57 +08:00
|
|
|
class CC_DLL CCSplitCols : public CCTiledGrid3DAction
|
2010-08-20 17:38:48 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** initializes the action with the number of columns to split and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
bool initWithCols(int nCols, ccTime duration);
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
2010-08-20 17:38:48 +08:00
|
|
|
virtual void update(ccTime time);
|
2010-08-28 12:02:10 +08:00
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
2010-08-20 17:38:48 +08:00
|
|
|
|
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** creates the action with the number of columns to split and the duration */
|
2010-08-20 17:38:48 +08:00
|
|
|
static CCSplitCols* actionWithCols(int nCols, ccTime duration);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_nCols;
|
2011-03-07 17:11:57 +08:00
|
|
|
CCSize m_winSize;
|
2010-08-20 17:38:48 +08:00
|
|
|
};
|
|
|
|
} // end of namespace cocos2d
|
|
|
|
|
|
|
|
#endif // __ACTION_CCTILEDGRID_ACTION_H__
|