macro
Class
Module: _decorator Parent Module: cc
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 or not clear dom Image object cache after uploading to gl texture.
Details
Properties
RAD
PI / 180
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:39 |
DEG
One degree
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:46 |
REPEAT_FOREVER
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:53 |
FLT_EPSILON
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:59 |
MIN_ZINDEX
Minimum z index value for node
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:65 |
MAX_ZINDEX
Maximum z index value for node
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:72 |
ONE
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:80 |
ZERO
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:86 |
SRC_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:92 |
SRC_ALPHA_SATURATE
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:98 |
SRC_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:104 |
DST_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:110 |
DST_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:116 |
ONE_MINUS_SRC_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:122 |
ONE_MINUS_SRC_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:128 |
ONE_MINUS_DST_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:134 |
ONE_MINUS_DST_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:140 |
ONE_MINUS_CONSTANT_ALPHA
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:146 |
ONE_MINUS_CONSTANT_COLOR
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:152 |
ORIENTATION_PORTRAIT
Oriented vertically
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:159 |
ORIENTATION_LANDSCAPE
Oriented horizontally
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:166 |
ORIENTATION_AUTO
Oriented automatically
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:173 |
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:187 |
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:209 |
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:216 |
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:226 |
BATCH_VERTEX_COUNT
The maximum vertex count for a single batched draw call.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:248 |
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:257 |
DOWNLOAD_MAX_CONCURRENT
The max concurrent task number for the downloader
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/platform/CCMacro.js:267 |
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:277 |
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:292 |
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:314 |
Deprecated | since v2.0 |
CLEANUP_IMAGE_CACHE
Whether or not clear dom Image object cache after uploading to gl texture. Concretely, we are setting image.src to empty string to release the cache. Normally you don't need to enable this option, because on web the 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:332 |