Windows platform cocos2d-x 3.2 download and create a new project process

Source: Internet
Author: User

First, there's an Android environment built on Cocos2d-x in Windows,

Please refer to this blog post by a netizen, "Cocos2d-x 3.0RC Development Guide: Windows Android Environment Build".


Here's a quick list of the tools you need:

1. JDK

: http://www.oracle.com/technetwork/java/javase/downloads/index.html


2. ADT (Android Developer Tools), which contains the SDK and eclipse.
Yes: http://developer.android.com/sdk/index.html


3. Download Android NDK
Yes: http://developer.android.com/tools/sdk/ndk/index.html
Unzip it into the ADT directory.


4. Download Apache ANT
Yes: http://ant.apache.org/bindownload.cgi
Also extracted to the ADT directory


5. Download Python
COCOS2DX uses Python to create and build projects on different platforms after 3.0, so the Python environment needs to be installed under Windows:
: Https://www.python.org/ftp/python/2.7.3/python-2.7.3.msi


The cocos2d-x i downloaded is currently the latest version of 3.2, so the following is a cocos2d-x 3.2 download installation and the process of creating a new project.


First, installation


As a prerequisite, you have set up the Android development environment in the reference article above, including Adt-bundle, Apache-ant, PYTHON.

First download from the official website Cocos2d-x, the current latest version v3.2, the official http://cn.cocos2d-x.org/download/

The installation of cocos2d is described below.

After extracting the downloaded cocos2d-x zip file in the local path to D:\adt-bundle\cocos2d-x-3.2, the following cocos_home_dir represents the path.


The first thing to do is run the download-deps.py Python program, which automatically downloads the third-party plug-ins (if any) that cocos2d-x requires.

Then run the setup.py Python program, which mainly sets the relevant environment variables, including the path of the Android Sdk,ndk and Apache Ant.

Once the above two steps have been successfully executed, you can create a new Cocos2d-x project.


Ii. creation of new projects

Open a command-line window in Cocos_home_dir,

(Press and hold shift+ right mouse button, the following menu appears, select Open Command Window)



First, enter Cocos to run a bit.

You can then use the following command to create a new Cocos2d-x project,

Cocos New Mygame-p com.your_company.mygame-l cpp-d New_projects_dir

In the above command line, Mygame represents the new project name, and New_projects_dir is the path to save for the new project.

If you omit-D New_projects_dir, Cocos creates a new subfolder Mygame under the current folder.

All source files for the new project will be created under sub-folder Mygame,

The new project created by default is a classic HelloWorld program.


Third, compile


1. Using VS for compiling

Under the new project file, there are subfolders for each platform, corresponding Mygame\proj.win32 subfolders for the Windows platform.

Enter the Proj.win32 subfolder to see the MyGame.sln file.

See the familiar sln file, if your VC developer, then you will be very skilled to open this project file, using VS to compile.


2. Compiling using the command line

The above is compiled with vs. You can also compile using the command line.


Save the following batch command as Build4win2.bat to the new Project's folder (for example, Mygame above).

Then execute build4win32.bat to compile the newly created project Mygame.

@echo execute the following command under the Cocos Project folder to compile and run the project (for Win32)
Cocos Run-p Win32


If you are compiling to an Android platform, use the following batch command

@echo execute the following command under the Cocos Project folder to compile and run the project (for Android)
Cocos Run-p Android-j 4


Iv. End of

For more detailed instructions on installation and compilation, you can view the Readme file that comes with Cocos2d-x,

The specific file name is: cocos_home_dir\readme.md.


Related Article

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.