如何在函数参数Cocos2dx中使用SEL_MenuHandler / menu_handler?

时间:2014-06-15 17:02:15

标签: c++ c++11 cocos2d-x

我使用cocos2dx制作游戏。

回到V 2.x我用过这个:

void Popup::addButtonWithText(const char* text, 
                              CCObject* target, 
                              SEL_MenuHandler selector)

并且在使用弹出对象时我将其用作:

popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));

现在在V 3.1.1中我正在使用它:

void Popup::addButtonWithText(const char* text, 
                              Object* target, 
                              SEL_MenuHandler selector)

并且在使用弹出对象时我将其用作:

popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));

但在V 3.1.1中我收到错误:

Static_cast from void to cocos2d::SEL_MenuHandler is not allowed

我正在做同样的事情,为什么我会收到这个错误?

1 个答案:

答案 0 :(得分:0)

相关问题