O'Reilly logo

Learning Cocos2d-x Game Development by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the Options scene

Similar to how we created the MainMenuScene, we will create OptionsMenuScene.h and OptionsMenuScene.cpp and include them in the Solution Explorer pane.

In the OptionsMenuScene.h file, add the following code:

#ifndef __wp8Game__OPTIONSMENU_SCENE__
#define __wp8Game__OPTIONSMENU_SCENE__

#include "cocos2d.h"
#include "ScrollingBgLayer.h"

using namespace cocos2d;

class OptionsMenu : public cocos2d::CCLayer
{
public:
    
    virtual bool init();  

    ScrollingBgLayer* scrollingBgLayer;

    static cocos2d::CCScene* scene();
    void update(float dt);

    void reset(CCObject* pSender);
    void mainMenu(CCObject* pSender);

    CREATE_FUNC(OptionsMenu);
};

#endif

Here once again, we include ScrollingBgLayer.h, inherit from CCLayer, and add in the usual code, as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required