It works ok, because I call ‘OptionsScene::backCallback’, and this method is inside that class, but I want to call a static method from another class, for example, this following code:
void HelloWorld::show()
{
CCLog(“i’m STATIC”);
}
is inside HelloWorld class,
I’am new to c++, I sucessfully call the static method from another class, but I can’t call it using the ‘menu_selector’ option from a CCMenuItemLabel
You can’t pass static method to CCMenuItemLabel because it expects nonstatic method (in C++ all nonstatic methods get hidden first argument which is used as “this” pointer - analogue to “self”). So you need to make the method you pass nonstatic or write a nonstatic wrapper for it.
The only parameter is the pointer to calling object (it is the menu item itself). You can use pSender pointer to obtain the data you need or get it from another source.
Your sender will be CCMenuItemToggle. You need to invoke sender->selectedItem() to get the CCMenuItemFont item. I see no way to get the string back from CCMenuItemFont.