I'm loading a CCB file from my Cocos2d-x project, but I can't get access to the CCBAnimationManager from a custom class.
In Cocos2d with objective-C is as simple as:
CCBAnimationManager* animationManager = self.userObject;
But the same implementation in C++ returns a null value and the execution will cause a crash...
any idea? Thks
Yes, it is not quite simple as in obj-C. New TestCpp project got an example for this. Look at the (CocosBuilderTest->AnimationsTest).
Basically you need to create a CCNodeLoaderLibrary and register it with your custom loader class.
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("TestAnimationsLayer", AnimationsTestLayerLoader::loader());
and then Create a CCBReader with that ccNodeLoaderLibrary
cocos2d::extension::CCBReader * ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
and now, you will be able to get hold of CCBAnimationManager via this ccbReader
ccbReader->getAnimationManager()