V4 API 变更
以下内容列举了主要的(不完全)接口变更
cocos2d::ActionManager
- 移除
, 使用numberOfRunningActionsInTargegetNumberOfRunningActionsInTarget替代.
cocos2d::Animate3D
- 移除
getPlayBack - 移除
setPlayBack
cocos2d::Animation
- 重命名
addSpriteFrameWithFileName为addSpriteFrameWithFile.
cocos2d::Animation3D
- 移除
, 使用getOrCreatecreate替代.
cocos2d::AnimationCache
- 移除
, 使用purgeSharedAnimationCachedestroyInstance替代. - 移除
, 使用sharedAnimationCachegetInstance替代. - 移除
, 使用animationByNamegetAnimation替代. - 移除
, 使用removeAnimationByNameremoveAnimation替代.
cocos2d::AsyncTaskPool
- 拼写修复
destoryInstance为destroyInstance
替换 GLProgram & GLProgramState 为 Program & ProgramState
移除 类 cocos2d::BatchCommand
新增 类 cocos2d::CallbackCommand
cocos2d::CallFunc
- 移除
create(cocos2d::Ref *, cocos2d::SEL_CallFunc) - 移除
, 使用initWithTargetinitWithFunction替代 - 移除
setTargetCallback
cocos2d::CallFuncN
- 移除
create(cocos2d::Ref *, cocos2d::SEL_CallFuncN) - 移除
initWithTarget
cocos2d::Camera 重构
- 移除
applyFrameBufferObject - 移除
restore - 移除
restoreFrameBufferObject - 移除
restoreViewport - 移除
setFrameBufferObject - 移除
, 通过setViewportRenderer访问
新增 类 cocos2d::CaptureScreenCallbackCommand
cocos2d::Clonable
- 移除
copy
cocos2d::Configuration
- 移除
, 使用purgeConfigurationgetInstance替代. - 移除
, 使用sharedConfigurationdestroyInstance替代. - 新增
getMaxAttributes
cocos2d::RenderCommand 重构
cocos2d::TriangleCommand 重构
cocos2d::CustomCommand 重构
cocos2d::MeshCommand 重构
cocos2d::Director
- 移除
, 使用sharedDirectorgetInstance替代. - 移除
getClearColor - 移除
, 通过getProjectionMatrixCamera访问 - 移除
getProjectionMatrixStackSize - 移除
initProjectionMatrixStack - 移除
loadProjectionIdentityMatrix - 移除
loadProjectionMatrix - 移除
multiplyProjectionMatrix - 移除
popProjectionMatrix - 移除
pushProjectionMatrix - 移除
, 通过setAlphaBlendingRenderer访问 - 移除
, 通过setDepthTestRenderer访问
cocos2d::DrawNode
- 移除
drawQuadraticBezier
移除 类 cocos2d::experimental::FrameBuffer
移除 类 cocos2d::experimental::RenderTargetBase
移除 类 cocos2d::experimental::RenderTargetDepthStencil
移除 类 cocos2d::experimental::RenderTargetRenderBuffer
cocos2d::FileUtils
- 移除
, 使用purgeFileUtilsdestroyInstance替代. - 移除
, 使用sharedFileUtilsgetInstance替代. - 移除
, 使用getFileDatagetDataFromFile替代.
cocos2d::Follow
- 拼写修复
setBoudarySet为setBoundarySet
cocos2d::Font
- 移除
getHorizontalKerningForTextUTF16
cocos2d::GLView
- 移除
getVR - 移除
pollInputEvents - 移除
setCursor - 移除
setDefaultCursor - 移除
setVR
cocos2d::Grid3D
- 移除
, 使用originalVertexgetOriginalVertex替代. - 移除
, 使用vertexgetVertex替代.
cocos2d::GridBase
- 移除
create(const cocos2d::Size &, cocos2d::Texture2D *, bool) - 移除
create(const cocos2d::Size &)
cocos2d::Image
- 重命名
getRenderFormat为getPixelFormat. - 移除
, 使用isPremultipliedAlphahasPremultipliedAlpha替代. - 重命名
premultiplyAlpha为premultipliedAlpha. - 移除
reversePremultipliedAlpha
cocos2d::IMEDispatcher
- 移除
isAnyDelegateAttachedWithIME
移除 类 cocos2d::IndexBuffer
cocos2d::Label
- 移除
create(const std::string &, const std::string &, float, const cocos2d::Size &, cocos2d::TextHAlignment, cocos2d::TextVAlignment) - 移除
, 使用getCommonLineHeightgetLineHeight替代. - 移除
getFontDefinition - 移除
setFontDefinition - 新增
setProgramState
cocos2d::Layer
- 移除
, 使用ccTouchBeganonTouchBegan替代. - 移除
, 使用ccTouchCancelledonTouchCancelled替代. - 移除
, 使用ccTouchEndedonTouchEnded替代. - 移除
, 使用ccTouchesBeganonTouchesBegan替代. - 移除
, 使用ccTouchesCancelledonTouchesCancelled替代. - 移除
, 使用ccTouchesEndedonTouchesEnded替代. - 移除
, 使用ccTouchesMovedonTouchesMoved替代. - 移除
, 使用ccTouchMovedonTouchMoved替代. - 移除
didAccelerate - 移除
isAccelerometerEnabled - 移除
isKeyboardEnabled - 移除
isKeypadEnabled - 移除
isSwallowsTouches - 移除
isTouchEnabled - 移除
, 使用keyBackClickedonKeyReleased替代. - 移除
, 使用keyMenuClickedonKeyReleased替代. - 移除
, 使用keyPressedonKeyPressed替代. - 移除
, 使用keyReleasedonKeyReleased替代. - 移除
registerWithTouchDispatcher - 移除
setAccelerometerEnabled - 移除
setAccelerometerInterval - 移除
setKeyboardEnabled - 移除
setKeypadEnabled - 移除
setSwallowsTouches - 移除
setTouchEnabled - 移除
setTouchMode
移除 类 cocos2d::LabelBMFont
移除 类 cocos2d::LabelTTF
cocos2d::Material
- 重命名
createWithGLStateProgram为createWithProgramState. - 新增
createWithProgramState - 新增
getRenderState - 新增
getStateBlock - 新增
setStateBlock
cocos2d::MenuItem
- 移除
create(cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
initWithTarget
cocos2d::MenuItemAtlasFont
- 移除
create(const std::string &, const std::string &, int, int, char, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
initWithString
cocos2d::MenuItemFont
- 移除
create(const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
, 使用fontNamegetFontName替代. - 移除
, 使用fontSizegetFontSize替代. - 移除
, 使用fontNameObjgetFontNameObj替代. - 移除
, 使用fontSizeObjgetFontSizeObj替代. - 移除
initWithString(const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemImage
- 移除
create(const std::string &, const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
create(const std::string &, const std::string &, const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
initWithNormalImage(const std::string &, const std::string &, const std::string &, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemLabel
- 移除
create(cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
initWithLabel(cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemSprite
- 移除
create(cocos2d::Node *, cocos2d::Node *, cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
create(cocos2d::Node *, cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler) - 移除
initWithNormalSprite(cocos2d::Node *, cocos2d::Node *, cocos2d::Node *, cocos2d::Ref *, cocos2d::SEL_MenuHandler)
cocos2d::MenuItemToggle
- 移除
createWithTarget(cocos2d::Ref *, cocos2d::SEL_MenuHandler, cocos2d::MenuItem *, ..) - 移除
createWithTarget(cocos2d::Ref *, cocos2d::SEL_MenuHandler, const Vector<cocos2d::MenuItem *> &) - 移除
initWithTarget(cocos2d::Ref *, cocos2d::SEL_MenuHandler, cocos2d::MenuItem *, __va_list_tag *) - 移除
, 使用selectedItem()getSelectedItem替代.
cocos2d::Mesh
- 移除
create(const std::vector<float> &, int, const cocos2d::Mesh::IndexArray &, int, const std::vector<MeshVertexAttrib> &, int) - 重命名
getGLProgramState为getProgramState. - 重命名
setGLProgramState为setProgramState. - 移除
getMeshCommand - 新增
setVertexLayout
cocos2d::Node
- 移除
, 使用boundingBoxgetBoundingBox替代. - 移除
getGLProgram - 重命名
getGLProgramState为getProgramState. - 移除
getGLServerState - 移除
, 使用getRotationXgetRotationSkewX替代 - 移除
, 使用getRotationYgetRotationSkewY替代 - 移除
getShaderProgram - 移除
, 使用getVertexZgetPositionZ替代 - 移除
, 使用getZOrdergetLocalZOrder替代 - 移除
, 使用ignoreAnchorPointForPositionisIgnoreAnchorPointForPosition - 移除
, 使用nodeToParentTransformgetNodeToParentTransform替代 - 移除
, 使用nodeToWorldTransformgetNodeToWorldTransform替代 - 移除
, 使用numberOfRunningActionsgetNumberOfRunningActions替代 - 移除
, 使用parentToNodeTransformgetParentToNodeTransform替代 - 移除
pauseSchedulerAndActions - 重命名
setGLProgramState为setProgramState. - 移除
setGLProgram - 移除
setGLServerState - 移除
, 使用setRotationXsetRotationSkewX替代 - 移除
, 使用setRotationYsetRotationSkewY替代 - 移除
setShaderProgram - 移除
, 使用setVertexZsetPositionZ替代 - 移除
, 使用setZOrdersetLocalZOrder替代 - 移除
unscheduleAllSelectors - 移除
, 使用worldToNodeTransformgetWorldToNodeTransform
cocos2d::ParticleSystem
- 移除
getOpacityModifyRGB
cocos2d::ParticleSystemQuad
- 移除
postStep
cocos2d::Pass 重构
cocos2d::PhysicsShape
- 拼写修复
getPolyonCenter为getPolygonCenter - 拼写修复
getTriaglesCount为getTrianglesCount
cocos2d::PoolManager
- 移除
, 使用purgePoolManagerdestroyInstance替代. - 移除
, 使用sharedPoolManagergetInstance替代.
移除 类 cocos2d::PrimitiveCommand
cocos2d::Profiler
- 移除
, 使用sharedProfilergetInstance替代.
cocos2d::ProgressTimer
- 移除
, 使用setReverseProgresssetReverseDirection替代.
重新实现 cocos2d::Renderer
- 移除
clear - 新增
clear(cocos2d::ClearFlag, const cocos2d::Color4F &, float, unsigned int, float) - 新增
getClearDepth - 新增
getClearFlag - 新增
getClearStencil - 新增
getColorAttachment - 新增
getCullMode - 新增
getDepthAttachment - 新增
getDepthCompareFunction - 新增
getDepthTest - 新增
getDepthWrite - 移除
getGroupCommandManager - 移除
initGLView - 新增
getRenderTargetFlag - 新增
getScissorRect - 新增
getScissorTest - 新增
getStencilAttachment - 新增
getStencilCompareFunction - 新增
getStencilDepthPassOperation - 新增
getStencilFailureOperation - 新增
getStencilPassDepthFailureOperation - 新增
getStencilReadMask - 新增
getStencilReferenceValue - 新增
getStencilTest - 新增
getStencilWriteMask - 新增
getViewport - 新增
getWinding - 新增
init - 移除
setClearColor - 新增
setCullMode - 新增
setDepthCompareFunction - 新增
setDepthWrite - 新增
setRenderTarget - 新增
setScissorRect - 新增
setScissorTest - 新增
setStencilCompareFunction - 新增
setStencilOperation - 新增
setStencilTest - 新增
setStencilWriteMask - 新增
setViewPort - 新增
setWinding
cocos2d::RenderTexture
- 移除
newCCImage - 移除
, 使用newImage(bool)newImage(std::function<void (Image *)>, bool)替代
cocos2d::Scene
- 移除
onEnter
cocos2d::Scheduler
- 移除
isScheduledForTarget - 移除
scheduleSelector - 移除
unscheduleSelector - 移除
unscheduleUpdateForTarget
cocos2d::ScriptEngineManager
- 移除
, 使用purgeSharedManagerdestroyInstance替代. - 移除
, 使用sharedManagergetInstance替代.
cocos2d::Sprite
- 移除
, 使用displayFramegetSpriteFrame替代 - 移除
, 使用getDisplayFramegetSpriteFrame替代 - 新增
getProgramState - 拼写修复
setStrechEnabled为setStretchEnabled - 新增
setVertexLayout - 新增
updateShaders
cocos2d::Sprite3D
- 移除
getSkin - 新增
setVertexLayout - 移除
, 使用setGLProgramStatesetProgramState替代 - 移除
setGLProgram
cocos2d::Sprite3DMaterial
- 重命名
createWithGLStateProgram为createWithProgramState.
cocos2d::SpriteFrameCache
- 移除
, 使用purgeSharedSpriteFrameCachedestroyInstance替代. - 移除
, 使用sharedSpriteFrameCachegetInstance替代. - 移除
, 使用spriteFrameByNamegetSpriteFrameByName替代.
cocos2d::Technique
- 重命名
createWithGLProgramState为createWithProgramState. - 新增
getStateBlock - 新增
setMaterial
cocos2d::Texture2D 重构
- 移除
使用defaultAlphaPixelFormatgetDefaultAlphaPixelFormat替代. - 移除
, 使用bitsPerPixelForFormat()getBitsPerPixelForFormat替代. - 签名变更
drawAtPoint(const cocos2d::Vec2 &, float) - 签名变更
drawInRect(const cocos2d::Rect &, float) - 新增
getBackendTexture() - 移除
getDescription() - 移除
getGLProgram() - 移除
getName() - 移除
initWithData(const void *, ssize_t, Texture2D::PixelFormat, int, int, const cocos2d::Size &) - 移除
initWithImage(cocos2d::Image *, cocos2d::Texture2D::PixelFormat) - 新增
initWithBackendTexture(backend::TextureBackend *) - 新增
initWithData(const void *, ssize_t, backend::PixelFormat, backend::PixelFormat, int, int, const cocos2d::Size &) - 新增
initWithData(const void *, ssize_t, backend::PixelFormat, int, int, const cocos2d::Size &) - 新增
initWithImage(cocos2d::Image *, backend::PixelFormat) - 移除
initWithMipmaps(cocos2d::MipmapInfo *, int, Texture2D::PixelFormat, int, int) - 新增
initWithMipmaps(cocos2d::MipmapInfo *, int, backend::PixelFormat, backend::PixelFormat, int, int) - 移除
releaseGLTexture() - 新增
isRenderTarget() - 移除
setGLProgram(cocos2d::GLProgram *) - 新增
setRenderTarget(bool) - 移除
, 使用stringForFormat()getStringForFormat替代.
cocos2d::TextureAtlas
- 移除
drawNumberOfQuads - 移除
drawQuads - 新增
getIndices - 移除
listenRendererRecreated
cocos2d::TextureCache
- 移除
, 通过destroyInstanceDirector访问. - 移除
, 通过getInstanceDirector访问. - 移除
purgeSharedTextureCache - 移除
reloadAllTextures - 移除
sharedTextureCache - 移除
, 使用addUIImageaddImage替代. - 移除
, 使用textureForKeygetTextureForKey替代.
cocos2d::TextureCube
- 新增
getBackendTexture
cocos2d::TiledGrid3D
- 移除
, 使用originalTilegetOriginalTile替代. - 移除
, 使用tilegetTile替代.
cocos2d::TileMapAtlas
- 移除
, 使用tileAtgetTileAt替代.
cocos2d::TMXLayer
- 移除
, 使用positionAtgetPositionAt替代. - 移除
, 使用propertyNamedgetProperty替代. - 移除
, 使用tileAtgetTileAt替代. - 移除
, 使用tileGIDAtgetTileGIDAt替代.
cocos2d::TMXMapInfo
- 移除
, 使用formatWithTMXFilecreate替代. - 移除
, 使用formatWithXMLcreateWithXML替代. - 移除
, 使用getStoringCharactersisStoringCharacters替代.
cocos2d::TMXObjectGroup
- 移除
, 使用objectNamedgetObject替代. - 移除
, 使用propertyNamedgetProperty替代.
cocos2d::TMXTiledMap
- 移除
, 使用layerNamedgetLayer替代. - 移除
, 使用objectGroupNamedgetObjectGroup替代. - 移除
, 使用propertiesForGIDgetPropertiesForGID替代. - 移除
, 使用propertyNamedgetProperty替代.
移除 类 cocos2d::UniformValue
cocos2d::UserDefault
- 移除
, 使用purgeSharedUserDefaultdestroyInstance替代. - 移除
, 使用sharedUserDefaultgetInstance替代.
cocos2d::ZipUtils
- 移除
, 使用ccInflateCCZBufferinflateCCZBuffer替代. - 移除
, 使用ccInflateCCZFileinflateCCZFile替代. - 移除
, 使用ccInflateGZipFileinflateGZipFile替代. - 移除
, 使用ccInflateMemoryinflateMemory替代. - 移除
, 使用ccInflateMemoryWithHintinflateMemoryWithHint替代. - 移除
, 使用ccIsCCZBufferisCCZBuffer替代. - 移除
, 使用ccIsCCZFileisCCZFile替代. - 移除
, 使用ccIsGZipBufferisGZipBuffer替代. - 移除
, 使用ccIsGZipFileisGZipFile替代. - 移除
, 使用ccSetPvrEncryptionKeysetPvrEncryptionKey替代. - 移除
, 使用ccSetPvrEncryptionKeyPartsetPvrEncryptionKeyPart替代.