【版本发布】Cocos2d-x v3.9RC0 发布

以下是3.9 RC0版本的亮点提要与API的变化:

3D模块:
功能 3D MotionStreak,支持拖尾效果。
优化 Sprite3D支持材质系统
2D模块:
功能 增加帧回调函数和动画回调函数
功能 新增脚本组件系统
功能 使用Component重构2D物理组件
功能 EditBox:优化iOS和Win32平台的实现,统一与Android平台的表现
优化 移除AssetsManager,AssetsManagerEx和Downloader对curl的依赖
优化 优化粒子性能
其他:
功能 JSB,Action支持继承,重写update函数
优化 Web引擎的ScrollView性能优化
优化 Web引擎九宫格精灵性能优化
优化 H5 分离并整理setTexture和updateColor的耦合
功能 支持Xcode 7和iOS 9真机调试发布

下载地址:
国内链接:http://www.cocos2d-x.org/filedown/cocos2d-x-3.9beta0.ziphttp://cocostudio.download.appget.cn/Cocos2D-X/cocos2d-x-3.9RC0.zip,1http://www.cocos2d-x.org/filedown/cocos2d-x-3.9beta0.zip
此包包含c++、js、lua

主要功能详述:

3DMotionStreak
支持3D拖拽效果。增加MotionStreak3D类。详细使用可以查看Sprite3Dtest测试示例。

Sprite3D
支持材质系统
新增Sprite3Dmaterial类,方便内置材质的创建。

增加帧回调函数和动画回调函数
ActionTimelineData类增加addFrameEndCallFunc, removeFrameEndCallclearFrameEndCalls接口,方便添加、移除特定帧事件。

脚本组件
脚本组件用来扩展C++节点,你可以给一个节点添加脚本组件,然后在脚本组件中可以接收onEnter, onExit和update事件。下面是Lua示例代码:






