Cocos2d-x is currently a popular game development framework, the latest version is 3.1.1, some of the online tutorials are older, this article will explain how to use the latest 3.1.1 to create a Windows Phone 8 development environment.
This article assumes that you have installed VS2012 or VS2013, and that you have installed the SDK for Windows Phone8.
First, download and install Cocos2d-x
Website address: http://www.cocos2d-x.org/
Click Download in the menu bar to go to the download page.
We download the latest V3.1.1, the new version will be more, but there may be some new bugs we need to solve.
Download down is a compressed package,
Extracting it from the disk is a folder.
The installation here is over.
The test procedure provided by the compiling and running system
To the folder build, cocos2d-win32.vc2012 is the Windows version of the test program project, and cocos2d-wp8.vc2012 is the Windows Phone version of the test program project.
First take a look at the Windows version of the test program, note that the project is more, compile time is relatively long. Note the startup project should be set to cpp-tests.
The run effect after compilation.
First, a Windows security prompt will be paged out and agreed on.
Then, you can see the running interface.
Then take a look at the Windows Phone version of the test program. The project name of the main program is cpp-test (Winodws Phone 8.0) in the Cpp-tests folder.
Operation is normal, the effect is as follows
Iii. creating a project using Cocos2d-console
COCOS2D provides the command-line way to create and manage projects, called Cocos2d-console, located in the folder Tools\cocos2d-console. The program itself is actually saved under the Bin folder.
This is a tool that is implemented using Python scripts, so you have to install Python on the system first, the official website: https://www.python.org/
There are now two versions, be sure to download the 2.7.7 version.
After downloading, do the installation
Select the installation path.
Select the installation content, by default you can
Start into the installation
Windows 8 also pops up an account control hint.
After confirming, start the actual installation.
Wait a moment and the installation is complete.
After installation, set the system path, which is saved by default under C:\Python27.
Then, you set the path to the Cocos2d-console, which you can do with Python.
First, open the System Information window.
Click Advanced System Settings
Click Environment Variables in the lower right corner
For example, after selecting Path, click the Edit button below.
It is important to note that the path of adding Python and Cocos2d-console, I am here
; C:\python27;d:\software\cocos2d-x-3.1.1\tools\cocos2d-console\bin;
Now, you can open a command-line window to check it out.
You can see the command-line prompt for Python directly in command and line input python, and CTRL + C can exit.
Enter cocos directly on the command line to see the help information for Cocos-console.
Create the project by command completion.
For example, we want to create in E:\cocos2d-projects, enter this folder at the command line, enter the command Cocos command to create, as shown below.
E:\cocos2d-projects>cocos New Mygame-l cppruning command:new> Copy template into E:\cocos2d-Projects\mygame> Copying cocos2d-x Files ...> Rename Project Name from 'Hellocpp'To' Mygame'> Replace the project name from 'Hellocpp'To'Mygame'> Replace the Project package name from 'Org.cocos2dx.hellocpp'To'ORG.COCOS2DX. hellocpp'E:\cocos2d-projects>
New indicates that the project is created with the name Mygame
-L To configure the language CPP means using CPP language
-P indicates the path of the package
Once created, a new folder named Mygame appears under the current folder, as shown below:
Proj.win32 is Win32 version, Proj.wp8-xaml is the Windows Phone Edition.
Using Visual Studio to open the Mygame project, you can compile and run it.
But there are some problems with Windows Phone Edition. After compiling, you should see 6 errors.
Take a closer look at the error message, you will find that the file is not found problems, the 6 files in the project Hellocppcomponent, are references to external files.
Now the system would like to Mygame below the Cocos2d\cocos\2d\platform\wp8-xaml\cpp folder to find the file, in fact, to see the folder will know, Cocos below is platform, this folder is not 2d Folder. So it caused a mistake.
In fact, not only the 6 files, but also the corresponding header files are the problem, the reference path of the 12 files to modify it just fine.
Select the file first, and then modify the path in the file's Properties window. Remove the extra 2d.
After you have modified all 12 paths, you can do so.