objective c - Kobold2d: KKInput touch handling using touchPhases -


i don´t understand this, trying set touch handling using default template, difference have made delegate how handle touches classs implement protocol. problem ktouchphase works ktouchphasecancelled.

-(void) update:(cctime)delta {     if ([input isanytouchonnode:self touchphase:kktouchphaseany])     {          cclog(@"touch: beg=%d mov=%d sta=%d end=%d can=%d",               [input isanytouchonnode:self touchphase:kktouchphasebegan],               [input isanytouchonnode:self touchphase:kktouchphasemoved],               [input isanytouchonnode:self touchphase:kktouchphasestationary],               [input isanytouchonnode:self touchphase:kktouchphaseended],               [input isanytouchonnode:self touchphase:kktouchphasecancelled]);      }      ccdirector* director = [ccdirector shareddirector];      if (director.currentplatformisios)     {         [self gesturerecognition]; // calls method pasted bellow          if ([kkinput sharedinput].anytouchendedthisframe)         {             cclog(@"anytouchendedthisframe");         }     } 

.->

-(void) gesturerecognition {     nsassert(self.delegate != nil, @"delegate must non-nil");      if (input.gesturetaprecognizedthisframe)     {         [self.delegate moveobjecttonewposition:input];     } 

and delegate implements protocol decides in moveobjecttonewposition:

-(void) moveobjecttonewposition:(kkinput *)input {     //kkinput *input = [kkinput sharedinput];     cgsize screensize = [[ccdirector shareddirector] winsize];      cgpoint touchlocation = [input locationofanytouchinphase:kktouchphasebegan];     [self touchesbegan:touchlocation];  }   - (void)touchesbegan: (cgpoint)touchlocation {     cclog(@"x: %f y: %f", touchlocation.x, touchlocation.y); } 

but touch phase gives me coordinates kktouchphasecancelled or kktouchphaseany... happening here?

gesture recognizers capture touch events, tap recognizer practically detect touch (most touches taps) , therefore don't see other touch events (phases) cancel.

to fix use tap gesture's position property instead of location of touch.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -