Creating the main menu scene
To create the main menu scene, create MainMenuScene.h
and MainMenuScene.cpp
in which we will create all the properties and methods to call the main menu.
In MainMenuScene.h
, add the following:
#ifndef __wp8Game__MAINMENU_SCENE__ #define __wp8Game__MAINMENU_SCENE__ #include "cocos2d.h" #include "ScrollingBgLayer.h" using namespace cocos2d; class MainMenu : public cocos2d::CCLayer { public: virtual bool init(); ScrollingBgLayer* scrollingBgLayer; void optionsScene(CCObject* pSender); void playGame(CCObject* pSender); void update(float dt); static cocos2d::CCScene* scene(); CREATE_FUNC(MainMenu); void MoveDownFinished(CCNode* sender); void MoveUpFinished(CCNode* sender); }; #endif
Here, we make this class inherit from CCLayer
and then create the init()
function, which returns a bool
value. We also create a variable of the ScrollingBgLayer
type and also include ScrollingBgLayer.h
, as we will be adding the scrolling...