Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core

Index

References

Enumerations

Classes

Interfaces

Events

Variables

Functions

Object literals

References

AffineTransform

Re-exports AffineTransform

AnimCurve

Re-exports AnimCurve

Animation

Re-exports Animation

AnimationClip

Re-exports AnimationClip

AnimationComponent

Renames and re-exports Animation

AnimationManager

Re-exports AnimationManager

AnimationState

Re-exports AnimationState

Asset

Re-exports Asset

AssetLibrary

Re-exports AssetLibrary

BASELINE_RATIO

Re-exports BASELINE_RATIO

BaseNode

Re-exports BaseNode

BatchedSkinningModelComponent

Renames and re-exports SkinnedMeshBatchRenderer

BatchingUtility

Re-exports BatchingUtility

BezierControlPoints

Re-exports BezierControlPoints

BitMask

Re-exports BitMask

BitmapFont

Re-exports BitmapFont

CCBoolean

Re-exports CCBoolean

CCFloat

Re-exports CCFloat

CCInteger

Re-exports CCInteger

CCObject

Re-exports CCObject

CCString

Re-exports CCString

CachedArray

Re-exports CachedArray

Camera

Re-exports Camera

CameraComponent

Renames and re-exports Camera

Color

Re-exports Color

CompactValueTypeArray

Re-exports CompactValueTypeArray

Component

Re-exports Component

CubicSplineNumberValue

Re-exports CubicSplineNumberValue

CubicSplineQuatValue

Re-exports CubicSplineQuatValue

CubicSplineVec2Value

Re-exports CubicSplineVec2Value

CubicSplineVec3Value

Re-exports CubicSplineVec3Value

CubicSplineVec4Value

Re-exports CubicSplineVec4Value

CurveTarget

Re-exports CurveTarget

CurveValue

Re-exports CurveValue

DESCRIPTOR_BUFFER_TYPE

Re-exports DESCRIPTOR_BUFFER_TYPE

DESCRIPTOR_DYNAMIC_TYPE

Re-exports DESCRIPTOR_DYNAMIC_TYPE

DESCRIPTOR_SAMPLER_TYPE

Re-exports DESCRIPTOR_SAMPLER_TYPE

DirectionalLight

Re-exports DirectionalLight

DirectionalLightComponent

Renames and re-exports DirectionalLight

Director

Re-exports Director

Downloader

Re-exports Downloader

EPSILON

Re-exports EPSILON

EasingMethod

Re-exports EasingMethod

EasingMethodName

Re-exports EasingMethodName

EffectAsset

Re-exports EffectAsset

Enum

Renames and re-exports valuetypes

Event

Re-exports Event

EventAcceleration

Re-exports EventAcceleration

EventHandler

Re-exports EventHandler

EventInfo

Re-exports EventInfo

EventKeyboard

Re-exports EventKeyboard

EventMouse

Re-exports EventMouse

EventTarget

Re-exports EventTarget

EventTouch

Re-exports EventTouch

Eventify

Re-exports Eventify

Font

Re-exports Font

ForwardFlow

Re-exports ForwardFlow

ForwardPipeline

Re-exports ForwardPipeline

ForwardStage

Re-exports ForwardStage

GFXAPI

Re-exports GFXAPI

GFXAddress

Re-exports GFXAddress

GFXAttributeName

Re-exports GFXAttributeName

GFXBindingMappingInfo

Re-exports GFXBindingMappingInfo

GFXBlendFactor

Re-exports GFXBlendFactor

GFXBlendOp

Re-exports GFXBlendOp

GFXBlendState

Re-exports GFXBlendState

GFXBlendTarget

Re-exports GFXBlendTarget

GFXBuffer

Re-exports GFXBuffer

GFXBufferAccess

Re-exports GFXBufferAccess

GFXBufferAccessBit

Re-exports GFXBufferAccessBit

GFXBufferFlagBit

Re-exports GFXBufferFlagBit

GFXBufferFlags

Re-exports GFXBufferFlags

GFXBufferSource

Re-exports GFXBufferSource

GFXBufferTextureCopy

Re-exports GFXBufferTextureCopy

GFXBufferUsage

Re-exports GFXBufferUsage

GFXBufferUsageBit

Re-exports GFXBufferUsageBit

GFXClearFlag

Re-exports GFXClearFlag

GFXColor

Re-exports GFXColor

GFXColorAttachment

Re-exports GFXColorAttachment

GFXColorMask

Re-exports GFXColorMask

GFXCommandBuffer

Re-exports GFXCommandBuffer

GFXCommandBufferType

Re-exports GFXCommandBufferType

GFXComparisonFunc

Re-exports GFXComparisonFunc

GFXCullMode

Re-exports GFXCullMode

GFXDepthStencilAttachment

Re-exports GFXDepthStencilAttachment

GFXDepthStencilState

Re-exports GFXDepthStencilState

GFXDescriptorSet

Re-exports GFXDescriptorSet

GFXDescriptorSetLayout

Re-exports GFXDescriptorSetLayout

GFXDescriptorType

Re-exports GFXDescriptorType

GFXDevice

Re-exports GFXDevice

GFXDrawInfo

Re-exports GFXDrawInfo

GFXDynamicStateFlagBit

Re-exports GFXDynamicStateFlagBit

GFXDynamicStateFlags

Re-exports GFXDynamicStateFlags

GFXExtent

Re-exports GFXExtent

GFXFeature

Re-exports GFXFeature

GFXFence

Re-exports GFXFence

GFXFilter

Re-exports GFXFilter

GFXFormat

Re-exports GFXFormat

GFXFormatInfo

Re-exports GFXFormatInfo

GFXFormatInfos

Re-exports GFXFormatInfos

GFXFormatSize

Re-exports GFXFormatSize

GFXFormatSurfaceSize

Re-exports GFXFormatSurfaceSize

GFXFormatType

Re-exports GFXFormatType

GFXFramebuffer

Re-exports GFXFramebuffer

GFXGetTypeSize

Re-exports GFXGetTypeSize

GFXInputAssembler

Re-exports GFXInputAssembler

GFXInputState

Re-exports GFXInputState

GFXLoadOp

Re-exports GFXLoadOp

GFXMemoryStatus

Re-exports GFXMemoryStatus

GFXMemoryUsage

Re-exports GFXMemoryUsage

GFXMemoryUsageBit

Re-exports GFXMemoryUsageBit

GFXObject

Re-exports GFXObject

GFXObjectType

Re-exports GFXObjectType

GFXOffset

Re-exports GFXOffset

GFXPipelineBindPoint

Re-exports GFXPipelineBindPoint

GFXPipelineLayout

Re-exports GFXPipelineLayout

GFXPipelineState

Re-exports GFXPipelineState

GFXPolygonMode

Re-exports GFXPolygonMode

GFXPrimitiveMode

Re-exports GFXPrimitiveMode

GFXQueue

Re-exports GFXQueue

GFXQueueType

Re-exports GFXQueueType

GFXRasterizerState

Re-exports GFXRasterizerState

GFXRect

Re-exports GFXRect

GFXRenderPass

Re-exports GFXRenderPass

GFXSampleCount

Re-exports GFXSampleCount

GFXSampler

Re-exports GFXSampler

GFXSamplerState

Re-exports GFXSamplerState

GFXShadeModel

Re-exports GFXShadeModel

GFXShader

Re-exports GFXShader

GFXShaderInfo

Re-exports GFXShaderInfo

GFXShaderStage

Re-exports GFXShaderStage

GFXShaderStageFlagBit

Re-exports GFXShaderStageFlagBit

GFXShaderStageFlags

Re-exports GFXShaderStageFlags

GFXStencilFace

Re-exports GFXStencilFace

GFXStencilOp

Re-exports GFXStencilOp

GFXStoreOp

Re-exports GFXStoreOp

GFXTexture

Re-exports GFXTexture

GFXTextureCopy

Re-exports GFXTextureCopy

GFXTextureFlagBit

