mirror of https://github.com/axmolengine/axmol.git
[dispatcher] Adding argument for whether to sort listeners when dispatching events.
This commit is contained in:
parent
62a0dc41c3
commit
bfdc2a0efe
|
@ -217,12 +217,13 @@ void EventDispatcher::setPriorityWithFixedValue(EventListener* listener, int fix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventDispatcher::dispatchEvent(Event* event)
|
void EventDispatcher::dispatchEvent(Event* event, bool toSortListeners)
|
||||||
{
|
{
|
||||||
if (_listeners == nullptr || !_isEnabled)
|
if (_listeners == nullptr || !_isEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sortAllEventListenerItemsForType(event->_type);
|
if (toSortListeners)
|
||||||
|
sortAllEventListenerItemsForType(event->_type);
|
||||||
|
|
||||||
DispatchGuard guard(_inDispatch);
|
DispatchGuard guard(_inDispatch);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
* Also removes all EventListeners marked for deletion from the
|
* Also removes all EventListeners marked for deletion from the
|
||||||
* event dispatcher list.
|
* event dispatcher list.
|
||||||
*/
|
*/
|
||||||
void dispatchEvent(Event* event);
|
void dispatchEvent(Event* event, bool toSortListeners = true);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Destructor of EventDispatcher */
|
/** Destructor of EventDispatcher */
|
||||||
|
|
Loading…
Reference in New Issue