[Nagging]
The engine directory of 3.x differs greatly from that of 2.x. Friends who have learned 2.x should find that the Engine Directory of 2.x is a bit messy. 3. x classifies the engine files by purpose, making the engine directory structure clearer.
[View the 3.x Engine Directory]
To learn cocos2dx well, you must first understand the files in the Engine Directory. Next, let's analyze the file directory of the cocos2dx3.2 engine.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/48/ED/wKiom1QMPY2xzGrTAAGpUeF7jAI362.jpg "Title =" 1.jpg" alt = "wkiom1qmpy2xzgrtaagpuef7jai362.jpg"/>
From the directory, let's take a look at the following files:
File Name |
Description |
Build |
Officially compiled project solutions. Focus on this file, such as cocos2d-win32.vc2012.sln, debug. Win32, win32-msvc-2012-x86.cmd, etc. These are directly stored in the root directory in 2.x. |
Cocos |
All source files used in cocos2dx development are concentrated. In addition to the core part of cocos2dx engine, it also includes sound engine, physical engine, network, Gui and so on. |
Extensions |
Extension directory. This includes some 2.5D special effects, network control, and some guis. To use these extensions: # Include "cocos-ext.h" Using namespace cocos2d: Extension |
External |
Third-party directory Library. It mainly includes box2d, chipmunk physical engine, and sqlite3 lightweight database. |
Tests |
Official example. Including the official CPP and Lua examples. CPP-empty-test is the simplest example. It also contains a CPP-Tests project, which covers the use of all classes of the cocos2dx engine, so it is very important! |
Templates |
Template directory. Provides the cocos2dx new project templates created on various platforms and IDE. |
Tools |
Tool directory. Provides a script tool for creating a new cocos2dx project on various platforms. Where: \ tools \ cocos2d-console \ bin \Cocos. pyIs used to create a new cocos2dx project. |
Download-deps.py |
Automatically download third-party plug-ins required for the cocos2d-x (if any) |
Setup. py |
Configure the cocos2dx environment variable script. |
[Cocos file directory]
In version 3.x, almost all resource files required for cocos2dx engine development are stored in the Cocos folder.
The classification of directories is more detailed, which makes the engine structure clearer.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/48/ED/wKiom1QMQOqQ7F1CAAHhyV_C1Wg013.jpg "Title =" 2.jpg" alt = "wkiom1qmqoqq7f1caahhyv_c1wg013.jpg"/>
From the structure of the file directory, we can see that the classification is clearer.
File Name |
Description |
Base |
One of the core components of the cocos2dx engine. Stores some basic classes, such as REF, ctor, vector, map, and value. |
2d
|
One of the core components of the cocos2dx engine. Classes that store some core components, such as sprtie, layer, label, and menu. |
3D |
Added support for some 3D images. Sprite3d and animate3d may be available in the future. |
Math |
Stores mathematical-related class files in the engine. For example, coordinate vec2.h and ry ccgeometry. H (rect and size are defined. |
Renderer |
The rendering file of the engine. Texture2d, Renderer, and shader. |
Deprecated |
To store the Rules to be deprecated in 2.x. For example, you can use typedef to ensure CC compatibility (for example, typedef label cclabel ). |
Platform |
Portal classes on different platforms. Ccapplication. H, ccglview. H, ccgl. H, ccstdc. h |
Audio |
Source file of the sound engine. In 2.x, it is placed in the cocosdenshion folder in the root directory. |
Physics |
Source files related to the physical Engine. Chipmunk.
|
Network |
Network-related source files. Httpclient and websocket. |
UI |
Gui source files. |
Editor-support |
Editor support. Cocosbuilder, cocostudio, and spine. |
Scripting |
Lua script source file. |
Cocos2d. h
|
The core header file of the cocos2dx engine contains all classes in the engine. You can open it to view the location of all source files of the engine. |
[Main database in the engine]
Let's startBuild cocos2d-win32.vc2012.slnSolution.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/48/EF/wKioL1QMRdKBxT6dAADWdqhMPIo362.jpg "Title =" 3.jpg" alt = "wkiol1qmrdkbxt6daadwdqhmpio362.jpg"/>
As you can see, the classification of the engine library of 3.x is more detailed than that of 2.x.
Library files |
Description |
Libaudio |
Sound engine library. Original Name: libcosdenshion |
Libbox2d |
Physical engine Library |
Libchipmunk |
Physical engine Library |
Libcocos2d |
Cocos2dx Core Engine Library |
Libextensions |
Extended Library |
Libcocosbuilder |
Editor support library |
Libcocosstudio |
Editor support library |
Libspine |
Editor support library |
Libnetwork |
Network Library |
Libgui |
Gui Library |
Liblocalstorage |
Local data storage solution Library |
Liblua |
Lua script Library |
[Header file directory]
Header file |
Directory |
Cocos2d. h |
Cocos2d-x-3.2 \ Cocos \ |
Ccdeprecated. h |
Cocos2d-x-3.2 \ Cocos \ deprecated \ |
Simpleaudioengine. h |
Cocos2d-x-3.2 \ Cocos \ audio \ include \ |
Httpclient, websocket |
Cocos2d-x-3.2 \ Cocos \ Network \ |
Cocosbuilder, cocostudio, and spine |
Cocos2d-x-3.2 \ Cocos \ Editor-support \ |
Cocosgui. h |
Cocos2d-x-3.2 \ Cocos \ UI |
Cocos-ext.h |
Cocos2d-x-3.2 \ extensions \ |
Box2d, chipmunk, sqlite3 |
Cocos2d-x-3.2 \ external \ |
This article is from the "summer wind" blog, please be sure to keep this source http://shahdza.blog.51cto.com/2410787/1549803
Cocos2dx [3.x] (2) -- Analysis of the cocos2dx3.2 Engine Directory