mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3697 from dumganhar/iss2087-new-event-dispatcher
Fixing MenuTest crash.
This commit is contained in:
commit
ec7cfae4e8
|
@ -581,7 +581,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove()
|
|||
_touchListener->onTouchBegan = CC_CALLBACK_2(RemoveMenuItemWhenMove::onTouchBegan, this);
|
||||
_touchListener->onTouchMoved = CC_CALLBACK_2(RemoveMenuItemWhenMove::onTouchMoved, this);
|
||||
|
||||
EventDispatcher::getInstance()->addEventListenerWithFixedPriority(_touchListener, -100);
|
||||
EventDispatcher::getInstance()->addEventListenerWithFixedPriority(_touchListener, -129);
|
||||
|
||||
}
|
||||
|
||||
|
@ -592,14 +592,10 @@ void RemoveMenuItemWhenMove::goBack(Object *pSender)
|
|||
|
||||
RemoveMenuItemWhenMove::~RemoveMenuItemWhenMove()
|
||||
{
|
||||
EventDispatcher::getInstance()->removeEventListener(_touchListener);
|
||||
CC_SAFE_RELEASE(item);
|
||||
}
|
||||
|
||||
//void RemoveMenuItemWhenMove::registerWithTouchDispatcher(void)
|
||||
//{
|
||||
// Director::getInstance()->getTouchDispatcher()->addTargetedDelegate(this, -129, false);
|
||||
//}
|
||||
|
||||
bool RemoveMenuItemWhenMove::onTouchBegan(Touch *touch, Event *event)
|
||||
{
|
||||
return true;
|
||||
|
@ -617,6 +613,8 @@ void RemoveMenuItemWhenMove::onTouchMoved(Touch *touch, Event *event)
|
|||
|
||||
void MenuTestScene::runThisTest()
|
||||
{
|
||||
MenuItemFont::setFontSize(20);
|
||||
|
||||
auto layer1 = new MenuLayerMainMenu();
|
||||
auto layer2 = new MenuLayer2();
|
||||
auto layer3 = new MenuLayer3();
|
||||
|
|
|
@ -106,7 +106,6 @@ class RemoveMenuItemWhenMove : public Layer
|
|||
public:
|
||||
RemoveMenuItemWhenMove();
|
||||
~RemoveMenuItemWhenMove();
|
||||
|
||||
virtual bool onTouchBegan(Touch *touch, Event *event);
|
||||
virtual void onTouchMoved(Touch *touch, Event *event);
|
||||
|
||||
|
|
Loading…
Reference in New Issue