Cocos2d iphone cocos2d中的ccGridSize

Cocos2d iphone cocos2d中的ccGridSize,cocos2d-iphone,Cocos2d Iphone,使用ccWave时,其中一个参数是grid,它表明该值应为ccGridSize类型 我想知道什么是ccGridSize。。 应为ccGridSize变量指定什么值 ccWaves的代码如下所示 [CCWaves actionWithWaves:<(int)> amplitude:<(float)> horizontal:<(BOOL)> vertical:<(BOOL)> grid

使用ccWave时,其中一个参数是
grid
,它表明该值应为
ccGridSize
类型

我想知道什么是
ccGridSize
。。 应为
ccGridSize
变量指定什么值

ccWaves的代码如下所示

[CCWaves actionWithWaves:<(int)> amplitude:<(float)>
              horizontal:<(BOOL)> vertical:<(BOOL)>
                    grid:<(ccGridSize)> duration:<(ccTime)>]; 
[CCWaves Action WithWaves:振幅:
水平:垂直:
网格:持续时间:;

在参数网格的位置可以给出什么值?

来自
cctypes.h

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

因此,只需几个整数就可以说明要设置动画的网格的每个步骤有多大。

Cocos2d将
ccGridSize
定义为:

typedef struct _ccGridSize
{
    NSInteger   x;
    NSInteger   y;
} ccGridSize;
并提供内联工厂功能:

static inline ccGridSize ccg(const NSInteger x, const NSInteger y);
因此,您可以将通话记录为:

... grid:ccg(gridSizeX, gridSizeY)

其中
gridSizeX
gridSizeY
为您的效果定义了许多网格列和行。

类似于
ccGridSize gs;gs.x=1;gs.y=1
然后传递
gs
或使用helper方法
ccg(x,y)
@deepth我使用
ccg()
函数创建您的
ccGridSize
,就像使用
ccp()
调用一样。