Book Image

Learning Cocos2d-x Game Development

By : Siddharth Shekar
Book Image

Learning Cocos2d-x Game Development

By: Siddharth Shekar

Overview of this book

Table of Contents (19 chapters)
Learning Cocos2d-x Game Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

First things first


As we are going to start creating the game from scratch, let's remove all the code that is already present in the HelloWorldScene.cpp file.

So, we open up the project by navigating to wp8Game/wp8Game-XAML/wp8Game.sln in Visual Studio and clicking on the HelloWorldScene.cpp file in the Solution Explorer pane under the wp8Component project in the classes folder. We then go to the init() function and remove CCMenuItem, CCMenu, and CCSprite. We need to make sure that the init() function looks as follows:

bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
    
    return true;
}

As Windows doesn't use a close button function, we might as well remove the close button function from the HelloWorldScene.cpp and HelloWorldScene.h files. So...