Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ccGridSize in cocos2d

While using ccWave, one of the parameters was grid and it showed that the value should be of type ccGridSize.

I would like to know what a ccGridSize is.. What value should be given for a ccGridSize variable?

The code for ccWaves is as follows...

[CCWaves actionWithWaves:<(int)> amplitude:<(float)>
              horizontal:<(BOOL)> vertical:<(BOOL)>
                    grid:<(ccGridSize)> duration:<(ccTime)>]; 

What value can be given in the place of the parameter grid???

like image 610
Deepzz Avatar asked May 29 '12 08:05

Deepzz


2 Answers

Cocos2d defines ccGridSize as:

typedef struct _ccGridSize
{
    NSInteger   x;
    NSInteger   y;
} ccGridSize;

And provides an inline factory function:

static inline ccGridSize ccg(const NSInteger x, const NSInteger y);

So you can write your call as:

... grid:ccg(gridSizeX, gridSizeY)

Where gridSizeX and gridSizeY define a number of grid columns and rows for your effect.

like image 133
iHunter Avatar answered Nov 07 '22 06:11

iHunter


From cctypes.h:

 typedef struct _ccGridSize
 {
        NSInteger   x;
        NSInteger   y;
 } ccGridSize;

So it's just a couple of ints to state how big every step is of the grid that you are going to animate.

like image 21
Jack Avatar answered Nov 07 '22 06:11

Jack