auto luaComponent =ComponentLua::create("player.lua");player->addComponent(luaComponent); ``````lua // player.lualocal player = { onEnter = function(self)-- do some things in onEnter endonExit =function(slef)-- do some things in onExitendupdate =function(self)-- do some things every frameend
--it is needed to return player to let c++ nodes know it return player ```
Javascript可以使用相同的方式,只需要使用ComponentJS替换ComponentLua。
在lua组件和javascript组件间有一些区别:
l 在lua脚本中,需要返回lua组件对象,在Javascript脚本中,只需要继承自cc.ComponentJS
l Lua组件只能在Lua项目中使用, Javascript组件只能在Javascript项目中使用。
更多的详细信息请查看ests/lua-tests/src/ComponentTest和tests/js-tests/src/ComponentTest示例项目。
 

2D
物理组件
 在3.9版本之前,在Node类身上有很多物理系统相关的函数,比如Node:setPhysicsBody()。在3.9版本中,这些代码都被统一移动到物理组件中。
 使用物理组件后,使用物理系统的方式发生了改变。在3.9版本之前,如下使用物理系统。
auto node = Node::create();node->setPhysicsBody(PhysicsBody::createEdgeBox(...));
在3.9版本中,使用下面的方式:
auto node = Node::create(); node->addComponent(PhysicsBody::createEdgeBox(...));
 

EditBox
优化,iOS
和Win32
平台
  1.弹出框的输入长度限制
2.弹出框支持密文输入
3.弹出框不阻塞游戏进程
4.实时同步弹出框的输入内容
 

移除AssetsManager,AssetsManagerEx
和Downloader
对curl
的依赖
 从v3.9开始,iOS版本和Android版本将不再依赖libcurl,这使得游戏的发布包进一步减小,并且也解决了一些由libcurl引入的bug,尤其是对于热更新功能,现在通过使用iOS和Android系统库,进一步提升了其稳定性
 

JSB  Action
支持继承,重写update
函数
 在旧版本的JSB中,开发者不可以在JS脚本中继承Action /ActionInterval / ActionInstant等Action类,因为其update函数的重写不会被调用,在v3.9中,这个问题已经被解决了,开发者可以自由得写出Action的子类,并扩展其功能。关于如何编写可以参考ActionTest / ActionCustomTest测试例中的用法
 
 

Web
引擎的ScrollView
性能优化
Web引擎中,ScrollView, ListView是大量被使用的UI控件,但在之前的版本,他们的性能不够优秀,尤其是当其子控件非常多的时候。在v3.9中,我们优化了它的渲染性能,只会绘制当前屏幕上可见的内容,不可见内容已经全部被剔除。测试数据显示,这在不同设备和浏览器上,v3.9的渲染效率是v3.8的两倍到四倍。
 

Web
引擎九宫格精灵性能优化

 将以往使用节点拼接方式构建九宫格精灵改为了使用九个渲染指令,降低了内存使用,提升渲染性能
 

Web引擎解除Sprite的setTexture和updateColor的耦合
1. 将Sprite里面的部分渲染逻辑清理出来,updateColor由纹理自己完成,而不需要逻辑节点Sprite去执行具体的绘制工作。
2. 修复旧的4色图更改颜色全黑状态下和新版本的颜色更新差异问题。
3. 优化纹理更新逻辑:
    原纹理更新逻辑是:setTexture的时候存入_texture,当用户改变颜色的时候,将现有纹理存入_originalTexture,并且将新的纹理放入_texture。频繁的替换纹理,非常容易造成纹理错误等。新的纹理机制是:setTexture的时候存入_texture,并且生成_renderTexture变量指向_texture,当颜色更新等操作的时候,只需要修改_renderTexture(分离了用户操作纹理和引擎内部操作纹理的耦合),不需要一直替换_texture。
4. 稍微优化了SpriteCanvas内部rendering的if else等逻辑
5. 合并了部分引擎内的重复UpdateColor代码
 

支持Xcode 7
和iOS 9
真机调试发布
 在v3.8.1版本中,Cocos工程已经可以在Xcode 7上编译并在模拟器中调试,然而对于iOS 9真机调试还遗留一个小bug,在v3.9中,已经彻底解决了iOS 9真机调试的问题。
 

其他变化
           Label: Added line spacing/leadingfeature to Label.
           ListView: Added APIs to scroll tospecific item in list.
           ListView: Added APIs to get an itemin specific position like center, leftmost, rightmost, topmost and bottommost.
           ListView: Added a feature formagnetic scrolling.
           Animate: AddedActionTimeline::setAnimationEndCallBack and ActionTimeline::addFrameEndCallFunc.
           Animate: AddedCSLoader::createNodeWithVisibleSize, CSLoader::createNodeWithVisibleSize andmoved "ui::Helper::DoLayout" into them.
           Stuio: Added support for CocosStudio Light3D.
           Platform: Added the missing CURLsupport to the Windows 10 UWP version.
           Platform: Added UIEditBox support onlinux platform.
        3D: Added non-null checks inPUScriptCompiler::visit before dereferencing.
        3D: Refined SkyboxBrush by making theshader parameter take effect at once.
        Label: Changed label font size type tofloat to support high precision when font size is small.
        ListView: Fixed an issue that listview's Magnetic::CENTER is not working well when non-bounceable.
        ListView: Added feature of jumping to aspecific item in list view.
        Sprite: Added "a unsupport imageformat!" log when creating a sprite in CCImage.cpp.
        ScrollView: Merge logics of Scroll Viewfor scroll by inertia and auto scroll into one.
        Animate: Moved initialization of imageto an appropriate location, because it always called twice inSpriteFrameCache::addSpriteFramesWithFile().
        Simulator: Changed the size ofstartFlag to 13.
        Simulator: Show Node and Skeleton inthe middle of the simulator.
        Simulator: Removed screen directioncheck in simulator to avoid render error.
        Pysics: Refined components to improve physicsperformance.
        UI: Refined ComponentContainer toimprove performance.
        UI: EventListenerMouse will dispatchEventMouse events.
        OpenGL: Added check forglfwCreateWindow.
        Platform: Fixed a crash on xiaomi2 ifCocos2d-x is built as a dynamic library.
        Platform: Updated libcococs2d name tov3.9 on WinRT platforms.
        Platform: Added some support for mouseon WinRT. Include: Show/Hide mouse cursor; Mouse event implemented similarDesktop version; Left button send mouse event      and touch;Support other mousebutton and scroll wheel.
        Platform: Correct the convertionbetween unicode and utf8 on WinRT.
        Platform: Improved EditBox implement onWin32 platform.
        JS: Addjsb.fileUtils.writeDataToFile().
        JS: Set js templates Mac targetplatform from null to 10.7.
        JS: Removed the static define ofvariable in headfile of ScriptingCore.
        Lua: Added AssetsManagerEx constantsUPDATE_FAILED and ERROR_DECOMPRESS in Lua.
        Lua / JS: Refined lua/js binding tool.
        I/O: Refined AssetsManagerEx unzippingby using async.
        Web: Improved logic of jsb_boot.js to syncwith the web engine behavior.
        Web: Sync with CCBoot for web.
        Build: Fixed various compiler warningson Xcode 7.
        Build: Fixed Wformat-security warningon Xcode.
        Build: Fixed a compile error in__LayerRGBA.
        Tool: Added tools for generatingdocuments automatically.
        Doc: Clean up the code of setRect()function.
        Doc: Fixed a minor typo and renamedINTIAL_CAPS_ALL_CHARACTERS to INITIAL_CAPS_ALL_CHARACTERS in UIEditBox.
你也可以在https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG这里查看全部变化.
 

NEW APIS
 

脚本组件模块
 添加ComponentLua和ComponentJS组件类,方便添加Lua,JS脚本。    
 

3D MotionStreak
 增加MotionStreak3D类,查看https://github.com/cocos2d/cocos2d-x/pull/13647/files, 提供3D拖尾效果支持。
 

JSB模块
 增加cc.fileUtils.writeDataToFile,查看https://github.com/cocos2d/cocos2d-x/pull/13726https://github.com/cocos2d/cocos2d-x/pull/13726


Spritedebug draw功能
ccConfig.h中的增加#defineCC_SPRITE_DEBUG_DRAW,设置为1开启Debug框绘制


Sprite3D支持材质系统
新增Sprite3Dmaterial类,方便内置材质的创建。


ActionTimelineData新增接口
ActionTimeline::removeFrameEndCallFunc addFrameEndCallFunc,removeFrameEndCall clearFrameEndCalls


ListView新增接口:
1 支持直接滚动到特定的列表项。
2 支持获取特定位置的项,如中心,最左,最右,最上,最下。
3 添加滚动吸附功能。
详细查看https://github.com/cocos2d/cocos2d-x/pull/13723


CCNode,补充遗漏的接口
getChildByTag


Label新增接口
setLineSpacing,getLineSpacing


CSLoader新增接口
createNodeWithVisibleSize,createNodeWithVisibleSize

CCComponentContainer
 
移除isEmpty()接口.


CCSprite类
移除原来的debugDraw(bool on);

终于有更新了

看不出来和beta0有啥区别啊。。不要说是复制过来的。。

change log里面没有rc0的记录。意思这个版本和beta0一模一样咯?

正式版还要多久呢

正式版何时发布?

什么时候可以加入3D touch相关的内容?

label 没有html 啊 这么基础的功能怎么就不做

使用了一下,和beta0一样,完全没法用,引入太多bug了,以前重要的bug也没解。
随便说几条:
1.)partical system 2d性能说是解决了,我对比过3.8,3.9同一个粒子特效,竟然粒子减少了,这叫性能优化?
2.)AssetsManger 说是移除了libcurl,但无法下载https的资源。 -
3.)Listview的性能问题,之前在英文论坛提及,竟然说不知道有这个问题。

我就不说手机发热严重,耗电太多这类问题。

蛋蛋的忧伤。。。。。。。。。。

— Begin quote from ____

引用第9楼yixiaoqingyuz于2015-11-08 09:15发表的 回 8楼(joe_tang) 的帖子 :
蛋蛋的忧伤。。。。。。。。。。 http://www.cocoachina.com/bbs/job.php?action=topost&tid=330580&pid=1429922

— End quote

老项目维护真心没办法。
新项目上unity了

1.)partical system 2d性能说是解决了,我对比过3.8,3.9同一个粒子特效,竟然粒子减少了,这叫性能优化?

粒子减少?能否提供相关数据或者说明?或者粒子文件?粒子的性能优化,主要是优化内存排布,降低cache miss,并没有涉及粒子的数量变更。

— Begin quote from ____

引用第8楼joe_tang于2015-11-07 05:59发表的 :
使用了一下,和beta0一样,完全没法用,引入太多bug了,以前重要的bug也没解。
随便说几条:
1.)partical system 2d性能说是解决了,我对比过3.8,3.9同一个粒子特效,竟然粒子减少了,这叫性能优化?
2.)AssetsManger 说是移除了libcurl,但无法下载https的资源。 -
3.)Listview的性能问题,之前在英文论坛提及,竟然说不知道有这个问题。
http://www.cocoachina.com/bbs/job.php?action=topost&tid=330580&pid=1429502

— End quote

1.)partical system 2d性能说是解决了,我对比过3.8,3.9同一个粒子特效,竟然粒子减少了,这叫性能优化?

优化的任务见:https://github.com/cocos2d/cocos2d-x/pull/13716

2.)AssetsManger 说是移除了libcurl,但无法下载https的资源。

谢谢,这个问题我们已经记录:https://github.com/cocos2d/cocos2d-x/issues/14309

3)Listview的性能问题,之前在英文论坛提及,竟然说不知道有这个问题。

这个版本的ListView性能优化是在Web引擎当中,可以参考下面的github任务:

https://github.com/cocos2d/cocos2d-x/issues/13959
https://github.com/cocos2d/cocos2d-x/pull/13962

至于Native的优化,有一个计划是reuse list item,不过这个版本没有时间完成所以延后了,社区也已经有了解决方案提交,不过我们需要再多花一些时间审核

另外,可以详细说下新引入的bug吗?

— Begin quote from ____

引用第12楼fysp于2015-11-09 12:08发表的 :

1.)partical system 2d性能说是解决了,我对比过3.8,3.9同一个粒子特效,竟然粒子减少了,这叫性能优化?

优化的任务见:https://github.com/cocos2d/cocos2d-x/pull/13716
http://www.cocoachina.com/bbs/job.php?action=topost&tid=330580&pid=1430617

— End quote

好的,版主来了。
1.) 我提供个附件,你可以测试一下在3.8, 3.9上的差异。我没看pr代码,但表现的确如此。
3.) 有计划表么?
措辞比较激烈,望见谅。
v3.9没在用,等空了详细测试下再把手头一些一块放上来

楼主,支持XCODE7和IOS 9真机调试可以出一个3.8.1的工程项目吗?现在升级到3.9不太现实啊,能来个3.8.1的补丁吗?

— Begin quote from ____

引用第14楼errorfun于2015-11-09 20:41发表的 :
楼主,支持XCODE7和IOS 9真机调试可以出一个3.8.1的工程项目吗?现在升级到3.9不太现实啊,能来个3.8.1的补丁吗? http://www.cocoachina.com/bbs/job.php?action=topost&tid=330580&pid=1431116

— End quote

需要在游戏工程的project和ios target > Build Settings > Enable Bitcode 选择关闭

发热耗电这是没办法避免的吧,哪个游戏不发热耗电啊。。。。

:6: 我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。我要一键打包。

3.9rc0 有问题。新建立一个工程后,在新工程目录下,使用cocos run -p android
会报未找到配置文件 .cocos-project.json , 新工程目录下有这个隐藏文件,但是这个命令确是在新工程目录的上一级目录去找的。
请版主核实一下。

蛋有点疼。。。。。。