@lionking0 wrote:
I am confused about something.
I have the following example:mainMenu.h
class mainMenu : public Node { public: static Scene* createScene(); virtual bool init(); void GoToGameScene(Ref *pSender); CREATE_FUNC(mainMenu); private: mainMenu() {}; ~mainMenu() {}; };
mainMenu.cpp
Scene* mainScene::createScene(){ auto scene = Scene::create(); auto layer = mainScene::create(); scene->addChild(layer); return scene; }
Focus on this part.
auto scene = Scene::create(); auto layer = mainScene::create();
Why do we create layer from mainScene not from Layer
For example: Why we do this:
auto layer = mainScene::create();
If we can do it, like creating a scene
auto layer = Layer::create();
Posts: 4
Participants: 2