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