macro
Class
Module: _decorator
Parent Module: cc
Predefined constants
Index
Properties
Details
Properties
RAD
PI / 180
DEG
One degree
REPEAT_FOREVER
FLT_EPSILON
MIN_ZINDEX
Minimum z index value for node
MAX_ZINDEX
Maximum z index value for node
ONE
ZERO
SRC_ALPHA
SRC_ALPHA_SATURATE
SRC_COLOR
DST_ALPHA
DST_COLOR
ONE_MINUS_SRC_ALPHA
ONE_MINUS_SRC_COLOR
ONE_MINUS_DST_ALPHA
ONE_MINUS_DST_COLOR
ONE_MINUS_CONSTANT_ALPHA
ONE_MINUS_CONSTANT_COLOR
ORIENTATION_PORTRAIT
Oriented vertically
ORIENTATION_LANDSCAPE
Oriented horizontally
ORIENTATION_AUTO
Oriented automatically
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
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
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.
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.
BATCH_VERTEX_COUNT
The maximum vertex count for a single batched draw call.
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.
DOWNLOAD_MAX_CONCURRENT
The max concurrent task number for the downloader
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.
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 before cc.game.run
.
Web only.
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.
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.
SHOW_MESH_WIREFRAME
Whether or not show mesh wire frame.
ROTATE_ACTION_CCW
Set cc.RotateTo/cc.RotateBy rotate direction.
If need set rotate positive direction to counterclockwise, please change setting to : cc.macro.ROTATE_ACTION_CCW = true;
SUPPORT_TEXTURE_FORMATS
!en
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。
!zh
引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。
目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。