Cocos2d-x 3.x We use Cocos2d-x 3.2, which provides support for the Windows Phone 8 platform. Let's look at how to build the Cocos2d-x Windows Phone 8 project in Cocos2d-x 3.2 and how to use it.
Build Windows Phone 8 Project
We can build a multiplatform template project with the Cocos New tool provided by Cocos2d-x. If our project is named Hellocpp, then the directory structure is generated as shown, where the contents of the Proj.wp8-xaml folder, as shown in the following figure, where HelloCpp.sln can start cocos2d-x Windows Phone 8 project.
Build Windows Phone 8 Project
Proj.wp8-xaml folder
Tip If you are using the COCOS2D-X-3.2ALPHA0 version, the solution compilation process will occur during the CCSprite3DDataCache.cpp file cannot find the error, please in the visual Studio Open Libcocos2d project in 3d directory right-click Delete CCSprite3DDataCache.cpp and CCSprite3DDataCache.h.
After successfully starting the project, see as shown in the engineering structure, where Hellocpp starts the project, it is a window Phone 8 project, written using C # code. The classes in Hellocppcomponent is something that needs to be modified, and other files we don't need to modify.
Windows Phone 8 Project
Running Windows Phone 8 project
Set Hellocpp to start the project as shown, select the device or emulator you want to run to, and then click the Start button to run the project. As shown in the following figure, the results are run on the emulator.
Operation Engineering
Running on the emulator
We can also see the memory usage information in addition to the frame rate information we can see on the simulation. The hidden memory usage information output differs from the hidden frame rate information output if the debug deployment mode runs explicitly and is hidden if the release deployment mode runs. This is achieved through the MainPage.xaml.cs defined in the Hellocpp project, the following sections of the code are as follows:
[HTML] view Plaincopy
#if DEBUG
#define Display_memory
#endif
... ...
Constructor
Public MainPage ()
{
InitializeComponent ();
#if display_memory
Starttimer (); ①
#else
memorydisplay.visibility = Visibility . Collapsed;
#endif
}
... ...
The above ① Line code Starttimer () can display memory usage information.
For more information, please pay attention to the first Cocos2d-x 3.2 Edition book "Cocos2d-x: C + + volume"
Book Exchange Discussion website: http://www.cocoagame.net
For more exciting video courses, please follow Cocos class: Http://v.51work6.com
Welcome to join Cocos2d-x Technical discussion group: 257760386
Welcome to Luxgen iOS Classroom public Platform
Cocos2d-x 3.x Windows Phone 8 project