1
\$\begingroup\$

I've been having problems with using 'CC_CALLBACK_#' (i.e. CC_CALLBACK_0, CC_CALLBACK_1). It works alright if I am using it to call a function from the class (Using 'GameScene' class for this example) itself like

CC_CALLBACK_0(GameScene::gamePause,this)

However I am unable to use it to call functions from other classes (i.e. 'SettingsScene') that have been included like

CC_CALLBACK_1(SettingsScene::bgmControl,this) 

I can use the SettingScene CC_CALLBACK code just fine in the SettingsScene class.

In cocos2dx v2, 'menu_selector' did not have any issues calling functions from other classes so I was wondering if anyone could tell me how to do it in v3.2? I really don't want to resort to copying the functions from other classes into the class I want to call it from :(

Thank you so much!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I am quoting vovkasm's answer from my question at the cocos2dx forum link for the people here :) "To call object method, you need: Method (the first argument to macros) Object itself (the second argument) So you snipped of code should look something like: CC_CALLBACK_1(SettingsScene::bgmControl, setttingsSceneObject) And you always can use C++11 feature called 'lambda expression': [&](ArgType arg) { settingsSceneObject->bgmControl(arg); }" \$\endgroup\$ Commented Feb 7, 2015 at 11:27

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.