V4 API Changes
The following is a list of major (incomplete) interface changes.
cocos2d::ActionManager
- Remove
, usenumberOfRunningActionsInTarge
getNumberOfRunningActionsInTarget
instead.
cocos2d::Animate3D
- Remove
getPlayBack
- Remove
setPlayBack
cocos2d::Animation
- Rename
addSpriteFrameWithFileName
toaddSpriteFrameWithFile
.
cocos2d::Animation3D
- Remove
, usegetOrCreate
create
instead.
cocos2d::AnimationCache
- Remove
, usepurgeSharedAnimationCache
destroyInstance
instead. - Remove
, usesharedAnimationCache
getInstance
instead. - Remove
, useanimationByName
getAnimation
instead. - Remove
, useremoveAnimationByName
removeAnimation
instead.
cocos2d::AsyncTaskPool
- Spell fix
destoryInstance
todestroyInstance
Replace GLProgram & GLProgramState as Program & ProgramState
Remove class cocos2d::BatchCommand
New class cocos2d::CallbackCommand
cocos2d::CallFunc
- Remove
create(cocos2d::Ref *, cocos2d::SEL_CallFunc)
- Remove
, useinitWithTarget
initWithFunction
instead - Remove
setTargetCallback
cocos2d::CallFuncN
- Remove
create(cocos2d::Ref *, cocos2d::SEL_CallFuncN)
- Remove
initWithTarget
cocos2d::Camera
Refactoring
- Remove
applyFrameBufferObject
- Remove
restore
- Remove
restoreFrameBufferObject
- Remove
restoreViewport
- Remove
setFrameBufferObject
- Remove
, accessed viasetViewport
Renderer
新类 class cocos2d::CaptureScreenCallbackCommand
cocos2d::Clonable
- Remove
copy
cocos2d::Configuration
- Remove
, usepurgeConfiguration
getInstance
instead. - Remove
, usesharedConfiguration
destroyInstance
instead. - Added
getMaxAttributes
cocos2d::RenderCommand
Refactoring
cocos2d::TriangleCommand
Refactoring
cocos2d::CustomCommand
Refactoring
cocos2d::MeshCommand
Refactoring
cocos2d::Director
- Remove
, usesharedDirector
getInstance
instead. - Remove
getClearColor
- Remove
, accessed viagetProjectionMatrix
Camera
- Remove
getProjectionMatrixStackSize
- Remove
initProjectionMatrixStack
- Remove
loadProjectionIdentityMatrix
- Remove
loadProjectionMatrix
- Remove
multiplyProjectionMatrix
- Remove
popProjectionMatrix
- Remove
pushProjectionMatrix
- Remove
, accessed viasetAlphaBlending
Renderer
- Remove
, accessed viasetDepthTest
Renderer
cocos2d::DrawNode
- Remove
drawQuadraticBezier
Remove class cocos2d::experimental::FrameBuffer
Remove class cocos2d::experimental::RenderTargetBase
Remove class cocos2d::experimental::RenderTargetDepthStencil
Remove class cocos2d::experimental::RenderTargetRenderBuffer
cocos2d::FileUtils
- Remove
, usepurgeFileUtils
destroyInstance
instead. - Remove
, usesharedFileUtils
getInstance
instead. - Remove
, usegetFileData
getDataFromFile
instead.
cocos2d::Follow
- Spell fix
setBoudarySet
tosetBoundarySet
cocos2d::Font
- Remove
getHorizontalKerningForTextUTF16
cocos2d::GLView
- Remove
getVR
- Remove
pollInputEvents
- Remove
setCursor
- Remove
setDefaultCursor
- Remove
setVR
cocos2d::Grid3D
- Remove
, useoriginalVertex
getOriginalVertex
instead. - Remove
, usevertex
getVertex
instead.
cocos2d::GridBase
- Remove
create(const cocos2d::Size &, cocos2d::Texture2D *, bool)
- Remove
create(const cocos2d::Size &)
cocos2d::Image
- Rename
getRenderFormat
togetPixelFormat
. - Remove
, useisPremultipliedAlpha
hasPremultipliedAlpha
instead. - Rename
premultiplyAlpha
topremultipliedAlpha
. - Remove
reversePremultipliedAlpha
cocos2d::IMEDispatcher
- Remove
isAnyDelegateAttachedWithIME
Remove class cocos2d::IndexBuffer
cocos2d::Label
- Remove
create(const std::string &, const std::string &, float, const cocos2d::Size &, cocos2d::TextHAlignment, cocos2d::TextVAlignment)
- Remove
, usegetCommonLineHeight
getLineHeight
instead. - Remove
.getFontDefinition
- Remove
.setFontDefinition
- Added
setProgramState
cocos2d::Layer
- Remove
, useccTouchBegan
onTouchBegan
instead. - Remove
, useccTouchCancelled
onTouchCancelled
instead. - Remove
, useccTouchEnded
onTouchEnded
instead. - Remove
, useccTouchesBegan
onTouchesBegan
instead. - Remove
, useccTouchesCancelled
onTouchesCancelled
instead. - Remove
, useccTouchesEnded
onTouchesEnded
instead. - Remove
, useccTouchesMoved
onTouchesMoved
instead. - Remove
, useccTouchMoved
onTouchMoved
instead. - Remove
didAccelerate
- Remove
isAccelerometerEnabled
- Remove
isKeyboardEnabled
- Remove
isKeypadEnabled
- Remove
isSwallowsTouches
- Remove
isTouchEnabled
- Remove
, usekeyBackClicked
onKeyReleased
instead. - Remove
, usekeyMenuClicked
onKeyReleased
instead. - Remove
, usekeyPressed
onKeyPressed
instead. - Remove
, usekeyReleased
onKeyReleased
instead. - Remove
registerWithTouchDispatcher
- Remove
setAccelerometerEnabled
- Remove
setAccelerometerInterval
- Remove
setKeyboardEnabled
- Remove
setKeypadEnabled
- Remove
setSwallowsTouches
- Remove
setTouchEnabled
- Remove
setTouchMode
Remove class cocos2d::LabelBMFont
Remove class cocos2d::LabelTTF
cocos2d::Material
- Rename
createWithGLStateProgram
tocreateWithProgramState
. - Added
createWithProgramState
- Added
getRenderState
- Added
getStateBlock
- Added
setStateBlock
cocos2d::MenuItem
- Remove
create(cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
initWithTarget
cocos2d::MenuItemAtlasFont
- Remove
create(const std::string &, const std::string &, int, int, char, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
initWithString
cocos2d::MenuItemFont
- Remove
create(const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
, usefontName
getFontName
instead. - Remove
, usefontSize
getFontSize
instead. - Remove
, usefontNameObj
getFontNameObj
instead. - Remove
, usefontSizeObj
getFontSizeObj
instead. - Remove
initWithString(const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemImage
- Remove
create(const std::string &, const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
create(const std::string &, const std::string &, const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
initWithNormalImage(const std::string &, const std::string &, const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemLabel
- Remove
create(cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
initWithLabel(cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemSprite
- Remove
create(cocos2d::Node *, cocos2d::Node *, cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
create(cocos2d::Node *, cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
- Remove
initWithNormalSprite(cocos2d::Node *, cocos2d::Node *, cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemToggle
- Remove
createWithTarget(cocos2d::Ref *, cocos2d::SEL_MenuHandler, cocos2d::MenuItem *, ..)
- Remove
createWithTarget(cocos2d::Ref *, cocos2d::SEL_MenuHandler, const Vector<cocos2d::MenuItem *> &)
- Remove
initWithTarget(cocos2d::Ref *, cocos2d::SEL_MenuHandler, cocos2d::MenuItem *, __va_list_tag *)
- Remove
, useselectedItem()
getSelectedItem
instead.
cocos2d::Mesh
- Remove
create(const std::vector<float> &, int, const cocos2d::Mesh::IndexArray &, int, const std::vector<MeshVertexAttrib> &, int)
- Rename
getGLProgramState
togetProgramState
. - Rename
setGLProgramState
tosetProgramState
. - Remove
getMeshCommand
- Added
setVertexLayout
cocos2d::Node
- Remove
, useboundingBox
getBoundingBox
instead. - Remove
getGLProgram
- Rename ~~
getGLProgramState
togetProgramState
. - Remove
getGLServerState
- Remove
, usegetRotationX
getRotationSkewX
instead - Remove
, usegetRotationY
getRotationSkewY
instead - Remove
getShaderProgram
- Remove
, usegetVertexZ
getPositionZ
instead - Remove
, usegetZOrder
getLocalZOrder
instead - Remove
, usingignoreAnchorPointForPosition
isIgnoreAnchorPointForPosition
- Remove
, usenodeToParentTransform
getNodeToParentTransform
instead - Remove
, usenodeToWorldTransform
getNodeToWorldTransform
instead - Remove
, usenumberOfRunningActions
getNumberOfRunningActions
instead - Remove
, useparentToNodeTransform
getParentToNodeTransform
instead - Remove
pauseSchedulerAndActions
- Rename ~~
setGLProgramState
tosetProgramState
. - Remove
setGLProgram
- Remove
setGLServerState
- Remove
, usesetRotationX
setRotationSkewX
instead - Remove
, usesetRotationY
setRotationSkewY
instead - Remove
setShaderProgram
- Remove
, usesetVertexZ
setPositionZ
instead - Remove
, usesetZOrder
setLocalZOrder
instead - Remove
unscheduleAllSelectors
- Remove
, usingworldToNodeTransform
getWorldToNodeTransform
cocos2d::ParticleSystem
- Remove
getOpacityModifyRGB
cocos2d::ParticleSystemQuad
- Remove
postStep
cocos2d::Pass
Refactoring
cocos2d::PhysicsShape
- Spell fix
getPolyonCenter
forgetPolygonCenter
- Spell fix
getTriaglesCount
forgetTrianglesCount
cocos2d::PoolManager
- Remove
, usepurgePoolManager
destroyInstance
instead. - Remove
, usesharedPoolManager
getInstance
instead.
Remove class cocos2d::PrimitiveCommand
cocos2d::Profiler
- Remove
, usesharedProfiler
getInstance
instead.
cocos2d::ProgressTimer
- Remove
, usesetReverseProgress
setReverseDirection
instead.
Reimplementing cocos2d::Renderer
- Remove
clear
- Added
clear(cocos2d::ClearFlag, const cocos2d::Color4F &, float, unsigned int, float)
- Added
getClearDepth
- Added
getClearFlag
- Added
getClearStencil
- Added
getColorAttachment
- Added
getCullMode
- Added
getDepthAttachment
- Added
getDepthCompareFunction
- Added
getDepthTest
- Added
getDepthWrite
- Remove
getGroupCommandManager
- Remove
initGLView
- Added
getRenderTargetFlag
- Added
getScissorRect
- Added
getScissorTest
- Added
getStencilAttachment
- Added
getStencilCompareFunction
- Added
getStencilDepthPassOperation
- Added
getStencilFailureOperation
- Added
getStencilPassDepthFailureOperation
- Added
getStencilReadMask
- Added
getStencilReferenceValue
- Added
getStencilTest
- Added
getStencilWriteMask
- Added
getViewport
- Added
getWinding
- Added
init
- Remove
setClearColor
- Added
setCullMode
- Added
setDepthCompareFunction
- Added
setDepthWrite
- Added
setRenderTarget
- Added
setScissorRect
- Added
setScissorTest
- Added
setStencilCompareFunction
- Added
setStencilOperation
- Added
setStencilTest
- Added
setStencilWriteMask
- Added
setViewPort
- Added
setWinding
cocos2d::RenderTexture
- Remove
newCCImage
- Remove
, usenewImage(bool)
newImage(std::function<void (Image *)>, bool)
instead
cocos2d::Scene
- Remove
onEnter
cocos2d::Scheduler
- Remove
isScheduledForTarget
- Remove
scheduleSelector
- Remove
unscheduleSelector
- Remove
unscheduleUpdateForTarget
cocos2d::ScriptEngineManager
- Remove
, usepurgeSharedManager
destroyInstance
instead. - Remove
, usesharedManager
getInstance
instead.
cocos2d::Sprite
- Remove
, usedisplayFrame
getSpriteFrame
instead - Remove
, usegetDisplayFrame
getSpriteFrame
instead - Added
getProgramState
- Spell fix
setStrechEnabled
tosetStretchEnabled
- Added
setVertexLayout
- Added
updateShaders
cocos2d::Sprite3D
- Remove
getSkin
- Added
setVertexLayout
- Remove
, usesetGLProgramState
setProgramState
instead - Remove
setGLProgram
cocos2d::Sprite3DMaterial
- Rename
createWithGLStateProgram
tocreateWithProgramState
.
cocos2d::SpriteFrameCache
- Remove
, usepurgeSharedSpriteFrameCache
destroyInstance
instead. - Remove
, usesharedSpriteFrameCache
getInstance
instead. - Remove
, usespriteFrameByName
getSpriteFrameByName
instead.
cocos2d::Technique
- Rename
createWithGLProgramState
tocreateWithProgramState
. - Added
getStateBlock
- Added
setMaterial
cocos2d::Texture2D
Refactoring
- Remove
UsedefaultAlphaPixelFormat
getDefaultAlphaPixelFormat
instead. - Remove
, usebitsPerPixelForFormat()
getBitsPerPixelForFormat
instead. - Signature change
drawAtPoint(const cocos2d::Vec2 &, float)
- Signature change
drawInRect(const cocos2d::Rect &, float)
- Added
getBackendTexture()
- Remove
getDescription()
- Remove
getGLProgram()
- Remove
getName()
- Remove
initWithData(const void *, ssize_t, Texture2D::PixelFormat, int, int, const cocos2d::Size &)
- Remove
initWithImage(cocos2d::Image *, cocos2d::Texture2D::PixelFormat)
- Added
initWithBackendTexture(backend::TextureBackend *)
- Added
initWithData(const void *, ssize_t, backend::PixelFormat, backend::PixelFormat, int, int, const cocos2d::Size &)
- Added
initWithData(const void *, ssize_t, backend::PixelFormat, int, int, const cocos2d::Size &)
- Added
initWithImage(cocos2d::Image *, backend::PixelFormat)
- Remove
initWithMipmaps(cocos2d::MipmapInfo *, int, Texture2D::PixelFormat, int, int)
- Added
initWithMipmaps(cocos2d::MipmapInfo *, int, backend::PixelFormat, backend::PixelFormat, int, int)
- Remove
releaseGLTexture()
- Added
isRenderTarget()
- Remove
setGLProgram(cocos2d::GLProgram *)
- Added
setRenderTarget(bool)
- Remove
, usestringForFormat()
getStringForFormat
instead.
cocos2d::TextureAtlas
- Remove
drawNumberOfQuads
- Remove
drawQuads
- Added
getIndices
- Remove
listenRendererRecreated
cocos2d::TextureCache
- Remove
, accessed viadestroyInstance
Director
. - Remove
, accessed viagetInstance
Director
. - Remove
purgeSharedTextureCache
- Remove
reloadAllTextures
- Remove
sharedTextureCache
- Remove
, useaddUIImage
addImage
instead. - Remove
, usetextureForKey
getTextureForKey
instead.
cocos2d::TextureCube
- Added
getBackendTexture
cocos2d::TiledGrid3D
- Remove
, useoriginalTile
getOriginalTile
instead. - Remove
, usetile
getTile
instead.
cocos2d::TileMapAtlas
- Remove
, usetileAt
getTileAt
instead.
cocos2d::TMXLayer
- Remove
, usepositionAt
getPositionAt
instead. - Remove
, usepropertyNamed
getProperty
instead. - Remove
, usetileAt
getTileAt
instead. - Remove
, usetileGIDAt
getTileGIDAt
instead.
cocos2d::TMXMapInfo
- Remove
, useformatWithTMXFile
create
instead. - Remove
, useformatWithXML
createWithXML
instead. - Remove
, usegetStoringCharacters
isStoringCharacters
instead.
cocos2d::TMXObjectGroup
- Remove
, useobjectNamed
getObject
instead. - Remove
, usepropertyNamed
getProperty
instead.
cocos2d::TMXTiledMap
- Remove
, uselayerNamed
getLayer
instead. - Remove
, useobjectGroupNamed
getObjectGroup
instead. - Remove
, usepropertiesForGID
getPropertiesForGID
instead. - Remove
, usepropertyNamed
getProperty
instead.
Remove class cocos2d::UniformValue
cocos2d::UserDefault
- Remove
, usepurgeSharedUserDefault
destroyInstance
instead. - Remove
, usesharedUserDefault
getInstance
instead.
cocos2d::ZipUtils
- Remove
, useccInflateCCZBuffer
inflateCCZBuffer
instead. - Remove
, useccInflateCCZFile
inflateCCZFile
instead. - Remove
, useccInflateGZipFile
inflateGZipFile
instead. - Remove
, useccInflateMemory
inflateMemory
instead. - Remove
, useccInflateMemoryWithHint
inflateMemoryWithHint
instead. - Remove
, useccIsCCZBuffer
isCCZBuffer
instead. - Remove
, useccIsCCZFile
isCCZFile
instead. - Remove
, useccIsGZipBuffer
isGZipBuffer
instead. - Remove
, useccIsGZipFile
isGZipFile
instead. - Remove
, useccSetPvrEncryptionKey
setPvrEncryptionKey
instead. - Remove
, useccSetPvrEncryptionKeyPart
setPvrEncryptionKeyPart
instead.