Re-exports GFXTextureFlagBit

GFXTextureFlags

Re-exports GFXTextureFlags

GFXTextureLayout

Re-exports GFXTextureLayout

GFXTextureSubres

Re-exports GFXTextureSubres

GFXTextureType

Re-exports GFXTextureType

GFXTextureUsage

Re-exports GFXTextureUsage

GFXTextureUsageBit

Re-exports GFXTextureUsageBit

GFXType

Re-exports GFXType

GFXUniform

Re-exports GFXUniform

GFXUniformBlock

Re-exports GFXUniformBlock

GFXUniformSampler

Re-exports GFXUniformSampler

GFXViewport

Re-exports GFXViewport

GFX_DRAW_INFO_SIZE

Re-exports GFX_DRAW_INFO_SIZE

GFX_MAX_ATTACHMENTS

Re-exports GFX_MAX_ATTACHMENTS

GFX_MAX_BUFFER_BINDINGS

Re-exports GFX_MAX_BUFFER_BINDINGS

GFX_MAX_TEXTURE_UNITS

Re-exports GFX_MAX_TEXTURE_UNITS

GFX_MAX_VERTEX_ATTRIBUTES

Re-exports GFX_MAX_VERTEX_ATTRIBUTES

Game

Re-exports Game

HtmlTextParser

Re-exports HtmlTextParser

IAnimationEvent

Re-exports IAnimationEvent

IAnimationEventGroup

Re-exports IAnimationEventGroup

IAssetOptions

Re-exports IAssetOptions

IColorLike

Re-exports IColorLike

IComponentsCurveData

Re-exports IComponentsCurveData

IGFXAttribute

Re-exports IGFXAttribute

IGFXBufferInfo

Re-exports IGFXBufferInfo

IGFXBufferViewInfo

Re-exports IGFXBufferViewInfo

IGFXCommandBufferInfo

Re-exports IGFXCommandBufferInfo

IGFXDepthBias

Re-exports IGFXDepthBias

IGFXDepthBounds

Re-exports IGFXDepthBounds

IGFXDescriptorSetInfo

Re-exports IGFXDescriptorSetInfo

IGFXDescriptorSetLayoutBinding

Re-exports IGFXDescriptorSetLayoutBinding

IGFXDescriptorSetLayoutInfo

Re-exports IGFXDescriptorSetLayoutInfo

IGFXDeviceInfo

Re-exports IGFXDeviceInfo

IGFXFenceInfo

Re-exports IGFXFenceInfo

IGFXFramebufferInfo

Re-exports IGFXFramebufferInfo

IGFXIndirectBuffer

Re-exports IGFXIndirectBuffer

IGFXInputAssemblerInfo

Re-exports IGFXInputAssemblerInfo

IGFXPipelineLayoutInfo

Re-exports IGFXPipelineLayoutInfo

IGFXPipelineStateInfo

Re-exports IGFXPipelineStateInfo

IGFXQueueInfo

Re-exports IGFXQueueInfo

IGFXRenderPassInfo

Re-exports IGFXRenderPassInfo

IGFXSamplerInfo

Re-exports IGFXSamplerInfo

IGFXStencilCompareMask

Re-exports IGFXStencilCompareMask

IGFXStencilWriteMask

Re-exports IGFXStencilWriteMask

IGFXSubPassInfo

Re-exports IGFXSubPassInfo

IGFXTextureInfo

Re-exports IGFXTextureInfo

IGFXTextureViewInfo

Re-exports IGFXTextureViewInfo

IGameConfig

Re-exports IGameConfig

IHtmlTextParserResultObj

Re-exports IHtmlTextParserResultObj

IHtmlTextParserStack

Re-exports IHtmlTextParserStack

IItem

Re-exports IItem

IMat3Like

Re-exports IMat3Like

IMat4Like

Re-exports IMat4Like

INodeCurveData

Re-exports INodeCurveData

IObjectCurveData

Re-exports IObjectCurveData

IPropertyCurveData

Re-exports IPropertyCurveData

IQuatLike

Re-exports IQuatLike

IRectLike

Re-exports IRectLike

IRuntimeCurve

Re-exports IRuntimeCurve

ISchedulable

Re-exports ISchedulable

ISizeLike

Re-exports ISizeLike

IUV

Re-exports IUV

IVec2Like

Re-exports IVec2Like

IVec3Like

Re-exports IVec3Like

IVec4Like

Re-exports IVec4Like

ImageAsset

Re-exports ImageAsset

IsPowerOf2

Re-exports IsPowerOf2

JavaScript

Re-exports JavaScript

JsonAsset

Re-exports JsonAsset

LabelAtlas

Re-exports LabelAtlas

Layers

Re-exports Layers

Light

Re-exports Light

LightComponent

Renames and re-exports Light

Loader

Re-exports Loader

LoadingItems

Re-exports LoadingItems

Mat3

Re-exports Mat3

Mat4

Re-exports Mat4

Material

Re-exports Material

Mesh

Re-exports Mesh

MeshRenderer

Re-exports MeshRenderer

MissingScript

Re-exports MissingScript

ModelComponent

Renames and re-exports MeshRenderer

Node

Re-exports Node

NodeActivator

Re-exports NodeActivator

Pipeline

Re-exports Pipeline

Pool

Re-exports Pool

Prefab

Re-exports Prefab

PrefabInfo

Re-exports PrefabInfo

PrivateNode

Re-exports PrivateNode

Profiler

Re-exports Profiler

Quat

Re-exports Quat

RatioSampler

Re-exports RatioSampler

Rect

Re-exports Rect

RecyclePool

Re-exports RecyclePool

RenderFlow

Re-exports RenderFlow

RenderPipeline

Re-exports RenderPipeline

RenderStage

Re-exports RenderStage

RenderTexture

Re-exports RenderTexture

RenderView

Re-exports RenderView

RenderWindow

Re-exports RenderWindow

RenderableComponent

Re-exports RenderableComponent

RenderingSubMesh

Re-exports RenderingSubMesh

ResolutionPolicy

Re-exports ResolutionPolicy

Scene

Re-exports Scene

SceneAsset

Re-exports SceneAsset

Scheduler

Re-exports Scheduler

Script

Re-exports Script

ShadowFlow

Re-exports ShadowFlow

ShadowStage

Re-exports ShadowStage

Size

Re-exports Size

SkelAnimDataHub

Re-exports SkelAnimDataHub

SkeletalAnimation

Re-exports SkeletalAnimation

SkeletalAnimationComponent

Renames and re-exports SkeletalAnimation

SkeletalAnimationState

Re-exports SkeletalAnimationState

Skeleton

Re-exports Skeleton

SkinnedMeshBatchRenderer

Re-exports SkinnedMeshBatchRenderer

SkinnedMeshRenderer

Re-exports SkinnedMeshRenderer

SkinnedMeshUnit

Re-exports SkinnedMeshUnit

SkinningModelComponent

Renames and re-exports SkinnedMeshRenderer

SkinningModelUnit

Renames and re-exports SkinnedMeshUnit

Socket

Re-exports Socket

SphereLight

Re-exports SphereLight

SphereLightComponent

Renames and re-exports SphereLight

SpotLight

Re-exports SpotLight

SpotLightComponent

Renames and re-exports SpotLight

SpriteAtlas

Re-exports SpriteAtlas

SpriteFrame

Re-exports SpriteFrame

SubContextView

Re-exports SubContextView

SystemEvent

Re-exports SystemEvent

SystemEventType

Re-exports SystemEventType

TTFFont

Re-exports TTFFont

TextAsset

Re-exports TextAsset

Texture2D

Re-exports Texture2D

TextureCube

Re-exports TextureCube

Touch

Re-exports Touch

TypeScript

Re-exports TypeScript

UIFlow

Re-exports UIFlow

UIStage

Re-exports UIStage

ValueType

Re-exports ValueType

Vec2

Re-exports Vec2

Vec3

Re-exports Vec3

Vec4

Re-exports Vec4

