Overview
Project-related configuration, transferred from the original cocos2d.js
to project.json
Medium, the file needs to be in the same class as the index.html
general recommendation under the root directory.
cocos2d.js changed to project.json
are as follows:
The original mixed cocos2d.js
with some logic code, it is not very good to reflect that it is as a project configuration file.
It is more friendly to use the JSON format as a configuration file. You can also make, cocos-console
cocos-utils
and even user-defined script tools that use the same configuration file.
Field Description DebugMode
Equivalent to the original COCOS2D_DEBUG
, wherein:
0 means that debug mode is turned off, and 1 means that log,2 means that warn,3 indicates that error,5 represents logforwebpage,6 warnforwebpage,7.
Rendermode
Same as the original configuration, indicating the rendering mode. 0 is the default, and 1 is canvas,2 for WebGL.
Showfps
Same as the original configuration, indicates whether the frame rate display is turned on. The default is False.
Framerate
Same as the original configuration, indicating the set frame rate. The default is 60.
Enginedir
Same as the original configuration, used to specify the engine directory. The difference is that, in the V2 version, the point is **/cocos2d-html5/cocos2d
, but in the V3 version, just point to the **/cocos2d-html5
line. The default is "FRAMEWORKS/COCOS2D-HTML5".
Jslist
Equivalent to the original appFiles
, used to enumerate the list of JS.
Id
Equivalent to the original tag
, which specifies the ID of the canvas.
Modules
In the V2 version, only through loadextension
, box2d
, chipmunk
, pluginx
and other switches to specify whether a module should be used.
In the V3 version, the use of modules
fields, flexible configuration, which can also better support the future of the engine module clipping. The configuration is as follows:
"modules" : ["extensions", "pluginx", "box2d", "chipmunk"]
If you want to know what modules are specifically provided in the engine, see moduleConfig.json
The fields in the file module
.
reprinted from: http://www.cocos2dx.net/post/250
"COCOS2D-JS official Documents" 22, Project.json