- Learning Cocos2d-x Game Development
- Siddharth Shekar
- 226字
- 2021-08-05 18:00:22
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:

- Learning SQL Server Reporting Services 2012
- 龍芯應(yīng)用開發(fā)標(biāo)準(zhǔn)教程
- 現(xiàn)代辦公設(shè)備使用與維護(hù)
- 精選單片機設(shè)計與制作30例(第2版)
- 平衡掌控者:游戲數(shù)值經(jīng)濟(jì)設(shè)計
- Large Scale Machine Learning with Python
- Machine Learning Solutions
- 面向?qū)ο蠓治雠c設(shè)計(第3版)(修訂版)
- Blender Game Engine:Beginner's Guide
- 新編電腦組裝與硬件維修從入門到精通
- Building Machine Learning Systems with Python
- 基于S5PV210處理器的嵌入式開發(fā)完全攻略
- 分布式存儲系統(tǒng):核心技術(shù)、系統(tǒng)實現(xiàn)與Go項目實戰(zhàn)
- 施耐德M241/251可編程序控制器應(yīng)用技術(shù)
- 多媒體技術(shù)教程