Namespace cc

Method Summary

Field Detail

<static> <constant> cc.ACTION_TAG_INVALID
Default Action tag
Defined in: CCAction.js.
<static> <constant> {Number} cc.ADJUST_FACTOR
The adjust factor is needed to prevent issue #442
One solution is to use DONT_RENDER_IN_SUBPIXELS images, but NO
The other issue is that in some transitions (and I don't know why)
the order should be reversed (In in top of Out or vice-versa).
Defined in: CCTransition.js.
<static> <constant> {Number} cc.ALIGN_BOTTOM
Horizontal center and vertical bottom.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_BOTTOM_LEFT
Horizontal left and vertical bottom.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_BOTTOM_RIGHT
Horizontal right and vertical bottom.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_CENTER
Horizontal center and vertical center.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_LEFT
Horizontal left and vertical center.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_RIGHT
Horizontal right and vertical center.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_TOP
Horizontal center and vertical top.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_TOP_LEFT
Horizontal left and vertical top.
Defined in: CCImage.js.
<static> <constant> {Number} cc.ALIGN_TOP_RIGHT
Horizontal right and vertical top.
Defined in: CCImage.js.
<static> <constant> cc.ATTRIBUTE_NAME_COLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.ATTRIBUTE_NAME_POSITION

Defined in: CCGLProgram.js.
<static> <constant> cc.ATTRIBUTE_NAME_TEX_COORD

Defined in: CCGLProgram.js.
<static> <constant> {Number} cc.BLEND_DST
default gl blend dst function. Compatible with premultiplied alpha images.
Defined in: CCMacro.js.
<static> <constant> {Number} cc.BLEND_SRC
default gl blend src function. Compatible with premultiplied alpha images.
Defined in: CCMacro.js.
<static> cc.Browser
Browser detection, based on mootools
platform will print out win32, mac, etc
type is the browser type, chrome, firefox etc
Defined in: miniFramework.js.
<static> {HTMLCanvasElement} cc.canvas
main Canvas of game engine
Defined in: CCApplication.js.
<static> <constant> {Number} cc.CANVAS
Canvas of render type
Defined in: CCApplication.js.
<static> <constant> {Number} cc.COCOSNODE_RENDER_SUBPIXEL

If enabled, the cc.Node objects (cc.Sprite, cc.Label,etc) will be able to render in subpixels.
If disabled, integer pixels will be used.

To enable set it to 1. Enabled by default.


Defined in: CCConfig.js.
<static> cc.Codec
mixin cc.Codec
Defined in: ZipUtils.js.
<static> cc.Component
************************************************************************* Copyright (c) 2013 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
Defined in: CCComponent.js.
<static> cc.ComponentContainer
************************************************************************* Copyright (c) 2013 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
Defined in: CCComponentContainer.js.
<static> cc.config
Runtime information
Defined in: CCConfig.js.
Deprecated:
Use "sys" instead.
<static> <constant> {Number} cc.CURRENT_ITEM
default tag for current item
Defined in: CCMenuItem.js.
<static> <constant> {String} cc.DEFAULT_ENGINE
default engine
Defined in: CCConfig.js.
<static> <constant> {Number} cc.DEFAULT_PADDING

Defined in: CCMenu.js.
<static> <constant> {Number} cc.DEFAULT_SPRITE_BATCH_CAPACITY

Defined in: CCSpriteBatchNode.js.
<static> {Number} cc.defaultFPS
set default fps to 60
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DEG

Defined in: CCMacro.js.
<static> <constant> {Number} cc.DEVICE_MAX_ORIENTATIONS
In browsers, we only support 2 orientations by change window size.
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_LANDSCAPE_LEFT
Device oriented horizontally, home button on the right (UIDeviceOrientationLandscapeLeft)
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_LANDSCAPE_RIGHT
Device oriented horizontally, home button on the left (UIDeviceOrientationLandscapeRight)
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_PORTRAIT
Device oriented vertically, home button on the bottom (UIDeviceOrientationPortrait)
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_PORTRAIT_UPSIDE_DOWN
Device oriented vertically, home button on the top (UIDeviceOrientationPortraitUpsideDown)
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DIRECTOR_FPS_INTERVAL

Senconds between FPS updates.
0.5 seconds, means that the FPS number will be updated every 0.5 seconds.
Having a bigger number means a more reliable FPS

Default value: 0.1f


Defined in: CCConfig.js.
<static> <constant> {Number} cc.DIRECTOR_PROJECTION_2D
sets a 2D projection (orthogonal projection)
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DIRECTOR_PROJECTION_3D
sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DIRECTOR_PROJECTION_CUSTOM
it calls "updateProjection" on the projection delegate.
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DIRECTOR_PROJECTION_DEFAULT
Default projection is 3D projection
Defined in: CCDirector.js.
<static> <constant> {cc.Point} cc.DIRECTOR_STATS_POSITION
Position of the FPS (Default: 0,0 (bottom-left corner))
Defined in: CCConfig.js.
<static> <constant> {Number} cc.DISABLE_TAG
default disabled tag
Defined in: CCMenuItem.js.
<static> {cc.DrawingPrimitive} cc.drawingUtil
drawing primitive of game engine
Defined in: CCApplication.js.
<static> <constant> {Number} cc.ENABLE_GL_STATE_CACHE

If enabled, cocos2d will maintain an OpenGL state cache internally to avoid unnecessary switches.
In order to use them, you have to use the following functions, insead of the the GL ones:
- ccGLUseProgram() instead of glUseProgram()
- ccGLDeleteProgram() instead of glDeleteProgram()
- ccGLBlendFunc() instead of glBlendFunc()

If this functionality is disabled, then ccGLUseProgram(), ccGLDeleteProgram(), ccGLBlendFunc() will call the GL ones, without using the cache.
It is recommened to enable whenever possible to improve speed.
If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on.


Defined in: CCConfig.js.
<static> <constant> cc.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.


Defined in: CCConfig.js.
<static> <constant> {String} cc.ENGINE_VERSION

The current version of Cocos2d-html5 being used.
Please DO NOT remove this String, it is an important flag for bug tracking.
If you post a bug to forum, please attach this flag.


Defined in: CCConfig.js.
<static> {Boolean} cc.firstRun
is director first run
Defined in: CCDirector.js.
<static> <constant> {Number} cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL

If enabled, the texture coordinates will be calculated by using this formula:
- texCoord.left = (rect.origin.x*2+1) / (texture.wide*2);
- texCoord.right = texCoord.left + (rect.size.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 using the spritesheet-artifact-fixer.py or a similar tool.

Affected nodes:
- cc.Sprite / cc.SpriteBatchNode and subclasses: cc.LabelBMFont, cc.TMXTiledMap
- cc.LabelAtlas
- cc.QuadParticleSystem
- cc.TileMap

To enabled set it to 1. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.FLT_EPSILON

Defined in: CCMacro.js.
<static> <constant> {Number} cc.FLT_MAX

Defined in: CCMacro.js.
<static> <constant> {Number} cc.FMT_JPG
Image Format:JPG
Defined in: CCImage.js.
<static> <constant> {Number} cc.FMT_PNG
Image Format:PNG
Defined in: CCImage.js.
<static> <constant> {Number} cc.FMT_RAWDATA
Image Format:RAWDATA
Defined in: CCImage.js.
<static> <constant> {Number} cc.FMT_TIFF
Image Format:TIFF
Defined in: CCImage.js.
<static> <constant> {Number} cc.FMT_UNKNOWN
Image Format:UNKNOWN
Defined in: CCImage.js.
<static> <constant> {Number} cc.FMT_WEBP
Image Format:WEBP
Defined in: CCImage.js.
<static> cc.g_NumberOfDraws
************************************************************************* Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011 Zynga Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
Defined in: CCDirector.js.
<static> {object} cc.g_sharedTextureCache
TextureCache - Alloc, Init & Dealloc
Defined in: CCTextureCache.js.
<static> {HTMLDivElement} cc.gameDiv
This Div element contain all game canvas
Defined in: CCApplication.js.
<static> <constant> cc.GL_ALL
GL server side states
Defined in: CCGLStateCache.js.
<static> <constant> {Number} cc.IMAGE_FORMAT_JPEG
enum for jpg
Defined in: CCRenderTexture.js.
<static> <constant> {Number} cc.IMAGE_FORMAT_PNG
enum for png
Defined in: CCRenderTexture.js.
<static> <constant> {Number} cc.IMAGE_FORMAT_RAWDATA
enum for raw
Defined in: CCRenderTexture.js.
<static> <constant> {Number} cc.INVALID_INDEX

Defined in: CCMacro.js.
<static> <constant> {Number} cc.IS_RETINA_DISPLAY_SUPPORTED
whether or not support retina display
Defined in: CCConfig.js.
<static> <constant> cc.IS_SHOW_DEBUG_ON_PAGE
Is show bebug info on web page
Defined in: CCCommon.js.
<static> <constant> {Number} cc.ITEM_SIZE
default size for font size
Defined in: CCMenuItem.js.
<static> <constant> {object} cc.KEY
keymap
Defined in: CCCommon.js.
//Example
//to mark a keydown
cc.keyDown[65] = true;
//or
cc.keyMap[cc.KEY.a]

//to mark a keyup
do cc.keyDown[65] = false;

//to find out if a key is down, check
if(cc.keyDown[65])
//or
if,(cc.keyDown[cc.KEY.space])
//if its undefined or false or null, its not pressed
<static> <constant> {Number} cc.LABEL_AUTOMATIC_WIDTH

Defined in: CCLabelBMFont.js.
<static> <constant> {Number} cc.LABELATLAS_DEBUG_DRAW

If enabled, all subclasses of cc.LabeltAtlas will draw a bounding box
Useful for debugging purposes only. It is recommened to leave it disabled.

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.LABELBMFONT_DEBUG_DRAW

If enabled, all subclasses of cc.LabelBMFont will draw a bounding box
Useful for debugging purposes only. It is recommened to leave it disabled.

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.LANGUAGE_ARABIC
Arabic language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_CHINESE
Chinese language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_ENGLISH
English language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_FRENCH
French language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_GERMAN
German language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_HUNGARIAN
Hungarian language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_ITALIAN
Italian language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_JAPANESE
Japanese language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_KOREAN
Korean language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_NORWEGIAN
Norwegian language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_POLISH
Polish language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_PORTUGUESE
Portuguese language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_RUSSIAN
Russian language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.LANGUAGE_SPANISH
Spanish language code
Defined in: CCCommon.js.
<static> <constant> {Number} cc.MENU_HANDLER_PRIORITY

Defined in: CCMenu.js.
<static> <constant> {Number} cc.MENU_STATE_TRACKING_TOUCH

Defined in: CCMenu.js.
<static> <constant> {Number} cc.MENU_STATE_WAITING

Defined in: CCMenu.js.
<static> <constant> cc.NODE_ON_ENTER
Node on enter
Defined in: CCNode.js.
<static> <constant> cc.NODE_ON_EXIT
Node on exit
Defined in: CCNode.js.
<static> <constant> {Number} cc.NODE_TAG_INVALID
Default Node tag
Defined in: CCNode.js.
<static> <constant> {Number} cc.NORMAL_TAG
default tag for normal
Defined in: CCMenuItem.js.
<static> <constant> {Number} cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA

If most of your imamges have pre-multiplied alpha, set it to 1 (if you are going to use .PNG/.JPG file images).
Only set to 0 if ALL your images by-pass Apple UIImage loading system (eg: if you use libpng or PVR images)

To enable set it to a value different than 0. Enabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.ORIENTATION_LANDSCAPE_LEFT
Device oriented horizontally, home button on the right
Defined in: CCApplication.js.
<static> <constant> {Number} cc.ORIENTATION_LANDSCAPE_RIGHT
Device oriented horizontally, home button on the left
Defined in: CCApplication.js.
<static> <constant> {Number} cc.ORIENTATION_PORTRAIT
Device oriented vertically, home button on the bottom
Defined in: CCApplication.js.
<static> <constant> {Number} cc.ORIENTATION_PORTRAIT_UPSIDE_DOWN
Device oriented vertically, home button on the top
Defined in: CCApplication.js.
<static> {cc.Size} cc.originalCanvasSize
save original size of canvas, use for resize canvas
Defined in: CCApplication.js.
<static> <constant> {Number} cc.PARTICLE_BALL_SHAPE
Ball Shape for ShapeMode of Particle
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_DURATION_INFINITY
The Particle emitter lives forever
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_MODE_GRAVITY
Gravity mode (A mode)
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_MODE_RADIUS
Radius mode (B mode)
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_SHAPE_MODE
Shape Mode of Particle Draw
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_STAR_SHAPE
Star Shape for ShapeMode of Particle
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS
The starting radius of the particle is equal to the ending radius
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE
The starting size of the particle is equal to the ending size
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_TEXTURE_MODE
Texture Mode of Particle Draw
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_TYPE_FREE
Living particles are attached to the world and are unaffected by emitter repositioning.
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_TYPE_GROUPED
Living particles are attached to the emitter and are translated along with it.
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PARTICLE_TYPE_RELATIVE
Living particles are attached to the world but will follow the emitter repositioning.
Use case: Attach an emitter to an sprite, and you want that the emitter follows the sprite.
Defined in: CCParticleSystem.js.
<static> <constant> {Number} cc.PI
PI is the ratio of a circle's circumference to its diameter.
Defined in: CCMacro.js.
<static> cc.PNGReader
************************************************************************* Copyright (c) 2011 Devon Govett Copyright (c) 2010-2012 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
Defined in: CCPNGReader.js.
<static> <constant> {Number} cc.POINT_EPSILON
smallest such that 1.0+FLT_EPSILON != 1.0
Defined in: CCPointExtension.js.
<static> <constant> {Number} cc.PRIORITY_NON_SYSTEM
Minimum priority level for user scheduling.
Defined in: CCScheduler.js.
<static> <constant> {Number} cc.PRIORITY_SYSTEM
Priority level reserved for system services.
Defined in: CCScheduler.js.
<static> <constant> {Number} cc.PROGRESS_TEXTURE_COORDS

Defined in: CCProgressTimer.js.
<static> <constant> {Number} cc.PROGRESS_TEXTURE_COORDS_COUNT

Defined in: CCProgressTimer.js.
<static> <constant> {Number} cc.PROGRESS_TIMER_TYPE_BAR
Bar
Defined in: CCProgressTimer.js.
<static> <constant> {Number} cc.PROGRESS_TIMER_TYPE_RADIAL
Radial Counter-Clockwise
Defined in: CCProgressTimer.js.
<static> <constant> {Number} cc.RAD

Defined in: CCMacro.js.
<static> {CanvasRenderingContext2D|WebGLRenderingContext} cc.renderContext
main Canvas 2D/3D Context of game engine
Defined in: CCApplication.js.
<static> {Number} cc.renderContextType
current render type of game engine
Defined in: CCApplication.js.
<static> <constant> {Number} cc.REPEAT_FOREVER

Defined in: CCMacro.js.
<static> <constant> {Object} cc.RESOURCE_TYPE
resource type
Defined in: CCLoader.js.
<static> <constant> {String} cc.RETINA_DISPLAY_FILENAME_SUFFIX

It's the suffix that will be appended to the files in order to load "retina display" images.

On an iPhone4 with Retina Display support enabled, the file @"sprite-hd.png" will be loaded instead of @"sprite.png".
If the file doesn't exist it will use the non-retina display image.

Platforms: Only used on Retina Display devices like iPhone 4.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.RETINA_DISPLAY_SUPPORT

If enabled, cocos2d supports retina display.
For performance reasons, it's recommended disable it in games without retina display support, like iPad only games.

To enable set it to 1. Use 0 to disable it. Enabled by default.

This value governs only the PNG, GIF, BMP, images.
This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.


Defined in: CCConfig.js.
Deprecated:
This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it.
<static> {Number} cc.s_globalOrderOfArrival
XXX: Yes, nodes might have a sort problem once every 15 days if the game runs at 60 FPS and each frame sprites are reordered.
Defined in: CCNode.js.
<static> <constant> {Number} cc.SAX_ARRAY

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SAX_DICT

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SAX_INT

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SAX_KEY

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SAX_NONE

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SAX_REAL

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SAX_STRING

Defined in: CCFileUtils.js.
<static> <constant> {Number} cc.SCENE_FADE
A tag constant for identifying fade scenes
Defined in: CCTransition.js.
<static> <constant> {Number} cc.SCENE_RADIAL
tag for scene redial
Defined in: CCTransitionProgress.js.
<static> <constant> {Number} cc.SELECTED_TAG
default selected tag
Defined in: CCMenuItem.js.
<static> <constant> cc.SHADER_POSITION_COLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_LENGTHTEXTURECOLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_UCOLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_TEXTUREA8COLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_TEXTURECOLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_TEXTURECOLORALPHATEST

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADER_POSITION_UCOLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.SHADERTYPE_MAX

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_COLOR

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_LENGTH_TEXTURECOLOR

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_TEXTURE

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_TEXTURE_A8COLOR

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_TEXTURE_UCOLOR

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_TEXTURECOLOR

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_TEXTURECOLOR_ALPHATEST

Defined in: CCShaderCache.js.
<static> <constant> cc.SHADERTYPE_POSITION_UCOLOR

Defined in: CCShaderCache.js.
<static> {cc.AppController} cc.sharedAppController
cocos2d application instance
Defined in: AppControl.js.
<static> <constant> {Number} cc.SPRITE_DEBUG_DRAW

If enabled, all subclasses of cc.Sprite will draw a bounding box
Useful for debugging purposes only. It is recommened to leave it disabled.

To enable set it to a value different than 0. Disabled by default:
0 -- disabled
1 -- draw bounding box
2 -- draw texture box


Defined in: CCConfig.js.
<static> <constant> {Number} cc.SPRITE_INDEX_NOT_INITIALIZED
cc.Sprite invalid index on the cc.SpriteBatchNode
Defined in: CCSprite.js.
<static> <constant> {Number} cc.SPRITEBATCHNODE_DEBUG_DRAW

If enabled, all subclasses of cc.Sprite that are rendered using an cc.SpriteBatchNode draw a bounding box.
Useful for debugging purposes only. It is recommened to leave it disabled.

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.SPRITEBATCHNODE_RENDER_SUBPIXEL

If enabled, the cc.Sprite objects rendered with cc.SpriteBatchNode will be able to render in subpixels.
If disabled, integer pixels will be used.

To enable set it to 1. Enabled by default.


Defined in: CCConfig.js.
<static> <constant> cc.TARGET_PLATFORM
Device type
Defined in: CCApplication.js.
<static> <constant> {Number} cc.TEXT_ALIGNMENT_CENTER
text alignment : center
Defined in: CCTypes.js.
<static> <constant> {Number} cc.TEXT_ALIGNMENT_LEFT
text alignment : left
Defined in: CCTypes.js.
<static> <constant> {Number} cc.TEXT_ALIGNMENT_RIGHT
text alignment : right
Defined in: CCTypes.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_A8
8-bit textures used as masks
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_AI88
16-bit textures used as masks
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT
Default texture format: RGBA8888
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_I8
8-bit intensity texture
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC2
2-bit PVRTC-compressed texture: PVRTC2
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC4
4-bit PVRTC-compressed texture: PVRTC4
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_RGB565
16-bit texture without Alpha channel
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1
16-bit textures: RGB5A1
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_RGB888
24-bit texture: RGBA888
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444
16-bit textures: RGBA4444
Defined in: CCTexture2D.js.
<static> <constant> cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888
32-bit texture: RGBA8888
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP

Use GL_TRIANGLE_STRIP instead of GL_TRIANGLES when rendering the texture atlas.
It seems it is the recommend way, but it is much slower, so, enable it at your own risk

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.TEXTURE_ATLAS_USE_VAO

By default, cc.TextureAtlas (used by many cocos2d classes) will use VAO (Vertex Array Objects).
Apple recommends its usage but they might consume a lot of memory, specially if you use many of them.
So for certain cases, where you might need hundreds of VAO objects, it might be a good idea to disable it.

To disable it set it to 0. disable by default.(Not Supported on WebGL)


Defined in: CCConfig.js.
<static> <constant> {Number} cc.TEXTURE_NPOT_SUPPORT

If enabled, NPOT textures will be used where available. Only 3rd gen (and newer) devices support NPOT textures.
NPOT textures have the following limitations:
- They can't have mipmaps
- They only accept GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}

To enable set it to a value different than 0. Disabled by default.

This value governs only the PNG, GIF, BMP, images.
This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.


Defined in: CCConfig.js.
Deprecated:
This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it.
<static> cc.TIFFReader
************************************************************************* Copyright (c) 2011 Gordon P. Hemsley http://gphemsley.org/ Copyright (c) 2010-2013 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
Defined in: CCTIFFReader.js.
<static> <constant> {Number} cc.TMX_LAYER_ATTRIB_BASE64

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_LAYER_ATTRIB_GZIP

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_LAYER_ATTRIB_NONE

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_LAYER_ATTRIB_ZLIB

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_ORIENTATION_HEX
Hexagonal orientation
Defined in: CCTMXTiledMap.js.
<static> <constant> {Number} cc.TMX_ORIENTATION_ISO
Isometric orientation
Defined in: CCTMXTiledMap.js.
<static> <constant> {Number} cc.TMX_ORIENTATION_ORTHO
Orthogonal orientation
Defined in: CCTMXTiledMap.js.
<static> <constant> {Number} cc.TMX_PROPERTY_LAYER

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_MAP

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_NONE

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_OBJECT

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_OBJECTGROUP

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_TILE

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_DIAGONAL_FLAG

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_FLIPPED_ALL

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_FLIPPED_MASK

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_HORIZONTAL_FLAG

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_VERTICAL_FLAG

Defined in: CCTMXXMLParser.js.
<static> cc.TOUCH_ALL_AT_ONCE
Layer will receive all the touches at once The onTouchesXXX API will be called
Defined in: CCLayer.js.
<static> <constant> {Number} cc.TOUCH_BEGAN

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TOUCH_CANCELLED

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TOUCH_ENDED

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TOUCH_MOVED

Defined in: CCTouchDispatcher.js.
<static> cc.TOUCH_ONE_BY_ONE
Layer will receive only one touch at the time. The onTouchXXX API will be called
Defined in: CCLayer.js.
<static> <constant> {Number} cc.TouchMax

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TouchSelectorAllBits

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TouchSelectorBeganBit

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TouchSelectorCancelledBit

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TouchSelectorEndedBit

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TouchSelectorMovedBit

Defined in: CCTouchDispatcher.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_DOWN_OVER
vertical orientation type where the Bottom is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_LEFT_OVER
horizontal orientation Type where the Left is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_RIGHT_OVER
horizontal orientation type where the Right is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_UP_OVER
vertical orientation type where the Up is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TYPE_BACK_CLICKED
android back button
Defined in: CCKeyboardDispatcher.js.
Deprecated:
These were for android devices, but does not work in html5 environment
<static> <constant> {Number} cc.TYPE_MENU_CLICKED
android menu button
Defined in: CCKeyboardDispatcher.js.
Deprecated:
for android devices, does not work in html5 environment
<static> <constant> {Number} cc.UINT_MAX
maximum unsigned int value
Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_ALPHA_TEST_VALUE_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_COSTIME

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_COSTIME_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_MAX

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_MVMATRIX

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_MVMATRIX_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_MVPMATRIX

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_MVPMATRIX_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_PMATRIX

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_PMATRIX_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_RANDOM01

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_RANDOM01_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_SAMPLER

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_SAMPLER_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_SINTIME

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_SINTIME_S

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_TIME

Defined in: CCGLProgram.js.
<static> <constant> cc.UNIFORM_TIME_S

Defined in: CCGLProgram.js.
<static> <constant> {Number} cc.USE_LA88_LABELS

If enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabelTTF objects.
If it is disabled, it will use A8 (Alpha 8-bit textures).
LA88 textures are 6% faster than A8 textures, but they will consume 2x memory.

This feature is enabled by default.


Defined in: CCConfig.js.
<static> <constant> cc.VERTEX_ATTRIB_COLOR

Defined in: CCGLProgram.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_COLOR

Defined in: CCGLStateCache.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_NONE

Defined in: CCGLStateCache.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_POSCOLORTEX

Defined in: CCGLStateCache.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_POSITION

Defined in: CCGLStateCache.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_TEXCOORDS

Defined in: CCGLStateCache.js.
<static> <constant> cc.VERTEX_ATTRIB_MAX

Defined in: CCGLProgram.js.
<static> <constant> cc.VERTEX_ATTRIB_POSITION

Defined in: CCGLProgram.js.
<static> <constant> cc.VERTEX_ATTRIB_TEX_COORDS

Defined in: CCGLProgram.js.
<static> <constant> {Number} cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM
text alignment : bottom
Defined in: CCTypes.js.
<static> <constant> {Number} cc.VERTICAL_TEXT_ALIGNMENT_CENTER
text alignment : center
Defined in: CCTypes.js.
<static> <constant> {Number} cc.VERTICAL_TEXT_ALIGNMENT_TOP
text alignment : top
Defined in: CCTypes.js.
<static> <constant> {Number} cc.WEBGL
WebGL of render type
Defined in: CCApplication.js.
<static> <constant> {Number} cc.ZOOM_ACTION_TAG
default tag for zoom action tag
Defined in: CCMenuItem.js.

Method Detail

  • <static> {cc.$} cc.$new(x)
    Creates a new element, and adds cc.$ methods
    Defined in: miniFramework.js.
    Parameters:
    {String} x
    name of the element tag to create
    Returns:
    {cc.$}
  • <static> cc.AffineTransform(a, b, c, d, tx, ty)

    Defined in: CCAffineTransform.js.
    Parameters:
    {Number} a
    {Number} b
    {Number} c
    {Number} d
    {Number} tx
    {Number} ty
  • <static> {cc.AffineTransform} cc.AffineTransformConcat(t1, t2)
    Concatenate `t2' to `t1' and return the result:
    t' = t1 * t2
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t1
    {cc.AffineTransform} t2
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {Boolean} cc.AffineTransformEqualToTransform(t1, t2)
    Return true if `t1' and `t2' are equal, false otherwise.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t1
    {cc.AffineTransform} t2
    Returns:
    {Boolean} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformIdentity()

    Defined in: CCAffineTransform.js.
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformInvert(t)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformMake(a, b, c, d, tx, ty)

    Defined in: CCAffineTransform.js.
    Parameters:
    {Number} a
    {Number} b
    {Number} c
    {Number} d
    {Number} tx
    {Number} ty
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformMakeIdentity()

    Defined in: CCAffineTransform.js.
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformRotate(aTransform, anAngle)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} aTransform
    {Number} anAngle
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformScale(t, sx, sy)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t
    {Number} sx
    {Number} sy
    Returns:
    {cc.AffineTransform} Constructor
  • <static> {cc.AffineTransform} cc.AffineTransformTranslate(t, tx, ty)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t
    {Number} tx
    {Number} ty
    Returns:
    {cc.AffineTransform} Constructor
  • <static> cc.ArrayAppendObject(arr, addObj)
    append an object to array
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    {*} addObj
  • <static> {Array} cc.ArrayAppendObjectsToIndex(arr, addObjs, index)
    Inserts some objects at index
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    {Array} addObjs
    {Number} index
    Returns:
    {Array}
  • <static> {Array} cc.ArrayAppendObjectToIndex(arr, addObj, index)
    Inserts an object at index
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    {*} addObj
    {Number} index
    Returns:
    {Array}
  • <static> {Boolean} cc.ArrayContainsObject(arr, findObj)
    Returns a Boolean value that indicates whether value is present in the array.
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    {*} findObj
    Returns:
    {Boolean}
  • <static> {Number} cc.ArrayGetIndexOfObject(arr, findObj)
    Returns index of first occurence of object, -1 if value not found.
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    Source Array
    {*} findObj
    find object
    Returns:
    {Number} index of first occurence of value
  • <static> {Number} cc.ArrayGetIndexOfValue(arr, value)
    Returns index of first occurence of value, -1 if value not found.
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    Source Array
    {*} value
    find value
    Returns:
    {Number} index of first occurence of value
  • <static> cc.ArrayRemoveArray(arr, minusArr)
    Removes from arr all values in minusArr. For each Value in minusArr, the first matching instance in arr will be removed.
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    Source Array
    {Array} minusArr
    minus Array
  • <static> cc.ArrayRemoveObject(arr, delObj)
    Searches for the first occurance of object and removes it. If object is not found the function has no effect.
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    Source Array
    {*} delObj
    remove object
  • <static> cc.ArrayRemoveObjectAtIndex(arr, index)
    Removes object at specified index and pushes back all subsequent objects.Behaviour undefined if index outside [0, num-1].
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    Source Array
    {Number} index
    index of remove object
  • <static> {Boolean} cc.ArrayVerifyType(arr, type)
    Verify Array's Type
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    {function} type
    Returns:
    {Boolean}
  • <static> cc.Assert(cond, message)
    Output Assert message.
    Defined in: CCCommon.js.
    Parameters:
    {Boolean} cond
    If cond is false, assert.
    {String} message
  • <static> cc.associateWithNative(jsObj, superclass)
    Function added for JS bindings compatibility. Not needed in cocos2d-html5.
    Defined in: CCCommon.js.
    Parameters:
    {object} jsObj
    subclass
    {object} superclass
  • <static> {Number} cc.bezierAt(a, b, c, d, t)

    Defined in: CCActionInterval.js.
    Parameters:
    {Number} a
    {Number} b
    {Number} c
    {Number} d
    {Number} t
    Returns:
    {Number}
  • <static> cc.black()
    Black Color (0,0,0)
    Defined in: CCTypes.js.
  • <static> cc.blue()
    Blue color (0,0,255)
    Defined in: CCTypes.js.
  • <static> {Number|Number|Number} cc.c3b(r, g, b)
    helper macro that creates an ccColor3B type
    Defined in: CCTypes.js.
    Parameters:
    {Number} r
    red value (0 to 255)
    {Number} g
    green value (0 to 255)
    {Number} b
    blue value (0 to 255)
    Returns:
    {Number|Number|Number}
  • <static> {Boolean} cc.c3BEqual(color1, color2)
    returns true if both ccColor3B are equal. Otherwise it returns false.
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color3B} color1
    {cc.Color3B} color2
    Returns:
    {Boolean} true if both ccColor3B are equal. Otherwise it returns false.
  • <static> {Number|Number|Number|Number} cc.c4b(r, g, b, a)
    helper macro that creates an ccColor4B type
    Defined in: CCTypes.js.
    Parameters:
    {Number} r
    red value (0 to 255)
    {Number} g
    green value (0 to 255)
    {Number} b
    blue value (0 to 255)
    {Number} a
    Alpha value (0 to 255)
    Returns:
    {Number|Number|Number|Number}
  • <static> {cc.Color4B} cc.c4BFromccc4F(c)
    Returns a cc.Color4B from a cc.Color4F.
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color4F} c
    Returns:
    {cc.Color4B}
  • <static> {Boolean} cc.c4FEqual(a, b)
    returns YES if both cc.Color4F are equal. Otherwise it returns NO.
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color4F} a
    color1
    {cc.Color4F} b
    color2
    Returns:
    {Boolean}
  • <static> {cc.Color4F} cc.c4FFromccc3B(c)
    Returns a cc.Color4F from a cc.Color3B. Alpha will be 1.
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color3B} c
    color
    Returns:
    {cc.Color4F}
  • <static> {cc.Color4F} cc.c4FFromccc4B(c)
    Returns a cc.Color4F from a cc.Color4B.
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color4B} c
    Color
    Returns:
    {cc.Color4F}
  • <static> {cc.Point} cc.CardinalSplineAt(p0, p1, p2, p3, tension, t)

    Returns the Cardinal Spline position for a given set of control points, tension and time CatmullRom Spline formula:
    s(-ttt + 2tt - t)P1 + s(-ttt + tt)P2 + (2ttt - 3tt + 1)P2 + s(ttt - 2tt + t)P3 + (-2ttt + 3tt)P3 + s(ttt - tt)P4


    Defined in: CCActionCatmullRom.js.
    Parameters:
    {cc.Point} p0
    {cc.Point} p1
    {cc.Point} p2
    {cc.Point} p3
    {Number} tension
    {Number} t
    Returns:
    {cc.Point}
  • <static> {Number} cc.clampf(value, min_inclusive, max_inclusive)
    Clamp a value between from and to.
    Defined in: CCPointExtension.js.
    Parameters:
    {Number} value
    {Number} min_inclusive
    {Number} max_inclusive
    Returns:
    {Number}
  • <static> {Array|object} cc.clone(obj)
    copy an new object
    Defined in: CCCommon.js.
    Parameters:
    {object|Array} obj
    source object
    Returns:
    {Array|object}
  • <static> {Number} cc.computeImageFormatType(filename)
    Support image format type
    Defined in: CCTextureCache.js.
    Parameters:
    {String} filename
    Returns:
    {Number}
  • <static> cc.CONTENT_SCALE_FACTOR()

    On Mac it returns 1;
    On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1


    Defined in: CCMacro.js.
  • <static> {String} cc.convertColor3BtoHexString(clr)
    convert Color3B to a string of color for style. e.g. Color3B(255,6,255) to : "#ff06ff"
    Defined in: CCTypes.js.
    Parameters:
    clr
    Returns:
    {String}
  • <static> {cc.Color3B} cc.convertHexNumToColor3B(clrSt)
    convert a string of color for style to Color3B. e.g. "#ff06ff" to : Color3B(255,6,255)
    Defined in: CCTypes.js.
    Parameters:
    {String} clrSt
    Returns:
    {cc.Color3B}
  • <static> {WebGLRenderingContext} cc.create3DContext(canvas, opt_attribs)
    create a webgl context
    Defined in: miniFramework.js.
    Parameters:
    {HTMLCanvasElement} canvas
    {Object} opt_attribs
    Returns:
    {WebGLRenderingContext}
  • <static> {Number} cc.DEGREES_TO_RADIANS(angle)
    converts degrees to radians
    Defined in: CCMacro.js.
    Parameters:
    {Number} angle
    Returns:
    {Number}
  • <static> cc.DISABLE_DEFAULT_GL_STATES()

    Disable default GL states:
    - GL_TEXTURE_2D
    - GL_TEXTURE_COORD_ARRAY
    - GL_COLOR_ARRAY


    Defined in: CCMacro.js.
  • <static> cc.dumpConfig()
    dump config info, but only in debug mode
    Defined in: CCConfig.js.
  • <static> cc.ENABLE_DEFAULT_GL_STATES()

    GL states that are enabled:
    - GL_TEXTURE_2D
    - GL_VERTEX_ARRAY
    - GL_TEXTURE_COORD_ARRAY
    - GL_COLOR_ARRAY


    Defined in: CCMacro.js.
  • <static> {cc.BMFontConfiguration} cc.FNTConfigLoadFile(fntFile)
    Load the .fnt file
    Defined in: CCLabelBMFont.js.
    Parameters:
    {String} fntFile
    Returns:
    {cc.BMFontConfiguration} Constructor
  • <static> cc.FNTConfigRemoveCache()
    Purges the FNT config cache
    Defined in: CCLabelBMFont.js.
  • <static> {cc.GridSize} cc.g(x, y)
    helper function to create a cc.GridSize
    Defined in: CCTypes.js.
    Parameters:
    {Number} x
    {Number} y
    Returns:
    {cc.GridSize}
  • <static> {Array} cc.generateTextureCacheForColor(texture)
    generate texture's cache for texture tint
    Defined in: CCSprite.js.
    Parameters:
    {HTMLImageElement} texture
    Returns:
    {Array}
  • <static> {HTMLCanvasElement} cc.generateTintImage(texture, tintedImgCache, color, rect, renderCanvas)
    generate tinted texture lighter: The source and destination colors are added to each other, resulting in brighter colors, moving towards color values of 1 (maximum brightness for that color).
    Defined in: CCSprite.js.
    Parameters:
    {HTMLImageElement} texture
    {Array} tintedImgCache
    {cc.Color3B|cc.Color4F} color
    {cc.Rect} rect
    {HTMLCanvasElement} renderCanvas Optional
    Returns:
    {HTMLCanvasElement}
  • <static> {HTMLCanvasElement} cc.generateTintImage2(texture, color, rect)
    generate tinted texture source-in: Where source and destination overlaps and both are opaque, the source is displayed. Everywhere else transparency is displayed.
    Defined in: CCSprite.js.
    Parameters:
    {HTMLImageElement} texture
    {cc.Color3B|cc.Color4F} color
    {cc.Rect} rect
    Returns:
    {HTMLCanvasElement}
  • <static> {Array} cc.getControlPointAt(controlPoints, pos)
    returns a point from the array
    Defined in: CCActionCatmullRom.js.
    Parameters:
    {Array} controlPoints
    {Number} pos
    Returns:
    {Array}
  • <static> cc.glBindTexture2D(textureId)
    If the texture is not already bound, it binds it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {cc.Texture2D} textureId
  • <static> cc.glBindTexture2DN(textureUnit, textureId)
    If the texture is not already bound to a given unit, it binds it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} textureUnit
    {cc.Texture2D} textureId
  • <static> cc.glBindVAO(vaoId)
    If the vertex array is not already bound, it binds it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    vaoId
  • <static> cc.glBlendFunc(sfactor, dfactor)
    Uses a blending function in case it not already used.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} sfactor
    {Number} dfactor
  • <static> cc.glBlendResetToCache()
    Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.
    Defined in: CCGLStateCache.js.
  • <static> cc.glDeleteProgram(program)
    Deletes the GL program. If it is the one that is being used, it invalidates it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {WebGLProgram} program
  • <static> cc.glDeleteTexture(textureId)
    It will delete a given texture. If the texture was bound, it will invalidate the cached.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {WebGLTexture} textureId
  • <static> cc.glDeleteTextureN(textureUnit, textureId)
    It will delete a given texture. If the texture was bound, it will invalidate the cached for the given texture unit.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} textureUnit
    {WebGLTexture} textureId
  • <static> cc.glEnable(flags)
    It will enable / disable the server side GL states.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glEnable() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} flags
  • <static> cc.glEnableVertexAttribs(flags)

    Will enable the vertex attribs that are passed as flags.
    Possible flags:
    cc.VERTEX_ATTRIB_FLAG_POSITION
    cc.VERTEX_ATTRIB_FLAG_COLOR
    cc.VERTEX_ATTRIB_FLAG_TEXCOORDS

    These flags can be ORed. The flags that are not present, will be disabled.


    Defined in: CCGLStateCache.js.
    Parameters:
    {cc.VERTEX_ATTRIB_FLAG_POSITION | cc.VERTEX_ATTRIB_FLAG_COLOR | cc.VERTEX_ATTRIB_FLAG_TEXCOORDS} flags
  • <static> cc.glInvalidateStateCache()
    Invalidates the GL state cache.
    If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
    Defined in: CCGLStateCache.js.
  • <static> cc.glUseProgram(program)
    Uses the GL program in case program is different than the current one.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {WebGLProgram} program
  • <static> cc.gray()
    Gray Color (166,166,166)
    Defined in: CCTypes.js.
  • <static> cc.green()
    Green Color (0,255,0)
    Defined in: CCTypes.js.
  • <static> {cc.ListEntry|cc.HashUpdateEntry} cc.HASH_FIND_INT(arr, findInt)
    find object from array by target
    Defined in: CCScheduler.js.
    Parameters:
    {Array} arr
    source array
    {cc.ListEntry|cc.HashUpdateEntry} findInt
    find target
    Returns:
    {cc.ListEntry|cc.HashUpdateEntry}
  • <static> cc.IMEKeyboardNotificationInfo(begin, end, duration)
    IME Keyboard Notification Info structure
    Defined in: CCIMEDispatcher.js.
    Parameters:
    {cc.Rect} begin
    the soft keyboard rectangle when animatin begin
    {cc.Rect} end
    the soft keyboard rectangle when animatin end
    {Number} duration
    the soft keyboard animation duration
  • <static> cc.INCREMENT_GL_DRAWS(addNumber)

    Increments the GL Draws counts by one.
    The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled.


    Defined in: CCMacro.js.
    Parameters:
    {Number} addNumber
  • <static> cc.initDebugSetting()
    Update Debug setting.
    Defined in: CCCommon.js.
  • <static> {Boolean} cc.isspace_unicode(ch)

    Defined in: CCLabelBMFont.js.
    Parameters:
    {String} ch
    Returns:
    {Boolean} weather the character is a whitespace character.
  • <static> cc.lerp(a, b, r)

    Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end


    Defined in: CCMacro.js.
    cc.lerp(2,10,0.5)//returns 6
    cc.lerp(2,10,0.2)//returns 3.6
    Parameters:
    {Number} a
    number A
    {Number} b
    number B
    {Number} r
    ratio between 0 and 1
  • <static> {Boolean} cc.less(p1, p2)

    Defined in: CCTouchDispatcher.js.
    Parameters:
    {cc.TouchHandler} p1
    {cc.TouchHandler} p2
    Returns:
    {Boolean}
  • <static> cc.loadImage(imageUrl)
    Load the images to the cache
    Defined in: CCTextureCache.js.
    Parameters:
    {String} imageUrl
  • <static> cc.log(message)
    Output Debug message.
    Defined in: CCCommon.js.
    Parameters:
    {String} message
  • <static> cc.logERROR()

    Defined in: CCCommon.js.
  • <static> cc.magenta()
    Magenta Color (255,0,255)
    Defined in: CCTypes.js.
  • <static> cc.MessageBox(message)
    Pop out a message box
    Defined in: CCCommon.js.
    Parameters:
    {String} message
  • <static> {Number} cc.NextPOT(x)

    Defined in: CCRenderTexture.js.
    Parameters:
    {Number} x
    Returns:
    {Number} Constructor
  • <static> cc.NODE_DRAW_SETUP(node)
    Helpful macro that setups the GL server state, the correct GL program and sets the Model View Projection matrix
    Defined in: CCMacro.js.
    Parameters:
    {cc.Node} node
    setup node
  • <static> cc.orange()
    Orange Color (255,127,0)
    Defined in: CCTypes.js.
  • <static> cc.p(x, y)
    Helper macro that creates a cc.Point.
    Defined in: CCGeometry.js.
    Parameters:
    {Number} x
    {Number} y
  • <static> {cc.Point} cc.pAdd(v1, v2)
    Calculates sum of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> cc.pAddIn(v1, v2)
    adds one point to another (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    v1
    v2
  • <static> {Number} cc.pAngle(a, b)

    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    Returns:
    {Number} the angle in radians between two vector directions
  • <static> {Number} cc.pAngleSigned(a, b)

    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    Returns:
    {Number} the signed angle in radians between two vector directions
  • <static> {cc.Point} cc.pClamp(p, min_inclusive, max_inclusive)
    Clamp a point between from and to.
    Defined in: CCPointExtension.js.
    Parameters:
    {Point} p
    {Number} min_inclusive
    {Number} max_inclusive
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pCompMult(a, b)
    Multiplies a nd b components, a.x*b.x, a.y*b.y
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pCompOp(p, opFunc)
    Run a math operation function on each point component
    Math.abs, Math.fllor, Math.ceil, Math.round.
    Defined in: CCPointExtension.js.
    //For example: let's try to take the floor of x,y
    var p = cc.pCompOp(cc.p(10,10),Math.abs);
    Parameters:
    {cc.Point} p
    {Function} opFunc
    Returns:
    {cc.Point}
  • <static> {Number} cc.pCross(v1, v2)
    Calculates cross product of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {Number}
  • <static> {cc.pLength} cc.pDistance(v1, v2)
    Calculates the distance between two points
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.pLength}
  • <static> {Number} cc.pDistanceSQ(point1, point2)
    Calculates the square distance between two points (not calling sqrt() )
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point1
    {cc.Point} point2
    Returns:
    {Number}
  • <static> {Number} cc.pDot(v1, v2)
    Calculates dot product of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {Number}
  • <static> {cc.Point} cc.pForAngle(a)
    Converts radians to a normalized vector.
    Defined in: CCPointExtension.js.
    Parameters:
    {Number} a
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pFromSize(s)
    Quickly convert cc.Size to a cc.Point
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Size} s
    Returns:
    {cc.Point}
  • <static> {Boolean} cc.pFuzzyEqual(a, b, variance)

    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    {Number} variance
    Returns:
    {Boolean} if points have fuzzy equality which means equal with some degree of variance.
  • <static> cc.pIn(v1, v2)
    copies the position of one point to another
    Defined in: CCPointExtension.js.
    Parameters:
    v1
    v2
  • <static> {cc.Point} cc.pIntersectPoint(A, B, C, D)
    ccpIntersectPoint return the intersection point of line A-B, C-D
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    {cc.Point} B
    {cc.Point} C
    {cc.Point} D
    Returns:
    {cc.Point}
  • <static> {Number} cc.pLength(v)
    Calculates distance between point an origin
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {Number}
  • <static> {Number} cc.pLengthSQ(v)
    Calculates the square length of a cc.Point (not calling sqrt() )
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {Number}
  • <static> {cc.pAdd} cc.pLerp(a, b, alpha)
    Linear Interpolation between two points a and b alpha == 0 ? a alpha == 1 ? b otherwise a value between a..b
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    {Number} alpha
    Returns:
    {cc.pAdd}
  • <static> {Boolean} cc.pLineIntersect(A, B, C, D, retP)
    A general line-line intersection test
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    A is the startpoint for the first line P1 = (p1 - p2).
    {cc.Point} B
    B is the endpoint for the first line P1 = (p1 - p2).
    {cc.Point} C
    C is the startpoint for the second line P2 = (p3 - p4).
    {cc.Point} D
    D is the endpoint for the second line P2 = (p3 - p4).
    {cc.Point} retP
    retP.x is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1)),
    retP.y is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3)).
    Returns:
    {Boolean} indicating successful intersection of a line
    note that to truly test intersection for segments we have to make
    sure that s & t lie within [0..1] and for rays, make sure s & t > 0
    the hit point is p3 + t * (p4 - p3);
    the hit point also is p1 + s * (p2 - p1);
  • <static> {cc.pMult} cc.pMidpoint(v1, v2)
    Calculates midpoint between two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.pMult}
  • <static> {cc.Point} cc.pMult(point, floatVar)
    Returns point multiplied by given factor.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    {Number} floatVar
    Returns:
    {cc.Point}
  • <static> cc.pMultIn(point, floatVar)
    multiplies the point with the given factor (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    point
    floatVar
  • <static> {cc.Point} cc.pNeg(point)
    Returns opposite of point.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pNormalize(v)
    Returns point multiplied to a length of 1.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {cc.Point}
  • <static> cc.pNormalizeIn(v)
    normalizes the point (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    v
  • <static> cc.POINT_PIXELS_TO_POINTS(pixels)
    Converts a rect in pixels to points
    Defined in: CCMacro.js.
    Parameters:
    pixels
  • <static> {cc.Point} cc.POINT_POINTS_TO_PIXELS(points)
    Converts a rect in points to pixels
    Defined in: CCMacro.js.
    Parameters:
    {cc.Point} points
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.PointApplyAffineTransform(point, t)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.Point} point
    {cc.AffineTransform} t
    Returns:
    {cc.Point} Constructor
  • <static> {Boolean} cc.pointEqualToPoint(point1, point2)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Point} point1
    {cc.Point} point2
    Returns:
    {Boolean}
  • <static> {cc.Point} cc.PointFromString(content)
    Returns a Core Graphics point structure corresponding to the data in a given string.
    Defined in: CCNS.js.
    //example
    var point = cc.PointFromString("{3.0,2.5}");
    Parameters:
    {String} content
    A string object whose contents are of the form "{x,y}", where x is the x coordinate and y is the y coordinate.
    The x and y values can represent integer or float values.
    The string is not localized, so items are always separated with a comma.
    Returns:
    {cc.Point} A Core Graphics structure that represents a point.
    If the string is not well-formed, the function returns cc.PointZero. Constructor
  • <static> {cc.Point} cc.PointMake(x, y)

    Defined in: CCGeometry.js.
    Parameters:
    {Number} x
    {Number} y
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.PointZero()
    The "left bottom" point -- equivalent to cc.p(0, 0).
    Defined in: CCGeometry.js.
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pPerp(point)
    Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    Returns:
    {cc.Point}
  • <static> {cc.pMult} cc.pProject(v1, v2)
    Calculates the projection of v1 over v2.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.pMult}
  • <static> {cc.Point} cc.pRotate(v1, v2)
    Rotates two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pRotateByAngle(v, pivot, angle)
    Rotates a point counter clockwise by the angle around a pivot
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    v is the point to rotate
    {cc.Point} pivot
    pivot is the pivot, naturally
    {Number} angle
    angle is the angle of rotation cw in radians
    Returns:
    {cc.Point} the rotated point
  • <static> {cc.Point} cc.pRPerp(point)
    Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    Returns:
    {cc.Point}
  • <static> {Boolean} cc.pSameAs(A, B)
    check to see if both points are equal
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    A ccp a
    {cc.Point} B
    B ccp b to be compared
    Returns:
    {Boolean} the true if both ccp are same
  • <static> {Boolean} cc.pSegmentIntersect(A, B, C, D)
    ccpSegmentIntersect return YES if Segment A-B intersects with segment C-D.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    {cc.Point} B
    {cc.Point} C
    {cc.Point} D
    Returns:
    {Boolean}
  • <static> {cc.Point} cc.pSub(v1, v2)
    Calculates difference of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> cc.pSubIn(v1, v2)
    subtracts one point from another (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    v1
    v2
  • <static> {Number} cc.pToAngle(v)
    Converts a vector to radians.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {Number}
  • <static> {cc.Point} cc.pUnrotate(v1, v2)
    Unrotates two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> cc.pZeroIn(v)
    sets the position of the point to 0
    Defined in: CCPointExtension.js.
    Parameters:
    v
  • <static> {Number} cc.RADIANS_TO_DEGREES(angle)
    converts radians to degrees
    Defined in: CCMacro.js.
    Parameters:
    {Number} angle
    Returns:
    {Number}
  • <static> {Number} cc.RANDOM_0_1()
    returns a random float between 0 and 1
    Defined in: CCMacro.js.
    Returns:
    {Number}
  • <static> {Number} cc.RANDOM_MINUS1_1()
    returns a random float between -1 and 1
    Defined in: CCMacro.js.
    Returns:
    {Number}
  • <static> cc.RECT_PIXELS_TO_POINTS(pixel)
    Converts a rect in pixels to points
    Defined in: CCMacro.js.
    Parameters:
    {cc.Rect} pixel
  • <static> cc.RECT_POINTS_TO_PIXELS(point)
    Converts a rect in points to pixels
    Defined in: CCMacro.js.
    Parameters:
    {cc.Rect} point
  • <static> {cc.Rect} cc.RectApplyAffineTransform(rect, anAffineTransform)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.Rect} rect
    {cc.AffineTransform} anAffineTransform
    Returns:
    {cc.Rect} Constructor
  • <static> {Boolean} cc.rectContainsPoint(rect, point)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    {cc.Point} point
    Returns:
    {Boolean}
  • <static> {Boolean} cc.rectContainsRect(rect1, rect2)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect1
    {cc.Rect} rect2
    Returns:
    {Boolean}
  • <static> {Boolean} cc.rectEqualToRect(rect1, rect2)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect1
    {cc.Rect} rect2
    Returns:
    {Boolean}
  • <static> {cc.Rect} cc.RectFromString(content)
    Returns a Core Graphics rectangle structure corresponding to the data in a given string.
    The string is not localized, so items are always separated with a comma.
    If the string is not well-formed, the function returns cc.RectZero.
    Defined in: CCNS.js.
    // example
    var rect = cc.RectFromString("{{3,2},{4,5}}");
    Parameters:
    {String} content
    content A string object whose contents are of the form "{{x,y},{w, h}}",
    where x is the x coordinate, y is the y coordinate, w is the width, and h is the height.
    These components can represent integer or float values.
    Returns:
    {cc.Rect} A Core Graphics structure that represents a rectangle. Constructor
  • <static> {Number} cc.rectGetMaxX(rect)
    return the rightmost x-value of 'rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number}
  • <static> {Number} cc.rectGetMaxY(rect)
    Return the topmost y-value of `rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number}
  • <static> {Number} cc.rectGetMidX(rect)
    return the midpoint x-value of 'rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number}
  • <static> {Number} cc.rectGetMidY(rect)
    Return the midpoint y-value of `rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number}
  • <static> {Number} cc.rectGetMinX(rect)
    return the leftmost x-value of 'rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number}
  • <static> {Number} cc.rectGetMinY(rect)
    Return the bottommost y-value of `rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number}
  • <static> {cc.Rect} cc.rectIntersection(rectA, rectB)
    Returns the overlapping portion of 2 rectangles
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {cc.Rect}
  • <static> {Boolean} cc.rectIntersectsRect(rectA, rectB)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {Boolean}
  • <static> {cc.Rect} cc.RectMake(x, y, width, height)

    Defined in: CCGeometry.js.
    Parameters:
    {Number} x
    {Number} y
    {Number} width
    {Number} height
    Returns:
    {cc.Rect}
  • <static> {Boolean} cc.rectOverlapsRect(rectA, rectB)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {Boolean}
  • <static> {cc.Rect} cc.rectUnion(rectA, rectB)
    Returns the smallest rectangle that contains the two source rectangles.
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {cc.Rect}
  • <static> {cc.Rect} cc.RectZero()
    The "zero" rectangle -- equivalent to cc.rect(0, 0, 0, 0).
    Defined in: CCGeometry.js.
    Returns:
    {cc.Rect}
  • <static> cc.red()
    Red Color (255,0,0,)
    Defined in: CCTypes.js.
  • <static> cc.registerStandardDelegate(delegate, priority)
    Adds a standard touch delegate to the dispatcher's list. See StandardTouchDelegate description.
    Defined in: CCTouchDispatcher.js.
    Parameters:
    {Object} delegate
    {Number} priority Optional
  • <static> cc.registerTargetedDelegate(priority, swallowsTouches, delegate)
    register a targeted touch delegate to the dispatcher's list.
    Defined in: CCTouchDispatcher.js.
    Parameters:
    {Number} priority
    {Boolean} swallowsTouches
    {Object} delegate
  • <static> cc.RENDER_IN_SUBPIXEL(A)

    Defined in: CCSprite.js.
    Parameters:
    A
  • <static> {Array} cc.reverseControlPoints(controlPoints)
    returns a new copy of the array reversed.
    Defined in: CCActionCatmullRom.js.
    Parameters:
    controlPoints
    Returns:
    {Array}
  • <static> cc.reverseControlPointsInline(controlPoints)
    reverse the current control point array inline, without generating a new one
    Defined in: CCActionCatmullRom.js.
    Parameters:
    controlPoints
  • <static> cc.setContextMenuEnable(enabled)
    enable/disable contextMenu for Canvas
    Defined in: CCApplication.js.
    Parameters:
    {Boolean} enabled
  • <static> cc.setProjectionMatrixDirty()
    sets the projection matrix as dirty
    Defined in: CCGLStateCache.js.
  • <static> cc.setup(el, width, height)

    setup game main canvas,renderContext,gameDiv and drawingUtil with argument

    can receive follow type of arguemnt:
    - empty: create a canvas append to document's body, and setup other option
    - string: search the element by document.getElementById(),
    if this element is HTMLCanvasElement, set this element as main canvas of engine, and set it's ParentNode as cc.gameDiv.
    if this element is HTMLDivElement, set it's ParentNode to cc.gameDiv´╝î and create a canvas as main canvas of engine.


    Defined in: CCApplication.js.
    //setup with null
    cc.setup();
    
    // setup with HTMLCanvasElement, gameCanvas is Canvas element
    // declare like this: 
    cc.setup("gameCanvas");
    
    //setup with HTMLDivElement, gameDiv is Div element
    // declare like this: 
    cc.setup("Cocos2dGameContainer");
    Parameters:
    el
    width
    height
  • <static> cc.SimpleSFX(audio, ext)
    the entity stored in soundList and effectList, containing the audio element and the extension name. used in cc.SimpleAudioEngine
    Defined in: SimpleAudioEngine.js.
    Parameters:
    audio
    ext
  • <static> {cc.Size} cc.size(w, h)

    Defined in: CCGeometry.js.
    Parameters:
    {Number} w
    width
    {Number} h
    height
    Returns:
    {cc.Size}
  • <static> {cc.Size} cc.SIZE_PIXELS_TO_POINTS(sizeInPixels)
    Converts a rect in pixels to points
    Defined in: CCMacro.js.
    Parameters:
    {cc.Size} sizeInPixels
    Returns:
    {cc.Size}
  • <static> {cc.Size} cc.SIZE_POINTS_TO_PIXELS(sizeInPoints)
    Converts a rect in points to pixels
    Defined in: CCMacro.js.
    Parameters:
    {cc.Size} sizeInPoints
    Returns:
    {cc.Size}
  • <static> {cc.Size} cc.SizeApplyAffineTransform(size, t)

    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.Size} size
    {cc.AffineTransform} t
    Returns:
    {cc.Size} Constructor
  • <static> {Boolean} cc.sizeEqualToSize(size1, size2)

    Defined in: CCGeometry.js.
    Parameters:
    {cc.Size} size1
    {cc.Size} size2
    Returns:
    {Boolean}
  • <static> {cc.Size} cc.SizeFromString(content)
    Returns a Core Graphics size structure corresponding to the data in a given string.
    Defined in: CCNS.js.
    // example
    var size = cc.SizeFromString("{3.0,2.5}");
    Parameters:
    {String} content
    A string object whose contents are of the form "{w, h}",
    where w is the width and h is the height.
    The w and h values can be integer or float values.
    The string is not localized, so items are always separated with a comma.
    Returns:
    {cc.Size} A Core Graphics structure that represents a size.
    If the string is not well-formed, the function returns cc.SizeZero.
  • <static> {cc.Size} cc.SizeMake(width, height)

    Defined in: CCGeometry.js.
    Parameters:
    {Number} width
    {Number} height
    Returns:
    {cc.Size}
  • <static> {cc.Size} cc.SizeZero()
    The "zero" size -- equivalent to cc.size(0, 0).
    Defined in: CCGeometry.js.
    Returns:
    {cc.Size}
  • <static> {String} cc.splitWithForm(content, strs)
    first, judge whether the form of the string like this: {x,y}
    if the form is right,the string will be splited into the parameter strs;
    or the parameter strs will be empty.
    if the form is right return true,else return false.

    Defined in: CCNS.js.
    Parameters:
    {String} content
    {String} strs
    Returns:
    {String}
  • <static> {Array} cc.StringToArray(input)
    string to array
    Defined in: ZipUtils.js.
    Parameters:
    {String} input
    Returns:
    {Array} array
  • <static> cc.SWAP(x, y, ref)

    simple macro that swaps 2 variables
    modified from c++ macro, you need to pass in the x and y variables names in string,
    and then a reference to the whole object as third variable


    Defined in: CCMacro.js.
    Parameters:
    x
    y
    ref
  • <static> {cc.Tex2F} cc.tex2(u, v)
    helper macro that creates an Tex2F type
    Defined in: CCTypes.js.
    Parameters:
    {Number} u
    {Number} v
    Returns:
    {cc.Tex2F}
  • <static> cc.TouchHandlerHelperData(type)

    Defined in: CCTouchDispatcher.js.
    Parameters:
    {Number} type
    Constructor
  • <static> cc.unregisterTouchDelegate(delegate)
    Removes a touch delegate. from TouchDispatcher
    Defined in: CCTouchDispatcher.js.
    Parameters:
    delegate
  • <static> {String} cc.unzip(input)
    Unpack a gzipped byte array
    Defined in: ZipUtils.js.
    Parameters:
    {Array} input
    Byte array
    Returns:
    {String} Unpacked byte string
  • <static> {Array} cc.unzipAsArray(input, bytes)
    Unpack a gzipped byte array
    Defined in: ZipUtils.js.
    Parameters:
    {Array} input
    Byte array
    {Number} bytes
    Bytes per array item
    Returns:
    {Array} Unpacked byte array
  • <static> {String} cc.unzipBase64(input)
    Unpack a gzipped byte string encoded as base64
    Defined in: ZipUtils.js.
    Parameters:
    {String} input
    Byte string encoded as base64
    Returns:
    {String} Unpacked byte string
  • <static> {Array} cc.unzipBase64AsArray(input, bytes)
    Unpack a gzipped byte string encoded as base64
    Defined in: ZipUtils.js.
    Parameters:
    {String} input
    Byte string encoded as base64
    {Number} bytes
    Bytes per array item
    Returns:
    {Array} Unpacked byte array
  • <static> cc.utf8_trim_from(str, index)
    Trims str st str=[0, index) after the operation. Return value: the trimmed string.
    Defined in: CCLabelBMFont.js.
    Parameters:
    {Array} str
    he string to trim
    {Number} index
    the index to start trimming from.
  • <static> cc.utf8_trim_ws(str)

    Defined in: CCLabelBMFont.js.
    Parameters:
    {Array} str
  • <static> {cc.V2F_C4B_T2F_Quad} cc.V2F_C4B_T2F_QuadZero()
    helper function to create a cc.V2F_C4B_T2F_Quad
    Defined in: CCTypes.js.
    Returns:
    {cc.V2F_C4B_T2F_Quad}
  • <static> cc.V3F_C4B_T2F_QuadCopy(sourceQuad)

    Defined in: CCTypes.js.
    Parameters:
    sourceQuad
  • <static> {cc.V3F_C4B_T2F_Quad} cc.V3F_C4B_T2F_QuadZero()
    helper function to create a cc.V3F_C4B_T2F_Quad
    Defined in: CCTypes.js.
    Returns:
    {cc.V3F_C4B_T2F_Quad}
  • <static> {cc.Vertex2F} cc.Vertex2(x, y)
    helper macro that creates an Vertex2F type
    Defined in: CCTypes.js.
    Parameters:
    {Number} x
    {Number} y
    Returns:
    {cc.Vertex2F}
  • <static> {cc.Vertex3F} cc.vertex3(x, y, z)
    helper macro that creates an Vertex3F type
    Defined in: CCTypes.js.
    Parameters:
    {Number} x
    {Number} y
    {Number} z
    Returns:
    {cc.Vertex3F}
  • <static> cc.WebAudioSFX(key, sourceNode, volumeNode, startTime, pauseTime)
    The entity stored in cc.WebAudioEngine, representing a sound object
    Defined in: SimpleAudioEngine.js.
    Parameters:
    key
    sourceNode
    volumeNode
    startTime
    pauseTime
  • <static> cc.white()
    White color (255,255,255)
    Defined in: CCTypes.js.
  • <static> cc.yellow()
    Yellow color (255,255,0)
    Defined in: CCTypes.js.