cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
CCTouchDispatcher Class Reference

CCTouchDispatcher. More...

#include <CCTouchDispatcher.h>

Inheritance diagram for CCTouchDispatcher:
[legend]
Collaboration diagram for CCTouchDispatcher:
[legend]

Public Member Functions

 ~CCTouchDispatcher ()
 NA. More...
 
bool init (void)
 NA. More...
 
 CCTouchDispatcher ()
 NA. More...
 
bool isDispatchEvents (void)
 Whether or not the events are going to be dispatched. More...
 
void setDispatchEvents (bool bDispatchEvents)
 
void addStandardDelegate (CCTouchDelegate *pDelegate, int nPriority)
 Adds a standard touch delegate to the dispatcher's list. More...
 
void addTargetedDelegate (CCTouchDelegate *pDelegate, int nPriority, bool bSwallowsTouches)
 Adds a targeted touch delegate to the dispatcher's list. More...
 
void removeDelegate (CCTouchDelegate *pDelegate)
 Removes a touch delegate. More...
 
void removeAllDelegates (void)
 Removes all touch delegates, releasing all the delegates NA. More...
 
void setPriority (int nPriority, CCTouchDelegate *pDelegate)
 Changes the priority of a previously added delegate. More...
 
void touches (CCSet *pTouches, CCEvent *pEvent, unsigned int uIndex)
 NA. More...
 
virtual void touchesBegan (CCSet *touches, CCEvent *pEvent)
 NA. More...
 
virtual void touchesMoved (CCSet *touches, CCEvent *pEvent)
 NA. More...
 
virtual void touchesEnded (CCSet *touches, CCEvent *pEvent)
 NA. More...
 
virtual void touchesCancelled (CCSet *touches, CCEvent *pEvent)
 NA. More...
 
CCTouchHandlerfindHandler (CCTouchDelegate *pDelegate)
 NA. More...
 
void incrementForcePrio (int priority)
 
void decrementForcePrio (int priority)
 
- Public Member Functions inherited from CCObject
 CCObject (void)
 
virtual ~CCObject (void)
 NA. More...
 
void release (void)
 
void retain (void)
 
CCObjectautorelease (void)
 
CCObjectcopy (void)
 
bool isSingleReference (void) const
 
unsigned int retainCount (void) const
 
virtual bool isEqual (const CCObject *pObject)
 
virtual void acceptVisitor (CCDataVisitor &visitor)
 
virtual void update (float dt)
 
 CCObject (const CCObject &)
 
CCObjectoperator= (const CCObject &)
 
virtual void encodeWithCoder (DS_Dictionary *)
 
virtual bool canEncode ()
 
CCObjectType getObjType () const
 
virtual int getTag () const
 
virtual void setTag (int nTag)
 
void setObjType (CCObjectType)
 
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)
 
- Public Member Functions inherited from EGLTouchDelegate
virtual void touchesBegan (CCSet *touches, CCEvent *pEvent)=0
 NA. More...
 
virtual void touchesMoved (CCSet *touches, CCEvent *pEvent)=0
 NA. More...
 
virtual void touchesEnded (CCSet *touches, CCEvent *pEvent)=0
 NA. More...
 
virtual void touchesCancelled (CCSet *touches, CCEvent *pEvent)=0
 NA. More...
 
virtual ~EGLTouchDelegate ()
 NA. More...
 

Protected Member Functions

void forceRemoveDelegate (CCTouchDelegate *pDelegate)
 
void forceAddHandler (CCTouchHandler *pHandler, CCArray *pArray)
 
void forceRemoveAllDelegates (void)
 
void rearrangeHandlers (CCArray *pArray)
 
CCTouchHandlerfindHandler (CCArray *pArray, CCTouchDelegate *pDelegate)
 

Protected Attributes

CCArraym_pTargetedHandlers
 
CCArraym_pStandardHandlers
 
bool m_bLocked
 
bool m_bToAdd
 
bool m_bToRemove
 
CCArraym_pHandlersToAdd
 
struct _ccCArray * m_pHandlersToRemove
 
bool m_bToQuit
 
bool m_bDispatchEvents
 
struct ccTouchHandlerHelperData m_sHandlerHelperData [ccTouchMax]
 
- Protected Attributes inherited from CCObject
unsigned int m_uReference
 
unsigned int m_uAutoReleaseCount
 
int m_nTag
 
int m_eObjType
 
unsigned int m_uObjectIdxInArray
 
bool m_bForcePrio
 
int m_nTargetPrio
 
bool getForcePrio (void)
 
void setForcePrio (bool var)
 
int getTargetPrio (void)
 
void setTargetPrio (int var)
 

Additional Inherited Members

- Static Public Member Functions inherited from CCObject
static CCObjectcreateWithCoder (DS_Dictionary *)
 
