如何解决CCMotionStrike在设备上不起作用,但在模拟器中起作用
| 所以我有最新的CCMotionStrike(使用ccVertexesLineToPolygon)。它可以在模拟器中按预期方式工作,但在设备上一次只能绘制一个线段(我必须释放触摸并重新绘制,然后才再次绘制一个线段)//init method:
self.isTouchEnabled = YES;
CGSize s = [[CCDirector sharedDirector] winSize];
// create the streak object and add it to the scene
streak = [CCMotionStreak streakWithFade:2 minSeg:5 width:5 color:ccc3(255,0) image:@\"streak.png\"];
[self addChild:streak];
streak.position = ccp(s.width/2,s.height/2);
-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView: [touch view]];
touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];
[streak setPosition:touchLocation];
isDrawing = true;
}
解决方法
CCMotionStreak仅适用于一种条纹...
编辑:
将
isDrawing = true;
放入ccTouchesBegan
中,并将ccTouchesEnded
放入isDrawing = false;
中
然后,将其从ѭ5移除
我怀疑这与它有什么关系,但是,我总是在[self addChild:streak];
之前放streak.position = ccp(s.width/2,s.height/2);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。