Cocos2d-x cross-platform game development-development environment

Source: Internet
Author: User

In the previous two articles, the basic knowledge of C language and C ++ was simply sorted out. Starting from this article, Cocos2dx engine was officially started.

To use Cocos2dx, A Cocos2dx development environment is required first. The bloggers usually use the Mac environment. However, given that there are more people using Windows, Windows 7 is also used today.

1. Download

The following are some items to be downloaded:

1 Visual Studio 2012: http://www.xiazaiba.com/html/7678.html

Cocos2dx2.2.2: http://www.cocos2d-x.org/

3 Python: http://www.python.org/download/

2. Install Visual Studio

After the download is complete, go to the next step and click OK. Then, find a registration code on the Internet. The following code is used by the blogger:

Visual Studio 2012 Product Key

Ultimate: YKCW6 BPFPF BT8C9 7 DCTH QXGWC

3. decompress the downloaded Cocos2dx package,

The last few. sln files are both visual studio engineering files. So what are these projects? This is some examples provided by cocos2dx to developers and shows how to use cocos2dx. It can be referenced in the learning process or in the project development process.

Select a project file (winrt is a tablet) based on your vs version, and click it to open it. If the following problem occurs, open the vs2012 Installation File, fix the vs file, select the project, right-click the project, and reload the file.

So, there is a build-win32.bat is doing?

This is a batch processing file, so that you can compile and run the sample project without opening vs. Don't believe it, wait. The sample runs automatically after compilation.

4. Read the code

The above projects are so messy. Where should we start from? Anyone who has learned programming knows that the first program is HelloWorld.

In the above directory, find samples-> Cpp-> HelloCpp. There are many platform projects. You can see the suffix of the folder to find out which platform is used, the source code.

How to run it? Open the. sln file mentioned earlier, find HelloCpp in it, right-click it, and set it as the startup Item. Then you can see the effect.

5. Create a project

To create a project in a previous version of cocos2dx, you need to add the template to the vs center. This is quite troublesome. Since version 2.1.5 and later, you have used the python script language to create a project. So, first install python.

I don't need to talk about this. The next step is OK. (Note: Installation of python2 will fail because python3 fails to be created. I don't know why, please kindly advise)

Then, the environment variable must be configured with a drop.

Select "computer"-> right-click-> properties-> advanced system settings-> environment variables, and then find the path variable editing in [system environment variables], and add "; C: python27; "here is your python installation path. (Note: Use semicolons to separate environment variables ). Then win + r, Enter cmd, press Enter, and then Enter pyhton. If no recognition is displayed, the operation succeeds.

If you still don't, see: http://www.cocoachina.com/bbs/read.php? Tid = 161597

Run the cd command in cmd to enter the folder cocos2d-x/tools/project-creator/You decompressed, and then enter:

Python create_project.py-project HelloWorld-package com.bjmzs.org-language cpp
Where:

HelloWorld is the project name
Com.bjmzs.org indicates the package Identification name for the version.
Cpp is a c ++ Project

After creation, a project folder will be added to the pressurized file directory, which is the project HelloWorld we created.

Click to enter and select your own platform proj. win32, and then click. sln to open the project and run successfully. Congratulations, the first project is successfully created.

Transmit positive energy:

The sky is vast, and the vast land is vast. The sea is charming and fine-flowing, and the mind is broad;

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.