[Cocos2D-X Study Notes] How to Build a windows Cocos2D-x Development Environment

Source: Internet
Author: User
Tags decompress file

Prerequisites:

Cocos2D underlying rendering technology: OpenGl ES \ DirectX \ Canvas

Cocos2D cross-platform solution (learn more ):

Top layer: APP

Intermediate: Opengl: view event

Bottom layer: Cocos2d: screen layer Touch/Key

COcos2d Version Control (learn more ):

Cocos2d python

--> Cocos2d-iphone

--> ShinyCocos

--> CocosNet

--> Cocos2d-android

--> Cocos2d-android-1

--> CocosCairo

--> Cocos2d-javascript

--> Coco2d-X --> Cocos2d-xna (WP7: xna Directx-based) cocos2d-html5 (Canvas for acceleration, efficiency may be low)

--> Lua scripting language, encapsulation of Cocos2d-X

Cocos2d-x version classification (understanding ):

(1) divided by development languages: C ++, C #, JavaScript, Lua, Html5 (JS)

(2) classified by platform: Android Mac/Ios Windows xp/7/8 WP7/8 HTML5 Airplay blackberry Meego Bada

(3) classified by graphics standards: OpenGL ES 1.x OpenGl ES 2.x (incompatible) DitrectX 11.1 Directx 10

 

Cocos2d-X function module (important ):

Cocos2D function modules Opengl Es, Directx, Canvas, pthread (multithreading)

Physical engine: Box2D, Chipmunk

Network library file: libcurl BSD Socket (Communication Module) SimpleAudioEngine (audio engine)

 

Cocos2d-X data structure (important ):

CCCopying: This class contains a virtual function, similar to the java interface. CCObject inherits CCCopying, And because CCObject is the parent class of all classes, each object has a Copy method.

CCObject: The base class of all classes except Copy, similar to the Object in Java

CCZone

CCData: stores data, which contains a byte array member.

CCGeometry: plotting-related class.

CCSet: store data, similar to set in Java

CCArray: Array

CCString: Char array object

CcTypes. h: defines some common Constants

STL: Data Structure in the vector list stack queue map C ++ syntax

 

Install the Cocos2d win32 Development Environment

Download and install Visual Studio 2012 or 2010.

1, download cocos2d-2.0-x-2.0.4, address: http://www.oschina.net/news/34396/cocos2d-2-0-x-2-0-4

The reason why I didn't choose to download the source code of the updated version is that the updated version requires a script to create a project. This version is sufficient for cocos2dx beginners.

2, extract the cocos2d-2.0-x-2.0.4.zip, unzip the file

3, click extract folder in the install-templates-msvc.bat file, will automatically add cocos2d template to the VS project, after installation, new VS project will appear:

4. Click the cocos2d-win32.vc2012.sln in the cocos2d decompression file (depending on the installation version of VS), will start VS, VS will automatically generate the solution, and will display several cocos2d built-in

For a project, such as helloCPP, select a project, right-click it, and select set as a startup Item. Then, click the local windows debugger to run the project.

The star icon is a Debug mode that can be selected. You can select the Release or Debug mode, and select releaseplugin to generate a release.win32 folder in the cocos2d folder, with the executable file .exe

You can also click the build-win32.bat in the cocos2d unzipping package to generate a solution on the console.

 

5. How to create your own project: [Key]

Many times, when creating a project to run, the system will prompt that a file is missing. For example, if you create a project in the root directory of drive D, the system will prompt that a file is missing during running, because the solution in the project attribute is newly created,

You can open project-> properties-> Configure properties-> C/C ++-> General-> and view the Add directory on the right.

The appended include directory contains some file paths related to the file solution, including some link files, header files, macro definitions, variable definitions, and so on.

Note that $ (SolutionDir) indicates the root directory of the project you created, for example, D: \ test \. You will find that D: the \ test \ Folder does not contain any folders named cocos2dx, external, or CocosDension,

In this case, an error is certainly reported during the migration. Solution: copy the three folders cocos2dx, external, and CocosDension to D: \ test \ In the downloaded cococo2d2.0.4 package. Here, we mainly look at the folders in the attached directory, copy a few of them, and then run it.

 

Another solution is to click the cocos2d-win32.vc2012.sln in the cocos2d decompress file, VS automatically generate the solution, add the project in the current solution, instead of creating a new solution, the created Project will be included in the directory of the Cocos2d2.0.4 folder you decompressed,

 

Then follow the default prompt to create the project and start the project and you will find it ready to run.

 

 

 

 

 

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.