0

Im trying to pass an array cpVect in a method arguments like this;

cpVect v1[] = {
        cpv(-31.5f/2.0, 70.5f/2.0),
        cpv(43.5f/2.0, 65.5f/2.0),
        cpv(34.5f/2.0, -69.5f/2.0),
        cpv(-52.5f/2.0, -69.5f/2.0)
    };

Rocks *rock = [[Rocks alloc] initWithSpace:space location:ccp(200, 700) filename:@"2_piedra1.png" verts:v1];

and the method:

- (Rocks *)initWithSpace:(cpSpace *)theSpace location:(CGPoint)location filename:(NSString *)filename verts:(cpVect)verts;

but fails with the type

thanks for the help

4

1 回答 1

0

您的方法应如下所示:

  • (Rocks *)initWithSpace:(cpSpace *)theSpace location:(CGPoint)location 文件名:(NSString *)filename verts:(cpVect *)verts;

请注意最后一个参数的 cpVect 之后的“*”。您正在传递一个 cpVect 值的数组(指针),而不仅仅是一个值。

于 2012-04-13T21:21:38.087 回答