2012-10-23 9 views
0
- (void)draw { 
lines[0] = ccp(self.l.x + (segmentIndex[0] * segmentSpacing), self.l.y); 
lines[1] = ccp(self.l.x + (segmentIndex[1] * segmentSpacing), self.l.y + segmentHeight * 1); 
lines[2] = ccp(self.l.x + (segmentIndex[2] * segmentSpacing), self.l.y + segmentHeight * 2); 
lines[3] = ccp(self.l.x + (segmentIndex[3] * segmentSpacing), self.l.y + segmentHeight * 3); 
lines[4] = ccp(lines[3].x + segmentWidth, lines[3].y); 
lines[5] = ccp(lines[2].x + segmentWidth, lines[2].y); 
lines[6] = ccp(lines[1].x + segmentWidth, lines[1].y); 
lines[7] = ccp(lines[0].x + segmentWidth, lines[0].y); 

ccDrawPoly(lines, 8, YES); 
//ccDrawSolidPoly(lines, 8, [self color]); 

}如何ccDrawPoly和填充?

的ccDrawPoly线绘制锯齿款式造型,我打算画。 有4个Y区段,每个区段都有一个由segmentIndex & segmentSpacing确定的点,然后x上的+ segmentWidth共有8个点。 我先走下最左边的点,然后走回去。

当我打电话给ccDrawSolidPoly时,它以不同的方式填充形状。它使用所有最外面的点填充多边形,而不是按点设置的顺序绘制线。

我该如何做ccDrawPoly并填充?

回答

0

写我自己的功能,显然。

论坛结果显示人们编辑了cocos2d ccDrawSolidPoly函数。