"Cocos2d entry tutorial 1" Cocos2d-x environment, cocos2dcocos2d-x

Source: Internet
Author: User

"Cocos2d entry tutorial 1" Cocos2d-x environment, cocos2dcocos2d-x

Before Cocos2d game development, configure the environment and prepare the tools. The tools we need are:

1. Cocos2d Engine

2. JDK

3. SDK

4. NDK

5. ANT

6. ADT

1. Download The Cocos2d-x engine, the latest version is 3.6, all examples of this tutorial take version 3.4 as an example, download directly decompress it. Click to download Cocos2d Engine

2. JDK

Check whether the JDK environment has been installed on your computer.

Method: Open the terminal and enter java-version

If you have not installed JDK, click to download JDK

The effect is as follows:

 

3. ADT download. ADT is called the integrated development environment of Android. Integrated with SDK and development tool Eclipse. Click to download ADT

Decompress the downloaded file. The folder contains two folders: SDK and eclipse, and the Eclipse folder contains Eclipse development tools.

The effect is as follows:

 

3. download and install the NDK and click Download NDK. After the download, decompress it directly to the ADT folder.

 

 

The SDK and NDK both exist in the ADT folder. then configure the sdk ndk ant path.

Now let's start environment configuration.

 

1. Drag the setup. py file in the cocos Engine Directory downloaded and decompressed to the terminal.

2. Then, the terminal will require you to enter the path of the sdk ndk ant, enter the path of the sdk ndk adt, and press Enter.

 

It requires us to enter the NDK path, SDK path, and ANT path respectively.

Note that the path must be followed by/. Ant is stored in the Coco folder under the application. If you do not have it, go to the Cocos official website to download the Cocos engine and

Download the framework in the App Store

Configuration successful:

If you want to develop Cocos on Eclipse, you also need to configure the sdk ndk path on Eclipse.

Top ADT-> preferences-> Android to set the SDK

Set the NDK in the top ADT-> preferences-> Android> NDK

Generally, the SDK automatically searches for a path. If it is empty, it loads the path.

As follows:

 

After Eclipse is configured, we will create our first project. And import it into Eclipse

 

Open the terminal and enter cocosnewhelloworld-lcpp-d ~ /Desktop

 

Helloworld is the project name-l followed by the Language (C ++)-d followed by the Project path (desktop)

Created successfully:

Next we will import the data directly:

An error is reported when the src directory is imported for the first time.

 

 

Under the/cocos2d/cocos/platform/android/java/src (that is, the project you want to compile) Directory of the engine, you can copy the com and org folders to the src directory.

The following figure shows the finished project architecture after successful import:

 

 

Important directories:

Src/java original code storage directory

The gen directory stores all files automatically generated by Android development tools. The most important part in the directory is the R. java file.

Res Resource Directory

Assets Resource Directory

Libs directory stores jar package C ++ library files

AndroidManifest. xml project list file

 

After the environment is set up, start our Cocos game development journey.

 

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.