C++ 如何在as函数参数Cocos2dx中使用SEL_MenuHandler/menu_处理程序?
我使用cocos2dx构建了一个游戏 在v2.x版本中,我使用了:C++ 如何在as函数参数Cocos2dx中使用SEL_MenuHandler/menu_处理程序?,c++,c++11,cocos2d-x,C++,C++11,Cocos2d X,我使用cocos2dx构建了一个游戏 在v2.x版本中,我使用了: void Popup::addButtonWithText(const char* text, CCObject* target, SEL_MenuHandler selector) void Popup::addButtonWithText(const char* text,
void Popup::addButtonWithText(const char* text,
CCObject* target,
SEL_MenuHandler selector)
void Popup::addButtonWithText(const char* text,
Object* target,
SEL_MenuHandler selector)
在使用弹出对象时,我将其用作:
popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
现在在V3.1.1中,我使用的是:
void Popup::addButtonWithText(const char* text,
CCObject* target,
SEL_MenuHandler selector)
void Popup::addButtonWithText(const char* text,
Object* target,
SEL_MenuHandler selector)
在使用弹出对象时,我将其用作:
popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
但在V3.1.1中,我得到了一个错误:
Static_cast from void to cocos2d::SEL_MenuHandler is not allowed
我也在做同样的事情,为什么会出现这个错误?请参考最近关于这个主题的讨论: