Archive for August, 2012

Implementing CCCallFunc Cocos2d-X 2.0

Thursday, August 2nd, 2012

This is a simple way of implementing CCCallFunc.

ClassA wants to pass a function reference to ClassB.

CCCallFunc calls a function without any parameters. If you want to get the CCObject that called it then use CCCallFuncN and if you want to pass your own data use CCCallFuncND

In ClassB header create a variable to hold the callFunction.

In ClassB implementation call the passed in function.

In class ClassA implementation.