Kobold2d:KKInput anyTouchEndedThisFrame [英] Kobold2d: KKInput anyTouchEndedThisFrame
本文介绍了Kobold2d:KKInput anyTouchEndedThisFrame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
anyTouchEndedThisFrame
必须是有问题我已经尝试了一切现在,它只会推定触摸,如果我结束,如果我移动手指,如果我触摸和如果我错了,请更正我。
The anyTouchEndedThisFrame
must be buggy I´ve tried about everything now, and it will only reckonize a touch that´s ended if I move the finger, if I touch and let go at the same spot it does not reckonize it, If I am wrong please correct me
-(void) moveObjectToNewPosition:(KKInput *)input
{
if (input.anyTouchEndedThisFrame) {
[self touchesEnded:[input locationOfAnyTouchInPhase:KKTouchPhaseAny]];
} if (input.anyTouchBeganThisFrame) {
[self touchesBegan:[input locationOfAnyTouchInPhase:KKTouchPhaseBegan]];
}
推荐答案
我应该实现这个方法使用非常简单
it has never worked even to me, you should implement this method which is very simple to use
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
UITouch * touch = [[allTouches allObjects] objectAtIndex:0];
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
}
-(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
}
-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
}
并添加到您的init中:
and add into your init this:
[self setTouchEnabled:YES];
这篇关于Kobold2d:KKInput anyTouchEndedThisFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文