Guest User

Untitled

a guest
Jul 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. - (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  2. {
  3. UITouch *touch = [touches anyObject];
  4. if( touch )
  5. {
  6. CGPoint location = [touch locationInView: [touch view]];
  7. CGPoint convertedPoint = [[Director sharedDirector] convertToGL:location];
  8. int x= convertedPoint.x;
  9. int y = convertedPoint.y;
  10. if (menuOn)
  11. {
  12. startState=NO;
  13. if (CGRectContainsPoint(MYes,convertedPoint))
  14. {
  15. [self onMenu];
  16. }
  17. else if (CGRectContainsPoint(MNo,convertedPoint))
  18. {
  19. startState=NO;
  20. menuOn=NO;
  21. [menuPopup setVisible:NO];
  22. }
  23.  
  24. }
  25.  
  26. else if (resetOn)
  27. {
  28. startState=NO;
  29. if (CGRectContainsPoint(MYes,convertedPoint))
  30. {
  31. resetOn=NO;
  32. [resetPopup setVisible:NO];
  33. [self onReset];
  34. }
  35. else if (CGRectContainsPoint(MNo,convertedPoint))
  36. {
  37. startState=NO;
  38. resetOn=NO;
  39. [resetPopup setVisible:NO];
  40. }
  41. }
  42. else if (startState)
  43. {
  44. startState=NO;
  45. if (CGRectContainsPoint(menuL,convertedPoint))
  46. {
  47. menuSel=YES;
  48. }
  49. else if (CGRectContainsPoint(resetL,convertedPoint))
  50. {
  51. resetSel=YES;
  52. }
  53. else
  54. {
  55. selectedSprite = [self getSprite :x :y];
  56. if (selectedSprite != -1) moveState=YES;
  57. }
  58.  
  59. }
  60. // no other handlers will receive this event
  61. return kEventHandled;
  62. }
  63.  
  64. // we ignore the event. Other rec
  65. return kEventIgnored;
  66. }
Add Comment
Please, Sign In to add comment