Cocos2d-x v3.1 Project Creation (III)
Cocos2d-x v3.1 Project Creation (III)
Cocos2d-x provides us with a set of command line tools for creating, compiling, running, and deploying, that is, the Cocos2d-Console we mentioned in the previous article, it is located in the tools subdirectory under our engine directory. This article mainly describes how to create a Cocos2d-x project, so the compilation, running and deployment will not be introduced. In the future, we will compile, run, and deploy the project in the ADT development environment, but the project development will be carried out in VS2012.
First, let's take a look at some of the relevant parameters of the Cocos2d-Console and demonstrate how to generate a project through an instance, the generated project contains the android, wp8, IOS and win32 projects. Next we will step into the introduction of the Cocos2d-Console command line tool.
1. Introduction to Cocos2d-Console Parameters
Command Format: cocos [command] [arguments]
[Command]: There are 5 optional values:
Compile is used to compile the new project of different platforms, generate the project (which we will use) run, run the project jscompile, compile js into the jsc file deploy for deployment
[Arguments]: Different [Commands] have different values.
Now, enter cocos -- help in the CMD command line to view the specific help information, as shown in:
To generate a project, you only need the "new" command. Now let's take a look at its detailed description and enter cocos new-help, for example:
-H,-l, and-d do not have to read the description to know what it means, the only difference is that-p and-t are not required when these two parameters are generated for the project.
-P option: set the project package name. In android, each project requires a package name. Note that the package must have three levels, for example, Test. cocos. tutorial. -t option, which is used to set the template for the project to be created. The default value is default, that is, the "cpp-template-default" directory in the templates directory under the engine directory.
Ii. Generate a project
Now we generate a project instance. I want to generate a Tutorial project under the local directory "D: \ CocosProject". To illustrate the use of these parameters, we try to use multiple parameters, although some are not necessary. Enter "cocos new-p Test. Cocos. Tutorial-l cpp-d: \ CocosProject-t default Tutorial" in CMD ". For example:
Go to the "D: \ CocosProject" and find the Tutorial directory.
PS: It is recommended that you do not directly copy the above command string for possible errors. Enter an article by yourself! It may be caused by encoding problems.