View

Re-exports View

WorldNode3DToLocalNodeUI

Re-exports WorldNode3DToLocalNodeUI

WorldNode3DToWorldNodeUI

Re-exports WorldNode3DToWorldNodeUI

_decorator

Re-exports _decorator

absMax

Re-exports absMax

absMaxComponent

Re-exports absMaxComponent

approx

Re-exports approx

assert

Re-exports assert

assertID

Re-exports assertID

bezier

Re-exports bezier

bezierByTime

Re-exports bezierByTime

bits

Renames and re-exports math

builtinResMgr

Re-exports builtinResMgr

ccenum

Re-exports ccenum

clamp

Re-exports clamp

clamp01

Re-exports clamp01

color

Re-exports color

computeRatioByType

Re-exports computeRatioByType

convertUtils

Re-exports convertUtils

director

Re-exports director

easing

Re-exports easing

effects

Re-exports effects

equals

Re-exports equals

error

Re-exports error

errorID

Re-exports errorID

find

Re-exports find

fragmentText

Re-exports fragmentText

game

Re-exports game

getPathFromRoot

Re-exports getPathFromRoot

getTypedArrayConstructor

Re-exports getTypedArrayConstructor

getWorldTransformUntilRoot

Re-exports getWorldTransformUntilRoot

instantiate

Re-exports instantiate

inverseLerp

Re-exports inverseLerp

isDisplayStats

Re-exports isDisplayStats

isUnicodeCJK

Re-exports isUnicodeCJK

isUnicodeSpace

Re-exports isUnicodeSpace

isValid

Re-exports isValid

js

Re-exports js

lerp

Re-exports lerp

loader

Re-exports loader

log

Re-exports log

logID

Re-exports logID

macro

Re-exports macro

markAsWarning

Re-exports markAsWarning

mat4

Re-exports mat4

misc

Re-exports misc

murmurhash2_32_gc

Re-exports murmurhash2_32_gc

nextPow2

Re-exports nextPow2

path

Re-exports path

pingPong

Re-exports pingPong

pipeline

Re-exports pipeline

profiler

Re-exports profiler

pseudoRandom

Re-exports pseudoRandom

pseudoRandomRange

Re-exports pseudoRandomRange

pseudoRandomRangeInt

Re-exports pseudoRandomRangeInt

quat

Re-exports quat

random

Re-exports random

randomRange

Re-exports randomRange

randomRangeInt

Re-exports randomRangeInt

rect

Re-exports rect

removeProperty

Re-exports removeProperty

repeat

Re-exports repeat

replaceProperty

Re-exports replaceProperty

safeMeasureText

Re-exports safeMeasureText

sampleAnimationCurve

Re-exports sampleAnimationCurve

screen

Re-exports screen

setDefaultLogTimes

Re-exports setDefaultLogTimes

setDisplayStats

Re-exports setDisplayStats

size

Re-exports size

sys

Re-exports sys

systemEvent

Re-exports systemEvent

textureUtil

Re-exports textureUtil

toDegree

Re-exports toDegree

toRadian

Re-exports toRadian

url

Re-exports url

utils

Re-exports utils

v2

Re-exports v2

v3

Re-exports v3

v4

Re-exports v4

view

Re-exports view

warn

Re-exports warn

warnID

Re-exports warnID

Events

AdaptResult

AdaptResult:

!en Emit when design resolution changed. !zh 当设计分辨率改变时发送。

scale

scale: number[]

Optional viewport

viewport: null | Rect

Variables

Const ERROR_MAP_URL

ERROR_MAP_URL: "https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md" = "https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md"

Const MAX_POOL_SIZE

MAX_POOL_SIZE: 20 = 20

Const SUPPORT_TEXTURE_FORMATS

SUPPORT_TEXTURE_FORMATS: string[] = ['.astc', '.pkm', '.pvr', '.webp', '.jpg', '.jpeg', '.bmp', '.png']

Const __BrowserGetter

__BrowserGetter: BrowserGetter = new BrowserGetter()

Const _global

_global: any = typeof window === 'undefined' ? global : window

Const _global

_global: any = typeof window === 'undefined' ? global : window

Const assertFormatter

assertFormatter: (Anonymous function) = getTypedFormatter('Assert')

Let ccError

ccError: log = console.log

Let ccLog

ccLog: log = console.log

Let ccWarn

ccWarn: log = console.log

Const director

director: Director = Director.instance = legacyCC.director = new Director()

导演类。

Const engineVersion

engineVersion: "1.2.0" = "1.2.0"

Const errorFormatter

errorFormatter: (Anonymous function) = getTypedFormatter('Error')

Const game

game: Game = legacyCC.game = new Game()

Const idGenerator

idGenerator: IDGenerator = new IdGenerator('Scheduler')

Const logFormatter

logFormatter: (Anonymous function) = getTypedFormatter('Log')

Let logList

logList: HTMLTextAreaElement | null = null

Const view

view: View = View.instance = legacyCC.view = new View()
en

view is the singleton view object.

zh

view 是全局的视图单例对象。

Const warnFormatter

warnFormatter: (Anonymous function) = getTypedFormatter('Warning')

Functions

resetDebugSetting

throw

  • throw(error_: any): void

assert

  • assert(value: any, message?: undefined | string, ...optionalParams: any[]): void
  • Assert the condition and output error messages if the condition is not true.

    Parameters

    • value: any

      The condition to check on

    • Optional message: undefined | string

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

assertID

  • assertID(condition: any, id: number, ...optionalParams: any[]): void

Let ccAssert

  • ccAssert(condition: any, message?: any, ...optionalParams: any[]): void

error

  • error(message?: any, ...optionalParams: any[]): void
  • Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).

    • In Cocos Creator, error is red.
    • In Chrome, error have a red icon along with red message text.

    Parameters

    • Optional message: any

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

errorID

  • errorID(id: number, ...optionalParams: any[]): void

formatString

  • formatString(message?: any, ...optionalParams: any[]): any

getError

  • getError(errorId: any, ...param: any[]): string
  • Gets error message with the error id and possible parameters.

    Parameters

    • errorId: any
    • Rest ...param: any[]

    Returns string

getTypedFormatter

  • getTypedFormatter(type: "Log" | "Warning" | "Error" | "Assert"): (Anonymous function)

isDisplayStats

  • isDisplayStats(): boolean

log

  • log(message?: any, ...optionalParams: any[]): void
  • Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).

    Parameters

    • Optional message: any

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

logID

  • logID(id: number, ...optionalParams: any[]): void

setDisplayStats

  • setDisplayStats(displayStats: boolean): void
  • Sets whether display the FPS and debug informations on the bottom-left corner.

    Parameters

    • displayStats: boolean

    Returns void

warn

  • warn(message?: any, ...optionalParams: any[]): void
  • Outputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).

    • In Cocos Creator, warning is yellow.
    • In Chrome, warning have a yellow warning icon with the message text.

    Parameters

    • Optional message: any

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

warnID

  • warnID(id: number, ...optionalParams: any[]): void

Object literals

Const KEY

KEY: object

*

*: number = 106
en

The numeric keypad '*'

zh

数字键盘 *

readonly

+

+: number = 107
en

The numeric keypad '+'

zh

数字键盘 +

readonly

,

,: number = 188
en

The ',' key.

zh

逗号键

readonly

-

-: number = 109
en

The numeric keypad '-'

zh

数字键盘 -

readonly

.

.: number = 190
en

The '.' key.

zh

句号键

readonly

/

/: number = 111
en

The numeric keypad '/'

zh

数字键盘 /

readonly

0

0: number = 48
en

The '0' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 0 键

readonly

1

1: number = 49
en

The '1' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 1 键

readonly

2

2: number = 50
en

The '2' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 2 键

readonly

3

3: number = 51
en

The '3' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 3 键

readonly

4

4: number = 52
en

The '4' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 4 键

readonly

5

5: number = 53
en

The '5' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 5 键

readonly

6

6: number = 54
en

