How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World

How To Run Hello World   

The cocos2d newcomers should be familiar with Ray Wnderlic's How To Make A Simple iPhone Game with Cocos2D Tutorial, which is recommended on the cocos2d-iphone official site and also published in CocoaChina forum in Chinese(http: / / www.cocoachina.com/bbs/read.php?tid-15554.html). 

Now cocos2d-x.org has port cocos2d-iphone into c++, to cross mobile platforms. There are already two stable version, 0.7.0 and 0.7.1, surporting the platforms android, iphone, win32, WoPhone and Bada which is contributed by a member of cocos2d-x comunity.
Ok, let's start to run the Hello World first.

Downloading and Installing cocos2d-x

The recommended IDE is Windows. Surpose you have installed WoPhone SDK and IDE (For UPhone SDK:http://sinaapp.csdn.net/up.zip, developer's community:http://110.86.4.110:8086/developmentWorks/).

Downloading Cocos2d-x Source Codes 

There are two ways to download the source codes:

First, download the archieve of the stable release here:  http://download.cocos2d-x.org.

Second, download the latest code here: http://github.com/cocos2d/cocos2d-x/. If you're not familiar with git, you could click the button "DOWNLOAD" on the right of page to download the latest code.

Then, unzip the archieve into the directory where WoPhone SDK lies: D:\Work7\cocos2d-x\. You'd better keep the directory structure as the follow picture to avoid the trouble of path configuration.

  How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World_第1张图片

We could find that cocos2d-x has completely ported the cocos2d engine, all the tests, box2d, chipmunk and cocosDenshion.

Double click cocosx-wophone.sln to start the solution with Visual Studio2008 or VS2010.(Don't click cocos2d-win32.sln by mistake.)

Installing the Template for Vs2008

Then enter D:/Work7/cocos2d-x/template/CCXAppWiz.vs, and double click setup_vs2008.js. After successful installation, there would be a prompt box shown "App Wizard successfully installed!". Then you could choose to create cocos2d-uphone or cocos2d-win32 application by the way of solution -> Add -> New Project in VS2008.

Hello, World

Ok, now we could see the Hello World scene. Follow the steps below.

First, set the HelloWorld project as the startup project:

How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World_第2张图片

Second, compile the HelloWorld project.

Third, start the WoPhone armulater. You can find the WoPhone Assistant icon at the right down corner of the screen, right click on the icon and start the armulater as follows:

How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World_第3张图片 

Fourth, run the HelloWorld project in VS2008, and the HelloWorld scene will be shown in the armulater.

How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World_第4张图片 

Now you should do some exercises, wry your neck to look at the armulater. Ok, everything is well except the landscape mode screen, but don't worry about this, the WoPhone team will make you enable to rotate the screen before long.

PS: There are two details in the above process:

First, we use the "Start" mode to start the armulatet instead of "Auto Start" mode, to get a simple and clean environment. In this mode, the system won't load the unneccessary programs that we don't need.

Second, the HelloWorld scene has a "X" button in the right-down corner, because not all the phones have a "HOME" button like iphone.

Creating a Template Project

For the simple game, we should create a new project to add our codes.

Follow this way,  solution -> Add -> New Project, choose the template "Cocos2d-WoPhone Application", and enter the project name you like at the botton, we use the name "SimpleGame" here.

How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World_第5张图片

Click "ok" button to enter the next form, and click "finish" button to finish the creation.

Then set the "SimpleGame" project as the startup project, build and run, you will see the result as hello world scene in the armulater.


你可能感兴趣的:(How To Make A Simple WoPhone Game With Cocos2d-x : How To Run Hello World)