Skip to content

Commit 23f26f2

Browse files
committed
Merge pull request #1247 from pandamicro/develop
Prepare for 3.2 release
2 parents 5c3f0db + f69ac73 commit 23f26f2

File tree

7 files changed

+176
-11
lines changed

7 files changed

+176
-11
lines changed

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Igor Mats @IgorMats Added outline shader sample
6868

6969
G17hao @G17hao Fixed an typo issue in jsb_boot.js
7070

71+
Simon de Lang @simondel Fixed use of deprecated cc, ccs and ccui create functions.
72+
7173
Cocos2d-JS can not grow so fast without the active community.
7274
Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups!
7375
Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.

CHANGELOG

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
ChangeLog:
22

3+
Cocos2d-JS v3.2 @ Dec.29, 2014
4+
5+
* Replaced `transform` function with `setTransform` function under canvas render mode for better performance.
6+
* Added a timer in `cc.audioEngine` to check audio element loading event, prevent the loading process being stucked when load audio file failed.
7+
* Added some new browser types to `cc.sys`.
8+
* Added some audio resource loading codes to ensure compatibility with Wechat browser.
9+
* Added check for WebAudio support to ensure compatibility.
10+
* [JSB]Upgraded Cocos2d-x to v3.3 Final.
11+
* [JSB]Added `getSearchPaths` API to `jsb.Manifest` to support better script hot update.
12+
* [JSB]Polished restart game feature.
13+
* [JSB]Added a sample usage case for `jsb.AssetsManager`'s script hot update ability.
14+
* [JSB]Skipped FlatBuffer related bindings.
15+
* [JSB]Canceled modifications in Spine due to License restriction and removed new constructor for `sp.SkeletonAnimation`.
16+
17+
* Bug fixes:
18+
1. Fixed an issue that `cc.InputManager` doesn't trigger touch event on chrome mobile emulator.
19+
2. Fixed an issue that `cc.game.setFrameRate` doesn't work.
20+
3. Fixed an issue that `cc.view` can't remove resize event listener.
21+
4. Fixed an issue that `cc.EventManager` didn't set register flag to false when a listener is removed.
22+
5. Fixed an issue that `cc.audioEngine` doesn't play some audios on some iOS devices.
23+
6. Fixed an issue of ccui controls that their `setColor` doesn't work when cascade color is enabled.
24+
7. Fixed an issue that `ccs.Armature`'s `setColor` doesn't work in canvas render mode.
25+
8. Fixed an issue that `ccs.Armature` crashes when adding a child to it.
26+
9. Fixed an issue that `cc.SpriteBatchNode`'s status is incorrect in WebGL render mode.
27+
10. Fixed an issue of `cc.Layer` that its position is incorrect under bake mode.
28+
11. Fixed an issue of `ccui.RichText` that its `setContentSize` doesn't work.
29+
12. Fixed an issue of `cc.LabelTTF` that its `setColor` doesn't work when cascade color is enabled.
30+
13. Fixed an issue of spine that its skeletons position is incorrect when scaleX equals to -1 and scaleY equals to 1.
31+
14. Fixed `sp.Skeleton`'s API inconsistence by renaming `boundingBox` to `getBoundingBox`.
32+
15. Removed all usages of deprecated create functions in the test cases.
33+
16. [JSB]Fixed an issue of `ccui.ScrollView`'s `innerWidth` and `innerHeight` properties.
34+
17. [JSB]Fixed an issue that setting `cc.Node`'s userData property will crash.
35+
18. [JSB]Fixed API inconsistence by renaming `jsb.fileUtils`'s `getByteArrayFromFile` to `getDataFromFile`.
36+
19. [JSB]Fixed a script file cache check issue in ScriptingCore.cpp.
37+
20. [JSB]Fixed an issue of `ccs.Armature`'s constructore.
38+
339
Cocos2d-JS v3.2 RC0 @ Dec.11, 2014
440

541
* Refactoration of web engine by separating the render logic, the arthictecture level refactoration is now completed and brounght great performance improvement.

docs/release-note-v3.2rc0.md renamed to docs/release-note-v3.2.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cocos2d-JS v3.2 RC0 release note
1+
# Cocos2d-JS v3.2 release note
22

33
<img src="http://files.cocos2d-x.org/images/orgsite/logo.png" height=180>
44

@@ -28,9 +28,9 @@ For JSB build, there are some restrictions :
2828

2929
## Download
3030