The '6' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 6 键

readonly

7

7: number = 55
en

The '7' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 7 键

readonly

8

8: number = 56
en

The '8' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 8 键

readonly

9

9: number = 57
en

The '9' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 9 键

readonly

;

;: number = 186
en

The ';' key.

zh

分号键

readonly

=

=: number = 187
en

The '=' key.

zh

等于号键

readonly

Delete

Delete: number = 46
en

The Delete key

zh

删除键

readonly

[

[: number = 219
en

The '[' key

zh

按键 [

readonly

]

]: number = 221
en

The ']' key

zh

按键 ]

readonly

a

a: number = 65
en

The a key

zh

A 键

readonly

alt

alt: number = 18
en

The alt key

zh

Alt 键

readonly

b

b: number = 66
en

The b key

zh

B 键

readonly

back

back: number = 6
en

The back key

zh

返回键

readonly

backslash

backslash: number = 220
en

The '' key

zh

反斜杠键

readonly

backspace

backspace: number = 8
en

The backspace key

zh

退格键

readonly

c

c: number = 67
en

The c key

zh

C 键

readonly

capslock

capslock: number = 20
en

The caps lock key

zh

大写锁定键

readonly

closebracket

closebracket: number = 221
en

The ']' key

zh

按键 ]

readonly

comma

comma: number = 188
en

The ',' key.

zh

逗号键

readonly

ctrl

ctrl: number = 17
en

The ctrl key

zh

Ctrl 键

readonly

d

d: number = 68
en

The d key

zh

D 键

readonly

dash

dash: number = 189
en

The dash '-' key.

zh

中划线键

readonly

down

down: number = 40
en

The down key

zh

向下箭头键

readonly

dpadCenter

dpadCenter: number = 1005
en

The dpad center key

zh

导航键 确定键

readonly

dpadDown

dpadDown: number = 1004
en

The dpad down key

zh

导航键 向下

readonly

dpadLeft

dpadLeft: number = 1000
en

The dpad left key

zh

导航键 向左

readonly

dpadRight

dpadRight: number = 1001
en

The dpad right key

zh

导航键 向右

readonly

dpadUp

dpadUp: number = 1003
en

The dpad up key

zh

导航键 向上

readonly

e

e: number = 69
en

The e key

zh

E 键

readonly

end

end: number = 35
en

The end key

zh

结束键

readonly

enter

enter: number = 13
en

The enter key

zh

回车键

readonly

equal

equal: number = 187
en

The '=' key.

zh

等于号键

readonly

escape

escape: number = 27
en

The esc key

zh

ESC 键

readonly

f

f: number = 70
en

The f key

zh

F 键

readonly

f1

f1: number = 112
en

The F1 function key

zh

F1 功能键

readonly

f10

f10: number = 121
en

The F10 function key

zh

F10 功能键

readonly

f11

f11: number = 122
en

The F11 function key

zh

F11 功能键

readonly

f12

f12: number = 123
en

The F12 function key

zh

F12 功能键

readonly

f2

f2: number = 113
en

The F2 function key

zh

F2 功能键

readonly

f3

f3: number = 114
en

The F3 function key

zh

F3 功能键

readonly

f4

f4: number = 115
en

The F4 function key

zh

F4 功能键

readonly

f5

f5: number = 116
en

The F5 function key

zh

F5 功能键

readonly

f6

f6: number = 117
en

The F6 function key

zh

F6 功能键

readonly

f7

f7: number = 118
en

The F7 function key

zh

F7 功能键

readonly

f8

f8: number = 119
en

The F8 function key

zh

F8 功能键

readonly

f9

f9: number = 120
en

The F9 function key

zh

F9 功能键

readonly

forwardslash

forwardslash: number = 191
en

The forward slash key

zh

正斜杠键

readonly

g

g: number = 71
en

The g key

zh

G 键

readonly

grave

grave: number = 192
en

The grave key

zh

