Start tossing the cocos2d-x and use batch processing to create a project

Source: Internet
Author: User

Began to take the time to learn cocos2d-x, although C and C ++ are not good, but in the development of learning memory may be deeper;
So I decided to start learning from today and use my free time to make it happen. This is exactly the case on May Day. I set up a development environment yesterday. Visual Studio installation is not very slow, maybe my current configuration is a little low, then it is to compile the Cocos2d-x-V2.2.3, do not know if there are any errors of others, I am at the end of the compilation prompt there are 15 warnings, 10 errors, but I did not care about it. I tried to run the sample program and it was okay. Then I created a HelloWorld myself. So I did not care about the error; since I started paying attention to the Cocos2d-x, she has updated to V2.X, so creating a new project is not the same as the previous tutorial on the Internet, but also to install what templates for, now it seems that all of them are created using Python, and this Python version also has requirements. It seems that it cannot be used 3. the version of X, I used 2.7.6; I feel that it is very easy to create this project now, just one sentence, is to call the Cocos2d-x \ tools \ project-creator \ create_project.py file to create, required Parameters

create_project.py -project %ProjectName% -package %PackageName% -language cpp

Project name is the project name, PackageName is the project package name, and language is the fable used by the project. There are three options: cpp, javascript, and lua;
I wanted to select two languages at the time of creation but it was not successful! I don't know if I can only select one at a time.
According to this sentence, many people on the Internet have thanked me for a batch processing, and I also wrote one, slightly beautifying O (∩) O ~~
This batch processing can determine whether the project name and package name are empty. If it is blank, you need to re-enter the project name. After the project is created successfully, it will automatically open the project and close the batch processing:

@ Echo off: startProjectecho complete echo --- enter the project name and package name to create the project --- echo ------------------------------------------- set/p ProjectName = ProjectName: if "% ProjectName %" = "" goto inputErrorif "% ProjectName %" = "exit" goto exitecho Input ProjectName is: % ProjectName % set/p PackageName = PackageName: if "% PackageName %" = "" goto inputErrorif "% ProjectName %" = "exit" Goto exitecho Input PackageName is: % PackageName % echo Create Project loading... d: \ Android \ Cocos2d \ cocos2d-x-2.2.3 \ tools \ project-creator \ create_project.py-project % ProjectName %-package % PackageName %-language cppecho Create Project Success! Loading project... d: \ Android \ Cocos2d \ cocos2d-x-2.2.3 \ projects \ % ProjectName % \ proj. win32 \ % ProjectName %. vcxprojexit: inputError @ echo ProjectName and PackageName not null !!! @ Echo ===================================================== =========@ echo === the input is empty, enter ======@ echo ============================================== ================== goto startProject: exit
The absolute path of the files selected for this batch processing is referenced, so the batch processing files can be run anywhere!
I did not choose to change the storage path of the created project, or the default Cocos2d-x under the projects directory, it seems to have changed this path, but also copy the corresponding file, otherwise it will lead to compilation can not pass;


While using cocos2d-x 3.0, the method of creation is somewhat different, and with the environment configured, this batch can create a project with cocos2d-x 3.0 by simply changing a command; the following is the batch processing for Project Creation in 3.0.

@ Echo off: startProjectecho-echo-enter the project name and package name to create the project echo ------------------------------------------- set/p ProjectName = ProjectName: if "% ProjectName %" = "" goto inputErrorif "% ProjectName %" = "exit" goto exitecho Input ProjectName is: % ProjectName % set/p PackageName = PackageName: if "% PackageName %" = "" goto inputErrorif "% ProjectName %" = "exit" goto exitecho Input PackageName is: % PackageN Ame % echo Create Project loading... cocos new-p % PackageName %-l cpp % ProjectName %-d D: \ Develop \ Cocos2dx \ workspaceecho Create Project Success! Loading project... D: \ Develop \ Cocos2dx \ workspace \ % ProjectName % \ proj. win32 \ % ProjectName %. vcxprojexit: inputError @ echo ProjectName and PackageName not null !!! @ Echo ===================================================== =========@ echo = the input is empty, enter ===================================================== ============= goto startProject: exit


OK. The Code has been written!

More can follow my personal blog site: Melove I love: http://www.melove.net

Related Article

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.