- Public Attributes inherited from CCObject
unsigned int m_uID
 
int m_nLuaID
 

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 NA

Constructor & Destructor Documentation

◆ ~CCTouchDispatcher()

◆ CCTouchDispatcher()

CCTouchDispatcher ( )
inline

NA.

Member Function Documentation

◆ addStandardDelegate()

void addStandardDelegate ( CCTouchDelegate pDelegate,
int  nPriority 
)

Adds a standard touch delegate to the dispatcher's list.

See StandardTouchDelegate description. IMPORTANT: The delegate will be retained. NA

◆ addTargetedDelegate()

void addTargetedDelegate ( CCTouchDelegate pDelegate,
int  nPriority,
bool  bSwallowsTouches 
)

Adds a targeted touch delegate to the dispatcher's list.

See TargetedTouchDelegate description. IMPORTANT: The delegate will be retained. NA

◆ decrementForcePrio()

void decrementForcePrio ( int  priority)
Remarks
Added by RobTop. See RT_ADD for more info.

◆ findHandler() [1/2]

CCTouchHandler * findHandler ( CCArray pArray,
CCTouchDelegate pDelegate 
)
protected

◆ findHandler() [2/2]

CCTouchHandler * findHandler ( CCTouchDelegate pDelegate)

NA.

◆ forceAddHandler()

void forceAddHandler ( CCTouchHandler pHandler,
CCArray pArray 
)
protected

◆ forceRemoveAllDelegates()

void forceRemoveAllDelegates ( void  )
protected

◆ forceRemoveDelegate()

void forceRemoveDelegate ( CCTouchDelegate pDelegate)
protected

◆ getForcePrio()

bool getForcePrio ( void  )
Remarks
Added by RobTop. See RT_ADD for more info.

◆ getTargetPrio()

int getTargetPrio ( void  )
Remarks
Added by RobTop. See RT_ADD for more info.

◆ incrementForcePrio()

void incrementForcePrio ( int  priority)
Remarks
Added by RobTop. See RT_ADD for more info.

◆ init()

bool init ( void  )

NA.

◆ isDispatchEvents()

bool isDispatchEvents ( void  )

Whether or not the events are going to be dispatched.

Default: true

◆ rearrangeHandlers()

void rearrangeHandlers ( CCArray pArray)
protected

◆ removeAllDelegates()

void removeAllDelegates ( void  )

Removes all touch delegates, releasing all the delegates NA.

◆ removeDelegate()

void removeDelegate ( CCTouchDelegate pDelegate)

Removes a touch delegate.

The delegate will be released NA

◆ setDispatchEvents()

void setDispatchEvents ( bool  bDispatchEvents)

◆ setForcePrio()

void setForcePrio ( bool  var)
Remarks
Added by RobTop. See RT_ADD for more info.

◆ setPriority()

void setPriority ( int  nPriority,
CCTouchDelegate pDelegate 
)

Changes the priority of a previously added delegate.

The lower the number, the higher the priority NA

◆ setTargetPrio()

void setTargetPrio ( int  var)
Remarks
Added by RobTop. See RT_ADD for more info.

◆ touches()

void touches ( CCSet pTouches,
CCEvent pEvent,
unsigned int  uIndex 
)

NA.

◆ touchesBegan()

virtual void touchesBegan ( CCSet touches,
CCEvent pEvent 
)
virtual

NA.

Implements EGLTouchDelegate.

◆ touchesCancelled()

virtual void touchesCancelled ( CCSet touches,
CCEvent pEvent 
)
virtual

NA.

Implements EGLTouchDelegate.

◆ touchesEnded()

virtual void touchesEnded ( CCSet touches,
CCEvent pEvent 
)
virtual

NA.

Implements EGLTouchDelegate.

◆ touchesMoved()

virtual void touchesMoved ( CCSet touches,
CCEvent pEvent 
)
virtual

NA.

Implements EGLTouchDelegate.

Member Data Documentation

◆ m_bDispatchEvents

bool m_bDispatchEvents
protected

◆ m_bForcePrio

bool m_bForcePrio
protected
Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_bLocked

bool m_bLocked
protected

◆ m_bToAdd

bool m_bToAdd
protected

◆ m_bToQuit

bool m_bToQuit
protected

◆ m_bToRemove

bool m_bToRemove
protected

◆ m_nTargetPrio

int m_nTargetPrio
protected
Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_pHandlersToAdd

CCArray* m_pHandlersToAdd
protected

◆ m_pHandlersToRemove

struct _ccCArray* m_pHandlersToRemove
protected

◆ m_pStandardHandlers

CCArray* m_pStandardHandlers
protected

◆ m_pTargetedHandlers

CCArray* m_pTargetedHandlers
protected

◆ m_sHandlerHelperData

struct ccTouchHandlerHelperData m_sHandlerHelperData[ccTouchMax]
protected

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