Before we do the cocos2d game development We first configure the environment, we first to prepare the tool, we need the tools 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 the examples of this tutorial in the 3.4 version for example, download the direct decompression. Click to download cocos2d engine
2.JDK
Check if the JDK environment is installed on your computer
Method: Open terminal, enter Java–version
If not installed, click Download JDK
The effect is as follows:
3.ADT Download, ADT is known as an integrated development environment for Android. Integrates the SDK and development tools eclipse. Click to download ADT
Unzip the downloaded file. There are SDK and Eclipse two folders under the folder, Eclipse development tool
The effect is as follows:
3.NDK download Install, click Download NDK, download finished directly to the ADT folder
The SDK and NDK are present in the ADT folder next to the SDK NDK ant three configuration path.
OK now i we start the environment configuration.
1. Drag the setup.py from the downloaded Cocos Engine directory directly to the terminal
2. The terminal will then require input from the SDK ndk ant path input and enter the path of the SDK Ndk ADT separately
It will ask us to enter the NDK path SDK path separately and the ant path
Note here is the path to follow/, ant exists in the application under the Coco folder, if there is no self to the Cocos official website to download the Cocos engine, and
Download the framework under its App Store
Configuration succeeded:
If you want to develop Cocos on Eclipse, you also need to make configuration settings on Eclipse SDK Ndk path
Top adt->preferences->android for Setup SDK
Top Adt->preferences->ANDROID>NDK to set NDK
The generic SDK automatically searches the path if it is empty and then loads its path in
As follows:
Eclipse is also configured next we'll create our first project. and import it into eclipse
Open Terminal input: cocosnewhelloworld-lcpp-d~/desktop
HelloWorld is the project name-L followed by the language (C + +)-D after the project path (desktop)
New success:
Next we are going to import directly:
Generally the first import src directory will be error to import the Android environment package
Engine directory under the/COCOS2D/COCOS/PLATFORM/ANDROID/JAVA/SRC (that is, you want to compile the project) directory, there is a COM, org two folders copied to the SRC directory can be.
Here is the finished project schema diagram after successful import:
Important catalogue to explain:
Src/java Original Code Storage directory
All files generated automatically by Android development tools are stored in the Gen directory. The most important thing in the catalogue is the R.java file.
Res resource (Resource) directory
Assets Resource Directory
Libs Directory store jar package C + + library files
Androidmanifest.xml Project manifest file
Set up the environment and start our Cocos game development tour right away.
"Cocos2d Introductory Tutorial One" COCOS2D-X environment construction