ios - Cocos2d v3: What do you pass into drawPolyWithVerts? -


i've looked @ documentation ccdrawnode, , method draw polygon is

- (void)drawpolywithverts:(const cgpoint *)verts                      count:(nsuinteger)count                  fillcolor:(cccolor *)fill                borderwidth:(cgfloat)width                bordercolor:(cccolor *)line 

http://www.cocos2d-swift.org/docs/api/classes/ccdrawnode.html#//api/name/drawpolywithverts:count:fillcolor:borderwidth:bordercolor:

i'm confused (const cgpoint *)certs parameter. thought cgpoint struct, , didn't need pointer.

also, i'm assuming you'll need series of points construct polygon, , thought cgpoint represented 1 point.

i've checked through cocos 2d programming guide , couldn't see method in there.

https://www.makegameswith.us/docs/#!/cocos2d/1.1/overview

i've check out cggeometry reference on apple's site, couldn't see there.

https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/cggeometry/reference/reference.html#//apple_ref/c/func/cgpointmake

i think i'm missing basic c / objective-c, can't figure out.

my question

what pass drawpolywithverts:(const cgpoint *)verts, , how make it?

as user667648 pointed out in comments, answer pass c array of cgpoints method.

example:

cgpoint polygon[4] =         {             cgpointmake(0, 0),             cgpointmake(2, 0),             cgpointmake(0, 7),             cgpointmake(2, 25)         }; 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -