- 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:

- 深入理解Spring Cloud與實戰
- 硬件產品經理成長手記(全彩)
- 現代辦公設備使用與維護
- INSTANT ForgedUI Starter
- 分布式微服務架構:原理與實戰
- 計算機組裝維修與外設配置(高等職業院校教改示范教材·計算機系列)
- 筆記本電腦維修300問
- 筆記本電腦使用、維護與故障排除從入門到精通(第5版)
- 單片機系統設計與開發教程
- Managing Data and Media in Microsoft Silverlight 4:A mashup of chapters from Packt's bestselling Silverlight books
- 單片機原理及應用:基于C51+Proteus仿真
- Java Deep Learning Cookbook
- Building Machine Learning Systems with Python
- 零基礎輕松學修電腦主板
- 計算機組裝與維護立體化教程(微課版)