Brief Introduction of cocos2d-x-3.0rc2 Environment Construction

Source: Internet
Author: User

[This article is transferred fromE liangshi Yiyou NetworkIt can be said that Cocos2d-x is familiar to everyone, especially for programmers and people engaged in programming work, here I will not detail. If you don't understand it, You can popularize Baidu. The following describes in detail the environment setup process and problems.

I. Preparations; the following environments are required for cocos2d development: 1: Microsoft vs2012 and later. (Cocos2d-x-3.0RC1 and above support WP platform compilation, If You Want To compile WP platform in vs2012 need to install wp8.0sdk, in vs2013 only need to install select to install); 2: Python: We use version 2.7. Version 3.0 may cause problems during use. Therefore, we recommend that you use version 2. 7. if there is a solution with 3.0 can also reply to inform;: 3: cocos2d-x-3.0rc2 4: Android SDK 5: Android ndk 6: ant 2: Step: 1: download and install vs2012 + wp8.0sdk or vs2013: Microsoft is simple and can be directly installed next. Note that if you install wp8.0sdk, your computer's CPU must support hardware virtualization for simulator debugging. A test tool is provided to check whether the computer's CPU supports hardware virtualization. If you do not develop the WP platform, you can ignore it. Install vs2012 or 2013 only. 2: Install python2.7:

Select the installation path and continue the next step. Open the system environment variable. Add it to the PATH variable. Your python installation path. For example, my installation path is c: \ python27. Add:; C: \ python27 in the path;

Decompress the downloaded cocos2dx-3.0rc2. We recommend that you change the name to Cocos and put it in a root directory of a disk. The specific reason is that the project will be created later. Open the command line and drag the. py file under the Cocos Directory into the directory for execution.

You are required to enter the installation path of the bin folder under SDK ndk and ant. For example, my SDK path is E: \ Android \ SDK. The ndk path is E: \ Android-ndk. The bin folder path under ant is: e: \ ant \ bin. Input as follows:

After the configuration is complete, close the command line directly;

Open the command line again and enter the following code: Cocos new your project name-P package name-l language (optional CPP Lua JS)-D storage path:

We recommend that you store the path in the Cocos directory and create a folder to save it. For example, E: \ Cocos \ mygame. It may be that the WP platform is not complete, if it is not placed in the Cocos \ custom folder. Some referenced content paths are incorrect in the created Project and need to be modified by yourself. It is more appropriate for beginners to follow this rule. After learning about the framework principles, you can create and modify the parameters at any location. After creating a project. Open the folder where the project is located. The directory structure is as follows.

Run the Win32 platform: Open the proj. Win32 folder. Double-click the mygame. sln file and run it in vs2012 or 2013. The project structure is as follows;

Mygame is the main code, classes is the folder where the logic code is located, and resource is the resource folder. Win32 is the unique code of the Win32 platform. Directly click the run button of vs2012 to wait for a moment for it to be generated. After the generation is successful, it will run.

The interface is as follows:

In this way, the Win32 platform can be developed.
Run the WP platform: the WP platform code is located in the proj. wp8-xaml folder. Open the folder and open the hellocpp. sln file. The project structure is as follows:

Hellocpp is the WP8 running project, and hellocppcomponent is the c ++ code referenced by WP8. The advantage of Cocos2d-x is that as long as you edit the C ++ code in each platform can compile the corresponding installation package. Therefore, you only need to edit the code under hellocppcomponent. This article does not edit the content and runs directly. NOTE: If your CPU does not support hardware virtualization, you cannot enable the simulator. Only WP mobile phones can be connected. In addition, the WP mobile phone must be unlocked with the developer account. This is a tough problem. The running result is as follows:

So far, the operations have been smooth. Next, we will introduce the problem that the project is created in other paths, which may cause a lot of pain: we will create a project on the elastic drive.

Open the Win32 project. There is a problem with wood. It can run normally.

Below we open the WP Project

Check the error message. The reference paths of the project are all incorrect.

As a beginner, solving these problems is a pain point. Therefore, it is recommended that you specify a folder in the Cocos folder.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.