macro
Class
Predefined constants
Index
Properties
RAD
Number
PI / 180DEG
Number
One degreeREPEAT_FOREVER
Number
FLT_EPSILON
Number
MIN_ZINDEX
Number
Minimum z index value for nodeMAX_ZINDEX
Number
Maximum z index value for nodeONE
Number
ZERO
Number
SRC_ALPHA
Number
SRC_ALPHA_SATURATE
Number
SRC_COLOR
Number
DST_ALPHA
Number
DST_COLOR
Number
ONE_MINUS_SRC_ALPHA
Number
ONE_MINUS_SRC_COLOR
Number
ONE_MINUS_DST_ALPHA
Number
ONE_MINUS_DST_COLOR
Number
ONE_MINUS_CONSTANT_ALPHA
Number
ONE_MINUS_CONSTANT_COLOR
Number
ORIENTATION_PORTRAIT
Number
Oriented verticallyORIENTATION_LANDSCAPE
Number
Oriented horizontallyORIENTATION_AUTO
Number
Oriented automaticallyFIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX
Number
The same for bottom and top.DIRECTOR_STATS_POSITION
Vec2
Position of the FPS (Default: 0,0 (bottom-left corner))...ENABLE_STACKABLE_ACTIONS
Number
If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked.TOUCH_TIMEOUT
Number
The timeout to determine whether a touch is no longer active and should be removed.BATCH_VERTEX_COUNT
Number
The maximum vertex count for a single batched draw call.ENABLE_TILEDMAP_CULLING
Boolean
Whether or not enabled tiled map auto culling.DOWNLOAD_MAX_CONCURRENT
Number
The max concurrent task number for the downloaderENABLE_TRANSPARENT_CANVAS
Boolean
Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.ENABLE_WEBGL_ANTIALIAS
Boolean
Boolean that indicates if the WebGL context is created withantialias
option turned on, default value is false.ENABLE_CULLING
Boolean
Whether or not enable auto culling.CLEANUP_IMAGE_CACHE
Boolean
Whether to clear the original image cache after uploaded a texture to GPU.SHOW_MESH_WIREFRAME
Boolean
Whether or not show mesh wire frame.SHOW_MESH_NORMAL
Boolean
Whether or not show mesh normal.ENABLE_MULTI_TOUCH
Boolean
Whether to enable multi-touch.SUPPORT_TEXTURE_FORMATS
String[]
The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types.
Details
Properties
RAD
PI / 180
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:37 |
DEG
One degree
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:44 |
REPEAT_FOREVER
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:51 |
FLT_EPSILON
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:57 |
MIN_ZINDEX
Minimum z index value for node
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:63 |
MAX_ZINDEX
Maximum z index value for node
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:70 |
ONE
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:78 |
ZERO
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:84 |
SRC_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:90 |
SRC_ALPHA_SATURATE
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:96 |
SRC_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:102 |
DST_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:108 |
DST_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:114 |
ONE_MINUS_SRC_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:120 |
ONE_MINUS_SRC_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:126 |
ONE_MINUS_DST_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:132 |
ONE_MINUS_DST_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:138 |
ONE_MINUS_CONSTANT_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:144 |
ONE_MINUS_CONSTANT_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:150 |
ORIENTATION_PORTRAIT
Oriented vertically
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:157 |
ORIENTATION_LANDSCAPE
Oriented horizontally
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:164 |
ORIENTATION_AUTO
Oriented automatically
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:171 |
FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX
If enabled, the texture coordinates will be calculated by using this formula:
- texCoord.left = (rect.x*2+1) / (texture.wide*2);
- texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2);
The same for bottom and top.
This formula prevents artifacts by using 99% of the texture.
The "correct" way to prevent artifacts is by expand the texture's border with the same color by 1 pixel
Affected component:
- cc.TMXLayer
Enabled by default. To disabled set it to 0.
To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:185 |
DIRECTOR_STATS_POSITION
Position of the FPS (Default: 0,0 (bottom-left corner))
To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
meta | description |
---|---|
Type | Vec2 |
Defined in | cocos2d/core/platform/CCMacro.js:207 |
ENABLE_STACKABLE_ACTIONS
If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked.
If you run 2 or more 'position' actions at the same time on a node, then end position will be the sum of all the positions.
If disabled, only the last run action will take effect.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:214 |
TOUCH_TIMEOUT
The timeout to determine whether a touch is no longer active and should be removed. The reason to add this timeout is due to an issue in X5 browser core, when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area, no touch cancel event is triggered, and the touch will be considered active forever. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds. Though it might remove a real touch if it's just not moving for the last 5 seconds which is not easy with the sensibility of mobile touch screen. You can modify this value to have a better behavior if you find it's not enough.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:224 |
BATCH_VERTEX_COUNT
The maximum vertex count for a single batched draw call.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:246 |
ENABLE_TILEDMAP_CULLING
Whether or not enabled tiled map auto culling. If you set the TiledMap skew or rotation, then need to manually disable this, otherwise, the rendering will be wrong.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:255 |
DOWNLOAD_MAX_CONCURRENT
The max concurrent task number for the downloader
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:265 |
ENABLE_TRANSPARENT_CANVAS
Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance. Though if you want to make your canvas background transparent and show other dom elements at the background, you can set it to true before
cc.game.run
. Web only.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:275 |
ENABLE_WEBGL_ANTIALIAS
Boolean that indicates if the WebGL context is created with
antialias
option turned on, default value is false. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated. Whether to use this really depend on your game design and targeted platform, device with retina display usually have good detail on graphics with or without this option, you probably don't want antialias if your game style is pixel art based. Also, it could have great performance impact with some browser / device using software MSAA. You can set it to true beforecc.game.run
. Web only.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:290 |
ENABLE_CULLING
Whether or not enable auto culling. This feature have been removed in v2.0 new renderer due to overall performance consumption. We have no plan currently to re-enable auto culling. If your game have more dynamic objects, we suggest to disable auto culling. If your game have more static objects, we suggest to enable auto culling.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:312 |
Deprecated | since v2.0 |
CLEANUP_IMAGE_CACHE
Whether to clear the original image cache after uploaded a texture to GPU. If cleared, Dynamic Atlas will not be supported. Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory. But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage. So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:330 |
SHOW_MESH_WIREFRAME
Whether or not show mesh wire frame.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:346 |
SHOW_MESH_NORMAL
Whether or not show mesh normal.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:356 |
ENABLE_MULTI_TOUCH
Whether to enable multi-touch.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/platform/CCMacro.js:366 |
SUPPORT_TEXTURE_FORMATS
The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types. Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
meta | description |
---|---|
Type | String[] |
Defined in | cocos2d/core/platform/CCMacro.js:387 |