2014-06-15 23 views
0

我用cocos2dx來構建遊戲。如何使用SEL_MenuHandler/menu_handler作爲函數參數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 

我做同樣的事情,所以爲什麼我收到此錯誤?

回答