按键 `

readonly

h

h: number = 72
en

The h key

zh

H 键

readonly

home

home: number = 36
en

The home key

zh

主菜单键

readonly

i

i: number = 73
en

The i key

zh

I 键

readonly

insert

insert: number = 45
en

The insert key

zh

插入键

readonly

j

j: number = 74
en

The j key

zh

J 键

readonly

k

k: number = 75
en

The k key

zh

K 键

readonly

l

l: number = 76
en

The l key

zh

L 键

readonly

left

left: number = 37
en

The left key

zh

向左箭头键

readonly

m

m: number = 77
en

The m key

zh

M 键

readonly

menu

menu: number = 18
en

The menu key

zh

菜单键

readonly

n

n: number = 78
en

The n key

zh

N 键

readonly

none

none: number = 0
en

None

zh

没有分配

readonly

num0

num0: number = 96
en

The numeric keypad 0

zh

数字键盘 0

readonly

num1

num1: number = 97
en

The numeric keypad 1

zh

数字键盘 1

readonly

num2

num2: number = 98
en

The numeric keypad 2

zh

数字键盘 2

readonly

num3

num3: number = 99
en

The numeric keypad 3

zh

数字键盘 3

readonly

num4

num4: number = 100
en

The numeric keypad 4

zh

数字键盘 4

readonly

num5

num5: number = 101
en

The numeric keypad 5

zh

数字键盘 5

readonly

num6

num6: number = 102
en

The numeric keypad 6

zh

数字键盘 6

readonly

num7

num7: number = 103
en

The numeric keypad 7

zh

数字键盘 7

readonly

num8

num8: number = 104
en

The numeric keypad 8

zh

数字键盘 8

readonly

num9

num9: number = 105
en

The numeric keypad 9

zh

数字键盘 9

readonly

numdel

numdel: number = 110
en

The numeric keypad 'delete'

zh

数字键盘删除键

readonly

numlock

numlock: number = 144
en

The numlock key

zh

数字锁定键

readonly

o

o: number = 79
en

The o key

zh

O 键

readonly

openbracket

openbracket: number = 219
en

The '[' key

zh

按键 [

readonly

p

p: number = 80
en

The p key

zh

P 键

readonly

pagedown

pagedown: number = 34
en

The page down key

zh

向下翻页键

readonly

pageup

pageup: number = 33
en

The page up key

zh

向上翻页键

readonly

pause

pause: number = 19
en

The pause key

zh

暂停键

readonly

period

period: number = 190
en

The '.' key

zh

句号键

readonly

q

q: number = 81
en

The q key

zh

Q 键

readonly

quote

quote: number = 222
en

The quote key

zh

单引号键

readonly

r

r: number = 82
en

The r key

zh

R 键

readonly

right

right: number = 39
en

The right key

zh

向右箭头键

readonly

s

s: number = 83
en

The s key

zh

S 键

readonly

scrolllock

scrolllock: number = 145
en

The scroll lock key

zh

滚动锁定键

readonly

select

select: number = 41
en

The select key

zh

Select 键

readonly

semicolon

semicolon: number = 186
en

The ';' key.

zh

分号键

readonly

shift

shift: number = 16
en

The shift key

zh

Shift 键

readonly

space

space: number = 32
en

The space key

zh

空格键

readonly

t

t: number = 84
en

The t key

zh

T 键

readonly

tab

tab: number = 9
en

The tab key

zh

Tab 键

readonly

u

u: number = 85
en

The u key

zh

U 键

readonly

up

up: number = 38
en

The up key

zh

向上箭头键

readonly

v

v: number = 86
en

The v key

zh

V 键

readonly

w

w: number = 87
en

The w key

zh

W 键

readonly

x

x: number = 88
en

The x key

zh

X 键

readonly

y

y: number = 89
en

The y key

zh

Y 键

readonly

z

z: number = 90
en

The z key

zh

Z 键

readonly

Const legacyCC

legacyCC: object
en

The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.

zh

Cocos 引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。

deprecated

_global

_global: any

Const macro

macro: object
en

Predefined constants

zh

预定义常量。

CLEANUP_IMAGE_CACHE

CLEANUP_IMAGE_CACHE: boolean = false
en

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. Currently not useful in 3D engine

zh

是否在将贴图上传至 GPU 之后删除 DOM Image 缓存。 具体来说,我们通过设置 image.src 为空字符串来释放这部分内存。 正常情况下,你不需要开启这个选项,因为在 web 平台,Image 对象所占用的内存很小。 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 在 3D 引擎中暂时无效。

default

false

DEG

DEG: number = 180 / Math.PI

One degree

DOWNLOAD_MAX_CONCURRENT

DOWNLOAD_MAX_CONCURRENT: number = 64
en

The max concurrent task number for the downloader

zh

下载任务的最大并发数限制,在安卓平台部分机型或版本上可能需要限制在较低的水平

default

64

ENABLE_MULTI_TOUCH

ENABLE_MULTI_TOUCH: boolean = true
en

Whether to enable multi-touch.

zh

是否开启多点触摸

default

true

ENABLE_TILEDMAP_CULLING

ENABLE_TILEDMAP_CULLING: boolean = true
en

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. Currently not useful in 3D engine

zh

是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 的话,需要手动关闭,否则渲染会出错。 在 3D 引擎中暂时无效。

default

true

ENABLE_TRANSPARENT_CANVAS

ENABLE_TRANSPARENT_CANVAS: boolean = false
en

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 {{game.init}}. Web only.

zh

用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 {{game.init}} 之前将这个值设为 true。 仅支持 Web

default

false

ENABLE_WEBGL_ANTIALIAS

ENABLE_WEBGL_ANTIALIAS: boolean = false
en

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 {{game.init}}. Web only.

zh

用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。 你可以在 {{game.init}} 之前设置这个值,否则它不会生效。 仅支持 Web

default

false

FLT_EPSILON

FLT_EPSILON: number = 1.192092896e-7

A minimal float value

KEY

KEY: { *: number; +: number; ,: number; -: number; .: number; /: number; 0: number; 1: number; 2: number; 3: number; 4: number; 5: number; 6: number; 7: number; 8: number; 9: number; ;: number; =: number; Delete: number; [: number; ]: number; a: number; alt: number; b: number; back: number; backslash: number; backspace: number; c: number; capslock: number; closebracket: number; comma: number; ctrl: number; d: number; dash: number; down: number; dpadCenter: number; dpadDown: number; dpadLeft: number; dpadRight: number; dpadUp: number; e: number; end: number; enter: number; equal: number; escape: number; f: number; f1: number; f10: number; f11: number; f12: number; f2: number; f3: number; f4: number; f5: number; f6: number; f7: number; f8: number; f9: number; forwardslash: number; g: number; grave: number; h: number; home: number; i: number; insert: number; j: number; k: number; l: number; left: number; m: number; menu: number; n: number; none: number; num0: number; num1: number; num2: number; num3: number; num4: number; num5: number; num6: number; num7: number; num8: number; num9: number; numdel: number; numlock: number; o: number; openbracket: number; p: number; pagedown: number; pageup: number; pause: number; period: number; q: number; quote: number; r: number; right: number; s: number; scrolllock: number; select: number; semicolon: number; shift: number; space: number; t: number; tab: number; u: number; up: number; v: number; w: number; x: number; y: number; z: number }
en

Key map for keyboard event

zh

键盘事件的按键值。

example

{@link cocos/core/platform/CCCommon/KEY.js}

Type declaration

  • *: number
    en

    The numeric keypad '*'

    zh

    数字键盘 *

    readonly
  • +: number
    en

    The numeric keypad '+'

    zh

    数字键盘 +

    readonly
  • ,: number
    en

    The ',' key.

    zh

    逗号键

    readonly
  • -: number
    en

    The numeric keypad '-'

    zh

    数字键盘 -

    readonly
  • .: number
    en

    The '.' key.

    zh

    句号键

    readonly
  • /: number
    en

    The numeric keypad '/'

    zh

    数字键盘 /

    readonly
  • 0: number
    en

    The '0' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 0 键

    readonly
  • 1: number
    en

    The '1' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 1 键

    readonly
  • 2: number
    en

    The '2' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 2 键

    readonly
  • 3: number
    en

    The '3' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 3 键

    readonly
  • 4: number
    en

    The '4' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 4 键

    readonly
  • 5: number
    en

    The '5' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 5 键

    readonly
  • 6: number
    en

    The '6' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 6 键

    readonly
  • 7: number
    en

    The '7' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 7 键

    readonly
  • 8: number
    en

    The '8' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 8 键

    readonly
  • 9: number
    en

    The '9' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 9 键

    readonly
  • ;: number
    en

    The ';' key.

    zh

    分号键

    readonly
  • =: number
    en

    The '=' key.

    zh

    等于号键

    readonly
  • Delete: number
    en

    The Delete key

    zh

    删除键

    readonly
  • [: number
    en

    The '[' key

    zh

    按键 [

    readonly
  • ]: number
    en

    The ']' key

    zh

    按键 ]

    readonly
  • a: number
    en

    The a key

    zh

    A 键

    readonly
  • alt: number
    en

    The alt key

    zh

    Alt 键

    readonly
  • b: number
    en

    The b key

    zh

    B 键

    readonly
  • back: number
    en

    The back key

    zh

    返回键

    readonly
  • backslash: number
    en

    The '' key

    zh

    反斜杠键

    readonly
  • backspace: number
    en

    The backspace key

    zh

    退格键

    readonly
  • c: number
    en

    The c key

    zh

    C 键

    readonly
  • capslock: number
    en

    The caps lock key

    zh

    大写锁定键

    readonly
  • closebracket: number
    en

    The ']' key

    zh

    按键 ]

    readonly
  • comma: number
    en

    The ',' key.

    zh

    逗号键

    readonly
  • ctrl: number
    en

    The ctrl key

    zh

    Ctrl 键

    readonly
  • d: number
    en

    The d key

    zh

    D 键

    readonly
  • dash: number
    en

    The dash '-' key.

    zh

    中划线键

    readonly
  • down: number
    en

    The down key

    zh

    向下箭头键

    readonly
  • dpadCenter: number
    en

    The dpad center key

    zh

    导航键 确定键

    readonly
  • dpadDown: number
    en

    The dpad down key

    zh

    导航键 向下

    readonly
  • dpadLeft: number
    en

    The dpad left key

    zh

    导航键 向左

    readonly
  • dpadRight: number
    en

    The dpad right key

    zh

    导航键 向右

    readonly
  • dpadUp: number
    en

    The dpad up key

    zh

    导航键 向上

    readonly
  • e: number
    en

    The e key

    zh

    E 键

    readonly
  • end: number
    en

    The end key

    zh

    结束键

    readonly
  • enter: number
    en

    The enter key

    zh

    回车键

    readonly
  • equal: number
    en

    The '=' key.

    zh

    等于号键

    readonly
  • escape: number
    en

    The esc key

    zh

    ESC 键

    readonly
  • f: number
    en

    The f key

    zh

    F 键

    readonly
  • f1: number
    en

    The F1 function key

    zh

    F1 功能键

    readonly
  • f10: number
    en

    The F10 function key

    zh

    F10 功能键

    readonly
  • f11: number
    en

    The F11 function key

    zh

    F11 功能键

    readonly
  • f12: number
    en

    The F12 function key

    zh

    F12 功能键

    readonly
  • f2: number
    en

    The F2 function key

    zh

    F2 功能键

    readonly
  • f3: number
    en

    The F3 function key

    zh

    F3 功能键

    readonly
  • f4: number
    en

    The F4 function key

    zh

    F4 功能键

    readonly
  • f5: number
    en

    The F5 function key

    zh

    F5 功能键

    readonly
  • f6: number
    en

    The F6 function key

    zh

    F6 功能键

    readonly
  • f7: number
    en

    The F7 function key

    zh

    F7 功能键

    readonly
  • f8: number
    en

    The F8 function key

    zh

    F8 功能键

    readonly
  • f9: number
    en

    The F9 function key

    zh

    F9 功能键

    readonly
  • forwardslash: number
    en

    The forward slash key

    zh

    正斜杠键

    readonly
  • g: number
    en

    The g key

    zh

    G 键

    readonly
  • grave: number
    en

    The grave key

    zh

    按键 `

    readonly
  • h: number
    en

    The h key

    zh

    H 键

    readonly
  • home: number
    en

    The home key

    zh

    主菜单键

    readonly
  • i: number
    en

    The i key

    zh

    I 键

    readonly
  • insert: number
    en

    The insert key

    zh

    插入键

    readonly
  • j: number
    en

    The j key

    zh

    J 键

    readonly
  • k: number
    en

    The k key

    zh

    K 键

    readonly
  • l: number
    en

    The l key

    zh

    L 键

    readonly
  • left: number
    en

    The left key

    zh

    向左箭头键

    readonly
  • m: number
    en

    The m key

    zh

    M 键

    readonly
  • menu: number
    en

    The menu key

    zh

    菜单键

    readonly
  • n: number
    en

    The n key

    zh

    N 键

    readonly
  • none: number
    en

    None

    zh

    没有分配

    readonly
  • num0: number
    en

    The numeric keypad 0

    zh

    数字键盘 0

    readonly
  • num1: number
    en

    The numeric keypad 1

    zh

    数字键盘 1

    readonly
  • num2: number
    en

    The numeric keypad 2

    zh

    数字键盘 2

    readonly
  • num3: number
    en

    The numeric keypad 3

    zh

    数字键盘 3

    readonly
  • num4: number
    en

    The numeric keypad 4

    zh

    数字键盘 4

    readonly
  • num5: number
    en

    The numeric keypad 5

    zh

    数字键盘 5

    readonly
  • num6: number
    en

    The numeric keypad 6

    zh

    数字键盘 6

    readonly
  • num7: number
    en

    The numeric keypad 7

    zh

    数字键盘 7

    readonly
  • num8: number
    en

    The numeric keypad 8

    zh

    数字键盘 8

    readonly
  • num9: number
    en

    The numeric keypad 9

    zh

    数字键盘 9

    readonly
  • numdel: number
    en

    The numeric keypad 'delete'

    zh

    数字键盘删除键

    readonly
  • numlock: number
    en

    The numlock key

    zh

    数字锁定键

    readonly
  • o: number
    en

    The o key

    zh

    O 键

    readonly
  • openbracket: number
    en

    The '[' key

    zh

    按键 [

    readonly
  • p: number
    en

    The p key

    zh

    P 键

    readonly
  • pagedown: number
    en

    The page down key

    zh

    向下翻页键

    readonly
  • pageup: number
    en

    The page up key

    zh

    向上翻页键

    readonly
  • pause: number
    en

    The pause key

    zh

    暂停键

    readonly
  • period: number
    en

    The '.' key

    zh

    句号键

    readonly
  • q: number
    en

    The q key

    zh

    Q 键

    readonly
  • quote: number
    en

    The quote key

    zh

    单引号键

    readonly
  • r: number
    en

    The r key

    zh

    R 键

    readonly
  • right: number
    en

    The right key

    zh

    向右箭头键

    readonly
  • s: number
    en

    The s key

    zh

    S 键

    readonly
  • scrolllock: number
    en

    The scroll lock key

    zh

    滚动锁定键

    readonly
  • select: number
    en

    The select key

    zh

    Select 键

    readonly
  • semicolon: number
    en

    The ';' key.

    zh

    分号键

    readonly
  • shift: number
    en

    The shift key

    zh

    Shift 键

    readonly
  • space: number
    en

    The space key

    zh

    空格键

    readonly
  • t: number
    en

    The t key

    zh

    T 键

    readonly
  • tab: number
    en

    The tab key

    zh

    Tab 键

    readonly
  • u: number
    en

    The u key

    zh

    U 键

    readonly
  • up: number
    en

    The up key

    zh

    向上箭头键

    readonly
  • v: number
    en

    The v key

    zh

    V 键

    readonly
  • w: number
    en

    The w key

    zh

    W 键

    readonly
  • x: number
    en

    The x key

    zh

    X 键

    readonly
  • y: number
    en

    The y key

    zh

    Y 键

    readonly
  • z: number
    en

    The z key

    zh

    Z 键

    readonly

ORIENTATION_AUTO

ORIENTATION_AUTO: number = 3
en

Oriented automatically

zh

自动适配朝向

ORIENTATION_LANDSCAPE

ORIENTATION_LANDSCAPE: number = 2
en

Oriented horizontally

zh

横屏朝向

ORIENTATION_PORTRAIT

ORIENTATION_PORTRAIT: number = 1
en

Oriented vertically

zh

竖屏朝向

RAD

RAD: number = Math.PI / 180

PI / 180

REPEAT_FOREVER

REPEAT_FOREVER: number = (Number.MAX_VALUE - 1)

A maximum value of number

SUPPORT_TEXTURE_FORMATS

SUPPORT_TEXTURE_FORMATS: string[]
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'], ios mobile platform

zh

引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. The iOS mobile platform also supports the PVR format。

TOUCH_TIMEOUT

TOUCH_TIMEOUT: number = 5000
en

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.

zh

用于甄别一个触点对象是否已经失效并且可以被移除的延时时长 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。

default

5000

Const screen

screen: object
en

The screen API provides an easy way for web content to be presented using the user's entire screen. It's designed for web platforms and some mobile browsers don't provide such behavior, e.g. Safari

zh

screen 单例对象提供简单的方法来尝试让 Web 内容进入全屏模式。这是 Web 平台特有的行为,在部分浏览器上并不支持这样的功能。

_fn

_fn: any = null as any

_fnMap

_fnMap: string[][] = [['requestFullscreen','exitFullscreen','fullscreenchange','fullscreenEnabled','fullscreenElement',],['requestFullScreen','exitFullScreen','fullScreenchange','fullScreenEnabled','fullScreenElement',],['webkitRequestFullScreen','webkitCancelFullScreen','webkitfullscreenchange','webkitIsFullScreen','webkitCurrentFullScreenElement',],['mozRequestFullScreen','mozCancelFullScreen','mozfullscreenchange','mozFullScreen','mozFullScreenElement',],['msRequestFullscreen','msExitFullscreen','MSFullscreenChange','msFullscreenEnabled','msFullscreenElement',],]

_preOnFullScreenChange

_preOnFullScreenChange: any = null as any

_supportsFullScreen

_supportsFullScreen: boolean = false

_touchEvent

_touchEvent: string = ""

autoFullScreen

  • autoFullScreen(element: HTMLElement, onFullScreenChange: (this: Document, ev: any) => any): void
  • Automatically request full screen during the next touch/click event

    Parameters

    • element: HTMLElement

      The element to request full screen state

    • onFullScreenChange: (this: Document, ev: any) => any

      callback function when full screen state changed

        • (this: Document, ev: any): any
        • Parameters

          • this: Document
          • ev: any

          Returns any

    Returns void

exitFullScreen

  • exitFullScreen(): boolean

fullScreen

  • fullScreen(): boolean

init

  • init(): void

requestFullScreen

  • requestFullScreen(element: HTMLElement, onFullScreenChange: (this: Document, ev: any) => any): any
  • Request to enter full screen mode with the given element. Many browser forbid to enter full screen mode without an user intended interaction. For simplify the process, you can try to use {{autoFullScreen}} which will try to enter full screen mode during the next user touch event.

    Parameters

    • element: HTMLElement

      The element to request full screen state

    • onFullScreenChange: (this: Document, ev: any) => any

      callback function when full screen state changed

        • (this: Document, ev: any): any
        • Parameters

          • this: Document
          • ev: any

          Returns any

    Returns any

Const sys

sys: object
en

A set of system related variables

zh

一系列系统相关环境变量

main

ANDROID

ANDROID: number = 3
en

Platform - Android native app

zh

平台 - 安卓原生平台

default

3

BLACKBERRY

BLACKBERRY: number = 6
en

Platform - Blackberry devices

zh

平台 - 黑莓设备

default

6

BROWSER_TYPE_360

BROWSER_TYPE_360: string = "360browser"
en

Browser Type - 360 Browser

zh

浏览器类型 - 360 浏览器

default

"360browser"

BROWSER_TYPE_ANDROID

BROWSER_TYPE_ANDROID: string = "androidbrowser"
en

Browser Type - Android Browser

zh

浏览器类型 - 安卓浏览器

default

"androidbrowser"

BROWSER_TYPE_BAIDU

BROWSER_TYPE_BAIDU: string = "baidubrowser"
en

Browser Type - Baidu Browser

zh

浏览器类型 - 百度浏览器

default

"baidubrowser"

BROWSER_TYPE_BAIDU_APP

BROWSER_TYPE_BAIDU_APP: string = "baiduboxapp"
en

Browser Type - Baidu Box App

zh

浏览器类型 - Baidu Box App

default

"baiduboxapp"

BROWSER_TYPE_CHROME

BROWSER_TYPE_CHROME: string = "chrome"
en

Browser Type - Chrome Browser

zh

浏览器类型 - Chrome 浏览器

default

"chrome"

BROWSER_TYPE_COCOSPLAY

BROWSER_TYPE_COCOSPLAY: string = "cocosplay"
en

Browser Type - Cocos Play Game

zh

浏览器类型 - Cocos Play 游戏

default

"cocosplay"

BROWSER_TYPE_EDGE

BROWSER_TYPE_EDGE: string = "edge"
en

Browser Type - Microsoft Edge

zh

浏览器类型 - 微软 Edge

default

"edge"

BROWSER_TYPE_FIREFOX

BROWSER_TYPE_FIREFOX: string = "firefox"
en

Browser Type - Firefox Browser

zh

浏览器类型 - Firefox 浏览器

default

"firefox"

BROWSER_TYPE_HUAWEI_GAME

BROWSER_TYPE_HUAWEI_GAME: string = "huaweiquickgame"
en

Browser Type - huawei quick Game

zh

浏览器类型 - 华为快游戏

default

"huaweiquickgame"

BROWSER_TYPE_IE

BROWSER_TYPE_IE: string = "ie"
en

Browser Type - Internet Explorer

zh

浏览器类型 - 微软 IE

default

"ie"

BROWSER_TYPE_LIEBAO

BROWSER_TYPE_LIEBAO: string = "liebao"
en

Browser Type - Cheetah Browser

zh

浏览器类型 - 猎豹浏览器

default

"liebao"

BROWSER_TYPE_MAXTHON

BROWSER_TYPE_MAXTHON: string = "maxthon"
en

Browser Type - Maxthon Browser

zh

浏览器类型 - 傲游浏览器

default

"maxthon"

BROWSER_TYPE_MIUI

BROWSER_TYPE_MIUI: string = "miuibrowser"
en

Browser Type - MI UI Browser

zh

浏览器类型 - MIUI 内置浏览器

default

"miuibrowser"

BROWSER_TYPE_MOBILE_QQ

BROWSER_TYPE_MOBILE_QQ: string = "mqqbrowser"
en

Browser Type - Mobile QQ Browser

zh

浏览器类型 - 手机 QQ 浏览器

default

"mqqbrowser"

BROWSER_TYPE_OPERA

BROWSER_TYPE_OPERA: string = "opera"
en

Browser Type - Opera Browser

zh

浏览器类型 - Opera 浏览器

default

"opera"

BROWSER_TYPE_OPPO_GAME

BROWSER_TYPE_OPPO_GAME: string = "oppogame"
en

Browser Type - OPPO mini Game

zh

浏览器类型 - OPPO小游戏

default

"oppogame"

BROWSER_TYPE_OUPENG

BROWSER_TYPE_OUPENG: string = "oupeng"
en

Browser Type - Oupeng Browser

zh

浏览器类型 - 欧朋浏览器

default

"oupeng"

BROWSER_TYPE_QQ

BROWSER_TYPE_QQ: string = "qqbrowser"
en

Browser Type - QQ Browser

zh

浏览器类型 - QQ 浏览器

default

"qqbrowser"

BROWSER_TYPE_QZONE

BROWSER_TYPE_QZONE: string = "qzone"
en

Browser Type - QZone Inner Browser

zh

浏览器类型 - QZone 内置浏览器

default

"qzone"

BROWSER_TYPE_SAFARI

BROWSER_TYPE_SAFARI: string = "safari"
en

Browser Type - Safari Browser

zh

浏览器类型 - Safari 浏览器

default

"safari"

BROWSER_TYPE_SOUGOU

BROWSER_TYPE_SOUGOU: string = "sogou"
en

Browser Type - Sogou Browser

zh

浏览器类型 - 搜狗浏览器

default

"sogou"

BROWSER_TYPE_UC

BROWSER_TYPE_UC: string = "ucbrowser"
en

Browser Type - UC Browser

zh

浏览器类型 - UC 浏览器

default

"ucbrowser"

BROWSER_TYPE_UCBS

BROWSER_TYPE_UCBS: string = "ucbs"
en

Browser Type - Third party integrated UC browser

zh

浏览器类型 - 第三方应用中集成的 UC 浏览器

default

"ucbs"

BROWSER_TYPE_UNKNOWN

BROWSER_TYPE_UNKNOWN: string = "unknown"
en

Browser Type - Unknown

zh

浏览器类型 - 未知

default

"unknown"

BROWSER_TYPE_VIVO_GAME

BROWSER_TYPE_VIVO_GAME: string = "vivogame"
en

Browser Type - vivo mini Game

zh

浏览器类型 - vivo小游戏

default

"vivogame"

BROWSER_TYPE_WECHAT

BROWSER_TYPE_WECHAT: string = "wechat"
en

Browser Type - WeChat inner browser

zh

浏览器类型 - 微信内置浏览器

default

"wechat"

DESKTOP_BROWSER

DESKTOP_BROWSER: number = 101
en

Platform - Desktop browsers

zh

平台 - 桌面端浏览器

default

101

EDITOR_CORE

EDITOR_CORE: number = 103
en

Platform - Editor's main process

zh

平台 - 编辑器主进程

default

103

EDITOR_PAGE

EDITOR_PAGE: number = 102
en

Platform - Editor's window process

zh

平台 - 编辑器窗口进程

default

102

EMSCRIPTEN

EMSCRIPTEN: number = 8
en

Platform - Emscripten compiled runtime

zh

平台 - 编译为 Emscripten 的运行时环境

default

8

IPAD

IPAD: number = 5
en

Platform - iPad native app

zh

平台 - iPad 原生平台

default

5

IPHONE

IPHONE: number = 4
en

Platform - iPhone native app

zh

平台 - iPhone 原生平台

default

4

LANGUAGE_ARABIC

LANGUAGE_ARABIC: string = "ar"
en

Arabic language code

zh

语言代码 - 阿拉伯语

LANGUAGE_BULGARIAN

LANGUAGE_BULGARIAN: string = "bg"
en

Bulgarian language code

zh

语言代码 - 保加利亚语

LANGUAGE_CHINESE

LANGUAGE_CHINESE: string = "zh"
en

Chinese language code

zh

语言代码 - 中文

LANGUAGE_DUTCH

LANGUAGE_DUTCH: string = "du"
en

Spanish language code

zh

语言代码 - 荷兰语

LANGUAGE_ENGLISH

LANGUAGE_ENGLISH: string = "en"
en

English language code

zh

语言代码 - 英语

LANGUAGE_FRENCH

LANGUAGE_FRENCH: string = "fr"
en

French language code

zh

语言代码 - 法语

LANGUAGE_GERMAN

LANGUAGE_GERMAN: string = "de"
en

German language code

zh

语言代码 - 德语

LANGUAGE_HUNGARIAN

LANGUAGE_HUNGARIAN: string = "hu"
en

Hungarian language code

zh

语言代码 - 匈牙利语

LANGUAGE_ITALIAN

LANGUAGE_ITALIAN: string = "it"
en

Italian language code

zh

语言代码 - 意大利语

LANGUAGE_JAPANESE

LANGUAGE_JAPANESE: string = "ja"
en

Japanese language code

zh

语言代码 - 日语

LANGUAGE_KOREAN

LANGUAGE_KOREAN: string = "ko"
en

Korean language code

zh

语言代码 - 韩语

LANGUAGE_NORWEGIAN

LANGUAGE_NORWEGIAN: string = "no"
en

Norwegian language code

zh

语言代码 - 挪威语

LANGUAGE_POLISH

LANGUAGE_POLISH: string = "pl"
en

Polish language code

zh

语言代码 - 波兰语

LANGUAGE_PORTUGUESE

LANGUAGE_PORTUGUESE: string = "pt"
en

Portuguese language code

zh

语言代码 - 葡萄牙语

LANGUAGE_ROMANIAN

LANGUAGE_ROMANIAN: string = "ro"
en

Romanian language code

zh

语言代码 - 罗马尼亚语

LANGUAGE_RUSSIAN

LANGUAGE_RUSSIAN: string = "ru"
en

Russian language code

zh

语言代码 - 俄罗斯语

LANGUAGE_SPANISH

LANGUAGE_SPANISH: string = "es"
en

Spanish language code

zh

语言代码 - 西班牙语

LANGUAGE_TURKISH

LANGUAGE_TURKISH: string = "tr"
en

Turkish language code

zh

语言代码 - 土耳其语

LANGUAGE_UKRAINIAN

LANGUAGE_UKRAINIAN: string = "uk"
en

Ukrainian language code

zh

语言代码 - 乌克兰语

LANGUAGE_UNKNOWN

LANGUAGE_UNKNOWN: string = "unknown"
en

Unknown language code

zh

语言代码 - 未知

LINUX

LINUX: number = 1
en

Platform - Linux

zh

平台 - Linux

default

1

MACOS

MACOS: number = 2
en

Platform - Mac OS X app

zh

平台 - Mac OS X 原生平台

default

2

MOBILE_BROWSER

MOBILE_BROWSER: number = 100
en

Platform - Mobile browsers

zh

平台 - 移动浏览器

default

100

NACL

NACL: number = 7
en

Platform - NACL

zh

平台 - NACL

default

7

NetworkType

NetworkType: NetworkType
en

Network type enumeration

zh

网络类型枚举

OS_ANDROID

OS_ANDROID: string = "Android"
en

Operating System - Android

zh

操作系统 - 安卓

OS_IOS

OS_IOS: string = "iOS"
en

Operating System - iOS

zh

操作系统 - iOS

OS_LINUX

OS_LINUX: string = "Linux"
en

Operating System - Linux

zh

操作系统 - Linux

OS_OSX

OS_OSX: string = "OS X"
en

Operating System - Mac OS X

zh

操作系统 - Mac OS X

OS_UNKNOWN

OS_UNKNOWN: string = "Unknown"
en

Operating System - Unknown

zh

操作系统 - 未知

OS_WINDOWS

OS_WINDOWS: string = "Windows"
en

Operating System - Windows

zh

操作系统 - Windows

QQ_PLAY

QQ_PLAY: number = 105
en

Platform - QQ Play Game

zh

平台 - QQ Play

default

105

TIZEN

TIZEN: number = 9
en

Platform - Tizen

zh

平台 - Tizen

default

9

UNKNOWN

UNKNOWN: number = -1
en

Platform - Unknown

zh

平台 - 未知

default

-1

WECHAT_GAME

WECHAT_GAME: number = 104
en

Platform - WeChat Mini Game

zh

平台 - 微信小游戏

default

104

WIN32

WIN32: number = 0
en

Platform - 32 bit Windows application

zh

平台 - 32位 Windows 可执行程序

default

0

WINRT

WINRT: number = 10
en

Platform - Windows RT

zh

平台 - Windows RT

default

10

WP8

WP8: number = 11
en

Platform - Windows Phone 8 app

zh

平台 - Windows Phone 8 原生应用

default

11

Private __audioSupport

__audioSupport: null = null

Audio support in the browser

MULTI_CHANNEL : Multiple audio while playing - If it doesn't, you can only play background music WEB_AUDIO : Support for WebAudio - Support W3C WebAudio standards, all of the audio can be played AUTOPLAY : Supports auto-play audio - if Don‘t support it, On a touch detecting background music canvas, and then replay REPLAY_AFTER_TOUCH : The first music will fail, must be replay after touchstart USE_EMPTIED_EVENT : Whether to use the emptied event to replace load callback DELAY_CREATE_CTX : delay created the context object - only webAudio NEED_MANUAL_LOOP : loop attribute failure, need to perform loop manually

May be modifications for a few browser version

browserType

browserType: string = "unknown"
en

Indicate the running browser type

zh

指示当前运行的浏览器类型

browserVersion

browserVersion: string = ""
en

Indicate the running browser version

zh

指示当前运行的浏览器版本

capabilities

capabilities: null = null
en

The capabilities of the current platform

zh

当前平台的功能可用性

isBrowser

isBrowser: boolean = typeof window === 'object' && typeof document === 'object' && !MINIGAME && !JSB && !RUNTIME_BASED
en

Whether the running platform is browser

zh

指示运行平台是否是浏览器

isLittleEndian

isLittleEndian: boolean = (() => {const buffer = new ArrayBuffer(2);new DataView(buffer).setInt16(0, 256, true);// Int16Array uses the platform's endianness.return new Int16Array(buffer)[0] === 256;})()
en

Whether the endianness of current platform is little endian

zh

当前平台字节顺序是否是小端序

isMobile

isMobile: boolean = false
en

Indicate whether the current running context is a mobile system

zh

指示当前运行平台是否是移动端平台

default

false

isNative

isNative: boolean = JSB
en

Whether the running platform is native app

zh

指示运行平台是否是原生平台

language

language: string = "unknown"
en

Indicate the current language of the running system

zh

指示当前运行环境的语言

default

{{sys.LANGUAGE_UNKNOWN}}

localStorage

localStorage: null = null
en

It is a local storage component based on HTML5 localStorage API, on web platform, it's equal to window.localStorage

zh

HTML5 标准中的 localStorage 的本地存储功能,在 Web 端等价于 window.localStorage

os

os: string = "Unknown"
en

Indicate the running os name

zh

指示当前运行系统

osMainVersion

osMainVersion: number = 0
en

Indicate the running os main version

zh

指示当前系统主版本

osVersion

osVersion: string = ""
en

Indicate the running os version string

zh

指示当前运行系统版本字符串

platform

platform: number = -1
en

The running platform

zh

当前运行平台或环境

default

{{sys.UNKNOWN}}

windowPixelResolution

windowPixelResolution: null = null
en

Indicate the real pixel resolution of the whole game window

zh

指示游戏窗口的像素分辨率

Private cleanScript

  • cleanScript(jsfile: any): void

dump

  • dump(): void

Private dumpRoot

  • dumpRoot(): void

garbageCollect

  • garbageCollect(): void

getBatteryLevel

  • getBatteryLevel(): number

getNetworkType

getSafeAreaRect

  • getSafeAreaRect(): any
  • Returns the safe area of the screen. If the screen is not notched, the design resolution will be returned by default. Only supported on Android, iOS and WeChat Mini Game platform.

    method

    getSafeAreaRect

    Returns any

isObjectValid

  • isObjectValid(obj: any): boolean
  • Check whether an object is valid, In web engine, it will return true if the object exist In native engine, it will return true if the JS object and the correspond native object are both valid

    Parameters

    • obj: any

      The object to be checked

    Returns boolean

now

  • now(): number

openURL

  • openURL(url: any): void

Private restartVM

  • restartVM(): void

Generated using TypeDoc