开发者

Is there a way for me to fill between 2 ccDrawCircle's and what is the segments parameter?

On cocos2d-iphone, I can use ccDrawCircle to draw circles. What I don't know 开发者_StackOverflow社区how to do is to fill between 2 ccDrawCircles that have the same ccp centre (sort of like a bicycle tire). I tried just using drawing a whole lot of ccdrawcircles in an attempt to get the effect i want but I'm hoping there is another way.

I'm also a little confused on what does the 'segments' parameter do for ccDrawCircle.


For anyone else who needs the answer to my questions, it is possible to write a while loop within an overridden draw method that is inherited within CCLayer. You just have to make sure you have the variables updated at your controller's update method.

-(void) draw
{
    ...
    self.currentInnerRadius= self.minimumInnerRadius;
    while (self.currentInnerRadius < self.OuterRadius) 
    {
        ccDrawCircle( ccp(x,y), self.currentInnerRadius, CC_DEGREES_TO_RADIANS(90), 100, NO);
        self.currentInnerRadius++;
    }
}

The segments parameter seems to be the number of triangle/vertices/segments you want to use to draw the circle. The higher the number, the 'smoother' your circle will be. Hopefully this helps someone else.

Cheers!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