Hi
I have got a class IntroMenu defined like this:
IntroMenu.h
class IntroMenu : public cocos2d::CCLayerColor
{
public:
AppDelegate* _app;
//etc...
}
IntroMenu.m
CCScene* IntroMenu::scene()
{
CCScene *scene = CCScene::node();
IntroMenu *layer = IntroMenu::node();
scene->addChild(layer);
return scene;
}
When I instanciate IntroMenu from my AppDelegate, I proceed like this in AppDelegate:
introScene = IntroMenu::scene();
((IntroMenu*)introScene)->_app = this;
app is a public variable of IntroMenu.
The problem is thatapp is a null pointer when I want to use it later in other methods of AppDelegate.
How to instanciate properly IntroMenu and its variable _app ?
Thanks