官术网_书友最值得收藏!

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, we remove the following function from the .h file:

    // a selector callback
    void menuCloseCallback(CCObject* pSender);

Furthermore, we remove the following from the .cpp file:

void HelloWorld::menuCloseCallback(CCObject* pSender)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
    CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
#else
    CCDirector::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
#endif
#endif
}

Now, we build and run the project to make sure that there are no build errors. When the build runs, we should see a blank black screen like the following:

主站蜘蛛池模板: 宁城县| 和龙市| 郧西县| 基隆市| 南华县| 盱眙县| 巴中市| 延津县| 竹北市| 德惠市| 汕尾市| 井研县| 东丽区| 石阡县| 镇江市| 万盛区| 玛纳斯县| 西乡县| 射阳县| 新安县| 莎车县| 桑日县| 开鲁县| 新民市| 台州市| 汕头市| 新田县| 扎赉特旗| 东明县| 彭州市| 太白县| 定结县| 灵宝市| 江华| 乌兰县| 横山县| 海兴县| 呼玛县| 大兴区| 丰台区| 乌海市|