issue #2087: [dispatcher] Making Node::updateEventPriorityIndex to inline function.

This commit is contained in:
James Chen 2013-09-16 16:39:59 +08:00
parent d8fb3aa731
commit abf834731a
2 changed files with 5 additions and 9 deletions

View File

@ -85,7 +85,7 @@ bool nodeComparisonLess(Object* p1, Object* p2)
// XXX: Yes, nodes might have a sort problem once every 15 days if the game runs at 60 FPS and each frame sprites are reordered.
static int s_globalOrderOfArrival = 1;
static int _globalEventPriorityIndex = 0;
int Node::_globalEventPriorityIndex = 0;
Node::Node(void)
: _rotationX(0.0f)
@ -826,7 +826,7 @@ void Node::visit()
}
// self draw
this->draw();
this->updateEventPriorityIndex();
_eventPriority = ++_globalEventPriorityIndex;
for( ; i < _children->count(); i++ )
{
@ -838,7 +838,7 @@ void Node::visit()
else
{
this->draw();
this->updateEventPriorityIndex();
_eventPriority = ++_globalEventPriorityIndex;
}
// reset for next frame
@ -1296,11 +1296,6 @@ void Node::resetEventPriorityIndex()
_globalEventPriorityIndex = 0;
}
void Node::updateEventPriorityIndex()
{
_eventPriority = ++_globalEventPriorityIndex;
}
void Node::associateEventListener(EventListener* listener)
{
_eventlisteners.insert(listener);

View File

@ -1381,7 +1381,7 @@ private:
protected:
void updateEventPriorityIndex();
inline void updateEventPriorityIndex() { _eventPriority = ++_globalEventPriorityIndex; };
/// lazy allocs
void childrenAlloc(void);
@ -1461,6 +1461,7 @@ protected:
ComponentContainer *_componentContainer; ///< Dictionary of components
int _eventPriority;
static int _globalEventPriorityIndex;
};
//#pragma mark - NodeRGBA