Cocos2d-x learning Summary Configuration chapter

Cocos2d-x learning Summary Configuration chapter

Learning Tools: Cocos2d-the X-User's Manual , "the X-Cocos2d-game development tour"

First official website to download cocos2d-x source, install vs2019. If you do not python2 installation, the official website to download and install python2.7. (Development tools need to restart after Bahrain. Cancellation is of no use.)

Decompression cocos2d-x folder, run setup.py (configuration environment variable cocos2d-x's)

Cocos command cocos2d-x with new construction. Cocos command execution directory is ./tools/cocos2d-console/bin/cocos, command usage is cocos new% ProjectName% -l cpp -d D: \ cocosProjects. To make the project easier to create, you can create your own compile a bat script project.

@echo off

set /p ProjectName=请输入工程名

D:\cocos2dx\cocos2d-x-3.17.2\tools\cocos2d-console\bin\cocos new %ProjectName% -l cpp -d D:\cocosProjects

After tens of seconds to wait, you may be in D: \ cocosProjects find your project folder. Long roughly like this:

MycocosProject
|- cocos2d      ······cocos2d引擎文件
|- classes      ······本项目用到的类
|- Resources    ······本项目用到的资源文件
|- proj.linux   ······linux下的项目文件
|- proj.win32   ······win32下的项目文件
|- proj.android ······Android下的项目文件
|- proj.ios_mac ······ios和mac下的项目文件

No need to delete the last two, open MycocosProject / proj.win32 in MycocosProject.sln.

This time visual studio will prompt you need to redirect the project (cocos2d-x use vs2015 development team, we are using vs2019. Since all the resources for new projects come from the development team, which is itself a vs2015 project. In order to use vs2019 editor , we need to create upgrade project to vs2019 version)

Then you can build the project. After a few minutes HelloWorld program is a cocos2d-x's. So we ran up the success of the first cocos2d-x program it!

However, there is a fatal problem (for ssd users), it is the development of default cocos2d-x is a project folder, folder includes libraries of all cocos2d-x. This leads to a cocos2d-x project occupies almost 2Gb hard disk space (win7 measured)! In fact, we can put more items into a large integrated project (ie vs the solution), so that multiple items shared libraries set cocos2d-x, so that you can greatly save disk space. No matter how many items you create, it will not increase the size of hard drive space of 2Gb2Gb.

Specific mode of operation is to create a second cocos2d-x project, leaving only the classes, Resources, proj.win32 three folders, then put it MycocosProject folder.

Then, enter proj.win32 newly created directory project, which opened xxx.vcxproj with a text editor. Will file all the ".. \ cocos2d" replaced ".. \ .. \ cocos2d".

After that open the original project MycocosProject, right-click on the solution and select [Add] - [] existing project, select xxx.sln, import a new project.

After importing the project, like the need to redirect the project. Right to redirect the project.

Now we have the success of the new project into the original solution in that big. Note, however, can not use the original sln file is opened later when we open a new project. We need to open with a big project MycocosProject the sln file, otherwise it will prompt cocos libraries are uninstalled.

If you have obsessive-compulsive disorder (like me), you can delete a large project in the classes and MycocosProject Resources folder, the project became so MycocosProject other works of pure starter.

After that, if we want to create a new project, a direct copy and paste the file xxx project folder and all the files contained xxx file names are changed to contain the name of the new project will be able to put the folder.

[Supplement] sln file concept: a collection of files used in the solution development environment, is one or more items (proj) of. It all elements of one or more items into a single organization solutions. This file is stored in the parent project directory.

Report: New construction batch file (a new project template folder for _HelloWorld)

@echo off

setlocal enabledelayedexpansion

set /p ProjectName=请输入工程名

xcopy /y _HelloWorld %ProjectName% /s /e /I

for /r %ProjectName% %%i in (*_HelloWorld*) do (

    set oldpath=%%~fi

    set newpath=!oldpath:_HelloWorld=%Projectname%!

    echo !oldpath!

    echo !newpath!

    mv !oldpath! !newpath!

)

pause

When using setlocal enabledelayexpansion to make batch processor script to execute separate compound statement, to avoid the bat file to a single statement to calculate all the re-assignment of the case.

After the open delayexpansion, variables can not be reused% val% said that rather use the! Val! Representation.

Reference Documents

Guess you like

Origin www.cnblogs.com/MyNameIsPc/p/11204823.html