31-
- [Cocos2d-JS v3.2 RC0](http://www.cocos2d-x.org/filedown/cocos2d-js-v3.2-rc0.zip)
31+
- [Cocos2d-JS v3.2](http://www.cocos2d-x.org/filedown/cocos2d-js-v3.2.zip)
3232
- [Online API reference](http://www.cocos2d-x.org/reference/html5-js/V3.0/index.html)
33-
- [Downloadable API Reference](http://www.cocos2d-x.org/filedown/Cocos2d-JS-v3.2-RC0-API.zip)
33+
- [Downloadable API Reference](http://www.cocos2d-x.org/filedown/Cocos2d-JS-v3.2-API.zip)
3434
- [Online test cases](http://cocos2d-x.org/js-tests/)
3535

3636
## Workflows
@@ -45,22 +45,22 @@ For JSB build, there are some restrictions :
4545

4646
Read more about all the features and bug fixes
4747

48-
- [Cocos2d-JS v3.2 RC0 changelog](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2rc0/changelog/en)
49-
- [Cocos2d-JS v3.2 RC0 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2rc0/upgrade-guide/en)
48+
- [Cocos2d-JS v3.2 changelog](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2/changelog/en)
49+
- [Cocos2d-JS v3.2 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2rc0/upgrade-guide/en)
5050

5151
## Upgrade your project from previous versions
5252

53-
If you want to upgrade your game based on v3.0 previous version to the v3.2 RC0 version, you should follow these steps:
53+
If you want to upgrade your game based on v3.x previous version to the v3.2 version, you should follow these steps:
5454

55-
1. Download the Cocos2d-JS v3.2 RC0 package.
55+
1. Download the Cocos2d-JS v3.2 package.
5656
2. Upgrade cocos command with `setup.py`.
5757
3. Create a new project with `cocos new` command.
5858
4. Replace the "src", "res", "index.html", "project.json", "main.js" etc with your old project.
5959
5. Then you may need to refer to the upgrade guide to solve some API change issues.
6060

6161
## About Cocos2d family
6262

63-
- Cocos2d-JS v3.2 RC0 uses Cocos2d-x v3.3rc1 as base of JSB solution
63+
- Cocos2d-JS v3.2 uses Cocos2d-x v3.3 as base of JSB solution
6464
- Cocos2d-JS v3.2 is compatible with Cocos Code IDE v1.1.0
6565
- Cocos2d-JS v3.2 is compatible with Cocos Studio v1.2 - v1.6, Cocos Studio 2 support have been removed because flat buffer binary file can't be parsed in JS, we will support Cocos Studio 2 in v3.3 with a JSON format parser.
6666

docs/upgrade-guide-from-3.1-to-3.2.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#Upgrade guide from Cocos2d-JS v3.1 to Cocos2d-JS v3.2
2+
3+
## 0. Upgrade to Cocos2d-JS v3.1
4+
5+
If you are still using Cocos2d-html5 or previous version of Cocos2d-JS, you need to read the previous upgrade guide first : [Upgrade guide to Cocos2d-JS v3.1](../../v3.0rc0/upgrade-guide/en.md)
6+
7+
## 1. Reduce package size with modulirization in JSB
8+
9+
In Cocos2d-JS v3.2, during compilation, Cocos2d-x modules and related JavaScript Bindings code can be automatically excluded from the final package if they are not used. As you may already know, our web engine support modularization with `modules` section in project.json file. However, this configuration doesn't take effect in JSB, you should do the following to exclude any module you don't need in JSB.
10+
11+
In AppDelegate.cpp, you will find `applicationDidFinishLaunching` function in which all JSB bindings are registered. If the registration code for a module is commented out, then the base Cocos2d-x module won't be used, during linking the linker will exclude it. This is a common optimization in linker, so it will take effect for both Android and iOS apps. Of course, all modules that you don't register their bindings won't be available in your JavaScript code.
12+
13+
At last, you only need to compile your project. The minimum size of Android package in Cocos2d-JS v3.2 is 4.4mb.
14+
15+
```
16+
bool AppDelegate::applicationDidFinishLaunching()
17+
{
18+
// initialize director
19+
auto director = Director::getInstance();
20+
auto glview = director->getOpenGLView();
21+
if(!glview) {
22+
glview = cocos2d::GLViewImpl::createWithRect("Release3_2", Rect(0,0,900,640));
23+
director->setOpenGLView(glview);
24+
}
25+
26+
// set FPS. the default value is 1.0/60 if you don't call this
27+
director->setAnimationInterval(1.0 / 60);
28+
29+
ScriptingCore* sc = ScriptingCore::getInstance();
30+
sc->addRegisterCallback(register_all_cocos2dx);
31+
sc->addRegisterCallback(register_cocos2dx_js_core);
32+
sc->addRegisterCallback(register_cocos2dx_js_extensions);
33+
sc->addRegisterCallback(jsb_register_system);
34+
35+
// extension can be commented out to reduce the package
36+
sc->addRegisterCallback(register_all_cocos2dx_extension);
37+
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
38+
39+
// chipmunk can be commented out to reduce the package
40+
sc->addRegisterCallback(jsb_register_chipmunk);
41+
// opengl can be commented out to reduce the package
42+
sc->addRegisterCallback(JSB_register_opengl);
43+
44+
// builder can be commented out to reduce the package
45+
sc->addRegisterCallback(register_all_cocos2dx_builder);
46+
sc->addRegisterCallback(register_CCBuilderReader);
47+
48+
// ui can be commented out to reduce the package, attension studio need ui module
49+
sc->addRegisterCallback(register_all_cocos2dx_ui);
50+
sc->addRegisterCallback(register_all_cocos2dx_ui_manual);
51+
52+
// studio can be commented out to reduce the package,
53+
sc->addRegisterCallback(register_all_cocos2dx_studio);
54+
sc->addRegisterCallback(register_all_cocos2dx_studio_manual);
55+
56+
// spine can be commented out to reduce the package
57+
sc->addRegisterCallback(register_all_cocos2dx_spine);
58+
sc->addRegisterCallback(register_all_cocos2dx_spine_manual);
59+
60+
// XmlHttpRequest can be commented out to reduce the package
61+
sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
62+
// websocket can be commented out to reduce the package
63+
sc->addRegisterCallback(register_jsb_websocket);
64+
// sokcet io can be commented out to reduce the package
65+
sc->addRegisterCallback(register_jsb_socketio);
66+
67+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
68+
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
69+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
70+
sc->addRegisterCallback(JavaScriptObjCBridge::_js_register);
71+
#endif
72+
sc->start();
73+
sc->runScript("script/jsb_boot.js");
74+
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
75+
ScriptEngineManager::getInstance()->setScriptEngine(engine);
76+
ScriptingCore::getInstance()->runScript("main.js");
77+
78+
return true;
79+
}
80+
```
81+
82+
## 2. Restart game and hot update related APIs
83+
84+
Since Cocos2d-JS v3.0 Beta, we have provided AssetsManager for assets and scripts hot update ability. Ever since, its stability is greatly improved and become reliable. Thank to our developers, we have also collected many great suggestions and feature requests. In v3.2, we decided to add two importants ones:
85+
86+
1. Clean a script's cache
87+
88+
A script will be cached in JSB, so even if you updated it with AssetsManager, it won't take effect even if you require it again. In this case, we provided `cleanScript` API to clean its cache.
89+
90+
```
91+
cc.sys.cleanScript(scriptPath);
92+
```
93+
94+
2. Restart game
95+
96+
Very often, when the hot update is done, the game need to be restarted entirely. So we provided restart game API, it will do the following steps:
97+
98+
1. Clean up Cocos2d-x's environment
99+
2. Restart the JavaScript VM
100+
3. Register all script bindings
101+
4. Re-execute the main.js
102+
103+
The API is
104+
105+
```
106+
cc.game.restart()
107+
```
108+
109+
3. Manifest's new API: getSearchPaths
110+
111+
If you want the new JavaScript files updated via AssetsManager to take effect, there are two requirements to be satisfied:
112+
113+
1. JavaScript files must be updated correctly.
114+
2. Everytime before the game start up, the search paths for the new scripts must be prepended before the execution of `cc.game.run()`. Then in `cc.game.run`, the engine will load the updated scripts.
115+
116+
This means the search paths of the updated assets must be stored locally, so we have provided a new API of Manifest to retrieve the search pahts. Then the local storage can be used to save the search paths, it's our recommended way, but developers can also use whatever they want to save the paths persistantly. Here is an recommended process after the scripts hot update via AssetsManager:
117+
118+
```
119+
// After update succeeded, updated manifest will become the new local manifest.
120+
var searchPaths = assetsManager.getLocalManifest().getSearchPaths();
121+
// The search paths can be coded to JSON string then stored in cc.sys.localStorage, so that it can be retrieved and preppended to jsb.fileUtils during the game restart.
122+
cc.sys.localStorage.setItem("AssetsSearchPaths", JSON.stringify(searchPaths));
123+
// Restart the game to let new scripts take effect.
124+
cc.game.restart();
125+
```
126+
127+
Hope these new APIs will make hot update in your game much eaiser.

samples/js-tests/src/SpineTest/SpineTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var SpineTest = BaseTestLayer.extend({
8282
// Make Spine's Animated skeleton Node
8383
// You need 'json + atlas + image' resource files to make it.
8484
// No JS binding for spine-c in this version. So, only file loading is supported.
85-
var spineBoy = new sp.SkeletonAnimation('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas');
85+
var spineBoy = sp.SkeletonAnimation.create('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas');
8686
spineBoy.setPosition(cc.p(size.width / 2, size.height / 2 - 150));
8787
spineBoy.setAnimation(0, 'walk', true);
8888
spineBoy.setMix('walk', 'jump', 0.2);

0 commit comments

Comments
 (0)