cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
<CCTouchOneByOneDelegate> Protocol Reference

#import <CCTouchDelegateProtocol.h>

+ Inheritance diagram for <CCTouchOneByOneDelegate>:

List of all members.

Public Member Functions

(BOOL) - ccTouchBegan:withEvent:
(void) - ccTouchMoved:withEvent:
(void) - ccTouchEnded:withEvent:
(void) - ccTouchCancelled:withEvent:

Detailed Description


Using this type of delegate results in two benefits:

  1. You don't need to deal with NSSets, the dispatcher does the job of splitting them. You get exactly one UITouch per call.
  2. You can claim a UITouch by returning YES in ccTouchBegan. Updates of claimed touches are sent only to the delegate(s) that claimed them. So if you get a move/ ended/cancelled update you're sure it is your touch. This frees you from doing a lot of checks when doing multi-touch.

(The name TargetedTouchDelegate relates to updates "targeting" their specific handler, without bothering the other handlers.)


Member Function Documentation

- (BOOL) ccTouchBegan: (UITouch *)  touch
withEvent: (UIEvent *)  event 

Return YES to claim the touch.


The documentation for this protocol was generated from the following file: