CcGridSize in cocos2d

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

I would like to know what ccGridSize . What value should be specified for the 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 set instead of the parameter grid?

+6
source share
2 answers

From cctypes.h :

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

So, these are just a couple of ints to indicate how large each step of the grid you are about to animate.

+3
source

Cocos2d defines ccGridSize as:

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

And provides a built-in factory function:

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

So you can write your call like:

 ... grid:ccg(gridSizeX, gridSizeY) 

Where gridSizeX and gridSizeY determine the number of grid columns and rows for your effect.

+3
source

Source: https://habr.com/ru/post/916887/


All Articles