"화이트 보드"를 추가하여 사람들이 그 위에 선을 그릴 수있게하려고합니다.cocos2d 스케치 보드의 작은 문제
유일한 문제는 매우 빠르게 그리면 스프라이트가 꽤 멀리 떨어져서 문자 나 숫자를 그릴 때 간신히 읽을 수 있다는 것입니다. 서로 다른 스프라이트 사이에는 많은 공간이 있습니다.
그림의 대부분이 내가 생각하는 내 방법입니다.
-(void) update:(ccTime)delta
{
CCDirector* director = [CCDirector sharedDirector];
CCRenderTexture* rtx = (CCRenderTexture*)[self getChildByTag:1];
// explicitly don't clear the rendertexture
[rtx begin];
for (UITouch* touch in touches)
{
CGPoint touchLocation = [director convertToGL:[touch locationInView:director.openGLView]];
touchLocation = [rtx.sprite convertToNodeSpace:touchLocation];
// because the rendertexture sprite is flipped along its Y axis the Y coordinate must be flipped:
touchLocation.y = rtx.sprite.contentSize.height - touchLocation.y;
CCSprite* sprite = [[CCSprite alloc] initWithFile:@"Cube_Ones.png"];
sprite.position = touchLocation;
sprite.scale = 0.1f;
[self addChild:sprite];
[placedSprites addObject:sprite];
}
[rtx end];
}
Maybe this is the cause?
[self scheduleUpdate];
나는 업데이트 사이의 시간을 줄이는 방법에 대해 완전히 모르겠다. 사전
마지막 터치와 현재 터치 사이를 확인하려면 거리 메서드가 필요합니다. 맞습니까? 그리고 정확히 어떻게 두 개의 터치 사이에 포인트를 생성하는지 이해할 수 없습니다. 그리고 나는이 모든 것을 업데이트 방법으로 할 것인가? 감사 – Austin