In the 2.x processing of events need to use the principal agent (delegate), I believe that the learning of the 2.x touch events, students know that the creation and removal of the process is very cumbersome.
In 3.x, because of the addition of the c++11 feature, the distribution mechanism of the event is managed through the event distributor Eventdispatcher.
The main event listeners are:
> Touch events: Eventlistenertouchonebyone, eventlistenertouchallatonce
> Mouse Response Event: Eventlistenermouse
> Keyboard Response Event: Eventlistenerkeyboard
> Accelerometer Event: eventlisteneracceleration
> Custom Event: Eventlistenercustom
> Physical Impact Events: Eventlistenerphysicscontact
> Game Handle Event: Eventlistenercontroller
Thank
Http://www.cnblogs.com/Richard-Core/p/3892641.html
http://blog.csdn.net/runaying/article/details/16352879
The event Distributor
Event Dispatcher Eventdispatcher, which is used to unify the distribution of all events that manage event listeners.
1, _eventdispatcher
_eventdispatcher is the attribute of node, obtained by Director::getinstance ()->geteventdispatcher ().
_eventdispatcher's work is made up of three parts:
(1) Event Distributor: Eventdispatcher.
(2) Type of event: Eventtouch, Eventkeyboard and so on.
(3) Event listener: Eventlistenertouch, Eventlistenerkeyboard and so on.
The listener implements various triggering logic, distributes the event type by the event distributor in due course, and then invokes the appropriate type of listener.
2. Add/Remove Listeners
Add Listener: addeventlistenerwithscenegraphpriority,
Addeventlistenerwithfixedpriority.
Remove Listener: RemoveEventListener,
Removealleventlisteners.
3. Main function
Contains the listener's add, delete, pause, restore, priority settings, hand-distribute events, and so on. 1, 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35