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

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:

主站蜘蛛池模板: 南通市| 碌曲县| 巴塘县| 宜川县| 辽中县| 江孜县| 五河县| 华阴市| 宁海县| 仁布县| 阿拉尔市| 德昌县| 徐汇区| 雷山县| 久治县| 余江县| 固始县| 龙山县| 宾阳县| 德保县| 峨边| 曲周县| 博湖县| 昂仁县| 长葛市| 图们市| 洪泽县| 锦州市| 教育| 进贤县| 临西县| 大足县| 莱阳市| 顺昌县| 凉城县| 左权县| 龙川县| 临沂市| 临城县| 邹平县| 梨树县|