Note that there are some explanatory texts on larger screens.

plurals
  1. PODo i need to call [convertToGl]?
    text
    copied!<p>i'm using cocos2d and i have subclassed cccnode (i want to draw circles and that works) .h</p> <pre><code>@interface CCSpriteCircle : CCSprite { float radius; float angle; //in radians NSUInteger segments; BOOL drawLineToCenter; ccColor4B cColor; } -(id) initWithRadius: (float)radius_ withAngle: (float)angle_ withSegments: (NSUInteger)segments_ withDrawLineToCenter:(BOOL)drawLineToCenter_; @property(nonatomic,assign) float radius; @property(nonatomic,assign) float angle; @property(nonatomic,assign) NSUInteger segments; @property(nonatomic,assign) BOOL drawLineToCenter; @property(nonatomic,assign) ccColor4B cColor; @end </code></pre> <p>//my .m file</p> <p>@implementation CCSpriteCircle @synthesize radius, angle,segments,drawLineToCenter,cColor;</p> <pre><code>-(id) initWithRadius: (float)radius_ withAngle: (float)angle_ withSegments: (NSUInteger)segments_ withDrawLineToCenter:(BOOL)drawLineToCenter_ { if( (self=[super init])) { self.radius = radius_; self.angle = angle_; self.segments = segments_; self.drawLineToCenter = drawLineToCenter_; //[self draw]; } return self; } -(void)draw { glLineWidth(1); glColor4ub(cColor.r, cColor.g, cColor.b, cColor.a); ccDrawCircle(ccp(self.position.x,self.position.y), radius, angle, segments, drawLineToCenter); // restore original values glLineWidth(1); glColor4ub(255,255,255,255); glPointSize(1); } @end </code></pre> <p>All works fine except that if i place the center of my ccspritecircle to 480 (that's the end of the screen) it doesnt appears but if i place it to 200px it's at the end of the screen.</p> <p>if i change the position code in my helloworld scene like this: from:</p> <p>circle_.position = ccp(480, 0);</p> <p>to:</p> <pre><code>circle_.position = [[CCDirector sharedDirector] convertToGL: CGPointMake(480,0)]; </code></pre> <p>then i dont see the circle anymore. Am i doing something wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload