Class cc.TargetedTouchDelegate

Class Summary
Constructor Attributes Constructor Name and Description
 
Using this type of delegate results in two benefits: - 1.

Method Summary

Class Detail

cc.TargetedTouchDelegate()
Using this type of delegate results in two benefits: - 1. You don't need to deal with cc.Sets, 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 onTouchBegan. 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's 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.)

Method Detail

  • {Boolean} onTouchBegan(touch, event)
    Return YES to claim the touch.
    Parameters:
    {cc.Touch} touch
    {event} event
    Returns:
    {Boolean}
  • onTouchCancelled(touch, event)
    Virtual function
    Parameters:
    {cc.Touch} touch
    {event} event
  • onTouchEnded(touch, event)
    Virtual function
    Parameters:
    {cc.Touch} touch
    {event} event
  • onTouchMoved(touch, event)
    Virtual function
    Parameters:
    {cc.Touch} touch
    {event} event