Cocos2d-x 3. x Windows Phone 8 engineering, cocos2d-x3.x
Cocos2d-x 3. x we use Cocos2d-x 3.2, which provides support for the Windows Phone 8 platform. Next we will introduce how to generate the Windows Phone 8 project for the Cocos2d-x in Cocos2d-x 3.2 and how to use it.
Generate a Windows Phone 8 Project
We can generate a multi-platform template project using the cocos new tool provided by the Cocos2d-x. If the project name is HelloCpp, the generated directory structure is shown in, where proj. the contents of the wp8-xaml folder, as shown in the following figure, where HelloCpp. sln can start the Cocos2d-x Windows Phone 8 project.
Generate a Windows Phone 8 Project
Proj. wp8-xaml folder
Prompt if you are using a cocos2d-x-3.2alpha0 version, CCSprite3DDataCache will occur during solution compilation. the cpp file cannot be found. Open the libcocos2d project in Visual Studio and right-click the 3d directory to delete CCSprite3DDataCache. cpp and CCSprite3DDataCache. h.
After the project is started successfully, you can see the project structure shown in. HelloCpp starts the project, which is a Windows Phone 8 project and is written in C # code. Classes in HelloCppComponent is the content to be modified, and we do not need to modify other files.
Windows Phone 8 Project
Run the Windows Phone 8 Project
Set HelloCpp to start the project, as shown in. Select the device or simulator to run and click start to run the project. The following figure shows the running result on the simulator.
Run the project
Running on the simulator, we can see not only the frame rate information, but also the memory usage information. The output of the hidden memory usage information is different from the output of the Hidden Frame Rate information. If the Debug deployment mode is run, the output is displayed. If the Debug deployment mode is run, the output is hidden. This is implemented through the pre-compilation command defined by MainPage. xaml. cs in the HelloCpp project. The following code is used:
#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.
More content please pay attention to the first domestic Cocos2d-x 3.2 version of the book "Cocos2d-x practice: C ++ volume" book exchange discussion site: http://www.cOcoagame.net
For more exciting video courses, please follow the Cocos course in Zhijie class: http: // v.51wOrk6.com
Welcome to the Cocos2d-x Technology Discussion Group: 257760386 welcome to the knowledge of the iOS classroom public platform