工欲善其事, its prerequisite.
you want to use cocos2d-x engine, you need to configure (or install) the engine to cocos2d-x official website download page Download engine, the official website to 2.x and 3.x two version, I use the version of 3.6, 3.x version of the class name, the function name is more C + + fan! There are many tutorials in the Chinese official website , and the Cocos Development platform provides developers with many useful things.
Cocos2d-x engine is a cross-platform game development engine, the development of the game can run on Ios,android,windows phone,mac,win32 and other devices, the available development platform usually has windows and MAC, this article uses the Windows platform for example, In addition, the development platform and the running platform equipment are closely related, the engine in each platform is similar, the single platform each has its own characteristics, according to the need to configure the development platform.
Anyway , install cocos2d-x the engine now has two methods, first to the traditional:
Console:
Unzip the downloaded Engine pack to
!! Note: There are non- ASCII characters in the full path, and no spaces , but also the path to the new project.
Download Installation python ( Cocos Console dependent script), requires version 2.x, 3.x non-compatible, check the last option can be automatically added to system variables
can be run directly at home console, missing words will be added manually, right-click My Computer--Properties
The user variable does not have a new path , and some add a Python installation path plus a semicolon to the previous one. in the console input python see below, it indicates the Python configuration is successful, there is no need to check the environment variables are correct.
Configure the Cocos console
Open the console, go to the extracted engine root directory (console, enter D: into the D-packing directory, the same as other disks; DIR displays all files and folders under the current path equal to LINUX under LS; CD folder enters folder; These are enough)
input python setup.py Run the configuration script
The next step is to ask for an Android-developed NDK, SDK, ant these are for Android development, not the engine must, you can directly press ENTER to skip, configure the Android development reference this article.
Prompt to restart the console, reboot is good.
Restart console input Cocos to see the hints in.
Cocos is to create, run, package Cocos2d-x the engineering script, another name called Cocos Control Desk
Cocos There are several parameters (in the red Box), which are commonly used New , that is, the new project, usually in the integrated development environment to develop the game, the other is not commonly used, not much to say.
For example, the following New How to use it:
Cocos New Hello-p com.game.hello-l cpp-d E:/cocos
Cocos New
Hello creating a project requires a name first, and this is a must.
- P Com.game.hello Project package name, with default values, this distinguishes between different games, it is best to specify a different
- L CPP Specifies the language of development, with Cpp,js,lua,cocos2d-x and the Cocos2d-js of the Cocos The console is generic and needs to be specified
- D E:/cocos new Project's storage path, default in current folder
can be from Cocos Console output information to see that New first copy the template, then copy the engine file, then rename the project name and the package name.
This new project contains the engine complete file, you can modify the source files at will, without affecting the new project again, but the disadvantage is that the engine source files are quite large, the initial or recompile will take a considerable amount of time.
Cocos Engine
above is the console creation project, Cocos also provides Cocos Engine This new way to create, here's a look at
in the cocos2d-x official website download page Download the Cocos engine on the far right, this Cocos Engine contains a Cocosstudio Development tools (personal feeling is not good)
Project-New
Can see only create Lua,js in two script development options available, to develop C + + need to download Cocos framework, download in store, search box default display is the framework, point search can be found, download
Download, after installation, restart the Cocos engine , this point in the upper right corner of the x number is useless, right click on the taskbar icon exit.
New C + + options are available after reboot
Finally, two new projects are compared
above is Cocos Engine , the following is the console
can see Cocos Engine created with Cocosstudio project (Bring it!), the console has a Cocos engine catalog, and Linux and Win8.1-nuiversal engineering
Finally mention the development platform, WIN32 under the Visual Studio version requires more than 2012, 2015 is still not supported, optional also very little, wordy, Community edition free, there must be installed Visual C + +;
Android can be developed under Windows and Mac as long as the Android development environment is good, the above console configuration when you enter the Ndk,sdk,ant, you can pack Android in the console,
Mac environment to be simple, after AppStore download installs Xcode, double-click Open the project to be able
Cocos2d-x opening configuration (Windows platform)