cocos2d-iphone  1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
CCTouchDispatcher Interface Reference

#include <CCTouchDispatcher.h>

+ Inheritance diagram for CCTouchDispatcher:
+ Collaboration diagram for CCTouchDispatcher:

List of all members.

Public Member Functions

void addStandardDelegate:priority: (id< CCStandardTouchDelegate > delegate,[priority] int priority)
void addTargetedDelegate:priority:swallowsTouches: (id< CCTargetedTouchDelegate > delegate,[priority] int priority,[swallowsTouches] BOOL swallowsTouches)
void removeDelegate: (id delegate)
void removeAllDelegates ()
void setPriority:forDelegate: (int priority,[forDelegate] id delegate)
NSComparisonResult sortByPriority (id first, id second, void *context)

Static Public Member Functions

CCTouchDispatchersharedDispatcher ()

Protected Attributes

NSMutableArray * targetedHandlers
NSMutableArray * standardHandlers
BOOL locked
BOOL toAdd
BOOL toRemove
NSMutableArray * handlersToAdd
NSMutableArray * handlersToRemove
BOOL toQuit
struct ccTouchHandlerHelperData handlerHelperData [kCCTouchMax]

Properties

BOOL dispatchEvents

Detailed Description

CCTouchDispatcher. Singleton that handles all the touch events. The dispatcher dispatches events to the registered TouchHandlers. There are 2 different type of touch handlers:

  • Standard Touch Handlers
  • Targeted Touch Handlers

The Standard Touch Handlers work like the CocoaTouch touch handler: a set of touches is passed to the delegate. On the other hand, the Targeted Touch Handlers only receive 1 touch at the time, and they can "swallow" touches (avoid the propagation of the event).

Firstly, the dispatcher sends the received touches to the targeted touches. These touches can be swallowed by the Targeted Touch Handlers. If there are still remaining touches, then the remaining touches will be sent to the Standard Touch Handlers.

Since:
v0.8.0

Member Function Documentation

void CCTouchDispatcher::addStandardDelegate:priority: ( id< CCStandardTouchDelegate delegate,
[priority] int  priority 
) [virtual]

Adds a standard touch delegate to the dispatcher's list. See StandardTouchDelegate description. IMPORTANT: The delegate will be retained.

void CCTouchDispatcher::addTargetedDelegate:priority:swallowsTouches: ( id< CCTargetedTouchDelegate delegate,
[priority] int  priority,
[swallowsTouches] BOOL  swallowsTouches 
) [virtual]

Adds a targeted touch delegate to the dispatcher's list. See TargetedTouchDelegate description. IMPORTANT: The delegate will be retained.

void CCTouchDispatcher::removeAllDelegates ( ) [virtual]

Removes all touch delegates, releasing all the delegates

void CCTouchDispatcher::removeDelegate: ( id  delegate) [virtual]

Removes a touch delegate. The delegate will be released

void CCTouchDispatcher::setPriority:forDelegate: ( int  priority,
[forDelegate] id  delegate 
) [virtual]

Changes the priority of a previously added delegate. The lower the number, the higher the priority

CCTouchDispatcher* CCTouchDispatcher::sharedDispatcher ( ) [static, virtual]

singleton of the CCTouchDispatcher


Property Documentation

BOOL CCTouchDispatcher::dispatchEvents [read, write, assign]

Whether or not the events are going to be dispatched. Default: YES


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