Hi,
I'm doing a simple test with cocos2D but I can't find the solution to my problem. I explain the thing.
I draw a circle with a startPoint (touchBegan) and an actual point (Touch Moved). In the Draw function I draw the circle depending upon his center and the distance between the startpoint and actual point (rayon in french).
The problem is when I move my finger very fast several circles appear on the iphone screen, I know there is a problem somewhere but I dont't know where.
Does anyone can explain me the problem ? (I draw 60 times per second and I don't know how many time per second I change the value of the rayon)
This is the code I use to draw the circle, the function "distance" calculate the distance between the center of the circle and the position of the user's finger.
Please excuse my bad english and maybe my bad clear explanation
-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint touchLocation = [touch locationInView: [touch view]];
end = [[CCDirector sharedDirector] convertToGL: touchLocation];
}
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
firing = YES;
CGPoint touchLocation = [touch locationInView: [touch view]];
origin = [[CCDirector sharedDirector] convertToGL: touchLocation];
end = [[CCDirector sharedDirector] convertToGL: touchLocation];
return YES;
}
-(void) draw
{
if(firing){
glLineWidth(3);
glColor4ub(0, 255, 255, 255);
ccDrawCircle(origin, [self Distance:origin to:end], CC_DEGREES_TO_RADIANS(90), 40, NO);
}
}